/* =============================================================
   revenue-management.org — light, elegant, hospitality-inspired
   ============================================================= */

:root {
  /* Brand palette — light, easy on the eyes */
  --bg:          #fbfaf6;   /* parchment */
  --bg-alt:      #f3efe6;   /* warm sand */
  --bg-soft:     #f8f5ec;
  --surface:     #ffffff;
  --ink:         #1c2733;   /* deep slate-navy */
  --ink-soft:    #3b4754;
  --muted:       #6a7480;
  --rule:        #e5dfd0;   /* hairline */
  --rule-strong: #d6cdb6;

  --navy:        #1f4e79;   /* primary  */
  --navy-deep:   #14385a;
  --teal:        #0e8a6a;   /* secondary */
  --copper:      #b8651e;   /* tertiary */
  --gold:        #d39b2c;
  --plum:        #6f3c7a;
  --rose:        #c1497a;

  --link:        var(--navy);
  --link-hover:  var(--copper);

  --shadow-sm: 0 1px 2px rgba(28,39,51,0.05), 0 1px 1px rgba(28,39,51,0.04);
  --shadow:    0 4px 14px rgba(28,39,51,0.08), 0 1px 2px rgba(28,39,51,0.04);
  --shadow-lg: 0 16px 40px rgba(28,39,51,0.10), 0 2px 6px rgba(28,39,51,0.06);

  --radius:    14px;
  --radius-sm:  8px;
  --radius-lg: 22px;

  --header-h: 68px;
  --maxw:    1440px;
  --content-maxw: 1180px;

  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: clamp(15.5px, 0.45vw + 14px, 17.5px);
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 80% -200px, rgba(31,78,121,0.06), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(14,138,106,0.05), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6,
p, li, td, th, dt, dd { overflow-wrap: anywhere; }

main { flex: 1 0 auto; }

img, svg { max-width: 100%; height: auto; display: block; }

/* --------- Typography ---------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 2.4rem 0 1rem;
  font-weight: 600;
}
h1 { font-size: clamp(2rem, 2.2vw + 1rem, 3.3rem); margin-top: 0.5rem; }
h2 { font-size: clamp(1.45rem, 0.9vw + 1rem, 2.1rem); }
h3 { font-size: clamp(1.2rem, 0.4vw + 1rem, 1.55rem); }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.05rem; }
strong { color: var(--ink); font-weight: 650; }

a {
  color: var(--link);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color .2s ease, background-size .25s ease;
}
a:hover, a:focus-visible {
  color: var(--link-hover);
  background-size: 100% 1.5px;
}

::selection { background: rgba(31,78,121,0.18); color: var(--ink); }

/* --------- Layout containers -------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  padding: 0 clamp(16px, 3vw, 36px);
  margin: 0 auto;
}

.container-prose {
  width: 100%;
  max-width: var(--content-maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 36px);
}

/* --------- Header / nav -------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(251,250,246,0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--rule);
  height: var(--header-h);
  display: flex;
  align-items: center;
}
.site-header__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 36px);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-size: 1.05rem;
  background: none;
}
.brand:hover { color: var(--navy); background-size: 0 0; }
.brand__mark { width: 36px; height: 36px; flex: 0 0 auto; }
.brand__text { line-height: 1.1; }
.brand__text small {
  display: block;
  font-family: var(--font-sans);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.nav { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-weight: 500;
  font-size: 0.94rem;
  background-image: none;
  transition: background-color .2s ease, color .2s ease;
}
.nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.nav a:hover, .nav a:focus-visible {
  background: var(--bg-alt);
  color: var(--ink);
}
.nav a[aria-current="page"] {
  background: var(--ink);
  color: #fffaef;
}
.nav a[aria-current="page"] svg { opacity: 1; }

/* Mobile menu */
.nav-toggle {
  display: none;
  margin-left: auto;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  color: var(--ink);
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.75rem clamp(16px, 3vw, 36px) 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav.is-open { display: flex; }
  .nav a { justify-content: flex-start; padding: 0.7rem 0.9rem; }
}

/* --------- Hero ---------------------------------------------------------- */
.hero {
  padding: clamp(2rem, 6vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.hero__grid > * { min-width: 0; }
@media (max-width: 980px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr); gap: 2rem; }
}
.hero__eyebrow {
  display: inline-block;
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal);
  font-weight: 600;
  margin-bottom: 0.75rem;
}
.hero h1 {
  margin-top: 0;
  font-size: clamp(2.3rem, 3.2vw + 1rem, 4.1rem);
  line-height: 1.05;
  color: var(--ink);
}
.hero h1 .accent {
  background: linear-gradient(90deg, var(--navy) 0%, var(--teal) 55%, var(--copper) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lede {
  font-size: clamp(1.05rem, 0.3vw + 1rem, 1.2rem);
  color: var(--ink-soft);
  max-width: 60ch;
}
.hero__art {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.hero__art .logo-large {
  width: 100%;
  max-width: 440px;
  filter: drop-shadow(0 20px 30px rgba(31,78,121,0.18));
  animation: floaty 9s ease-in-out infinite;
}
@keyframes floaty {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* CTA buttons with colorful icons */
.cta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.9rem;
  margin-top: 1.6rem;
}
.cta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  background-image: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.cta:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow);
  color: var(--ink);
  background-size: 0 0;
}
.cta__icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
}
.cta__icon svg { width: 22px; height: 22px; }
.cta__icon--navy   { background: linear-gradient(135deg, #2666a6, #14385a); }
.cta__icon--teal   { background: linear-gradient(135deg, #16b08a, #0e6d54); }
.cta__icon--copper { background: linear-gradient(135deg, #d97f33, #8c4914); }
.cta__icon--gold   { background: linear-gradient(135deg, #ecbc4e, #a87616); }
.cta__icon--plum   { background: linear-gradient(135deg, #9b58a8, #5b2d65); }

.cta__title { font-weight: 600; line-height: 1.2; }
.cta__sub   { font-size: 0.85rem; color: var(--muted); }

/* --------- Section cards (homepage) ------------------------------------ */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.section-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  position: relative;
  overflow: hidden;
}
.section-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--accent, var(--navy));
}
.section-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--rule-strong);
}
.section-card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--accent, var(--navy));
}
.section-card__icon svg { width: 24px; height: 24px; }
.section-card h3 { margin: 0; font-size: 1.2rem; }
.section-card p { color: var(--ink-soft); margin: 0; }
.section-card__links { margin-top: auto; padding-top: 0.6rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.section-card__links a {
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--bg-alt);
  color: var(--ink-soft);
  background-image: none;
}
.section-card__links a:hover { background: var(--ink); color: #fffaef; background-size: 0 0; }
.section-card__cta {
  align-self: flex-start;
  margin-top: 0.25rem;
  font-weight: 600;
  color: var(--accent, var(--navy));
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1.5px;
  background-repeat: no-repeat;
  background-position: 0 100%;
}
.section-card__cta:hover { background-size: 100% 1.5px; color: var(--accent, var(--navy)); }

/* --------- Prose body --------------------------------------------------- */
.prose {
  max-width: none;
}
.prose h1 {
  background: linear-gradient(90deg, var(--navy) 0%, var(--teal) 55%, var(--copper) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.prose h2 {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.4rem;
}
.prose h2::before,
.prose h3::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 0.55rem;
  border-radius: 2px;
  vertical-align: middle;
  background: var(--teal);
  transform: translateY(-3px);
}
.prose h3::before { background: var(--copper); }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1.1rem; }
.prose li { margin: 0.25rem 0; }

/* Inline code */
.prose :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  color: var(--ink);
  padding: 0.08em 0.4em;
  border-radius: 5px;
  border: 0;
  white-space: break-spaces;
}

/* --------- Code blocks --------------------------------------------------- */
.code-block {
  position: relative;
  margin: 1.25rem 0 1.6rem;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.6rem 0.4rem 0.9rem;
  background: linear-gradient(180deg, var(--bg-alt), var(--bg-soft));
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.code-block__copy {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink-soft);
  padding: 0.25rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.code-block__copy:hover {
  background: var(--ink);
  color: #fffaef;
  border-color: var(--ink);
}
.code-block__copy.is-copied { background: var(--teal); color: #fff; border-color: var(--teal); }

.code-block pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.55;
  background: transparent;
}
.code-block code { background: transparent; padding: 0; color: var(--ink); }

/* Prism token colors — tuned to the warm light palette */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #8a8275; font-style: italic; }
.token.punctuation { color: #4a566a; }
.token.namespace { opacity: 0.7; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted {
  color: #b8651e; /* copper */
}
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted {
  color: #0e8a6a; /* teal */
}
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
  color: #6f3c7a; /* plum */
}
.token.atrule, .token.attr-value, .token.keyword { color: #1f4e79; font-weight: 600; }
.token.function, .token.class-name { color: #14385a; font-weight: 600; }
.token.regex, .token.important, .token.variable { color: #c1497a; }

/* --------- Tables -------------------------------------------------------- */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: 1.25rem 0;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}
.prose thead th {
  background: var(--bg-alt);
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--rule-strong);
  white-space: nowrap;
}
.prose tbody td {
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody tr:hover { background: var(--bg-soft); }

/* --------- Task lists (togglable checkboxes) ---------------------------- */
.prose ul.contains-task-list,
.prose ol.contains-task-list { list-style: none; padding-left: 0.4rem; }
.prose .task-list-item { display: flex; gap: 0.55rem; align-items: flex-start; margin: 0.3rem 0; }
.prose .task-list-item::marker,
.prose .task-list-item::before { content: none !important; }
.prose .task-list-item input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 1.05em; height: 1.05em;
  margin-top: 0.3em;
  border-radius: 5px;
  border: 1.5px solid var(--rule-strong);
  background: var(--surface);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  display: inline-grid;
  place-content: center;
  flex: 0 0 auto;
}
.prose .task-list-item input[type="checkbox"]:hover { border-color: var(--navy); }
.prose .task-list-item input[type="checkbox"]:checked {
  background: var(--teal);
  border-color: var(--teal);
}
.prose .task-list-item input[type="checkbox"]:checked::after {
  content: "";
  width: 0.65em; height: 0.65em;
  background: #fff;
  clip-path: polygon(14% 44%, 0 60%, 40% 100%, 100% 20%, 84% 8%, 39% 70%);
}
.prose .task-list-item.task-list-item-checked > label,
.prose .task-list-item > input[type="checkbox"]:checked + label,
.prose .task-list-item:has(> input[type="checkbox"]:checked) {
  text-decoration: line-through;
  color: var(--muted);
}

/* --------- FAQ accordion ------------------------------------------------ */
.faq-section details {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 0 1rem;
  margin: 0.5rem 0;
  box-shadow: var(--shadow-sm);
}
.faq-section details + details { margin-top: 0.5rem; }
.faq-section summary {
  cursor: pointer;
  list-style: none;
  padding: 0.95rem 0;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}
.faq-section summary::-webkit-details-marker { display: none; }
.faq-section summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.3rem;
  line-height: 1;
  color: var(--navy);
  transition: transform .2s ease;
}
.faq-section details[open] > summary::after { content: "−"; }
.faq-section details > *:not(summary) { padding-bottom: 0.95rem; }

/* --------- Breadcrumbs -------------------------------------------------- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1.2rem 0 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.breadcrumbs a {
  color: var(--ink-soft);
  background-image: none;
}
.breadcrumbs a:hover { color: var(--navy); }
.breadcrumbs span[aria-current] { color: var(--ink); font-weight: 600; }
.breadcrumbs li { display: inline; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.35rem;
  color: var(--rule-strong);
}

/* --------- Related / Next nav ------------------------------------------ */
.page-nav {
  margin: 2.5rem 0 1rem;
  padding: 1.2rem 1.3rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.page-nav__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin: 0 0 0.65rem;
}
.page-nav ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.page-nav a { background-image: none; padding: 0.55rem 0.75rem; border-radius: 8px; display: inline-block; }
.page-nav a:hover { background: var(--bg-alt); color: var(--ink); background-size: 0 0; }

/* Bottom prev/next */
.prev-next {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0 1rem;
}
@media (max-width: 640px) { .prev-next { grid-template-columns: 1fr; } }
.prev-next a {
  background-image: none;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  background: var(--surface);
  display: block;
  transition: transform .2s ease, box-shadow .2s ease;
}
.prev-next a:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.prev-next small { display: block; color: var(--muted); font-size: 0.75rem; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 0.25rem; }
.prev-next strong { display: block; color: var(--ink); font-weight: 600; }
.prev-next .next { text-align: right; }

/* --------- Article meta ------------------------------------------------- */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.2rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.4rem 0 1.5rem;
}

/* --------- Layout grid for content page -------------------------------- */
.content-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(1.25rem, 2.5vw, 2.5rem);
  align-items: start;
  margin: 1rem auto 3rem;
}
@media (max-width: 1024px) {
  .content-layout { grid-template-columns: 1fr; }
}
.toc {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  align-self: start;
  font-size: 0.9rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - var(--header-h) - 32px);
  overflow-y: auto;
}
.toc h4 {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-sans);
  font-weight: 600;
}
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.2rem 0; }
.toc a {
  color: var(--ink-soft);
  background-image: none;
  display: block;
  padding: 0.25rem 0.45rem;
  border-radius: 6px;
}
.toc a:hover { color: var(--navy); background: var(--bg-alt); background-size: 0 0; }
.toc li.depth-3 { padding-left: 0.85rem; font-size: 0.85em; }

/* --------- Heading anchor link styling ------------------------------- */
.heading-anchor {
  color: inherit;
  background-image: none;
  text-decoration: none;
}
.heading-anchor:hover { color: var(--copper); background-size: 0 0; }

/* --------- Mermaid ------------------------------------------------------ */
.mermaid {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1.25rem 0;
  text-align: center;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

/* --------- Footer ------------------------------------------------------- */
.site-footer {
  flex-shrink: 0;
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 1.5rem;
  margin-top: 4rem;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 760px) {
  .site-footer__grid { grid-template-columns: 1fr; }
}
.site-footer .brand { font-size: 1rem; }
.site-footer__intro p { color: var(--ink-soft); margin: 0.6rem 0 0; max-width: 50ch; }
.site-footer__nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}
.site-footer__nav h4 {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 0.55rem;
}
.site-footer__nav ul { list-style: none; padding: 0; margin: 0; }
.site-footer__nav li { margin: 0.2rem 0; }
.site-footer__nav a { color: var(--ink-soft); background-image: none; font-size: 0.95rem; }
.site-footer__nav a:hover { color: var(--navy); }
.site-footer__bottom {
  border-top: 1px solid var(--rule);
  padding-top: 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* --------- Misc --------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* KaTeX block spacing tweak.
   markdown-it-katex emits `<span class="katex-display">` inside a `<p>`, so we
   force block layout and allow horizontal scroll for wide formulas. Vertical
   overflow must stay visible — clipping it cuts off the denominator on fractions. */
.prose .katex-display {
  display: block;
  overflow-x: auto;
  overflow-y: visible;
  padding: 0.75rem 0.25rem;
  margin: 1.25rem 0;
  text-align: center;
}
.prose .katex-display > .katex { display: inline-block; text-align: initial; }
.prose .katex { font-size: 1.05em; line-height: 1.4; }

/* Print */
@media print {
  .site-header, .site-footer, .toc, .code-block__copy, .prev-next, .page-nav, .nav-toggle { display: none !important; }
  body { background: #fff; }
}
