/* ============================================================================
   Resource-Bounded Distinction Systems — documentation shell
   Editorial research-docs UI: warm canvas, crisp utility chrome, generous type.
   ============================================================================ */

:root {
  color-scheme: light;
  --bar-height: 72px;
  --content-max: 920px;

  --appbar-bg: rgba(252, 252, 251, 0.88);
  --appbar-border: rgba(205, 212, 224, 0.78);
  --nav-bg: rgba(247, 248, 251, 0.82);
  --nav-border: #e0e5ed;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --field-bg: #eef1f6;
  --text: #182234;
  --muted: #667188;
  --subtle: #8993a5;
  --border: #dfe4ec;
  --border-strong: #c9d1de;
  --accent: #2457d6;
  --accent-hover: #173fa8;
  --accent-soft: #edf2ff;
  --accent-wash: #f7f9ff;
  --code-bg: #f0f3f7;
  --callout-bg: #f5f7fd;
  --callout-border: #d9e2ff;
  --table-head-bg: #eef2f9;
  --table-stripe: #f9fafc;
  --hover: #e9edf5;
  --shadow-sm: 0 1px 2px rgba(27, 43, 72, 0.05), 0 3px 12px rgba(27, 43, 72, 0.04);
  --shadow-md: 0 12px 28px rgba(27, 43, 72, 0.11), 0 2px 6px rgba(27, 43, 72, 0.06);
  --shadow-drawer: 8px 0 32px rgba(18, 31, 58, 0.18);
  --active-bar: #2457d6;
  --blockquote-border: #e0714c;
  --blockquote-bg: #fff7f3;
  --katex-border: #182234;

  --font-sans: "Inter", "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --appbar-bg: rgba(19, 25, 37, 0.9);
  --appbar-border: rgba(70, 82, 107, 0.68);
  --nav-bg: rgba(16, 21, 32, 0.86);
  --nav-border: #2d374c;
  --bg: #111724;
  --surface: #182131;
  --surface-raised: #1d283a;
  --field-bg: #222d40;
  --text: #edf2fb;
  --muted: #9aa7bb;
  --subtle: #728096;
  --border: #303c51;
  --border-strong: #45526a;
  --accent: #91adff;
  --accent-hover: #b3c5ff;
  --accent-soft: #26365c;
  --accent-wash: #1b263b;
  --code-bg: #222c3d;
  --callout-bg: #1a2740;
  --callout-border: #354c7c;
  --table-head-bg: #263247;
  --table-stripe: #1c2636;
  --hover: #263248;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.18), 0 3px 12px rgba(0, 0, 0, 0.12);
  --shadow-md: 0 14px 32px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.18);
  --shadow-drawer: 8px 0 32px rgba(0, 0, 0, 0.42);
  --active-bar: #91adff;
  --blockquote-border: #f09a78;
  --blockquote-bg: #302a2d;
  --katex-border: #edf2fb;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -10%, rgba(36, 87, 214, 0.075), transparent 32rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

button, input { font: inherit; }

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Top app bar
   -------------------------------------------------------------------------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--bar-height);
  padding: 0 24px;
  background: var(--appbar-bg);
  border-bottom: 1px solid var(--appbar-border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.appbar-brand {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 11px;
  min-width: 0;
  color: var(--text);
  white-space: nowrap;
}

.appbar-brand:hover { color: var(--text); text-decoration: none; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 12px;
  background: linear-gradient(145deg, #3869e6, #173fa8);
  color: #fff;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 5px 12px rgba(36, 87, 214, 0.28);
}

.brand-name {
  max-width: 310px;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.icon-btn:hover {
  border-color: var(--border);
  background: var(--hover);
  color: var(--text);
  transform: translateY(-1px);
}

#nav-toggle { display: none; }

.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* --- search --- */

.search-wrap {
  position: relative;
  flex: 1 1 560px;
  max-width: 620px;
  margin: 0 auto;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 16px;
  z-index: 1;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 44px;
  border: 1px solid transparent;
  border-radius: 13px;
  outline: none;
  background: var(--field-bg);
  color: var(--text);
  font-size: 14px;
  box-shadow: inset 0 1px 2px rgba(28, 44, 72, 0.06);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

#search-input:hover { border-color: var(--border); }

#search-input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 13%, transparent), var(--shadow-sm);
}

#search-input::placeholder { color: var(--muted); }

.search-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  left: 0;
  z-index: 2000;
  display: none;
  max-height: 420px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-md);
}

.search-dropdown.open { display: block; }

.search-result {
  display: block;
  padding: 11px 12px;
  border-radius: 9px;
  color: var(--text);
}

.search-result:hover {
  background: var(--hover);
  color: var(--text);
  text-decoration: none;
}

.sr-title { display: block; color: var(--accent); font-size: 14px; font-weight: 700; }
.sr-snippet { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.search-empty { padding: 14px 12px; color: var(--muted); font-size: 14px; }

/* --------------------------------------------------------------------------
   Shell layout
   -------------------------------------------------------------------------- */

.shell {
  display: flex;
  align-items: stretch;
  max-width: 1640px;
  min-height: calc(100vh - var(--bar-height));
  margin: 0 auto;
}

.left-nav {
  position: sticky;
  top: var(--bar-height);
  align-self: flex-start;
  width: 292px;
  height: calc(100vh - var(--bar-height));
  flex: 0 0 292px;
  max-width: 292px;
  padding: 32px 16px 48px;
  overflow-y: auto;
  background: var(--nav-bg);
  border-right: 1px solid var(--nav-border);
  overscroll-behavior: contain;
}

.nav-group { margin-bottom: 30px; }

.nav-group-title {
  padding: 0 14px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  display: block;
  padding: 8px 14px 8px 17px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.nav-link:hover {
  background: var(--hover);
  color: var(--text);
  text-decoration: none;
  transform: translateX(2px);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}

.nav-link.active::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--active-bar);
  content: "";
}

/* --- research program: the four-stage chain as navigation --- */

.program-group {
  position: relative;
  padding: 15px 9px 9px;
  margin: 0 0 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
  border-radius: 14px;
  background: linear-gradient(165deg, var(--accent-wash), var(--nav-bg) 72%);
}

.program-group::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent 78%);
}

.program-group .nav-group-title {
  padding: 0 6px 4px;
  color: var(--accent);
}

.program-group .nav-link {
  padding-right: 9px;
  padding-left: 9px;
  border-radius: 8px;
  font-size: 12.5px;
}

.map-link {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.map-link.active { font-weight: 800; }

.map-glyph { color: var(--accent); font-size: 13px; line-height: 1; }

.nav-link.stage {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 650;
  line-height: 1.3;
}

.nav-link.stage .stage-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1;
}

/* vertical chain connector between consecutive stage links */
.nav-link.stage + .nav-link.stage::before {
  content: "";
  position: absolute;
  top: -9px;
  left: 17px;
  width: 2px;
  height: 9px;
  background: var(--border-strong);
}

.main {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
}

.content-wrap {
  width: 100%;
  max-width: var(--content-max);
  padding: 58px 48px 112px;
}

.right-rail {
  display: none;
  position: sticky;
  top: var(--bar-height);
  align-self: flex-start;
  width: 230px;
  height: calc(100vh - var(--bar-height));
  flex: 0 0 230px;
  max-width: 230px;
  padding: 55px 24px 40px 10px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

@media (min-width: 1280px) {
  .right-rail { display: block; }
}

.rail-inner {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.rail-title {
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

.rail-list { padding: 0; margin: 0; list-style: none; }
.rail-list li { margin: 0; }

.rail-list a {
  display: block;
  padding: 5px 10px;
  margin-left: -17px;
  border-left: 2px solid transparent;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  transition: color 150ms ease, border-color 150ms ease;
}

.rail-list a:hover { color: var(--text); text-decoration: none; }
.rail-list a.active { border-left-color: var(--accent); color: var(--accent); }
.rail-list li.l1 a { padding-left: 22px; }
.rail-list li.l2 a { padding-left: 34px; }

/* --------------------------------------------------------------------------
   Content typography
   -------------------------------------------------------------------------- */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.crumb-sep { color: var(--subtle); }

.page-title {
  max-width: 820px;
  margin: 0 0 34px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.99;
  text-wrap: balance;
}

.content {
  color: var(--text);
  font-size: 16.5px;
  letter-spacing: -0.005em;
  line-height: 1.78;
}

.content h2,
.content h3,
.content h4 {
  color: var(--text);
  scroll-margin-top: calc(var(--bar-height) + 24px);
  text-wrap: balance;
}

.content h2 {
  padding-top: 10px;
  margin: 56px 0 17px;
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.content h2::before {
  display: block;
  width: 32px;
  height: 4px;
  margin-bottom: 13px;
  border-radius: 4px;
  background: var(--accent);
  content: "";
}

.content h3 {
  padding-top: 30px;
  margin: 38px 0 12px;
  border-top: 1px solid var(--border);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.content h4 {
  margin: 27px 0 8px;
  color: var(--accent);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.35;
}

.content p { margin: 15px 0; }
.content strong { font-weight: 750; }

.content ul,
.content ol {
  padding-left: 27px;
  margin: 17px 0;
}

.content li { padding-left: 5px; margin: 7px 0; }
.content li::marker { color: var(--accent); font-weight: 700; }

.content a {
  text-decoration-line: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 32%, transparent);
  text-decoration-thickness: 1px;
}

.content a:hover { text-decoration-color: currentColor; }

.content code {
  padding: 0.15em 0.42em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--code-bg);
  font-family: var(--font-mono);
  font-size: 0.84em;
  letter-spacing: -0.03em;
}

.content pre {
  padding: 18px 20px;
  margin: 20px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
  font: 13px/1.65 var(--font-mono);
}

.content pre code { padding: 0; border: 0; background: transparent; }
.content hr { height: 1px; margin: 38px 0; border: 0; background: var(--border); }

/* lead abstract callout */

.lead blockquote {
  padding: 21px 24px;
  margin: 24px 0 12px;
  border: 1px solid var(--callout-border);
  border-left: 4px solid var(--accent);
  border-radius: 13px;
  background: var(--callout-bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  box-shadow: var(--shadow-sm);
}

blockquote {
  padding: 17px 20px;
  margin: 20px 0;
  border: 1px solid color-mix(in srgb, var(--blockquote-border) 26%, var(--border));
  border-left: 4px solid var(--blockquote-border);
  border-radius: 10px;
  background: var(--blockquote-bg);
  color: var(--text);
}

/* TL;DR card */

.tldr-card {
  position: relative;
  padding: 24px 28px;
  margin: 18px 0 12px;
  overflow: hidden;
  border: 1px solid var(--callout-border);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--callout-bg), var(--surface));
  box-shadow: var(--shadow-sm);
}

.tldr-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: var(--accent);
  content: "";
}

.tldr-card p { margin: 13px 0; }
.tldr-card p:first-child { margin-top: 0; }
.tldr-card p:last-child { margin-bottom: 0; }
.tldr-card hr { margin: 21px 0; background: var(--callout-border); }

/* --------------------------------------------------------------------------
   Math
   -------------------------------------------------------------------------- */

.math-display {
  padding: 6px 0;
  margin: 24px auto;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}

.math-display .katex-display { margin: 0; }
.content .katex { font-size: 1.1em; }
html[data-theme="dark"] .katex .fbox { border-color: var(--katex-border); }

/* --------------------------------------------------------------------------
   Tables
   -------------------------------------------------------------------------- */

.table-wrap {
  margin: 22px 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.55;
}

thead th {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--table-head-bg);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-align: left;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) td { background: var(--table-stripe); }

/* --------------------------------------------------------------------------
   Section index grid (overview)
   -------------------------------------------------------------------------- */

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.section-card {
  display: flex;
  gap: 16px;
  min-height: 145px;
  padding: 19px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease;
}

.section-card:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--border));
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.sc-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 43px;
  height: 43px;
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 17%, transparent);
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

.sc-title { margin-bottom: 5px; font-size: 15px; font-weight: 800; line-height: 1.35; }
.sc-summary { color: var(--muted); font-size: 13px; line-height: 1.55; }
.sc-status {
  margin: 2px 0 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
}

.source-card {
  border-color: color-mix(in srgb, var(--text) 18%, var(--border));
  background: linear-gradient(135deg, var(--surface-raised), var(--surface));
}

.source-card .sc-num {
  width: 52px;
  border-color: color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--text);
  color: var(--surface);
  font-size: 10px;
  letter-spacing: 0.04em;
}

/* --- research-program map card (overview grid) --- */

.section-card.program-card {
  grid-column: 1 / -1;
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  background: linear-gradient(135deg, var(--accent-wash), var(--surface-raised) 62%);
}

.section-card.program-card .sc-num {
  border-color: transparent;
  background: linear-gradient(145deg, #3869e6, #173fa8);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.01em;
}

.section-card.program-card .sc-title { font-size: 17px; }

.sc-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 4px 0 9px;
}

.chain-chip {
  display: inline-flex;
  padding: 2px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.chain-arrow { color: var(--subtle); font-style: normal; font-size: 12px; }

/* --------------------------------------------------------------------------
   Prev / next
   -------------------------------------------------------------------------- */

.prevnext {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding-top: 28px;
  margin-top: 64px;
  border-top: 1px solid var(--border);
}

.pn-card {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.pn-card:hover {
  border-color: var(--accent);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.pn-card.next { text-align: right; }
.pn-card.disabled { opacity: 0.42; pointer-events: none; }
.pn-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.pn-title { display: block; color: var(--accent); font-size: 14px; font-weight: 750; line-height: 1.4; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1279px) {
  .content-wrap { max-width: 980px; }
}

@media (max-width: 1040px) {
  :root { --bar-height: 64px; }

  .app-bar { padding: 0 14px; }
  #nav-toggle { display: inline-flex; }
  .left-nav {
    position: fixed;
    top: var(--bar-height);
    bottom: 0;
    left: 0;
    z-index: 1500;
    width: 300px;
    max-width: 86vw;
    height: auto;
    transform: translateX(-105%);
    box-shadow: var(--shadow-drawer);
    transition: transform 220ms ease;
  }
  .left-nav.open { transform: translateX(0); }
  .nav-overlay {
    position: fixed;
    inset: var(--bar-height) 0 0;
    z-index: 1400;
    background: rgba(13, 22, 38, 0.52);
  }
  .content-wrap { padding: 48px 40px 96px; }
  .brand-name { max-width: 230px; }
}

@media (max-width: 700px) {
  .app-bar { gap: 7px; padding: 0 10px; }
  .brand-name { display: none; }
  .search-wrap { flex-basis: auto; margin: 0; }
  .content-wrap { padding: 38px 20px 80px; }
  .page-title { margin-bottom: 28px; font-size: clamp(2.45rem, 12vw, 3.6rem); }
  .content { font-size: 16px; line-height: 1.72; }
  .content h2 { font-size: 27px; }
  .content h3 { padding-top: 25px; margin-top: 32px; }
  .tldr-card { padding: 21px 21px 21px 24px; }
  .section-grid { grid-template-columns: 1fr; gap: 13px; }
  .section-card { min-height: 0; }
  .prevnext { grid-template-columns: 1fr; margin-top: 50px; }
  .pn-card.next { text-align: left; }
  table { font-size: 13px; }
  thead th, tbody td { padding-right: 13px; padding-left: 13px; }
}

@media (max-width: 420px) {
  .icon-btn { width: 38px; height: 38px; }
  .brand-mark { width: 35px; height: 35px; }
  #search-input { height: 40px; padding-left: 40px; }
  .search-icon { left: 13px; }
  .content-wrap { padding-right: 16px; padding-left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* scrollbar (WebKit) */
.left-nav::-webkit-scrollbar,
.right-rail::-webkit-scrollbar,
.search-dropdown::-webkit-scrollbar { width: 8px; }

.left-nav::-webkit-scrollbar-thumb,
.right-rail::-webkit-scrollbar-thumb,
.search-dropdown::-webkit-scrollbar-thumb {
  border-radius: 8px;
  background: var(--border-strong);
}
