/* ============================================================
   EZON PARTNERS × FABLE 5 — ESTUDO V: TELEMETRY
   The observatory console. VARIANCE 5 · MOTION 6 · DENSITY 9
   Martian Mono only (wght 100–800 · wdth 75–112.5).
   ============================================================ */

@import url('../assets/fonts/martian-mono/font.css');

:root {
  --graphite: #0C0F0C;
  --panel: #121712;
  --grid: #1E261E;
  --phos: #C6F238;
  --phos-dim: #61754D;
  --amber: #FFB000;

  --fs-micro: 0.5625rem;   /* 9px  */
  --fs-small: 0.6875rem;   /* 11px */
  --fs-body: 0.8125rem;    /* 13px */
  --fs-h2: clamp(1.125rem, 0.9rem + 1.1vw, 1.75rem);
  --fs-hero: clamp(2.75rem, 1.4rem + 7.2vw, 8.25rem);

  --wide: 'wdth' 112.5;
  --narrow: 'wdth' 75;
  --pad: clamp(0.875rem, 0.6rem + 1.2vw, 1.5rem);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { overflow-x: clip; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--graphite);
  color: var(--phos-dim);
  font-family: 'Martian Mono', ui-monospace, monospace;
  font-size: var(--fs-body);
  font-weight: 300;
  line-height: 1.65;
  font-variant-numeric: tabular-nums;
  overflow-x: clip;
  min-height: 100vh;
}

::selection { background: var(--phos); color: var(--graphite); }

a { color: var(--phos); text-decoration: none; }
a:hover { background: var(--phos); color: var(--graphite); }

:focus-visible {
  outline: 1px solid var(--phos);
  outline-offset: 2px;
  background: #1A2413;
}

/* ---------- CRT overlay (fixed, decorative) ---------- */
.crt {
  position: fixed; inset: 0; z-index: 60;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 8%, rgba(198,242,56,0.05), transparent 55%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.22) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}
.crt::after {
  content: '';
  position: absolute; inset: 0;
  box-shadow: inset 0 0 18vmax rgba(0,0,0,0.55);
}

/* ---------- shell ---------- */
.shell { max-width: 1440px; margin: 0 auto; border-inline: 1px solid var(--grid); }
@media (min-width: 1442px) { .shell { border-inline-color: var(--grid); } }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem;
  align-items: baseline; justify-content: space-between;
  padding: 0.5rem var(--pad);
  border-bottom: 1px solid var(--grid);
  font-size: var(--fs-micro);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.statusbar .id { color: var(--phos); font-weight: 600; }
.statusbar .led::before {
  content: '●'; color: var(--phos); margin-right: 0.5em;
  animation: blink 2.4s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .statusbar .led::before { animation: none; } }

/* ---------- masthead ---------- */
.masthead { padding: calc(var(--pad) * 2) var(--pad) var(--pad); border-bottom: 1px solid var(--grid); }
.masthead .rule { color: var(--grid); font-size: var(--fs-small); overflow: hidden; white-space: nowrap; }
.masthead .kicker {
  display: flex; gap: 1.25rem; flex-wrap: wrap;
  font-size: var(--fs-micro); letter-spacing: 0.22em; text-transform: uppercase;
  margin-bottom: 1rem;
}
.masthead .kicker .em { color: var(--phos); }
.masthead h1 {
  font-size: var(--fs-hero);
  font-weight: 750;
  font-variation-settings: var(--wide);
  letter-spacing: -0.015em;
  line-height: 0.95;
  color: var(--phos);
  text-shadow: 0 0 24px rgba(198,242,56,0.35);
}
.masthead .sub {
  margin-top: 1.25rem; max-width: 62ch;
  font-size: var(--fs-small); letter-spacing: 0.04em;
}
.masthead .sub strong { color: var(--phos); font-weight: 600; }

/* ---------- cockpit grid ---------- */
.cockpit {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1px;
  background: var(--grid);
  border-bottom: 1px solid var(--grid);
}
.panel { background: var(--graphite); padding: var(--pad); min-width: 0; }
.panel > header {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
  font-size: var(--fs-micro); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--phos); font-weight: 600;
  margin-bottom: 0.875rem;
}
.panel > header .idx { color: var(--phos-dim); font-weight: 300; }

.p-sim { grid-column: span 8; padding: 0; position: relative; }
.p-metrics { grid-column: span 4; }
.p-log { grid-column: span 4; }
.p-dials { grid-column: span 4; }
.p-doctrine { grid-column: span 4; }

@media (max-width: 960px) {
  .p-sim, .p-metrics, .p-log, .p-dials, .p-doctrine { grid-column: span 12; }
}

/* ---------- sim panel ---------- */
.p-sim canvas { display: block; width: 100%; height: clamp(320px, 52vh, 560px); }
.p-sim .hud {
  position: absolute; inset: 0; pointer-events: none;
  font-size: var(--fs-micro); letter-spacing: 0.16em; text-transform: uppercase;
}
.p-sim .hud .corner { position: absolute; padding: 0.75rem 1rem; }
.p-sim .hud .tl { top: 0; left: 0; color: var(--phos); font-weight: 600; }
.p-sim .hud .tr { top: 0; right: 0; text-align: right; }
.p-sim .hud .bl { bottom: 0; left: 0; }
.p-sim .hud .br { bottom: 0; right: 0; text-align: right; color: var(--phos); }
.p-sim .hud .reticle {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  color: var(--phos-dim); opacity: 0.65;
}

/* ---------- metrics ---------- */
.metric { padding: 0.75rem 0; border-top: 1px solid var(--grid); }
.metric:first-of-type { border-top: 0; padding-top: 0; }
.metric .label {
  display: flex; justify-content: space-between;
  font-size: var(--fs-micro); letter-spacing: 0.18em; text-transform: uppercase;
}
.metric .value {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  font-weight: 700;
  font-variation-settings: var(--narrow);
  color: var(--phos);
  line-height: 1.15;
}
.metric .value .unit { font-size: 0.45em; font-weight: 300; color: var(--phos-dim); }
.metric .bar { font-size: var(--fs-small); letter-spacing: 0.08em; color: var(--phos-dim); }
.metric .bar .on { color: var(--phos); }

/* ---------- event log ---------- */
.log {
  height: 100%; min-height: 14rem; max-height: 22rem; overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-size: var(--fs-small); line-height: 1.9;
}
.log p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log p .t { color: var(--phos); font-weight: 600; }
.log p.warn .t, .log p.warn { color: var(--amber); }
.log .cursor::after {
  content: '▌'; color: var(--phos);
  animation: blink 1s steps(2, jump-none) infinite;
}
@media (prefers-reduced-motion: reduce) { .log .cursor::after { animation: none; } }

/* ---------- dials ---------- */
.dial { padding: 0.6rem 0; border-top: 1px solid var(--grid); }
.dial:first-of-type { border-top: 0; padding-top: 0; }
.dial .name {
  display: flex; justify-content: space-between;
  font-size: var(--fs-micro); letter-spacing: 0.18em; text-transform: uppercase;
  margin-bottom: 0.25rem;
}
.dial .name b { color: var(--phos); font-weight: 700; }
.dial .track { font-size: var(--fs-body); letter-spacing: 0.14em; color: var(--grid); }
.dial .track .fill { color: var(--phos); }
.dials-note { margin-top: 1rem; font-size: var(--fs-micro); letter-spacing: 0.08em; }

/* ---------- doctrine ---------- */
.p-doctrine ol { list-style: none; counter-reset: dox; }
.p-doctrine li {
  counter-increment: dox;
  padding: 0.875rem 0; border-top: 1px solid var(--grid);
  font-size: var(--fs-body); line-height: 1.7;
}
.p-doctrine li:first-child { border-top: 0; padding-top: 0; }
.p-doctrine li::before {
  content: '0' counter(dox) ' ▸ ';
  color: var(--phos); font-weight: 700; font-size: var(--fs-small);
}
.p-doctrine li strong { color: var(--phos); font-weight: 600; }

/* ---------- constellation table ---------- */
.constellation { border-bottom: 1px solid var(--grid); }
.constellation > h2, .contact > h2 {
  padding: var(--pad);
  font-size: var(--fs-micro); letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--phos); font-weight: 600;
  border-bottom: 1px solid var(--grid);
}
.constellation table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.constellation th, .constellation td {
  text-align: left; padding: 0.7rem var(--pad);
  border-bottom: 1px solid var(--grid);
  font-weight: 300; letter-spacing: 0.05em;
}
.constellation thead th {
  font-size: var(--fs-micro); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--phos-dim);
}
.constellation tbody tr:last-child td { border-bottom: 0; }
.constellation td.name { color: var(--phos); font-weight: 600; font-variation-settings: var(--wide); }
.constellation td.this { color: var(--phos); }
.constellation a { display: inline-block; }
@media (max-width: 700px) {
  .constellation .hide-s { display: none; }
}

/* ---------- contact (single amber element) ---------- */
.contact { border-bottom: 1px solid var(--grid); }
.contact .row {
  display: flex; flex-wrap: wrap; gap: var(--pad);
  align-items: center; justify-content: space-between;
  padding: calc(var(--pad) * 1.4) var(--pad);
}
.contact .msg { max-width: 46ch; font-size: var(--fs-small); }
.contact .cta {
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 0.8rem 1.4rem;
  font-size: var(--fs-small); font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.contact .cta:hover { background: var(--amber); color: var(--graphite); }
.contact .cta:focus-visible { outline-color: var(--amber); background: transparent; }

/* ---------- footer ---------- */
footer.site {
  padding: var(--pad);
  font-size: var(--fs-micro); letter-spacing: 0.14em; text-transform: uppercase;
  display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; justify-content: space-between;
}
footer.site .emblem { width: 30px; height: 30px; color: var(--phos); }
footer.site .rule { width: 100%; color: var(--grid); overflow: hidden; white-space: nowrap; font-size: var(--fs-small); }

/* ---------- reveal (IO) ---------- */
.io { opacity: 0; transform: translateY(10px); transition: opacity 0.5s ease, transform 0.5s ease; }
.io.on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .io { opacity: 1; transform: none; transition: none; }
}
