/* The Courier — slither's brand world (decided 2026-08-20; the ratified
   direction sheet is the source of truth). Warm paper over green-black:
     parcel #FBF6EC · surface #FFFDF6 · sand #F0DCB8 · teal #2F8F90
     depot #10332F · postmark #5E7A73 · apricot #F2A65A (one accent per view)
   The functional colours (--bad/--warn/--good) are semantic, not brand.
   docs/architecture.svg and docs/staged-accept.svg (and their -dark
   twins) wear the same palette, so the README and the demo read as one
   project. app.js reads these custom properties for the canvas. */

:root {
  --bg: #fbf6ec;
  --panel: #fffdf6;
  --fill: #f0dcb8;
  --stroke: #2f8f90;
  --text: #10332f;
  --note: #5e7a73;
  --line: #e7dcc7;
  --stage: #f6ead4;
  --bad: #c0452f;
  --warn: #b4691e;
  --good: #2e7d46;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold",
    "Trebuchet MS", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c2723;
    --panel: #10332f;
    --fill: #1b4a44;
    --stroke: #4fb3b4;
    --text: #f0e9da;
    --note: #8fb6ae;
    --line: #24544d;
    --stage: #143732;
    --bad: #f07862;
    --warn: #f2a65a;
    --good: #7fc98b;
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  padding: 0 1.25rem 3rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.5;
  font-size: 15px;
}

main {
  max-width: 1180px;
  margin: 0 auto;
}

header {
  padding: 2rem 0 1rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-family: var(--display);
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

h1 .mark {
  flex: none;
}

h1 code {
  font-family: var(--mono);
  font-size: 1.5rem;
}

.claim {
  margin: 0;
  color: var(--note);
  max-width: 68ch;
}

.claim strong {
  color: var(--text);
  font-weight: 600;
}

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

h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--note);
  margin: 0 0 0.6rem;
  font-weight: 600;
}

/* ── hero ─────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(240px, 0.85fr);
  gap: 2.2rem;
  align-items: center;
  padding: 2.6rem 0 2.4rem;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }
}

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--note);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.hero h1 {
  font-size: 3.4rem;
  margin: 0 0 0.45rem;
  display: block;
}

.tagline {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.28rem;
  color: var(--text);
  margin: 0 0 0.75rem;
  max-width: 34ch;
  text-wrap: balance;
}

.lede {
  color: var(--note);
  max-width: 58ch;
  margin: 0 0 1.1rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1.35rem;
}

.chips span {
  font-size: 0.78rem;
  font-family: var(--display);
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
}

.cta {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0 0 0.9rem;
}

.btn {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  background: var(--stroke);
  color: var(--bg);
  border-radius: 12px;
  padding: 0.55rem 1.15rem;
  text-decoration: none;
}

.btn:hover {
  filter: brightness(1.07);
}

.cta .src {
  color: var(--stroke);
  font-weight: 600;
}

.hero-caveat {
  font-size: 0.78rem;
  color: var(--warn);
  font-weight: 600;
  margin: 0;
}

.hero-art {
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 1.3rem 1.3rem 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

.hero-art svg {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
}

.demo-h {
  font-size: 1.35rem;
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-family: var(--display);
  letter-spacing: -0.015em;
  text-transform: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.demo-h .mark {
  flex: none;
}

/* ── controls ─────────────────────────────────────────────────────── */

.controls {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 860px) {
  .controls {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem 1rem;
}

.scenarios {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

button {
  font: inherit;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--stroke);
}

button[aria-pressed="true"] {
  background: var(--fill);
  border-color: var(--stroke);
  color: var(--text);
  font-weight: 600;
}

.blurb {
  margin: 0.7rem 0 0;
  color: var(--note);
  font-size: 0.86rem;
  min-height: 2.6em;
}

.sliders {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem 0.7rem;
  align-items: center;
}

.sliders label {
  font-size: 0.86rem;
  white-space: nowrap;
}

.sliders output {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--note);
  min-width: 4.2ch;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--stroke);
}

input[type="text"],
input[type="number"] {
  font: inherit;
  font-size: 0.86rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.22rem 0.45rem;
  width: 100%;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.55rem;
}

.row label {
  font-size: 0.86rem;
  white-space: nowrap;
}

/* ── stage ────────────────────────────────────────────────────────── */

.stage {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
}

.peers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.peer {
  padding: 0.7rem 1rem;
}

.peer + .peer {
  border-left: 1px solid var(--line);
  text-align: right;
}

.peer .who {
  font-weight: 700;
  font-family: var(--display);
}

.peer .addr {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--note);
}

.ladder {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.45rem;
  flex-wrap: wrap;
}

.peer + .peer .ladder {
  justify-content: flex-end;
}

.badge {
  font-size: 0.72rem;
  font-family: var(--mono);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
  color: var(--note);
}

.badge.on {
  background: var(--fill);
  border-color: var(--stroke);
  color: var(--text);
}

.badge.dead {
  border-color: var(--bad);
  color: var(--bad);
}

canvas {
  display: block;
  width: 100%;
  background: var(--bg);
}

/* ── transport ────────────────────────────────────────────────────── */

.transport {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.8rem;
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}

.transport input[type="range"] {
  flex: 1 1 220px;
}

.clock {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--note);
  white-space: nowrap;
}

.clock b {
  color: var(--text);
  font-weight: 600;
}

/* ── counters ─────────────────────────────────────────────────────── */

.counters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.6rem;
  margin: 1.25rem 0;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.55rem 0.7rem;
}

.metric .v {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 600;
}

.metric .k {
  font-size: 0.72rem;
  color: var(--note);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── log ──────────────────────────────────────────────────────────── */

.log {
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.65;
  max-height: 17rem;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.6rem 0.8rem;
  background: var(--panel);
  white-space: pre-wrap;
  word-break: break-word;
}

.log div {
  color: var(--note);
}

.log div.now {
  color: var(--text);
  background: var(--fill);
  border-radius: 3px;
}

.log .t {
  color: var(--note);
  display: inline-block;
  min-width: 9ch;
}

.log .lost {
  color: var(--bad);
}
.log .warn {
  color: var(--warn);
}
.log .good {
  color: var(--good);
}

footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--note);
  font-size: 0.84rem;
}

footer p {
  max-width: 76ch;
}

.brandline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--display);
  font-size: 0.84rem;
}

.brandline b {
  color: var(--text);
  font-weight: 700;
}

.brandline svg {
  flex: none;
}

.status {
  font-size: 0.84rem;
  color: var(--note);
  margin: 0.6rem 0 0;
  min-height: 1.5em;
}

.status.err {
  color: var(--bad);
}
