/* zoobc.dev — one stylesheet, system fonts, light and dark themes.
   Colours from the ZooBC logo (cyan #00A6D5 → #0086C2, magenta #A73C8D → #822E86, ink #2A2B2A) and zoobc.com. */

/* ---- tokens ------------------------------------------------------------------------------------------------- */
:root {
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
  --radius: 10px;
  --radius-s: 6px;
  --header-h: 60px;
  --measure: 46rem;

  --bg: #f6f8f9;
  --surface: #ffffff;
  --surface-2: #eff3f5;
  --surface-3: #e6ecef;
  --ink: #0f1a21;
  --ink-2: #26343d;
  --muted: #56666f;
  --line: #dce4e9;
  --line-2: #c5d1d8;
  --accent: #07739c;
  --accent-ink: #ffffff;
  --accent-soft: #e3f3f9;
  --accent-line: #a9d8ea;
  --magenta: #9e2f86;
  --magenta-soft: #f7e9f3;
  --magenta-line: #e5bcd9;
  --ok: #146c43;
  --ok-soft: #e2f4ea;
  --bad: #b42318;
  --bad-soft: #fdecea;
  --warn: #8a4b00;
  --warn-soft: #fff5e3;
  --warn-line: #ecc379;
  --code-bg: #eef2f5;
  --mark: #ffe28a;
  --shadow: 0 1px 2px rgba(15, 26, 33, .05), 0 4px 14px rgba(15, 26, 33, .06);
  --focus: #1b8fd0;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1419; --surface: #0f1c23; --surface-2: #14242d; --surface-3: #1a2d38;
    --ink: #e7eef2; --ink-2: #cbd6dc; --muted: #93a6b0; --line: #20333f; --line-2: #2c4352;
    --accent: #52c3ef; --accent-ink: #062330; --accent-soft: #0f2d3b; --accent-line: #1d5670;
    --magenta: #e683cf; --magenta-soft: #2c1528; --magenta-line: #5b2b52;
    --ok: #57d49b; --ok-soft: #0f2e22; --bad: #ff8f80; --bad-soft: #3a1714;
    --warn: #ffc56e; --warn-soft: #2a2012; --warn-line: #7a5a20;
    --code-bg: #15252f; --mark: #7a5c00; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25); --focus: #6ccff6;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1419; --surface: #0f1c23; --surface-2: #14242d; --surface-3: #1a2d38;
  --ink: #e7eef2; --ink-2: #cbd6dc; --muted: #93a6b0; --line: #20333f; --line-2: #2c4352;
  --accent: #52c3ef; --accent-ink: #062330; --accent-soft: #0f2d3b; --accent-line: #1d5670;
  --magenta: #e683cf; --magenta-soft: #2c1528; --magenta-line: #5b2b52;
  --ok: #57d49b; --ok-soft: #0f2e22; --bad: #ff8f80; --bad-soft: #3a1714;
  --warn: #ffc56e; --warn-soft: #2a2012; --warn-line: #7a5a20;
  --code-bg: #15252f; --mark: #7a5c00; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25); --focus: #6ccff6;
  color-scheme: dark;
}

/* ---- base --------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink-2); font: 16px/1.65 var(--sans); overflow-wrap: break-word; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { color: var(--ink); line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.4rem); margin: .2em 0 .35em; letter-spacing: -.02em; }
h2 { font-size: 1.45rem; margin: 2.4rem 0 .8rem; }
h3 { font-size: 1.15rem; margin: 1.8rem 0 .6rem; }
h4 { font-size: 1rem; margin: 1.4rem 0 .5rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
ul, ol { padding-left: 1.4rem; }
li { margin: .2rem 0; }
li > ul, li > ol { margin: .3rem 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.6rem 0 0; }
strong { color: var(--ink); font-weight: 650; }
code, kbd, pre { font-family: var(--mono); font-size: .875em; }
code { background: var(--code-bg); border-radius: 4px; padding: .08em .32em; overflow-wrap: anywhere; color: var(--ink); }
code.hex, code.long { word-break: break-all; }
pre { margin: 0; line-height: 1.5; }
pre code { background: none; padding: 0; }
kbd { border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; font-size: .75em; color: var(--muted); background: var(--surface); }
mark { background: var(--mark); color: inherit; border-radius: 2px; padding: 0 .05em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: .5rem .9rem; border-radius: var(--radius-s); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: 10px; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- buttons ------------------------------------------------------------------------------------------------ */
.btn { display: inline-flex; align-items: center; gap: .45rem; font: 600 .9rem/1.2 var(--sans); padding: .55rem .9rem; border-radius: var(--radius-s); border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { color: var(--accent-ink); filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn-ghost:hover { background: var(--accent-soft); border-color: transparent; }
.btn-lg { font-size: 1rem; padding: .75rem 1.15rem; }
.btn-note { font-weight: 400; font-size: .8rem; opacity: .8; }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-s); border: 1px solid transparent; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---- header ------------------------------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.hdr { height: var(--header-h); display: flex; align-items: center; gap: 1.2rem; padding: 0 clamp(12px, 2.5vw, 28px); max-width: 1600px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); flex: none; }
.brand img { width: 30px; height: 30px; }
.brand-name { font-weight: 700; font-size: 1.12rem; letter-spacing: -.01em; }
.brand-tld { color: var(--accent); }
.site-nav ul { display: flex; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.site-nav li { margin: 0; }
.site-nav a { display: block; padding: .45rem .7rem; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-weight: 550; font-size: .93rem; }
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.hdr-tools { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.search-btn { display: inline-flex; align-items: center; gap: .5rem; min-width: 13rem; padding: .45rem .6rem; border: 1px solid var(--line-2); border-radius: var(--radius-s); background: var(--surface); color: var(--muted); font: .9rem var(--sans); cursor: pointer; }
.search-btn:hover { border-color: var(--accent); color: var(--ink); }
.search-btn kbd { margin-left: auto; }
.btn-discuss { padding: .45rem .75rem; font-size: .85rem; }
.nav-toggle { display: none; }
.theme-btn .i-moon, .theme-btn .i-auto { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-moon { display: inline; }
:root:not([data-theme]) .theme-btn .i-sun { display: none; }
:root:not([data-theme]) .theme-btn .i-auto { display: inline; }
:root:not([data-theme]) .theme-btn .i-auto-fill { fill: currentColor; }

/* ---- shell and sidebars ------------------------------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 1600px; margin: 0 auto; }
.has-left .shell { grid-template-columns: 17rem minmax(0, 1fr); }
.has-left.has-right .shell { grid-template-columns: 17rem minmax(0, 1fr) 15rem; }
.has-right:not(.has-left) .shell { grid-template-columns: minmax(0, 1fr) 15rem; }
.main { min-width: 0; padding: 2rem clamp(16px, 4vw, 56px) 4rem; outline: none; }
.sidebar { position: sticky; top: var(--header-h); align-self: start; height: calc(100vh - var(--header-h)); overflow-y: auto; overscroll-behavior: contain; }
.sidebar-inner { padding: 1.4rem 1rem 3rem; }
.sidebar-left { border-right: 1px solid var(--line); }
.sidebar-right { border-left: 1px solid var(--line); }
.sb-home { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; margin-bottom: .8rem; border-radius: var(--radius-s); color: var(--ink); text-decoration: none; font-weight: 600; font-size: .92rem; }
.sb-home:hover, .chapters-nav a:hover { background: var(--surface-2); }
.sb-home.is-current { background: var(--accent-soft); color: var(--accent); }
.sb-group { margin: 0 0 1rem; }
.sb-group-title { font: 650 .7rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 .3rem; padding: 0 .6rem; }
.chapters-nav ol { list-style: none; margin: 0; padding: 0; }
.chapters-nav li { margin: 0; }
.chapters-nav li a { display: flex; gap: .55rem; align-items: baseline; padding: .28rem .6rem; border-radius: var(--radius-s); color: var(--ink-2); text-decoration: none; font-size: .88rem; line-height: 1.35; }
.chapters-nav li a.is-current { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sb-num { font: 600 .78rem var(--mono); color: var(--muted); flex: none; }
.is-current .sb-num { color: var(--accent); }
.toc-title { font: 650 .72rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0 0 .5rem; }
.toc ol { list-style: none; margin: 0 0 1rem; padding: 0; border-left: 1px solid var(--line); }
.toc li { margin: 0; }
.toc a { display: block; padding: .2rem .7rem; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: .82rem; line-height: 1.4; }
.toc .toc-l3 a { padding-left: 1.4rem; font-size: .78rem; }
.toc a:hover { color: var(--ink); }
.toc a.is-active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
.toc-extra p { margin: .4rem 0; font-size: .85rem; }
.toc-extra a { display: inline-flex; gap: .45rem; align-items: center; text-decoration: none; }
.mobile-bar { display: none; }
.sidebar-scrim { display: none; }
.toc-inline { display: none; }

/* ---- documents ---------------------------------------------------------------------------------------------- */
.doc { max-width: var(--measure); margin: 0 auto; }
.doc-wide { max-width: 72rem; }
.doc.narrow { max-width: 40rem; }
.chapter, .spec-home, .conformance { max-width: 52rem; }
.crumbs { display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; color: var(--muted); margin-bottom: .6rem; }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.12rem; color: var(--ink-2); }
.eyebrow { font: 650 .78rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--accent); margin: 0 0 .6rem; }
.chapter h1 { margin-top: .6rem; }
.ch-num { font-family: var(--mono); color: var(--accent); font-weight: 650; }
.ch-dash { color: var(--muted); }
.chapter-meta { font-size: .88rem; color: var(--muted); margin: -.2rem 0 .9rem; }
.chapter-scope { font-size: .9rem; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem; }
.scope-label { display: block; font: 650 .7rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin-bottom: .2rem; }
.chapter-tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .2rem; }
.chip { display: inline-flex; align-items: center; gap: .3rem; font: 600 .75rem/1.2 var(--sans); padding: .25rem .55rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--ink-2); background: var(--surface); text-decoration: none; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip svg { width: .95em; height: .95em; }
.chip-level { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }

/* headings with a section number and a copy-link anchor */
.doc h2, .doc h3 { position: relative; scroll-margin-top: calc(var(--header-h) + 16px); }
.doc h2 { padding-top: .2rem; }
.sec-num { font-family: var(--mono); font-weight: 650; color: var(--accent); margin-right: .15em; font-size: .92em; }
.anchor { display: inline-block; width: 1.1em; height: 1.1em; margin-left: .35em; vertical-align: -.1em; opacity: 0; border-radius: 4px; color: var(--muted); text-decoration: none; background: currentColor; -webkit-mask: var(--i-link) center / 80% no-repeat; mask: var(--i-link) center / 80% no-repeat; transition: opacity .12s; }
:root { --i-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M10 14a4.5 4.5 0 0 0 6.4 0l3-3a4.5 4.5 0 0 0-6.4-6.4l-1 1'/%3E%3Cpath d='M14 10a4.5 4.5 0 0 0-6.4 0l-3 3a4.5 4.5 0 0 0 6.4 6.4l1-1'/%3E%3C/svg%3E"); --i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Crect x='8.5' y='8.5' width='11' height='11' rx='2'/%3E%3Cpath d='M15.5 5.5v-.5a1.5 1.5 0 0 0-1.5-1.5H6A1.5 1.5 0 0 0 4.5 5v8A1.5 1.5 0 0 0 6 14.5h.5'/%3E%3C/svg%3E"); --i-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor, h4:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); }
.anchor.is-copied { opacity: 1; color: var(--ok); -webkit-mask-image: var(--i-check); mask-image: var(--i-check); }
@media (hover: none) { .anchor { opacity: .45; } }

/* the eight parts of a mechanism */
.part { border-left: 2px solid var(--line-2); padding: .05rem 0 .05rem 1rem; margin: 1.1rem 0; }
.part > :last-child { margin-bottom: 0; }
.part-label { display: block; font: 700 .7rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .25rem; }
.part-vector { border-left-color: var(--accent); }
.part-vector .part-label { color: var(--accent); }
.part-vector .part-label + strong { display: block; font-weight: 600; font-size: .92rem; color: var(--ink-2); margin: -.1rem 0 .2rem; }
.part-defects { border-left-color: var(--warn-line); }
.part-defects > p > .part-label, .part-defects .part-label { color: var(--warn); }
.part-purpose > p { font-size: 1.02rem; color: var(--ink); }

/* tables and code blocks scroll inside their own box */
.table-wrap, .code-wrap { overflow-x: auto; margin: 1rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible, .code-wrap:focus-visible { outline-offset: 0; }
table { border-collapse: collapse; width: 100%; font-size: .87rem; line-height: 1.5; }
th, td { text-align: left; vertical-align: top; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); color: var(--ink); font-weight: 650; font-size: .8rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td code, th code { font-size: .84em; }
td.nw, th.nw { white-space: nowrap; }
.ta-left { text-align: left; } .ta-center { text-align: center; } .ta-right { text-align: right; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 650; border-top: 1px solid var(--line-2); border-bottom: 0; background: var(--surface-2); }
.code-wrap pre { padding: .9rem 1rem; white-space: pre; }

/* hex values get a copy button */
.copy-btn { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; margin-left: .2em; vertical-align: -.35em; border: 1px solid var(--line-2); border-radius: 5px; background: var(--surface); color: var(--muted); cursor: pointer; padding: 0; }
.copy-btn::before { content: ""; width: 72%; height: 72%; background: currentColor; -webkit-mask: var(--i-copy) center / contain no-repeat; mask: var(--i-copy) center / contain no-repeat; }
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.is-copied { color: var(--ok); border-color: var(--ok); }
.copy-btn.is-copied::before { -webkit-mask-image: var(--i-check); mask-image: var(--i-check); }

/* ⏳ decided, ⚠ DEFECT */
.decided { display: inline-flex; align-items: center; gap: .25em; font: 650 .74em/1.35 var(--sans); padding: .06em .5em; border-radius: 999px; background: var(--magenta-soft); color: var(--magenta); border: 1px solid var(--magenta-line); white-space: nowrap; cursor: help; vertical-align: .08em; }
.decided-mini { padding: .02em .35em; }
h2 .decided, h3 .decided { font-size: .55em; vertical-align: .3em; }
.defect-mark { color: var(--warn); font-weight: 750; white-space: nowrap; }
.warn-mark { color: var(--warn); }
.callout { border: 1px solid var(--line-2); border-radius: var(--radius); padding: .75rem 1rem; margin: 1rem 0; background: var(--surface); }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font: 700 .74rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; margin: 0 0 .4rem; }
.callout-defect { border-color: var(--warn-line); background: var(--warn-soft); }
.callout-defect .callout-title { color: var(--warn); }
.callout-info { border-color: var(--accent-line); background: var(--accent-soft); }
.callout-info .callout-title { color: var(--accent); }
.tooltip { position: fixed; z-index: 90; max-width: min(22rem, calc(100vw - 24px)); padding: .5rem .7rem; border-radius: var(--radius-s); background: var(--ink); color: var(--bg); font: .82rem/1.45 var(--sans); box-shadow: var(--shadow); pointer-events: none; }

.discuss-note { display: flex; gap: .6rem; align-items: flex-start; margin-top: 3rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); font-size: .93rem; }
.discuss-note svg { margin-top: .25rem; color: var(--accent); }
/* cross-references: the chapter number and the section read as one link */
a.xref { text-decoration-color: var(--accent-line); }
a.xref code { color: var(--accent); background: var(--accent-soft); font-weight: 600; }
a.xref:hover code { background: var(--accent-line); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.4rem; }
.pager a { display: flex; flex-direction: column; gap: .2rem; padding: .85rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.pager a:hover { border-color: var(--accent); }
.pager-next { text-align: right; grid-column: 2; align-items: flex-end; }
.pager-dir { display: inline-flex; align-items: center; gap: .3rem; font-size: .8rem; color: var(--muted); }
.pager-name { font-weight: 600; }
.noscript { padding: .8rem 1rem; border: 1px solid var(--warn-line); background: var(--warn-soft); border-radius: var(--radius); }
.source-note, .h-source { color: var(--muted); font-size: .88rem; font-weight: 400; }

/* ---- test cases and widgets ----------------------------------------------------------------------------------- */
.cases { margin: 1.2rem 0 .4rem; padding: .8rem; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.cases-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem 1rem; align-items: baseline; margin: 0 .2rem .6rem; }
.cases-title { display: inline-flex; align-items: center; gap: .45rem; margin: 0; font: 700 .78rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--accent); }
.cases-title a { color: inherit; text-decoration: none; }
.cases-count { margin: 0; font-size: .82rem; color: var(--muted); }
.case-list { display: grid; gap: .45rem; }
.case { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); scroll-margin-top: calc(var(--header-h) + 16px); }
.case[open] { border-color: var(--line-2); box-shadow: var(--shadow); }
.case:target { border-color: var(--accent); }
.case > summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .8rem; padding: .6rem .85rem .6rem 2rem; cursor: pointer; list-style: none; position: relative; border-radius: var(--radius); }
.case > summary::-webkit-details-marker { display: none; }
.case > summary::before { content: ""; position: absolute; left: .85rem; top: 1.02rem; width: .45rem; height: .45rem; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .12s; }
.case[open] > summary::before { transform: rotate(45deg); top: .9rem; }
.case > summary:hover .case-title { color: var(--accent); }
.case-title { font-weight: 600; color: var(--ink); flex: 1 1 18rem; line-height: 1.4; }
.case-meta { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.case-id { font-size: .76rem; color: var(--muted); background: transparent; padding: 0; }
.case-where { font-size: .78rem; color: var(--muted); }
.tag { display: inline-block; font: 650 .68rem/1.3 var(--sans); padding: .1rem .45rem; border-radius: 999px; text-transform: uppercase; letter-spacing: .06em; border: 1px solid var(--line-2); color: var(--muted); }
.tag-valid { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: var(--ok-soft); }
.tag-invalid { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: var(--bad-soft); }
.tag-ref { color: var(--ink-2); background: var(--surface-2); }
.tag-observed { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.case .decided { font-size: .68rem; }
.case-body { padding: .2rem 1rem 1rem; border-top: 1px solid var(--line); }
.case-note, .case-explain { font-size: .9rem; margin: .8rem 0; }
.case-explain { color: var(--muted); }
.case-loading { color: var(--muted); font-size: .9rem; margin: .8rem 0; }
.facts { display: grid; gap: .5rem; margin: .6rem 0 0; }
.fact { display: grid; grid-template-columns: minmax(8rem, 13rem) minmax(0, 1fr); gap: .6rem; align-items: start; }
.fact dt { font: 600 .82rem var(--mono); color: var(--muted); padding-top: .2rem; overflow-wrap: anywhere; }
.fact dd { margin: 0; min-width: 0; }
.val { display: inline; background: var(--code-bg); }
.val-block { display: block; white-space: pre-wrap; padding: .4rem .55rem; word-break: break-all; max-height: 22rem; overflow: auto; }

.w-kind { font-size: .85rem; color: var(--muted); margin: .8rem 0 .6rem; }
.w-kind code { font-size: .82em; }
.w-section-title { font: 700 .72rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 1rem 0 .5rem; }
.w-inputs { border: 0; padding: 0; margin: 0; min-width: 0; }
.w-inputs legend { padding: 0; }
.w-field { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: .3rem .8rem; align-items: start; margin-bottom: .45rem; }
.w-field label { font-size: .85rem; color: var(--ink-2); padding-top: .35rem; line-height: 1.35; }
.w-field .w-name { display: block; font: .74rem var(--mono); color: var(--muted); }
.w-field-note { grid-column: 2; margin: 0; font-size: .8rem; color: var(--muted); }
textarea, select, input[type="search"], input[type="text"] { font: .85rem/1.45 var(--mono); color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); padding: .38rem .55rem; width: 100%; min-width: 0; }
select { font-family: var(--sans); font-size: .9rem; }
textarea { resize: vertical; word-break: break-all; overflow-y: auto; }
textarea:focus, select:focus, input:focus { outline: 2px solid var(--focus); outline-offset: -1px; border-color: transparent; }
textarea.is-edited { border-color: var(--magenta-line); background: var(--magenta-soft); }
.w-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .7rem 0 .2rem; }
.w-status { font-size: .85rem; color: var(--muted); }
.w-results { margin: .8rem 0 0; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.w-row { display: grid; grid-template-columns: minmax(8rem, 12rem) minmax(0, 1fr) minmax(0, 1fr); border-top: 1px solid var(--line); }
.w-row:first-child { border-top: 0; }
.w-row > div { padding: .45rem .65rem; min-width: 0; }
.w-head > div { background: var(--surface-2); font: 650 .72rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.w-label { font-size: .84rem; color: var(--ink-2); }
.w-label .w-name { display: block; font: .72rem var(--mono); color: var(--muted); }
.w-val { font: .8rem/1.5 var(--mono); white-space: pre-wrap; word-break: break-all; color: var(--ink); }
.w-val.is-none { font-family: var(--sans); color: var(--muted); font-style: italic; }
.w-val .copy-btn { font-size: .9rem; }
.w-agree { display: inline-flex; align-items: center; gap: .25rem; margin-top: .25rem; font: 650 .74rem var(--sans); white-space: normal; word-break: normal; }
.w-agree.yes { color: var(--ok); }
.w-agree.no { color: var(--bad); }
.w-agree svg { width: 1em; height: 1em; }
.w-refusal { color: var(--bad); }
.w-cell-label { display: none; }
.w-check { margin-top: 1rem; padding-top: .9rem; border-top: 1px dashed var(--line-2); }
.w-check-grid { display: grid; grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr); gap: .45rem .8rem; align-items: start; }
.w-check-grid label { font-size: .85rem; padding-top: .35rem; }
.w-verdict { margin-top: .7rem; border-radius: var(--radius-s); }
.w-verdict:empty { display: none; }
.w-verdict.ok, .w-verdict.bad, .w-verdict.info { padding: .65rem .8rem; }
.w-verdict.ok { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.w-verdict.bad { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.w-verdict.info { background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.w-verdict-head { font-weight: 750; letter-spacing: .02em; }
.w-verdict-msg { margin-left: .4rem; }
.w-diff { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .7rem; margin-top: .55rem; color: var(--ink-2); font-size: .82rem; }
.w-diff dt { font-weight: 600; }
.w-diff dd { margin: 0; font: .8rem/1.5 var(--mono); word-break: break-all; white-space: pre-wrap; }
.w-diff mark { background: var(--bad); color: #fff; padding: 0 .08em; border-radius: 2px; }
.w-diff .ellipsis { color: var(--muted); }
.w-edited-note { font-size: .82rem; color: var(--magenta); margin: .4rem 0 0; }

/* ---- the Tests page ------------------------------------------------------------------------------------------ */
.downloads { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1.2rem 0 1.4rem; }
.per-chapter { flex-basis: 100%; }
.per-chapter > summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: .9rem; width: max-content; }
.file-list { list-style: none; padding: 0; margin: .7rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .3rem .8rem; }
.file-list li { margin: 0; }
.file-list a { display: flex; gap: .55rem; align-items: baseline; padding: .25rem .4rem; border-radius: var(--radius-s); text-decoration: none; color: var(--ink-2); font-size: .87rem; }
.file-list a:hover { background: var(--surface-2); color: var(--accent); }
.file-list .muted { margin-left: auto; font-size: .8rem; font-variant-numeric: tabular-nums; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: .7rem; align-items: end; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: .8rem; position: sticky; top: calc(var(--header-h) + 8px); z-index: 5; box-shadow: var(--shadow); }
.f-field label { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.f-q { grid-column: span 2; }
.f-field select, .f-field input { font-family: var(--sans); font-size: .9rem; }
.f-reset { display: flex; justify-content: flex-end; }
.result-count { font-size: .9rem; color: var(--muted); margin: .2rem .2rem .7rem; }
.catalogue .case-where a { color: var(--muted); }
.more-wrap { text-align: center; margin-top: 1rem; }

/* ---- search ------------------------------------------------------------------------------------------------- */
.search-dialog { width: min(44rem, calc(100vw - 24px)); max-height: min(36rem, calc(100vh - 80px)); margin: 72px auto auto; padding: 0; border: 1px solid var(--line-2); border-radius: 14px; background: var(--surface); color: var(--ink-2); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.search-dialog::backdrop { background: rgba(8, 16, 22, .45); }
.sd-box { display: flex; flex-direction: column; max-height: inherit; }
.sd-bar { display: flex; align-items: center; gap: .6rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.sd-bar svg { color: var(--muted); width: 20px; height: 20px; }
.sd-bar input { border: 0; padding: .3rem 0; font: 1.05rem var(--sans); background: transparent; }
.sd-bar input:focus { outline: none; }
.sd-close { border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); border-radius: 5px; font: .72rem var(--sans); padding: .2rem .45rem; cursor: pointer; }
.sd-status { font-size: .82rem; color: var(--muted); padding: .5rem 1rem 0; }
.sd-status:empty { display: none; }
.sd-results, .search-results { list-style: none; margin: 0; padding: .4rem; overflow-y: auto; }
.sd-results li, .search-results li { margin: 0; }
.sr-item { display: block; padding: .55rem .7rem; border-radius: 8px; text-decoration: none; color: var(--ink-2); }
.sr-item:hover, .sr-item[aria-selected="true"] { background: var(--accent-soft); }
.sr-ctx { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.sr-title { display: block; font-weight: 650; color: var(--ink); }
.sr-snip { display: block; font-size: .84rem; color: var(--muted); overflow-wrap: anywhere; }
.sd-foot { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 1rem; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.search-form label { display: block; font-weight: 600; margin-bottom: .4rem; }
.search-row { display: flex; gap: .5rem; }
.search-row input { font: 1rem var(--sans); padding: .55rem .7rem; }
.search-results { padding: 0; }
.search-results .sr-item { padding: .8rem .2rem; border-radius: 0; border-bottom: 1px solid var(--line); }

/* ---- home --------------------------------------------------------------------------------------------------- */
.is-home .main { padding-top: 0; }
.home { max-width: 72rem; margin: 0 auto; }
.is-home .shell { overflow-x: clip; }
.hero { position: relative; padding: clamp(2.5rem, 6vw, 5rem) 0 2.5rem; }
.hero::before { content: ""; position: absolute; inset: -2rem -40vw auto; height: 100%; z-index: -1; background: radial-gradient(40rem 22rem at 85% 10%, color-mix(in srgb, #2caeea 16%, transparent), transparent 70%), radial-gradient(34rem 18rem at 8% 70%, color-mix(in srgb, #d447bd 11%, transparent), transparent 70%); pointer-events: none; -webkit-mask-image: linear-gradient(to bottom, #000 60%, transparent); mask-image: linear-gradient(to bottom, #000 60%, transparent); }
.hero h1 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.4rem); max-width: 18ch; margin-bottom: 1rem; }
.hero .lead { max-width: 44rem; font-size: clamp(1.05rem, 1rem + .3vw, 1.22rem); }
.lead-2 { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.6rem 0 2rem; }
.hero-stats { display: flex; flex-wrap: wrap; gap: .8rem 2.6rem; list-style: none; padding: 0; margin: 0; }
.hero-stats li { display: flex; flex-direction: column; margin: 0; }
.hero-stats strong { font-size: 1.7rem; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hero-stats span { font-size: .85rem; color: var(--muted); }
.entry-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1rem 0 2rem; }
.entry-card { display: flex; flex-direction: column; padding: 1.3rem 1.3rem 1.1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink-2); box-shadow: var(--shadow); transition: border-color .12s, transform .12s; }
.entry-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.entry-card h2 { font-size: 1.2rem; margin: .6rem 0 .45rem; }
.entry-card p { font-size: .95rem; flex: 1; }
.entry-icon { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.entry-icon svg { width: 1.3rem; height: 1.3rem; }
.entry-go { display: inline-flex; align-items: center; gap: .35rem; font-weight: 650; color: var(--accent); font-size: .92rem; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1rem; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 1.3rem; }
.panel h2 { font-size: 1.15rem; margin: 0 0 .3rem; }
.panel-sub { color: var(--muted); font-size: .9rem; }
.identity { display: grid; gap: .7rem; margin: 1rem 0; }
.identity dt { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.identity dd { margin: .15rem 0 0; }
.identity code { font-size: .8rem; }
.identity .dt-note { font-weight: 400; text-transform: none; letter-spacing: 0; }
.launch-note { margin: .9rem 0 0; }
.launch-note p:not(.callout-title) { font-size: .88rem; margin: 0; }
.chain { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.chain h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; font-size: 1rem; margin: 0; }
.chain-id { font-weight: 400; font-size: .85rem; color: var(--muted); }
.chain-id code { font-size: .78rem; }
.chain .identity { margin: .6rem 0 0; }
.links-title { font-size: .78rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 1.3rem 0 .4rem; }
.link-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.link-list li { margin: 0; border-bottom: 1px solid var(--line); }
.link-list a { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .2rem; text-decoration: none; font-weight: 600; }
.link-list .muted { font-weight: 400; font-size: .85rem; text-align: right; }
.link-list a > span:first-child { flex: none; }
.steps { padding-left: 1.2rem; }
.steps li { margin: .55rem 0; }
.level-list { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; }
.level-list li { margin: 0; }
.level-list a, .level-card { text-decoration: none; }
.level-list a { display: inline-flex; gap: .4rem; align-items: baseline; padding: .35rem .65rem; border: 1px solid var(--line-2); border-radius: 999px; color: var(--ink-2); font-size: .88rem; }
.level-list a:hover { border-color: var(--accent); }
.lvl-id { font: 700 .85rem var(--mono); color: var(--accent); }
.panel-foot { margin: .8rem 0 0; font-size: .9rem; color: var(--muted); }

/* ---- conformance, sandbox, licence ------------------------------------------------------------------------- */
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(11.5rem, 1fr)); gap: .8rem; }
.level-card { display: flex; flex-direction: column; gap: .3rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink-2); }
.level-card:hover { border-color: var(--accent); }
.level-card .lvl-id { font-size: 1.1rem; }
.lvl-name { font-weight: 700; color: var(--ink); }
.lvl-can { font-size: .86rem; }
.lvl-n { font-size: .78rem; color: var(--muted); margin-top: auto; }
.level { margin-top: 3rem; padding-top: .5rem; border-top: 1px solid var(--line); }
.level-can { font-size: 1.02rem; }
.level-body { font-size: .97rem; }
.pill { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; }
.pill-soon { background: var(--magenta-soft); color: var(--magenta); border: 1px solid var(--magenta-line); }
.feature-list li { margin: .5rem 0; }
.licence-text { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 1rem 1.2rem; }
.licence-text pre { white-space: pre-wrap; font-size: .82rem; line-height: 1.55; }

/* ---- footer ------------------------------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.ftr { max-width: 1600px; margin: 0 auto; padding: 2.4rem clamp(16px, 4vw, 56px) 1.4rem; display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 2rem; }
.ftr-brand p { font-size: .9rem; color: var(--muted); max-width: 26rem; margin: .7rem 0; }
.ftr-col h2 { font: 650 .72rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: .4rem 0 .6rem; }
.ftr-col ul { list-style: none; padding: 0; margin: 0; }
.ftr-col li { margin: .3rem 0; }
.ftr-col a { color: var(--ink-2); text-decoration: none; font-size: .92rem; }
.ftr-col a:hover { color: var(--accent); text-decoration: underline; }
.ftr-legal { max-width: 1600px; margin: 0 auto; padding: 1rem clamp(16px, 4vw, 56px) 2rem; border-top: 1px solid var(--line); font-size: .84rem; color: var(--muted); }
.ftr-legal p { margin: 0; }

/* ---- responsive ----------------------------------------------------------------------------------------------- */
@media (max-width: 1280px) {
  .has-left.has-right .shell { grid-template-columns: 16rem minmax(0, 1fr); }
  .has-right:not(.has-left) .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar-right { display: none; }
  .toc-inline { display: block; margin: .4rem 0 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
  .toc-inline > summary { padding: .55rem .85rem; cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--ink); }
  .toc-inline ol { list-style: none; margin: 0; padding: .2rem .85rem .8rem; max-height: 50vh; overflow: auto; }
  .toc-inline li { margin: .15rem 0; font-size: .88rem; }
  .toc-inline .toc-l3 { padding-left: 1rem; font-size: .84rem; }
  .toc-inline a { text-decoration: none; }
}
@media (max-width: 1100px) {
  .search-btn { min-width: 0; }
  .search-btn .search-btn-text, .search-btn kbd { display: none; }
  .hdr .btn-discuss span { display: none; }
  .hdr .btn-discuss { padding: .5rem; }
}
@media (max-width: 1023px) {
  .has-left .shell, .has-left.has-right .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar-left { position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; height: 100vh; width: min(20rem, 86vw); background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow); transform: translateX(-102%); transition: transform .18s ease-out; visibility: hidden; }
  .sidebar-left.is-open { transform: none; visibility: visible; }
  .sidebar-scrim:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 16, 22, .4); }
  .mobile-bar { display: flex; gap: .5rem; margin: -1rem 0 1rem; }
  .mobile-bar .btn { padding-left: .4rem; }
  .nav-toggle { display: inline-grid; }
  .site-nav { position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); display: none; }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; padding: .5rem; }
  .site-nav a { padding: .7rem .8rem; }
  .hdr { gap: .6rem; }
  .ftr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ftr-brand { grid-column: 1 / -1; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .main { padding: 1.4rem 16px 3rem; }
  .brand-name { font-size: 1rem; }
  .hdr-tools { gap: .3rem; }
  h2 { font-size: 1.28rem; }
  .part { padding-left: .75rem; }
  table { font-size: .82rem; min-width: 34rem; }
  th, td { padding: .42rem .55rem; }
  .w-field, .w-check-grid, .fact { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .w-field label, .w-check-grid label { padding-top: 0; }
  .w-field-note { grid-column: 1; }
  .w-head { display: none !important; }
  .w-row { grid-template-columns: minmax(0, 1fr); padding: .2rem 0; }
  .w-row > div { padding: .3rem .65rem; }
  .w-cell-label { display: block; font: 650 .68rem/1.3 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: .1rem; }
  .case > summary { padding-left: 1.9rem; }
  .cases { padding: .55rem; margin-left: -.4rem; margin-right: -.4rem; }
  .case-body { padding: .1rem .7rem .8rem; }
  .filters { position: static; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: .8rem; }
  .f-q { grid-column: 1 / -1; }
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager-next { grid-column: 1; }
  .ftr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .search-dialog { margin-top: 12px; max-height: calc(100vh - 24px); }
  .sd-foot span { display: none; }
  .link-list a { flex-direction: column; gap: 0; }
  .link-list .muted { text-align: left; }
  .search-row { flex-direction: column; }
}
@media print {
  .site-header, .sidebar, .site-footer, .mobile-bar, .toc-inline, .pager, .cases, .search-dialog { display: none !important; }
  .has-left .shell, .has-left.has-right .shell { grid-template-columns: 1fr; }
  .part, .table-wrap { break-inside: avoid; }
}
