
  :root {
    --bg: #0f1115; --panel: #181b22; --panel-2: #1f232c; --border: #2a2f3a;
    --text: #e7eaf0; --muted: #9aa3b2; --accent: #4f8cff;
    --good: #57ab5a; --warn: #d4a72c; --bad: #e5534b;
    --header-bg: rgba(15,17,21,.84); --tint: rgba(255,255,255,.02);
    --shadow: 0 20px 50px rgba(0,0,0,.45);
  }
  @media (prefers-color-scheme: light) {
    :root {
      --bg: #f5f7fb; --panel: #ffffff; --panel-2: #eef2f7; --border: #dde1e8;
      --text: #1a1d24; --muted: #5b6472; --accent: #3b6fe0;
      --good: #268042; --warn: #94690f; --bad: #cb4036;
      --header-bg: rgba(255,255,255,.86); --tint: rgba(20,26,40,.022);
      --shadow: 0 18px 44px rgba(20,26,40,.10);
    }
  }
  /* Icon shapes for CSS-only decoration. data: URIs in a mask, so they inherit the
     live accent instead of baking a colour in. */
  :root {
    --ico-search: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-3.9-3.9"/></svg>');
  }
  * { box-sizing: border-box; }
  body { margin: 0; min-height: 100vh; display: flex; flex-direction: column;
         font: 16px/1.7 -apple-system, "Segoe UI", Roboto, sans-serif;
         background: var(--bg); color: var(--text); }
  /* Small accent-coloured text and the white-on-accent button both fall under 4.5:1
     with the raw accent; these derived tokens clear AA in each theme. */
  :root { --accent-text: var(--accent); --accent-btn: var(--accent); }
  @supports (color: color-mix(in srgb, red, blue)) {
    :root { --accent-btn: color-mix(in srgb, var(--accent) 70%, #000); }  /* = app/theme.py */
    @media (prefers-color-scheme: light) {
      :root { --accent-text: color-mix(in srgb, var(--accent) 70%, #000);
              --accent-btn: color-mix(in srgb, var(--accent) 80%, #000); }  /* = app/theme.py */
    }
  }
  /* Translucent washes for tints, glows and icon tiles. Same family as
     static/landing.html, so a rule can be moved between the two - but remember this
     file's light/dark polarity is inverted relative to it. */
  :root {
    --accent-30: color-mix(in srgb, var(--accent) 30%, transparent);
    --accent-05: color-mix(in srgb, var(--accent) 5%, transparent);
    --accent-08: color-mix(in srgb, var(--accent) 8%, transparent);
    --accent-12: color-mix(in srgb, var(--accent) 12%, transparent);
    --accent-20: color-mix(in srgb, var(--accent) 20%, transparent);
    --accent-45: color-mix(in srgb, var(--accent) 45%, transparent);
    --good-14: color-mix(in srgb, var(--good) 14%, transparent);
    --good-30: color-mix(in srgb, var(--good) 30%, transparent);
    --warn-14: color-mix(in srgb, var(--warn) 14%, transparent);
    --warn-30: color-mix(in srgb, var(--warn) 30%, transparent);
    --bad-12: color-mix(in srgb, var(--bad) 12%, transparent);
    --bad-30: color-mix(in srgb, var(--bad) 30%, transparent);
  }
  /* Gradient partner colour for the brand icon and CTA button, derived from the
     live accent so a rebrand stays coherent. Static fallback first. */
  :root { --accent-2: #7c4dd6; }
  @supports (color: color-mix(in oklab, red, blue)) {
    :root { --accent-2: color-mix(in oklab, var(--accent) 58%, #8b5cf6); }
  }
  :root { --accent2-14: color-mix(in srgb, var(--accent-2) 14%, transparent);
          --accent2-32: color-mix(in srgb, var(--accent-2) 32%, transparent); }
  a { color: var(--accent-text); }
  body { position: relative; }
  /* A soft wash behind the top of every content page, so the column does not start
     against flat background. Decorative, non-interactive, and clipped by body's own
     box - the page is a single column, so one blob is enough. */
  body::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 100%; max-width: 1100px; height: 520px; pointer-events: none; z-index: 0;
    background:
      radial-gradient(ellipse 42% 46% at 26% 34%, var(--accent2-14), transparent 70%),
      radial-gradient(ellipse 46% 50% at 74% 28%, var(--accent-20), transparent 72%);
  }
  /* header.top is styled entirely in app/nav.py, including its own z-index. */
  .wrap, footer { position: relative; z-index: 1; }
  .wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; flex: 1; width: 100%; }
  .wrap.wide { max-width: 900px; }
  .crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }
  .crumbs a { color: var(--muted); }
  h1 { font-size: clamp(26px, 4.6vw, 34px); line-height: 1.2; margin: 0 0 14px; text-wrap: balance; }
  .lead { font-size: 17.5px; color: var(--muted); margin: 0 0 30px; }
  h2 { font-size: 21px; margin: 38px 0 10px; text-wrap: balance; }
  h3 { font-size: 16.5px; margin: 26px 0 8px; }
  p { margin: 0 0 14px; }
  ul, ol { padding-left: 22px; margin: 0 0 16px; }
  li { margin-bottom: 8px; }
  pre:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  pre { background: var(--panel); border: 1px solid var(--border); border-radius: 9px;
        padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.6;
        font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
  .callout {
    position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--accent-12), var(--accent2-14));
    border: 1px solid var(--accent-30); border-left: 3px solid var(--accent);
    border-radius: 10px; padding: 16px 18px 16px 52px; margin: 26px 0;
  }
  /* The magnifier sits in the padding gutter, so it never reflows the text. */
  .callout::before {
    content: ''; position: absolute; top: 17px; left: 17px; width: 22px; height: 22px;
    background: var(--accent); pointer-events: none;
    -webkit-mask: var(--ico-search) center / contain no-repeat;
    mask: var(--ico-search) center / contain no-repeat;
  }
  .callout p:last-child { margin-bottom: 0; }
  .mistakes { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
              padding: 18px 20px 6px; }
  h2.group-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .09em;
                 color: var(--accent-text); font-weight: 700; margin: 34px 0 12px;
                 padding-top: 18px; border-top: 1px solid var(--border);
                 display: flex; align-items: center; gap: 9px; }
  h2.group-title::before {
    content: ''; width: 18px; height: 3px; border-radius: 2px; flex-shrink: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
  }
  .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
  .card { position: relative; overflow: hidden;
          background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
          padding: 16px 18px; text-decoration: none; color: inherit; display: block;
          transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease; }
  .card::after {
    content: ''; position: absolute; top: -40px; right: -40px; width: 120px; height: 120px;
    pointer-events: none; opacity: 0; transition: opacity .16s ease;
    background: radial-gradient(circle at center, var(--accent-20), transparent 70%);
  }
  .card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 26px var(--accent-20); }
  .card:hover::after { opacity: 1; }
  .card h3 { margin: 0 0 6px; font-size: 16px; color: var(--text); }
  .card p { margin: 0; color: var(--muted); font-size: 14px; }
  /* Industry cards carry a small illustrated tile; plain cards simply omit it. */
  .card .card-ico {
    width: 40px; height: 40px; border-radius: 10px; margin-bottom: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-12); border: 1px solid var(--accent-30); color: var(--accent);
  }
  .cards > .card:nth-child(4n+2) .card-ico { background: var(--accent2-14); border-color: var(--accent2-32); color: var(--accent-2); }
  .cards > .card:nth-child(4n+3) .card-ico { background: var(--good-14); border-color: var(--good-30); color: var(--good); }
  .cards > .card:nth-child(4n+4) .card-ico { background: var(--warn-14); border-color: var(--warn-30); color: var(--warn); }
  /* "On this page", built from the article's own H2s by _add_toc(). */
  .toc { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
         padding: 14px 18px 10px; margin: 22px 0 8px; }
  .toc .toc-title { margin: 0 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .07em;
                    text-transform: uppercase; color: var(--muted); }
  .toc ol { margin: 0; padding-left: 20px; columns: 2 220px; column-gap: 28px; }
  .toc li { margin: 0 0 4px; break-inside: avoid; }
  .toc a { display: inline-block; min-height: 24px; padding: 2px 0; }
  h2[id] { scroll-margin-top: 80px; }
  /* /compare/<slug> */
  .cmp-suits { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
  .cmp-suits > div { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
                     padding: 14px 18px 4px; }
  .cmp-suits h3 { margin-top: 0; }
  .cmp-src { font-size: 13px; color: var(--muted); white-space: nowrap; }
  /* Four and five columns don't fit a phone: scroll sideways inside .tablewrap rather
     than squeeze every cell to a word wide. */
  table.cmp-table { min-width: 620px; }
  .cmp-src a { color: var(--muted); }
  .related { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
  .related a { background: var(--panel); border: 1px solid var(--border); border-radius: 100px;
               padding: 6px 14px; font-size: 13.5px; text-decoration: none;
               transition: border-color .15s ease, background .15s ease; }
  .related a:hover { border-color: var(--accent); background: var(--accent-08); }
  .glossary-index { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 26px; }
  .glossary-index a { background: var(--panel); border: 1px solid var(--border);
                      border-radius: 6px; padding: 4px 10px; font-size: 13px; text-decoration: none; }
  dl { margin: 0; }
  dt { font-weight: 700; margin-top: 22px; scroll-margin-top: 20px; }
  dd { margin: 6px 0 0; color: var(--muted); }
  .glossary-toc ul { list-style: none; padding: 0; margin: 0 0 30px; display: grid; gap: 6px; font-size: 14.5px; }
  .glossary-toc strong { display: inline-block; min-width: 1.4em; }
  /* A run of short links separated only by commas: 24px tall each (WCAG 2.2 SC 2.5.8). */
  .glossary-toc a { display: inline-block; min-height: 24px; min-width: 24px; padding: 2px 0; }
  .glossary-letter h2 { margin: 34px 0 4px; scroll-margin-top: 80px; }
  .glossary-letter h3 { margin: 20px 0 0; font-size: 17px; scroll-margin-top: 80px; }
  .gloss-def { margin: 6px 0 0; color: var(--muted); }
  .gloss-guide { margin: 6px 0 0; font-size: 14px; }
  table { width: 100%; border-collapse: collapse; font-size: 14.5px; margin-bottom: 18px; }
  th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .07em;
       color: var(--muted); font-weight: 600; padding: 0 10px 8px 0; border-bottom: 1px solid var(--border); }
  td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--border); }
  td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .tablewrap { overflow-x: auto; }
  .method-note { color: var(--muted); font-size: 13.5px; }
  .barrow { display: grid; grid-template-columns: minmax(0,1fr) 78px; gap: 12px; align-items: center;
            padding: 8px 0; border-bottom: 1px solid var(--border); }
  .barrow:last-child { border-bottom: 0; }
  .barrow .track { display: block; height: 8px; border-radius: 100px; background: var(--panel-2); margin-top: 5px; }
  .barrow .track i { display: block; height: 100%; border-radius: 100px;
                     background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
  .barrow a { display: inline-block; min-height: 24px; padding: 2px 0; }
  .barrow .pc { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
  .statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 14px; margin: 24px 0 30px; }
  .stat { position: relative; overflow: hidden;
          background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 18px 16px; }
  .stat::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 46px; height: 3px; border-radius: 0 0 3px 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
  }
  .stat b { display: block; font-size: 27px; line-height: 1.1; font-variant-numeric: tabular-nums;
            color: var(--accent); }
  @supports ((background-clip: text) or (-webkit-background-clip: text)) {
    .stat b {
      background: linear-gradient(120deg, var(--accent), var(--accent-2));
      -webkit-background-clip: text; background-clip: text; color: transparent;
    }
  }
  /* Where the "number" is really a phrase (the most-common-fault tile), the gradient
     reads as decoration rather than a figure, so those keep the plain text colour. */
  .stat b.word { font-size: 19px; line-height: 1.25; background: none; color: var(--text);
                 -webkit-text-fill-color: currentColor; }
  .stat span { color: var(--muted); font-size: 13.5px; }
  .method { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px 6px; }

  /* ---------- content-page artwork (app/industry_art.py, app/guide_art.py) ---------- */
  .ind-art {
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    background: linear-gradient(150deg, var(--accent-08), var(--accent2-14));
    margin: 0 0 26px; aspect-ratio: 320 / 150;
  }
  .ind-art-svg { display: block; width: 100%; height: 100%; }
  .ia-panel { fill: var(--panel); stroke: var(--border); stroke-width: 1.4; }
  .ia-hair { stroke: var(--border); stroke-width: 1.4; fill: none; }
  .ia-hair-strong { stroke: var(--border); stroke-width: 2; fill: none; stroke-linecap: round; }
  .ia-dot { fill: var(--border); }
  .ia-block { fill: var(--muted); opacity: .34; }
  .ia-faint { fill: var(--muted); opacity: .2; }
  .ia-tile { fill: var(--panel-2); stroke: var(--border); stroke-width: 1.2; }
  .ia-empty { fill: none; stroke: var(--bad); stroke-width: 1.4; stroke-dasharray: 4 3; }
  .ia-accent { fill: var(--accent); }
  .ia-warn { fill: var(--warn); }
  .ia-good { fill: var(--good); }
  .ia-bad { fill: var(--bad); }
  .ia-cross { stroke: var(--panel); stroke-width: 1.8; stroke-linecap: round; fill: none; }
  .ia-cut { stroke: var(--bad); stroke-width: 1.6; stroke-dasharray: 3 3; fill: none; }
  .ia-brace { stroke: var(--muted); stroke-width: 2; fill: none; opacity: .5; stroke-linecap: round; }
  .ia-wash { fill: var(--accent-12); }
  .ia-ok-wash { fill: var(--good-14); }
  .ia-good-line { stroke: var(--good); stroke-width: 2; fill: none; stroke-linecap: round; }
  /* Arrowheads are drawn as paths - a <marker> would need an id, and /guides renders
     every scene's worth of markup through the same template. */
  .ia-arrow { stroke: var(--muted); stroke-width: 2; fill: none; opacity: .6;
              stroke-linecap: round; stroke-linejoin: round; }
  .ia-wash-2 { fill: var(--accent-08); }
  .ia-object { stroke: var(--accent); stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  .ia-object-fill { stroke: var(--accent); stroke-width: 3; fill: var(--accent-08); stroke-linecap: round; stroke-linejoin: round; }
  .ia-shine { stroke: var(--panel); stroke-width: 3; fill: none; stroke-linecap: round; opacity: .8; }
  .ia-pulse { stroke: var(--bad); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
  /* Kept on phones too: at ~350px wide the scene is only ~165px tall, which is a
     reasonable hero and still leaves the measured figures near the top. */
  footer { margin-top: 60px; padding-top: 22px; border-top: 1px solid var(--border);
           color: var(--muted); font-size: 13px; text-align: center; }
  /* inline-block + 3px is what makes each link a 24px-tall target. At 18px the links
     wrap close enough on a phone that two of them failed WCAG 2.5.8's spacing test. */
  footer a { color: var(--muted); margin: 0 8px; display: inline-block; padding: 3px 0; }
