@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 300 700;
  font-stretch: 100%;
  font-display: swap;
  src: url("/assets/fonts/bricolage-grotesque-300-700.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Doto';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("/assets/fonts/doto-900.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/ibm-plex-mono-600.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400-italic.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/instrument-serif-400.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("/assets/fonts/inter-300-600.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* =========================================================
   Lawful / Blueprint — line-drawn field guide to UK law
   ========================================================= */

/* ---------- Tokens (dark is the default sheet) ---------- */
:root {
  --ink-rgb: 236, 240, 248;
  --acc-rgb: 255, 106, 43;
  --acc2-rgb: 90, 184, 255;
  --bg: #070a12;
  --bg-2: #0b0f18;
  --surface: #0a0e17;
  --panel: #0f1420;
  --ink: #eef1f7;
  --ink-2: rgba(var(--ink-rgb), 0.8);
  --dim: rgba(var(--ink-rgb), 0.62);
  --faint: rgba(var(--ink-rgb), 0.2);
  --hair: rgba(var(--ink-rgb), 0.09);
  --accent: #ff6a2b;
  --accent-dim: rgba(var(--acc-rgb), 0.15);
  --acc2: #5ab8ff;
  --acc2-dim: rgba(var(--acc2-rgb), 0.14);
  --on-accent: #0a0b0e;
  --glass: rgba(10, 14, 23, 0.72);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 18px 50px -24px rgba(0, 0, 0, 0.7);
  --blue: #5aa9ff;
  --green: #3ddc97;
  --amber: #ffb547;
  --red: #ff6b6b;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --dot: "Doto", "IBM Plex Mono", monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --display: "Bricolage Grotesque", "Inter", system-ui, sans-serif;
  --r: 10px;
  --r-sm: 8px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --header: 60px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --ink-rgb: 20, 26, 42;
    --acc-rgb: 217, 74, 18;
    --acc2-rgb: 31, 99, 196;
    --bg: #f3f1ea;
    --bg-2: #ebe8df;
    --surface: #f6f4ee;
    --panel: #ebe7dd;
    --ink: #141a2a;
    --ink-2: rgba(var(--ink-rgb), 0.84);
    --dim: rgba(var(--ink-rgb), 0.66);
    --faint: rgba(var(--ink-rgb), 0.24);
    --hair: rgba(var(--ink-rgb), 0.1);
    --accent: #d94a12;
    --accent-dim: rgba(var(--acc-rgb), 0.12);
    --acc2: #1f63c4;
    --acc2-dim: rgba(var(--acc2-rgb), 0.1);
    --on-accent: #fff;
    --glass: rgba(246, 244, 238, 0.72);
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -26px rgba(20, 26, 42, 0.35);
    --blue: #1f5fbf;
    --green: #0e8c52;
    --amber: #a86400;
    --red: #c8102e;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --ink-rgb: 20, 26, 42;
  --acc-rgb: 217, 74, 18;
  --acc2-rgb: 31, 99, 196;
  --bg: #f3f1ea;
  --bg-2: #ebe8df;
  --surface: #f6f4ee;
  --panel: #ebe7dd;
  --ink: #141a2a;
  --ink-2: rgba(var(--ink-rgb), 0.84);
  --dim: rgba(var(--ink-rgb), 0.66);
  --faint: rgba(var(--ink-rgb), 0.24);
  --hair: rgba(var(--ink-rgb), 0.1);
  --accent: #d94a12;
  --accent-dim: rgba(var(--acc-rgb), 0.12);
  --acc2: #1f63c4;
  --acc2-dim: rgba(var(--acc2-rgb), 0.1);
  --on-accent: #fff;
  --glass: rgba(246, 244, 238, 0.72);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -26px rgba(20, 26, 42, 0.35);
  --blue: #1f5fbf;
  --green: #0e8c52;
  --amber: #a86400;
  --red: #c8102e;
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header) + 64px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px);
  background-size: 96px 96px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 75%);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 0%, transparent 75%);
  opacity: 0.7;
  z-index: 0;
}
body.locked { overflow: hidden; }
main, .site-footer { position: relative; z-index: 1; }
.theme-anim, .theme-anim * { transition: background-color 0.4s, color 0.4s, border-color 0.4s, fill 0.4s, stroke 0.4s !important; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 400; letter-spacing: -0.02em; line-height: 1.08; }
p { margin: 0; }
a { color: inherit; }
strong { font-weight: 600; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { width: min(1280px, 100% - 32px); margin-inline: auto; }
.acc { color: var(--accent); }
.muted { color: var(--dim); }
.tx { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 400; color: var(--dim); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 12px; z-index: 200; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

.eyebrow { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 18px; }
.h2 { font-size: clamp(2rem, 5vw, 3.6rem); font-weight: 300; letter-spacing: -0.035em; margin-bottom: 16px; }
.section { padding: 112px 0; position: relative; }
.section-head { max-width: 760px; margin-bottom: 48px; }
.section-head .muted { font-size: 1.05rem; max-width: 640px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 20px; font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; border: 1px solid var(--faint); background: transparent; transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s; }
.btn:hover { transform: translateY(-1px); border-color: var(--ink); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn.primary:hover { background: transparent; color: var(--accent); }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 60; height: var(--header); border-bottom: 1px solid var(--hair); }
.site-header::before { content: ""; position: absolute; inset: 0; background: var(--bg); opacity: 0.97; z-index: -1; }
.header-inner { display: flex; align-items: center; gap: 20px; height: 100%; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-weight: 600; font-size: 0.92rem; letter-spacing: 0.12em; text-decoration: none; white-space: nowrap; }
.logo-mark { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.rev { white-space: nowrap; }
.main-nav { display: flex; margin-left: auto; }
.main-nav a { font-size: 0.86rem; font-weight: 400; color: var(--dim); text-decoration: none; padding: 8px 10px; display: inline-flex; gap: 6px; align-items: baseline; transition: color 0.2s; }
.main-nav a:hover { color: var(--ink); }
.main-nav a { white-space: nowrap; }
@media (max-width: 1560px) { .rev { display: none; } }
@media (max-width: 1320px) { .main-nav .tab-n { display: none; } .main-nav a { padding: 8px 8px; } }
.tab-n { font-family: var(--mono); font-size: 0.68rem; color: var(--accent); letter-spacing: 0.04em; }
.header-actions { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--hair); background: transparent; transition: border-color 0.2s; }
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.icon-btn .sun { display: none; }
:root[data-theme="light"] .icon-btn .sun { display: block; }
:root[data-theme="light"] .icon-btn .moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .sun { display: block; }
  :root:not([data-theme="dark"]) .icon-btn .moon { display: none; }
}
.burger { display: none; gap: 4px; align-content: center; }
.burger span { display: block; width: 16px; height: 1.5px; background: currentColor; }
@media (max-width: 1180px) { .rev { display: none; } }
@media (max-width: 1060px) {
  .main-nav { display: none; }
  .burger { display: grid; }
  .header-actions { margin-left: auto; }
}

/* ---------- Burger menu ---------- */
.menu { position: fixed; inset: 0; z-index: 120; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s; }
.menu.open { opacity: 1; }
.menu-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); border-left: 1px solid var(--faint); display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.3s var(--ease); background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px); background-size: 32px 32px; }
.menu.open .menu-panel { transform: none; }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--hair); background: var(--bg); }
.menu-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.menu-nav a { display: flex; gap: 14px; align-items: baseline; padding: 13px 20px; text-decoration: none; font-size: 1.1rem; border-bottom: 1px solid var(--hair); background: var(--bg); }
.menu-nav a:hover, .menu-nav a:focus-visible { color: var(--accent); }
.menu-sub { border-bottom: 1px solid var(--hair); background: var(--bg); padding: 4px 0 8px; }
.menu-sub a { font-size: 0.95rem; padding: 8px 20px 8px 44px; border: 0; color: var(--ink-2); }
.menu-foot { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--hair); background: var(--bg); }
.menu-foot .btn { flex: 1; justify-content: center; }

/* ---------- Hero ---------- */
.hero { padding: 72px 0 0; }
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 48px; align-items: end; }
.hero h1 { font-size: clamp(2.8rem, 7.4vw, 6.4rem); font-weight: 300; letter-spacing: -0.05em; line-height: 0.98; }
.lede { font-size: 1.1rem; color: var(--ink-2); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); margin: 56px 0 40px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.stats div { padding: 22px 20px 20px 0; border-right: 1px solid var(--hair); }
.stats div + div { padding-left: 20px; }
.stats div:last-child { border-right: 0; }
.stats dt { font-family: var(--dot); font-weight: 900; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1; color: var(--ink); }
.stats div:first-child dt { color: var(--accent); }
.stats dd { margin: 10px 0 0; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
@media (max-width: 900px) {
  .hero { padding-top: 44px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(3) { padding-left: 0; }
  .stats div:nth-child(n + 3) { border-top: 1px solid var(--hair); }
}

/* ---------- Blueprint panel ---------- */
.blueprint { border: 1px solid var(--faint); background: var(--surface); position: relative; }
.bp-bar { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--hair); }
.bp-canvas { overflow-x: auto; overflow-y: hidden; background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px); background-size: 24px 24px; scrollbar-width: thin; scrollbar-color: var(--faint) transparent; }
.judi { display: block; width: 100%; min-width: 1100px; height: auto; padding: 18px 12px 8px; }
.bp-hint { display: none; justify-content: center; padding: 6px; border-top: 1px solid var(--hair); }
.bp-hint span { animation: nudge 2.4s ease-in-out infinite; }
.bp-hint.gone { display: none !important; }
@keyframes nudge { 50% { transform: translateX(6px); } }
@media (max-width: 1150px) { .bp-hint { display: flex; } .hide-sm { display: none; } }
.bp-info { display: grid; grid-template-columns: minmax(220px, 0.8fr) 1.4fr; gap: 8px 32px; padding: 22px 20px; border-top: 1px solid var(--faint); background: var(--panel); }
.bp-info-head h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 300; margin-top: 6px; }
.bp-info p:not(.tx) { color: var(--ink-2); }
#jiLinks { grid-column: 2; display: flex; flex-direction: column; gap: 4px; }
#jiLinks b { color: var(--accent); font-weight: 500; }
.bp-legend { display: flex; flex-wrap: wrap; gap: 8px 24px; padding: 12px 20px; border-top: 1px solid var(--hair); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.bp-legend span { display: inline-flex; align-items: center; gap: 8px; }
.lg { display: inline-block; width: 22px; height: 0; border-top: 1.5px solid var(--ink); }
.lg-dash { border-top-style: dashed; border-color: var(--dim); }
.lg-dot { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--accent); }
.lg-acc { width: 14px; height: 10px; border: 1.5px solid var(--accent); background: var(--accent-dim); }
@media (max-width: 760px) {
  .bp-info { grid-template-columns: 1fr; }
  #jiLinks { grid-column: 1; }
  .bp-bar .tx:last-child { display: none; }
}

/* judiciary drawing */
.judi .tx { font-size: 9px; fill: var(--dim); letter-spacing: 0.06em; }
.judi .tx.faint, .fig .tx.faint { fill: var(--dim); opacity: 0.7; }
.judi .tier { fill: var(--accent); font-weight: 600; }
.judi .ln { fill: none; stroke: var(--faint); stroke-width: 1; }
.judi .ln.acc { stroke: var(--accent); }
.judi .tx.acc { fill: var(--accent); }
.judi .edge { fill: none; stroke: var(--dim); stroke-width: 1.3; stroke-linejoin: round; transition: stroke 0.25s, stroke-width 0.25s; }
.judi .edge.dashed { stroke-dasharray: 5 5; stroke: var(--dim); }
.judi .edge.near { stroke: var(--ink); }
.judi .edge.hot { stroke: var(--accent); stroke-width: 2.2; }
.judi .edge-label { fill: var(--dim); }
.judi .pulse { fill: var(--accent); }
.judi .node { cursor: pointer; outline: none; }
.judi .box { fill: var(--surface); stroke: var(--ink); stroke-opacity: 0.55; stroke-width: 1.2; transition: stroke 0.2s, fill 0.2s, stroke-width 0.2s; }
.judi .corner { fill: none; stroke: var(--accent); stroke-width: 1.5; opacity: 0; transition: opacity 0.2s; }
.judi .node:hover .box, .judi .node:focus-visible .box { stroke: var(--accent); stroke-opacity: 1; }
.judi .node:hover .corner, .judi .node:focus-visible .corner, .judi .node.sel .corner { opacity: 1; }
.judi .node.sel .box { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2; fill: var(--accent-dim); }
.judi .node.acc .box { stroke: var(--accent); stroke-opacity: 1; fill: var(--accent-dim); }
.judi .node.dash .box { stroke-dasharray: 4 4; }
.judi .ttl { font-family: var(--sans); font-weight: 500; fill: var(--ink); letter-spacing: -0.01em; }
.judi .code { fill: var(--accent); font-size: 8px; }
.judi .sub { font-size: 7.6px; }
.judi .sys { font-family: var(--sans); font-size: 15px; font-weight: 500; fill: var(--ink); }
.judi .ring { fill: none; stroke: var(--accent); stroke-width: 1; opacity: 0; transform-origin: 700px 62px; transform-box: view-box; }
.judi.in .ring { animation: ping 3.2s 2.4s var(--ease) infinite; }
@keyframes ping { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(4.2); } }

/* draw-in for the judiciary */
.js .judi .edge { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .judi .edge.dashed { stroke-dasharray: 1; }
.js .judi .box { stroke-dasharray: 1; stroke-dashoffset: 1; fill-opacity: 0; }
.js .judi .node text, .js .judi .edge-label, .js .judi .tiers, .js .judi .sys, .js .judi .pulse { opacity: 0; }
.js .judi.in .box { stroke-dashoffset: 0; fill-opacity: 1; transition: stroke-dashoffset 1s var(--ease) calc(var(--d) * 70ms), fill-opacity 0.6s calc(var(--d) * 70ms + 500ms), stroke 0.2s, stroke-width 0.2s; }
.js .judi.in .node text { opacity: 1; transition: opacity 0.6s calc(var(--d) * 70ms + 400ms); }
.js .judi.in .edge { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s var(--ease) calc(1200ms + var(--d) * 60ms), stroke 0.25s, stroke-width 0.25s; }
.js .judi.in .edge.dashed { animation: undash 0.01s linear calc(2600ms) forwards; }
@keyframes undash { to { stroke-dasharray: 0.012 0.01; } }
.js .judi.in .edge-label, .js .judi.in .tiers, .js .judi.in .sys { opacity: 1; transition: opacity 0.8s 1.8s; }
.js .judi.in .pulse { opacity: 1; transition: opacity 0.6s 2.4s; }

/* ---------- Ticker ---------- */
.ticker { margin-top: 56px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); overflow: hidden; padding: 12px 0; }
.ticker-track { display: flex; gap: 48px; width: max-content; animation: marq 80s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track span { white-space: nowrap; font-size: 0.9rem; color: var(--ink-2); }
@keyframes marq { to { transform: translateX(-50%); } }
.tstamp { font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.1em; font-weight: 600; margin-right: 10px; padding: 2px 6px; border: 1px solid currentColor; }
.v-true { --v: var(--green); }
.v-myth { --v: var(--red); }
.v-sortof { --v: var(--amber); }
.tstamp { color: var(--v); }

/* ---------- Key / legend ---------- */
.key { padding: 88px 0; }
.key-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: end; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--hair); }
.legend li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--hair); font-size: 0.95rem; }
.scope { display: inline-flex; align-items: center; font-family: var(--mono); font-size: 0.66rem; font-weight: 600; letter-spacing: 0.06em; padding: 2px 6px; border: 1px solid currentColor; white-space: nowrap; line-height: 1.4; }
.s-EW { color: var(--blue); }
.s-Eng { color: var(--red); }
.s-Wales { color: var(--green); }
.s-GB { color: #a78bfa; }
.s-UK { color: var(--ink); }
.s-Intl { color: #2dd4bf; }
:root[data-theme="light"] .s-GB { color: #6d28d9; }
:root[data-theme="light"] .s-Intl { color: #0f766e; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .s-GB { color: #6d28d9; }
  :root:not([data-theme="dark"]) .s-Intl { color: #0f766e; }
}
@media (max-width: 800px) { .key-grid { grid-template-columns: 1fr; gap: 28px; } }

/* ---------- Figures (topic drawings) ---------- */
.fig { margin: 0; border: 1px solid var(--faint); background: var(--surface); background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px); background-size: 20px 20px; position: relative; }
.fig svg { display: block; width: 100%; height: auto; padding: 12px; overflow: visible; }
.fig figcaption { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); padding: 10px 14px; border-top: 1px solid var(--hair); background: var(--surface); }
.fig figcaption span { color: var(--accent); margin-right: 6px; }
:is(.fig, .orn, .fig-lite) .crop path { fill: none; stroke: var(--accent); stroke-width: 1.2; }
:is(.fig, .orn, .fig-lite) .ln { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; stroke-opacity: 0.85; }
:is(.fig, .orn, .fig-lite) .ln.faint { stroke-opacity: 0.3; }
:is(.fig, .orn, .fig-lite) .ln.acc { stroke: var(--accent); stroke-opacity: 1; }
:is(.fig, .orn, .fig-lite) .ln.thick { stroke-width: 2.4; }
:is(.fig, .orn, .fig-lite) .ln.grn { stroke: var(--green); stroke-opacity: 1; }
:is(.fig, .orn, .fig-lite) .ln.red { stroke: var(--red); stroke-opacity: 1; }
:is(.fig, .orn, .fig-lite) .ln.leader { stroke-opacity: 0.45; stroke-width: 0.8; }
:is(.fig, .orn, .fig-lite) .ln.dimln { stroke: var(--accent); stroke-width: 0.9; stroke-opacity: 0.9; }
:is(.fig, .orn, .fig-lite) .ln.fillacc { fill: var(--accent-dim); stroke: var(--accent); stroke-opacity: 1; }
:is(.fig, .orn, .fig-lite) .ln.fillamb { fill: rgba(255, 176, 32, 0.18); stroke: var(--amber); stroke-opacity: 1; }
:is(.fig, .orn, .fig-lite) .ln.hatch { fill: rgba(var(--ink-rgb), 0.07); }
:is(.fig, .orn, .fig-lite) .ln.fillbg { fill: var(--surface); }
:is(.fig, .orn, .fig-lite) .ln.dash { stroke-dasharray: 6 6; stroke-opacity: 0.5; }
:is(.fig, .orn, .fig-lite) .ln.arc { stroke-width: 10; stroke-opacity: 0.35; stroke-linecap: butt; }
:is(.fig, .orn, .fig-lite) .dotfill { fill: var(--accent); }
:is(.fig, .orn, .fig-lite) .tx { font-size: 8.6px; fill: var(--dim); }
:is(.fig, .orn, .fig-lite) .tx.strong { fill: var(--ink); font-weight: 600; }
:is(.fig, .orn, .fig-lite) .tx.acc { fill: var(--accent); }
:is(.fig, .orn, .fig-lite) .tx.num { font-family: var(--dot); font-size: 14px; font-weight: 900; fill: var(--ink); letter-spacing: 0.02em; }
:is(.fig, .orn, .fig-lite) .tx.sign { font-family: var(--sans); font-size: 15px; font-weight: 600; fill: var(--ink); letter-spacing: 0; }
:is(.fig, .orn, .fig-lite) .tx.mini { font-size: 6.5px; fill: var(--ink); }
:is(.fig, .orn, .fig-lite) .tx.dimtx { fill: var(--accent); font-size: 8px; }
.fig .spin ellipse { transform-origin: 160px 150px; animation: globe 9s linear infinite; }
.fig .spin ellipse:nth-child(2) { animation-delay: -3s; }
.fig .spin ellipse:nth-child(3) { animation-delay: -6s; }
@keyframes globe { 0% { transform: scaleX(0.05); } 50% { transform: scaleX(1); } 100% { transform: scaleX(0.05); } }

/* draw-in for figures */
.js :is(.fig, .orn, .fig-lite) [pathLength] { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js :is(.fig, .orn, .fig-lite) .ln.dash[pathLength], .js :is(.fig, .orn, .fig-lite) .spin ellipse { stroke-dasharray: none; stroke-dashoffset: 0; opacity: 0; }
.js :is(.fig, .orn, .fig-lite) text, .js :is(.fig, .orn, .fig-lite) .dotfill, .js :is(.fig, .orn, .fig-lite) .pulse { opacity: 0; }
.js :is(.fig, .orn, .fig-lite) .ln.fillacc, .js :is(.fig, .orn, .fig-lite) .ln.fillamb, .js :is(.fig, .orn, .fig-lite) .ln.hatch { fill-opacity: 0; }
.js :is(.fig, .orn, .fig-lite).in [pathLength] { stroke-dashoffset: 0; transition: stroke-dashoffset 1.1s var(--ease) calc(var(--d) * 28ms); }
.js :is(.fig, .orn, .fig-lite).in .ln.dash[pathLength], .js :is(.fig, .orn, .fig-lite).in .spin ellipse { opacity: 1; transition: opacity 0.8s calc(var(--d) * 28ms); }
.js :is(.fig, .orn, .fig-lite).in text, .js :is(.fig, .orn, .fig-lite).in .dotfill, .js :is(.fig, .orn, .fig-lite).in .pulse { opacity: 1; transition: opacity 0.6s calc(var(--d) * 28ms + 300ms); }
.js :is(.fig, .orn, .fig-lite).in .ln.fillacc, .js :is(.fig, .orn, .fig-lite).in .ln.fillamb, .js :is(.fig, .orn, .fig-lite).in .ln.hatch { fill-opacity: 1; transition: stroke-dashoffset 1.1s var(--ease) calc(var(--d) * 28ms), fill-opacity 0.8s calc(var(--d) * 28ms + 600ms); }

/* ---------- Topics ---------- */
.topics { padding-bottom: 72px; }
.tabbar-wrap { position: sticky; top: var(--header); z-index: 40; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.tabbar-wrap::before { content: ""; position: absolute; inset: 0; background: var(--bg); opacity: 0.97; z-index: -1; }
.tabbar { position: relative; display: flex; overflow-x: auto; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { flex: none; display: inline-flex; gap: 8px; align-items: baseline; padding: 16px 16px 14px; font-size: 0.92rem; font-weight: 400; color: var(--dim); text-decoration: none; border-bottom: 2px solid transparent; transition: color 0.2s, border-color 0.2s; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } }
.topic-head { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 48px; align-items: start; }
.topic-head h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 300; letter-spacing: -0.04em; }
.tagline { font-size: 1.15rem; color: var(--accent); margin: 14px 0 12px; font-weight: 400; }
.intro { color: var(--ink-2); }
.specs { display: grid; grid-template-columns: repeat(4, 1fr); margin: 28px 0 0; border-top: 1px solid var(--hair); }
.specs div { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.specs dt { font-family: var(--dot); font-weight: 900; font-size: 1.9rem; line-height: 1; }
.specs dd { margin: 6px 0 0; font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
@media (max-width: 960px) { .topic-head { grid-template-columns: 1fr; gap: 28px; } }
@media (max-width: 480px) { .specs { grid-template-columns: repeat(2, 1fr); } }

.sub-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 64px 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--faint); }
.sub-head h4 { font-size: 1.5rem; font-weight: 300; }
.law-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap: 0; border-left: 1px solid var(--hair); border-top: 1px solid var(--hair); }
.law { position: relative; padding: 22px 22px 18px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); background: var(--bg); display: flex; flex-direction: column; gap: 10px; transition: background 0.25s; }
.law::before, .law::after { content: ""; position: absolute; width: 10px; height: 10px; border-color: var(--accent); border-style: solid; opacity: 0; transition: opacity 0.25s; }
.law::before { top: -1px; left: -1px; border-width: 1.5px 0 0 1.5px; }
.law::after { right: -1px; bottom: -1px; border-width: 0 1.5px 1.5px 0; }
.law:hover { background: var(--surface); }
.law:hover::before, .law:hover::after { opacity: 1; }
.law-top { display: flex; justify-content: space-between; align-items: center; }
.law-year { font-family: var(--dot); font-weight: 900; font-size: 1.6rem; color: var(--accent); line-height: 1; margin-top: 4px; }
.law h3 { font-size: 1.3rem; font-weight: 400; letter-spacing: -0.02em; }
.law .summary { color: var(--ink-2); font-size: 0.95rem; }
.law details { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--faint); }
.law summary { cursor: pointer; list-style: none; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); display: flex; justify-content: space-between; }
.law summary::-webkit-details-marker { display: none; }
.law summary::after { content: "+"; font-size: 1rem; line-height: 1; transition: transform 0.25s; }
.law details[open] summary::after { transform: rotate(45deg); }
.law ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.law li { position: relative; padding-left: 20px; font-size: 0.9rem; color: var(--ink-2); }
.law li::before { content: ""; position: absolute; left: 2px; top: 0.72em; width: 10px; height: 1px; background: var(--accent); }
.js .law, .js .section-head, .js .tl, .js .flip { opacity: 0; transform: translateY(16px); }
.js .law.in, .js .section-head.in, .js .tl.in, .js .flip.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease) calc(var(--i, 0) * 50ms), transform 0.7s var(--ease) calc(var(--i, 0) * 50ms); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.fact { display: flex; flex-direction: column; gap: 8px; padding: 20px; border: 1px solid var(--hair); border-left: 2px solid var(--accent); background: var(--surface); color: var(--ink-2); }

/* ---------- Weird cards ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; padding: 9px 14px; border: 1px solid var(--hair); background: transparent; color: var(--dim); transition: all 0.2s; }
.filter:hover { color: var(--ink); border-color: var(--faint); }
.filter.active { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
.weird-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 14px; }
.flip { perspective: 1200px; height: 250px; padding: 0; border: 0; background: none; text-align: left; display: block; }
.flip-inner { display: block; position: relative; width: 100%; height: 100%; transition: transform 0.7s var(--ease); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 18px; border: 1px solid var(--faint); background: var(--surface); backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
.front { background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px); background-size: 16px 16px; transition: border-color 0.2s; }
.flip:hover .front { border-color: var(--accent); }
.card-top, .card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card-foot { margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--faint); }
.card-title { font-size: 1.15rem; line-height: 1.25; margin-top: 16px; font-weight: 400; letter-spacing: -0.01em; }
.back { transform: rotateY(180deg); border-color: var(--v); background: var(--panel); }
.card-text { font-size: 0.88rem; line-height: 1.5; color: var(--ink-2); margin-top: 12px; overflow-y: auto; }
.stamp { align-self: flex-start; display: inline-block; font-family: var(--mono); font-weight: 600; font-size: 0.85rem; letter-spacing: 0.14em; color: var(--v); border: 2px solid var(--v); padding: 4px 10px; transform: rotate(-4deg); }
.flip.flipped .stamp { animation: stampIn 0.45s 0.25s var(--ease) both; }
@keyframes stampIn { from { opacity: 0; transform: rotate(-12deg) scale(1.8); } to { opacity: 1; transform: rotate(-4deg) scale(1); } }
.stamp.warn { --v: var(--accent); }

/* ---------- Quiz ---------- */
.quiz-card { border: 1px solid var(--faint); background: var(--surface); padding: clamp(22px, 4vw, 44px); max-width: 980px; }
.quiz-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.quiz-score { display: flex; border: 1px solid var(--hair); }
.quiz-score div { padding: 10px 18px; text-align: center; border-right: 1px solid var(--hair); }
.quiz-score div:last-child { border-right: 0; }
.quiz-score span { display: block; font-family: var(--dot); font-weight: 900; font-size: 1.9rem; line-height: 1.1; }
.quiz-score small { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }
.quiz-progress { height: 2px; background: var(--hair); margin: 28px 0; }
.quiz-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.5s var(--ease); }
.q-text { font-size: clamp(1.5rem, 3.4vw, 2.4rem); font-weight: 300; letter-spacing: -0.03em; line-height: 1.15; margin: 12px 0 26px; }
.q-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.q-opt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px 18px; border: 1px solid var(--faint); background: var(--bg); font-size: 1.05rem; text-align: left; transition: border-color 0.2s, background 0.2s, transform 0.2s; }
.q-opt:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-2px); }
.q-opt.correct { border-color: var(--green); background: rgba(61, 220, 132, 0.1); }
.q-opt.wrong { border-color: var(--red); background: rgba(255, 90, 95, 0.1); animation: shake 0.4s; }
.q-opt:disabled { cursor: default; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.q-feedback { margin-top: 20px; padding: 20px; border: 1px dashed var(--faint); display: flex; flex-direction: column; gap: 10px; animation: fade 0.4s var(--ease); }
.q-feedback strong { font-weight: 500; font-size: 1.1rem; }
.q-feedback p { color: var(--ink-2); }
.q-feedback .btn { align-self: flex-start; margin-top: 4px; }
.q-feedback .stamp { animation: stampIn 0.45s var(--ease) both; }
.q-end { text-align: center; padding: 16px 0; }
.q-end .big { font-family: var(--dot); font-weight: 900; font-size: clamp(4rem, 14vw, 7rem); line-height: 1; color: var(--accent); margin: 8px 0; }
.q-end p:not(.tx) { color: var(--ink-2); font-size: 1.15rem; margin-bottom: 22px; }
@media (max-width: 640px) { .q-options { grid-template-columns: 1fr; } }

/* ---------- Ages ruler ---------- */
.age-box { border: 1px solid var(--faint); background: var(--surface); padding: clamp(22px, 4vw, 40px); }
.age-display { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.age-num { font-family: var(--dot); font-weight: 900; font-size: clamp(5rem, 16vw, 9rem); line-height: 0.9; color: var(--accent); }
.ruler-wrap { position: relative; margin-top: 24px; height: 70px; }
.ruler { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.ruler line { stroke: var(--ink); stroke-opacity: 0.6; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ruler line.mile { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2; }
.ruler text { font-family: var(--mono); font-size: 11px; fill: var(--dim); }
#ageRange { position: absolute; left: calc(2% - 9px); width: calc(96% + 18px); top: -10px; height: 64px; margin: 0; -webkit-appearance: none; appearance: none; background: transparent; cursor: ew-resize; }
#ageRange::-webkit-slider-runnable-track { height: 64px; background: transparent; }
#ageRange::-moz-range-track { height: 64px; background: transparent; }
#ageRange::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 64px; background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; border: 0; }
#ageRange::-moz-range-thumb { width: 18px; height: 64px; border: 0; border-radius: 0; background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat; }
.age-ticks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.age-ticks button { font-family: var(--mono); font-size: 0.74rem; padding: 6px 10px; border: 1px solid var(--hair); background: transparent; color: var(--dim); }
.age-ticks button.on { color: var(--accent); border-color: var(--accent); }
.age-list { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.age-list li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); font-size: 0.93rem; color: var(--ink-2); animation: fade 0.35s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.age-list .from { flex: none; font-family: var(--mono); font-size: 0.7rem; font-weight: 600; padding: 2px 6px; border: 1px solid var(--faint); color: var(--dim); }
.age-list li.new { background: var(--accent-dim); color: var(--ink); }
.age-list li.new .from { color: var(--accent); border-color: var(--accent); }

/* ---------- Routes ---------- */
.route-list { display: grid; gap: 18px; }
.route-list .fig svg { min-width: 760px; }
.route-list .fig { overflow-x: auto; }
.fig .routeline { stroke-width: 2; }
:is(.fig, .orn, .fig-lite) .pulse { fill: var(--accent); }
:is(.fig, .orn, .fig-lite) .pulse.big { filter: drop-shadow(0 0 6px var(--accent)); }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.tl { display: grid; grid-template-columns: 150px 24px 1fr; gap: 16px; align-items: start; padding: 22px 0; border-bottom: 1px solid var(--hair); }
.tl-year { font-family: var(--dot); font-weight: 900; font-size: 2.2rem; line-height: 1; color: var(--ink); }
.tl:hover .tl-year { color: var(--accent); }
.tl-dot { width: 11px; height: 11px; margin-top: 12px; border: 1.5px solid var(--accent); transform: rotate(45deg); }
.tl h4 { font-size: 1.25rem; font-weight: 400; margin-bottom: 4px; }
.tl p { color: var(--dim); font-size: 0.95rem; }
@media (max-width: 600px) { .tl { grid-template-columns: 90px 1fr; } .tl-dot { display: none; } .tl-year { font-size: 1.6rem; } }

/* ---------- Disclaimer & footer ---------- */
.disclaimer-sec { padding: 72px 0; }
.disclaimer { display: flex; gap: 28px; align-items: flex-start; padding: 28px; border: 1px dashed var(--accent); background: var(--accent-dim); }
.disclaimer h2 { font-size: 1.7rem; font-weight: 300; margin-bottom: 8px; }
.disclaimer p { color: var(--ink-2); max-width: 760px; }
.disclaimer a { color: var(--accent); }
@media (max-width: 600px) { .disclaimer { flex-direction: column; gap: 16px; } }
.site-footer { border-top: 1px solid var(--faint); padding: 48px 0 24px; }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-inner .muted { margin-top: 10px; font-size: 0.92rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 20px; align-content: flex-start; }
.footer-links a { text-decoration: none; color: var(--dim); font-size: 0.92rem; }
.footer-links a:hover { color: var(--accent); }
.footer-base { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--hair); }

/* ---------- Search ---------- */
.search-overlay { position: fixed; inset: 0; z-index: 130; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; justify-content: center; padding: 10vh 16px 16px; }
.search-overlay[hidden], .menu[hidden] { display: none; }
.search-box { width: min(700px, 100%); max-height: 76vh; display: flex; flex-direction: column; background: var(--bg); border: 1px solid var(--faint); animation: fade 0.25s var(--ease); }
.search-input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--hair); }
.search-input svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--dim); stroke-width: 1.6; }
.search-input input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font: inherit; font-size: 1.1rem; }
.esc { font-family: var(--mono); font-size: 0.68rem; padding: 4px 8px; border: 1px solid var(--hair); background: transparent; color: var(--dim); }
.search-results { list-style: none; margin: 0; padding: 6px; overflow-y: auto; }
.search-results li button { width: 100%; text-align: left; border: 0; background: none; padding: 12px; display: flex; flex-direction: column; gap: 3px; border-bottom: 1px solid var(--hair); }
.search-results li button:hover, .search-results li button:focus-visible { background: var(--surface); }
.r-title { font-weight: 400; font-size: 1rem; }
.r-sub { font-size: 0.85rem; color: var(--dim); }
.search-results .empty { padding: 24px; text-align: center; color: var(--dim); }
mark { background: var(--accent-dim); color: var(--accent); }

.to-top { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: 44px; height: 44px; border: 1px solid var(--faint); background: var(--bg); font-family: var(--mono); opacity: 0; pointer-events: none; transform: translateY(8px); transition: all 0.3s; }
.to-top.show { opacity: 1; pointer-events: auto; transform: none; }
.to-top:hover { border-color: var(--accent); color: var(--accent); }
.flash { animation: flash 1.6s; }
@keyframes flash { 30% { outline: 2px solid var(--accent); outline-offset: 4px; } }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 150; }

@media (max-width: 640px) {
  .section { padding: 80px 0; }
  .sub-head { flex-direction: column; gap: 6px; }
}

/* =========================================================
   Cyanotype layer: rounded glass, iOS icons, ornaments, motion
   ========================================================= */

/* ---------- Atmosphere ---------- */
body { background: radial-gradient(1100px 600px at 90% -10%, rgba(var(--acc2-rgb), 0.07), transparent 60%), radial-gradient(800px 500px at -10% 35%, rgba(var(--acc-rgb), 0.06), transparent 60%), var(--bg); background-repeat: no-repeat; }
body::before { background-size: 72px 72px; opacity: 0.65; }
.hero h1 em, .h2 em, .topic-head h1 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; font-size: 1.1em; line-height: 0.9; }
.hero h1 { font-size: clamp(2.8rem, 7.4vw, 6.4rem); }
.law-year { font-size: 1.7rem; }
.logo-mark { stroke: var(--accent); }

.progress { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 90; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--acc2), var(--accent)); box-shadow: 0 0 12px var(--accent); }

.bg-lines { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.bgl { position: absolute; fill: none; stroke: var(--faint); stroke-width: 1; opacity: 0.55; translate: 0 calc(var(--sy, 0) * -0.12px); }
.bgl-1 { width: 520px; top: 8vh; right: -160px; animation: turn 120s linear infinite; }
.bgl-2 { width: 300px; top: 62vh; left: -120px; animation: turn 90s linear infinite reverse; translate: 0 calc(var(--sy, 0) * -0.06px); }
.bgl-3 { width: 420px; bottom: -40px; right: 12vw; opacity: 0.35; translate: calc(var(--sy, 0) * -0.04px) 0; }
@keyframes turn { to { rotate: 360deg; } }

/* ---------- Rounded glass surfaces ---------- */
.blueprint, .fig, .quiz-card, .age-box, .face, .fact, .disclaimer, .search-box, .law, .q-opt, .q-feedback { border-radius: var(--r); }
.blueprint { overflow: hidden; box-shadow: var(--shadow); background: var(--glass); }
.fig { overflow: hidden; box-shadow: var(--shadow); }
.route-list .fig { overflow-x: auto; }
.btn, .filter, .esc { border-radius: 6px; }
.icon-btn { border-radius: var(--r-sm); }
.scope { border-radius: 6px; }
.tstamp { border-radius: 5px; }
.to-top { border-radius: 14px; box-shadow: var(--shadow); }
.age-ticks button { border-radius: 8px; }
.age-list .from { border-radius: 6px; }
.quiz-score { border-radius: var(--r-sm); overflow: hidden; }
.quiz-card, .age-box { background: var(--glass); box-shadow: var(--shadow); }
.btn.primary { box-shadow: 0 8px 22px -12px var(--accent); }
.btn { transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.3s var(--ease), box-shadow 0.3s; }
.btn:hover { transform: translateY(-2px); }
.menu-panel { border-radius: 14px 0 0 14px; overflow: hidden; }
.search-box { overflow: hidden; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.6); }
.stamp { border-radius: 8px; }

/* law sheets become separated cards */
.law-grid { gap: 14px; border: 0; }
.law { border: 1px solid var(--hair); background: var(--glass); transition: background 0.25s, border-color 0.25s, box-shadow 0.3s, transform 0.5s var(--ease); }
.law:hover { border-color: var(--faint); box-shadow: var(--shadow); }
.law::before { border-top-left-radius: 8px; }
.law::after { border-bottom-right-radius: 8px; }
.fact { flex-direction: row; align-items: flex-start; gap: 14px; border: 1px solid var(--hair); background: var(--glass); }
.fact > span:last-child { display: flex; flex-direction: column; gap: 6px; }

/* ---------- iOS icons ---------- */
.ios { display: inline-block; flex: none; width: var(--s); height: var(--s); line-height: 0; vertical-align: middle; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.28)); transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.ios svg { width: 100%; height: 100%; display: block; overflow: visible; }
.ios-shine { fill: #fff; opacity: 0.16; }
.ios-glyph { fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .ios { filter: drop-shadow(0 4px 8px rgba(16, 42, 90, 0.22)); }
.js .ios-glyph { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .ios.in .ios-glyph, .js .in .ios-glyph, .js .tabbar .ios-glyph, .js .menu .ios-glyph, .js .bp-info .ios-glyph, .js .age-list .ios-glyph, .js .weird-grid .flipped .ios-glyph { stroke-dashoffset: 0; transition: stroke-dashoffset 0.9s var(--ease) 0.15s; }
a:hover > .ios, button:hover .ios, .law:hover .ios, .fact:hover .ios, .tl:hover .ios, .stats div:hover .ios, .tab[aria-current] .ios { transform: translateY(-3px) scale(1.08) rotate(-4deg); }
.tab[aria-current] .ios { animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes pop { 0% { transform: scale(0.7); } 60% { transform: scale(1.15) rotate(-6deg); } 100% { transform: translateY(-3px) scale(1.08) rotate(-4deg); } }

/* where icons sit */
.tab { align-items: center; padding: 12px 14px; border-radius: 8px 8px 0 0; }
.tab[aria-current] { background: var(--accent-dim); }
.menu-nav a { align-items: center; }
.menu-sub a { display: flex; align-items: center; gap: 12px; padding-left: 28px; }
.stats div { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.stats div .ios { grid-row: span 2; align-self: start; margin-top: 6px; }
.stats dd { grid-column: 2; }
.stats dt { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.topic-title { display: flex; align-items: center; gap: 18px; }
.law-top { gap: 10px; }
.law-top .tx { margin-right: auto; }
.card-top .tx { margin-right: auto; }
.card-top .stamp { margin-left: 4px; }
.age-list li { align-items: center; }
.ji-icon { display: inline-block; margin-right: 12px; vertical-align: middle; }
.ji-icon .ios { animation: pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.bp-info-head .tx { vertical-align: middle; }
.tl { grid-template-columns: 130px 44px 1fr; align-items: center; }
.tl-dot { width: auto; height: auto; margin: 0; border: 0; transform: none; position: relative; }
.tl-dot::before { content: ""; position: absolute; left: 50%; top: -28px; bottom: -28px; width: 1px; background: linear-gradient(var(--faint), var(--accent), var(--faint)); z-index: -1; }
.tl-year { font-size: 2.2rem; }
@media (max-width: 600px) { .tl { grid-template-columns: 74px 36px 1fr; gap: 10px; } .tl-dot { display: block; } .tl-dot .ios { --s: 28px !important; width: 28px; height: 28px; } .tl-year { font-size: 1.7rem; } }

/* ---------- Section heads with ornaments ---------- */
.section-head.has-orn { max-width: none; display: grid; grid-template-columns: minmax(0, 760px) auto; justify-content: space-between; align-items: end; gap: 32px; }
.orn { margin: 0; width: 200px; flex: none; }
.orn svg { display: block; width: 100%; height: auto; overflow: visible; }
.key-right { display: grid; gap: 18px; }
.key-right .orn { width: 210px; justify-self: end; }
.quiz-head .orn { width: 150px; margin-left: auto; }
.disclaimer .orn { width: 88px; }
@media (max-width: 800px) {
  .section-head.has-orn { grid-template-columns: 1fr; gap: 12px; }
  .section-head.has-orn .orn { width: 150px; order: -1; }
  .key-right .orn { justify-self: start; width: 170px; }
  .quiz-head .orn { display: none; }
}

/* idle motion inside ornaments */
.orn .orbit { transform-origin: 105px 80px; transform-box: view-box; animation: turn 9s linear infinite; }
.orn .page { transform-origin: 100px 90px; transform-box: view-box; animation: pageTurn 5s ease-in-out infinite; }
@keyframes pageTurn { 0%, 15% { transform: scaleX(1); } 45%, 60% { transform: scaleX(-1); } 90%, 100% { transform: scaleX(1); } }
.orn .scan { animation: scan 6s ease-in-out infinite; }
@keyframes scan { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(-40px, -22px); } 50% { transform: translate(-20px, 12px); } 75% { transform: translate(14px, -10px); } }
.orn .tip { transform-origin: 100px 30px; transform-box: view-box; animation: tip 4s ease-in-out infinite; }
@keyframes tip { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
.orn .grow { transform-origin: var(--gx) 130px; transform-box: view-box; animation: grow 3.4s ease-in-out infinite; }
.orn .grow:nth-of-type(2) { animation-delay: -1.1s; }
.orn .grow:nth-of-type(3) { animation-delay: -2.2s; }
@keyframes grow { 0%, 100% { transform: scaleY(0.94); } 50% { transform: scaleY(1.04); } }
.orn .sway { transform-origin: 100px 43px; transform-box: view-box; animation: sway 3.6s ease-in-out infinite; }
.orn .sway.r { transform-origin: 100px 81px; animation-direction: reverse; animation-duration: 4.4s; }
@keyframes sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
.orn .sand-top { transform-origin: 100px 56px; transform-box: view-box; animation: drain 6s linear infinite; }
.orn .sand-bot { transform-origin: 100px 128px; transform-box: view-box; animation: fill 6s linear infinite; }
@keyframes drain { 0% { transform: scaleY(1); } 90% { transform: scaleY(0.05); } 100% { transform: scaleY(1); } }
@keyframes fill { 0% { transform: scaleY(0.05); } 90% { transform: scaleY(1); } 100% { transform: scaleY(0.05); } }
.orn .grain { animation: grain 1s linear infinite; animation-delay: calc(var(--k) * -0.25s); }
@keyframes grain { from { transform: translateY(-6px); opacity: 1; } to { transform: translateY(44px); opacity: 0; } }
.orn .ripple { transform-origin: 60px 66px; transform-box: view-box; animation: ripple 2.8s ease-out infinite; stroke-dasharray: none !important; }
@keyframes ripple { from { transform: scale(0.3); opacity: 0.9; } to { transform: scale(1.15); opacity: 0; } }
:is(.fig, .orn, .fig-lite) .ln.acc2 { stroke: var(--acc2); stroke-opacity: 1; }

/* ---------- Dividers ---------- */
.divider { height: 40px; margin: 8px 0 -8px; position: relative; z-index: 1; }
.divider svg { display: block; width: 100%; height: 40px; overflow: hidden; }
.fig-lite .tx { font-size: 11px; letter-spacing: 0.12em; }

/* ---------- Footer skyline ---------- */
.skyline { border: 0; background: none; box-shadow: none; margin-bottom: 32px; }
.skyline svg { padding: 0; }
.skyline .eye { transform-origin: 860px 120px; transform-box: view-box; animation: turn 60s linear infinite; }
.skyline .river { stroke-dasharray: 18 12; animation: flow 3s linear infinite; }
.skyline .river.r2 { animation-duration: 5s; animation-direction: reverse; }
@keyframes flow { to { stroke-dashoffset: -60; } }

/* ---------- Blueprint crosshair & scan ---------- */
.bp-canvas { position: relative; }
.xh, .xh-read, .scanline { position: absolute; pointer-events: none; z-index: 2; }
.xh { opacity: 0; transition: opacity 0.2s; background: var(--acc2); }
.xh-h { left: 0; width: var(--cw, 100%); height: 1px; top: var(--y, 0); translate: var(--sl, 0) 0; opacity: 0; }
.xh-v { top: 0; bottom: 0; width: 1px; left: var(--x, 0); }
.xh-read { left: var(--x, 0); top: var(--y, 0); margin: 8px 0 0 10px; padding: 3px 6px; border-radius: 6px; background: var(--acc2-dim); color: var(--acc2); font-size: 0.62rem; opacity: 0; transition: opacity 0.2s; white-space: nowrap; }
.bp-canvas.aim .xh { opacity: 0.35; }
.bp-canvas.aim .xh-read { opacity: 1; }
.scanline { top: 0; bottom: 0; left: 0; width: 120px; background: linear-gradient(90deg, transparent, var(--acc2-dim)); border-right: 1px solid var(--acc2); opacity: 0; }
.js .judi.in ~ .scanline, .js .bp-canvas.scan .scanline { animation: sweep 7s 2.6s var(--ease) infinite; }
@keyframes sweep { 0% { transform: translateX(-120px); opacity: 0; } 8% { opacity: 0.6; } 40% { opacity: 0.6; } 50% { transform: translateX(var(--sw, 1200px)); opacity: 0; } 100% { transform: translateX(var(--sw, 1200px)); opacity: 0; } }
.judi .node .box { rx: 8px; }
.judi .edge.hot { stroke: var(--accent); filter: drop-shadow(0 0 4px var(--accent)); }
.judi .pulse { fill: var(--acc2); filter: drop-shadow(0 0 4px var(--acc2)); }
.lg-dot { background: var(--acc2); }

/* ---------- Split headings ---------- */
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.12em; margin-bottom: -0.12em; }
.split .w > span { display: inline-block; }
.js .split.ready .w > span { transform: translateY(110%) rotate(4deg); transform-origin: 0 100%; }
.js .split.ready.in .w > span { transform: none; transition: transform 0.9s var(--ease) calc(var(--wi) * 70ms); }

/* ---------- Tilt ---------- */
.tilt { transform-style: preserve-3d; }
.js .law.in.tilting, .js .flip.in.tilting { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(-2px); transition: transform 0.12s linear; }
.law.tilting::selection { background: none; }
.glare { position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(400px circle at var(--gx, 50%) var(--gy, 50%), rgba(var(--acc2-rgb), 0.12), transparent 50%); opacity: 0; transition: opacity 0.3s; }
.tilting .glare { opacity: 1; }

/* ---------- Theme switch ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { z-index: 2; }
.icon-btn svg { transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.theme-flip svg { animation: themeSpin 0.7s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes themeSpin { from { transform: rotate(-180deg) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.theme-ring { position: fixed; z-index: 200; pointer-events: none; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; border: 1.5px solid var(--accent); animation: themeRing 0.9s var(--ease) forwards; }
@keyframes themeRing { from { transform: scale(0.2); opacity: 1; } to { transform: scale(var(--ring, 80)); opacity: 0; } }

/* misc motion */
.reveal-up { animation: fade 0.6s var(--ease) both; }
.ticker { border-radius: 0; }
.tl-year { transition: color 0.3s, transform 0.4s var(--ease); }
.tl:hover .tl-year { transform: translateX(6px); }
.stats div { transition: transform 0.4s var(--ease); }
.filter { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- Per-law mini diagrams ---------- */
.lviz { margin: 4px 0 2px; padding: 12px 12px 10px; border: 1px dashed var(--faint); border-radius: var(--r-sm); background-image: linear-gradient(var(--hair) 1px, transparent 1px), linear-gradient(90deg, var(--hair) 1px, transparent 1px); background-size: 12px 12px; }
.lviz svg { display: block; width: 100%; height: auto; overflow: visible; }
.lviz .tx { font-size: 8.4px; }
.lviz .tx.vz-num { font-family: var(--dot); font-weight: 900; font-size: 40px; fill: var(--ink); letter-spacing: 0.02em; }
.lviz .tx.vz-step { font-size: 6.5px; fill: var(--ink); }
.lviz .tx.vz-sm { font-size: 7.2px; letter-spacing: 0.03em; }
.lviz .tx.vz-key { font-family: var(--dot); font-weight: 900; font-size: 15px; fill: var(--ink); }
.lviz .tx.vz-key.acc { fill: var(--accent); }
.lviz .vz-bar { fill: var(--faint); transform-box: fill-box; transform-origin: 0 50%; }
.lviz .vz-bar.top { fill: var(--accent); }
.js .lviz .vz-bar { transform: scaleX(0); }
.js .lviz.in .vz-bar { transform: none; transition: transform 1s var(--ease) calc(var(--d) * 120ms + 200ms); }
.lviz-cap { margin-top: 6px; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.law:hover .lviz { border-color: var(--accent); }

/* =========================================================
   Information architecture: topic directory & topic pages
   ========================================================= */

/* home: topic directory */
.topic-dir { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 14px; }
.topic-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 16px; text-decoration: none; border-radius: var(--r); background: var(--glass); border: 1px solid var(--hair); transition: transform 0.5s var(--ease), border-color 0.3s, background 0.3s; overflow: hidden; }
.topic-card:hover, .topic-card:focus-visible { transform: translateY(-4px); background: var(--surface); }
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.topic-card h3 { font-size: 1.6rem; font-weight: 300; letter-spacing: -0.03em; }
.tc-tag { color: var(--ink-2); font-size: 0.92rem; line-height: 1.45; }
.tc-ch { list-style: none; margin: 4px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--faint); display: grid; gap: 4px; }
.tc-ch li { display: flex; gap: 10px; align-items: baseline; font-size: 0.86rem; color: var(--dim); }
.tc-ch b { font-family: var(--mono); font-size: 0.66rem; font-weight: 600; color: var(--accent); width: 12px; }
.tc-foot { margin-top: auto; padding-top: 12px; display: flex; justify-content: space-between; }
.tc-foot .acc { transition: transform 0.3s var(--ease); }
.topic-card:hover .tc-foot .acc { transform: translateX(4px); }
.tc-frame { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.9s var(--ease); }
.topic-card:hover .tc-frame, .topic-card:focus-visible .tc-frame { stroke-dashoffset: 0; opacity: 1; }
.js .topic-card { opacity: 0; transform: translateY(18px); }
.js .topic-dir.in .topic-card { opacity: 1; transform: none; transition: opacity 0.7s var(--ease) calc(var(--i) * 60ms), transform 0.7s var(--ease) calc(var(--i) * 60ms), border-color 0.3s, background 0.3s; }
.js .topic-dir.in .topic-card:hover { transform: translateY(-4px); transition-delay: 0s; }

/* home: start here */
.start-here { margin-top: 72px; display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr); gap: 48px; align-items: start; }
.sh-head { position: sticky; top: calc(var(--header) + 32px); }
.sh-head h3 { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 300; letter-spacing: -0.035em; line-height: 1.05; margin-bottom: 12px; }
.sh-head h3 em { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.1em; }
.sh-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--hair); }
.sh-list a { display: grid; grid-template-columns: 40px 36px 1fr auto; gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--hair); text-decoration: none; transition: background 0.25s, padding 0.35s var(--ease); }
.sh-list a:hover { background: var(--accent-dim); padding-left: 14px; }
.sh-n { font-family: var(--dot); font-weight: 900; font-size: 1.5rem; color: var(--accent); }
.sh-t { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sh-t b { font-weight: 400; font-size: 1.1rem; }
.sh-t span { font-size: 0.88rem; color: var(--dim); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sh-go { white-space: nowrap; }
@media (max-width: 900px) { .start-here { grid-template-columns: 1fr; gap: 20px; } .sh-head { position: static; } }
@media (max-width: 600px) { .sh-list a { grid-template-columns: 30px 36px 1fr; } .sh-go { display: none; } }

/* topic pages */
.topic-page { padding-top: 28px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.crumbs a { text-decoration: none; color: var(--dim); }
.crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--ink); }
.topic-page .topic-head { margin-bottom: 48px; }
.topic-page .tabbar-wrap { margin-bottom: 0; }
.tab { text-decoration: none; }
.chips { display: none; }
.topic-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 48px; align-items: start; padding-top: 40px; }
.rail { position: sticky; top: calc(var(--header) + 80px); max-height: calc(100vh - var(--header) - 100px); overflow-y: auto; padding-left: 14px; border-left: 1px solid var(--hair); }
.rail::before { content: ""; position: absolute; left: -1px; top: 0; width: 2px; height: calc(var(--rp, 0) * 100%); background: var(--accent); transition: height 0.5s var(--ease); }
.rail > .tx { margin-bottom: 12px; }
.rail ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail ol a { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: baseline; padding: 8px 8px; border-radius: 6px; text-decoration: none; color: var(--dim); font-size: 0.92rem; transition: color 0.2s, background 0.2s; }
.rail ol a:hover { color: var(--ink); background: var(--hair); }
.rail ol a.on { color: var(--ink); background: var(--accent-dim); }
.ch-n { font-family: var(--mono); font-size: 0.7rem; font-weight: 600; color: var(--accent); }
.ch-c { font-family: var(--mono); font-size: 0.66rem; color: var(--dim); }
.rail-next { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; padding: 14px 8px 0; border-top: 1px dashed var(--faint); text-decoration: none; font-size: 0.92rem; }
.rail-next .tx { width: 100%; }
.rail-next:hover { color: var(--accent); }
.chapter { scroll-margin-top: calc(var(--header) + 72px); padding-bottom: 56px; }
.ch-head { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: start; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--faint); }
.ch-letter { font-family: var(--dot); font-weight: 900; font-size: clamp(3rem, 6vw, 4.6rem); line-height: 0.85; color: var(--accent); }
.ch-head h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); font-weight: 300; letter-spacing: -0.03em; margin: 4px 0 6px; }
.ch-head p:not(.tx) { color: var(--dim); max-width: 620px; }
.js .ch-head.reveal { opacity: 0; transform: translateY(14px); }
.js .ch-head.reveal.in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.law h3 { font-size: 1.3rem; font-weight: 400; letter-spacing: -0.02em; }
.law { scroll-margin-top: calc(var(--header) + 90px); }
.law-link { margin-left: 2px; font-family: var(--mono); font-size: 0.8rem; color: var(--dim); text-decoration: none; opacity: 0; transition: opacity 0.2s; }
.law:hover .law-link, .law-link:focus-visible { opacity: 1; }
.law-link:hover { color: var(--accent); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.pager-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; border: 1px solid var(--hair); border-radius: var(--r); background: var(--glass); text-decoration: none; transition: border-color 0.3s, transform 0.4s var(--ease); }
.pager-card.next { text-align: right; align-items: flex-end; }
.pager-card:hover { border-color: var(--accent); transform: translateY(-3px); }
.pager-t { display: inline-flex; align-items: center; gap: 12px; font-size: 1.3rem; font-weight: 300; }
.topic-note { margin: 40px auto 24px; padding-top: 16px; border-top: 1px dashed var(--faint); line-height: 1.8; }
.topic-note a { color: var(--accent); }
@media (max-width: 1000px) {
  .topic-layout { grid-template-columns: 1fr; padding-top: 0; }
  .rail { display: none; }
  .chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; position: sticky; top: calc(var(--header) + 54px); z-index: 39; padding: 10px 16px; border-bottom: 1px solid var(--hair); background: var(--bg); }
  .chips::-webkit-scrollbar { display: none; }
  .chips a { flex: none; display: inline-flex; gap: 8px; align-items: center; padding: 7px 12px; border: 1px solid var(--hair); border-radius: 999px; font-size: 0.85rem; text-decoration: none; color: var(--dim); white-space: nowrap; transition: all 0.2s; }
  .chips a b { font-family: var(--mono); font-size: 0.68rem; color: var(--accent); }
  .chips a.on { color: var(--on-accent); background: var(--accent); border-color: var(--accent); }
  .chips a.on b { color: var(--on-accent); }
  .topic-layout .chapter:first-child { padding-top: 28px; }
  .chapter { scroll-margin-top: calc(var(--header) + 120px); }
}
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager-card.next { text-align: left; align-items: flex-start; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js .law, .js .section-head, .js .tl, .js .flip, .js .topic-card, .js .ch-head.reveal { opacity: 1; transform: none; }
  .js .split.ready .w > span { transform: none; }
  .js .ios-glyph { stroke-dashoffset: 0; }
  .bgl { translate: none; }
}

/* ---------- The UK essentials ---------- */
.ess-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 14px; }
.ess-tile { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 20px 20px 16px; text-decoration: none; border-radius: var(--r); background: var(--glass); border: 1px solid var(--hair); transition: transform 0.5s var(--ease), border-color 0.3s, background 0.3s; }
.ess-tile:hover, .ess-tile:focus-visible { transform: translateY(-4px); background: var(--surface); border-color: var(--accent); }
.ess-tile:hover .lviz { border-color: var(--accent); }
.et-top { display: flex; align-items: center; gap: 10px; }
.ess-tile h3 { font-size: 1.35rem; font-weight: 400; letter-spacing: -0.02em; line-height: 1.15; }
.et-rule { color: var(--ink-2); font-size: 0.92rem; line-height: 1.45; }
.ess-tile .tc-foot .acc { transition: transform 0.3s var(--ease); }
.ess-tile:hover .tc-foot .acc { transform: translateX(4px); }
.js .ess-tile { opacity: 0; transform: translateY(18px); }
.js .ess-grid.in .ess-tile { opacity: 1; transform: none; transition: opacity 0.7s var(--ease) calc(var(--i) * 60ms), transform 0.7s var(--ease) calc(var(--i) * 60ms), border-color 0.3s, background 0.3s; }
.js .ess-grid.in .ess-tile:hover { transform: translateY(-4px); transition-delay: 0s; }
.ess-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; margin-top: 28px; }

.ess-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-self: center; }
.ess-index a { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--hair); border-radius: var(--r); background: var(--glass); text-decoration: none; transition: border-color 0.3s, transform 0.4s var(--ease), background 0.3s; }
.ess-index a .ios { grid-row: span 2; }
.ess-index a b { font-weight: 400; font-size: 0.98rem; line-height: 1.2; }
.ess-index a:hover { border-color: var(--accent); background: var(--surface); transform: translateX(3px); }
.js .ess-index a { opacity: 0; transform: translateY(10px); }
.js .ess-index.in a { opacity: 1; transform: none; transition: opacity 0.6s var(--ease) calc(var(--i) * 50ms), transform 0.6s var(--ease) calc(var(--i) * 50ms), border-color 0.3s, background 0.3s; }
.ch-icon { line-height: 0; }
.ess-rule { font-size: 1.02rem; line-height: 1.45; color: var(--ink); padding-left: 12px; border-left: 2px solid var(--accent); }
.ess-law { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--faint); text-decoration: none; color: var(--accent); }
.ess-law span { min-width: 0; text-align: left; }
.ess-law b { transition: transform 0.3s var(--ease); }
.ess-law:hover b { transform: translateX(4px); }
@media (max-width: 1000px) { .ess-chips { top: var(--header) !important; } }

/* What it means for you / Do this */
.tip { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-dim); font-size: 0.92rem; line-height: 1.5; color: var(--ink); }
.tip-k { display: flex; align-items: center; gap: 8px; color: var(--accent); }
.tip.do { background: color-mix(in srgb, #2fbf71 12%, transparent); }
.tip.do .tip-k { color: #2fbf71; }
:root[data-theme="light"] .tip.do .tip-k { color: #1b8a4f; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .tip.do .tip-k { color: #1b8a4f; } }

/* chapter map: one stop per law */
.ch-map { list-style: none; margin: 14px 0 0; padding: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 8px; position: relative; }
.ch-map::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: linear-gradient(90deg, var(--accent), var(--faint) 60%, transparent); transform-origin: 0 50%; }
.js .ch-map::before { transform: scaleX(0); }
.js .ch-map.in::before { transform: none; transition: transform 1.2s var(--ease); }
.ch-map a { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 8px; border: 1px solid var(--hair); border-radius: 999px; text-decoration: none; font-size: 0.82rem; color: var(--ink-2); background: var(--glass); transition: border-color 0.2s, color 0.2s, background 0.2s; }
.ch-map a .tx { font-size: 0.62rem; }
.ch-map a i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--accent); flex: none; transition: background 0.2s; }
.ch-map a:hover { border-color: var(--accent); color: var(--ink); background: var(--accent-dim); }
.ch-map a:hover i { background: var(--accent); }
.js .ch-map li { opacity: 0; transform: translateY(6px); }
.js .ch-map.in li { opacity: 1; transform: none; transition: opacity 0.5s var(--ease) calc(var(--i) * 40ms + 200ms), transform 0.5s var(--ease) calc(var(--i) * 40ms + 200ms); }

/* key numbers strip */
.keynums { margin-bottom: 48px; }
.keynums > .tx { margin-bottom: 12px; }
.keynums ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.keynums a { position: relative; display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 16px 16px 14px; border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); text-decoration: none; transition: background 0.25s; }
.keynums a::after { content: ""; position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.4s var(--ease); }
.keynums a:hover { background: var(--surface); }
.keynums a:hover::after { transform: none; }
.kn-v { font-family: var(--dot); font-weight: 900; font-size: clamp(2rem, 3.4vw, 2.6rem); line-height: 1; color: var(--ink); }
.keynums li:first-child .kn-v { color: var(--accent); }
.kn-u { color: var(--accent); }
.kn-l { font-size: 0.86rem; color: var(--ink-2); line-height: 1.35; }
.kn-t { margin-top: auto; padding-top: 8px; color: var(--dim); }
.js .keynums li { opacity: 0; transform: translateY(10px); }
.js .keynums.in li { opacity: 1; transform: none; transition: opacity 0.6s var(--ease) calc(var(--i) * 70ms), transform 0.6s var(--ease) calc(var(--i) * 70ms); }

@media (prefers-reduced-motion: reduce) {
  .js .ess-tile, .js .ess-index a, .js .ch-map li, .js .keynums li { opacity: 1; transform: none; }
  .js .ch-map::before { transform: none; }
}

/* =========================================================
   Microinteractions
   ========================================================= */
/* Smooth page-to-page transitions where the browser supports them */
@view-transition { navigation: auto; }
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: vtOut 0.28s var(--ease) both; }
  ::view-transition-new(root) { animation: vtIn 0.42s var(--ease) both; }
}
@keyframes vtOut { to { opacity: 0; transform: translateY(-8px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 300; display: inline-flex; align-items: center; gap: 10px; padding: 11px 16px; border: 1px solid var(--faint); border-radius: 999px; background: var(--bg); box-shadow: var(--shadow); font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); opacity: 0; pointer-events: none; transform: translate(-50%, 16px) scale(0.96); transition: opacity 0.3s var(--ease), transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 rgba(var(--acc-rgb), 0.6); animation: tdot 1.2s ease-out infinite; }
@keyframes tdot { to { box-shadow: 0 0 0 10px rgba(var(--acc-rgb), 0); } }

/* Ripple */
.has-ripple { overflow: hidden; isolation: isolate; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: 0.18; transform: scale(0); pointer-events: none; z-index: -1; animation: ripple 0.65s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* Press feedback */
.btn, .icon-btn, .filter, .to-top, .tab, .chips a, .ch-map a, .ess-index a, .q-options button, .rail ol a, .menu-nav a { transition-property: background, color, border-color, transform, scale, translate, box-shadow; }
.btn:active, .icon-btn:active, .filter:active, .to-top:active, .chips a:active, .ch-map a:active, .q-options button:active, .tab:active { scale: 0.95; transition-duration: 0.08s; }
.topic-card:active, .ess-tile:active, .pager-card:active, .sh-list a:active, .keynums a:active, .ess-index a:active { scale: 0.985; transition-duration: 0.1s; }

/* Magnet */
.btn, .icon-btn, .to-top, .logo { translate: var(--mgx, 0) var(--mgy, 0); transition: translate 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s, scale 0.12s; }
.magnet-on { transition-duration: 0.12s, 0.2s, 0.2s, 0.2s, 0.2s, 0.12s; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
#themeToggle:hover svg { transform: rotate(-25deg) scale(1.1); }
#searchOpen:hover svg { transform: scale(1.12) rotate(-8deg); }
.btn.primary { box-shadow: 0 0 0 0 rgba(var(--acc-rgb), 0.5); }
.btn.primary:hover { box-shadow: 0 0 0 6px rgba(var(--acc-rgb), 0); transition: box-shadow 0.6s var(--ease), background 0.2s, color 0.2s, translate 0.12s; }

/* Spotlight inside cards */
.spot { background-image: radial-gradient(280px circle at var(--sx, -999px) var(--sy, -999px), rgba(var(--acc-rgb), 0.09), transparent 65%); }
.spot:not(:hover) { background-image: none; }

/* Header */
.site-header { transition: box-shadow 0.3s, border-color 0.3s; }
.site-header.scrolled { box-shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.6); }
.main-nav a { position: relative; }
.main-nav a::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 1.5px; background: var(--accent); transform: scaleX(0); transform-origin: 100% 50%; transition: transform 0.35s var(--ease); }
.main-nav a:hover::after, .main-nav a:focus-visible::after { transform: scaleX(1); transform-origin: 0 50%; }
.main-nav a .tab-n { transition: transform 0.3s var(--ease); display: inline-block; }
.main-nav a:hover .tab-n { transform: translateY(-2px); }
.logo:hover .logo-mark { animation: balance 1.1s var(--ease); }
@keyframes balance { 0% { transform: rotate(0); } 25% { transform: rotate(-10deg); } 50% { transform: rotate(7deg); } 75% { transform: rotate(-3deg); } 100% { transform: rotate(0); } }
.logo-mark { transform-origin: 50% 20%; }

/* Back to top: a ring that fills as you scroll */
.to-top { border-radius: 50%; }
.to-top::before { content: ""; position: absolute; inset: -2px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--pp, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px)); }
.to-top:hover { transform: translateY(-3px); }

/* Icons react inside whatever you hover */
.law:hover .law-top .ios, .topic-card:hover .tc-top .ios, .ess-tile:hover .et-top .ios, .pager-card:hover .ios, .tab:hover .ios, .menu-nav a:hover .ios, .sh-list a:hover .ios, .ess-index a:hover .ios, .rail-next:hover .ios, .ess-law:hover .ios, .fact:hover .ios { transform: rotate(-8deg) scale(1.14); }
.tip:hover .tip-k .ios { animation: wiggle 0.6s var(--ease); }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-14deg) scale(1.12); } 60% { transform: rotate(10deg); } }

/* Law cards */
.law h3 { transition: color 0.25s; }
.law:hover h3 { color: var(--accent); }
.law-year { transition: letter-spacing 0.4s var(--ease); }
.law:hover .law-year { letter-spacing: 0.06em; }
.law-link { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 6px; transition: opacity 0.2s, background 0.2s, color 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.law-link:hover { background: var(--accent-dim); }
.law-link.copied { opacity: 1; color: #2fbf71; transform: scale(1.25); }
.law summary { transition: color 0.2s, letter-spacing 0.3s var(--ease); }
.law summary:hover { letter-spacing: 0.12em; }
@media (prefers-reduced-motion: no-preference) {
  .law details[open] li { animation: liIn 0.45s var(--ease) both; animation-delay: calc(var(--li, 0) * 60ms); }
  .law details[open] li::before { animation: liLine 0.5s var(--ease) both; animation-delay: calc(var(--li, 0) * 60ms + 120ms); }
}
@keyframes liIn { from { opacity: 0; transform: translateX(-8px); } }
@keyframes liLine { from { transform: scaleX(0); } }
.law li::before { transform-origin: 0 50%; }
.scope { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.scope:hover { transform: scale(1.12); }

/* Diagrams: click to replay */
.lviz { position: relative; cursor: pointer; transition: border-color 0.3s, background-color 0.3s; }
.lviz::after { content: "↻ REPLAY"; position: absolute; right: 8px; top: 6px; font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.08em; color: var(--accent); opacity: 0; transform: translateY(-3px); transition: opacity 0.2s, transform 0.3s var(--ease); }
.lviz:hover::after { opacity: 1; transform: none; }
.lviz.replayed { animation: vizPulse 0.5s var(--ease); }
@keyframes vizPulse { 30% { background-color: var(--accent-dim); } }
.lviz:hover .vz-bar { filter: brightness(1.15); }

/* Tips and the essentials checklist */
.tip { transition: transform 0.3s var(--ease), box-shadow 0.3s, background 0.3s; }
.tip:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -18px rgba(var(--acc-rgb), 0.9); }
.tip.do { cursor: pointer; user-select: none; }
.tip.do .tip-k { position: relative; }
.tip.do .tip-k::after { content: ""; margin-left: auto; width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid currentColor; opacity: 0.6; transition: background 0.25s, opacity 0.25s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tip.do:hover .tip-k::after { opacity: 1; transform: scale(1.1); }
.tip.do.done .tip-k::after { opacity: 1; background: #2fbf71 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; border-color: #2fbf71; transform: scale(1.15); }
.tip.do.done { background: color-mix(in srgb, #2fbf71 20%, transparent); }
.law.ess.is-done { border-color: color-mix(in srgb, #2fbf71 45%, transparent); }
.law.ess.is-done h3 { text-decoration: line-through; text-decoration-color: #2fbf71; text-decoration-thickness: 1.5px; }
.spark { position: absolute; right: 9px; top: 50%; width: 4px; height: 4px; border-radius: 50%; background: #2fbf71; pointer-events: none; animation: spark 0.7s var(--ease) forwards; }
@keyframes spark { from { transform: rotate(var(--a)) translateX(0); opacity: 1; } to { transform: rotate(var(--a)) translateX(26px); opacity: 0; } }
.ess-meter { margin-top: 22px; padding: 14px 16px; border: 1px solid var(--hair); border-radius: var(--r); background: var(--glass); }
.em-top { display: flex; justify-content: space-between; align-items: baseline; }
.em-top b { font-family: var(--dot); font-weight: 900; font-size: 1.3rem; color: var(--ink); }
.em-bar { margin-top: 10px; height: 6px; border-radius: 999px; background: var(--hair); overflow: hidden; }
.em-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--accent), #2fbf71); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1); }
.em-hint { margin-top: 8px; font-size: 0.82rem; color: var(--dim); }
.ess-meter.all { border-color: #2fbf71; }

/* Chapter maps light up the law you're reading */
.ch-map a.here { border-color: var(--accent); color: var(--ink); background: var(--accent-dim); }
.ch-map a.here i { background: var(--accent); box-shadow: 0 0 0 4px rgba(var(--acc-rgb), 0.2); }

/* Rails, chips and lists */
.rail ol a .ch-name { transition: transform 0.3s var(--ease); }
.rail ol a:hover .ch-name { transform: translateX(4px); }
.rail ol a.on .ch-n { animation: blip 0.5s var(--ease); }
@keyframes blip { 50% { transform: scale(1.4); } }
.chips a { transition: background 0.2s, color 0.2s, border-color 0.2s, scale 0.1s; }
.sh-list a .sh-n { transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); display: inline-block; }
.sh-list a:hover .sh-n { transform: scale(1.2) rotate(-6deg); }
.keynums a:hover .kn-v { color: var(--accent); }
.kn-v { transition: color 0.25s; }
.fact { transition: transform 0.35s var(--ease); }
.fact:hover { transform: translateX(4px); }
.tc-ch li { transition: color 0.2s, transform 0.3s var(--ease); }
.topic-card:hover .tc-ch li { color: var(--ink-2); }
.topic-card:hover .tc-ch li:nth-child(1) { transform: translateX(3px); transition-delay: 0s; }
.topic-card:hover .tc-ch li:nth-child(2) { transform: translateX(3px); transition-delay: 0.04s; }
.topic-card:hover .tc-ch li:nth-child(3) { transform: translateX(3px); transition-delay: 0.08s; }
.topic-card:hover .tc-ch li:nth-child(4) { transform: translateX(3px); transition-delay: 0.12s; }
.topic-card:hover .tc-ch li:nth-child(5) { transform: translateX(3px); transition-delay: 0.16s; }
.search-results li button { transition: background 0.2s, padding 0.3s var(--ease); }
.search-results li button:hover, .search-results li button:focus-visible { padding-left: 22px; }
.crumbs a { position: relative; transition: color 0.2s; }
.filter:hover { border-color: var(--accent); color: var(--ink); }
.tab .ios { transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }

/* Focus: a ring that pops in */
:focus-visible { transition: outline-offset 0.15s; }
@media (prefers-reduced-motion: no-preference) { :focus-visible { animation: focusPop 0.3s var(--ease); } }
@keyframes focusPop { from { outline-offset: 7px; } }

/* Links in body text get an animated underline */
.topic-note a, .intro a, .muted a { text-decoration: none; background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 0.35s var(--ease); }
.topic-note a:hover, .intro a:hover, .muted a:hover { background-size: 100% 1px; }

@media (prefers-reduced-motion: reduce) {
  .btn, .icon-btn, .to-top, .logo { translate: none; }
  .law:hover .law-top .ios, .topic-card:hover .tc-top .ios, .ess-tile:hover .et-top .ios, .tab:hover .ios { transform: none; }
  .tip:hover, .fact:hover, .to-top:hover { transform: none; }
  .logo:hover .logo-mark, .tip:hover .tip-k .ios, .toast-dot, .lviz.replayed { animation: none; }
  .ripple, .spark, }

/* =========================================================
   Microinteractions, round two
   ========================================================= */
/* Everything eases in */
.js .rv { opacity: 0; transform: translateY(14px); }
.js .rv.rv-in { opacity: 1; transform: none; transition: opacity 0.7s var(--ease) calc(var(--rvi, 0) * 60ms), transform 0.8s var(--ease) calc(var(--rvi, 0) * 60ms); }
.js .rv.rv-load.rv-in { transition-delay: calc(var(--rvi, 0) * 60ms + 120ms); }

/* Tooltips */
.tt { position: fixed; z-index: 500; max-width: 240px; padding: 6px 10px; border-radius: 6px; background: var(--ink); color: var(--bg); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; pointer-events: none; opacity: 0; transform: translateY(4px) scale(0.96); transition: opacity 0.18s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.tt.below { transform: translateY(-4px) scale(0.96); }
.tt.on { opacity: 1; transform: none; }

/* Link previews */
.pv { position: fixed; z-index: 450; width: 290px; padding: 12px 14px; border: 1px solid var(--faint); border-radius: var(--r); background: var(--bg); box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; pointer-events: none; opacity: 0; transform: translateY(-6px); transition: opacity 0.2s, transform 0.35s var(--ease); }
.pv.on { opacity: 1; transform: none; }
.pv b { font-weight: 500; font-size: 0.95rem; }
.pv span { font-size: 0.84rem; color: var(--ink-2); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pv i { font-style: normal; color: var(--accent); }

/* Law years: hover shows how long ago */
.law-year.has-ago { position: relative; display: inline-block; align-self: flex-start; }
.law-year.has-ago::after { content: attr(data-ago); position: absolute; left: 100%; top: 50%; margin-left: 12px; white-space: nowrap; font-family: var(--mono); font-size: 0.64rem; font-weight: 400; letter-spacing: 0.08em; color: var(--dim); opacity: 0; transform: translate(-6px, -50%); transition: opacity 0.25s, transform 0.35s var(--ease); }
.law:hover .law-year.has-ago::after { opacity: 1; transform: translate(0, -50%); }

/* Reading progress */
.read-meter { display: flex; flex-direction: column; gap: 6px; margin: 0 0 14px; }
.read-meter b { color: var(--ink); font-weight: 600; }
.rm-bar { height: 3px; border-radius: 3px; background: var(--hair); overflow: hidden; }
.rm-bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--p, 0)); transform-origin: 0 50%; transition: transform 0.7s var(--ease); }
.rail ol a { position: relative; }
.rail ol a::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 2px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) calc(var(--read, 0) * 100%), transparent 0); opacity: 0.55; transition: opacity 0.3s; }
.rail ol a.read-all .ch-c::after { content: " ✓"; color: #2fbf71; }
.law.seen .law-top > .tx::after { content: " · READ"; color: #2fbf71; }
.tc-read { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 8px; color: #2fbf71; }
.tc-read svg { width: 16px; height: 16px; transform: rotate(-90deg); }
.tc-read circle { fill: none; stroke: var(--hair); stroke-width: 2.5; }
.tc-read circle.p { stroke: #2fbf71; stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--p)); transition: stroke-dashoffset 1s var(--ease); }

/* Quote popover */
.quote-pop { position: fixed; z-index: 460; display: flex; gap: 2px; padding: 4px; border-radius: 999px; background: var(--ink); box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translateY(6px) scale(0.9); transition: opacity 0.2s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.quote-pop.on { opacity: 1; pointer-events: auto; transform: none; }
.quote-pop button { border: 0; background: transparent; color: var(--bg); padding: 6px 12px; border-radius: 999px; font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.06em; text-transform: uppercase; cursor: pointer; transition: background 0.2s, color 0.2s; }
.quote-pop button:hover { background: var(--accent); color: var(--on-accent); }

/* Keyboard shortcuts panel */
.kb-help { position: fixed; inset: 0; z-index: 480; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(6px); opacity: 0; transition: opacity 0.25s; }
.kb-help[hidden] { display: none; }
.kb-help.on { opacity: 1; }
.kb-card { width: min(380px, 100%); padding: 22px; border: 1px solid var(--faint); border-radius: var(--r); background: var(--bg); box-shadow: var(--shadow); transform: translateY(14px) scale(0.97); transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.kb-help.on .kb-card { transform: none; }
.kb-card dl { margin: 14px 0 0; display: grid; gap: 8px; }
.kb-card dl div { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.kb-card dd { margin: 0; color: var(--ink-2); }
kbd { display: inline-block; min-width: 26px; padding: 3px 8px; border: 1px solid var(--faint); border-bottom-width: 2px; border-radius: 6px; font-family: var(--mono); font-size: 0.72rem; text-align: center; background: var(--surface); }

/* Gavel easter egg */
body.order main { animation: gavel 0.5s var(--ease); }
@keyframes gavel { 15% { transform: translateY(4px); } 30% { transform: translateY(-2px); } 45% { transform: translateY(2px); } 100% { transform: none; } }

/* Skyline leans */
.skyline svg { transform: translateX(var(--kx, 0)); transition: transform 1.2s var(--ease); }

/* Weird grid reshuffles */
@keyframes shuf { from { opacity: 0; transform: translateY(10px) scale(0.97); } }

/* Age slider bubble */
.age-bubble { position: absolute; top: -34px; transform: translateX(-50%) scale(0.6); padding: 4px 10px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-family: var(--dot); font-weight: 900; font-size: 1rem; pointer-events: none; opacity: 0; transition: opacity 0.2s, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.age-bubble.on { opacity: 1; transform: translateX(-50%) scale(1); }

/* Search overlay and menu ease in */
@media (prefers-reduced-motion: no-preference) {
  .search-overlay:not([hidden]) .search-box, .search-overlay:not([hidden]) > div { animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .search-results li { animation: liIn 0.35s var(--ease) both; }
  .search-results li:nth-child(2) { animation-delay: 30ms; } .search-results li:nth-child(3) { animation-delay: 60ms; }
  .search-results li:nth-child(4) { animation-delay: 90ms; } .search-results li:nth-child(5) { animation-delay: 120ms; }
  .search-results li:nth-child(n+6) { animation-delay: 150ms; }
  .menu.open .menu-nav > a, .menu.open .menu-sub a { animation: liIn 0.45s var(--ease) both; }
  .menu.open .menu-nav > a:nth-child(2) { animation-delay: 40ms; } .menu.open .menu-nav > a:nth-child(3) { animation-delay: 80ms; }
  .menu.open .menu-nav > a:nth-child(4) { animation-delay: 120ms; } .menu.open .menu-nav > a:nth-child(5) { animation-delay: 160ms; }
  .menu.open .menu-nav > a:nth-child(n+6) { animation-delay: 200ms; }
  .menu.open .menu-sub a { animation-delay: 140ms; }
  .q-opt.correct { animation: winPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }
  .section-head h2 em, .h2 em { background: linear-gradient(var(--accent), var(--accent)) 0 96% / 0 2px no-repeat; transition: background-size 1.2s var(--ease) 0.6s; }
  .section-head.in h2 em, .split.in em { background-size: 100% 2px; }
}
@keyframes popIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }
@keyframes winPop { 40% { transform: scale(1.04); } }

/* Line graphics: law meta strip and chapter timeline */
.lmeta { padding: 6px 0 2px; border-top: 1px dashed var(--faint); border-bottom: 1px dashed var(--faint); }
.lmeta svg { display: block; width: 100%; height: auto; overflow: visible; }
.lmeta .tx { font-size: 7.6px; }
.lmeta .tx.mini { font-size: 6.2px; }
.lmeta .tx.mini.off, :is(.fig-lite) .tx.mini.off { fill: var(--dim); }
.ch-tl { margin: -6px 0 22px; }
.ch-tl > .tx { margin-bottom: 4px; }
.ch-tl svg { display: block; width: 100%; height: auto; overflow: visible; }
.ch-tl .tx.mini { font-size: 7px; fill: var(--dim); }
.ch-tl .pulse, .lmeta .pulse { fill: var(--accent); }
.js .ch-tl.in .pulse { opacity: 1; transition: opacity 0.6s 1.4s; }

/* "In practice" lists drawn as a connected line */
.law details ul { position: relative; padding-left: 4px; }
.law details ul::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--accent), var(--faint)); transform-origin: 50% 0; }
.law details li { padding-left: 24px; }
.law details li::before { left: 2px; top: 0.5em; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--accent); background: var(--bg); }
@media (prefers-reduced-motion: no-preference) {
  .law details[open] ul::before { animation: lineDown 0.7s var(--ease) both; }
  .law details[open] li::before { animation: nodePop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both; animation-delay: calc(var(--li, 0) * 80ms + 150ms); }
}
@keyframes lineDown { from { transform: scaleY(0); } }
@keyframes nodePop { from { transform: scale(0); } }

@media (prefers-reduced-motion: reduce) {
  .js .rv { opacity: 1; transform: none; filter: none; }
  .tt, .pv, .quote-pop, .kb-card, .age-bubble { transition: opacity 0.15s; }
  .skyline svg { transform: none; }
  body.order main, #weirdGrid.shuffle .flip { animation: none; }
}

/* ---------- Display type, dot cursor, speed ---------- */
.hero h1, .h2, .section-head h2, .topic-head h1, .sh-head h3, .ch-head h2, .law h3, .tc-name, .ess-hero h1 { font-family: var(--display); font-optical-sizing: none; font-variation-settings: "opsz" 48; }
.hero h1 { font-weight: 560; letter-spacing: -0.035em; line-height: 0.95; text-wrap: balance; }
.h2, .section-head h2, .topic-head h1, .sh-head h3 { font-weight: 450; letter-spacing: -0.035em; }
.ch-head h2 { font-weight: 500; letter-spacing: -0.025em; }
.law h3 { font-weight: 500; letter-spacing: -0.015em; }
.hero h1 em, .h2 em, .topic-head h1 em, .sh-head h3 em { font-weight: 400; letter-spacing: -0.01em; }

@media (hover: hover) and (pointer: fine) {
  html.has-dot, html.has-dot * { cursor: none !important; }
  html.has-dot input:not([type=range]):not([type=checkbox]):not([type=radio]), html.has-dot textarea, html.has-dot [contenteditable] { cursor: text !important; }
}
.cursor-dot { position: fixed; left: 0; top: 0; z-index: 9999; width: 0; height: 0; pointer-events: none; opacity: 0; transition: opacity 0.2s; will-change: transform; }
.cursor-dot.on { opacity: 1; }
.cursor-dot.text { opacity: 0; }
.cursor-dot::before { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #fff; mix-blend-mode: difference; transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.cursor-dot.hover::before { transform: scale(1.6); }
.cursor-dot.down::before { transform: scale(0.7); }
.cursor-dot { mix-blend-mode: difference; }

svg.paused, svg.paused * { animation-play-state: paused !important; }
.hero h1 em { font-family: var(--display); font-style: normal; font-weight: 560; letter-spacing: -0.035em; font-size: 1em; line-height: inherit; }
.made-by { margin-top: 18px; margin-bottom: 0; padding-bottom: 8px; text-align: center; font-family: var(--display); font-size: 0.95rem; font-weight: 500; letter-spacing: -0.01em; color: var(--ink-2); }
@media (max-width: 600px) { .made-by { text-align: left; padding-bottom: 20px; } }
