/* Book B stylesheet. The page is the website's legal-page chrome (tokens.css,
   styles.css, legal.css — loaded from lagstyr-web, unstamped, revalidated on
   every request) plus what mdBook output introduces and long-form legal prose
   never needed: a first-level heading inside the article, fenced code, images,
   definition lists, nested lists, the contents rail's current-chapter mark,
   and the chapter pager. This file loads last so its rules win.

   The `fallback` layer below is a mirror of lagstyr-web/public/tokens.css as
   of 2026-09-12. Layered rules lose to unlayered ones, so whenever the site's
   own tokens.css is present it wins outright; the mirror only applies when the
   book is rendered without the site (the repository's own accessibility and
   conformance runs), and it exists so those runs measure real colours and a
   real focus ring rather than browser defaults. */
@layer fallback {
  :root {
    color-scheme: dark;
    --void: #07080f; --void-2: #090b15; --substrate: #0d1020; --substrate-2: #12162a;
    --spine: #1b2036; --spine-2: #2a3050;
    --ink: #eceef7; --ink-dim: #c6cadb; --mist: #8b90a8; --mist-2: #79809e;
    --indigo: #7c8cff; --indigo-bright: #9aa6ff; --indigo-deep: #4b59cf;
    --font-display: system-ui, sans-serif; --font-body: system-ui, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
    --t-h3: 1.2rem; --t-mono: 0.78rem; --t-small: 0.875rem;
    --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-9: 96px;
    --radius: 14px; --radius-sm: 9px; --maxw: 1160px; --gutter: clamp(20px, 5vw, 56px);
    --ease: ease;
  }
  body { margin: 0; background: var(--void); color: var(--ink); font: 1.0625rem/1.6 var(--font-body); }
  a { color: var(--indigo-bright); }
  .skip-link { position: absolute; left: 1rem; top: -3rem; }
  .skip-link:focus { top: 1rem; }
  .shell { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
  .legal-grid { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--s-7); }
  .legal-toc ol { list-style: none; padding: 0; }
  .legal-toc a { display: block; padding: 7px 0 7px 14px; color: var(--mist); text-decoration: none; }
  .prose { max-width: 76ch; }
  .prose > * + * { margin-top: var(--s-5); }
  .foot, .nav { padding: var(--s-5) 0; border-block: 1px solid var(--spine); }
  /* The footer links are emitted with no whitespace between them, so as
     inline boxes they form one unbreakable run; the site lays them out as a
     wrapping flex row, and so must the fallback. */
  .foot-links { display: flex; flex-wrap: wrap; gap: var(--s-5); }
  /* The site's legal.css collapses the rail below 960px; the fallback must
     too, or the repository's own 320px reflow audit measures a layout the
     site never ships. */
  @media (max-width: 960px) { .legal-grid { grid-template-columns: minmax(0, 1fr); } }
}

/* Focus is always visible, and at least 2px wide: the accessibility harness
   measures outline width, and the site's ring is a box-shadow. */
a:focus-visible, button:focus-visible { outline: 3px solid var(--indigo); outline-offset: 2px; }

/* contents rail: mdBook's list, in the site's rail */
.legal-toc ol ol { padding-left: var(--s-4); }
.legal-toc a[aria-current="page"] { color: var(--ink); border-left-color: var(--indigo); }
.legal-toc .part-title { font-family: var(--font-mono); font-size: var(--t-mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mist); margin: var(--s-5) 0 var(--s-2); padding-left: 14px; list-style: none; border-left: 0; }
.legal-toc .part-title:first-child { margin-top: 0; }
.legal-toc .chapter-item strong[aria-hidden] { display: none; }

/* the article: mdBook puts the title inside the content */
.book-prose .eyebrow { margin-bottom: var(--s-4); }
.book-prose h1 { font-family: var(--font-display); font-size: clamp(2rem, 3.6vw, 2.9rem); line-height: 1.1; letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.book-prose h1 a.header, .book-prose h2 a.header, .book-prose h3 a.header { color: inherit; border-bottom: 0; text-decoration: none; }
.book-prose h2 a.header:hover::after, .book-prose h3 a.header:hover::after { content: " #"; color: var(--indigo); font-family: var(--font-mono); font-size: 0.7em; }
.book-prose h4 { font-size: 1.05rem; color: var(--ink); margin-top: var(--s-6); }
.book-prose ul ul, .book-prose ol ol, .book-prose ul ol, .book-prose ol ul { margin-top: var(--s-3); }
.book-prose pre { margin: 0; padding: var(--s-4) var(--s-5); overflow-x: auto; background: var(--substrate); border: 1px solid var(--spine); border-radius: var(--radius-sm); }
.book-prose pre code { background: transparent; border: 0; padding: 0; color: var(--ink-dim); font-size: 0.85rem; }
.book-prose img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.book-prose .table-wrapper { border: 1px solid var(--spine); border-radius: var(--radius); overflow-x: auto; background: var(--spine); }
.book-prose dl.glossary { margin: 0; }
.book-prose dl.glossary dt { color: var(--ink); font-weight: 600; margin-top: var(--s-5); scroll-margin-top: 88px; }
.book-prose dl.glossary dd { margin: var(--s-2) 0 0; color: var(--ink-dim); }

/* the pager */
.book-pager { display: flex; justify-content: space-between; gap: var(--s-4); margin-top: var(--s-9); padding-top: var(--s-6); border-top: 1px solid var(--spine); }
.book-pager a { border-bottom: 0; }
.book-pager a[rel="next"] { margin-left: auto; }

/* Reflow at 320px (WCAG 1.4.10): legal.css collapses the grid to `1fr` below
   960px, and a `1fr` track has an auto minimum, so a table's min-width would
   widen the column past the viewport instead of scrolling inside its wrapper. */
@media (max-width: 960px) { .legal-grid { grid-template-columns: minmax(0, 1fr); } .book-prose { min-width: 0; } }
@media (max-width: 680px) { .book-pager { flex-direction: column; } .book-pager a[rel="next"] { margin-left: 0; } }
@media print { .book-pager, .book-prose .eyebrow { display: none !important; } }
