/* ModernCI: one design system for the site and the product UI.
   No build step. No external hosts. Works without JavaScript.
   Spec: docs/SITE-DESIGN.md */

@font-face {
  font-family: "Atkinson Next";
  src: url("fonts/atkinson-next.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Mono";
  src: url("fonts/atkinson-mono.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* ---------- tokens ---------- */
/* One set, two themes: each colour is light-dark(paper, carbon) and resolves from the element's
   colour-scheme. By default that follows the OS (prefers-color-scheme); the theme toggle pins it
   with data-theme on <html> (light or dark; absent means follow the OS). WCAG AA in both: text
   4.5:1 (state chips on their own tint too), controls, focus rings and chart marks 3:1; the check
   is crates/ui/src/theme/contrast.rs. */
:root {
  color-scheme: light dark;

  /* paper (light) / carbon (dark: warm, not the category's blue-black) */
  --paper: light-dark(#F4F1E8, #15140F);    /* page */
  --sheet: light-dark(#FBF9F3, #1C1B15);    /* raised: ledgers, files, cards */
  --sunk: light-dark(#EBE6D8, #232119);     /* header bands, wells */
  --ink: light-dark(#16150F, #EDE7D7);      /* text */
  --ink-2: light-dark(#57534A, #B3AC99);    /* secondary text */
  --ink-3: light-dark(#65615A, #9A9483);    /* labels */
  --rule: light-dark(#D9D3C2, #2E2C24);     /* hairlines (decorative) */
  --rule-2: light-dark(#B9B19C, #45423A);   /* stronger hairlines (decorative) */
  --control: light-dark(#8A836F, #7A7462);  /* form/control borders, 3:1 */
  --copper: light-dark(#A3441A, #E8915F);   /* the one brand accent: links, the double rule, focus */
  --green: light-dark(#17693A, #6FCB8E);  --green-bg: light-dark(#DDEBDD, #1D2A20);
  --red: light-dark(#B0182F, #FF8089);    --red-bg: light-dark(#F7DEDC, #33191C);
  --amber: light-dark(#8A5800, #E5B550);  --amber-bg: light-dark(#F3E5C2, #2E2614);
  --blue: light-dark(#1D5C8C, #8CC0EC);   --blue-bg: light-dark(#DCE7F1, #18232E);
  --violet: light-dark(#6A3D9A, #C9A9F0); --violet-bg: light-dark(#E9E0F3, #251D30);

  --sans: "Atkinson Next", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Atkinson Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* 4 px spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  /* type scale */
  --t-xs: 12px; --t-sm: 14px; --t-md: 17px; --t-lg: 20px; --t-xl: 25px; --t-2xl: 32px;
  --t-3xl: clamp(32px, 3.6vw, 44px);
  --t-4xl: clamp(36px, 5vw, 64px);

  --wrap: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 6px;
  /* Controls (the console's fields, selects and buttons): one height, one inset, one radius. */
  --control-h: 36px; --control-px: 10px; --control-radius: 4px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-md)/1.55 var(--sans);
  font-feature-settings: "kern";
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.12; letter-spacing: -0.015em; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--copper); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--copper); outline-offset: 2px; border-radius: 2px; }
code, kbd, pre, .mono { font-family: var(--mono); font-feature-settings: "zero"; }
code { font-size: 0.92em; }
img, svg { display: block; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--s4); top: -100px; background: var(--ink); color: var(--paper); padding: var(--s2) var(--s4); z-index: 10; }
.skip:focus { top: var(--s2); }

.wrap { max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- the move glyph: branch -> branch ---------- */
/* The real "→" stays in the text for copy and screen readers; the drawn arrow is ours. */
.to {
  display: inline-block; position: relative; width: 1.3em; color: transparent;
  vertical-align: baseline; user-select: all;
}
.to::before {
  content: ""; position: absolute; left: 0.15em; right: 0.15em; top: 0.18em; bottom: 0.12em;
  background: var(--copper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12'%3E%3Cpath d='M1 6h15M11 1.5 16.5 6 11 10.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 12'%3E%3Cpath d='M1 6h15M11 1.5 16.5 6 11 10.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
}
.move { font-family: var(--mono); white-space: nowrap; }

/* ---------- verdict chips: colour + shape + word ---------- */
.v {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 var(--t-xs)/1 var(--mono); text-transform: lowercase;
  padding: 4px 8px 4px 6px; border-radius: 3px; white-space: nowrap;
}
.v::before { content: ""; width: 8px; height: 8px; flex: none; }
.v-merged { color: var(--green); background: var(--green-bg); }
.v-merged::before { border-radius: 50%; background: var(--green); }
.v-green { color: var(--green); background: var(--green-bg); }
.v-green::before { border-radius: 50%; border: 2px solid var(--green); }
.v-red { color: var(--red); background: var(--red-bg); }
.v-red::before { background: var(--red); transform: rotate(45deg) scale(0.85); }
.v-wait { color: var(--amber); background: var(--amber-bg); }
.v-wait::before { border-radius: 50%; border: 2px dashed var(--amber); }
.v-run { color: var(--ink-2); background: var(--sunk); }
.v-run::before { border-radius: 50%; background: conic-gradient(var(--ink-2) 0 50%, transparent 0); border: 1.5px solid var(--ink-2); }
@media (prefers-reduced-motion: no-preference) {
  .v-run::before { animation: spin 1.6s linear infinite; }
  @keyframes spin { to { transform: rotate(1turn); } }
}

/* tags and small labels */
.tag {
  display: inline-block; font: 700 11px/1 var(--mono);
  color: var(--ink-3); border: 1px solid var(--rule-2); border-radius: 3px; padding: 4px 6px;
}
.tag-ex { color: var(--amber); border-color: currentColor; }
.label { font: 700 var(--t-xs)/1.3 var(--mono); color: var(--ink-3); }

/* ---------- shell: one bar for signed-out and signed-in ---------- */
.bar { border-bottom: 1px solid var(--rule); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.bar-in { display: flex; align-items: center; gap: var(--s5); height: 60px; }
.wm { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.wm .mark { width: 24px; height: 24px; flex: none; }
.wm-name { font: 700 19px/1 var(--mono); letter-spacing: -0.02em; }
.tagline { font: 400 var(--t-sm)/1 var(--sans); color: var(--ink-2); padding-left: var(--s4); border-left: 1px solid var(--rule-2); white-space: nowrap; }
.nav { display: flex; gap: var(--s1); margin-left: auto; align-items: center; }
.nav a { color: var(--ink-2); text-decoration: none; font-size: var(--t-sm); padding: 8px 10px; border-radius: 4px; }
.nav a:hover { color: var(--ink); background: var(--sunk); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--copper); border-radius: 0; }
.bar-end { display: flex; gap: var(--s2); align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 700 var(--t-sm)/1 var(--sans);
  padding: 10px 14px; border-radius: 4px; text-decoration: none; border: 1px solid var(--control); color: var(--ink); background: transparent; white-space: nowrap;
}
.btn:hover { background: var(--sunk); }
.btn-ink { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn-ink:hover { background: var(--ink); opacity: 0.88; }
.menu { display: none; }
.menu summary { list-style: none; cursor: pointer; font: 700 var(--t-sm)/1 var(--mono); padding: 10px 12px; border: 1px solid var(--control); border-radius: 4px; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] .menu-list { display: grid; }
.menu-list { display: none; position: absolute; right: var(--gutter); left: var(--gutter); top: 60px; background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: var(--s2); gap: 2px; box-shadow: 0 12px 24px -12px rgb(0 0 0 / 0.25); }
.menu-list a { color: var(--ink); text-decoration: none; padding: 12px; border-radius: 4px; }
.menu-list a:hover { background: var(--sunk); }

@media (max-width: 1020px) { .tagline { display: none; } }
@media (max-width: 860px) {
  .nav, .bar-end .btn:not(.btn-ink) { display: none; }
  .menu { display: block; margin-left: auto; }
  .bar-end { gap: var(--s2); }
}
@media (max-width: 420px) { .bar-end .btn-ink { display: none; } }

/* ---------- sections ---------- */
.sec { padding: var(--s9) 0; border-top: 1px solid var(--rule); }
.sec-head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5) var(--s7); margin-bottom: var(--s7); align-items: end; }
.sec-head h2 { font-size: var(--t-3xl); }
.sec-head p { color: var(--ink-2); font-size: var(--t-lg); max-width: 60ch; }
.sec-num { font: 700 var(--t-xs)/1 var(--mono); color: var(--copper); display: block; margin-bottom: var(--s4); }
@media (max-width: 860px) {
  .sec { padding: var(--s8) 0; }
  .sec-head { grid-template-columns: 1fr; margin-bottom: var(--s6); }
  .sec-head p { font-size: var(--t-md); }
}

/* ---------- hero ---------- */
.hero { padding: var(--s7) 0 var(--s7); }
.hero-cta { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; margin-top: var(--s5); }
.hero-cta .cmd { flex: 0 1 auto; max-width: 100%; min-width: 0; }
.hero-top > * { min-width: 0; }
@media (max-width: 520px) { .hero-cta .cmd { flex: 1 1 100%; } }
.bottom-card { border-top: 1px solid var(--ink); padding-top: var(--s4); display: grid; gap: var(--s3); justify-items: start; }
.bottom-card p { color: var(--ink-2); font-size: var(--t-sm); }
.hero-top { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: var(--s7); align-items: end; }
.kicker { display: inline-flex; align-items: center; gap: 10px; font: 700 var(--t-sm)/1 var(--mono); color: var(--ink); margin-bottom: var(--s5); }
.kicker::before { content: ""; width: 18px; height: 6px; border-top: 1.5px solid var(--copper); border-bottom: 1.5px solid var(--copper); }
.hero h1 { font-size: var(--t-4xl); line-height: 1.04; letter-spacing: -0.025em; max-width: 17ch; }
.hero h1 { font-size: clamp(48px, 6.4vw, 92px); line-height: 0.95; letter-spacing: -0.035em; }
.hero-line { font: 700 clamp(22px, 2.3vw, 31px)/1.22 var(--sans); letter-spacing: -0.015em; max-width: 32ch; margin-top: var(--s4); text-wrap: balance; }
.hero-line em { font-style: normal; text-decoration: underline double var(--copper); text-decoration-thickness: 2px; text-underline-offset: 0.18em; text-decoration-skip-ink: none; }
.hero-sub { color: var(--ink-2); font-size: var(--t-lg); max-width: 50ch; margin-top: var(--s4); }
.hero-side { display: grid; gap: var(--s4); padding-bottom: 6px; }
.hero-side .cmd { width: 100%; }
.hero-ledger { margin-top: var(--s6); }
@media (max-width: 960px) { .hero-top { grid-template-columns: 1fr; gap: var(--s6); } }
@media (max-width: 860px) { .hero { padding-top: var(--s7); } .hero-sub { font-size: var(--t-md); } }

/* a command you can select with one click, no JS */
.cmd {
  display: flex; align-items: center; gap: 10px; font: 400 var(--t-sm)/1.4 var(--mono);
  background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 4px; padding: 12px 14px; overflow-x: auto; white-space: nowrap;
}
.cmd::before { content: "$"; color: var(--ink-3); user-select: none; }
.cmd code { user-select: all; font-size: inherit; }
.cmds { display: grid; gap: var(--s2); }

/* ---------- THE LEDGER: the signature element ---------- */
.ledger { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; }
.ledger-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--rule-2); background: var(--sunk); }
.ledger-title { font: 700 var(--t-sm)/1.2 var(--mono); }
.ledger-title span { color: var(--ink-3); font-weight: 400; }
.ledger-head .tag { margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 6px; font: 400 var(--t-xs)/1 var(--mono); color: var(--ink-3); }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
@media (prefers-reduced-motion: no-preference) {
  .live::before { animation: pulse 2s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.25; } }
}

.lt { width: 100%; border-collapse: collapse; font: 400 var(--t-sm)/1.35 var(--mono); font-variant-numeric: tabular-nums; }
.lt th { text-align: left; font: 700 11px/1.2 var(--mono); color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--rule-2); white-space: nowrap; }
.lt td { white-space: nowrap; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.lt th:first-child, .lt td:first-child { padding-left: 16px; }
.lt th:last-child, .lt td:last-child { padding-right: 16px; }
.lt .r { text-align: right; }
.lt .dim { color: var(--ink-3); }
.lt .memo td { white-space: normal; padding-top: 0; color: var(--ink-2); font: 400 13px/1.45 var(--sans); padding-left: calc(16px + 6ch); }
.lt tr:has(+ .memo) td { border-bottom: 0; }
.lt .memo code { font-size: 12.5px; }
.lt .why { display: block; max-width: 62ch; font-family: var(--sans); font-size: 13px !important; line-height: 1.4; color: var(--ink-2); font-size: var(--t-xs); margin-top: 4px; white-space: normal; }
.lt tbody tr:hover td { background: color-mix(in srgb, var(--sunk) 55%, transparent); }
.lt .pr { color: var(--ink-3); }
.lt .zero { color: var(--green); }

/* new rows ink in on load; static and complete without motion or JS */
@media (prefers-reduced-motion: no-preference) {
  .lt.ink tbody tr { animation: inkin 0.5s ease-out both; }
  .lt.ink tbody tr:nth-child(n+3) { animation-delay: 0.12s; }
  .lt.ink tbody tr:nth-child(n+5) { animation-delay: 0.24s; }
  .lt.ink tbody tr:nth-child(n+7) { animation-delay: 0.36s; }
  .lt.ink tbody tr:nth-child(n+9) { animation-delay: 0.48s; }
  @keyframes inkin { from { opacity: 0; transform: translateY(-4px); } }
}

/* the bottom line: single rule above, double rule below (the accountant's total) */
.bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s5); flex-wrap: wrap; padding: 16px 16px 18px; border-top: 1px solid var(--ink); background: var(--sheet); }
.bottom-label { font: 700 var(--t-sm)/1.3 var(--sans); }
.bottom-label small { display: block; font: 400 var(--t-xs)/1.4 var(--mono); color: var(--ink-3); margin-top: 2px; }
.fig { font: 700 var(--t-2xl)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; padding-bottom: 7px; border-bottom: 4px double var(--copper); }
.fig-xl { font-size: clamp(44px, 6vw, 80px); border-bottom-width: 6px; padding-bottom: 10px; }
.fig .unit { font-size: 0.45em; color: var(--ink-3); font-weight: 400; letter-spacing: 0; margin-left: 6px; }
.ledger-foot { padding: 10px 16px; font: 400 var(--t-xs)/1.5 var(--mono); color: var(--ink-3); border-top: 1px solid var(--rule); background: var(--sunk); }

/* narrow screens: each ledger row becomes a two-line entry */
@media (max-width: 760px) {
  .lt.stack thead { display: none; }
  .lt.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 16px; border-bottom: 1px solid var(--rule); }
  .lt.stack td { padding: 0 !important; border: 0; }
  .lt.stack td[data-k]::before { content: attr(data-k) " "; color: var(--ink-3); font-size: 11px; }
  .lt.stack .c-move { grid-column: 1; }
  .lt.stack .c-v { grid-column: 2; grid-row: 1; justify-self: end; }
  .lt.stack .c-cost { grid-column: 2; text-align: right; font-weight: 700; }
  .lt.stack .hide-s { display: none; }
  .lt.stack .r { text-align: left; }
  .lt.stack tbody tr:hover td { background: none; }
  .lt.stack tr:has(+ .memo) { border-bottom: 0; padding-bottom: 4px; }
  .lt.stack .memo { display: block; padding-top: 0; }
  .lt.stack .memo td { display: block; padding-left: 0 !important; }
}

/* ---------- files: real artifacts on paper, not a black terminal ---------- */
.file { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.file-tab { display: flex; justify-content: space-between; gap: var(--s3); padding: 10px 14px; background: var(--sunk); border-bottom: 1px solid var(--rule-2); font: 700 var(--t-xs)/1.3 var(--mono); }
.file-tab span { color: var(--ink-3); font-weight: 400; }
.file pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; font: 400 13.5px/1.65 var(--mono); tab-size: 2; }
.file pre .k { color: var(--ink); font-weight: 700; }
.file pre .s { color: var(--ink-2); }
.file pre .c { color: var(--ink-3); }
.file pre .a { color: var(--copper); }
.file pre .g { color: var(--green); }
.file pre .x { color: var(--red); }

/* ---------- the work item an agent receives ---------- */
.wi { background: var(--sheet); border: 1px solid var(--rule-2); border-left: 4px solid var(--red); border-radius: var(--radius); overflow: hidden; min-width: 0; }
.wi-head { padding: 14px 16px; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; }
.wi-id { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; font: 400 var(--t-xs)/1.3 var(--mono); color: var(--ink-3); }
.wi-title { font: 700 var(--t-md)/1.35 var(--mono); }
.wi dl { margin: 0; display: grid; grid-template-columns: 9.5em minmax(0, 1fr); font: 400 13px/1.55 var(--mono); }
.wi dt, .wi dd { margin: 0; padding: 9px 16px; border-bottom: 1px solid var(--rule); }
.wi dt { color: var(--ink-3); padding-right: 0; }
.wi dd { padding-left: 8px; min-width: 0; overflow-wrap: anywhere; }
.wi dd pre { margin: 0; white-space: pre-wrap; font: inherit; }
.wi .hl { background: var(--red-bg); color: var(--red); padding: 0 3px; border-radius: 2px; }
@media (max-width: 520px) {
  .wi dl { grid-template-columns: 1fr; }
  .wi dt { padding-bottom: 0; border-bottom: 0; }
  .wi dd { padding-left: 16px; }
}

/* ---------- grids and cards ---------- */
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s5); }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s5); }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s5); }
@media (max-width: 960px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); padding: var(--s5); min-width: 0; }
.card h3 { font-size: var(--t-lg); margin-bottom: var(--s2); }
.card p { color: var(--ink-2); font-size: var(--t-md); }
.card .label { display: block; margin-bottom: var(--s3); }

/* the problem: lived numbers, as an incident log */
.log { border-top: 1px solid var(--ink); }
.log-row { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--s5); padding: var(--s5) 0; border-bottom: 1px solid var(--rule-2); align-items: baseline; }
.log-fig { font: 700 clamp(28px, 3.2vw, 40px)/1 var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.log-fig small { font-size: 0.45em; color: var(--ink-3); font-weight: 400; letter-spacing: 0; }
.log-row p { font-size: var(--t-lg); }
.log-row p span { color: var(--ink-2); }
@media (max-width: 760px) { .log-row { grid-template-columns: 1fr; gap: var(--s2); } .log-row p { font-size: var(--t-md); } }

/* the chain: quality -> speed -> cost */
.chain { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--sheet); }
.link { padding: var(--s5); position: relative; min-width: 0; }
.link + .link { border-left: 1px solid var(--rule-2); }
.link + .link::before {
  content: ""; position: absolute; left: -13px; top: 30px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--rule-2);
}
/* the arrow is a mask over the accent, so it follows the theme */
.link + .link::after {
  content: ""; position: absolute; left: -10px; top: 33px; width: 18px; height: 18px; background: var(--copper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12h11M13 7.5 17.5 12 13 16.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12h11M13 7.5 17.5 12 13 16.5' fill='none' stroke='black' stroke-width='2' stroke-linecap='square'/%3E%3C/svg%3E") center / contain no-repeat;
}
.link .label { display: block; margin-bottom: var(--s3); }
.link h3 { font-size: var(--t-lg); margin-bottom: var(--s2); }
.link p { color: var(--ink-2); font-size: var(--t-sm); }
.link:last-child h3 { display: inline-block; padding-bottom: 5px; border-bottom: 4px double var(--copper); }
@media (max-width: 860px) {
  .chain { grid-template-columns: 1fr; }
  .link + .link { border-left: 0; border-top: 1px solid var(--rule-2); }
  .link + .link::before { left: var(--s5); top: -13px; transform: rotate(90deg); }
  .link + .link::after { left: calc(var(--s5) + 3px); top: -10px; transform: rotate(90deg); }
}
.rule-note { margin-top: var(--s5); display: flex; gap: var(--s5); flex-wrap: wrap; color: var(--ink-2); font-size: var(--t-sm); }
.rule-note b { color: var(--ink); }

/* the loop */
.loop { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--s5); align-items: start; }
.steps { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--ink); counter-reset: st; }
.steps li { counter-increment: st; display: grid; grid-template-columns: 2.4em minmax(0, 1fr); gap: var(--s3); padding: var(--s4) 0; border-bottom: 1px solid var(--rule-2); }
.steps li::before { content: counter(st, decimal-leading-zero); font: 700 var(--t-sm)/1.6 var(--mono); color: var(--copper); }
.steps b { display: block; font-size: var(--t-md); }
.steps span { color: var(--ink-2); font-size: var(--t-sm); }
.steps li.redstep::before { color: var(--red); }
.stack-artifacts { display: grid; gap: var(--s4); min-width: 0; }
@media (max-width: 960px) { .loop { grid-template-columns: 1fr; } }

/* honest agents */
.proof { display: grid; gap: var(--s3); }
.proof .mini { font: 400 13px/1.55 var(--mono); border-top: 1px solid var(--rule); padding-top: var(--s3); margin-top: var(--s4); color: var(--ink-2); }
.mini .row { display: flex; justify-content: space-between; gap: var(--s3); }
.mini .row b { color: var(--ink); font-weight: 700; }
.mini .bad { color: var(--red); font-weight: 700; }
.mini .ok { color: var(--green); font-weight: 700; }

/* before / after */
.ba { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 4fr) minmax(0, 4fr); background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; font-variant-numeric: tabular-nums; }
.ba > div { padding: 12px 16px; border-bottom: 1px solid var(--rule); min-width: 0; }
.ba .h { background: var(--sunk); border-bottom-color: var(--rule-2); font: 700 var(--t-xs)/1.4 var(--mono); color: var(--ink-3); }
.ba .h b { display: block; color: var(--ink); text-transform: none; letter-spacing: 0; font-size: var(--t-sm); }
.ba .k { font-size: var(--t-sm); font-weight: 700; }
.ba .k small { display: block; font-weight: 400; color: var(--ink-3); font-size: var(--t-xs); }
.ba .m { font: 400 var(--t-sm)/1.45 var(--mono); color: var(--ink-2); }
.ba .tot { border-top: 1px solid var(--ink); border-bottom: 0; padding-top: 16px; padding-bottom: 16px; }
.pending { display: inline-block; font: 700 11px/1 var(--mono); color: var(--amber); border: 1px dashed currentColor; border-radius: 3px; padding: 4px 6px; }
@media (max-width: 760px) {
  .ba { grid-template-columns: 1fr 1fr; }
  .ba .k, .ba .h:first-child { grid-column: 1 / -1; background: var(--sunk); }
  .ba .h:first-child { display: none; }
}

/* topology: your daemon, hosts connect out */
.topo { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1.2fr) auto minmax(0, 1fr); align-items: center; gap: var(--s3); }
.node { border: 1px solid var(--rule-2); background: var(--sheet); border-radius: var(--radius); padding: var(--s4); font: 400 13px/1.55 var(--mono); }
.node .label { display: block; margin-bottom: var(--s2); }
.node.core { border: 1.5px solid var(--ink); }
.node.opt { border-style: dashed; background: transparent; }
.node ul { margin: 0; padding: 0; list-style: none; color: var(--ink-2); }
.wire { font: 400 var(--t-xs)/1.3 var(--mono); color: var(--ink-3); text-align: center; }
.wire::before { content: ""; display: block; width: 56px; height: 12px; margin: 0 auto 6px; background: var(--copper);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 12'%3E%3Cpath d='M1 6h52M47 1.5 52.5 6 47 10.5' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 12'%3E%3Cpath d='M1 6h52M47 1.5 52.5 6 47 10.5' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E") center / contain no-repeat; }
.wire.back::before { transform: scaleX(-1); }
@media (max-width: 860px) {
  .topo { grid-template-columns: 1fr; }
  .wire { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 4px 0; }
  .wire::before { width: 12px; height: 32px; margin: 0;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 32'%3E%3Cpath d='M6 1v28M1.5 24 6 29.5 10.5 24' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
            mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 32'%3E%3Cpath d='M6 1v28M1.5 24 6 29.5 10.5 24' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E"); }
  .wire.back::before { transform: scaleY(-1); }
}

/* ---------- page heads (inner pages) ---------- */
.phead { padding: var(--s8) 0 var(--s7); }
.phead h1 { font-size: var(--t-4xl); line-height: 1.05; letter-spacing: -0.025em; max-width: 20ch; }
.phead p { color: var(--ink-2); font-size: var(--t-lg); max-width: 58ch; margin-top: var(--s5); }
@media (max-width: 860px) { .phead { padding: var(--s7) 0 var(--s6); } .phead p { font-size: var(--t-md); } }

/* how it works: sticky index + chapters, no JS */
.chapters { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s8); align-items: start; }
.toc { position: sticky; top: 84px; font: 400 var(--t-sm)/1.4 var(--mono); }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--rule-2); }
.toc a { display: block; padding: 7px 0 7px 14px; color: var(--ink-2); text-decoration: none; margin-left: -1px; border-left: 2px solid transparent; }
.toc a:hover { color: var(--ink); border-left-color: var(--copper); }
.toc .label { display: block; margin-bottom: var(--s3); }
.chapter { padding: 0 0 var(--s8); scroll-margin-top: 84px; }
.chapter + .chapter { border-top: 1px solid var(--rule); padding-top: var(--s7); }
.chapter-h { display: grid; grid-template-columns: 3.2em minmax(0, 1fr); gap: var(--s2); margin-bottom: var(--s5); }
.chapter-h .n { font: 700 var(--t-xl)/1.2 var(--mono); color: var(--copper); }
.chapter-h h2 { font-size: var(--t-2xl); }
.chapter-h p { grid-column: 2; color: var(--ink-2); font-size: var(--t-lg); max-width: 60ch; margin-top: var(--s2); }
.chapter-body { display: grid; gap: var(--s4); margin-left: calc(3.2em + var(--s2)); }
@media (max-width: 960px) {
  .chapters { grid-template-columns: 1fr; gap: var(--s5); }
  .toc { position: static; }
  .toc ol { display: flex; flex-wrap: wrap; border-left: 0; gap: 4px; }
  .toc a { border: 1px solid var(--rule-2); border-radius: 3px; padding: 6px 10px; margin: 0; }
  .chapter-body { margin-left: 0; }
  .chapter-h { grid-template-columns: 2.6em minmax(0, 1fr); }
  .chapter-h p { grid-column: 1 / -1; font-size: var(--t-md); }
}

/* failure ladder */
.ladder { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.rung { padding: var(--s4); border-right: 1px solid var(--rule); font-size: var(--t-sm); position: relative; min-width: 0; }
.rung:last-child { border-right: 0; background: var(--sunk); }
.rung .label { display: block; margin-bottom: var(--s2); }
.rung b { display: block; font-family: var(--mono); margin-bottom: 4px; }
.rung span { color: var(--ink-2); }
.rung.now { box-shadow: inset 0 3px 0 var(--red); }
@media (max-width: 760px) { .ladder { grid-template-columns: 1fr 1fr; } .rung:nth-child(2) { border-right: 0; } .rung:nth-child(-n+2) { border-bottom: 1px solid var(--rule); } }

/* question card */
.q { background: var(--sheet); border: 1px solid var(--rule-2); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: var(--s4) var(--s5); display: grid; gap: var(--s3); }
.q .wi-id { color: var(--ink-3); }
.q h4 { font-size: var(--t-md); }
.q ol { margin: 0; padding-left: 1.4em; color: var(--ink-2); font-size: var(--t-sm); display: grid; gap: 4px; }
.q .rec { font: 400 13px/1.5 var(--mono); color: var(--ink-2); border-top: 1px solid var(--rule); padding-top: var(--s3); }
.q .acts { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* desired-state loop */
.dsl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; }
.dsl div { padding: var(--s4); border-right: 1px solid var(--rule); background: var(--sheet); }
.dsl div:last-child { border-right: 0; }
.dsl b { font-family: var(--mono); display: block; margin-bottom: 4px; }
.dsl span { color: var(--ink-2); font-size: var(--t-sm); }
@media (max-width: 760px) { .dsl { grid-template-columns: 1fr 1fr; } .dsl div:nth-child(2) { border-right: 0; } .dsl div:nth-child(-n+2) { border-bottom: 1px solid var(--rule); } }

/* prose lists */
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.ticks li { padding-left: 22px; position: relative; color: var(--ink-2); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 10px; height: 5px; border-top: 1.5px solid var(--copper); border-bottom: 1.5px solid var(--copper); }
.ticks b { color: var(--ink); }

/* plain data table (compare, cost) */
.dt-wrap { overflow-x: auto; border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--sheet); }
.dt { width: 100%; border-collapse: collapse; font-size: var(--t-sm); min-width: 720px; }
.dt th { text-align: left; font: 700 11px/1.3 var(--mono); color: var(--ink-3); background: var(--sunk); padding: 10px 14px; border-bottom: 1px solid var(--rule-2); }
.dt td { padding: 14px; border-bottom: 1px solid var(--rule); vertical-align: top; color: var(--ink-2); }
.dt td:first-child { color: var(--ink); font-weight: 700; }
.dt tr:last-child td { border-bottom: 0; }
.dt .mono { font-size: 13px; }

/* pricing */
.price { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.plan { padding: var(--s5); border-right: 1px solid var(--rule-2); display: grid; gap: var(--s3); align-content: start; }
.plan:last-child { border-right: 0; }
.plan h3 { font-size: var(--t-xl); }
.plan .fig { font-size: var(--t-2xl); justify-self: start; }
.plan p { color: var(--ink-2); font-size: var(--t-sm); }
@media (max-width: 860px) { .price { grid-template-columns: 1fr; } .plan { border-right: 0; border-bottom: 1px solid var(--rule-2); } .plan:last-child { border-bottom: 0; } }

.eq { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); font: 400 var(--t-lg)/1.3 var(--mono); padding: var(--s6) var(--s5); background: var(--sheet); border: 1px solid var(--rule-2); border-radius: var(--radius); }
.eq .term { display: grid; gap: 4px; }
.eq .term small { font: 400 var(--t-xs)/1.3 var(--sans); color: var(--ink-3); }
.eq .op { color: var(--copper); font-weight: 700; font-size: var(--t-xl); }
.eq .frac { display: grid; text-align: center; }
.eq .frac > span:first-child { border-bottom: 1.5px solid var(--ink); padding: 0 6px 6px; }
.eq .frac > span:last-child { padding: 6px 6px 0; }
.eq .res { padding-bottom: 6px; border-bottom: 4px double var(--copper); font-weight: 700; }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--ink); padding: var(--s7) 0 var(--s8); margin-top: var(--s8); font-size: var(--t-sm); }
.foot-in { display: grid; grid-template-columns: minmax(0, 4fr) repeat(3, minmax(0, 2fr)); gap: var(--s5); }
.foot p { color: var(--ink-2); max-width: 36ch; margin-top: var(--s3); }
.foot h4 { font: 700 11px/1.3 var(--mono); color: var(--ink-3); margin-bottom: var(--s3); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.foot ul a { color: var(--ink-2); text-decoration: none; }
.foot ul a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 760px) { .foot-in { grid-template-columns: 1fr 1fr; } .foot-in > div:first-child { grid-column: 1 / -1; } }

/* ---------- the app (signed in): same tokens, same components ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 61px); }
.rail { border-right: 1px solid var(--rule); padding: var(--s5) var(--s4); font-size: var(--t-sm); background: var(--paper); }
.rail .label { display: block; margin: var(--s5) 0 var(--s2) 10px; }
.rail .label:first-child { margin-top: 0; }
.rail a { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 4px; color: var(--ink-2); text-decoration: none; }
.rail a:hover { background: var(--sunk); color: var(--ink); }
.rail a[aria-current="page"] { background: var(--sheet); color: var(--ink); font-weight: 700; box-shadow: inset 2px 0 0 var(--copper), 0 0 0 1px var(--rule-2); }
.count { font: 700 11px/1 var(--mono); padding: 3px 6px; border-radius: 3px; background: var(--sunk); color: var(--ink-2); }
.count.red { background: var(--red-bg); color: var(--red); }
.count.amb { background: var(--amber-bg); color: var(--amber); }
.main { padding: var(--s6) var(--gutter) var(--s8); max-width: 1240px; min-width: 0; }
.main-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); }
.main-head h1 { font-size: var(--t-2xl); }
.main-head p { color: var(--ink-2); font-size: var(--t-sm); margin-top: 6px; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); margin: var(--s7) 0 var(--s3); }
.panel-h h2 { font-size: var(--t-lg); }
.panel-h a { font-size: var(--t-sm); }
.switch { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font: 400 var(--t-sm)/1 var(--mono); border: 1px solid var(--control); border-radius: 4px; padding: 8px 10px; color: var(--ink); text-decoration: none; }
.switch::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--ink-2); border-bottom: 1.5px solid var(--ink-2); transform: rotate(45deg) translate(-2px, -2px); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--sunk); border: 1px solid var(--rule-2); display: grid; place-items: center; font: 700 12px/1 var(--mono); color: var(--ink-2); }

.kpis { display: grid; grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: var(--radius); background: var(--sheet); }
.kpi { padding: var(--s5); border-right: 1px solid var(--rule); display: grid; gap: var(--s2); align-content: space-between; min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi .val { font: 700 var(--t-2xl)/1 var(--mono); font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 0.5em; color: var(--ink-3); font-weight: 400; }
.kpi .delta { font: 400 var(--t-xs)/1.4 var(--mono); color: var(--ink-3); }
.kpi .delta .good { color: var(--green); font-weight: 700; }
.kpi .fig { justify-self: start; }
@media (max-width: 1100px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi:nth-child(2) { border-right: 0; } .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--rule); } }
@media (max-width: 520px) { .kpis { grid-template-columns: 1fr; } .kpi { border-right: 0; border-bottom: 1px solid var(--rule); } }

.alarm { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--s3); align-items: start; padding: 12px 16px; border-bottom: 1px solid var(--rule); font-size: var(--t-sm); }
.alarm:last-child { border-bottom: 0; }
.alarm code { font-weight: 700; }
.alarm p { color: var(--ink-2); }
.alarm .when { font: 400 var(--t-xs)/1.6 var(--mono); color: var(--ink-3); white-space: nowrap; }
.spark { display: block; width: 100%; height: 28px; }
.bar-meter { height: 6px; background: var(--sunk); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar-meter i { display: block; height: 100%; background: var(--ink-2); }
.bar-meter i.w { background: var(--amber); }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); padding: var(--s3) var(--gutter); display: flex; gap: 4px; overflow-x: auto; }
  .rail .label { display: none; }
  .rail a { white-space: nowrap; gap: 8px; }
  .main { padding-top: var(--s5); }
}

/* an inverted band: one dark moment on a paper page (and one paper moment in dark mode) */
.inv { color-scheme: dark; background: var(--paper); color: var(--ink); border-top: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .inv { color-scheme: light; } }
:root[data-theme="dark"] .inv { color-scheme: light; }
.inv + .sec { border-top: 0; }
.inv .sec-head h2 { font-size: clamp(36px, 4.4vw, 60px); }
.inv .sec-head h2 span { text-decoration: underline double var(--copper); text-decoration-thickness: 3px; text-underline-offset: 0.16em; text-decoration-skip-ink: none; }

/* signed-in bar on small screens: keep the daemon switcher, drop the tenant one */
@media (max-width: 860px) {
  .nav.ctx { display: flex; margin-left: auto; }
  .nav.ctx .switch:first-child { display: none; }
  .bar-in:has(.ctx) .bar-end .btn { display: none; }
}
@media (max-width: 520px) {
  .alarm { grid-template-columns: auto minmax(0, 1fr); }
  .alarm .when { grid-column: 2; }
}
.hero-note { color: var(--ink-2); font-size: var(--t-sm); margin: 0; }

/* ---------- the flow line: committed -> judged -> merged, with the appeal loop ---------- */
.flow { margin: var(--s5) 0 0; font: 700 var(--t-md)/1.2 var(--mono); color: var(--ink); width: fit-content; max-width: 100%; }
.flow-main { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.flow-main .to { width: 1.6em; }
.flow-appeal { display: flex; align-items: flex-end; gap: var(--s2); margin-top: 2px; padding-left: calc(9ch + 1.6em + 2px); }
.flow-appeal svg { width: 44px; height: 34px; flex: none; color: var(--copper); }
.flow-appeal span { font-weight: 400; font-size: var(--t-sm); line-height: 1; color: var(--red); padding-bottom: 5px; }
.flow-gloss { color: var(--ink-2); font-size: var(--t-sm); margin-top: var(--s2); max-width: 52ch; }
.flow.big { font-size: var(--t-lg); }
@media (max-width: 420px) { .flow-appeal { padding-left: 0; } }

/* ---------- copy box for the agent-led path ---------- */
.agentbox { display: grid; gap: var(--s2); max-width: 720px; }
.agentbox .ab-label { font: 700 var(--t-sm)/1.3 var(--sans); color: var(--ink); }
.ab-row { display: flex; align-items: stretch; gap: var(--s2); }
.ab-box { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; font: 400 var(--t-sm)/1.45 var(--mono); background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 4px; padding: 12px 14px; overflow-x: auto; }
.ab-box code { user-select: all; font-size: inherit; white-space: normal; }
.ab-row .btn { cursor: pointer; font-family: var(--sans); }
.ab-note { color: var(--ink-3); font-size: var(--t-sm); margin: 0; }
@media (max-width: 520px) { .ab-row { flex-direction: column; } .ab-row .btn { justify-content: center; } }

/* ---------- the one-line heading on the cost page ---------- */
.phead h1.one-line { max-width: none; }
.phead h1.one-line .m { display: none; }
@media (min-width: 1024px) { .phead h1.one-line { font-size: clamp(44px, 4.3vw, 60px); white-space: nowrap; } }
@media (max-width: 600px) { .phead h1.one-line .m { display: inline; } }

/* ---------- used-by band: quiet, one flat colour, slow marquee ---------- */
.usedby { padding: var(--s7) 0; border-top: 1px solid var(--rule); }
.ub-head { font: 700 var(--t-xs)/1 var(--mono); color: var(--ink-3); margin: 0 0 var(--s5); }
.ub { overflow: hidden; color: var(--ink-3);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.ub-track { display: flex; width: max-content; animation: ub-slide 60s linear infinite; }
.ub:hover .ub-track { animation-play-state: paused; }
.ub-set { display: flex; align-items: center; list-style: none; margin: 0; padding: 0; flex: none; }
.ub-set li { display: flex; align-items: center; }
.ub-set li { padding-right: var(--ub-gap, 96px); }
.ub-set a { display: inline-flex; align-items: center; gap: 10px; height: 20px; color: inherit; text-decoration: none; font: 700 var(--t-md)/1 var(--sans); }
.ub-set a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.ub-mark { width: 20px; height: 20px; flex: none; background: currentColor;
  -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
@keyframes ub-slide { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ub { -webkit-mask-image: none; mask-image: none; }
  .ub-track { animation: none; width: auto; }
  .ub-set[aria-hidden="true"] { display: none; }
  .ub-set { flex-wrap: wrap; row-gap: var(--s3); }
  .ub-set li { padding-right: var(--s7); }
}
@media (max-width: 600px) { .phead h1.one-line { font-size: min(7.2vw, 36px); } .phead h1.one-line .m + * { } }
.flow { width: auto; }
.flow-main { gap: 8px; }
.flow-appeal { padding-left: calc(9ch + 1.6em + 12px); }
.flow-gloss { font: 400 var(--t-sm)/1.4 var(--sans); max-width: none; }
/* the one-number heading sits on one line at 1024px and up; the lead moves under it */
.sec-head.wide h2.one-line .m { display: none; }
@media (min-width: 1024px) { .sec-head.wide { grid-template-columns: 1fr; } .inv .sec-head.wide h2.one-line { white-space: nowrap; font-size: clamp(40px, 4.2vw, 56px); } }
@media (max-width: 600px) { .sec-head.wide h2.one-line .m { display: inline; } .inv .sec-head.wide h2.one-line { font-size: min(7.2vw, 36px); } }
/* A phone keeps the big flow on one row, so the appeal loop stays under "judged". */
@media (max-width: 420px) { .flow.big { font-size: var(--t-md); } }

/* ---------- the theme toggle: Light / Dark / System, in the bar ---------- */
.theme-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: 700 var(--t-xs)/1 var(--mono); color: var(--ink-2); background: transparent;
  border: 1px solid var(--control); border-radius: 4px; padding: 7px 9px; white-space: nowrap;
}
.theme-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.theme-btn[hidden] { display: none; }
.theme-form { margin: 0; display: inline-flex; }
/* a half-lit disc: the mode's glyph, drawn here so the label stays text */
.theme-btn::before { content: ""; width: 10px; height: 10px; flex: none; border-radius: 50%; border: 1.5px solid currentColor; }
.theme-btn[data-mode="light"]::before { background: currentColor; }
.theme-btn[data-mode="dark"]::before { background: linear-gradient(90deg, currentColor 50%, transparent 0); }
.theme-btn[data-mode="system"]::before { background: conic-gradient(currentColor 0 50%, transparent 0); transform: rotate(45deg); }

/* ---------- sources and demo labels: every number links to its source (sources.html) ---------- */
.fn { font: 700 11px/1 var(--mono); vertical-align: super; margin-left: 2px; text-decoration: none; padding: 1px 3px; border: 1px solid currentColor; border-radius: 3px; }
.fn:hover { text-decoration: none; background: var(--sunk); }
.src { font-size: var(--t-sm); color: var(--ink-2); margin-top: var(--s4); max-width: 75ch; }
.demo-label { display: block; font: 700 var(--t-xs)/1.4 var(--mono); color: var(--amber); border: 1px dashed currentColor; border-radius: 3px; padding: 6px 10px; margin-bottom: var(--s3); }
.prose { max-width: 75ch; display: grid; gap: var(--s4); }
.prose h2 { font-size: var(--t-xl); margin-top: var(--s6); }
.prose h3 { font-size: var(--t-lg); margin-top: var(--s4); }
.prose ul { margin: 0; padding-left: 1.2em; display: grid; gap: var(--s2); }
.prose blockquote { margin: 0; padding-left: var(--s4); border-left: 2px solid var(--copper); color: var(--ink-2); }
.facts-list { display: grid; gap: var(--s5); max-width: 85ch; }
.fact { border-top: 1px solid var(--rule-2); padding-top: var(--s4); display: grid; gap: var(--s2); scroll-margin-top: 80px; }
.fact h3 { font-size: var(--t-lg); }
.fact dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0; font-size: var(--t-sm); }
.fact dt { font: 700 var(--t-xs)/1.6 var(--mono); color: var(--ink-3); }
.fact dd { margin: 0; color: var(--ink-2); overflow-wrap: anywhere; }
.fact:target { outline: 2px solid var(--copper); outline-offset: 8px; border-radius: 2px; }
@media (max-width: 600px) { .fact dl { grid-template-columns: 1fr; } }

/* =====================================================================================
   NIGHT: the marketing face, dark first (home, how it works; any page can opt in).
   Put class="night" on <html>. Tokens only, so every component above (bar, buttons,
   chips, footer) re-skins itself; the app keeps its own light/dark.
   Contrast on --paper: ink 16.7, ink-2 9.3, ink-3 6.1, copper 8.9, green 10.7, red 8.7;
   --edge (diagram strokes that carry meaning) 3.5.
   ===================================================================================== */
.night {
  color-scheme: dark;
  --paper: #0C0B09; --sheet: #15130F; --sunk: #1C1A15;
  --ink: #F1ECDF; --ink-2: #B9B2A0; --ink-3: #949080;
  --rule: #24211B; --rule-2: #3A362C; --control: #6E6857; --edge: #6E6857;
  --copper: #F09A66;
  --green: #72D394; --green-bg: #12241A;
  --red: #FF8A92;   --red-bg: #2A1416;
  --amber: #E9BC5A; --amber-bg: #2A2312;
  --glow: rgb(240 154 102 / 0.10);
}
.night body { background: var(--paper); }
.night .bar { background: rgb(12 11 9 / 0.82); -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px); }
.night .foot { border-top-color: var(--rule); }
.night .btn-ink:hover { opacity: 1; background: #FFFFFF; border-color: #FFFFFF; }

/* ---------- page rhythm: space, not rules ---------- */
.x-sec { padding: clamp(64px, 10vw, 128px) 0; }
.x-sec + .x-sec { padding-top: 0; }
.x-narrow { max-width: 760px; margin: 0 auto; }
.x-eyebrow { font: 700 var(--t-xs)/1 var(--mono); color: var(--copper); letter-spacing: 0.02em; margin: 0 0 var(--s4); display: block; }
.x-h2 { font-size: clamp(30px, 4.4vw, 48px); letter-spacing: -0.03em; line-height: 1.05; }
.x-lede { color: var(--ink-2); font-size: clamp(17px, 1.6vw, 20px); line-height: 1.5; margin-top: var(--s4); max-width: 54ch; }
.x-more { font: 700 var(--t-sm)/1 var(--sans); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; margin-top: var(--s4); }
.x-more::after { content: "→"; transition: transform .2s; }
.x-more:hover::after { transform: translateX(3px); }

/* ---------- hero ---------- */
.x-hero { padding: clamp(56px, 9vw, 112px) 0 var(--s6); text-align: center; position: relative; isolation: isolate; }
.x-hero::before { /* one warm light behind the loop; no images */
  content: ""; position: absolute; inset: 30% 0 -10%; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, var(--glow), transparent 70%);
}
.x-h1 { font-size: clamp(46px, 10.5vw, 120px); line-height: 0.96; letter-spacing: -0.045em; font-weight: 700; text-wrap: balance; }
.x-h1 .w { display: inline-block; }
.x-h1 .g { color: var(--green); }
.x-sub { color: var(--ink-2); font-size: clamp(18px, 2vw, 22px); line-height: 1.45; max-width: 40ch; margin: var(--s5) auto 0; }
.x-ctas { display: flex; gap: var(--s3); justify-content: center; flex-wrap: wrap; margin-top: var(--s6); }
.x-ctas .btn { padding: 14px 20px; font-size: var(--t-md); border-radius: 999px; }
.x-note { font: 400 var(--t-sm)/1.4 var(--mono); color: var(--ink-3); margin-top: var(--s5); }
.x-note b { color: var(--ink-2); font-weight: 400; }
.x-hero.left { text-align: left; }
.x-hero.left .x-sub { margin-left: 0; }

/* =====================================================================================
   DIAGRAMS: one grammar for every picture on the site.
   - node: a pill (a thing you type or see: `git push`, `merged`), r = full
   - card: a box with rows (a file, a terminal, a message), r = 10, --sheet on --rule-2
   - edge: 1.5px --edge with a chevron; green/red edges carry the outcome
   - glyphs: green = ring + check, red = diamond, waiting = dashed ring, running = half disc
     (colour + shape + word, never colour alone)
   - motion: one pulse travels the path; nothing moves under prefers-reduced-motion
   Text in diagrams is real text in the page's own fonts.
   ===================================================================================== */
.dg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--mono); }
.dg text { fill: var(--ink); font-size: 15px; white-space: pre; }
.dg .t-sm { font-size: 12.5px; }
.dg .t-xs { font-size: 11px; }
.dg .t-b { font-weight: 700; }
.dg .t-2 { fill: var(--ink-2); }
.dg .t-3 { fill: var(--ink-3); }
.dg .t-c { fill: var(--copper); }
.dg .t-g { fill: var(--green); }
.dg .t-r { fill: var(--red); }
.dg .t-a { fill: var(--amber); }
.dg .t-mid { text-anchor: middle; }
.dg .t-end { text-anchor: end; }
.dg .node { fill: var(--sheet); stroke: var(--rule-2); stroke-width: 1.5; }
.dg .node.you { stroke: var(--control); }
.dg .node.ok { stroke: var(--green); fill: var(--green-bg); }
.dg .node.bad { stroke: var(--red); fill: var(--red-bg); }
.dg .card { fill: var(--sheet); stroke: var(--rule-2); stroke-width: 1; }
.dg .card.bad { stroke: color-mix(in srgb, var(--red) 55%, var(--rule-2)); }
.dg .well { fill: var(--sunk); }
.dg .sep { stroke: var(--rule-2); stroke-width: 1; }
.dg .edge { fill: none; stroke: var(--edge); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dg .edge.g { stroke: var(--green); }
.dg .edge.r { stroke: var(--red); }
.dg .edge.c { stroke: var(--copper); }
.dg .edge.dash { stroke-dasharray: 3 5; }
.dg .chev { fill: none; stroke: var(--edge); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.dg .chev.g { stroke: var(--green); }
.dg .chev.r { stroke: var(--red); }
.dg .chev.c { stroke: var(--copper); }
.dg .dot { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1.5; }
.dg .dot.c { fill: var(--copper); stroke: var(--copper); }
.dg .dot.g { fill: var(--green); stroke: var(--green); }
.dg .dot.r { fill: var(--red); stroke: var(--red); }
.dg .lane { fill: none; stroke: var(--rule-2); stroke-width: 2; stroke-linecap: round; }
.dg .lane.c { stroke: color-mix(in srgb, var(--copper) 60%, var(--rule-2)); }
.dg .strike { stroke: var(--ink-3); stroke-width: 1.25; }
.dg .pulse { fill: none; stroke: var(--copper); stroke-width: 3; stroke-linecap: round; opacity: 0; }
.dg .halo { fill: none; stroke-width: 1.5; opacity: 0; }

/* glyphs, drawn at 16 x 16 around their centre (use with transform="translate(x y)") */
.gl-ok circle { fill: none; stroke: var(--green); stroke-width: 1.75; }
.gl-ok path { fill: none; stroke: var(--green); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.gl-red rect { fill: var(--red); }
.gl-red path { fill: none; stroke: var(--red-bg); stroke-width: 1.6; stroke-linecap: round; }
.gl-wait circle { fill: none; stroke: var(--amber); stroke-width: 1.75; stroke-dasharray: 3 3; }
.gl-run circle { fill: none; stroke: var(--ink-2); stroke-width: 1.5; }
.gl-run path { fill: var(--ink-2); }
.gl-reuse circle { fill: var(--green); }

/* the two shapes of a diagram: wide above 720px, tall below. Same nodes, same order. */
.dg-tall { display: none; }
@media (max-width: 720px) { .dg-wide { display: none; } .dg-tall { display: block; } }

/* figure frame */
.x-fig { margin: 0; }
.x-fig figcaption { font: 400 var(--t-xs)/1.4 var(--mono); color: var(--ink-3); margin-top: var(--s3); }
.x-fig figcaption .tag { margin-right: 6px; }

/* ---------- the loop (home hero, how it works head) ---------- */
.x-loop { max-width: 1000px; margin: clamp(40px, 6vw, 72px) auto 0; }
.x-loop .dg-tall { max-width: 380px; margin: 0 auto; }

@media (prefers-reduced-motion: no-preference) {
  /* one story every 10 s: push, red, back to you, fix, push, green, merged */
  .x-loop .pulse.p-red { animation: lp-red 10s linear infinite; }
  .x-loop .pulse.p-green { animation: lp-green 10s linear infinite; }
  .x-loop .k1, .x-loop .k2 { animation: lp-k12 10s step-end infinite; }
  .x-loop .k3 { animation: lp-k3 10s step-end infinite; }
  .x-loop .halo.h-red { stroke: var(--red); animation: lp-hred 10s ease-out infinite; }
  .x-loop .halo.h-fix { stroke: var(--copper); animation: lp-hfix 10s ease-out infinite; }
  .x-loop .halo.h-ok { stroke: var(--green); animation: lp-hok 10s ease-out infinite; }
  @keyframes lp-red   { 0% { stroke-dashoffset: 6; opacity: 1; } 58% { stroke-dashoffset: -100; opacity: 1; } 58.1%, 100% { opacity: 0; } }
  @keyframes lp-green { 0%, 58% { stroke-dashoffset: 6; opacity: 0; } 58.1% { opacity: 1; } 84% { stroke-dashoffset: -100; opacity: 1; } 84.1%, 100% { opacity: 0; } }
  @keyframes lp-k12 { 0% { fill: var(--paper); stroke: var(--ink-3); } 16% { fill: var(--green); stroke: var(--green); } 58% { fill: var(--paper); stroke: var(--ink-3); } 71% { fill: var(--green); stroke: var(--green); } }
  @keyframes lp-k3  { 0% { fill: var(--paper); stroke: var(--ink-3); } 18% { fill: var(--red); stroke: var(--red); } 58% { fill: var(--paper); stroke: var(--ink-3); } 72% { fill: var(--green); stroke: var(--green); } }
  @keyframes lp-hred { 0%, 20% { opacity: 0; } 23% { opacity: 1; } 38%, 100% { opacity: 0; } }
  @keyframes lp-hfix { 0%, 34% { opacity: 0; } 36% { opacity: 1; } 50%, 100% { opacity: 0; } }
  @keyframes lp-hok  { 0%, 79% { opacity: 0; } 81% { opacity: 1; } 100% { opacity: 0; } }
}

/* ---------- terminal and code: what a developer already looks at ---------- */
.tty { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 12px; overflow: hidden; text-align: left; }
.tty-h { display: flex; align-items: center; gap: var(--s3); padding: 10px 14px; border-bottom: 1px solid var(--rule); font: 400 var(--t-xs)/1 var(--mono); color: var(--ink-3); }
.tty-h::before { content: ""; width: 34px; height: 8px; flex: none;
  background: radial-gradient(circle at 4px 4px, var(--rule-2) 3.5px, transparent 4px) 0 0 / 13px 8px repeat-x; }
.tty-h .tag { margin-left: auto; }
.tty pre { margin: 0; padding: var(--s4) var(--s5); font: 400 13.5px/1.75 var(--mono); color: var(--ink-2); overflow-x: auto; white-space: pre; }
.tty .p { color: var(--copper); user-select: none; }
.tty .k { color: var(--ink); }
.tty .r { color: var(--red); }
.tty .g { color: var(--green); }
.tty .d { color: var(--ink-3); }
.tty .hd { color: var(--ink); font-weight: 700; }

/* ---------- facts: one line each, a glyph each ---------- */
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; margin-top: var(--s7); }
.fact { background: var(--paper); padding: var(--s5); display: grid; gap: var(--s2); align-content: start; }
.fact svg { width: 40px; height: 28px; margin-bottom: var(--s2); }
.fact h3 { font-size: var(--t-md); letter-spacing: -0.01em; }
.fact p { color: var(--ink-2); font-size: var(--t-sm); line-height: 1.5; }
.fact code { color: var(--ink); }
@media (max-width: 960px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .facts { grid-template-columns: 1fr; } }

/* ---------- split: words beside a picture ---------- */
.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 6vw, 88px); align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

/* ---------- used by: static until there are ten ---------- */
.logos { display: flex; align-items: center; justify-content: center; gap: clamp(32px, 6vw, 72px); flex-wrap: wrap; list-style: none; margin: 0; padding: 0; color: var(--ink-3); }
.logos a { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font: 700 var(--t-lg)/1 var(--sans); letter-spacing: -0.01em; transition: color .2s; }
.logos a:hover { color: var(--ink); }
.logos svg { width: 28px; height: 28px; }
.logos-h { text-align: center; font: 700 var(--t-xs)/1 var(--mono); color: var(--ink-3); margin: 0 0 var(--s5); }

/* ---------- closing call ---------- */
.x-close { text-align: center; border: 1px solid var(--rule-2); border-radius: 20px; padding: clamp(40px, 7vw, 80px) var(--s5);
  background: radial-gradient(60% 80% at 50% 0%, var(--glow), transparent 70%), var(--sheet); }
.x-close .x-lede { margin-left: auto; margin-right: auto; }
.x-fine { color: var(--ink-3); font-size: var(--t-sm); margin-top: var(--s5); }
.x-fine a { color: var(--ink-2); }

/* ---------- how it works: diagram-led steps ---------- */
.x-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(72px, 11vw, 136px); }
.x-step { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 6vw, 88px); align-items: center; }
.x-step:nth-child(even) .x-step-text { order: 2; }
.x-step-n { display: flex; align-items: center; gap: var(--s3); font: 700 var(--t-xs)/1 var(--mono); color: var(--copper); margin-bottom: var(--s4); }
.x-step-n svg { width: 56px; height: 30px; }
.x-step h2 { font-size: clamp(28px, 3.6vw, 40px); letter-spacing: -0.03em; }
.x-step p { color: var(--ink-2); font-size: var(--t-md); margin-top: var(--s3); max-width: 46ch; }
.x-step p code { color: var(--ink); }
.x-step .dg { max-width: 500px; margin: 0 auto; }
@media (max-width: 860px) {
  .x-step { grid-template-columns: 1fr; }
  .x-step:nth-child(even) .x-step-text { order: 0; }
}
/* the "you are here" loop beside each step number */
.x-mini .e { fill: none; stroke: var(--rule-2); stroke-width: 1.5; }
.x-mini .n { fill: var(--paper); stroke: var(--ink-3); stroke-width: 1.5; }
.x-mini .n.on { fill: var(--copper); stroke: var(--copper); }

@media (prefers-reduced-motion: no-preference) {
  .dg .spin { animation: dg-spin 1.6s linear infinite; transform-box: fill-box; transform-origin: center; }
  .dg .wait-spin { animation: dg-spin 6s linear infinite; transform-box: fill-box; transform-origin: center; }
  .dg .travel { animation: dg-travel 4.5s linear infinite; }
  .dg .travel.late { animation-delay: 1.4s; }
  @keyframes dg-spin { to { transform: rotate(1turn); } }
  @keyframes dg-travel { 0% { stroke-dashoffset: 6; opacity: 1; } 70% { stroke-dashoffset: -100; opacity: 1; } 70.1%, 100% { opacity: 0; } }
}
.split > *, .x-step > * { min-width: 0; }
@media (max-width: 520px) { .tty pre { font-size: 12px; padding: var(--s4); } }
.dg.s text { font-size: 16px; }
.dg.s .t-sm { font-size: 14px; }
.dg.s .t-xs { font-size: 12.5px; }

/* ---------- classes in place of inline styles (the pages carry none) ---------- */
.mark .mk-tile { fill: var(--ink); }
.mark .mk-arrow { stroke: var(--paper); }
.mark .mk-rule { stroke: var(--copper); }
.bar-in.wide { padding: 0 var(--gutter); }
.brand-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); }
.brand-fig { padding: var(--s6); margin: 0; }
.brand-fig.on-paper { background: #F4F1E8; border: 1px solid var(--rule-2); }
.brand-fig.on-ink { background: #16150F; }
img.logo48 { height: 48px; width: auto; }
ul.swatches { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.swatch-chip { display: inline-block; width: 28px; height: 28px; vertical-align: middle; margin-right: var(--s2); }
.swatch-chip.edged rect { stroke: var(--rule-2); }
.free { color: var(--green); }
.mt5 { margin-top: var(--s5); }
