/* Layout: an instrument readout. One left-aligned column, mono data strips,
   and a 64-cell bit row as the recurring mark. */
:root {
  --paper: #eef1f5;
  --panel: #ffffff;
  --ink: #111b33;
  --muted: #56617a;
  --rule: #cdd4e0;
  --cobalt: #1f4fd8;
  --cobalt-soft: #dfe7fb;
  --gold: #a86f00;
  --gold-soft: #fbefd0;
  --bad: #b3261e;
  --display: "Bricolage Grotesque", "Arial Narrow", Arial, sans-serif;
  --body: "IBM Plex Sans", "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0b1220; --panel: #131c30; --ink: #e6ebf5; --muted: #98a4bd;
    --rule: #2a364f; --cobalt: #8aadff; --cobalt-soft: #1b2a52;
    --gold: #f0c257; --gold-soft: #3a2f12; --bad: #ff8a80; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0b1220; --panel: #131c30; --ink: #e6ebf5; --muted: #98a4bd;
  --rule: #2a364f; --cobalt: #8aadff; --cobalt-soft: #1b2a52;
  --gold: #f0c257; --gold-soft: #3a2f12; --bad: #ff8a80; color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 1.0625rem; line-height: 1.6;
}
a { color: var(--cobalt); text-underline-offset: 0.18em; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; line-height: 1.05; }
p { margin: 0; }
.wrap { max-width: 68rem; margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.label {
  font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--muted);
}

/* navigation */
.nav {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: var(--paper); border-bottom: 1px solid var(--rule);
}
.nav .wrap { display: flex; align-items: center; gap: 1.5rem; padding-block: 0.7rem; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 1.3rem; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand span { color: var(--cobalt); }
.nav nav { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-left: auto; font-size: 0.92rem; }
.nav nav a { color: var(--muted); text-decoration: none; }
.nav nav a:hover, .nav nav a[aria-current="true"] { color: var(--ink); }

/* hero */
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; padding-block: clamp(2.5rem, 7vw, 5rem) 3rem; }
.hero h1 { font-size: clamp(2.5rem, 7.2vw, 5.2rem); font-weight: 800; letter-spacing: -0.035em; max-width: 13ch; }
.hero h1 em { font-style: normal; color: var(--cobalt); }
.lede { font-size: clamp(1.1rem, 1.6vw, 1.3rem); max-width: 40rem; color: var(--ink); }
.hero-top { display: grid; gap: 1.4rem; }
.tagrow { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.tag { font-family: var(--mono); font-size: 0.78rem; padding: 0.25rem 0.6rem; border: 1px solid var(--rule); border-radius: 2px; color: var(--muted); }

/* the instrument */
.instrument { background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: clamp(1rem, 2.5vw, 1.75rem); display: grid; gap: 1.1rem; min-width: 0; }
.inst-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.inst-head h2 { font-size: 1.25rem; font-weight: 700; }
.bitblock { display: grid; gap: 0.35rem; }
.bitline { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.75rem; align-items: center; }
.bits { display: grid; grid-template-columns: repeat(64, minmax(0, 1fr)); gap: 2px; }
.bits i { display: block; aspect-ratio: 1 / 1.6; border: 1px solid var(--rule); border-radius: 1px; background: transparent; }
.bits i.on { background: var(--ink); border-color: var(--ink); }
.bits.same i.on { background: var(--cobalt); border-color: var(--cobalt); }
.bits i.diff { background: var(--bad); border-color: var(--bad); }
.readout { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.readout div { display: grid; gap: 0.15rem; min-width: 0; }
.readout .mono { font-size: 0.95rem; overflow-wrap: anywhere; }
.verdict { display: flex; gap: 1rem; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.verdict p { font-weight: 600; }
.verdict p.ok { color: var(--cobalt); }
.verdict p.bad { color: var(--bad); }
.small { font-size: 0.9rem; color: var(--muted); max-width: 46rem; }
button {
  font: 500 0.9rem var(--body); color: var(--ink); background: transparent;
  border: 1px solid var(--ink); border-radius: 2px; padding: 0.45rem 0.9rem; cursor: pointer;
}
button:hover { background: var(--ink); color: var(--paper); }

/* sections */
section { border-top: 1px solid var(--rule); }
section > .wrap { padding-block: clamp(2.5rem, 6vw, 4.5rem); display: grid; gap: 2rem; }
.sec-head { display: grid; gap: 0.6rem; }
.sec-head h2 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -0.025em; max-width: 22ch; }
.sec-head p { max-width: 42rem; color: var(--muted); }

.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem; }
.three div { display: grid; gap: 0.5rem; align-content: start; border-top: 3px solid var(--ink); padding-top: 0.9rem; }
.three h3 { font-size: 1.3rem; font-weight: 700; }
.three p { color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: s; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 1rem; padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.steps li::before { content: counter(s); font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--cobalt); line-height: 1.1; }
.steps strong { display: block; font-weight: 600; }
.steps span { color: var(--muted); }
.outcomes { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.pill { font-family: var(--mono); font-size: 0.8rem; padding: 0.3rem 0.7rem; border-radius: 2px; }
.pill.v { background: var(--cobalt-soft); color: var(--cobalt); }
.pill.f { border: 1px solid var(--bad); color: var(--bad); }
.pill.c { background: var(--gold-soft); color: var(--gold); }

/* chain */
.chain { display: flex; flex-wrap: wrap; gap: 0; align-items: stretch; }
.chain button {
  flex: 1 1 9rem; text-align: left; border: 1px solid var(--rule); border-radius: 0;
  margin: 0 -1px -1px 0; padding: 0.8rem 0.9rem; display: grid; gap: 0.2rem; background: var(--panel); color: var(--ink);
}
.chain button:hover { background: var(--cobalt-soft); color: var(--ink); }
.chain button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chain button[aria-pressed="true"] .label { color: var(--paper); opacity: 0.75; }
.chain b { font-family: var(--display); font-size: 1.05rem; font-weight: 700; }
.record { background: var(--panel); border: 1px solid var(--rule); border-radius: 4px; padding: clamp(1rem, 2.5vw, 1.5rem); display: grid; gap: 1rem; min-width: 0; }
.record h3 { font-size: 1.35rem; font-weight: 700; }
.record dl { margin: 0; display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr); gap: 0.5rem 1rem; }
.record dt { color: var(--muted); font-size: 0.9rem; }
.record dd { margin: 0; overflow-wrap: anywhere; }
.record dd.mono { font-size: 0.85rem; }
@media (max-width: 34rem) {
  .record dl { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; }
  .record dd { margin-bottom: 0.6rem; }
  .bitline { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .bits { grid-template-columns: repeat(32, minmax(0, 1fr)); }
}

/* status */
.status { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2.5rem; }
.status h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 0.8rem; }
.status ul { margin: 0; padding: 0; list-style: none; display: grid; }
.status li { padding-block: 0.7rem; border-top: 1px solid var(--rule); }
.status .done h3 { color: var(--cobalt); }
.status .open h3 { color: var(--gold); }

/* pilot */
.pilot { background: var(--ink); color: var(--paper); border-top: 0; }
.pilot .sec-head p, .pilot .small { color: var(--paper); opacity: 0.8; }
.pilot .label { color: var(--paper); opacity: 0.65; }
.contact { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.contact .mono { font-size: clamp(1rem, 2.4vw, 1.4rem); user-select: all; overflow-wrap: anywhere; }
.pilot button { color: var(--paper); border-color: var(--paper); }
.pilot button:hover { background: var(--paper); color: var(--ink); }
footer .wrap { padding-block: 1.5rem 2.5rem; }

@media (prefers-reduced-motion: no-preference) {
  .bits i { transition: background-color 120ms linear; }
}
