/* ============================================================
   DOLMEN SOUNDS — FUNCTIONAL TERMINAL
   Design tokens + 1px industrial border system.
   Rules: 1px borders, no rounded edges, no gradients in chrome,
   #00FF41 accents only. See CLAUDE.md before changing tokens.
   ============================================================ */

:root {
  --bg:      #000000;
  --bg-deep: #020503;            /* near-black w/ green undertone (Nuada bridge) */
  --ink:     #ffffff;
  --term:    #00ff41;            /* terminal green — ACCENTS ONLY */
  --forest:  #0e2a20;            /* Nuada forest green — imagery/previews only, never chrome */
  --dim:     rgba(255,255,255,.55);
  --ghost:   rgba(255,255,255,.16);
  --line:    1px solid var(--ink);
  --line-dim:1px solid rgba(255,255,255,.35);

  /* Type roles. Display type is the SVG wordmark; these are functional stacks.
     No webfont requests in v0.x (weight + privacy). Upgrade path in CLAUDE.md. */
  --font-tech: "Arial Narrow", "Helvetica Neue", Haettenschweiler, "Franklin Gothic Medium", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Courier New", monospace;

  --track: 0.18em;               /* functional small-cap tracking */
}

* { margin: 0; padding: 0; box-sizing: border-box; border-radius: 0 !important; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-tech);
  overflow: hidden;               /* stages are fixed viewports; internal panes may scroll */
  -webkit-font-smoothing: antialiased;
}

#app { position: fixed; inset: 0; }

/* ---- stage roots ------------------------------------------------ */
.stage { position: absolute; inset: 0; background: var(--bg); }
.stage[data-leaving] { pointer-events: none; }

/* ---- functional text -------------------------------------------- */
.t-tech  { font-family: var(--font-tech); text-transform: uppercase; letter-spacing: var(--track); }
.t-mono  { font-family: var(--font-mono); }
.t-dim   { color: var(--dim); }
.t-ghost { color: var(--ghost); }
.t-term  { color: var(--term); }
.t-xs    { font-size: 10px; }
.t-sm    { font-size: 12px; }

/* ---- 1px furniture ---------------------------------------------- */
.box       { border: var(--line); background: var(--bg); }
.box-dim   { border: var(--line-dim); }

.btn {
  display: inline-block;
  border: var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-tech);
  text-transform: uppercase;
  letter-spacing: var(--track);
  font-size: 12px;
  padding: 10px 22px;
  cursor: pointer;
  user-select: none;
}
.btn:hover, .btn:focus-visible { background: var(--ink); color: var(--bg); outline: none; }
.btn:focus-visible { box-shadow: 0 0 0 1px var(--term); }
.btn--solid { background: var(--ink); color: var(--bg); }
.btn--solid:hover { background: var(--term); border-color: var(--term); color: var(--bg); }
.btn[disabled] { opacity: .3; pointer-events: none; }

input.field {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .12em;
  padding: 8px 2px;
}
input.field:focus { outline: none; border-bottom-color: var(--term); }
input.field::placeholder { color: var(--ghost); text-transform: uppercase; }

/* ---- scanline / grain overlays (imagery only) -------------------- */
.scanlines::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0,0,0,.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
.flicker { animation: flick 7s steps(1) infinite; }
@keyframes flick {
  0%,93%,100% { opacity: 1; }
  94%        { opacity: .86; }
  95%        { opacity: 1; }
  97.5%      { opacity: .92; }
}

/* ---- INIT / BOOT -------------------------------------------------- */
.boot-center { position: absolute; inset: 0; display: grid; place-items: center; }
.boot-mark   { width: min(72vw, 620px); position: relative; }
.boot-foot   { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; transition: opacity .42s linear; }
.boot-canvas { position: absolute; pointer-events: none; }

/* ---- GATE --------------------------------------------------------- */
.gate-bg     { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.gate-mark   { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -58%); width: min(78vw, 760px); }
.gate-cta    { position: absolute; bottom: 7vh; left: 50%; transform: translateX(-50%); }
.flash       { position: absolute; inset: 0; background: var(--ink); opacity: 0; pointer-events: none; }

/* ---- AUTH --------------------------------------------------------- */
.auth-dim  { position: absolute; inset: 0; background: rgba(0,0,0,.62); }
.auth-box  {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(86vw, 380px); border: var(--line); background: rgba(0,0,0,.85);
  padding: 22px 22px 26px;
}
.auth-head { display: flex; justify-content: space-between; border-bottom: var(--line); padding-bottom: 10px; margin-bottom: 22px; }
.auth-row  { margin-bottom: 20px; }
.auth-msg  { min-height: 14px; margin: 2px 0 14px; font-size: 10px; letter-spacing: .14em; }
.auth-box.deny { animation: deny .18s steps(2) 2; }
@keyframes deny { 50% { transform: translate(calc(-50% + 5px), -50%); } }

/* ---- DASHBOARD ----------------------------------------------------- */
.dash        { display: flex; flex-direction: column; height: 100%; background: var(--bg-deep); }
.dash-head   {
  position: relative; flex: 0 0 33vh; min-height: 180px; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  border-bottom: var(--line);
  padding: clamp(20px, 4vh, 56px) clamp(24px, 6vw, 88px);
}
.dash-mark   { width: min(58vw, 560px, 96vh); }
.dash-meta   { position: absolute; left: clamp(24px, 6vw, 88px); bottom: 12px; }
.dash-grid   {
  flex: 1; display: grid; gap: clamp(16px, 2.4vw, 28px);
  padding: clamp(24px, 4vh, 56px) clamp(24px, 6vw, 88px);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  align-content: stretch; overflow-y: auto;
}
.card {
  position: relative; border: var(--line); background: var(--bg);
  display: flex; flex-direction: column; min-height: 220px; cursor: pointer;
}
.card:hover .card-label, .card:focus-visible .card-label { color: var(--term); }
.card:focus-visible { outline: 1px solid var(--term); outline-offset: -3px; }
.card-preview { flex: 1; position: relative; overflow: hidden; border-bottom: var(--line); background: var(--bg-deep); }
.card-preview canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.card-meta   { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 12px; }
.card-label  { font-size: 13px; letter-spacing: var(--track); }
.card-glyph  { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; opacity: .9; }
.card-idx    { font-size: 10px; color: var(--ghost); }


/* ---- OBSERVER TERMINAL --------------------------------------------- */
.term        { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.term-head   { display: flex; align-items: center; justify-content: space-between; border-bottom: var(--line); padding: 10px 88px 10px 16px; }
.term-grid   { flex: 1; display: grid; grid-template-columns: 1fr 1.35fr 1fr; min-height: 0; }
.term-col    { border-right: var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.term-col:last-child { border-right: 0; }
.term-col-head { border-bottom: var(--line); padding: 8px 12px; font-size: 11px; letter-spacing: var(--track); display: flex; justify-content: space-between; }
.term-col-body { flex: 1; position: relative; min-height: 0; padding: 14px; overflow-y: auto; }

.dropzone {
  border: var(--line); height: 42%; min-height: 150px; display: grid; place-items: center;
  text-align: center; font-size: 11px; letter-spacing: var(--track); color: var(--dim);
  cursor: pointer;
}
.dropzone.armed { border-color: var(--term); color: var(--term); }
.readout { margin-top: 14px; font-family: var(--font-mono); font-size: 10px; line-height: 1.9; color: var(--dim); word-break: break-all; }
.readout b { color: var(--ink); font-weight: normal; }

.obs-wrap  { position: absolute; inset: 0; }
.obs-wrap canvas { width: 100%; height: 100%; display: block; }
.hud { position: absolute; font-family: var(--font-mono); font-size: 9px; color: var(--ink); opacity: .34; pointer-events: none; white-space: pre; }
.hud.tl { top: 8px; left: 10px; } .hud.tr { top: 8px; right: 10px; text-align: right; }
.hud.bl { bottom: 8px; left: 10px; } .hud.br { bottom: 8px; right: 10px; text-align: right; }

.param      { margin-bottom: 26px; }
.param-head { display: flex; justify-content: space-between; font-size: 10px; letter-spacing: var(--track); margin-bottom: 8px; }
.param-val  { font-family: var(--font-mono); color: var(--dim); }
.slider     { position: relative; height: 18px; border: var(--line); cursor: ew-resize; touch-action: none; }
.slider-fill{ position: absolute; top: 0; bottom: 0; left: 0; background: rgba(255,255,255,.14); }
.slider-needle { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--ink); }
.slider:focus-visible { outline: 1px solid var(--term); outline-offset: 2px; }

.term-action { margin-top: 8px; width: 100%; padding: 14px 0; font-size: 13px; }
.term-note   { margin-top: 12px; font-family: var(--font-mono); font-size: 9px; color: var(--ghost); line-height: 1.8; }

/* ---- fixed chrome ---------------------------------------------------- */
.snd-toggle { position: fixed; top: 10px; right: 10px; z-index: 60; font-size: 9px; padding: 5px 9px; letter-spacing: .14em; }
.back-link  { background: none; border: 0; color: var(--dim); font-family: var(--font-tech); font-size: 10px; letter-spacing: var(--track); text-transform: uppercase; cursor: pointer; }
.back-link:hover { color: var(--term); }

/* ---- responsive: stack the 3-block grid, keep 1px logic --------------- */
@media (max-width: 860px) {
  html, body { overflow: auto; }
  .term-grid { grid-template-columns: 1fr; overflow-y: auto; }
  .term-col  { border-right: 0; border-bottom: var(--line); min-height: 340px; }
  .term-col:last-child { border-bottom: 0; }
  .dash-grid { grid-template-columns: 1fr; }
  }

@media (prefers-reduced-motion: reduce) {
  .flicker { animation: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* auth as a node gate — return path stays inside the box (rule 2) */
.auth-back { display: block; width: 100%; margin-top: 16px; text-align: center; }
