/* ═══════════════════════════════════════════
   TOKENS — academic parchment × forest green
═══════════════════════════════════════════ */
:root {
  /* Paper */
  --paper: #fbfaf6;
  --pap2: #f6f3eb;
  --pap3: #efe9dc;
  --pap4: #e5ddcc;

  /* Borders */
  --line: #d5ccba;
  --line2: #c1b59f;

  /* Text */
  --ink: #18140d;
  --ink2: #312b20;
  --muted: #746a5b;
  --faint: #b8ae98;

  /* Hero */
  --hero: #0d1b12;
  --hero2: #17271a;

  /* Forest */
  --green: #1f6f43;
  --gk: rgb(31 111 67 / 10%);

  /* Terracotta */
  --rust: #c05a2b;
  --rk: rgb(192 90 43 / 10%);

  /* Heritage Blue */
  --navy: #234d7a;
  --nk: rgb(35 77 122 / 10%);

  /* Antique Gold */
  --gold: #a8861b;
  --ok: rgb(168 134 27 / 10%);

  /* Burgundy */
  --plum: #74214f;
  --pk: rgb(116 33 79 / 10%);

  /* Slate */
  --slate: #36586a;
  --sk: rgb(54 88 106 / 10%);

  /* Extras */
  --shadow: rgb(18 15 10 / 8%);
  --shadow-lg: rgb(18 15 10 / 16%);
  --success: #2f7d46;
  --warning: #d18c1d;
  --danger: #c74d3f;
}

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

html {
  scroll-behavior: smooth;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Crimson Pro", Georgia, serif;
  font-size: clamp(16px, 2.05vw, 18.5px);
  line-height: 1.85;
  overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   HERO — dark forest, academic title page
═══════════════════════════════════════════ */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--hero);
  padding: clamp(52px, 8vw, 92px) clamp(24px, 5vw, 68px) 0;
  border-bottom: 3px solid var(--green);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 80% 50%,
      rgb(26 107 60 / 14%) 0%,
      transparent 65%),
    radial-gradient(ellipse 40% 35% at 10% 70%,
      rgb(26 63 107 / 7%) 0%,
      transparent 60%);
}

/* subtle rule pattern */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgb(26 107 60 / 4%) 1px,
      transparent 1px);
  background-size: 100% 32px;
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  margin-top: 3%;
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: clamp(24px, 4vw, 52px);
  align-items: center;
  min-width: 0;
}

@media(width <=700px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .hero-art {
    display: none;
  }
}

.hero-series {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(9px, 1.3vw, 10.5px);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: rgb(26 107 60 / 90%);
  margin-bottom: clamp(16px, 2.5vw, 24px);
}

.hero-series::before {
  content: "§";
  color: var(--green);
}

.hero h1 {
  font-family: "Josefin Sans", sans-serif;
  font-size: clamp(2.4rem, 7.5vw, 5.6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
}

.hero h1 .it {
  font-family: "Crimson Pro", serif;
  font-style: italic;
  font-weight: 300;
  color: rgb(255 255 255 / 25%);
  font-size: 0.52em;
  display: block;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.hero h1 .green {
  color: var(--green);
}

.hero-abstract {
  font-family: "Crimson Pro", serif;
  font-style: italic;
  font-size: clamp(13px, 1.9vw, 15.5px);
  color: rgb(249 247 242 / 45%);
  line-height: 1.85;
  max-width: 560px;
  margin-top: clamp(16px, 2.5vw, 24px);
}

.hero-undertitle {
  margin-top: clamp(16px, 2.5vw, 22px);
  padding: clamp(12px, 2vw, 16px) clamp(16px, 2.5vw, 20px);
  background: rgb(26 107 60 / 8%);
  border: 1px solid rgb(26 107 60 / 25%);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(10.5px, 1.5vw, 12px);
  color: rgb(249 247 242 / 40%);
  line-height: 1.75;
  max-width: 580px;
}

.hero-undertitle strong {
  color: rgb(26 107 60 / 90%);
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: clamp(18px, 3vw, 26px);
}

.htag {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8.5px, 1.2vw, 10px);
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid;
  background: transparent;
  white-space: nowrap;
}

.htag.g {
  color: rgb(26 107 60 / 90%);
  border-color: rgb(26 107 60 / 30%);
}

.htag.r {
  color: rgb(184 76 32 / 90%);
  border-color: rgb(184 76 32 / 30%);
}

.htag.n {
  color: rgb(26 63 107 / 90%);
  border-color: rgb(26 63 107 / 30%);
}

.htag.o {
  color: rgb(160 124 16 / 90%);
  border-color: rgb(160 124 16 / 30%);
}

.htag.p {
  color: rgb(107 26 90 / 90%);
  border-color: rgb(107 26 90 / 30%);
}

.htag.s {
  color: rgb(42 74 90 / 90%);
  border-color: rgb(42 74 90 / 30%);
}

/* Hero art: VC dimension shattering diagram */
.hero-art {
  flex-shrink: 0;
}

/* Bottom strip */
.hero-strip {
  display: flex;
  border-top: 1px solid rgb(26 107 60 / 25%);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: clamp(28px, 5vw, 46px);
}

.hs-cell {
  flex: 1;
  min-width: clamp(100px, 17vw, 155px);
  padding: clamp(13px, 2.3vw, 18px) clamp(12px, 2vw, 18px);
  border-right: 1px solid rgb(26 107 60 / 12%);
  text-align: center;
}

.hs-cell:last-child {
  border-right: none;
}

.hs-val {
  font-family: "Josefin Sans", sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 700;
  color: rgb(26 107 60 / 90%);
  line-height: 1;
}

.hs-label {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8px, 1.2vw, 9.5px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgb(249 247 242 / 25%);
  margin-top: 5px;
}

/* ═══════════════════════════════════════════
   TOC
═══════════════════════════════════════════ */
.toc-outer {
  max-width: 1080px;
  margin: clamp(32px, 5vw, 52px) auto;
  padding: 0 clamp(24px, 5vw, 68px);
}

.toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line2);
  border-radius: 6px;
  overflow: hidden;
}

.toc-cell a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: clamp(11px, 1.8vw, 14px) clamp(13px, 2.2vw, 17px);
  background: var(--pap2);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(11px, 1.5vw, 12.5px);
  color: var(--muted);
  text-decoration: none;
  transition:
    background 0.14s,
    color 0.14s;
  line-height: 1.4;
}

.toc-cell a:hover {
  background: #fff;
  color: var(--green);
}

.toc-n {
  color: var(--green);
  font-weight: 500;
  min-width: 22px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   CONTENT
═══════════════════════════════════════════ */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(24px, 5vw, 68px) clamp(32px, 5vw, 52px);
}

/* ═══════════════════════════════════════════
   CHAPTER
═══════════════════════════════════════════ */
.ch {
  margin-bottom: clamp(60px, 8.5vw, 105px);
}

.ch:last-child {
  margin-bottom: 0;
}

.ch-head {
  position: relative;
  padding-top: clamp(32px, 5.5vw, 52px);
  border-top: 2px solid var(--ink);
  margin-bottom: clamp(24px, 3.5vw, 36px);
}

.ch-head::before {
  content: "";
  position: absolute;
  top: -2px;
  left: 0;
  width: clamp(60px, 10vw, 100px);
  height: 3px;
  background: var(--green);
}

.ch-top {
  display: flex;
  align-items: baseline;
  gap: clamp(14px, 2.5vw, 22px);
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.ch-num {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(1.8rem, 4.8vw, 3.2rem);
  color: var(--green);
  opacity: 0.2;
  line-height: 1;
  letter-spacing: -0.03em;
  flex-shrink: 0;
}

.ch-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8.5px, 1.2vw, 10px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid;
  align-self: center;
  flex-shrink: 0;
}

.ch-badge.g {
  color: var(--green);
  border-color: rgb(26 107 60 / 30%);
  background: var(--gk);
}

.ch-badge.r {
  color: var(--rust);
  border-color: rgb(184 76 32 / 30%);
  background: var(--rk);
}

.ch-badge.n {
  color: var(--navy);
  border-color: rgb(26 63 107 / 30%);
  background: var(--nk);
}

.ch-badge.o {
  color: var(--gold);
  border-color: rgb(160 124 16 / 30%);
  background: var(--ok);
}

.ch-badge.p {
  color: var(--plum);
  border-color: rgb(107 26 90 / 30%);
  background: var(--pk);
}

.ch-badge.s {
  color: var(--slate);
  border-color: rgb(42 74 90 / 30%);
  background: var(--sk);
}

.ch h2 {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 3.8vw, 2.2rem);
  color: var(--ink);
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.ch-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(10px, 1.4vw, 11.5px);
  color: var(--muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

.sub {
  margin: clamp(26px, 4vw, 44px) 0;
}

.sh {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(10.5px, 1.5vw, 12px);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: clamp(12px, 2vw, 16px);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sh::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line2);
}

.sh.g {
  color: var(--green);
}

.sh.r {
  color: var(--rust);
}

.sh.n {
  color: var(--navy);
}

.sh.o {
  color: var(--gold);
}

.sh.p {
  color: var(--plum);
}

.sh.s {
  color: var(--slate);
}

p {
  margin-bottom: clamp(12px, 1.8vw, 16px);
}

/* ═══════════════════════════════════════════
   DEFINITION BOX — the most important element
═══════════════════════════════════════════ */
.def {
  margin: clamp(20px, 3.5vw, 32px) 0;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid;
  background: #fff;
  box-shadow: 0 1px 3px rgb(26 23 13 / 6%);
  min-width: 0;
}

.def-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: clamp(8px, 1.4vw, 11px) clamp(14px, 2.5vw, 20px);
  border-bottom: 1px solid;
  background: var(--pap2);
}

.def-label {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(8.5px, 1.2vw, 10px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.def-title {
  font-family: "Crimson Pro", serif;
  font-style: italic;
  font-size: clamp(14px, 1.9vw, 16px);
  color: var(--ink2);
}

.def-body {
  padding: clamp(16px, 2.8vw, 24px) clamp(16px, 3.5vw, 28px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-size: clamp(14.5px, 1.95vw, 17px);
  line-height: 1.85;
  min-width: 0;
}

.def-note {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(9.5px, 1.3vw, 11px);
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.65;
  font-style: italic;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.def.g .def-top {
  border-bottom-color: rgb(26 107 60 / 20%);
}

.def.g {
  border-color: rgb(26 107 60 / 30%);
}

.def.g .def-body {
  border-left: 4px solid var(--green);
}

.def.g .def-label {
  color: var(--green);
}

.def.r .def-top {
  border-bottom-color: rgb(184 76 32 / 20%);
}

.def.r {
  border-color: rgb(184 76 32 / 30%);
}

.def.r .def-body {
  border-left: 4px solid var(--rust);
}

.def.r .def-label {
  color: var(--rust);
}

.def.n .def-top {
  border-bottom-color: rgb(26 63 107 / 20%);
}

.def.n {
  border-color: rgb(26 63 107 / 30%);
}

.def.n .def-body {
  border-left: 4px solid var(--navy);
}

.def.n .def-label {
  color: var(--navy);
}

.def.o .def-top {
  border-bottom-color: rgb(160 124 16 / 20%);
}

.def.o {
  border-color: rgb(160 124 16 / 30%);
}

.def.o .def-body {
  border-left: 4px solid var(--gold);
}

.def.o .def-label {
  color: var(--gold);
}

.def.p .def-top {
  border-bottom-color: rgb(107 26 90 / 20%);
}

.def.p {
  border-color: rgb(107 26 90 / 30%);
}

.def.p .def-body {
  border-left: 4px solid var(--plum);
}

.def.p .def-label {
  color: var(--plum);
}

.def.s .def-top {
  border-bottom-color: rgb(42 74 90 / 20%);
}

.def.s {
  border-color: rgb(42 74 90 / 30%);
}

.def.s .def-body {
  border-left: 4px solid var(--slate);
}

.def.s .def-label {
  color: var(--slate);
}

/* ═══════════════════════════════════════════
   THEOREM — dark ink block
═══════════════════════════════════════════ */
.thm {
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  padding: clamp(22px, 3.5vw, 34px) clamp(20px, 4vw, 36px);
  margin: clamp(22px, 3.5vw, 36px) 0;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.thm::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg,
      var(--green),
      rgb(26 107 60 / 30%),
      transparent);
}

.thm-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8.5px, 1.2vw, 10px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgb(26 107 60 / 90%);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.thm-badge::before {
  content: "⊢";
  font-size: 1.1em;
}

.thm p {
  font-family: "Crimson Pro", serif;
  font-size: clamp(14.5px, 1.95vw, 17px);
  line-height: 1.85;
  margin-bottom: 0;
  color: rgb(249 247 242 / 90%);
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ═══════════════════════════════════════════
   CALLOUT — marginal note
═══════════════════════════════════════════ */
.marg {
  display: flex;
  gap: clamp(14px, 2.5vw, 20px);
  background: var(--pap2);
  border: 1px solid var(--line2);
  border-radius: 4px;
  padding: clamp(16px, 2.8vw, 24px);
  margin: clamp(18px, 3vw, 28px) 0;
  align-items: flex-start;
}

.marg-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(9px, 1.3vw, 10.5px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  padding: 6px 0;
  border-right: 2px solid;
  flex-shrink: 0;
}

.marg-body p {
  font-size: clamp(13.5px, 1.8vw, 16px);
  line-height: 1.82;
  margin-bottom: 0;
  font-style: italic;
}

.marg.g .marg-tag {
  color: var(--green);
  border-color: var(--green);
}

.marg.r .marg-tag {
  color: var(--rust);
  border-color: var(--rust);
}

.marg.n .marg-tag {
  color: var(--navy);
  border-color: var(--navy);
}

.marg.o .marg-tag {
  color: var(--gold);
  border-color: var(--gold);
}

.marg.p .marg-tag {
  color: var(--plum);
  border-color: var(--plum);
}

.marg.s .marg-tag {
  color: var(--slate);
  border-color: var(--slate);
}


/* ═══════════════════════════════════════════
   DERIVATION
═══════════════════════════════════════════ */
.drv {
  border: 1px solid var(--line2);
  border-radius: 4px;
  overflow: hidden;
  margin: clamp(20px, 3.5vw, 32px) 0;
  background: #fff;
}

.drv-hdr {
  background: var(--pap2);
  padding: clamp(9px, 1.5vw, 12px) clamp(14px, 3vw, 22px);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8.5px, 1.2vw, 10px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.drv-row {
  background: #fff;
  padding: clamp(14px, 2.5vw, 20px) clamp(14px, 3vw, 26px);
  border-bottom: 1px solid var(--pap3);
  display: grid;
  grid-template-columns: clamp(28px, 4vw, 38px) 1fr;
  gap: clamp(10px, 2vw, 18px);
  align-items: start;
  min-width: 0;
}

.drv-row>div {
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.drv-row:last-child {
  border-bottom: none;
}

.dn {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(10px, 1.4vw, 12px);
  font-weight: 600;
  padding-top: 4px;
}

.dn.g {
  color: var(--green);
}

.dn.r {
  color: var(--rust);
}

.dn.n {
  color: var(--navy);
}

.dn.o {
  color: var(--gold);
}

.dn.p {
  color: var(--plum);
}

.dn.s {
  color: var(--slate);
}

.dnote {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(10px, 1.4vw, 11.5px);
  color: var(--muted);
  font-style: italic;
  margin-top: 8px;
  line-height: 1.65;
}

/* ═══════════════════════════════════════════
   FIGURES
═══════════════════════════════════════════ */
.fig {
  margin: clamp(24px, 4vw, 42px) 0;
}

.fig-box {
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 4px;
  padding: clamp(16px, 3vw, 26px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 1px 3px rgb(26 23 13 / 5%);
}

.fig-cap {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(10px, 1.4vw, 11.5px);
  color: var(--muted);
  margin-top: clamp(10px, 1.8vw, 14px);
  font-style: italic;
  text-align: center;
}

/* ═══════════════════════════════════════════
   TABLES
═══════════════════════════════════════════ */
.t-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: clamp(18px, 3vw, 28px) 0;
  border-radius: 4px;
  border: 1px solid var(--line2);
  background: #fff;
  box-shadow: 0 1px 3px rgb(26 23 13 / 4%);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: clamp(13px, 1.75vw, 15px);
  min-width: 420px;
  font-family: "Crimson Pro", serif;
}

thead {
  background: var(--ink);
  color: var(--paper);
}

thead th {
  padding: clamp(10px, 1.8vw, 13px) clamp(10px, 2vw, 16px);
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(8px, 1.2vw, 9.5px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(249 247 242 / 60%);
  text-align: left;
}

tbody tr {
  border-bottom: 1px solid var(--pap3);
}

tbody tr:hover {
  background: var(--pap2);
}

tbody td {
  padding: clamp(10px, 1.8vw, 13px) clamp(10px, 2vw, 16px);
  vertical-align: top;
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   TWO-COL
═══════════════════════════════════════════ */
.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 2.5vw, 20px);
  margin: clamp(16px, 3vw, 26px) 0;
}

@media (width <=620px) {
  .two {
    grid-template-columns: 1fr;
  }
}

.tcol {
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 4px;
  padding: clamp(16px, 2.5vw, 24px);
  box-shadow: 0 1px 3px rgb(26 23 13 / 4%);
  min-width: 0;
}

.tcol h4 {
  font-family: "Josefin Sans", sans-serif;
  font-weight: 700;
  font-size: clamp(9.5px, 1.4vw, 11px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: clamp(10px, 1.8vw, 14px);
}

.tcol p {
  font-size: clamp(13px, 1.75vw, 15px);
  margin-bottom: 8px;
  line-height: 1.7;
}

/* ═══════════════════════════════════════════
   FEATURE LIST
═══════════════════════════════════════════ */
.fl {
  list-style: none;
  margin: clamp(10px, 2vw, 14px) 0;
}

.fl li {
  padding: clamp(9px, 1.6vw, 12px) 0 clamp(9px, 1.6vw, 12px) clamp(22px, 3.5vw, 30px);
  border-bottom: 1px solid var(--pap3);
  position: relative;
  font-size: clamp(14.5px, 1.95vw, 16.5px);
  line-height: 1.78;
}

.fl li:last-child {
  border-bottom: none;
}

.fl li::before {
  content: "■";
  position: absolute;
  left: 0;
  font-size: 0.55em;
  top: clamp(16px, 2.5vw, 20px);
}

.fl.g li::before {
  color: var(--green);
}

.fl.r li::before {
  color: var(--rust);
}

.fl.n li::before {
  color: var(--navy);
}

.fl.o li::before {
  color: var(--gold);
}

.fl.p li::before {
  color: var(--plum);
}

.fl.s li::before {
  color: var(--slate);
}

/* ═══════════════════════════════════════════
   INLINE
═══════════════════════════════════════════ */
code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.84em;
  background: var(--pap3);
  border: 1px solid var(--line2);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--green);
}

.hg {
  color: var(--green);
  font-weight: 600;
}

.hr {
  color: var(--rust);
  font-weight: 600;
}

.hn {
  color: var(--navy);
  font-weight: 600;
}

.ho {
  color: var(--gold);
  font-weight: 600;
}

.hp {
  color: var(--plum);
  font-weight: 600;
}

.hs {
  color: var(--slate);
  font-weight: 600;
}

em {
  font-style: italic;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--pap2);
}

::-webkit-scrollbar-thumb {
  background: var(--line2);
  border-radius: 3px;
}

/* ═══════════════════════════════════════════
   RESPONSIVE — mobile / narrow viewport
═══════════════════════════════════════════ */

/* site-footer dark override */
.site-footer {
  background: #0a0a0a;
  border-top: 1px solid var(--line2);
}

.site-footer .copyright,
.site-footer .footer-meta {
  color: rgb(255 255 255 / 55%);
}

.site-footer .back-to-top,
.site-footer .social-link11 {
  color: rgb(255 255 255 / 45%);
}

.site-footer .back-to-top:hover {
  color: var(--green);
}

.site-footer .social-link11:hover {
  color: #fff;
}

.site-footer .made-with {
  color: rgb(255 255 255 / 30%);
  border-top-color: var(--line2);
}

@media(width <=768px) {
  .ch-sub {
    display: none;
  }

  .def-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-strip {
    scrollbar-width: none;
  }

  .hero-strip::-webkit-scrollbar {
    display: none;
  }
}

@media(width <=480px) {
  /* hero */
  .hero {
    padding-left: clamp(16px, 5vw, 24px);
    padding-right: clamp(16px, 5vw, 24px);
  }

  .hero h1 {
    font-size: clamp(2rem, 12vw, 3rem);
  }

  .hero-undertitle {
    font-size: clamp(9.5px, 3vw, 11px);
  }

  /* page content */
  .page {
    padding-left: clamp(16px, 5vw, 24px);
    padding-right: clamp(16px, 5vw, 24px);
  }

  .toc-outer {
    padding-left: clamp(16px, 5vw, 24px);
    padding-right: clamp(16px, 5vw, 24px);
  }

  /* chapter headers */
  .ch-head::before {
    width: 40px;
  }

  .ch h2 {
    font-size: clamp(1.25rem, 7vw, 1.7rem);
  }

  /* definition boxes */
  .def-body {
    padding-left: clamp(12px, 4vw, 20px);
    padding-right: clamp(12px, 4vw, 20px);
  }

  /* derivation rows */
  .drv-row {
    grid-template-columns: 24px 1fr;
    gap: 8px;
    padding-left: clamp(12px, 4vw, 18px);
    padding-right: clamp(12px, 4vw, 18px);
  }

  /* marginal callout */
  .marg {
    display: block;
  }

  .marg-tag {
    writing-mode: horizontal-tb;
    transform: none;
    border-right: none;
    border-bottom: 2px solid;
    padding-bottom: 6px;
    margin-bottom: 10px;
  }

  /* theorem */
  .thm {
    padding-left: clamp(14px, 4vw, 22px);
    padding-right: clamp(14px, 4vw, 22px);
  }

  /* TOC grid: single column */
  .toc-grid {
    grid-template-columns: 1fr;
  }

  /* figures */
  .fig-box {
    padding: clamp(10px, 3vw, 16px);
  }

  /* hero strip */
  .hs-label {
    font-size: clamp(7px, 2.5vw, 9px);
  }
}