/* A radio operator's log: ruled paper, the call (sent) in ink blue, the answer
   (received) in dark green, the state of the link on its own line. A missed answer
   is shown dashed and grey, never red. System fonts only. */
:root {
  --paper: #f5f3ec; --panel: #fffdf6; --ink: #1b2531; --quiet: #4f5b67; --rule: #d6d1c3; --grid: #e7e2d4;
  --accent: #145a52; --accent-soft: #d4e8e3; --on-accent: #ffffff; --track: #1d5c97; --track-2: #4a5a6a;
  --good: #1f7a3d; --bad: #8a2a1f; --code-bg: #efece2;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1520; --panel: #111c29; --ink: #e5ebf1; --quiet: #9eabb8; --rule: #253344; --grid: #172331;
    --accent: #6fd0c0; --accent-soft: #15302c; --on-accent: #0e140c; --track: #7db8ec; --track-2: #a9b6c3;
    --good: #5fcf86; --bad: #ee9082; --code-bg: #0a111a;
  }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--sans); }
a { color: var(--track); }
a:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
code, pre { font-family: var(--mono); }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* top bar */
.top { position: relative; z-index: 2; height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 16px var(--mono); }
.brand img { width: 28px; height: 28px; }
.top nav { display: flex; gap: 22px; font: 15px var(--mono); }
.top nav a { color: var(--quiet); text-decoration: none; }
.top nav a:hover { color: var(--ink); }
@media (max-width: 720px) { .top nav a:not(.gh) { display: none; } }

/* hero: fills the first screen; the numbers strip sits at its bottom edge */
.hero { position: relative; overflow: hidden; min-height: calc(100svh - 64px); display: flex; flex-direction: column;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px);
  background-size: 100% 28px; background-position: 0 -1px; }
.bgcode { position: absolute; inset: 0 0 auto auto; width: 62%; margin: 0; padding: 40px 0 0; color: var(--ink); opacity: .07;
  font: 15px/1.7 var(--mono); white-space: pre; pointer-events: none; user-select: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 30%); mask-image: linear-gradient(90deg, transparent, #000 30%); }
.hero-grid { position: relative; flex: 1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-top: 24px; padding-bottom: 28px; }
.prompt { font: 600 16px var(--mono); color: var(--track); margin: 0 0 6px; }
.prompt .cur { display: inline-block; width: .6em; height: 1.05em; vertical-align: -.15em; background: var(--accent); margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.wordmark { font: 900 clamp(30px, 5.1vw, 80px)/1.02 var(--mono); letter-spacing: -0.04em; margin: 0; white-space: nowrap; }
.page-title { font: 900 clamp(28px, 4.2vw, 56px)/1.08 var(--mono); letter-spacing: -0.03em; margin: 0; }
.card h3 a { color: inherit; }
.tagline { font-weight: 700; font-size: clamp(19px, 1.9vw, 25px); line-height: 1.3; color: var(--accent); margin: 14px 0 10px; }
.lede { color: var(--quiet); margin: 0 0 24px; max-width: 38em; }
.buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border: 1px solid var(--rule); background: var(--panel);
  color: var(--ink); font: 700 16px var(--sans); text-decoration: none; border-radius: 3px; }
.btn svg { width: 18px; height: 18px; }
.btn.star { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn:hover { border-color: var(--ink); }
.cmd { display: flex; align-items: stretch; border: 1px solid var(--rule); background: var(--panel); border-radius: 3px; max-width: 640px; }
.cmd pre { flex: 1; margin: 0; padding: 12px 14px; font-size: 14px; overflow-x: auto; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.cmd .dollar { color: var(--good); user-select: none; }
.copy { border: 0; border-left: 1px solid var(--rule); background: none; color: var(--accent); font: 700 14px var(--mono); padding: 0 16px; cursor: pointer; }


/* numbers strip */
.numbers { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--rule); background: var(--panel); margin-bottom: 14px; }
.numbers > div { padding: 16px 20px; border-left: 1px solid var(--rule); min-width: 0; }
.numbers > div:first-child { border-left: 0; }
.numbers .n { display: block; font: 800 34px/1.1 var(--mono); color: var(--accent); }
.numbers .l { display: block; font-weight: 700; }
.numbers code { display: block; font-size: 11.5px; color: var(--quiet); overflow-wrap: anywhere; margin-top: 4px; }

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .bgcode { width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
  .numbers { grid-template-columns: repeat(2, 1fr); }
  .numbers > div:nth-child(3) { border-left: 0; }
  .numbers > div:nth-child(n+3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 600px) {
  .hero-grid { padding-top: 8px; }
  .prompt { font-size: 14px; }
  .bgcode { opacity: .045; }
  .lede { font-size: 16px; margin-bottom: 18px; }
  .btn { padding: 10px 14px; font-size: 15px; }
  .cmd pre { font-size: 12.5px; }
  .numbers .n { font-size: 26px; }
  .numbers > div { padding: 12px 14px; }
}

/* sections */
section.band { padding: 72px 0; border-top: 1px solid var(--rule); }
h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 19px; margin: 0 0 6px; }
.sub { color: var(--quiet); max-width: 46em; margin: 0 0 32px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { background: var(--panel); border: 1px solid var(--rule); border-top: 3px solid var(--accent); padding: 22px; border-radius: 3px; }
.card p { margin: 0; color: var(--quiet); }
.cards.four { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { .cards.four { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 860px) { .cards, .cards.four { grid-template-columns: 1fr; } }
.status { display: inline-block; font: 700 12px var(--mono); letter-spacing: .04em; text-transform: uppercase; color: var(--ink); border: 1px solid var(--quiet); border-radius: 2px; padding: 2px 7px; margin-bottom: 10px; }
.after .status, .card p .status { margin: 0; vertical-align: 1px; }
.after { margin: 28px 0 0; max-width: 46em; }
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 40px; align-items: start; }
@media (max-width: 860px) { .feature { grid-template-columns: minmax(0, 1fr); } }
figure { margin: 0; }
figure img { width: 100%; height: auto; display: block; background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; }
figcaption { font-size: 14px; color: var(--quiet); margin-top: 8px; }
.json { background: var(--code-bg); border: 1px solid var(--rule); padding: 12px 14px; font-size: 13px; overflow-x: auto; border-radius: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--quiet); }
td code { font-size: 13px; overflow-wrap: anywhere; }
.scroll { overflow-x: auto; }
.num { font-family: var(--mono); color: var(--accent); font-weight: 700; }
pre.block { background: var(--code-bg); border: 1px solid var(--rule); padding: 14px; overflow-x: auto; font-size: 14px; border-radius: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* a command shows whole: it wraps at spaces, continuation lines hang two characters in (more for an indented line) */
.cmd pre .ln, pre.block .ln { display: block; padding-left: 2ch; text-indent: -2ch; }
/* output wraps too, its continuation lines hang by --hang */
.json .ln { display: block; padding-left: var(--hang, 2ch); text-indent: calc(-1 * var(--hang, 2ch)); }
/* a word with a hyphen or slash moves to the next line whole, and breaks only if it alone is wider than the box */
pre .ln .w { display: inline-block; max-width: 100%; text-indent: 0; }
footer { border-top: 1px solid var(--rule); padding: 32px 0 48px; color: var(--quiet); font-size: 15px; }
footer a { margin-right: 18px; }

/* the first screen's stage: the real artifact, replayed */
.stage { background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; box-shadow: 0 1px 0 var(--rule); min-width: 0; }
.stage-head { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--rule); font: 13px var(--mono); color: var(--quiet); }
.stage-head b { color: var(--ink); }
.stage-head span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.stage-lines { margin: 0; padding: 10px 12px; min-height: calc(8 * 1.65em + 20px); background: var(--code-bg); font: 12.5px/1.65 var(--mono); color: var(--quiet); white-space: pre-wrap; overflow-wrap: anywhere; }
.stage-lines .ev { color: var(--accent); font-weight: 700; }
.stage-lines .in { color: var(--ink); }
.stage-foot { padding: 8px 12px; font-size: 13px; color: var(--quiet); border-top: 1px solid var(--rule); }

/* the link-state ladder above the replay */
.ladder { list-style: none; margin: 0; padding: 8px 12px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; border-bottom: 1px solid var(--rule); }
.ladder li { font: 11px var(--mono); padding: 3px 1px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--rule); border-radius: 2px; color: var(--quiet); }
.ladder li.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.ladder li.on[data-s="degraded"], .ladder li.on[data-s="lost"] { background: var(--panel); color: var(--ink); border: 2px dashed var(--ink); }
.stage .stage-lines { height: calc(11 * 1.65em + 20px); min-height: 0; overflow: hidden; }
@media (max-width: 600px) { .ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ladder li { font-size: 11px; } .stage .stage-lines { font-size: 11.5px; } }
.stage-lines .tx { color: var(--track); }
.stage-lines .rx { color: var(--good); }
.stage-lines .st { color: var(--ink); font-weight: 700; }
.stage-lines .st.warn { border-bottom: 1px dashed var(--quiet); }
.stage-foot span { font-family: var(--mono); font-size: 12px; margin-left: 8px; white-space: nowrap; }
.stage-foot .k-tx { color: var(--track); } .stage-foot .k-rx { color: var(--good); } .stage-foot .k-st { color: var(--ink); font-weight: 700; }

/* the state machine figure */
.fsm { width: 100%; height: auto; display: block; background: var(--panel); border: 1px solid var(--rule); border-radius: 3px; }
.fsm .b rect { fill: var(--paper); stroke: var(--quiet); stroke-width: 1.5; }
.fsm .b.up rect { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2; }
.fsm .b.dg rect, .fsm .b.dn rect { stroke: var(--ink); stroke-dasharray: 6 4; }
.fsm .b.dn rect { stroke-dasharray: 2 4; stroke-width: 2.5; }
.fsm text { font: 600 16px var(--mono); fill: var(--ink); text-anchor: middle; }
.fsm .a { stroke: var(--quiet); stroke-width: 1.6; fill: none; }
.fsm .fh { fill: var(--quiet); }
.fsm .l { font: 14px var(--sans); fill: var(--quiet); }
.fsm .l.e { text-anchor: end; } .fsm .l.s { text-anchor: start; }
.fsm .n { font: italic 14px var(--sans); fill: var(--quiet); }
#outputs table { margin-top: 16px; background: var(--panel); border: 1px solid var(--rule); }
