/* DAVE — Relay DV-01 · black-site telegraph office at the edge of the desert.
   Palette: coal / bone / copper / patina (copper is the same metal at two ages). */

:root {
  --coal:   #131110;
  --soot:   #1b1714;
  --ash:    #2c2620;
  --bone:   #e4dbc9;
  --dust:   #8f8474;
  --copper: #c87a4b;
  --patina: #5ba88b;
  --blood:  #93402d;
  --line-x: 44px;
  --mono: "Fragment Mono", ui-monospace, monospace;
  --display: "Saira Stencil One", var(--mono);
}

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

html { scroll-behavior: smooth; }

body {
  position: relative;
  background: var(--coal);
  color: var(--bone);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.65;
  overflow-x: hidden;
}

/* grain — desert night air */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.wrap { max-width: 880px; margin: 0 auto; padding: 0 24px 0 calc(var(--line-x) + 44px); }

a { color: var(--patina); }

::selection { background: var(--copper); color: var(--coal); }

/* ── THE LINE — one copper wire runs the whole page ─────────── */
.line {
  position: absolute;
  top: 0; bottom: 0; left: var(--line-x);
  width: 2px;
  background: linear-gradient(180deg,
    var(--copper) 0%, var(--patina) 30%, var(--copper) 55%,
    var(--patina) 80%, var(--copper) 100%);
  opacity: .45;
  z-index: 1;
}

/* insulator node + station code at each section */
.station {
  position: absolute;
  top: 3.4rem;
  left: calc(var(--line-x) - 6px);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  z-index: 2;
}
.insulator {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bone);
  border: 3px solid var(--copper);
  box-shadow: 0 0 0 3px var(--coal);
}
.station b {
  font-family: var(--mono); font-weight: 400;
  font-size: 11px; letter-spacing: .25em;
  color: var(--dust);
  writing-mode: vertical-rl;
}

/* ── top bar ────────────────────────────────────────────────── */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px 14px calc(var(--line-x) + 44px);
  font-size: 11px; letter-spacing: .22em;
  color: var(--dust);
  border-bottom: 1px solid var(--ash);
  position: relative; z-index: 3;
}
.sound-toggle {
  font-family: var(--mono); font-size: 11px; letter-spacing: .22em;
  color: var(--dust);
  background: none; border: 1px solid var(--ash);
  padding: 6px 12px; cursor: pointer;
}
.sound-toggle:hover, .sound-toggle:focus-visible { color: var(--bone); border-color: var(--copper); }
.sound-toggle[aria-pressed="true"] { color: var(--patina); border-color: var(--patina); }

/* ── hero ───────────────────────────────────────────────────── */
.hero {
  position: relative;
  padding: clamp(4rem, 10vh, 7rem) 0 0;
  min-height: min(88vh, 860px);
  display: flex; flex-direction: column; justify-content: space-between;
}

.eyebrow {
  font-size: 12px; letter-spacing: .3em; color: var(--copper);
  margin-bottom: 1.2rem;
}

.wordmark {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(5rem, 21vw, 15rem);
  line-height: .88;
  letter-spacing: .01em;
  color: var(--bone);
}

.tagline {
  margin-top: 1.4rem;
  font-size: clamp(.95rem, 1.6vw, 1.15rem);
  color: var(--dust);
  letter-spacing: .08em;
}

/* morse ticker */
.ticker { margin-top: 3rem; max-width: 620px; }
.ticker-strip {
  display: flex; align-items: center; gap: 5px;
  height: 18px;
  border-top: 1px solid var(--ash);
  border-bottom: 1px solid var(--ash);
  padding: 0 2px;
  overflow: hidden;
  scroll-behavior: smooth;
}
.m-dot, .m-dash {
  flex: none; height: 4px; background: var(--ash);
  transition: background .12s, box-shadow .12s;
}
.m-dot  { width: 6px; }
.m-dash { width: 20px; }
.m-gap  { flex: none; width: 10px; }
.m-lit  { background: var(--patina); box-shadow: 0 0 8px var(--patina); }
.m-sent { background: var(--copper); }

.ticker-decode {
  margin-top: .7rem;
  font-size: 13px; letter-spacing: .18em; color: var(--bone);
  min-height: 1.6em;
}
.ticker-decode .prompt { color: var(--copper); }
.cursor { animation: blink 1.1s steps(1) infinite; color: var(--patina); }
@keyframes blink { 50% { opacity: 0; } }

/* telegraph poles on the horizon */
.poles { display: block; width: 100%; height: 120px; margin-top: 3rem; }
.pole-wire path { stroke: var(--copper); stroke-width: 1; opacity: .4; }
.pole-wood rect, .pole-wood circle { fill: var(--ash); }
.pole-ground { fill: var(--ash); }

/* ── sections ───────────────────────────────────────────────── */
.section { position: relative; padding: 5.5rem 0 2rem; }

.section-head {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  letter-spacing: .04em;
  color: var(--bone);
}
.section-head::after {
  content: "";
  display: block;
  width: 64px; height: 2px;
  margin-top: .9rem;
  background: var(--copper);
}
.section-sub { margin: 1.1rem 0 2.2rem; color: var(--dust); max-width: 60ch; }

/* dispatches */
.dispatch {
  position: relative;
  border: 1px solid var(--ash);
  background: var(--soot);
  padding: 1.4rem 1.6rem 1.5rem;
  margin-bottom: 1.4rem;
  max-width: 680px;
}
.dispatch-meta {
  display: flex; gap: 1.6rem; align-items: baseline;
  font-size: 11px; letter-spacing: .2em; color: var(--dust);
  margin-bottom: .9rem;
}
.dispatch-title {
  font-family: var(--mono); font-weight: 400;
  font-size: 1rem; letter-spacing: .3em;
  color: var(--copper);
  margin-bottom: .6rem;
}
.dispatch p { color: var(--bone); max-width: 56ch; }
.stamp {
  position: absolute; top: 1rem; right: 1.1rem;
  font-size: 12px; letter-spacing: .3em;
  color: var(--blood);
  border: 2px solid var(--blood);
  padding: 2px 8px 2px 11px;
  transform: rotate(6deg);
  opacity: .8;
}

/* field kit */
.kit { list-style: none; max-width: 680px; }
.kit li {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.4rem;
  padding: .85rem 0;
  border-bottom: 1px dashed var(--ash);
}
.kit-item { color: var(--bone); letter-spacing: .12em; font-size: .9rem; }
.kit-note { color: var(--dust); }

/* status board */
.status-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--ash);
  border: 1px solid var(--ash);
  max-width: 820px;
}
.tile {
  background: var(--soot);
  padding: 1.2rem 1.3rem 1.3rem;
  display: flex; flex-direction: column; gap: .7rem;
}
.tile-label { font-size: 11px; letter-spacing: .25em; color: var(--dust); }
.tile-value { font-size: 1.15rem; letter-spacing: .1em; color: var(--bone); }
.is-open { color: var(--patina); text-shadow: 0 0 12px rgba(91,168,139,.5); }

.meter { display: flex; gap: 5px; align-items: flex-end; height: 22px; }
.meter i {
  width: 9px; background: var(--patina); opacity: .9;
  animation: carrier 2.6s ease-in-out infinite;
}
.meter i:nth-child(1) { height: 30%; animation-delay: 0s; }
.meter i:nth-child(2) { height: 50%; animation-delay: .18s; }
.meter i:nth-child(3) { height: 70%; animation-delay: .36s; }
.meter i:nth-child(4) { height: 85%; animation-delay: .54s; }
.meter i:nth-child(5) { height: 100%; animation-delay: .72s; }
@keyframes carrier { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* open channel — the key */
.addr { color: var(--patina); text-underline-offset: 3px; }
.key-console {
  display: flex; gap: 2rem; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--ash);
  background: var(--soot);
  padding: 1.8rem;
  max-width: 680px;
}
.key {
  flex: none;
  display: flex; flex-direction: column; align-items: center; gap: .8rem;
  background: none; border: none; cursor: pointer;
  font-family: var(--mono);
}
.key-knob {
  width: 64px; height: 64px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e0a06e, var(--copper) 55%, #7a4527);
  border: 2px solid #7a4527;
  box-shadow: 0 6px 0 #4a2a18, 0 10px 24px rgba(0,0,0,.6);
  transition: transform .07s, box-shadow .07s;
}
.key:active .key-knob, .key.keying .key-knob {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #4a2a18, 0 4px 12px rgba(0,0,0,.6);
}
.key-label { font-size: 11px; letter-spacing: .3em; color: var(--copper); }
.key:focus-visible { outline: 2px solid var(--patina); outline-offset: 6px; }
.key[disabled] { cursor: default; opacity: .8; }

.key-readout { flex: 1; min-width: 220px; }
.key-morse {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  min-height: 22px; margin-bottom: .6rem;
}
.key-status { font-size: 12px; letter-spacing: .18em; color: var(--dust); }

/* footer */
.footer {
  margin-top: 4rem;
  border-top: 1px solid var(--ash);
  padding: 2.4rem 0 3rem;
}
.footer-line { font-size: 12px; letter-spacing: .3em; color: var(--dust); }
.footer-fine { margin-top: .8rem; font-size: 11px; letter-spacing: .14em; color: var(--ash); }
.footer-fine { color: #55493c; }

/* ── responsive ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  :root { --line-x: 14px; }
  .wrap, .topbar { padding-left: calc(var(--line-x) + 26px); }
  .station b { display: none; }
  .insulator { width: 10px; height: 10px; border-width: 2px; }
  .station { left: calc(var(--line-x) - 4px); }
  .kit li { grid-template-columns: 1fr; gap: .2rem; }
  .dispatch-meta { flex-wrap: wrap; gap: .8rem; }
  .hero { min-height: 70vh; }
  .eyebrow { font-size: 10px; letter-spacing: .2em; }
  .topbar-id { max-width: 60%; }
}

/* ── reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .meter i { animation: none; opacity: 1; }
  .cursor { animation: none; }
}
