/* ErlangEYE design system — one source for every surface.
   85–90% near-black, 8–12% grey/white, 1–3% mint. The mint is rare on purpose. */

:root {
  --bg-primary: #030506;
  --bg-secondary: #070A0A;
  --bg-tertiary: #0A0E0E;
  --bg-raised: #0D1212;

  --text-primary: #D7DEE2;
  --text-secondary: #8A969D;
  --text-muted: #4E5A60;

  --border: #182123;
  --border-strong: #263235;
  --border-active: rgba(99, 215, 181, .45);

  --accent: #63D7B5;
  --accent-bright: #7AE8C7;
  --accent-dim: #2E7666;
  --accent-glow: rgba(99, 215, 181, .12);
  --accent-line: rgba(99, 215, 181, .025);

  --amber: #B9925A;
  --red: #A85A5A;

  --mono: "IBM Plex Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --display: "Space Grotesk", "IBM Plex Sans", system-ui, sans-serif;

  --radius: 2px;
  --t-fast: 150ms;
  --t-slow: 400ms;
}

* { box-sizing: border-box; }
html { background: var(--bg-primary); color-scheme: dark; }
body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: 13px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* The field: a grid that is barely there, and a very faint grain. */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--accent-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--accent-line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 85%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, transparent 0px, transparent 3px, rgba(255,255,255,.008) 4px);
}
.stage { position: relative; z-index: 1; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-bright); }
::selection { background: rgba(99,215,181,.25); color: var(--text-primary); }

/* ── type ─────────────────────────────────────────────────────────────── */
.display { font-family: var(--display); font-weight: 500; letter-spacing: .02em; }
.logo {
  font-family: var(--display); font-weight: 500; letter-spacing: .28em; text-transform: uppercase;
  color: var(--text-primary); white-space: nowrap;
}
.logo b { color: var(--accent); font-weight: 500; }
.label {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-muted);
}
.label.on { color: var(--accent); }
.value { font-family: var(--display); font-size: 22px; font-weight: 500; letter-spacing: .01em; color: var(--text-primary); }
.value.small { font-size: 16px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; margin: 0; }
.dim { color: var(--text-secondary); }
.muted { color: var(--text-muted); }
.mint { color: var(--accent); }
.amber { color: var(--amber); }
.red { color: var(--red); }

/* ── console bar (navigation) ─────────────────────────────────────────── */
.console {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 28px;
  height: 44px; padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(3,5,6,.86); backdrop-filter: blur(6px);
}
.console .logo { font-size: 13px; }
.console nav { display: flex; gap: 22px; margin-left: 12px; }
.console nav a, .console nav button {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-secondary); position: relative; transition: color var(--t-fast);
}
.console nav a:hover, .console nav button:hover { color: var(--text-primary); }
.console nav .on { color: var(--accent); }
.console nav .on::before { content: "● "; font-size: 8px; vertical-align: 1px; }
.console .signal { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-secondary); }

/* ── status language ──────────────────────────────────────────────────── */
.status { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.status::before { display: inline-block; width: 1.2em; }
.status.online { color: var(--accent); } .status.online::before { content: "●"; }
.status.processing { color: var(--accent); } .status.processing::before { content: "◉"; animation: breathe 2.4s ease-in-out infinite; }
.status.idle { color: var(--text-muted); } .status.idle::before { content: "○"; }
.status.offline { color: var(--text-muted); } .status.offline::before { content: "○"; }
.status.remote { color: var(--text-secondary); } .status.remote::before { content: "◌"; }
.status.warn { color: var(--amber); } .status.warn::before { content: "◆"; }
.status.crit { color: var(--red); } .status.crit::before { content: "◆"; }
.dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--border-strong); vertical-align: middle;
}
.dot.online { background: var(--accent); box-shadow: 0 0 10px var(--accent-glow), 0 0 4px rgba(99,215,181,.5); animation: breathe 3s ease-in-out infinite; }
.dot.remote { background: var(--text-muted); }
.dot.warn { background: var(--amber); }

/* ── panels: command modules, not cards ───────────────────────────────── */
.panel {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(7,10,10,.55); position: relative;
  transition: border-color var(--t-fast);
}
.panel > header {
  display: flex; align-items: center; gap: 12px;
  height: 30px; padding: 0 12px;
  border-bottom: 1px solid var(--border);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-secondary);
}
.panel > header::before { content: "┌─"; color: var(--border-strong); letter-spacing: 0; }
.panel > header .right { margin-left: auto; color: var(--text-muted); letter-spacing: .06em; }
.panel > .body { padding: 14px; }
.panel.active { border-color: var(--border-active); box-shadow: 0 0 20px var(--accent-glow); }
.panel:hover { border-color: var(--border-strong); }

.fields { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; align-items: baseline; }
.fields .label { padding-top: 2px; }
.fields .v { font-size: 12px; color: var(--text-primary); }

.rule { height: 1px; background: var(--border); border: 0; margin: 0; }
.tick { color: var(--border-strong); }

/* ── terminal blocks ──────────────────────────────────────────────────── */
.terminal {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-secondary); padding: 12px 14px;
  font-family: var(--mono); font-size: 12px; line-height: 1.8; color: var(--text-secondary);
}
.terminal .ln::before { content: "> "; color: var(--text-muted); }
.terminal .ln.lit { color: var(--accent); }
.terminal .ln.lit::before { color: var(--accent-dim); }
.cursor { display: inline-block; width: .55em; height: 1em; background: var(--accent); vertical-align: -2px; margin-left: 2px; animation: blink 1.4s steps(1) infinite; }

/* ── commands ─────────────────────────────────────────────────────────── */
.cmd {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: transparent; color: var(--text-primary); cursor: pointer;
  font: 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), color var(--t-fast);
}
.cmd::before { content: ">"; color: var(--accent-dim); transition: color var(--t-fast); }
.cmd:hover { border-color: var(--border-active); box-shadow: 0 0 20px var(--accent-glow); color: var(--accent-bright); }
.cmd:hover::before { content: ">>"; color: var(--accent); }
.cmd.primary { border-color: var(--accent-dim); color: var(--accent); }
.cmd:focus-visible, button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 1px solid var(--accent); outline-offset: 2px;
}

/* ── inputs ───────────────────────────────────────────────────────────── */
input, select {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-primary); padding: 7px 10px; font: 12px var(--mono);
}
input::placeholder { color: var(--text-muted); }
input:focus, select:focus { border-color: var(--border-active); outline: 0; }
select option { background: var(--bg-raised); }

/* ── tables as instruments ────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--border-strong);
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 400;
}
td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; color: var(--text-secondary); }
td.v { color: var(--text-primary); }
tr:hover td { background: rgba(99,215,181,.03); }

/* ── empty / loading states ───────────────────────────────────────────── */
.void { padding: 48px 0; text-align: center; }
.void .h { font-family: var(--display); font-size: 14px; letter-spacing: .2em; color: var(--text-secondary); }
.void .s { font-size: 11px; letter-spacing: .1em; color: var(--text-muted); margin-top: 10px; }
.void .s::after { content: "…"; }
.init { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); padding: 24px 0; }
.init::after { content: ""; display: inline-block; width: 2.6em; text-align: left; animation: dots 1.2s steps(4) infinite; }

/* ── motion ───────────────────────────────────────────────────────────── */
@keyframes breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes blink { 50% { opacity: 0; } }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes orbit-r { to { transform: rotate(-360deg); } }
@keyframes scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cursor { opacity: 1; }
}

/* ── HUD chrome ───────────────────────────────────────────────────────── */
.hud { position: relative; }
.hud::before, .hud::after {
  content: ""; position: absolute; width: 10px; height: 10px; pointer-events: none;
  border-color: var(--accent-dim); border-style: solid; border-width: 0;
}
.hud::before { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.hud::after { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.hud.active::before, .hud.active::after { border-color: var(--accent); }
.ticker {
  height: 22px; overflow: hidden; border-bottom: 1px solid var(--border);
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted);
  background: rgba(3,5,6,.9); position: relative;
}
.ticker .track { position: absolute; white-space: nowrap; line-height: 22px; padding-left: 100%; animation: ticker 90s linear infinite; }
.ticker .track span { margin-right: 44px; }
.ticker .track b { color: var(--accent); font-weight: 400; }
.ticker .track i { color: var(--amber); font-style: normal; }
.ticker:hover .track { animation-play-state: paused; }
@keyframes ticker { to { transform: translateX(-100%); } }
.sweep { position: relative; overflow: hidden; }
.sweep::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%;
  background: linear-gradient(90deg, transparent, rgba(99,215,181,.10), transparent);
  animation: sweep 1.4s ease-out 1;
  pointer-events: none;
}
@keyframes sweep { to { left: 110%; } }
.lit-words span { transition: color .5s, text-shadow .5s; }
.lit-words span.on { color: var(--accent-bright); text-shadow: 0 0 8px var(--accent-glow); }
#neural { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: .75; }

/* ── markdown from the minds ──────────────────────────────────────────── */
.md p { margin: 0 0 6px; } .md p:last-child { margin-bottom: 0; }
.md code { font-family: var(--mono); font-size: 11.5px; background: var(--bg-raised); border: 1px solid var(--border); padding: 0 4px; border-radius: 2px; color: var(--text-primary); }
.md pre { margin: 6px 0; padding: 10px 12px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: 2px; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; font-size: 11.5px; line-height: 1.6; color: var(--text-secondary); }
.md ul, .md ol { margin: 4px 0 6px; padding-left: 20px; } .md li { margin: 2px 0; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 10px 0 4px; font-weight: 500; }
.md blockquote { margin: 6px 0; padding: 2px 12px; border-left: 2px solid var(--accent-dim); color: var(--text-muted); }
.md table { margin: 6px 0; font-size: 11.5px; } .md th, .md td { padding: 4px 8px; }
.md a { color: var(--accent); border-bottom: 1px dotted var(--accent-dim); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
.md strong { color: var(--text-primary); font-weight: 500; }
.md img { max-width: 100%; }
.md .at { color: var(--accent); }

/* ── layout helpers ───────────────────────────────────────────────────── */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 22px; }
.grid { display: grid; gap: 14px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }
.scroll-x { overflow-x: auto; }
