/* ═══════════════════════════════════════════════════════════
   REPLY GENIX — The Outbound Console
   Two-color world: ink ↔ paper. Cyan budget: 4 uses, few px each.
   Display: Clash Display ≤500. Instrument: JetBrains Mono.
   ═══════════════════════════════════════════════════════════ */

:root {
  --ink: #0a0a0b;
  --ink-soft: #131315;
  --paper: #f4f2ee;
  --paper-soft: #eae7e1;
  --dim-on-ink: #7d7c78;
  --dim-on-paper: #6f6d68;
  --line-on-ink: rgba(244, 242, 238, 0.14);
  --line-on-paper: rgba(10, 10, 11, 0.14);
  /* the entire cyan budget */
  --cyan: #00e5ff;

  --fg: var(--paper);
  --dim: var(--dim-on-ink);
  --line: var(--line-on-ink);

  --font-display: "Clash Display", "Arial Narrow", sans-serif;
  --font-mono: "JetBrains Mono", Consolas, monospace;

  --pad-x: clamp(1.25rem, 5vw, 5rem);
}

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

html { scrollbar-width: thin; scrollbar-color: #3a3a3c transparent; }

body {
  background: var(--ink);
  color: var(--fg);
  font-family: var(--font-display);
  font-weight: 400;
  overflow-x: hidden;
  min-height: 100dvh;
}

/* zone flip: paper zones re-map the shared tokens */
body[data-zone="paper"] {
  --fg: #0a0a0b;
  --dim: var(--dim-on-paper);
  --line: var(--line-on-paper);
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
.mono {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

::selection { background: var(--fg); color: var(--ink); }
body[data-zone="paper"] ::selection { color: var(--paper); }

@media (prefers-reduced-motion: no-preference) {
  body { transition: background-color 0.6s ease; }
}

/* ══ Instrument layer ══════════════════════════════════════ */

.console-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem var(--pad-x);
  mix-blend-mode: difference;
  color: #f4f2ee;
  pointer-events: none;
}
.console-bar a, .console-bar .wordmark { pointer-events: auto; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.02em;
}
.wordmark span { font-weight: 400; opacity: 0.6; }

.bar-meta { display: flex; gap: 2rem; align-items: center; }
.clock-readout { opacity: 0.75; font-variant-numeric: tabular-nums; }

.bar-cta { position: relative; }
.bar-cta::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: -3px;
  height: 1px;
  background: var(--cyan); /* cyan use 1 of 4: nav hover underline */
  transition: right 0.25s ease;
}
.bar-cta:hover::after, .bar-cta:focus-visible::after { right: 0; }
.bar-cta:focus-visible { outline: 1px solid #f4f2ee; outline-offset: 3px; }

.coord-readout {
  position: fixed;
  left: var(--pad-x); bottom: 1.1rem;
  z-index: 50;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.coord-readout span { color: var(--fg); } /* values pop, brackets stay dim */

.chapter-rail {
  position: fixed;
  right: var(--pad-x); bottom: 1.1rem;
  z-index: 50;
  color: var(--dim);
  display: flex;
  gap: 0.6rem;
  align-items: center;
  font-variant-numeric: tabular-nums;
}
.rail-bullet {
  color: var(--cyan); /* cyan use 2 of 4: the live chapter bullet */
  font-size: 0.5rem;
}
.rail-label { color: var(--fg); }

/* ══ Signal path ═══════════════════════════════════════════ */

#signal-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: visible;
}
#signal-trace {
  stroke: var(--fg);
  stroke-width: 1.5;
  opacity: 0.5;
}
#signal-glow {
  /* cyan use 3 of 4: short bright trail just behind the head */
  stroke: var(--cyan);
  stroke-width: 1.5;
}
#signal-head {
  fill: var(--cyan); /* same budget item as the trail: the head itself */
}
#signal-halo {
  fill: rgba(0, 229, 255, 0.22); /* glow without a filter: filters force full-SVG repaints */
}

.node-anchor {
  display: inline-block;
  width: 10px; height: 10px;
  position: relative;
}
.node-anchor::before {
  content: "";
  position: absolute; inset: 1px;
  border: 1px solid var(--dim);
  border-radius: 50%;
  transition: transform 0.3s ease, border-color 0.3s ease;
}
.node-anchor.lit::before {
  border-color: var(--fg);
  transform: scale(1.7);
}

/* ══ Chapter scaffolding ═══════════════════════════════════ */

.chapter {
  position: relative;
  padding: clamp(6rem, 14vh, 10rem) var(--pad-x);
  z-index: 10;
}

.eyebrow {
  color: var(--dim);
  margin-bottom: 1.6rem;
}

.ch-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2.6rem, 7.5vw, 6.5rem);
  line-height: 0.94;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-wrap: balance;
}

.ch-head { margin-bottom: clamp(2.5rem, 6vh, 4.5rem); max-width: 70rem; }

.ch-body.split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: start;
}
.ch-body.split.reverse { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); }

.ch-copy .lead {
  font-size: clamp(1.25rem, 2.2vw, 1.7rem);
  line-height: 1.35;
  margin-bottom: 1.4rem;
  max-width: 32ch;
}
.ch-copy p:not(.lead) {
  color: var(--dim);
  line-height: 1.6;
  font-size: 1.02rem;
  max-width: 52ch;
  margin-bottom: 2rem;
}

.spec-list { list-style: none; display: grid; gap: 0.65rem; color: var(--dim); }

.ch-media img {
  width: 100%;
  filter: grayscale(1) contrast(1.05);
  border: 1px solid var(--line);
}
.ch-media figcaption { margin-top: 0.7rem; color: var(--dim); }

/* ══ [00] Hero ═════════════════════════════════════════════ */

.hero {
  min-height: 100dvh;
  display: flex;
  align-items: flex-end;
  padding-bottom: clamp(3rem, 8vh, 6rem);
}
.hero-media {
  position: absolute; inset: 0;
  overflow: hidden;
}
.hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: grayscale(1) brightness(0.62);
}
.hero-media::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10,10,11,0.55) 0%, rgba(10,10,11,0.15) 45%, rgba(10,10,11,0.82) 100%);
}
.hero-inner { position: relative; z-index: 2; width: 100%; }

.hero-title {
  font-weight: 500;
  font-size: clamp(3.2rem, 11vw, 10rem);
  line-height: 0.92;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 1rem 0 1.8rem;
}
.hero-title .line { display: block; }

.hero-sub {
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.45;
  color: rgba(244, 242, 238, 0.8);
  max-width: 44ch;
  margin-bottom: 3rem;
}

.hero-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--dim);
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}

/* ══ [03] Console ══════════════════════════════════════════ */

.console-chapter { padding: 0; }
/* Everything inside the pin must fit ANY viewport height: sizes and
   gaps scale with vh so the last lines never reveal below the fold. */
.console-pin {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(3.5rem, 7vh, 6rem) var(--pad-x) clamp(1.5rem, 4vh, 3rem);
}
.console-pin .ch-head { margin-bottom: clamp(0.9rem, 2.5vh, 2rem); }
.console-pin .ch-title { font-size: clamp(1.9rem, 4.8vw, 4.5rem); }
.console-pin .eyebrow { margin-bottom: clamp(0.6rem, 1.5vh, 1.6rem); }

.terminal {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(244, 242, 238, 0.02);
  max-width: 62rem;
  font-size: clamp(0.68rem, 1.9vh, 0.85rem);
}
.terminal-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: clamp(0.45rem, 1.2vh, 0.7rem) 1.2rem;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
}
.t-dim { color: var(--dim); }

.term-lines { list-style: none; padding: clamp(0.7rem, 1.8vh, 1.2rem) 1.2rem; display: grid; gap: clamp(0.35rem, 1.2vh, 0.75rem); }
.term-line {
  display: grid;
  grid-template-columns: 6.5em 1fr auto;
  gap: 1.2em;
  opacity: 0.16; /* pending lines stay faintly visible: the queue reads as "about to execute" */
  color: var(--dim);
}
.term-line.on { opacity: 1; color: var(--fg); }
.term-line .t-time { color: var(--dim); font-variant-numeric: tabular-nums; }
.term-line .t-cmd { color: var(--fg); }
.term-line::after {
  content: "[ " attr(data-status) " ]";
  color: var(--dim);
  justify-self: end;
  opacity: 0;
}
.term-line[data-status=""]::after { content: ""; }
.term-line.on::after { opacity: 1; }
.term-line.on[data-status="BOOKED"]::after { color: var(--fg); }

.term-cursor {
  padding: 0 1.2rem clamp(0.7rem, 1.8vh, 1.2rem);
  color: var(--fg);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.terminal .node-anchor { position: absolute; right: 1.2rem; bottom: 1.2rem; }

.console-note { margin-top: clamp(0.8rem, 2vh, 1.6rem); color: var(--dim); max-width: 62rem; }

/* ══ [04] Proof ════════════════════════════════════════════ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2rem;
  border-top: 1px solid var(--line);
  padding-top: 3rem;
  margin-bottom: 1rem;
}
.stat-value {
  font-weight: 500;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--dim); margin-top: 0.6rem; }
.stats-note { color: var(--dim); margin-bottom: clamp(4rem, 9vh, 7rem); }

.case-bands {
  margin: 0 calc(-1 * var(--pad-x));
}
.case-band {
  padding: clamp(3rem, 7vh, 5rem) var(--pad-x);
  color: #0a0a0b;
}
.band-a { background: #d9d5cc; }
.band-b { background: #c7c9c4; }
.band-c { background: #b8b4ab; }
.band-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 2rem;
  align-items: baseline;
  max-width: 80rem;
}
.band-title {
  font-weight: 500;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  letter-spacing: -0.02em;
}
.band-desc { line-height: 1.5; max-width: 48ch; margin-bottom: 1.2rem; opacity: 0.75; }
.band-tags { display: flex; flex-wrap: wrap; gap: 1rem; opacity: 0.55; }

.ledger {
  margin-top: clamp(3rem, 7vh, 5rem);
  max-width: 62rem;
}
.ledger-title { color: var(--dim); margin-bottom: 1.2rem; }
.ledger-rows { list-style: none; display: grid; }
.ledger-rows li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}
.ledger-rows li:first-child { border-top: 1px solid var(--line); }
.ledger-rows li span:first-child { white-space: nowrap; }
.ledger-rows li span:last-child { white-space: nowrap; color: var(--dim); }
.ledger-dots {
  flex: 1;
  border-bottom: 1px dotted var(--line);
  transform: translateY(-0.25em);
}

.quote-block {
  margin-top: clamp(4rem, 9vh, 7rem);
  max-width: 60rem;
}
.quote {
  font-size: clamp(1.4rem, 3vw, 2.3rem);
  line-height: 1.25;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin-bottom: 1.4rem;
  text-wrap: balance;
}
.quote-attr { color: var(--dim); }

/* ══ [05] Terminus ═════════════════════════════════════════ */

.cta-chapter { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; }

.cta-copy {
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1.45;
  color: var(--dim);
  max-width: 44ch;
  margin-bottom: 3.5rem;
}

.cta-wrap { position: relative; display: inline-flex; align-items: center; gap: 1.2rem; margin-bottom: 1.4rem; }

.cta-scarcity { color: var(--dim); margin-bottom: clamp(5rem, 12vh, 9rem); }

.cta-button {
  display: inline-flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid var(--fg);
  padding: 1.6rem 2.6rem;
  transition: background-color 0.25s ease, color 0.25s ease;
  cursor: pointer;
}
.cta-button .cta-pre { color: var(--dim); transition: color 0.25s ease; }
.cta-button .cta-label {
  font-weight: 500;
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  letter-spacing: -0.02em;
  line-height: 1;
}
.cta-button:hover, .cta-button:focus-visible {
  background: var(--fg);
  color: var(--ink);
}
.cta-button:hover .cta-pre, .cta-button:focus-visible .cta-pre { color: var(--ink); }
.cta-button:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }

.operator {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: end;
  border-top: 1px solid var(--line);
  padding-top: 3rem;
  max-width: 70rem;
}
.operator-photo img {
  /* starts in the dark; the scroll scrub in app.js turns the light on
     (grayscale falls away, brightness lifts) as it reaches center */
  filter: grayscale(1) brightness(0.32) contrast(1.18);
  border: 1px solid var(--line);
  max-width: 260px;
}
.operator-photo figcaption { margin-top: 0.7rem; color: var(--dim); }
.operator-copy p {
  color: var(--dim);
  line-height: 1.6;
  max-width: 50ch;
  margin-bottom: 1.6rem;
}
.operator-sign {
  font-weight: 500;
  color: var(--fg) !important;
  font-size: 1.15rem;
}

.site-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  color: var(--dim);
  border-top: 1px solid var(--line);
  margin-top: clamp(4rem, 8vh, 6rem);
  padding-top: 1.4rem;
}
.site-foot a:hover, .site-foot button:hover { color: var(--fg); }
#back-top {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  margin-left: auto;
}

/* ══ Responsive ════════════════════════════════════════════ */

@media (max-width: 820px) {
  .ch-body.split, .ch-body.split.reverse { grid-template-columns: 1fr; }
  .ch-body.split.reverse .ch-media { order: 2; }
  .stats-row { grid-template-columns: 1fr; gap: 2.5rem; }
  .band-inner { grid-template-columns: 1fr; gap: 1rem; }
  .operator { grid-template-columns: 1fr; align-items: start; }
  .coord-readout { display: none; }
  .chapter-rail { right: auto; left: var(--pad-x); }
  .clock-readout { display: none; }
  .term-line { grid-template-columns: 5.2em 1fr; gap: 0.4rem 0.8em; }
  .term-line::after { grid-column: 2; justify-self: start; }
  /* the pinned console must fit a phone viewport too */
  .console-pin { padding-top: 4rem; }
  .console-pin .ch-head { margin-bottom: 0.9rem; }
  .terminal { font-size: 0.62rem; }
  .term-lines { gap: 0.35rem; padding: 0.7rem 0.9rem; }
  .terminal-top { padding: 0.45rem 0.9rem; }
  .term-cursor { padding: 0 0.9rem 0.7rem; }
  .console-note { font-size: 0.62rem; margin-top: 0.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .term-cursor { animation: none; }
  .term-line { opacity: 1; color: var(--fg); }
  .term-line::after { opacity: 1; }
  .operator-photo img { filter: grayscale(0.1) brightness(1.05) contrast(1.02); }
}

@media (max-width: 820px) {
  .ledger-rows li { flex-wrap: wrap; gap: 0.3rem 1rem; }
  .ledger-dots { display: none; }
  .ledger-rows li span:last-child { flex-basis: 100%; }
}

/* ══ Flow strip (ch 02): demand → desk → supply ═══════════
   Ported from the Signal Desk build. Always an ink panel, so it
   reads the same inside paper or ink chapters.              */

.flow-strip {
  position: relative;
  height: clamp(170px, 18vw, 220px);
  margin-top: clamp(3rem, 8vh, 5.5rem);
  background: var(--ink);
  border: 1px solid var(--line-on-ink);
  overflow: hidden;
  color: var(--paper);
}
.flow-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(244, 242, 238, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 242, 238, 0.05) 1px, transparent 1px);
  background-size: 25px 25px;
  mask-image: linear-gradient(90deg, transparent, #000 20%, #000 80%, transparent);
}
.flow-strip svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.flow-routes path { fill: none; stroke: rgba(244, 242, 238, 0.2); stroke-width: 1; vector-effect: non-scaling-stroke; }
.flow-pulse {
  fill: none;
  stroke: var(--cyan);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 90 1200;
  animation: flow-travel 9s linear infinite;
}
@keyframes flow-travel { from { stroke-dashoffset: 1300; } to { stroke-dashoffset: -1300; } }

.flow-node {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  background: var(--ink-soft);
  border: 1px solid rgba(244, 242, 238, 0.35);
  padding: 1rem 2rem;
  text-align: center;
}
.flow-node strong { font-family: var(--font-display); font-weight: 500; font-size: 0.95rem; letter-spacing: 0.02em; }
.flow-node strong span { font-weight: 400; opacity: 0.6; }
.flow-node small { display: block; font-size: 0.55rem; color: var(--dim-on-ink); margin-top: 0.4rem; letter-spacing: 0.14em; }
.flow-node-dot {
  position: absolute;
  top: -4px; right: 10px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.flow-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink);
  padding: 0.6rem 1.1rem;
  font-size: 0.62rem;
  line-height: 1.8;
}
.flow-label span { color: var(--dim-on-ink); }
.flow-label.left { left: 6%; }
.flow-label.right { right: 6%; text-align: right; }
.flow-caption {
  position: absolute;
  left: 1rem; bottom: 0.6rem;
  font-size: 0.55rem;
  color: var(--dim-on-ink);
}

@media (max-width: 820px) {
  .flow-strip { height: 170px; }
  .flow-node { padding: 0.8rem 0.9rem; }
  .flow-node strong { font-size: 0.75rem; }
  .flow-label { padding: 0.4rem 0.3rem; font-size: 0.52rem; letter-spacing: 0.02em; }
  .flow-label.left { left: 0; }
  .flow-label.right { right: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .flow-pulse { animation: none; stroke-dasharray: none; }
}
