/* Nivelaro — 2026 stylesheet.
   Modern CSS only: @layer, nesting, oklch, color-mix, container queries, :has(),
   scroll-driven animations, view transitions. No framework, no build step.
   Design DNA carried over from the B1-Grammatik reference — serif display,
   tinted gradient ground, layered panels, conic progress rings — then pushed
   further on colour accuracy, type scale and motion. */

@layer tokens, base, layout, components, utilities;

/* Safari < 15.4, Chrome < 111 and Firefox < 113 treat every oklch() token as
   invalid-at-computed-value-time, which turned buttons into near-white text on
   nothing and made the sticky header transparent. A second declaration cannot
   fix this — a custom property always parses — so the whole palette is
   restated under @supports. */
@supports not (color: oklch(0% 0 0)) {
  :root {
    --brand: #3f51c9; --brand-lift: #5b6bdd; --brand-deep: #2c3a9c;
    --brand-soft: #eceefb; --brand-ink: #27327f;
    --ink: #1b1f33; --ink-2: #3f4557; --ink-3: #6b7180;
    --bg: #f7f8fa; --bg-2: #f1f2f6; --panel: #fff; --panel-2: #fafbfc;
    --line: #e2e5ec; --line-2: #eef0f4;
    --ok: #1c7f46; --ok-bg: #e8f6ed; --no: #b5302a; --no-bg: #fbeceb; --warn: #9a6b12;
    --on-brand: #fff; --on-ok: #fff; --on-no: #fff;
    --ring: 0 0 0 3px rgba(63, 81, 201, .35);
  }
}

/* ------------------------------------------------------------------ tokens */
@layer tokens {
  :root {
    /* oklch gives perceptually even steps, so the dark palette is a real
       re-pick rather than an inverted guess. */
    --brand-h: 262;
    --brand:        oklch(52% 0.19 var(--brand-h));
    --brand-lift:   oklch(60% 0.20 var(--brand-h));
    --brand-deep:   oklch(42% 0.17 var(--brand-h));
    --brand-soft:   oklch(95% 0.03 var(--brand-h));
    --brand-ink:    oklch(38% 0.16 var(--brand-h));

    --ink:    oklch(21% 0.03 265);
    --ink-2:  oklch(42% 0.025 265);
    --ink-3:  oklch(52% 0.02 265);
    --bg:     oklch(97.5% 0.006 265);
    --bg-2:   oklch(95.5% 0.008 265);
    --panel:  oklch(100% 0 0);
    --panel-2:oklch(98% 0.004 265);
    --line:   oklch(90% 0.012 265);
    --line-2: oklch(94% 0.008 265);

    /* Foreground for the accent surfaces. The accents invert lightness between
       themes, so a hardcoded white here failed AA in dark by a wide margin
       (2.99:1 on every primary button). */
    --on-brand: oklch(99% 0 0);
    --on-ok:    oklch(99% 0 0);
    --on-no:    oklch(99% 0 0);

    --ok:      oklch(52% 0.13 155);
    --ok-bg:   oklch(95% 0.04 155);
    --no:      oklch(50% 0.17 25);
    --no-bg:   oklch(95% 0.04 25);
    --warn:    oklch(60% 0.13 75);

    --shadow-1: 0 1px 2px oklch(21% 0.03 265 / .05), 0 8px 24px -14px oklch(21% 0.03 265 / .18);
    --shadow-2: 0 2px 6px oklch(21% 0.03 265 / .07), 0 26px 54px -24px oklch(21% 0.03 265 / .34);
    --ring: 0 0 0 3px color-mix(in oklch, var(--brand) 35%, transparent);

    --page: 1140px;
    --gutter: clamp(18px, 4.2vw, 32px);

    --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-full: 999px;

    --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
    --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
            "Noto Sans", "Noto Sans Arabic", "Noto Sans Hebrew", sans-serif;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    /* fluid type scale */
    --step--1: clamp(0.86rem, 0.84rem + 0.1vw, 0.92rem);
    --step-0:  clamp(1rem, 0.97rem + 0.15vw, 1.08rem);
    --step-1:  clamp(1.2rem, 1.13rem + 0.35vw, 1.4rem);
    --step-2:  clamp(1.45rem, 1.3rem + 0.75vw, 1.9rem);
    --step-3:  clamp(1.8rem, 1.5rem + 1.5vw, 2.7rem);
    --step-4:  clamp(2.2rem, 1.6rem + 3vw, 3.9rem);

    --measure: 68ch;
    color-scheme: light dark;
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --on-brand: oklch(18% 0.03 265);
      --on-ok:    oklch(18% 0.03 265);
      --on-no:    oklch(18% 0.03 265);
      --brand:      oklch(72% 0.15 var(--brand-h));
      --brand-lift: oklch(79% 0.13 var(--brand-h));
      --brand-deep: oklch(64% 0.16 var(--brand-h));
      --brand-soft: oklch(28% 0.06 var(--brand-h));
      --brand-ink:  oklch(84% 0.10 var(--brand-h));

      --ink:    oklch(94% 0.012 265);
      --ink-2:  oklch(80% 0.02 265);
      --ink-3:  oklch(64% 0.02 265);
      --bg:     oklch(17% 0.018 265);
      --bg-2:   oklch(14% 0.02 265);
      --panel:  oklch(22% 0.02 265);
      --panel-2:oklch(25% 0.022 265);
      --line:   oklch(32% 0.024 265);
      --line-2: oklch(28% 0.022 265);

      --ok:    oklch(76% 0.15 158);
      --ok-bg: oklch(28% 0.06 158);
      --no:    oklch(72% 0.15 30);
      --no-bg: oklch(28% 0.06 30);

      --shadow-1: 0 1px 2px oklch(0% 0 0 / .5), 0 10px 26px -14px oklch(0% 0 0 / .7);
      --shadow-2: 0 3px 8px oklch(0% 0 0 / .55), 0 28px 58px -24px oklch(0% 0 0 / .85);
    }
  }
  :root[data-theme="dark"] {
    --on-brand: oklch(18% 0.03 265); --on-ok: oklch(18% 0.03 265); --on-no: oklch(18% 0.03 265);
    --brand: oklch(72% 0.15 var(--brand-h)); --brand-lift: oklch(79% 0.13 var(--brand-h));
    --brand-deep: oklch(64% 0.16 var(--brand-h)); --brand-soft: oklch(28% 0.06 var(--brand-h));
    --brand-ink: oklch(84% 0.10 var(--brand-h));
    --ink: oklch(94% 0.012 265); --ink-2: oklch(80% 0.02 265); --ink-3: oklch(64% 0.02 265);
    --bg: oklch(17% 0.018 265); --bg-2: oklch(14% 0.02 265);
    --panel: oklch(22% 0.02 265); --panel-2: oklch(25% 0.022 265);
    --line: oklch(32% 0.024 265); --line-2: oklch(28% 0.022 265);
    --ok: oklch(76% 0.15 158); --ok-bg: oklch(28% 0.06 158);
    --no: oklch(72% 0.15 30); --no-bg: oklch(28% 0.06 30);
    --shadow-1: 0 1px 2px oklch(0% 0 0 / .5), 0 10px 26px -14px oklch(0% 0 0 / .7);
    --shadow-2: 0 3px 8px oklch(0% 0 0 / .55), 0 28px 58px -24px oklch(0% 0 0 / .85);
  }
}

/* -------------------------------------------------------------------- base */
@layer base {
  :root[data-theme="dark"]  { color-scheme: dark }
  :root[data-theme="light"] { color-scheme: light }

  /* 7. The sticky header used to sit on top of every anchor target, including
     the skip link's destination. */
  html { scroll-padding-block-start: 5.5rem }
  main:focus { outline: none }

  *, *::before, *::after { box-sizing: border-box }
  html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scrollbar-gutter: stable }
  @media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto } }

  body {
    margin: 0;
    font-family: var(--sans);
    font-size: var(--step-0);
    line-height: 1.62;
    color: var(--ink);
    background:
      radial-gradient(1100px 620px at 6% -8%, var(--brand-soft), transparent 60%),
      radial-gradient(900px 520px at 96% 4%, color-mix(in oklch, var(--brand-soft) 70%, transparent), transparent 58%),
      linear-gradient(180deg, var(--bg), var(--bg-2));
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  h1, h2, h3, h4 {
    font-family: var(--display);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin: 0 0 0.5em;
    text-wrap: balance;
    font-variation-settings: "SOFT" 0, "WONK" 0;
  }
  h1 { font-size: var(--step-4) }
  h2 { font-size: var(--step-2); margin-top: 2.2em }
  h3 { font-size: var(--step-1) }
  p  { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty }

  a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px }
  a:hover { color: var(--brand-deep) }
  :focus-visible { outline: 2px solid var(--brand); outline-offset: 3px }
  ::selection { background: color-mix(in oklch, var(--brand) 25%, transparent) }

  img, svg { max-width: 100%; height: auto }
  table { border-collapse: collapse }

  /* Cross-document view transitions — a static multi-page site that feels
     like an app, with zero JS. */
  @view-transition { navigation: auto }
  @media (prefers-reduced-motion: reduce) { @view-transition { navigation: none } }
  ::view-transition-old(root) { animation-duration: .18s }
  ::view-transition-new(root) { animation-duration: .22s }
}

/* ------------------------------------------------------------------ layout */
@layer layout {
  /* The page grid. Everything on every page aligns to these two values, so
     the left edge never moves between sections or between pages. Content that
     needs a shorter measure limits its own text, not the container. */
  .wrap {
    width: 100%;
    max-inline-size: var(--page);
    margin-inline: auto;
    padding-inline: var(--gutter);
  }
  .narrow > * { max-inline-size: var(--measure) }
  .narrow > .cards, .narrow > .tiles, .narrow > table { max-inline-size: none }
  .stack > * + * { margin-block-start: var(--gap, 1rem) }
  .row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center }
  .pad-y { padding-block: clamp(32px, 6vw, 68px) clamp(18px, 2.6vw, 30px) }

  header.site {
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: saturate(170%) blur(14px);
    background: color-mix(in oklch, var(--panel) 82%, transparent);
    border-block-end: 1px solid var(--line);
    view-transition-name: siteheader;
  }
  .bar { display: flex; align-items: center; gap: 14px; min-height: 62px; flex-wrap: wrap }

  footer.site {
    margin-block-start: 72px; border-block-start: 1px solid var(--line);
    background: color-mix(in oklch, var(--panel) 70%, transparent);
    padding-block: 30px 46px;
  }
}

/* -------------------------------------------------------------- components */
@layer components {
  /* Blanket rule: the verdict animation, four translate transitions and the
     progress bar were all unguarded. quiz.js gates its scroll behaviour too. */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: .001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: .001ms !important;
      scroll-behavior: auto !important;
    }
  }

  /* brand */
  .brand {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--display); font-weight: 600; font-size: 1.16rem;
    letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
  }
  .brand .mark {
    inline-size: 30px; block-size: 30px; border-radius: 9px; flex: none;
    display: grid; place-items: center; color: var(--on-brand); font-family: var(--sans);
    font-weight: 700; font-size: 15px;
    background: linear-gradient(150deg, var(--brand-lift), var(--brand-deep));
    box-shadow: inset 0 0 0 1px oklch(100% 0 0 / .18);
  }
  .brand small { display: block; font-family: var(--sans); font-size: 10.5px; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3) }

  nav.main { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; font-size: var(--step--1) }
  nav.main a {
    color: var(--ink-2); text-decoration: none; font-weight: 550;
    padding: 7px 11px; border-radius: var(--r-sm);
    &:hover { background: var(--brand-soft); color: var(--brand-ink) }
    &[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink) }
  }

  /* buttons */
  .btn {
    --_bg: var(--brand);
    display: inline-flex; align-items: center; gap: 8px;
    font: inherit; font-weight: 650; font-size: var(--step-0);
    padding: 12px 22px; border: 0; border-radius: var(--r);
    background: var(--_bg); color: var(--on-brand); cursor: pointer;
    text-decoration: none; box-shadow: var(--shadow-1);
    transition: translate .15s ease, box-shadow .15s ease, background .15s ease;
    &:hover { background: var(--brand-lift); translate: 0 -1px; box-shadow: var(--shadow-2) }
    &:active { translate: 0 0 }
    &:disabled { opacity: .5; cursor: default; translate: 0 }
  }
  .btn.ghost {
    background: var(--panel); color: var(--ink-2); border: 1px solid var(--line); box-shadow: none;
    &:hover { background: var(--panel-2); color: var(--brand-ink); border-color: var(--brand) }
  }
  .btn.sm { padding: 8px 15px; font-size: var(--step--1) }

  .kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 11.5px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
    color: var(--brand-ink); background: var(--brand-soft);
    border-radius: var(--r-full); padding: 7px 15px;
  }
  .pill {
    font-size: var(--step--1); font-weight: 600; color: var(--ink-2);
    background: var(--panel-2); border: 1px solid var(--line);
    border-radius: var(--r-full); padding: 5px 13px; white-space: nowrap;
    & b { color: var(--ink); font-variant-numeric: tabular-nums }
  }

  /* hero */
  .hero {
    padding-block: clamp(40px, 7vw, 76px) 8px;
    & > h1 { max-inline-size: 26ch }
    & > .lead { max-inline-size: 58ch }
  }
  .hero h1 span { color: var(--brand) }
  .lead { font-size: var(--step-1); color: var(--ink-2); max-width: 58ch; margin-block: 0 28px }

  /* KPI tiles — big tabular numbers, the reference's strongest idea */
  .kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-block: 4px 0 }
  .kpi {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
    padding: 13px 18px; box-shadow: var(--shadow-1); min-inline-size: 120px;
    & b { display: block; font-family: var(--display); font-size: 1.7rem; font-weight: 600;
          letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums }
    & span { font-size: 11px; font-weight: 650; color: var(--ink-3);
             text-transform: uppercase; letter-spacing: .08em }
    &.accent b { color: var(--brand) }
  }

  /* panels & cards */
  .panel {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-1); padding: clamp(18px, 3vw, 26px);
  }
  .cards {
    list-style: none; padding: 0; margin-block: 24px;
    display: grid; gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  }
  .cards > li > a {
    display: flex; flex-direction: column; gap: 4px; height: 100%;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
    padding: 18px 20px; text-decoration: none; color: var(--ink);
    box-shadow: var(--shadow-1);
    transition: translate .16s ease, border-color .16s ease, box-shadow .16s ease;
    &:hover { border-color: var(--brand); translate: 0 -2px; box-shadow: var(--shadow-2) }
    & h3 { margin: 0; font-size: var(--step-0); letter-spacing: -.01em }
    & .meta { margin: 0; font-size: 12px; font-weight: 600; color: var(--ink-3);
              text-transform: uppercase; letter-spacing: .06em }
    & .note { margin: 6px 0 0; font-size: var(--step--1); color: var(--ink-2) }
  }
  /* :has() — cards that contain a free badge get a subtle accent edge */
  .cards > li > a:has(.free) { border-inline-start: 3px solid var(--ok) }
  .free { color: var(--ok); font-weight: 650 }

  /* progress ring */
  .ring {
    --p: 0;
    inline-size: 92px; block-size: 92px; flex: none; border-radius: 50%;
    display: grid; place-items: center; position: relative;
    background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--line-2) 0);
    &::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel) }
    & b { position: relative; z-index: 1; font-family: var(--display); font-size: 1.35rem;
          font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em }
  }

  /* fact table */
  table.facts {
    inline-size: 100%; max-inline-size: 760px; margin-block: 24px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
    box-shadow: var(--shadow-1);
    & th, & td { text-align: start; padding: 12px 18px; border-block-end: 1px solid var(--line-2);
                 font-size: var(--step--1) }
    & tr:last-child :is(th, td) { border-block-end: 0 }
    & th { color: var(--ink-3); font-weight: 600; inline-size: 42% }
    & td { font-variant-numeric: tabular-nums }
  }

  /* quiz — styles target the light-DOM custom element */
  nv-quiz { display: block; margin-block: 28px }
  .quiz {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg);
    box-shadow: var(--shadow-1); padding: clamp(18px, 3vw, 28px);
    container-type: inline-size;
  }
  .qhead { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap }
  .qprog { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3);
           letter-spacing: .08em; text-transform: uppercase }
  .qbar { block-size: 5px; background: var(--line-2); border-radius: var(--r-full);
          margin-block: 12px 20px; overflow: hidden }
  .qbar > i { display: block; block-size: 100%; border-radius: inherit;
              background: linear-gradient(90deg, var(--brand-lift), var(--brand));
              transition: inline-size .3s cubic-bezier(.4, 0, .2, 1) }
  .qtext { font-family: var(--display); font-size: var(--step-1); font-weight: 600;
           line-height: 1.3; margin: 0 0 18px; letter-spacing: -.015em }

  .opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px }
  @container (min-width: 620px) { .opts { grid-template-columns: 1fr 1fr } }
  .opts button {
    inline-size: 100%; text-align: start; font: inherit; color: var(--ink);
    background: var(--panel-2); border: 1.5px solid var(--line); border-radius: var(--r);
    padding: 14px 16px; cursor: pointer; display: flex; gap: 11px; align-items: flex-start;
    transition: border-color .14s, background .14s, translate .14s;
    &:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-soft); translate: 0 -1px }
    & .k { font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--ink-3);
           background: var(--panel); border: 1px solid var(--line); border-radius: 7px;
           padding: 1px 7px; flex: none }
    &[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft) }
    &[aria-pressed="true"] .k { background: var(--brand); color: var(--on-brand); border-color: transparent }
    &.is-ok { border-color: var(--ok); background: var(--ok-bg) }
    &.is-ok .k { background: var(--ok); color: var(--on-ok); border-color: transparent }
    &.is-no { border-color: var(--no); background: var(--no-bg) }
    &.is-no .k { background: var(--no); color: var(--on-no); border-color: transparent }
    &:disabled { cursor: default }
  }

  .verdict {
    margin-block: 18px 0; padding: 14px 17px; border-radius: var(--r);
    font-size: var(--step--1); font-weight: 550;
    animation: rise .24s ease both;
    &.ok { background: var(--ok-bg); color: var(--ok) }
    &.no { background: var(--no-bg); color: var(--no) }
    & .why { display: block; margin-block-start: 7px; font-weight: 400; color: var(--ink-2) }
  }
  @keyframes rise { from { opacity: 0; translate: 0 6px } to { opacity: 1; translate: 0 0 } }

  .qfoot { margin-block-start: 20px; display: flex; gap: 10px; flex-wrap: wrap }

  .score { text-align: center; padding-block: 10px }
  .score .ring { margin-inline: auto; inline-size: 124px; block-size: 124px;
                 & b { font-size: 1.8rem } }
  .score .lbl { color: var(--ink-2); margin-block-start: 12px }
  .score .flag { display: inline-block; margin-block-start: 14px; padding: 7px 20px;
                 border-radius: var(--r-full); font-weight: 650;
                 &.ok { background: var(--ok-bg); color: var(--ok) }
                 &.no { background: var(--no-bg); color: var(--no) } }

  .note-strip {
    font-size: var(--step--1); color: var(--ink-2); background: var(--panel-2);
    border: 1px solid var(--line); border-inline-start: 3px solid var(--warn);
    border-radius: var(--r-sm); padding: 11px 15px; margin-block: 0 18px;
  }

  /* state / level grids */
  .tiles { list-style: none; padding: 0; margin-block: 22px; display: grid; gap: 9px;
           grid-template-columns: repeat(auto-fill, minmax(min(100%, 195px), 1fr)) }
  .tiles a {
    display: block; padding: 12px 15px; background: var(--panel);
    border: 1px solid var(--line); border-radius: var(--r-sm);
    text-decoration: none; color: var(--ink); font-size: var(--step--1); font-weight: 550;
    transition: border-color .14s, background .14s;
    &:hover { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink) }
  }

  /* language switcher — Popover API, no JS */
  .langs { position: relative }
  .langbtn {
    font: inherit; font-size: var(--step--1); font-weight: 600; cursor: pointer;
    color: var(--ink-2); background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--r-sm); padding: 7px 13px;
    anchor-name: --langbtn;
    &:hover { border-color: var(--brand); color: var(--brand-ink) }
  }
  [popover].langmenu:popover-open {
    margin: 0; inset: auto; border: 1px solid var(--line); border-radius: var(--r);
    background: var(--panel); box-shadow: var(--shadow-2); padding: 7px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; min-inline-size: 270px;
    position-anchor: --langbtn;
    position-area: block-end span-inline-start;
    position-try-fallbacks: block-end span-inline-end, block-start span-inline-start;
    margin-block-start: 6px;
    & a { padding: 7px 11px; border-radius: 7px; text-decoration: none; color: var(--ink-2);
          font-size: var(--step--1); white-space: nowrap;
          &:hover { background: var(--brand-soft); color: var(--brand-ink) }
          &[aria-current] { font-weight: 650; color: var(--ink); background: var(--panel-2) } }
  }
  /* fallback for engines without anchor positioning */
  @supports not (position-area: block-end) {
    [popover].langmenu:popover-open { position: fixed; inset-block-start: 64px; inset-inline-end: 16px }
  }

  /* prose blocks for module/content pages */
  .prose {
    max-inline-size: var(--measure);
    & :is(h2, h3) { margin-block-start: 1.8em }
    & ul, & ol { padding-inline-start: 1.3em; & li { margin-block-end: .45em } }
    & blockquote { margin: 1.4em 0; padding-inline-start: 18px;
                   border-inline-start: 3px solid var(--brand); color: var(--ink-2); font-style: italic }
    & code { font-family: var(--mono); font-size: .92em; background: var(--panel-2);
             border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px }
  }

  .disclaim { font-size: 12.5px; color: var(--ink-3); max-width: 82ch; margin-block: 0 8px }
  .fine { font-size: 12.5px; color: var(--ink-3); margin: 0 }

  .skip { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%);
    &:focus { position: fixed; inset-block-start: 10px; inset-inline-start: 10px; inline-size: auto;
              block-size: auto; clip-path: none; z-index: 99; background: var(--panel);
              padding: 10px 16px; border: 2px solid var(--brand); border-radius: var(--r-sm) } }

  /* reveal on scroll, driven by the scroll timeline — no observer, no JS */
  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .reveal {
        animation: reveal linear both;
        animation-timeline: view();
        animation-range: entry 8% cover 22%;
      }
      @keyframes reveal { from { opacity: 0; translate: 0 14px } to { opacity: 1; translate: 0 0 } }
    }
  }
}

/* --------------------------------------------------------------- utilities */
@layer utilities {
  /* Consent prompt. Docked to the bottom, above the page but never covering
     the whole viewport — it is a question, not a wall. */
  .consent {
    position: fixed; inset-block-end: 0; inset-inline: 0; z-index: 80;
    background: var(--panel); border-block-start: 1px solid var(--line);
    box-shadow: var(--shadow-2);
    padding-block: 14px;
    animation: rise .2s ease-out;
  }
  .consent-in {
    display: flex; gap: 18px; align-items: center; justify-content: space-between;
    flex-wrap: wrap;
  }
  .consent p { margin: 0; max-inline-size: 70ch }
  .consent .note { font-size: var(--step--1); color: var(--ink-2) }
  .btn.ghost {
    background: transparent; color: var(--ink-2);
    border: 1px solid var(--line);
  }
  @media (prefers-reduced-motion: reduce) { .consent { animation: none } }


  nav.main { flex: 1 1 auto; min-inline-size: max-content }
  @media (width < 560px) {
    nav.main { flex-basis: 100%; order: 3; min-inline-size: 0;
      justify-content: flex-start; gap: 14px; font-size: 14px }
    .bar { row-gap: 6px }
  }

  /* RTL: the progress fill and the result ring are direction-blind. */
  [dir="rtl"] .ring { scale: -1 1 }
  [dir="rtl"] .ring > b { scale: -1 1 }
  .pill, .qprog { unicode-bidi: isolate }

  /* The back-links were 22px tall — under WCAG 2.2 SC 2.5.8 and not inside a
     sentence, so the inline exception does not apply. */
  .wrap > p > a[href]:only-child { display: inline-block; padding-block: 4px }

  /* The reference question list stays in the DOM for crawlers and no-JS
     readers; it is a <details> so it costs no layout when closed. */
  .q-all > summary { cursor: pointer }
  .q-all > summary > h2 { display: inline; font-size: 1.05rem }

  .sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%) }
  .center { text-align: center }
  .mt0 { margin-block-start: 0 }
  [hidden] { display: none !important }
}
