/* Kanoniq — kanoniq.extenza.dev
   Hand-written, no bundler. Reasoning: .ai/notes/brainstorm/2026-09-27-marketing-site-design.md
   Solid stroke = authored. Dashed stroke = derived. That rule is the whole design, and it is
   also the logo. */

@layer tokens, base, layout, components;

@layer tokens {
  @font-face {
    font-family: 'IBM Plex Sans';
    src: url('/fonts/ibm-plex-sans-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
  }
  @font-face {
    font-family: 'IBM Plex Sans';
    src: url('/fonts/ibm-plex-sans-600.woff2') format('woff2');
    font-weight: 600;
    font-display: swap;
  }
  @font-face {
    font-family: 'JetBrains Mono';
    src: url('/fonts/jetbrains-mono-400.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
  }
  @font-face {
    font-family: 'Space Grotesk';
    src: url('/fonts/space-grotesk-700.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
  }

  /* Light palette: ADR 0050. */
  :root {
    color-scheme: light dark;

    --paper: #d6e6f7;
    --ink: #0f2340;
    --derived: #5d7594;  /* strokes only — 3.7:1 on paper, enough for graphics, not for text */
    --muted: #3a4f6c;    /* muted *text* — 6.6:1 on paper */
    --rule: #a3c0df;
    --accent: #a8320f;   /* 5.3:1 on paper */
    --glyph: #e0501f;    /* filled glyphs only — 3.1:1 on paper, enough for graphics, not for text */
    --code: #133a6b;     /* source text — 7.8:1 on its own surface */
    --surface: #c3d8ef;  /* the code block's ground */

    --sans: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', 'Consolas', monospace;
    --display: 'Space Grotesk', var(--sans);

    --step--1: 0.875rem;
    --step-0: 1rem;
    --step-1: 1.25rem;
    --step-2: 1.5625rem;
    --step-3: clamp(1.9rem, 1.45rem + 1.5vw, 2.4rem);
    --step-4: clamp(2.25rem, 1.5rem + 3.4vw, 4rem);
    --step-5: clamp(2.6rem, 1.2rem + 5.4vw, 5.75rem);

    --measure: 60ch;
    --gutter: 1rem;
    --space-xs: 0.5rem;
    --space-s: 1rem;
    --space-m: 1.5rem;
    --space-l: 2.5rem;
    --space-xl: 4rem;
  }

  /* Spacing scales with the viewport through the tokens, not through overriding .band /
     .hero further down — that fight is how section padding rules cancel each other out. */
  @media (min-width: 48rem) {
    :root {
      --gutter: 2rem;
      --space-l: 3.5rem;
      --space-xl: 6rem;
    }
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --paper: #12201d;
      --ink: #e8edea;
      --derived: #8aa199;
      --muted: #9fb3ac;  /* 7.6:1 on dark paper */
      --rule: #2a3b37;
      --accent: #d9a441;
      --glyph: #d9a441;
      --code: #9ff0cf;   /* 11.5:1 on its own surface */
      --surface: #172925;
    }
  }

  /* The toggle's explicit choice, set as data-theme by theme.js. Higher specificity than the
     media query above, so it overrides the OS preference in either direction. */
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #12201d;
    --ink: #e8edea;
    --derived: #8aa199;
    --muted: #9fb3ac;
    --rule: #2a3b37;
    --accent: #d9a441;
    --glyph: #d9a441;
    --code: #9ff0cf;
    --surface: #172925;
  }

  :root[data-theme="light"] {
    color-scheme: light;
    --paper: #d6e6f7;
    --ink: #0f2340;
    --derived: #5d7594;
    --muted: #3a4f6c;
    --rule: #a3c0df;
    --accent: #a8320f;
    --glyph: #e0501f;
    --code: #133a6b;
    --surface: #c3d8ef;
  }

  /* The source listing. A `.kq` file is pure authored source — the most solid thing the site
     has to show — so it is presented as its own material rather than as page background with
     colored text on it: a sheet brighter than the page in light, a well darker than it in dark.
     Each role keeps its hue across themes, so the key reads the same in both.

     Every value is checked against --kq-ground. Ratios are for text, so the gutter color is
     the floor: nothing here is lighter than 4.5:1. */
  :root {
    --kq-ground: #fbfcfe;
    --kq-rule: #a3c0df;
    --kq-target: #e8f0fa;
    --kq-hover: #000;
    --kq-ink: #0f2340;   /* references           15.3:1 */
    --kq-quiet: #52627a; /* punctuation, gutter   6.0:1 */
    --kq-soft: #3a4f6c;  /* derived, description  8.1:1 */
    --kq-kw: #0b5f7a;    /* declaration keyword   7.0:1 */
    --kq-rel: #3a4fa0;   /* relationship          7.3:1 */
    --kq-kind: #1b5fb0;  /* kind, protocol        6.2:1 */
    --kq-str: #a8320f;   /* quoted name           6.5:1 — the accent */
    --kq-lit: #8a3a8a;   /* date, period, number  6.7:1 */
    --kq-def: #0a1830;   /* declared Code        17.2:1 */
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --kq-ground: #0c1a17;
      --kq-rule: #23403a;
      --kq-target: #14302a;
      --kq-hover: #fff;
      --kq-ink: #cfded8;   /* 12.6:1 */
      --kq-quiet: #6b8a82; /*  4.7:1 */
      --kq-soft: #8aa199;  /*  6.4:1 */
      --kq-kw: #9ff0cf;    /* 11.5:1 — the same green as --code */
      --kq-rel: #7cc0ad;   /*  8.4:1 */
      --kq-kind: #5fa8c4;  /*  6.6:1 */
      --kq-str: #d9a441;   /*  7.8:1 — the accent */
      --kq-lit: #e8a08c;   /*  8.4:1 */
      --kq-def: #f4faf7;   /* 15.9:1 */
    }
  }

  :root[data-theme="dark"] {
    --kq-ground: #0c1a17;
    --kq-rule: #23403a;
    --kq-target: #14302a;
    --kq-hover: #fff;
    --kq-ink: #cfded8;
    --kq-quiet: #6b8a82;
    --kq-soft: #8aa199;
    --kq-kw: #9ff0cf;
    --kq-rel: #7cc0ad;
    --kq-kind: #5fa8c4;
    --kq-str: #d9a441;
    --kq-lit: #e8a08c;
    --kq-def: #f4faf7;
  }

  :root[data-theme="light"] {
    --kq-ground: #fbfcfe;
    --kq-rule: #a3c0df;
    --kq-target: #e8f0fa;
    --kq-hover: #000;
    --kq-ink: #0f2340;
    --kq-quiet: #52627a;
    --kq-soft: #3a4f6c;
    --kq-kw: #0b5f7a;
    --kq-rel: #3a4fa0;
    --kq-kind: #1b5fb0;
    --kq-str: #a8320f;
    --kq-lit: #8a3a8a;
    --kq-def: #0a1830;
  }
}

@layer base {
  *,
  *::before,
  *::after { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; }

  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: var(--step-0);
    line-height: 1.6;
    text-underline-offset: 0.2em;
  }

  h1, h2, h3 {
    margin: 0;
    font-weight: 600;
    line-height: 1.12;
    text-wrap: balance;
  }

  p { margin: 0; }

  a {
    color: var(--accent);
    text-decoration-thickness: 1px;
  }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  ::selection {
    background: var(--ink);
    color: var(--paper);
  }
}

@layer layout {
  .wrap {
    max-width: 64rem;
    margin-inline: auto;
    padding-inline: var(--gutter);
  }

  /* The figure and the footer run wider than the reading measure; the text inside them keeps
     its own max-width, so line length is unaffected. */
  .wrap--wide { max-width: 76rem; }

  .band { padding-block: var(--space-l); }
  main > .band + .band { border-top: 1px solid var(--rule); }
  header.band { padding-block: var(--space-m) 0; }
  header.band .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--space-s); }
  .hero { padding-block: var(--space-l) var(--space-xl); }

  .vh {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .skip {
    position: absolute;
    left: var(--gutter);
    top: -4rem;
    z-index: 1;
    padding: var(--space-xs) var(--space-s);
    background: var(--ink);
    color: var(--paper);
    text-decoration: none;
    transition: top 120ms ease-out;
  }
  .skip:focus { top: var(--space-xs); }
}

@layer components {

  /* ---- logo ------------------------------------------------------------- */
  /* One solid bar over two dashed ones: one authored model, several derived views. */

  .logo {
    display: flex;
    align-items: center;
    gap: 0.7rem;
  }

  /* On a subpage the logo is the way back, so it becomes a link without looking like one. */
  a.logo {
    width: max-content;
    text-decoration: none;
  }

  .logo-mark {
    width: 2.4rem;
    height: 2.4rem;
    flex: none;
  }

  .mark-a,
  .mark-d {
    fill: none;
    stroke-width: 1.7;
  }

  /* The logo carries the accent. The solid/dashed distinction still reads, because the dash
     pattern does that work — color was only reinforcing it. */
  .mark-a { stroke: var(--accent); }

  .mark-d {
    stroke: var(--accent);
    stroke-dasharray: 2.6 2.1;
    opacity: 0.6;
  }

  .logo-word {
    font-family: var(--display);
    font-weight: 700;
    font-size: 1.85rem;
    letter-spacing: -0.02em;
    color: var(--accent);
  }

  .with-icon {
    display: grid;
    gap: var(--space-m);
  }

  .sec-icon {
    display: block;
    width: 100%;
    max-width: 5rem;
    height: auto;
    color: var(--glyph);
  }

  @media (min-width: 48rem) {
    .with-icon {
      grid-template-columns: 11rem minmax(0, 1fr);
      gap: var(--space-xl);
      align-items: start;
    }

    .sec-icon { max-width: 100%; }
  }

  /* ---- hero ------------------------------------------------------------- */

  .hero-top {
    display: grid;
    gap: var(--space-m);
  }

  .hero h1 {
    font-size: var(--step-5);
    line-height: 1;
    letter-spacing: -0.035em;
    max-width: 15ch;
  }

  .hero-say .cta-row { margin-top: var(--space-m); }

  @media (min-width: 64rem) {
    .hero-top {
      grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
      align-items: end;
      gap: var(--space-l);
    }

    .hero-say .lede { margin-top: 0; }
  }

  /* A quotation set apart before a section: quiet, indented on a dashed rule. */
  .epigraph {
    max-width: var(--measure);
    margin: 0 0 var(--space-l);
    padding-left: var(--space-s);
    border-left: 2px dashed var(--derived);
  }

  .epigraph blockquote {
    margin: 0;
    font-size: var(--step-1);
    font-style: italic;
    line-height: 1.4;
  }

  .epigraph figcaption {
    margin-top: var(--space-xs);
    font-family: var(--mono);
    font-size: 0.85rem;
    color: var(--muted);
  }

  .epigraph figcaption::before { content: "— "; }

  .lede {
    max-width: var(--measure);
    margin-top: var(--space-m);
    font-size: var(--step-1);
    line-height: 1.5;
  }

  /* The closing illustration: tone, not proof, so it stays a fraction of the row. */
  .hero-il {
    display: block;
    width: 100%;
    max-width: 22rem;
    height: auto;
    justify-self: center;
  }

  /* The plate's ground, unstroked: only its left edge is drawn, so it reads as open. */
  .il-f { fill: var(--paper); }

  .il-n {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
    stroke-linejoin: round;
  }

  .il-d {
    fill: none;
    stroke: var(--derived);
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
  }

  .il-g {
    fill: none;
    stroke: var(--derived);
    stroke-width: 1;
    stroke-dasharray: 2 4;
  }

  /* ---- the drawing sheet ------------------------------------------------- */
  /* A drawing sheet rather than page background: the same material as the source listing, with
     a drafting grid and a title block. Its one job is the claim, played live. */

  .sheet {
    --grid: color-mix(in srgb, var(--kq-rule) 22%, transparent);

    margin: var(--space-xl) 0 0;
    border: 1px solid var(--kq-rule);
    border-radius: 4px;
    background-color: var(--kq-ground);
    background-image:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
  }

  .sheet-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-m);
    justify-items: start;
    padding: var(--space-m);
  }

  .stage-lbl {
    margin-bottom: var(--space-s);
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .kq {
    margin: 0;
    padding: var(--space-s);
    border: 1px solid var(--rule);
    border-radius: 3px;
    background: var(--surface);
    font-family: var(--mono);
    font-size: 0.875rem;
    line-height: 1.7;
    color: var(--code);
    overflow-x: auto;
  }

  .kq code { font: inherit; }

  /* On the sheet the source is authored: a solid frame, the listing's own syntax colors. */
  .kq--live {
    max-width: 100%;
    padding: var(--space-s) var(--space-m);
    border-color: var(--kq-ink);
    background: var(--kq-ground);
    font-size: 0.8125rem;
    color: var(--kq-ink);
  }

  /* An editable name reads as a field inside the string: a tinted well on a solid rule, solid
     because it is authored. */
  .kq-name {
    min-width: 1ch;
    margin: 0;
    padding: 0 0.2em;
    border: 0;
    border-bottom: 2px solid var(--accent);
    border-radius: 2px 2px 0 0;
    background: var(--kq-target);
    font: inherit;
    line-height: inherit;
    color: var(--kq-str);
    caret-color: var(--accent);
    field-sizing: content;
    cursor: text;
  }

  .kq-name:hover,
  .kq-name.is-hl,
  .kq-name.is-typing { background: color-mix(in srgb, var(--accent) 16%, var(--kq-ground)); }

  .kq-name:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  /* The invitation, in the same red pencil that marks up the copy. Fades once the reader has
     typed; its space stays so nothing below jumps. */
  .sheet-try {
    display: flex;
    align-items: flex-start;
    gap: 0.4rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: var(--accent);
    transition: opacity 400ms ease-out;
  }

  .sheet-try.is-done { opacity: 0; }

  .try-arrow {
    width: 2.25rem;
    height: 2rem;
    flex: none;
    margin-top: 0.4rem;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .flow {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding-left: 3.5rem;
  }

  .flow-arrow {
    width: 3rem;
    height: 1rem;
    flex: none;
    transform: rotate(90deg);
  }

  .flow-lbl {
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .dg {
    display: block;
    width: 100%;
    height: auto;
  }

  .dg--model { max-width: 200px; }

  .stage--views {
    display: grid;
    gap: var(--space-s);
    width: 100%;
    max-width: 26rem;
  }

  .stage--views .stage-lbl { margin-bottom: 0; }

  @media (min-width: 64rem) {
    .sheet-body {
      grid-template-columns: max-content auto 200px auto minmax(18rem, 26rem);
      align-items: start;
      justify-content: space-between;
      gap: var(--space-s);
      padding: var(--space-l);
    }

    .flow {
      flex-direction: column;
      align-self: center;
      gap: 0.35rem;
      padding-left: 0;
    }

    .flow-arrow { transform: none; }

    .dg--model { width: 200px; }
  }

  /* ---- diagram strokes: the one rule ------------------------------------- */

  .node,
  .link {
    fill: none;
    stroke: var(--ink);
    stroke-width: 1.5;
  }

  .cap,
  .cap-d,
  .cap-h {
    font-family: var(--sans);
    font-size: 15px;
    fill: var(--ink);
    text-anchor: middle;
  }

  .dg--view .cap-d,
  .cap-h { font-size: 13px; }

  .cap-d { fill: var(--muted); }

  .tiny,
  .code-d {
    font-family: var(--mono);
    font-size: 10px;
    fill: var(--muted);
  }

  .code-d { text-anchor: middle; }

  .band-l,
  .node-d,
  .link-d,
  .arrow {
    fill: none;
    stroke: var(--derived);
    stroke-width: 1.5;
    stroke-dasharray: 5 4;
  }

  .head-a { fill: var(--ink); stroke: none; }
  .head-d { fill: var(--derived); stroke: none; }
  .chip { fill: var(--rule); stroke: none; }

  .node,
  .node-d,
  .link-d,
  .cap,
  .cap-d,
  .code-d { transition: stroke 120ms ease-out, fill 120ms ease-out; }

  /* Identity: one component, lit wherever it appears. */
  .is-hl .node,
  .is-hl .node-d,
  .is-hl .link-d { stroke: var(--accent); }

  .is-hl .cap,
  .is-hl .cap-d,
  .is-hl .code-d { fill: var(--accent); }

  /* A rename: the derived strokes run once, from the model outward, and each new name flashes. */
  .sheet.is-flowing .flow--derived .arrow,
  .sheet.is-flowing .stage--views .band-l,
  .sheet.is-flowing .stage--views .node-d,
  .sheet.is-flowing .stage--views .link-d { animation: march 900ms linear; }

  .is-updated { animation: ping 900ms ease-out; }

  @keyframes march {
    to { stroke-dashoffset: -27; }
  }

  @keyframes ping {
    from { fill: var(--accent); }
  }

  /* ---- the hand-drawn copy ------------------------------------------------ */
  /* Drawn by a person, so solid; a picture, so it shares no identity and never follows. When it
     falls behind, it is marked up the way a drawing is checked: a ring in red pencil. */

  .copy-plate {
    margin-top: var(--space-xs);
    padding: var(--space-xs) var(--space-s) var(--space-s);
    border: 1px solid var(--rule);
    border-radius: 2px;
    background: var(--paper);
    rotate: -1.2deg;
    transition: border-color 300ms ease-out;
  }

  .copy-plate.is-out { border-color: var(--accent); }

  .copy-lbl {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
  }

  .node-h,
  .link-h {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.3;
  }

  .head-h { fill: var(--muted); }
  .cap-h { fill: var(--muted); }
  .cap-h.is-stale { fill: var(--accent); }

  .redline {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    opacity: 0;
    transition: stroke-dashoffset 250ms ease-in, opacity 0s 250ms;
  }

  .redline.is-stale {
    stroke-dashoffset: 0;
    opacity: 1;
    transition: stroke-dashoffset 700ms cubic-bezier(0.6, 0.05, 0.3, 1) 250ms, opacity 0s 250ms;
  }

  /* ---- the title block ---------------------------------------------------- */

  .title-block {
    display: grid;
    border-top: 1px solid var(--kq-rule);
    background: var(--kq-ground);
    border-radius: 0 0 4px 4px;
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .tb-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem var(--space-m);
  }

  .tb-cell + .tb-cell { border-top: 1px solid var(--kq-rule); }

  .tb-status {
    min-height: 3.4rem;
    font-family: var(--sans);
    font-size: var(--step-0);
    line-height: 1.45;
    color: var(--ink);
  }

  .tb-act:has(> [hidden]) { display: none; }

  .tb-swatch {
    width: 1.75rem;
    height: 0.625rem;
    flex: none;
  }

  .tb-swatch + .tb-swatch { margin-left: 0.75rem; }

  .sheet-reset {
    padding: 0.4rem 0.9rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: transparent;
    color: var(--accent);
    font-family: var(--mono);
    font-size: var(--step--1);
    cursor: pointer;
  }

  .sheet-reset:hover,
  .sheet-reset:focus-visible { background: var(--accent); color: var(--kq-ground); }

  @media (min-width: 48rem) {
    .title-block { grid-template-columns: auto minmax(0, 1fr) auto; }

    .tb-cell + .tb-cell {
      border-top: 0;
      border-left: 1px solid var(--kq-rule);
    }
  }

  /* One orchestrated reveal, in the order Kanoniq produces things: source, then the model it
     parses into, then the views derived from that. */
  .rv {
    opacity: 0;
    animation: settle 350ms ease-out forwards;
  }

  .rv-1 { animation-delay: 100ms; }
  .rv-2 { animation-delay: 380ms; }
  .rv-3 { animation-delay: 660ms; }

  @keyframes settle {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  @media (prefers-reduced-motion: reduce) {
    .rv {
      opacity: 1;
      animation: none;
    }
    .sheet.is-flowing *,
    .is-updated { animation: none; }
    .redline,
    .redline.is-stale { transition: none; }
    .skip { transition: none; }
  }

  figcaption code,
  .prose-p code {
    font-family: var(--mono);
    font-size: 0.95em;
    color: var(--code);
  }

  /* ---- prose, and a section split into text plus artwork ------------------ */

  /* Short sections carry a larger measure: three sentences at body size read as a caption. */
  .prose {
    font-size: var(--step-1);
    line-height: 1.5;
  }

  .prose .lede {
    font-size: var(--step-2);
    line-height: 1.35;
    letter-spacing: -0.015em;
  }

  .prose p + p,
  .prose-p { margin-top: var(--space-m); }

  .prose p:not(.lede),
  .prose-p { max-width: var(--measure); }

  .split {
    display: grid;
    gap: var(--space-l);
    align-items: center;
  }

  /* The artwork is raster and carries its own ground, so it is framed as a plate rather than
     pretending to sit on the page's background. */
  .section-il {
    display: block;
    width: 100%;
    height: auto;
    max-width: 30rem;
    justify-self: center;
    border: 1px solid var(--rule);
    border-radius: 3px;
  }

  @media (min-width: 64rem) {
    .split {
      grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
      gap: var(--space-xl);
    }

    .section-il { justify-self: end; }

    /* A 16:9 image beside a text column reads short. Given the full width it can be much
       larger for the same vertical space. */
    .split--stack {
      grid-template-columns: minmax(0, 1fr);
      gap: var(--space-l);
    }

    .split--stack .section-il {
      max-width: 52rem;
      justify-self: center;
    }

    .split--cta { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  }

  /* ---- the export drawing ------------------------------------------------- */
  /* On the drawing sheet like the hero: the model authored and solid, every export dashed, and
     the one identifier that survives them all in the accent. */

  .export-dg {
    --grid: color-mix(in srgb, var(--kq-rule) 22%, transparent);

    display: block;
    width: 100%;
    max-width: 30rem;
    height: auto;
    justify-self: center;
    border: 1px solid var(--kq-rule);
    border-radius: 4px;
    background-color: var(--kq-ground);
    background-image:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
  }

  @media (min-width: 64rem) {
    .export-dg { justify-self: end; }
  }

  .ex-cap { font-size: 14px; }

  .ex-sm {
    font-family: var(--sans);
    font-size: 10px;
    fill: var(--muted);
    text-anchor: middle;
  }

  .ex-strong { font-weight: 600; fill: var(--ink); }

  .ex-row {
    font-family: var(--mono);
    font-size: 9px;
    fill: var(--muted);
  }

  .ex-id {
    font-family: var(--mono);
    font-size: 8.5px;
    fill: var(--accent);
    text-anchor: end;
  }

  .ex-id--start { text-anchor: start; }
  .ex-mid { text-anchor: middle; }

  .dd {
    fill: none;
    stroke: var(--derived);
    stroke-width: 1.2;
    stroke-dasharray: 3 2.5;
  }

  .ex-end { stroke-width: 2.5; stroke-dasharray: none; }

  .ex-fine {
    fill: none;
    stroke: var(--derived);
    stroke-width: 1;
  }

  .ex-no {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.2;
    stroke-dasharray: 5 4;
  }

  .ex-no-head { fill: var(--muted); }

  .redline-x {
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  /* ---- section headings, format and stage lists --------------------------- */

  .band h2 {
    font-size: var(--step-3);
    letter-spacing: -0.02em;
    max-width: 20ch;
  }

  .formats,
  .stages-list {
    display: grid;
    margin: var(--space-l) 0 0;
    padding: 0;
    list-style: none;
  }

  .stages-list { counter-reset: stage; }

  .formats > li,
  .stages-list > li {
    display: grid;
    gap: var(--space-xs);
    padding-block: var(--space-m);
    border-top: 1px solid var(--rule);
  }

  /* Numbered because the stages genuinely are a sequence — each one depends on the last. */
  .stages-list > li { counter-increment: stage; }

  /* Large but quiet: the <ol> carries the sequence for assistive tech, so the numeral is
     structure rather than content and can sit at the low-contrast end. */
  .stages-list > li::before {
    content: counter(stage);
    font-family: var(--mono);
    font-size: 3rem;
    line-height: 0.85;
    color: var(--derived);
  }

  .formats h3,
  .stages-list h3 { font-size: var(--step-1); }

  .formats p,
  .stages-list p { max-width: 56ch; }

  /* KQ is the source, the three formats are derived from it — same rule as everywhere else,
     so the arrow and their borders are dashed and KQ's is solid. */
  .tagflow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-s);
    margin-top: var(--space-m);
  }

  .tag-arrow {
    width: 3rem;
    height: 1rem;
    flex: none;
  }

  .tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-s);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .tag,
  .tags li {
    padding: 0.55rem 1.3rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--surface);
    font-family: var(--mono);
    font-size: var(--step-0);
    color: var(--accent);
  }

  .tags li { border-style: dashed; }

  .tag--src {
    display: inline-block;
    font-weight: 700;
  }

  .when {
    display: block;
    margin-top: 0.2rem;
    font-family: var(--mono);
    font-size: var(--step--1);
    font-weight: 400;
    color: var(--muted);
  }

  @media (min-width: 48rem) {
    .formats > li {
      grid-template-columns: 14rem 1fr;
      gap: var(--space-m);
    }

    .stages-list > li {
      grid-template-columns: 4.5rem 14rem 1fr;
      gap: var(--space-m);
      align-items: start;
    }
  }

  /* ---- the three points -------------------------------------------------- */

  /* One strip of drawing sheet, the hero's material, cut into three panels by solid rules. Each
     drawing is the claim beneath it, in the same solid/dashed vocabulary. */
  .points {
    --grid: color-mix(in srgb, var(--kq-rule) 22%, transparent);

    display: grid;
    margin: var(--space-l) 0 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--kq-rule);
    border-radius: 4px;
    background-color: var(--kq-ground);
    background-image:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
  }

  .points > li { padding: var(--space-m); }

  .points > li + li { border-top: 1px solid var(--kq-rule); }

  .pt-dg {
    display: block;
    width: 100%;
    max-width: 22rem;
    height: auto;
    margin: 0 0 var(--space-m);
  }

  .points h3 {
    font-size: var(--step-2);
    letter-spacing: -0.015em;
    margin-bottom: var(--space-xs);
  }

  .points p {
    max-width: 44ch;
    color: var(--muted);
  }

  .pt-was {
    font-family: var(--sans);
    font-size: 13px;
    fill: var(--muted);
    text-anchor: middle;
  }

  .pt-strike {
    stroke: var(--accent);
    stroke-width: 1.5;
  }

  .pt-hint {
    fill: none;
    stroke: var(--muted);
    stroke-width: 1.2;
  }

  .pt-name { font-size: 20px; font-weight: 600; }
  .pt-small { font-size: 14px; }
  .pt-chip { font-size: 11px; fill: var(--muted); }

  .pt-eyelet { fill: var(--ink); }

  /* The identity is the one thing on the sheet that does not change, so it carries the accent. */
  .pt-tag {
    fill: none;
    stroke: var(--accent);
    stroke-width: 1.5;
  }

  .pt-id {
    font-family: var(--mono);
    font-size: 12px;
    fill: var(--accent);
    text-anchor: middle;
  }

  .pt-rule {
    stroke: var(--ink);
    stroke-width: 1;
  }

  .pt-right { text-anchor: end; }

  .pt-code {
    font-family: var(--mono);
    font-size: 11px;
    fill: var(--kq-ink);
    white-space: pre;
  }

  .pt-del { fill: var(--kq-str); }
  .pt-add { fill: var(--kq-kw); }
  .pt-del-bg { fill: color-mix(in srgb, var(--kq-str) 12%, transparent); }
  .pt-add-bg { fill: color-mix(in srgb, var(--kq-kw) 12%, transparent); }

  @media (min-width: 56rem) {
    .points { grid-template-columns: repeat(3, minmax(0, 1fr)); }

    .points > li { padding: var(--space-l) var(--space-m); }

    .points > li + li {
      border-top: 0;
      border-left: 1px solid var(--kq-rule);
    }
  }

  /* ---- the shadow box ------------------------------------------------------- */

  /* The Hairline figure above the three points, on the same drawing sheet. Its palette is the
     sheet's: the model's bright stroke is ink, every other line a derived or ruled one. */
  .projections {
    display: grid;
    gap: var(--space-m);
    align-items: center;
    margin: var(--space-l) 0 0;
  }

  .pj-plate {
    --grid: color-mix(in srgb, var(--kq-rule) 22%, transparent);

    position: relative;
    max-width: 40rem;
    border: 1px solid var(--kq-rule);
    border-radius: 4px;
    background-color: var(--kq-ground);
    background-image:
      linear-gradient(var(--grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
  }

  .pj-stage {
    --hairline-plate: var(--kq-ground);
    --hairline-hi: var(--ink);
    --hairline-edge: var(--derived);
    --hairline-mid: color-mix(in srgb, var(--derived) 60%, var(--kq-ground));
    --hairline-lo: var(--kq-rule);

    position: relative;
    aspect-ratio: 5 / 4;
  }

  .pj-read {
    position: absolute;
    top: var(--space-s);
    right: var(--space-s);
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
    pointer-events: none;
  }

  .projections h3 {
    font-size: var(--step-2);
    letter-spacing: -0.015em;
    margin-bottom: var(--space-xs);
  }

  .projections figcaption p {
    max-width: 44ch;
    color: var(--muted);
  }

  @media (min-width: 56rem) {
    .projections { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  }

  /* ---- where to start ------------------------------------------------------ */

  /* The page's one loud section. The page turns over (its ink becomes the ground, under the
     drafting grid) and the answers run down a lane in the accent, the logo's color, set as large
     as anything on the page. A problem on the left is joined to its answer by the site's one
     rule: a dashed connector, derived, from a port on the problem into the solid lane, authored.
     The connector draws itself as its row scrolls in, and runs like the hero's derived strokes
     while the row is hovered. The icons are anchors for the eye, not a sequence, so the rows
     carry no numbers. */

  .band--starts {
    --st-ground: var(--ink);
    --st-text: var(--paper);
    --st-muted: color-mix(in srgb, var(--paper) 74%, var(--ink));
    --st-faint: color-mix(in srgb, var(--paper) 20%, var(--ink));
    --st-grid: color-mix(in srgb, var(--paper) 7%, transparent);
    --st-lane: var(--accent);   /* the lane's text is --paper: 5.3:1 in light, 7.5:1 in dark */
    --st-hit: var(--paper);     /* a hovered answer's ground */
    --st-on-hit: var(--accent); /* and its text: 5.3:1 */
    --st-hot: var(--glyph);     /* strokes and display type only: 4.0:1 on the light ground */
    --st-reach: 5rem;           /* how far a connector runs before the lane */

    padding-block: var(--space-xl);
    background-color: var(--st-ground);
    background-image:
      linear-gradient(var(--st-grid) 1px, transparent 1px),
      linear-gradient(90deg, var(--st-grid) 1px, transparent 1px);
    background-size: 24px 24px;
    background-position: -1px -1px;
    color: var(--st-text);
  }

  /* In dark the section does not flip to a light slab, which would glare on a dark page: it
     sinks into a well darker than the page, as the source listing does, and the amber lane
     carries it. */
  @media (prefers-color-scheme: dark) {
    .band--starts {
      --st-ground: #0a1513;
      --st-text: var(--ink);
      --st-muted: var(--muted);
      --st-faint: var(--rule);
      --st-grid: color-mix(in srgb, var(--ink) 5%, transparent);
      --st-hit: var(--ink);
      --st-on-hit: var(--paper); /* 14.9:1 */
    }
  }

  :root[data-theme="dark"] .band--starts {
    --st-ground: #0a1513;
    --st-text: var(--ink);
    --st-muted: var(--muted);
    --st-faint: var(--rule);
    --st-grid: color-mix(in srgb, var(--ink) 5%, transparent);
    --st-hit: var(--ink);
    --st-on-hit: var(--paper);
  }

  :root[data-theme="light"] .band--starts {
    --st-ground: var(--ink);
    --st-text: var(--paper);
    --st-muted: color-mix(in srgb, var(--paper) 74%, var(--ink));
    --st-faint: color-mix(in srgb, var(--paper) 20%, var(--ink));
    --st-grid: color-mix(in srgb, var(--paper) 7%, transparent);
    --st-hit: var(--paper);
    --st-on-hit: var(--accent);
  }

  main > .band + .band--starts,
  main > .band--starts + .band { border-top-color: transparent; }

  .band--starts ::selection {
    background: var(--st-text);
    color: var(--st-ground);
  }

  .band--starts :focus-visible { outline-color: var(--st-hot); }

  .band--starts h2 {
    max-width: 11ch;
    font-family: var(--display);
    font-weight: 700;
    font-size: var(--step-5);
    letter-spacing: -0.035em;
    line-height: 0.95;
  }

  .st-name { color: var(--st-hot); }

  .starts {
    width: 100%;
    margin-top: var(--space-l);
    border-collapse: collapse;
  }

  .starts th {
    padding: 0.7rem var(--space-s);
    font-family: var(--mono);
    font-size: var(--step--1);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: left;
    color: var(--st-muted);
    border-top: 1px solid var(--st-text);
  }

  .starts th:last-child {
    background: var(--st-hit);
    color: var(--st-on-hit);
    border-top-color: var(--st-hit);
  }

  /* The rules under the problems are dashed and the lane's are solid: the same rule again. */
  .starts td {
    padding: var(--space-m) var(--space-s);
    vertical-align: middle;
    border-bottom: 1px dashed var(--st-faint);
  }

  .starts .st-pain {
    display: grid;
    gap: var(--space-s);
    font-size: var(--step-1);
    line-height: 1.35;
    color: var(--st-muted);
    transition: color 160ms ease-out;
  }

  .st-icon {
    width: 3rem;
    height: 3rem;
    stroke-width: 1;
    color: var(--st-text);
    opacity: 0.45;
    transition: color 160ms ease-out, opacity 160ms ease-out;
  }

  .starts .st-start {
    position: relative;
    background: var(--st-lane);
    border-bottom: 1px solid color-mix(in srgb, var(--paper) 28%, var(--st-lane));
    transition: background-color 160ms ease-out;
  }

  .st-start a {
    display: block;
    font-family: var(--display);
    font-weight: 700;
    font-size: clamp(1.75rem, 1rem + 2.6vw, 3.25rem);
    letter-spacing: -0.03em;
    line-height: 1;
    text-wrap: balance;
    color: var(--paper);
    text-decoration: none;
    transition: color 160ms ease-out;
  }

  /* The whole lane cell is the link's target, not just its words. */
  .st-start a::before {
    content: "";
    position: absolute;
    inset: 0;
  }

  /* A no-break space, so the arrow never wraps onto a line of its own; silent, since the link
     already says where it goes. */
  .st-start a::after {
    content: "\00a0→" / "";
    display: inline-block;
    font-family: var(--sans);
    font-weight: 400;
    transition: transform 160ms ease-out;
  }

  .starts tr:hover .st-pain,
  .starts tr:focus-within .st-pain { color: var(--st-text); }

  .starts tr:hover .st-icon,
  .starts tr:focus-within .st-icon {
    color: var(--st-hot);
    opacity: 1;
  }

  .starts tr:hover .st-start,
  .starts tr:focus-within .st-start { background: var(--st-hit); }

  .starts tr:hover .st-start a,
  .starts tr:focus-within .st-start a { color: var(--st-on-hit); }

  .starts tr:hover .st-start a::after,
  .starts tr:focus-within .st-start a::after { transform: translateX(0.2em); }

  /* The link's target covers the cell, so its outline goes round the cell. */
  .starts .st-start a:focus-visible { outline: none; }
  .starts .st-start a:focus-visible::before {
    outline: 3px solid var(--st-on-hit);
    outline-offset: -6px;
  }

  /* Narrow, up to where the two columns have room: each row stacks, and the column heading moves
     onto the answer, hidden from assistive tech since the table's own header already says it. */
  @media (max-width: 63.99rem) {
    .starts,
    .starts tbody,
    .starts tr,
    .starts td { display: block; }

    .starts thead {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }

    .starts tbody { border-top: 1px solid var(--st-text); }

    .starts td { border-bottom: 0; }

    .starts tr + tr { margin-top: var(--space-s); }

    .starts .st-pain {
      grid-template-columns: 3rem minmax(0, 1fr);
      align-items: center;
      padding-inline: 0;
    }

    .starts .st-start { padding: var(--space-s) var(--space-s) var(--space-m); }

    .st-start::before {
      content: "Start with" / "";
      display: block;
      margin-bottom: var(--space-xs);
      font-family: var(--mono);
      font-size: var(--step--1);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--paper);
    }

    .starts tr:hover .st-start::before,
    .starts tr:focus-within .st-start::before { color: var(--st-on-hit); }
  }

  @media (min-width: 64rem) {
    .starts th,
    .starts td { padding-inline: var(--space-m); }

    .starts td { padding-block: var(--space-l); }

    .starts .st-pain {
      grid-template-columns: 5.5rem minmax(0, 1fr);
      align-items: center;
      gap: var(--space-m);
      padding-right: calc(var(--st-reach) + var(--space-m));
      font-size: var(--step-2);
      line-height: 1.3;
    }

    .st-icon { width: 5.5rem; height: 5.5rem; }

    .starts .st-start {
      width: 48%;
      padding-inline: var(--space-l);
    }

    /* The connector: a port on the problem, a dashed run, an arrowhead into the lane. Dashes
       are a repeating gradient rather than a dashed border, so they can run. */
    .st-start::before,
    .st-start::after {
      content: "";
      position: absolute;
      top: 50%;
      color: var(--st-muted);
      pointer-events: none;
      transition: color 160ms ease-out;
    }

    .st-start::before {
      left: calc(-1 * var(--st-reach));
      width: calc(var(--st-reach) - 0.6rem);
      height: 10px;
      margin-top: -5px;
      background:
        radial-gradient(circle, currentColor 4px, transparent 4.5px) 0 50% / 10px 10px no-repeat,
        linear-gradient(90deg, currentColor 8px, transparent 8px) 14px 50% / 14px 2px repeat-x;
      transform-origin: left center;
    }

    .st-start::after {
      left: -0.75rem;
      width: 0;
      height: 0;
      margin-top: -0.45rem;
      border-block: 0.45rem solid transparent;
      border-left: 0.75rem solid currentColor;
    }

    .starts tr:hover .st-start::before,
    .starts tr:focus-within .st-start::before,
    .starts tr:hover .st-start::after,
    .starts tr:focus-within .st-start::after { color: var(--st-hot); }
  }

  @media (min-width: 64rem) and (prefers-reduced-motion: no-preference) {
    .starts tr:hover .st-start::before,
    .starts tr:focus-within .st-start::before { animation: st-run 500ms linear infinite; }

    /* Where the browser can tie an animation to scrolling, each row is drawn as it comes up:
       the connector runs out from its port, the head lands, then the answer. A row is finished
       by the time all of it is above the bottom tenth of the window, so nothing on screen is
       ever left half drawn. Elsewhere the rows simply sit there, finished. */
    @supports (animation-timeline: view()) {
      .starts tbody tr {
        view-timeline: --st-row block;
        view-timeline-inset: 0 10%;
      }

      .st-icon,
      .st-start::before,
      .st-start::after,
      .st-start a {
        animation-timeline: --st-row;
        animation-fill-mode: both;
        animation-timing-function: cubic-bezier(0.3, 0.7, 0.2, 1);
      }

      .st-icon {
        animation-name: st-appear;
        animation-range: entry 0% entry 70%;
      }

      .st-start::before {
        animation-name: st-draw;
        animation-range: entry 0% entry 75%;
      }

      .st-start::after {
        animation-name: st-appear;
        animation-range: entry 70% entry 80%;
      }

      .st-start a {
        animation-name: st-arrive;
        animation-range: entry 45% entry 100%;
      }

      /* A hovered row's connector runs instead; by then it is long since drawn. */
      .starts tr:hover .st-start::before,
      .starts tr:focus-within .st-start::before {
        animation: st-run 500ms linear infinite;
        animation-timeline: auto;
      }
    }
  }

  @keyframes st-run {
    from { background-position: 0 50%, 14px 50%; }
    to { background-position: 0 50%, 28px 50%; }
  }

  @keyframes st-draw {
    from { transform: scaleX(0); }
  }

  @keyframes st-appear {
    from { opacity: 0; }
  }

  /* A wipe rather than a slide: a transform would make the link the containing block of its
     own target, shrinking it from the cell to the words. */
  @keyframes st-arrive {
    from { clip-path: inset(0 100% 0 0); }
  }

  @media (prefers-reduced-motion: reduce) {
    .st-pain,
    .st-icon,
    .st-start,
    .st-start a,
    .st-start a::after,
    .st-start::before,
    .st-start::after { transition: none; }
  }

  /* ---- the source listing -------------------------------------------------- */

  /* Markup comes from .ai/tools/highlight-kq.mjs in --fragment mode and carries classes
     only; the CSP forbids inline style (ADR 0035), so everything it needs is here. */

  .listing-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    margin-top: var(--space-m);
  }

  .listing {
    border: 1px solid var(--kq-rule);
    border-radius: 3px;
    background: var(--kq-ground);
    overflow: auto;
    overscroll-behavior-x: contain;

    /* Sized by the file rather than by the column: a listing stretched to the full width is
       mostly empty on the right, and the ragged edge is the honest shape of source. */
    width: max-content;
    max-width: 100%;
  }

  /* Outside the scrolling .listing, so it stays put over the corner rather than scrolling off
     with the code. --kq-* tokens, since it sits on the plate rather than the page. */
  .copy-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 1;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--kq-rule);
    border-radius: 3px;
    background: var(--kq-ground);
    color: var(--kq-quiet);
    font-family: var(--mono);
    font-size: var(--step--1);
    cursor: pointer;
  }

  .copy-btn:hover,
  .copy-btn:focus-visible { color: var(--kq-ink); border-color: var(--kq-str); }

  .copy-btn[data-copied] { color: var(--kq-kw); border-color: var(--kq-kw); }

  /* Solid, never dashed: the chrome around authored source says authored. */
  .listing-cap {
    margin-top: var(--space-m);
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .listing-lines { border-collapse: collapse; }

  .listing-lines td {
    padding: 0;
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.65;
    white-space: pre;
    vertical-align: top;
    color: var(--kq-ink);
  }

  /* Sticky so the numbers survive a horizontal scroll on a narrow screen, which needs an
     opaque ground of its own — hence the repeated background. */
  .listing-lines .ln {
    position: sticky;
    left: 0;
    width: 1%;
    padding-inline: 1.1rem 1rem;
    background: var(--kq-ground);
    border-right: 1px solid var(--kq-rule);
    text-align: right;
    color: var(--kq-quiet);
    font-variant-numeric: tabular-nums;
    user-select: none;
  }

  .listing-lines .ln a {
    color: inherit;
    text-decoration: none;
  }

  .listing-lines .ln a:hover { color: var(--kq-ink); }

  .listing-lines .lc { padding-inline: 1.1rem 1.5rem; }

  /* Landing on a declaration from a reference: the row lifts and the Code is ringed, so the
     jump lands somewhere visible rather than silently. */
  .listing-lines tr:target .lc,
  .listing-lines tr:has(.t-def:target) .lc { background: var(--kq-target); }

  .listing-lines tr:has(.t-def:target) .t-def {
    outline: 1px solid var(--kq-kw);
    outline-offset: 3px;
    border-radius: 2px;
  }

  .t-keyword { color: var(--kq-kw); }
  .t-relation { color: var(--kq-rel); }
  .t-kind { color: var(--kq-kind); }
  .t-string { color: var(--kq-str); }
  .t-literal { color: var(--kq-lit); }
  .t-doc { color: var(--kq-soft); font-style: italic; }
  .t-comment { color: var(--kq-quiet); font-style: italic; }
  .t-punct { color: var(--kq-quiet); }

  /* `derived` is spelled the way the diagrams draw derivation, matching .kw-d in the hero. */
  .t-modifier {
    color: var(--kq-soft);
    font-style: italic;
    text-decoration: underline dashed var(--kq-soft) 1px;
    text-underline-offset: 3px;
  }

  /* An abbreviation and an arrow are structure, not another category, so they carry weight
     instead of a further hue — eight colors in one listing is already the ceiling. */
  .t-abbr {
    color: var(--kq-ink);
    font-weight: 600;
    letter-spacing: 0.04em;
  }

  /* A constant stands for a literal, so it takes the literal's hue, bold, rather than a ninth one. */
  .t-constant {
    color: var(--kq-lit);
    font-weight: 600;
  }

  .t-arrow {
    color: var(--kq-ink);
    font-weight: 600;
  }

  .t-def {
    color: var(--kq-def);
    font-weight: 600;
    text-decoration: none;
  }

  .t-ref {
    color: var(--kq-ink);
    text-decoration: underline dotted var(--kq-quiet) 1px;
    text-underline-offset: 3px;
  }

  /* A Code that resolves to nothing in this file. It should never reach the page — the build
     would be showing a broken model — so it is marked rather than styled away. */
  .t-unresolved {
    color: var(--kq-ink);
    text-decoration: underline wavy var(--kq-str) 1px;
    text-underline-offset: 3px;
  }

  a.t-ref:hover,
  a.t-def:hover {
    color: var(--kq-hover);
    text-decoration-color: var(--kq-hover);
  }

  .listing-lines a:focus-visible {
    outline: 2px solid var(--kq-str);
    outline-offset: 2px;
  }

  /* The key sits on the page, not on the plate: it explains the listing rather than being
     part of it, and the swatch is the only place a color appears without a word attached. */
  .listing-key {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-m);
    margin: var(--space-s) 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .listing-key li {
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }

  .listing-key li::before {
    content: '';
    width: 0.6rem;
    height: 0.6rem;
    flex: none;
    border-radius: 2px;
    background: currentColor;
  }

  .key-kw { color: var(--kq-kw); }
  .key-mod { color: var(--kq-soft); }
  .key-rel { color: var(--kq-rel); }
  .key-kind { color: var(--kq-kind); }
  .key-str { color: var(--kq-str); }
  .key-lit { color: var(--kq-lit); }
  .key-doc { color: var(--kq-soft); }
  .key-com { color: var(--kq-quiet); }

  .listing-more { margin-top: var(--space-m); }

  .step-link img,
  .step-link .logo-mark {
    width: 1.2em;
    height: 1.2em;
    vertical-align: -0.25em;
    margin-right: 0.35em;
  }

  .listing-stats {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-m);
    margin: var(--space-m) 0 0;
    padding: 0;
    list-style: none;
    font-family: var(--mono);
    font-size: var(--step--1);
    color: var(--muted);
  }

  .listing-stats b {
    color: var(--ink);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
  }

  /* Below the gutter width the plate is worth more than the margin, so it takes the full
     viewport and drops the side borders rather than scrolling inside a narrow well. */
  @media (max-width: 40rem) {
    .listing-wrap {
      display: block;
      margin-inline: calc(var(--gutter) * -1);
    }

    .listing {
      border-inline: 0;
      border-radius: 0;
      width: auto;
    }
  }

  /* ---- the example page ---------------------------------------------------- */

  .file-name {
    font-family: var(--mono);
    font-size: var(--step-2);
    font-weight: 600;
    letter-spacing: -0.01em;
  }

  .back {
    display: inline-block;
    margin-top: var(--space-l);
    font-family: var(--mono);
    font-size: var(--step--1);
  }

  /* ---- the extension page -------------------------------------------------- */

  .page-title {
    font-size: var(--step-4);
    letter-spacing: -0.025em;
    max-width: 18ch;
  }

  /* ---- text pages: privacy, the AI disclaimer, the 404 -------------------- */

  .doc h2 {
    margin-top: var(--space-l);
    font-size: var(--step-2);
    max-width: none;
  }

  .doc h2 + .prose-p { margin-top: var(--space-s); }

  /* ---- the open-source notices: one table, then each license text once ---- */

  .os-table-wrap { margin-top: var(--space-m); overflow-x: auto; }
  .os-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
  .os-table th { text-align: left; font-family: var(--mono); font-weight: 600; color: var(--muted); padding: 0.35rem var(--space-xs); border-bottom: 1px solid var(--rule); }
  .os-table td { padding: 0.35rem var(--space-xs); border-bottom: 1px solid var(--rule); vertical-align: top; }
  .os-name { font-family: var(--mono); }
  .os-version, .os-note, .os-copy { color: var(--muted); }
  .os-copy { font-size: 0.9em; }
  .os-source { font-size: 0.9em; }
  .doc h3 { margin-top: var(--space-m); font-size: var(--step-1); scroll-margin-top: var(--space-m); }
  .os-text { margin-top: var(--space-xs); padding: var(--space-s); max-height: 24rem; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 0.75rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; }

  .error-code {
    font-family: var(--mono);
    font-size: clamp(6rem, 3rem + 14vw, 12rem);
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--derived);
  }

  .steps {
    display: grid;
    margin: var(--space-l) 0 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
  }

  .steps > li {
    display: grid;
    gap: var(--space-xs);
    padding-block: var(--space-m);
    border-top: 1px solid var(--rule);
    counter-increment: step;
  }

  .steps > li::before {
    content: counter(step);
    font-family: var(--mono);
    font-size: var(--step-2);
    line-height: 1;
    color: var(--derived);
  }

  .steps h3 { font-size: var(--step-1); }
  .steps p { max-width: 56ch; }
  .steps .kq { justify-self: start; max-width: 100%; }

  .lede code,
  .steps code,
  .limits code {
    font-family: var(--mono);
    font-size: 0.95em;
    color: var(--code);
  }

  @media (min-width: 48rem) {
    .steps > li {
      grid-template-columns: 3rem minmax(0, 1fr);
      column-gap: var(--space-m);
    }

    .steps > li > * { grid-column: 2; }
    .steps > li::before { grid-row: 1 / span 3; }
  }

  .limits {
    max-width: var(--measure);
    margin-top: var(--space-m);
  }

  .limits + .limits { margin-top: var(--space-s); }

  /* ---- call to action ----------------------------------------------------- */

  .status-sub {
    max-width: var(--measure);
    color: var(--muted);
  }

  .cta-button {
    display: inline-block;
    margin-top: var(--space-l);
    padding: 0.7rem 1.4rem;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent);
    color: var(--paper);
    font-family: var(--mono);
    font-size: var(--step-0);
    text-decoration: none;
  }

  .cta-button--outline {
    background: transparent;
    color: var(--accent);
  }

  .cta-button:hover,
  .cta-button:focus-visible { text-decoration: underline; }

  .cta-row { display: flex; flex-wrap: wrap; gap: var(--space-s); margin-top: var(--space-l); }
  .cta-row .cta-button { margin-top: 0; }

  /* ---- header navigation ---------------------------------------------------- */

  .head-nav { display: flex; align-items: center; gap: var(--space-s); }

  .head-link {
    color: var(--muted);
    font-family: var(--mono);
    font-size: var(--step--1);
    text-decoration: none;
  }

  .head-link:hover,
  .head-link:focus-visible { color: var(--accent); text-decoration: underline; }

  /* Opens in a new tab: the demo and the docs are apps of their own, so the site stays where it was. */
  .head-link--ext::after { content: "↗"; margin-left: 0.2em; font-size: 0.85em; }

  /* On a phone the hero's own button is the way to the demo, a thumb away. */
  @media (max-width: 30rem) {
    .head-link--wide { display: none; }
  }

  /* ---- theme toggle --------------------------------------------------------- */

  .theme-toggle {
    flex: none;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font-family: var(--mono);
    font-size: var(--step--1);
    cursor: pointer;
  }

  .theme-toggle:hover,
  .theme-toggle:focus-visible {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* ---- pricing ------------------------------------------------------------- */

  .pricing { margin-top: var(--space-l); }

  /* What shows until the widget's script runs, and in its place without it. */
  .pricing-fallback {
    width: 100%;
    border-collapse: collapse;
  }

  .pricing-fallback th,
  .pricing-fallback td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--rule);
    text-align: left;
  }

  .pricing-fallback td:last-child { font-family: var(--mono); }

  /* ---- comparison pages: the generated table, its sources and the hub's list (plan 34) ---- */

  .compare-asof {
    margin-top: var(--space-m);
    font-family: var(--mono);
    font-size: 0.875rem;
    color: var(--muted);
  }

  /* Narrow screens read each point as a card, its cells labeled; from 48rem it is a table. */
  .compare-table {
    display: block;
    width: 100%;
    margin-top: var(--space-s);
    border-collapse: collapse;
    font-size: 0.9375rem;
  }

  .compare-table caption,
  .compare-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .compare-table tbody,
  .compare-table tr,
  .compare-table th,
  .compare-table td { display: block; }

  .compare-table tr { padding: 0.75rem 0; border-bottom: 1px solid var(--rule); }

  .compare-table th,
  .compare-table td {
    padding: 0.35rem 0.75rem;
    text-align: left;
    vertical-align: top;
  }

  .compare-table td::before {
    content: attr(data-label);
    display: block;
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--muted);
  }

  @media (min-width: 48rem) {
    .compare-table { display: table; }
    .compare-table caption { position: absolute; }
    .compare-table thead { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; display: table-header-group; }
    .compare-table tbody { display: table-row-group; }
    .compare-table tr { display: table-row; padding: 0; border-bottom: 0; }
    .compare-table th,
    .compare-table td { display: table-cell; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--rule); }
    .compare-table td::before { content: none; }
    .compare-table thead th { border-bottom: 2px solid var(--ink); font-weight: 600; }
  }

  .compare-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface) 55%, transparent); }

  .compare-table tbody th { font-weight: 600; }

  .verdict { font-weight: 600; border-left: 3px solid var(--rule); }
  .verdict--kanoniq { border-left-color: var(--accent); }
  .verdict--theirs { border-left-color: var(--ink); }
  .verdict--different { border-left-style: dashed; border-left-color: var(--derived); }
  .verdict--same { border-left-color: var(--derived); }

  .compare-why {
    display: block;
    margin-top: 0.25rem;
    font-weight: 400;
    color: var(--muted);
  }

  .planned {
    font-style: italic;
    color: var(--muted);
    border-bottom: 1px dashed var(--derived);
  }

  .compare-sources a { overflow-wrap: anywhere; }

  .prose-list { margin-top: var(--space-s); padding-left: 1.25rem; max-width: 70ch; }
  .prose-list li + li { margin-top: 0.4rem; }

  .compare-list {
    margin-top: var(--space-m);
    padding-left: 0;
    list-style: none;
  }

  .compare-list li { padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }

  /* ---- footer -------------------------------------------------------------- */

  footer {
    padding-block: var(--space-l) var(--space-m);
    color: var(--muted);
    font-size: var(--step--1);
  }

  /* The logo, drawn as a rule: one solid line, one dashed beneath it. */
  .foot-motif { border-top: 1px solid var(--ink); }

  .foot-motif::after {
    content: '';
    display: block;
    margin-top: 5px;
    border-top: 1px dashed var(--derived);
  }

  .foot-grid {
    display: grid;
    gap: var(--space-l);
    margin-top: var(--space-l);
  }

  .foot-brand p {
    max-width: 38ch;
    margin-top: var(--space-s);
  }

  .foot-brand .logo-word { font-size: 1.45rem; }
  .foot-brand .logo-mark { width: 1.9rem; height: 1.9rem; }

  .foot-h {
    margin-bottom: var(--space-xs);
    font-size: var(--step-0);
    color: var(--ink);
  }

  .foot-links {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .foot-links a,
  .foot-legal a {
    color: var(--muted);
    text-decoration: none;
  }

  .foot-links a:hover,
  .foot-links a:focus-visible,
  .foot-legal a:hover,
  .foot-legal a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
  }

  .foot-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-xs) var(--space-m);
    margin-top: var(--space-l);
    padding-top: var(--space-s);
    border-top: 1px solid var(--rule);
    font-family: var(--mono);
    font-size: 0.8125rem;
  }

  .foot-legal-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs) var(--space-m);
  }

  .dim { font-family: var(--mono); }

  @media (min-width: 40rem) {
    .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .foot-brand { grid-column: 1 / -1; }
  }

  @media (min-width: 64rem) {
    .foot-grid {
      grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
      gap: var(--space-m);
    }

    .foot-brand { grid-column: auto; }
  }
}
