/* ---------- Tokens ---------- */
:root {
  --paper: #edf0f2;
  --raised: #f7f9fa;
  --ink: #16212b;
  --muted: #55626e;
  --rule: #c6ced5;
  --signal: #e39b12;      /* alert amber: what broke (fills, dots) */
  --signal-text: #8f5600; /* amber that passes contrast as text */
  --resolved: #0e6e63;    /* teal: what fixed it */
  --code-bg: #e1e6ea;

  /* the "control room" band is dark in both themes */
  --night: #0d1928;
  --night-2: #12233a;
  --night-line: #26405e;
  --night-ink: #e6edf5;
  --night-muted: #8fa3b8;
  --night-amber: #f0b23a;
  --night-teal: #3cc2ae;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 66ch;
  --gutter: clamp(16px, 4vw, 48px);
  --wide: 1220px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #11181e;
    --raised: #172028;
    --ink: #e4eaef;
    --muted: #9aa7b2;
    --rule: #2c3944;
    --signal: #f0b23a;
    --signal-text: #f0b23a;
    --resolved: #4fc1b0;
    --code-bg: #1d2831;
    --night: #0a131d;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }
img, svg { max-width: 100%; height: auto; }

.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; }
.skip:focus { left: var(--gutter); z-index: 10; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-top: 1.4rem; padding-bottom: 1.4rem;
}
.wordmark { font-weight: 700; font-stretch: 85%; font-size: 1.125rem; text-decoration: none; display: inline-flex; align-items: center; gap: 0.6rem; }
.wordmark::before { content: ""; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--signal); }
.site-nav { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; }
.site-nav a { text-decoration: none; color: var(--muted); }
.site-nav a:hover { color: var(--ink); }
.site-nav .nav-cta {
  color: var(--ink); border: 1px solid currentColor; padding: 0.4rem 0.85rem; border-radius: 3px; font-weight: 600;
}
.night .site-nav a { color: var(--night-muted); }
.night .site-nav a:hover, .night .site-nav .nav-cta { color: var(--night-ink); }
.night .wordmark { color: var(--night-ink); }

/* ---------- Buttons ---------- */
.button {
  display: inline-block; padding: 0.8rem 1.25rem; background: var(--ink); color: var(--paper);
  text-decoration: none; font-weight: 650; border-radius: 3px; border: 0; font: inherit; font-weight: 650; cursor: pointer;
}
.button:hover { background: var(--resolved); color: #fff; }
.night .button { background: var(--night-amber); color: #111a24; }
.night .button:hover { background: var(--night-teal); color: #0b1620; }
.text-link { font-weight: 600; }
.night .text-link { color: var(--night-ink); }

/* ---------- Night band + hero ---------- */
.night {
  background-color: var(--night);
  background-image:
    linear-gradient(rgba(143, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(143, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--night-ink);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 3rem;
  align-items: center;
  padding-top: clamp(2rem, 6vw, 4.5rem);
  padding-bottom: clamp(3rem, 7vw, 5.5rem);
}

.status {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-size: 0.9rem; color: var(--night-ink);
  border: 1px solid var(--night-line); border-radius: 999px; padding: 0.3rem 0.8rem 0.3rem 0.65rem;
  background: rgba(18, 35, 58, 0.7);
}
.status::before {
  content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--night-teal);
  box-shadow: 0 0 0 0 rgba(60, 194, 174, 0.6); animation: beacon 2.4s ease-out infinite;
}
@keyframes beacon { 0% { box-shadow: 0 0 0 0 rgba(60,194,174,.55); } 70%,100% { box-shadow: 0 0 0 9px rgba(60,194,174,0); } }

.hero h1 {
  margin: 1.4rem 0 0;
  font-size: clamp(2.6rem, 5.6vw, 4.9rem);
  font-stretch: 66%;
  font-weight: 800;
  line-height: 0.93;
  letter-spacing: -0.012em;
}
.hero-intro {
  margin: 1.6rem 0 0; max-width: 46ch;
  font-family: var(--serif); font-size: clamp(1.1rem, 1.45vw, 1.25rem); line-height: 1.6; color: #c9d5e2;
}
.hero-intro strong { color: var(--night-ink); font-weight: 600; }
.hero-meta { margin: 1.25rem 0 0; color: var(--night-muted); font-size: 0.925rem; }
.hero-actions { margin-top: 2rem; display: flex; gap: 0.75rem 1.5rem; flex-wrap: wrap; align-items: center; }

/* ---------- Live diagram ---------- */
.live { margin: 0; }
.live-frame {
  border: 1px solid var(--night-line); border-radius: 8px; background: rgba(10, 20, 33, 0.75);
  overflow: hidden;
}
.live-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 0.6rem 0.9rem; border-bottom: 1px solid var(--night-line);
  font-size: 0.8125rem; color: var(--night-muted);
}
.live-bar b { color: var(--night-ink); font-weight: 600; }
.live-toggle {
  background: none; border: 1px solid var(--night-line); color: var(--night-muted);
  font: inherit; font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 3px; cursor: pointer;
}
.live-toggle:hover { color: var(--night-ink); }

#live-diagram { display: block; width: 100%; height: auto; }
.diagram-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#live-diagram text { font-family: var(--sans); fill: var(--night-ink); pointer-events: none; }
#live-diagram .sub { fill: var(--night-muted); font-size: 10.5px; }
#live-diagram .lbl { font-size: 13.5px; font-weight: 650; }
#live-diagram .edge-label { fill: var(--night-muted); font-size: 10px; }
#live-diagram .edge { fill: none; stroke: var(--night-line); stroke-width: 1.6; }
#live-diagram .edge.dashed { stroke-dasharray: 4 4; }
#live-diagram .zone { fill: rgba(38, 64, 94, 0.18); stroke: var(--night-line); stroke-dasharray: 2 5; }
#live-diagram .zone-label { fill: var(--night-muted); font-size: 10px; }

#live-diagram .node { cursor: pointer; outline: none; }
#live-diagram .node rect { fill: var(--night-2); stroke: var(--night-line); stroke-width: 1.4; transition: stroke 200ms, fill 200ms; }
#live-diagram .node:hover rect, #live-diagram .node:focus-visible rect, #live-diagram .node.sel rect { stroke: var(--night-ink); }
#live-diagram .node.blink rect { stroke: #d7e6ff; fill: #183152; }
#live-diagram .node.ok rect { stroke: var(--night-teal); fill: #0f3236; }
#live-diagram .node.alert rect { stroke: var(--night-amber); fill: #3a2a0c; }
#live-diagram .node.alert .lbl { fill: var(--night-amber); }

#live-diagram .packet { stroke: none; }
#live-diagram .packet.deploy { fill: #d7e6ff; }
#live-diagram .packet.access { fill: var(--night-muted); }
#live-diagram .packet.alert { fill: var(--night-amber); }
#live-diagram .packet.fix { fill: var(--night-teal); }

.live-panel {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  border-top: 1px solid var(--night-line);
}
.info { padding: 0.9rem 1rem 1rem; border-right: 1px solid var(--night-line); min-height: 9.5rem; }
.info h3 { margin: 0; font-size: 1rem; font-stretch: 85%; font-weight: 700; color: var(--night-ink); }
.info p { margin: 0.35rem 0 0; font-size: 0.9rem; line-height: 1.5; color: #c3cfdc; }
.info a { display: inline-block; margin-top: 0.5rem; font-size: 0.875rem; font-weight: 600; color: var(--night-teal); }

.log { list-style: none; margin: 0; padding: 0.75rem 0.9rem; font-family: var(--mono); font-size: 0.72rem; line-height: 1.55; color: var(--night-muted); overflow: hidden; min-height: 9.5rem; }
.log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: logIn 260ms ease-out; }
.log time { color: #8196ad; margin-right: 0.5rem; }
.log .bad { color: var(--night-amber); }
.log .ok { color: var(--night-teal); }
@keyframes logIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Sections ---------- */
.section { padding-top: 5.5rem; }
.section-head { display: grid; gap: 0.6rem; margin-bottom: 2.25rem; max-width: 62ch; }
.section-head h2 {
  margin: 0; font-size: clamp(1.9rem, 3.8vw, 2.9rem); font-stretch: 72%; font-weight: 780; line-height: 1.02;
}
.section-head p { margin: 0; color: var(--muted); font-family: var(--serif); font-size: 1.2rem; line-height: 1.5; }

/* ---------- Results ---------- */
.results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; margin: 0; padding: 0; list-style: none; }
.results li { border-top: 2px solid var(--ink); padding-top: 1rem; }
.results .num {
  display: block; font-size: clamp(2.6rem, 5vw, 4rem); font-stretch: 66%; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.results .what { display: block; margin-top: 0.6rem; font-weight: 600; }
.results .ctx { display: block; margin-top: 0.3rem; color: var(--muted); font-size: 0.925rem; line-height: 1.45; }

/* ---------- Services ---------- */
.services { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3rem 2.5rem; }
.service { border-top: 1px solid var(--rule); padding-top: 1.25rem; display: flex; flex-direction: column; }
.service svg.icon { width: 40px; height: 40px; color: var(--ink); }
.service svg.icon .accent { stroke: var(--signal); }
.service h3 { margin: 0.9rem 0 0; font-size: 1.35rem; font-stretch: 80%; font-weight: 720; line-height: 1.15; }
.service .pain { margin: 0.5rem 0 0; font-family: var(--serif); font-size: 1.1rem; line-height: 1.5; }
.service ul { margin: 0.9rem 0 0; padding-left: 1.1rem; color: var(--muted); font-size: 0.95rem; }
.service li { margin-bottom: 0.3rem; }
.service .proof { margin: auto 0 0; padding-top: 1rem; color: var(--resolved); font-weight: 600; font-size: 0.95rem; }

/* ---------- Process ---------- */
.process {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2rem; counter-reset: step;
  position: relative;
}
.process::before {
  content: ""; position: absolute; left: 1.4rem; right: 1.4rem; top: 1.4rem; height: 2px;
  background: repeating-linear-gradient(90deg, var(--rule) 0 6px, transparent 6px 12px);
}
.process li { counter-increment: step; position: relative; }
.process li::before {
  content: counter(step);
  display: grid; place-items: center; width: 2.8rem; height: 2.8rem; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--ink);
  font-weight: 750; font-stretch: 80%; font-size: 1.15rem; position: relative;
}
.process li:last-child::before { background: var(--resolved); border-color: var(--resolved); color: #fff; }
.process h3 { margin: 1rem 0 0; font-size: 1.2rem; font-stretch: 82%; font-weight: 720; }
.process p { margin: 0.45rem 0 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; }

/* ---------- Case study ledger ---------- */
.ledger { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.ledger a {
  display: grid; grid-template-columns: 10rem minmax(0, 1fr) 15rem; gap: 0.5rem 2rem;
  padding: 1.5rem 0; border-top: 1px solid var(--rule); text-decoration: none;
}
.ledger .area { color: var(--muted); font-size: 0.875rem; padding-top: 0.45rem; display: flex; gap: 0.55rem; align-items: baseline; }
.ledger .area::before {
  content: ""; flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%;
  background: var(--signal); transform: translateY(-0.05rem); transition: background-color 220ms ease;
}
.ledger .seen { margin: 0; font-size: clamp(1.25rem, 2.2vw, 1.6rem); font-stretch: 80%; font-weight: 680; line-height: 1.15; }
.ledger .found { margin: 0.5rem 0 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.5; color: var(--muted); max-width: 62ch; }
.ledger .found b { color: var(--ink); font-weight: 600; }
.ledger .outcome { margin: 0; padding-top: 0.45rem; font-size: 0.9375rem; line-height: 1.45; color: var(--resolved); font-weight: 560; }
.ledger a:hover .seen, .ledger a:focus-visible .seen { text-decoration: underline; text-decoration-thickness: 2px; text-decoration-color: var(--signal); text-underline-offset: 0.16em; }
.ledger a:hover .area::before, .ledger a:focus-visible .area::before { background: var(--resolved); }

/* ---------- Featured project ---------- */
.feature {
  margin-top: 4rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 2.5rem 3.5rem;
  background: var(--raised); border: 1px solid var(--rule); border-radius: 8px; padding: clamp(1.25rem, 3vw, 2.5rem);
}
.feature .kicker { margin: 0; color: var(--muted); font-size: 0.9rem; }
.feature h3 { margin: 0.3rem 0 0; font-size: clamp(1.8rem, 3.4vw, 2.5rem); font-stretch: 70%; font-weight: 800; line-height: 1; }
.feature p { font-family: var(--serif); font-size: 1.1rem; line-height: 1.55; margin: 0.9rem 0 0; }
.feature ul { margin: 1rem 0 0; padding-left: 1.1rem; font-size: 0.975rem; }
.feature li { margin-bottom: 0.35rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.25rem; padding: 0; list-style: none; }
.tags li { font-size: 0.8125rem; border: 1px solid var(--rule); border-radius: 999px; padding: 0.15rem 0.6rem; margin: 0; color: var(--muted); }
.flow-figure { margin: 0; align-self: center; }
#flow { width: 100%; height: auto; display: block; }
#flow text { font-family: var(--sans); fill: var(--ink); }
#flow .step-sub { fill: var(--muted); font-size: 11px; }
#flow .step-name { font-size: 14px; font-weight: 650; }
#flow .track { fill: none; stroke: var(--rule); stroke-width: 2; }
#flow .rb { fill: none; stroke: var(--signal); stroke-width: 1.6; stroke-dasharray: 4 4; }
#flow .step circle { fill: var(--raised); stroke: var(--ink); stroke-width: 2; }
#flow .step.on circle { fill: var(--resolved); stroke: var(--resolved); }
#flow .token { fill: var(--resolved); }
#flow .rb-label { fill: var(--signal-text); font-size: 11.5px; font-weight: 650; }
.flow-figure figcaption { margin-top: 0.75rem; color: var(--muted); font-size: 0.875rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.small-btn {
  display: inline-block; background: none; border: 1px solid currentColor; color: inherit; font: inherit; font-size: 0.8125rem;
  padding: 0.2rem 0.65rem; border-radius: 3px; cursor: pointer; text-decoration: none; white-space: nowrap; opacity: 0.85;
}
.small-btn:hover { opacity: 1; }

/* ---------- About / experience ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 3rem 4rem; }
.about-lede { font-family: var(--serif); font-size: 1.25rem; line-height: 1.6; margin: 0 0 2rem; max-width: 52ch; }
.jobs { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rule); }
.jobs li { position: relative; padding: 0 0 1.75rem 1.5rem; }
.jobs li::before {
  content: ""; position: absolute; left: -0.45rem; top: 0.4rem; width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: var(--paper); border: 2px solid var(--muted);
}
.jobs li:first-child::before { background: var(--resolved); border-color: var(--resolved); }
.jobs .when { color: var(--muted); font-size: 0.875rem; }
.jobs h3 { margin: 0.15rem 0 0; font-size: 1.2rem; font-stretch: 82%; font-weight: 720; }
.jobs p { margin: 0.35rem 0 0; font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; max-width: 60ch; }
.creds { margin: 0; }
.creds div { border-top: 1px solid var(--rule); padding: 0.85rem 0; }
.creds div:last-child { border-bottom: 1px solid var(--rule); }
.creds dt { font-weight: 650; }
.creds dd { margin: 0.15rem 0 0; color: var(--muted); font-size: 0.95rem; }
.stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.75rem 2.5rem; margin: 3.5rem 0 0; }
.stack div { border-top: 2px solid var(--ink); padding-top: 0.75rem; }
.stack dt { font-weight: 700; font-stretch: 85%; font-size: 1.05rem; }
.stack dd { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.95rem; }

/* ---------- Contact / brief ---------- */
.contact-band { margin-top: 6rem; padding: clamp(3rem, 7vw, 5rem) 0; }
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 3rem 4rem; align-items: start; }
.contact h2 { margin: 0; font-size: clamp(2.2rem, 4.6vw, 3.6rem); font-stretch: 66%; font-weight: 800; line-height: 0.95; }
.contact .lede { font-family: var(--serif); font-size: 1.2rem; line-height: 1.55; color: #c9d5e2; margin: 1.2rem 0 0; max-width: 44ch; }
.contact-links { list-style: none; margin: 2rem 0 0; padding: 0; }
.contact-links li { border-top: 1px solid var(--night-line); }
.contact-links li:last-child { border-bottom: 1px solid var(--night-line); }
.contact-links a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.85rem 0; text-decoration: none; font-weight: 600; }
.contact-links span { color: var(--night-muted); font-weight: 400; overflow-wrap: anywhere; text-align: right; }
.contact-links a:hover span { color: var(--night-ink); }

.brief { border: 1px solid var(--night-line); border-radius: 8px; padding: clamp(1.1rem, 2.5vw, 1.75rem); background: rgba(18, 35, 58, 0.6); }
.brief h3 { margin: 0 0 0.25rem; font-size: 1.3rem; font-stretch: 82%; font-weight: 720; }
.brief fieldset { border: 0; margin: 1.1rem 0 0; padding: 0; }
.brief legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.55rem; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip span {
  display: inline-block; padding: 0.4rem 0.8rem; border: 1px solid var(--night-line); border-radius: 999px;
  font-size: 0.9rem; color: #c9d5e2; transition: background-color 150ms, border-color 150ms, color 150ms;
}
.chip input:checked + span { background: var(--night-teal); border-color: var(--night-teal); color: #0b1620; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--night-amber); outline-offset: 2px; }
.brief label.field { display: block; margin-top: 1.1rem; font-weight: 600; font-size: 0.95rem; }
.brief textarea {
  display: block; width: 100%; margin-top: 0.5rem; resize: vertical; min-height: 6rem;
  background: var(--night); color: var(--night-ink); border: 1px solid var(--night-line); border-radius: 4px;
  font: inherit; font-weight: 400; font-size: 1rem; padding: 0.65rem 0.75rem;
}
.brief textarea::placeholder { color: #8196ad; }
.brief .row { margin-top: 1.25rem; display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; }
.brief .note { color: var(--night-muted); font-size: 0.85rem; margin: 0; }
.mail-fallback { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--night-line); }
.mail-fallback p { margin: 0 0 0.6rem; font-size: 0.9rem; color: #c9d5e2; }
.mail-fallback .row { margin-top: 0; }
.mail-fallback .small-btn { color: var(--night-ink); font-size: 0.875rem; padding: 0.35rem 0.8rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule); padding-top: 1.75rem; padding-bottom: 3rem; margin-top: 0;
  color: var(--muted); font-size: 0.9375rem; display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
}
.site-footer p { margin: 0; max-width: 62ch; }
.night + .site-footer, .contact-band + .site-footer { border-top: 0; padding-top: 2rem; }

/* ---------- Case study pages ---------- */
.case { padding-top: clamp(2rem, 6vw, 4.5rem); }
.back { color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
.back:hover { color: var(--ink); }
.case-area { margin: 2.25rem 0 0.75rem; color: var(--muted); font-size: 0.9375rem; display: flex; gap: 0.55rem; align-items: baseline; }
.case-area::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--signal); flex: none; }
.case h1 { margin: 0; max-width: 22ch; font-size: clamp(2.2rem, 5.6vw, 4.25rem); font-stretch: 70%; font-weight: 780; line-height: 0.98; letter-spacing: -0.01em; }
.dek { margin: 1.5rem 0 0; max-width: 58ch; font-family: var(--serif); font-size: clamp(1.2rem, 1.8vw, 1.4rem); line-height: 1.5; }
.facts { margin: 2.5rem 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem 2rem; border-top: 2px solid var(--ink); padding-top: 1rem; max-width: 62rem; }
.facts dt { font-size: 0.875rem; color: var(--muted); }
.facts dd { margin: 0.25rem 0 0; font-size: 0.975rem; line-height: 1.45; }
.facts .outcome dd { color: var(--resolved); font-weight: 600; }

.prose { margin-top: 3.5rem; max-width: var(--measure); font-family: var(--serif); font-size: 1.1875rem; line-height: 1.68; }
.prose h2 { font-family: var(--sans); font-size: 1.5rem; font-stretch: 82%; font-weight: 720; line-height: 1.15; margin: 3rem 0 0.75rem; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.45rem; }
.prose li::marker { color: var(--muted); }
.prose strong { font-weight: 600; }
.prose code, .ledger code, .feature code {
  font-family: var(--mono); font-size: 0.82em; background: var(--code-bg); padding: 0.1em 0.35em; border-radius: 3px; overflow-wrap: anywhere;
}
.prose pre { margin: 0 0 1.25rem; padding: 1rem 1.15rem; background: var(--code-bg); border-radius: 4px; overflow-x: auto; font-size: 0.95rem; line-height: 1.5; }
.prose pre code { background: none; padding: 0; font-size: 0.85em; }

.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; }
.prose table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 0.975rem; line-height: 1.45; min-width: 34rem; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 0.7rem 1rem 0.7rem 0; border-top: 1px solid var(--rule); }
.prose thead th { border-top: 2px solid var(--ink); font-weight: 650; }
.prose tbody tr:last-child td { border-bottom: 1px solid var(--rule); }

.timeline { list-style: none; padding: 0 !important; margin: 0 0 1.5rem; border-left: 2px solid var(--rule); }
.timeline li { position: relative; padding: 0 0 1.1rem 1.4rem; margin: 0; }
.timeline li::before { content: ""; position: absolute; left: -0.4rem; top: 0.55rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--muted); }
.timeline li.bad::before { background: var(--signal); border-color: var(--signal); }
.timeline li.good::before { background: var(--resolved); border-color: var(--resolved); }
.timeline .when { display: block; font-family: var(--sans); font-size: 0.875rem; font-weight: 650; color: var(--muted); }

.lessons { margin: 3rem 0 0; padding: 1.25rem 1.4rem 0.4rem; background: var(--raised); border-left: 3px solid var(--resolved); border-radius: 0 4px 4px 0; }
.lessons h2 { margin-top: 0; }

.bars { margin: 0.5rem 0 1.75rem; font-family: var(--sans); font-size: 0.95rem; }
.bar { margin-bottom: 1rem; }
.bar-label { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.35rem; }
.bar-label b { font-weight: 650; }
.bar-track { height: 0.9rem; background: var(--code-bg); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; }
.bar-fill.slow { width: 100%; background: var(--signal); }
.bar-fill.fast { width: 0.4%; min-width: 3px; background: var(--resolved); }
.bars figcaption { color: var(--muted); font-size: 0.875rem; }

.case-cta {
  margin-top: 4rem; padding: 1.5rem 1.6rem; border-radius: 8px; background: var(--night); color: var(--night-ink);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem 2rem; max-width: 62rem;
}
.case-cta p { margin: 0; font-family: var(--serif); font-size: 1.2rem; line-height: 1.45; max-width: 44ch; }
.case-cta .button { background: var(--night-amber); color: #111a24; }
.case-cta .button:hover { background: var(--night-teal); }

.pager { margin-top: 3.5rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; border-top: 1px solid var(--rule); padding-top: 1.5rem; margin-bottom: 4rem; }
.pager a { text-decoration: none; display: block; }
.pager span { display: block; color: var(--muted); font-size: 0.875rem; }
.pager b { display: block; font-stretch: 85%; font-weight: 680; font-size: 1.1rem; line-height: 1.25; margin-top: 0.2rem; }
.pager a:hover b { text-decoration: underline; text-decoration-color: var(--signal); }
.pager .next { text-align: right; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .hero { grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
  .hero h1 { max-width: 14ch; }
  .services { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature, .about, .contact { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ledger a { grid-template-columns: minmax(0, 1fr); gap: 0.4rem; }
  .ledger .area, .ledger .outcome { padding-top: 0; }
  .process { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process::before { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-nav { gap: 1rem; }
  .site-nav .hide-sm { display: none; }
  .services, .process { grid-template-columns: minmax(0, 1fr); }
  .results { gap: 1.5rem; }
  .live-panel { grid-template-columns: minmax(0, 1fr); }
  #live-diagram { min-width: 600px; }
  .info { border-right: 0; border-bottom: 1px solid var(--night-line); min-height: 0; }
  .log { min-height: 0; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .prose { font-size: 1.125rem; }
  .prose table { min-width: 0; font-size: 0.9rem; }
  .prose th, .prose td { padding-right: 0.75rem; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .site-header nav, .pager, .hero-actions, .case-cta { display: none; }
  body { background: #fff; color: #000; }
}
