/* ============================================================
   wieman-dash — Operations console.
   Matches wiemansystems.com: Space Grotesk + Space Mono,
   monochrome, hard borders, offset shadows, 52px grid.
   ============================================================ */

@font-face {
  font-family: "Space Grotesk";
  src: url(/fonts/space-grotesk-latin.woff2) format("woff2");
  font-weight: 300 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url(/fonts/space-mono-400-latin.woff2) format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Space Mono";
  src: url(/fonts/space-mono-700-latin.woff2) format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --black: #000; --white: #fff;
  --g100: #f5f5f5; --g200: #e5e5e5; --g300: #d4d4d4; --g400: #a3a3a3;
  --g500: #737373; --g600: #525252; --g700: #404040; --g800: #262626; --g900: #171717;
  --ok: #15803d; --ok-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2;
  --display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --wrap: 1240px;
  --gutter: clamp(18px, 4.5vw, 56px);
  --ease: cubic-bezier(.65, .05, .36, 1);
  --shadow: 6px 6px 0 var(--black);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--white); color: var(--black);
  font-family: var(--display); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(0,0,0,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,.045) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: radial-gradient(140% 100% at 50% -10%, #000 50%, transparent 100%);
}
.hidden { display: none !important; }
.muted { color: var(--g500); }
a { color: inherit; }

.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 400;
  text-transform: uppercase; letter-spacing: .22em; color: var(--g500);
}

/* ---- buttons ---- */
button {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  background: var(--white); color: var(--black);
  border: 1px solid var(--black); border-radius: 0; padding: 9px 16px; cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
button:hover { background: var(--black); color: var(--white); }
button.primary { background: var(--black); color: var(--white); box-shadow: var(--shadow); }
button.primary:hover { transform: translate(-2px, -2px); box-shadow: 9px 9px 0 var(--black); }
button.ghost { border-color: var(--g300); color: var(--g600); }
button.ghost:hover { border-color: var(--black); background: var(--black); color: var(--white); }
#refresh .ico { display: inline-block; }
#refresh.spinning .ico { animation: spin .7s linear infinite; }

/* ============================================================
   LOGIN
   ============================================================ */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card {
  position: relative; background: var(--white); border: 1px solid var(--black); box-shadow: var(--shadow);
  padding: 44px 40px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px;
  animation: rise .5s var(--ease) both;
}
.login-card .kicker { margin-bottom: 4px; }
.login-card h1 { margin: 0; font-weight: 700; font-size: 34px; line-height: 1.02; letter-spacing: -.035em; }
.login-card h1 .accent { display: block; color: var(--g400); }
.login-card .sub { margin: 0 0 8px; color: var(--g500); font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.login-card input {
  font-family: var(--mono); font-size: 14px; background: var(--white); color: var(--black);
  border: 1px solid var(--black); border-radius: 0; padding: 14px; outline: none; transition: box-shadow .18s var(--ease);
}
.login-card input::placeholder { color: var(--g400); letter-spacing: .1em; }
.login-card input:focus { box-shadow: 4px 4px 0 var(--black); }
.login-card button { padding: 14px; font-size: 13px; }
.error { color: var(--bad); font-family: var(--mono); font-size: 12px; margin: 0; }

/* ============================================================
   SHELL
   ============================================================ */
main { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter) 80px; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 30px 0 20px; margin-bottom: 24px; border-bottom: 1px solid var(--black);
}
.brand { display: flex; flex-direction: column; gap: 5px; }
.brand .title { font-weight: 700; font-size: 26px; letter-spacing: -.03em; line-height: 1; }
.brand .title .arrow { color: var(--g400); }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#updated { font-family: var(--mono); font-size: 11px; color: var(--g500); letter-spacing: .04em; }

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); position: relative; }
.live-dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--ok); animation: ping 1.8s var(--ease) infinite;
}

section { margin-top: 34px; }
.section-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .22em; }
.section-head .count { font-family: var(--mono); font-size: 11px; color: var(--g400); text-transform: uppercase; letter-spacing: .12em; }
.section-head .rule { flex: 1; height: 1px; background: var(--g200); }

/* ---- hero status ---- */
.hero {
  margin-top: 26px; display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border: 1px solid var(--black); box-shadow: var(--shadow); background: var(--white); padding: 22px 26px;
}
.hero-main { display: flex; align-items: center; gap: 20px; }
.hero-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--g400); position: relative; flex: none; }
.hero-dot::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px solid currentColor; opacity: 0; }
.hero-dot.is-ok { background: var(--ok); color: var(--ok); }
.hero-dot.is-bad { background: var(--bad); color: var(--bad); }
.hero-dot.is-warn { background: var(--warn); color: var(--warn); }
.hero-dot.is-ok::after, .hero-dot.is-bad::after, .hero-dot.is-warn::after { animation: ping 1.8s var(--ease) infinite; }
.hero-status { font-weight: 700; font-size: 26px; letter-spacing: -.03em; line-height: 1.05; }
.hero-sub { font-family: var(--mono); font-size: 12px; color: var(--g500); margin-top: 4px; letter-spacing: .02em; }
.hero-spark { display: flex; align-items: flex-end; gap: 5px; height: 40px; }
.hero-spark .hbar { width: 9px; background: var(--g200); border: 1px solid var(--black); transform-origin: bottom; }
.hero-spark .hbar.is-ok { background: var(--ok); } .hero-spark .hbar.is-warn { background: var(--warn); } .hero-spark .hbar.is-bad { background: var(--bad); }

/* ---- stat strip ---- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border: 1px solid var(--black); margin-top: 22px; }
.stat { padding: 15px 18px; border-right: 1px solid var(--g200); display: flex; flex-direction: column; gap: 6px; }
.stat:last-child { border-right: 0; }
.stat .stat-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .18em; color: var(--g500); }
.stat .stat-value { font-weight: 700; font-size: 24px; letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; line-height: 1; }
.stat .stat-value .unit { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--g400); letter-spacing: 0; }
.stat.is-ok .stat-value { color: var(--ok); } .stat.is-warn .stat-value { color: var(--warn); } .stat.is-bad .stat-value { color: var(--bad); }

/* ============================================================
   PROJECT CARDS
   ============================================================ */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.card {
  position: relative; background: var(--white); border: 1px solid var(--black); padding: 20px;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease);
}
.card::before {
  content: ""; position: absolute; left: -1px; top: -1px; height: 3px; width: calc(100% + 2px);
  background: var(--black); transform: scaleX(0); transform-origin: left; transition: transform .28s var(--ease);
}
.card:hover { transform: translate(-3px, -3px); box-shadow: var(--shadow); }
.card:hover::before { transform: scaleX(1); }
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-name { font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.card-url { font-family: var(--mono); font-size: 11.5px; margin-top: 2px; }
.card-url a { color: var(--g600); text-decoration: none; border-bottom: 1px solid var(--g300); transition: border-color .15s, color .15s; }
.card-url a:hover { color: var(--black); border-color: var(--black); }

.metrics { margin-top: 16px; display: flex; flex-direction: column; gap: 11px; }
.metric { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: center; }
.metric-label { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--g400); }
.metric-val { display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px; color: var(--g800); flex-wrap: wrap; }
.metric-val .commit-msg { color: var(--black); }
.metric-val .ago, .metric-val .dim { color: var(--g400); }
.lat { font-weight: 700; }
.lat.fast { color: var(--ok); } .lat.mid { color: var(--warn); } .lat.slow { color: var(--bad); }

/* sparkline */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 24px; }
.spark-bar { width: 7px; min-height: 3px; background: var(--g300); border: 1px solid var(--black); transform-origin: bottom; animation: grow .5s var(--ease) both; }
.spark-bar.is-ok { background: var(--ok); } .spark-bar.is-warn { background: var(--warn); } .spark-bar.is-bad { background: var(--bad); } .spark-bar.is-neutral { background: var(--g300); }

/* security segment meter */
.seg-meter { display: flex; gap: 3px; }
.seg { width: 16px; height: 9px; border: 1px solid var(--black); background: var(--white); animation: pop .4s var(--ease) both; }
.seg.on { background: var(--ok); } .seg.off { background: var(--white); }
.seg-meter.partial .seg.on { background: var(--warn); }
.seg-meter.low .seg.on { background: var(--bad); }

/* chips footer */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--g200); }
.chip {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  border: 1px solid var(--g300); padding: 3px 8px; color: var(--g600); display: inline-flex; align-items: center; gap: 5px;
}
.chip.accent { border-color: var(--black); color: var(--black); }

/* badges + dots */
.badge {
  display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; border: 1px solid var(--g300); padding: 4px 9px; white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--g400); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.badge.is-ok { border-color: var(--ok); color: var(--ok); } .badge.is-ok .dot.ok { box-shadow: 0 0 0 3px var(--ok-bg); }
.badge.is-bad { border-color: var(--bad); color: var(--bad); }
.badge.is-warn { border-color: var(--warn); color: var(--warn); }
.badge.is-neutral { border-color: var(--g300); color: var(--g500); }

/* ============================================================
   LOWER: activity feed + services
   ============================================================ */
.lower { display: grid; grid-template-columns: 1.5fr 1fr; gap: 28px; margin-top: 8px; align-items: start; }
.lower-main, .lower-side { min-width: 0; }
.lower-side section:first-child { margin-top: 34px; }

.feed { border: 1px solid var(--black); }
.feed-item {
  display: grid; grid-template-columns: 30px 1fr auto; gap: 12px; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--g200); animation: fadeup .4s var(--ease) both;
}
.feed-item:last-child { border-bottom: 0; }
.feed-ico {
  width: 24px; height: 24px; border: 1px solid var(--black); display: grid; place-items: center;
  font-family: var(--mono); font-size: 11px; font-weight: 700;
}
.feed-ico.commit { background: var(--white); } .feed-ico.deploy { background: var(--black); color: var(--white); }
.feed-ico.deploy.is-bad { background: var(--bad); border-color: var(--bad); }
.feed-body { min-width: 0; }
.feed-proj { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.feed-title { font-size: 13px; color: var(--g600); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { font-family: var(--mono); font-size: 10px; color: var(--g400); white-space: nowrap; letter-spacing: .04em; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.mini {
  border: 1px solid var(--black); padding: 14px 16px;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.mini:hover { transform: translate(-2px, -2px); box-shadow: 4px 4px 0 var(--black); }
.mini-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.mini-name { font-weight: 700; font-size: 14px; }
.mini-row { font-family: var(--mono); font-size: 11px; color: var(--g500); margin-top: 7px; display: flex; gap: 8px; }
.mini-row .k { color: var(--g400); text-transform: uppercase; letter-spacing: .12em; }

.empty { font-family: var(--mono); font-size: 12px; color: var(--g500); border: 1px dashed var(--g300); padding: 16px 18px; }

footer {
  margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--g200);
  font-family: var(--mono); font-size: 11px; color: var(--g400); text-transform: uppercase; letter-spacing: .14em; text-align: center;
}

/* ============================================================
   ANIMATION
   ============================================================ */
.reveal { animation: fadeup .55s var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { opacity: .7; transform: scale(.8); } 70%, 100% { opacity: 0; transform: scale(1.7); } }

@media (max-width: 880px) { .lower { grid-template-columns: 1fr; gap: 8px; } .lower-side section:first-child { margin-top: 34px; } }
@media (max-width: 560px) { .hero { flex-direction: column; align-items: flex-start; gap: 18px; } .metric { grid-template-columns: 58px 1fr; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
