/* ==========================================================================
   SELF-HOSTED FONTS: GEIST (400-800) & JETBRAINS MONO (400-700)
   ========================================================================== */
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwRGFWfOw.woff2) format("woff2");
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwYGFWfOw.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwTGFWfOw.woff2) format("woff2");
  unicode-range:
    U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301,
    U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwSGFWfOw.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwcGFU.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: "Geist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwSGFWfOw.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwcGFU.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: "Geist";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwSGFWfOw.woff2) format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(./fonts/geist-gyByhwUxId8gMEwcGFU.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrainsmono-tDbv2o-flEEny0FZhsfKu5WU4zr3EBX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(./fonts/jetbrainsmono-tDbv2o-flEEny0FZhsfKu5WU4zr3EBX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./fonts/jetbrainsmono-tDbv2o-flEEny0FZhsfKu5WU4zr3EBX0PnT8RD8yKwBNntkaToggR7BYRbKPx7cwhsk.woff2)
    format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F,
    U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(./fonts/jetbrainsmono-tDbv2o-flEEny0FZhsfKu5WU4zr3EBX0PnT8RD8yKwBNntkaToggR7BYRbKPxDcwg.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;
}

/* ==========================================================================
   TOKENS & BASE
   ========================================================================== */
:root {
  --bg: #11141a;
  --surface: #191e26;
  --surface-elevated: #222a35;
  --surface-subtle: #161b23;
  --text-main: #f3f5f8;
  --text-dim: #bdc8d6;
  --text-meta: #a1afbf;
  --line: rgb(227 234 245 / 11%);
  --line-strong: rgb(227 234 245 / 23%);
  --accent: #65dce9;
  --accent-hover: #9deaf3;
  --accent-soft: rgb(101 220 233 / 11%);
  --accent-border: rgb(101 220 233 / 42%);
  --warn-border: rgb(245 158 11 / 38%);
  --warn-bg: rgb(245 158 11 / 7%);
  --warn-text: #fbbf24;
  --card-radius: 14px;
  --subpanel-radius: 10px;
  --control-radius: 8px;
  --pill-radius: 6px;
  --radius: 14px;
  --surface-hairline: inset 0 1px 0 0 rgba(255, 255, 255, 0.06);
  --shadow-card:
    var(--surface-hairline), 0 1px 2px rgba(0, 0, 0, 0.32), 0 10px 26px -14px rgba(0, 0, 0, 0.55);
  --shadow-subpanel: inset 0 1px 0 0 rgba(255, 255, 255, 0.04);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-press: cubic-bezier(0.2, 0, 0, 1);
  --duration-press: 100ms;
  --duration-fast: 150ms;
}

:root[data-palette="dark"] {
  --bg: #080806;
  --surface: #231d17;
  --surface-elevated: #352b22;
  --surface-subtle: #14110e;
  --text-main: #f7f1e7;
  --text-dim: #d6c6b3;
  --text-meta: #b6a48f;
  --line: rgb(235 215 184 / 12%);
  --line-strong: rgb(235 215 184 / 24%);
  --accent: #f0d9ae;
  --accent-hover: #fff0d2;
  --accent-soft: rgb(240 217 174 / 13%);
  --accent-border: rgb(240 217 174 / 44%);
  --warn-border: rgb(212 163 89 / 42%);
  --warn-bg: rgb(212 163 89 / 10%);
  --warn-text: #d4a359;
}

:root[data-palette="precision"] {
  --bg: #080d1a;
  --surface: #10192e;
  --surface-elevated: #172442;
  --surface-subtle: #0b1223;
  --text-main: #f2f6ff;
  --text-dim: #b6c7e8;
  --text-meta: #90a9d6;
  --line: rgb(118 165 255 / 20%);
  --line-strong: rgb(118 165 255 / 38%);
  --accent: #ccf53d;
  --accent-hover: #defa75;
  --accent-soft: rgb(204 245 61 / 12%);
  --accent-border: rgb(204 245 61 / 52%);
}

:root[data-palette="atelier"] {
  color-scheme: light;
  --bg: #f2efe9;
  --surface: #fbfaf7;
  --surface-elevated: #ffffff;
  --surface-subtle: #e7e3da;
  --text-main: #14171f;
  --text-dim: #39404e;
  --text-meta: #4c5565;
  --line: rgb(20 23 31 / 16%);
  --line-strong: rgb(20 23 31 / 30%);
  --accent: #a82a0e;
  --accent-hover: #872009;
  --accent-soft: rgb(168 42 14 / 10%);
  --accent-border: rgb(168 42 14 / 45%);
  --warn-border: rgb(138 73 0 / 42%);
  --warn-bg: rgb(138 73 0 / 10%);
  --warn-text: #8a4900;
}

:root[data-palette="monolith"] {
  --bg: #09090a;
  --surface: #161619;
  --surface-elevated: #212126;
  --surface-subtle: #101012;
  --text-main: #f5f5f1;
  --text-dim: #c5c5c0;
  --text-meta: #9e9e98;
  --line: rgb(245 245 241 / 16%);
  --line-strong: rgb(245 245 241 / 32%);
  --accent: #ff5c38;
  --accent-hover: #ff7e61;
  --accent-soft: rgb(255 92 56 / 14%);
  --accent-border: rgb(255 92 56 / 54%);
}

::selection {
  background: var(--accent-soft);
  color: var(--text-main);
}

input,
textarea,
select {
  caret-color: var(--accent);
}

p,
li,
dd {
  text-wrap: pretty;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text-main);
  font-family:
    "Geist",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  scrollbar-color: var(--line-strong) transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text-main);
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--accent-border);
}

@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--accent-hover);
    text-decoration-color: var(--accent-hover);
  }
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 16px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--control-radius);
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  font-size: 0.8125rem;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--duration-fast) var(--ease-out-expo);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--text-main);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   TOP BAR & LAYOUT SHELL
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.04);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  text-decoration: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-subpanel);
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

@media (hover: hover) and (pointer: fine) {
  .back-link:hover {
    color: var(--text-main);
    border-color: var(--line-strong);
    background: var(--surface-elevated);
  }
}

.back-link:active {
  transform: scale(0.975);
}

.topbar-meta {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.version-stamp {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--text-meta);
}

.lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  min-width: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-subpanel);
  color: var(--text-main);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

@media (hover: hover) and (pointer: fine) {
  .lang-btn:hover {
    border-color: var(--line-strong);
    background: var(--surface-elevated);
  }
}

.lang-btn:active {
  transform: scale(0.975);
}

.page-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

/* ==========================================================================
   HEADER / SUMMARY
   ========================================================================== */
.hero {
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
}

.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(1.625rem, 3vw, 2.25rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.hero-lead {
  margin: 0 0 18px;
  max-width: 72ch;
  color: var(--text-dim);
  font-size: 0.96875rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.stat-cell {
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--subpanel-radius);
  box-shadow: var(--shadow-subpanel);
  padding: 10px 12px;
}

.stat-num {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  display: block;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-meta);
}

.section-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8125rem;
}

.section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 8px;
  border-radius: var(--pill-radius);
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 500;
  transition:
    color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

.section-nav a:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .section-nav a:hover {
    color: var(--accent);
    background: var(--accent-soft);
    text-decoration: none;
  }
}

.section-nav a[aria-current="location"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ==========================================================================
   SECTIONS & EDITORIAL BLOCKS
   ========================================================================== */
.section-block {
  padding-top: 32px;
}

.section-head {
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0 0 6px;
  font-size: 1.3125rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.section-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.90625rem;
  max-width: 72ch;
}

.sub-heading {
  margin: 26px 0 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-main);
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.step-num {
  display: inline-block;
  margin-bottom: 6px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
}

.step-card h3 {
  margin: 0 0 6px;
  font-size: 0.96875rem;
  font-weight: 600;
}

.step-card p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84375rem;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table th {
  background: var(--surface-subtle);
  color: var(--text-meta);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.data-table td strong {
  color: var(--text-main);
}

.data-table td:first-child {
  font-weight: 600;
  color: var(--text-main);
  min-width: 150px;
}

.status-tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.6875rem;
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: var(--surface-subtle);
}

.status-tag.is-unused {
  border-color: var(--warn-border);
  color: var(--warn-text);
  background: var(--warn-bg);
}

/* Evidence ladder & clinical notice */
.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.panel-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.panel-box.is-caution {
  border-color: var(--warn-border);
  background: var(--warn-bg);
}

.panel-box h3 {
  margin: 0 0 10px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.ladder-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 0.84375rem;
}

.ladder-list li + li {
  margin-top: 6px;
}

.ladder-list strong {
  color: var(--text-main);
}

.limits-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-dim);
  font-size: 0.84375rem;
}

.limits-list li + li {
  margin-top: 6px;
}

/* ==========================================================================
   SOURCE DIRECTORY CONTROLS & CARDS
   ========================================================================== */
.directory-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
}

.search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.search-wrap {
  position: relative;
  flex: 1 1 280px;
}

.search-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 44px 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--bg);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.875rem;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    box-shadow var(--duration-fast) var(--ease-out-expo);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder {
  color: var(--text-meta);
}

.search-clear-btn {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--text-meta);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
}

.search-clear-btn[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .search-clear-btn:hover {
    color: var(--text-main);
    background: var(--surface-elevated);
  }
}

.result-count {
  margin: 0;
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.78125rem;
  color: var(--text-meta);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-pill {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-subtle);
  box-shadow: var(--shadow-subpanel);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

@media (hover: hover) and (pointer: fine) {
  .filter-pill:hover {
    border-color: var(--line-strong);
    color: var(--text-main);
  }
}

.filter-pill:active {
  transform: scale(0.97);
}

.filter-pill[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: var(--shadow-subpanel);
}

.source-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.source-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: 15px 16px;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo);
}

@media (hover: hover) and (pointer: fine) {
  .source-card:hover {
    border-color: var(--line-strong);
  }
}

.source-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 6px;
}

.source-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--surface-subtle);
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.6875rem;
  color: var(--text-dim);
}

.badge-group {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

.source-year {
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-meta);
}

.source-title {
  margin: 0 0 4px;
  font-size: 0.96875rem;
  font-weight: 600;
  line-height: 1.35;
}

.source-meta {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  color: var(--text-meta);
}

.source-scope {
  margin: 0 0 10px;
  font-size: 0.859375rem;
  color: var(--text-dim);
}

.source-note {
  margin: 0 0 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  color: var(--warn-text);
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  font-size: 0.8125rem;
}

.source-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding: 6px 4px;
  font-weight: 600;
}

.source-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 44px;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface-subtle);
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo);
}

@media (hover: hover) and (pointer: fine) {
  .source-copy-btn:hover {
    border-color: var(--accent-border);
    color: var(--text-main);
    background: var(--surface-elevated);
  }
}

.source-copy-btn.is-copied {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-soft);
}

.empty-state {
  padding: 24px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.empty-reset-btn {
  margin-top: 10px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-subpanel);
  color: var(--text-main);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    border-color var(--duration-fast) var(--ease-out-expo),
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

.empty-reset-btn:active {
  transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
  .empty-reset-btn:hover {
    border-color: var(--accent-border);
    background: var(--surface-elevated);
  }
}

/* ==========================================================================
   RESEARCHERS SECTION (SECTION 3)
   ========================================================================== */
.researchers-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.researcher-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.researcher-card.is-background {
  border-style: dashed;
}

.researcher-card h3 {
  margin: 0 0 2px;
  font-size: 0.95rem;
  font-weight: 600;
}

.researcher-role {
  margin: 0 0 8px;
  font-size: 0.78125rem;
  color: var(--text-meta);
}

.researcher-card p {
  margin: 0 0 8px;
  font-size: 0.84375rem;
  color: var(--text-dim);
}

.researcher-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.8125rem;
}
.researcher-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 2px;
}

/* ==========================================================================
   FOOTER & NOSCRIPT
   ========================================================================== */
.noscript-box {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-dim);
  font-size: 0.875rem;
}

.page-footer {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  font-size: 0.8125rem;
  color: var(--text-meta);
}

.back-to-top-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: rgba(25, 30, 38, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out-expo),
    transform var(--duration-press) var(--ease-press);
}

.back-to-top-btn[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .back-to-top-btn:hover {
    background: var(--surface-elevated);
  }
}

.back-to-top-btn:active {
  transform: scale(0.97);
}

/* ==========================================================================
   RESPONSIVE & PRINT
   ========================================================================== */
@media (max-width: 780px) {
  .hero-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .steps-grid,
  .split-grid,
  .researchers-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding: 10px 16px;
  }
  .page-shell {
    padding: 20px 16px 48px;
  }
  .search-input {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition-property: opacity, background-color, border-color, color, box-shadow !important;
    transition-duration: 150ms !important;
    transition-timing-function: ease !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  html,
  body {
    background: #fff;
    color: #111;
  }
  .topbar,
  .section-nav,
  .directory-controls {
    display: none;
  }
  .page-shell {
    max-width: none;
    padding: 0;
  }
  .step-card,
  .table-wrap,
  .panel-box,
  .source-card,
  .researcher-card,
  .stat-cell {
    background: #fff;
    border-color: #ccc;
    color: #111;
    break-inside: avoid;
  }
  .hero-lead,
  .section-head p,
  .step-card p,
  .source-scope,
  .source-meta,
  .researcher-card p,
  .limits-list,
  .ladder-list {
    color: #222;
  }
  a {
    color: #0b4f6c;
  }
}

/* Follow the existing document language switch without changing source-register JS. */
html:not([lang="en"]) .review-scope-en,
html[lang="en"] .review-scope-sv {
  display: none;
}
