@charset "utf-8";
/* ==========================================================================
   VithursKingOfAEO.com — "The Handbook"
   A documentation design system for the complete King of AEO handbook.
   Single stylesheet. No @import. No external fonts. Light + dark.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Type families */
  --font-sans: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, monospace;

  /* Type scale — restrained, docs-appropriate */
  --fs-3xs: 0.6875rem;
  --fs-2xs: 0.75rem;
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-base: 0.9688rem;
  --fs-md: 1.0625rem;
  --fs-lg: clamp(1.125rem, 0.35vw + 1.05rem, 1.25rem);
  --fs-xl: clamp(1.3rem, 0.6vw + 1.15rem, 1.5rem);
  --fs-2xl: clamp(1.6rem, 1.1vw + 1.35rem, 2.05rem);
  --fs-3xl: clamp(1.95rem, 1.9vw + 1.5rem, 2.7rem);

  --lh-tight: 1.22;
  --lh-snug: 1.4;
  --lh-body: 1.68;

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.375rem;
  --s-6: 1.75rem;
  --s-7: 2.25rem;
  --s-8: 3rem;
  --s-9: 4rem;
  --s-10: 5.5rem;

  /* Radii */
  --r-xs: 3px;
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  /* Layout */
  --topbar-h: 56px;
  --w-sidebar: 17.5rem;
  --w-toc: 15.5rem;
  --measure: 72ch;
  --gutter: 1.25rem;

  /* Motion */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);

  /* ---- Light palette (neutral ramp + indigo accent) ---- */
  --c-surface: #ffffff;
  --c-sunken: #f8fafc;
  --c-raised: #ffffff;
  --c-inset: #f1f5f9;

  --c-ink: #0f172a;
  --c-ink-2: #1e293b;
  --c-muted: #475569;
  --c-faint: #55627a;
  --c-fainter: #63718a;

  --c-border: #e2e8f0;
  --c-border-2: #cbd5e1;

  --c-accent: #4f46e5;
  --c-accent-hover: #4338ca;
  --c-accent-ink: #3730a3;
  --c-accent-soft: #eef2ff;
  --c-accent-line: #c7d2fe;

  /* Callout hues */
  --c-note: #0284c7;
  --c-note-soft: #f0f9ff;
  --c-note-ink: #075985;

  --c-key: #4f46e5;
  --c-key-soft: #eef2ff;
  --c-key-ink: #3730a3;

  --c-def: #0d9488;
  --c-def-soft: #f0fdfa;
  --c-def-ink: #115e59;

  --c-warn: #b45309;
  --c-warn-soft: #fffbeb;
  --c-warn-ink: #92400e;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 1px 3px rgba(15, 23, 42, 0.06), 0 6px 18px -8px rgba(15, 23, 42, 0.12);
  --shadow-pop: 0 12px 32px -12px rgba(15, 23, 42, 0.28);

  --topbar-bg: rgba(255, 255, 255, 0.86);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-surface: #0b1120;
    --c-sunken: #070c16;
    --c-raised: #111a2e;
    --c-inset: #16203a;

    --c-ink: #e8edf7;
    --c-ink-2: #dbe3f0;
    --c-muted: #a8b5cb;
    --c-faint: #94a3b8;
    --c-fainter: #8593a8;

    --c-border: #1e293b;
    --c-border-2: #334155;

    --c-accent: #818cf8;
    --c-accent-hover: #a5b4fc;
    --c-accent-ink: #c7d2fe;
    --c-accent-soft: #1c1f45;
    --c-accent-line: #3b3f7a;

    --c-note: #38bdf8;
    --c-note-soft: #0b2333;
    --c-note-ink: #bae6fd;

    --c-key: #818cf8;
    --c-key-soft: #1c1f45;
    --c-key-ink: #c7d2fe;

    --c-def: #2dd4bf;
    --c-def-soft: #0a2823;
    --c-def-ink: #99f6e4;

    --c-warn: #fbbf24;
    --c-warn-soft: #2b1f07;
    --c-warn-ink: #fde68a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.45), 0 6px 18px -8px rgba(0, 0, 0, 0.6);
    --shadow-pop: 0 12px 32px -12px rgba(0, 0, 0, 0.8);

    --topbar-bg: rgba(11, 17, 32, 0.86);
  }
}

/* --------------------------------------------------------------------------
   2. Reset + base
   -------------------------------------------------------------------------- */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}

body {
  margin: 0;
  background: var(--c-surface);
  color: var(--c-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

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

:focus-visible {
  outline: 2px solid var(--c-accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

a {
  color: var(--c-accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color var(--t-base);
}
a:hover { color: var(--c-accent-hover); text-decoration: underline; }

img, svg { max-width: 100%; }
svg { flex: none; }

hr {
  border: 0;
  border-top: 1px solid var(--c-border);
  margin: var(--s-7) 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  padding: 0.7rem 1.1rem;
  background: var(--c-accent);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: 0 0 var(--r-md) 0;
}
.skip-link:focus {
  left: 0;
  text-decoration: none;
}

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

/* --------------------------------------------------------------------------
   3. Top bar
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  background: var(--topbar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--c-border);
}

.topbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 0 var(--gutter);
  max-width: 100rem;
  margin: 0 auto;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--c-ink);
  font-weight: 700;
  font-size: var(--fs-sm);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex: none;
}
.wordmark:hover { color: var(--c-ink); text-decoration: none; }
.wordmark__mark {
  width: 22px;
  height: 22px;
  border-radius: var(--r-sm);
  background: var(--c-accent);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0;
}
.wordmark__name { white-space: nowrap; }
.wordmark__tld { color: var(--c-fainter); font-weight: 500; }

.topbar__divider {
  width: 1px;
  height: 20px;
  background: var(--c-border-2);
  flex: none;
}

/* Breadcrumb in the top bar */
.crumbs { min-width: 0; flex: 1 1 auto; }
.crumbs ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--c-faint);
  white-space: nowrap;
  overflow: hidden;
}
.crumbs li { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.crumbs li + li::before {
  content: "/";
  color: var(--c-fainter);
  opacity: 0.7;
}
.crumbs a { color: var(--c-faint); }
.crumbs a:hover { color: var(--c-accent); }
.crumbs li:last-child span {
  color: var(--c-ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: none;
}

.topbar__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 34px;
  padding: 0 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-raised);
  color: var(--c-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.topbar__link:hover {
  border-color: var(--c-accent-line);
  color: var(--c-accent);
  background: var(--c-accent-soft);
  text-decoration: none;
}

/* Mobile nav drawer (JS-free) */
.drawer { display: none; }
.drawer > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-raised);
  color: var(--c-ink-2);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  cursor: pointer;
  user-select: none;
}
.drawer > summary::-webkit-details-marker { display: none; }
.drawer[open] > summary { border-color: var(--c-accent-line); color: var(--c-accent); }
.drawer__panel {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-pop);
  padding: var(--s-5) var(--gutter) var(--s-7);
}

/* --------------------------------------------------------------------------
   4. Three-column docs shell
   -------------------------------------------------------------------------- */

.shell {
  max-width: 100rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: var(--w-sidebar) minmax(0, 1fr) var(--w-toc);
  gap: 0 var(--s-8);
  align-items: start;
}

/* --------------------------------------------------------------------------
   5. Sidebar (the primary navigation)
   -------------------------------------------------------------------------- */

.sidebar {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-6) var(--s-4) var(--s-8) 0;
  border-right: 1px solid var(--c-border);
  scrollbar-width: thin;
}
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--c-border-2);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

.nav-group + .nav-group { margin-top: var(--s-5); }

.nav-group__title {
  margin: 0 0 var(--s-2);
  padding-left: 0.7rem;
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--c-border);
}
.nav-list li { margin: 0; }

.nav-list a {
  display: block;
  padding: 0.34rem 0.7rem;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--c-muted);
  font-size: var(--fs-sm);
  line-height: 1.45;
  transition: color var(--t-base), border-color var(--t-base), background var(--t-base);
}
.nav-list a:hover {
  color: var(--c-ink);
  border-left-color: var(--c-border-2);
  text-decoration: none;
}
.nav-list a[aria-current="page"] {
  color: var(--c-accent);
  font-weight: 600;
  border-left-color: var(--c-accent);
  background: var(--c-accent-soft);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}

.sidebar__foot {
  margin-top: var(--s-7);
  padding: var(--s-4) 0 0 0.7rem;
  border-top: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  line-height: 1.6;
  color: var(--c-fainter);
}

/* --------------------------------------------------------------------------
   6. Main document column
   -------------------------------------------------------------------------- */

.doc {
  min-width: 0;
  padding: var(--s-7) 0 var(--s-9);
}

.doc__inner { max-width: var(--measure); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent);
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
}

h1 {
  margin: var(--s-3) 0 var(--s-4);
  font-size: var(--fs-3xl);
  font-weight: 700;
  line-height: var(--lh-tight);
  letter-spacing: -0.024em;
  color: var(--c-ink);
}

/* Publication dateline — the metadata rail beneath the page title */
.docmeta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 var(--s-5);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.docmeta svg { width: 12px; height: 12px; flex: none; }
.docmeta time { color: var(--c-faint); font-weight: 600; letter-spacing: 0.05em; }

.doc__lead {
  margin: 0 0 var(--s-6);
  font-size: var(--fs-lg);
  line-height: 1.55;
  color: var(--c-muted);
}
.doc__lead strong { color: var(--c-ink); font-weight: 650; }

.prose { max-width: var(--measure); }

.prose h2 {
  position: relative;
  margin: var(--s-8) 0 var(--s-4);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
  font-size: var(--fs-2xl);
  font-weight: 660;
  line-height: var(--lh-tight);
  letter-spacing: -0.018em;
  color: var(--c-ink);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}
.prose > h2:first-child { margin-top: var(--s-2); border-top: 0; padding-top: 0; }

.prose h3 {
  position: relative;
  margin: var(--s-6) 0 var(--s-3);
  font-size: var(--fs-xl);
  font-weight: 640;
  line-height: var(--lh-snug);
  letter-spacing: -0.012em;
  color: var(--c-ink);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}

.prose h4 {
  margin: var(--s-5) 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  font-weight: 650;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--c-ink-2);
}

.prose p { margin: 0 0 var(--s-4); }
.prose strong { font-weight: 650; color: var(--c-ink); }

.prose ul,
.prose ol { margin: 0 0 var(--s-5); padding-left: 1.35rem; }
.prose li { margin: 0.3rem 0; }
.prose ul li::marker { color: var(--c-accent); }
.prose ol li::marker { color: var(--c-faint); font-family: var(--font-mono); font-size: var(--fs-xs); }

/* Heading anchors (# on hover) */
.hanchor {
  position: absolute;
  left: -1.35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.35rem;
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 400;
  color: var(--c-accent-line);
  opacity: 0;
  text-align: left;
  transition: opacity var(--t-base), color var(--t-base);
}
.prose h2 .hanchor { top: auto; bottom: 0.1em; transform: none; }
.prose h2:hover .hanchor,
.prose h3:hover .hanchor,
.hanchor:focus-visible { opacity: 1; }
.hanchor:hover { color: var(--c-accent); text-decoration: none; }

/* --------------------------------------------------------------------------
   7. Signature components
   -------------------------------------------------------------------------- */

/* --- Answer capsule --- */
.capsule {
  margin: 0 0 var(--s-6);
  padding: var(--s-5);
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent-line);
  border-radius: var(--r-lg);
}
.capsule__label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-accent-ink);
}
.capsule__label svg { width: 13px; height: 13px; }
.capsule p {
  margin: 0;
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--c-ink);
}
.capsule p + p { margin-top: var(--s-3); }
.capsule strong { font-weight: 660; }

/* --- Key facts table --- */
.keyfacts {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 0 var(--s-6);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  font-size: var(--fs-sm);
}
.keyfacts tr:first-child th { border-top-left-radius: var(--r-lg); }
.keyfacts tr:first-child td { border-top-right-radius: var(--r-lg); }
.keyfacts tr:last-child th { border-bottom-left-radius: var(--r-lg); }
.keyfacts tr:last-child td { border-bottom-right-radius: var(--r-lg); }
.keyfacts caption {
  caption-side: top;
  text-align: left;
  padding: 0 0 var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.keyfacts th,
.keyfacts td {
  padding: 0.62rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-border);
}
.keyfacts tr:last-child th,
.keyfacts tr:last-child td { border-bottom: 0; }
.keyfacts th {
  width: 12.5rem;
  background: var(--c-sunken);
  border-right: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--c-faint);
  white-space: nowrap;
}
.keyfacts td { color: var(--c-ink-2); }
.keyfacts td strong { font-weight: 650; }

/* --- Callouts (4 variants) --- */
.callout {
  --co: var(--c-note);
  --co-soft: var(--c-note-soft);
  --co-ink: var(--c-note-ink);
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 0.75rem;
  margin: var(--s-6) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--co-soft);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--co);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: var(--fs-sm);
  line-height: 1.6;
}
.callout--note { --co: var(--c-note); --co-soft: var(--c-note-soft); --co-ink: var(--c-note-ink); }
.callout--key { --co: var(--c-key); --co-soft: var(--c-key-soft); --co-ink: var(--c-key-ink); }
.callout--definition { --co: var(--c-def); --co-soft: var(--c-def-soft); --co-ink: var(--c-def-ink); }
.callout--warn { --co: var(--c-warn); --co-soft: var(--c-warn-soft); --co-ink: var(--c-warn-ink); }

.callout__icon {
  width: 20px;
  height: 20px;
  margin-top: 0.15rem;
  color: var(--co);
}
.callout__icon svg { width: 20px; height: 20px; display: block; }
.callout__body { min-width: 0; }
.callout__title {
  margin: 0 0 0.3rem;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--co-ink);
}
.callout p { margin: 0 0 0.55rem; color: var(--c-ink-2); }
.callout p:last-child { margin-bottom: 0; }
.callout ul, .callout ol { margin: 0.4rem 0 0.55rem; padding-left: 1.1rem; }
.callout a { color: var(--co-ink); text-decoration: underline; }

/* --- Inline term chips --- */
kbd,
.chip {
  display: inline-block;
  padding: 0.08em 0.42em;
  border: 1px solid var(--c-border-2);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--c-sunken);
  color: var(--c-ink-2);
  font-family: var(--font-mono);
  font-size: 0.86em;
  line-height: 1.5;
  white-space: nowrap;
}
.chip--accent {
  border-color: var(--c-accent-line);
  background: var(--c-accent-soft);
  color: var(--c-accent-ink);
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: var(--r-xs);
  background: var(--c-inset);
  color: var(--c-accent-ink);
}

/* --- Blockquote (used as the "stated relationship" device) --- */
.prose blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--c-sunken);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-size: var(--fs-md);
  line-height: 1.55;
  color: var(--c-ink);
}
.prose blockquote p { margin: 0 0 0.5rem; }
.prose blockquote p:last-child { margin-bottom: 0; }

/* --- Tables in prose --- */
.table-scroll {
  overflow-x: auto;
  margin: 0 0 var(--s-6);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  -webkit-overflow-scrolling: touch;
}
.table-scroll > table { margin: 0; border: 0; border-radius: 0; }

.prose table {
  width: 100%;
  min-width: 30rem;
  border-collapse: separate;
  border-spacing: 0;
  margin: 0 0 var(--s-6);
  font-size: var(--fs-sm);
}
.prose th,
.prose td {
  padding: 0.62rem 0.85rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--c-border);
}
.prose thead th {
  background: var(--c-sunken);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--c-faint);
  white-space: nowrap;
}
.prose tbody tr:last-child td { border-bottom: 0; }
.prose tbody td { color: var(--c-ink-2); }

/* --- Legacy content classes, restyled for the handbook --- */

/* Key/value definition grid used across the original pages */
.kv {
  display: grid;
  grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr);
  margin: 0 0 var(--s-6);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
  font-size: var(--fs-sm);
}
.kv > div {
  padding: 0.62rem 0.85rem;
  border-bottom: 1px solid var(--c-border);
}
.kv > div:nth-child(odd) {
  background: var(--c-sunken);
  border-right: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  color: var(--c-faint);
}
.kv > div:nth-last-child(1),
.kv > div:nth-last-child(2) { border-bottom: 0; }

/* Card grids */
.grid,
.grid3 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: var(--s-3);
  margin: 0 0 var(--s-6);
  padding: 0;
  list-style: none;
}
.card {
  padding: var(--s-4);
  background: var(--c-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
}
.card:hover {
  border-color: var(--c-border-2);
  box-shadow: var(--shadow-md);
}
.card h3 {
  margin: 0 0 0.4rem;
  font-size: var(--fs-md);
  font-weight: 640;
  line-height: 1.35;
  letter-spacing: -0.008em;
  color: var(--c-ink);
}
.card p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--c-muted);
}
.card p + p { margin-top: 0.5rem; }

/* Numbered "reason" cards */
.card.reason {
  position: relative;
  padding-left: 3.4rem;
}
.reason-num {
  position: absolute;
  left: var(--s-4);
  top: var(--s-4);
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: var(--c-accent-soft);
  border: 1px solid var(--c-accent-line);
  color: var(--c-accent-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 650;
}
.card.reason h3 {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-fainter);
}

/* Domain / resource cards */
.domain-card h3 { margin-top: 0.35rem; }
.domain-card h3 a { color: var(--c-ink); }
.domain-card h3 a:hover { color: var(--c-accent); text-decoration: none; }
.pill {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--c-border-2);
  border-radius: var(--r-pill);
  background: var(--c-sunken);
  color: var(--c-faint);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  letter-spacing: 0.03em;
  white-space: nowrap;
}

/* Call-to-action strip */
.cta {
  margin: var(--s-5) 0 var(--s-6);
  padding: var(--s-4) var(--s-5);
  background: var(--c-sunken);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  color: var(--c-muted);
}
.cta a { font-weight: 600; }

/* The bold "answer" statement block */
.answer {
  margin: 0 0 var(--s-6);
  padding: var(--s-5);
  background: var(--c-ink);
  border: 1px solid var(--c-ink);
  border-radius: var(--r-lg);
  color: #f8fafc;
}
.answer .label {
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #a5b4fc;
}
.answer .big {
  margin-top: 0.25rem;
  font-size: var(--fs-2xl);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: #ffffff;
}
.answer p { margin: 0.5rem 0 0; font-size: var(--fs-sm); color: #cbd5e1; }
.answer strong { color: #ffffff; font-weight: 650; }
@media (prefers-color-scheme: dark) {
  .answer { background: var(--c-inset); border-color: var(--c-border-2); }
  .answer .big { color: var(--c-ink); }
  .answer p { color: var(--c-muted); }
  .answer strong { color: var(--c-ink); }
}

/* Index box (homepage handbook index) */
.indexbox {
  margin: 0 0 var(--s-6);
  padding: var(--s-5);
  background: var(--c-sunken);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}
.indexbox > strong {
  display: block;
  margin-bottom: var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-faint);
}
.indexbox ul {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: var(--s-6);
  font-size: var(--fs-sm);
}
.indexbox li { margin: 0.18rem 0; break-inside: avoid; }

/* Glossary definition list */
.glossary {
  margin: 0 0 var(--s-6);
  border-top: 1px solid var(--c-border);
}
.glossary dt {
  position: relative;
  margin: 0;
  padding: var(--s-4) 0 0.2rem;
  font-weight: 650;
  font-size: var(--fs-md);
  color: var(--c-ink);
  scroll-margin-top: calc(var(--topbar-h) + 1rem);
}
.glossary dd {
  margin: 0;
  padding: 0 0 var(--s-4);
  border-bottom: 1px solid var(--c-border);
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.glossary dt .hanchor { bottom: 0.25em; top: auto; transform: none; }
.glossary dt:hover .hanchor { opacity: 1; }

/* Alphabet jump index */
.jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 var(--s-6);
  padding: 0;
  list-style: none;
}
.jump a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 0.55rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-raised);
  color: var(--c-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.jump a:hover {
  border-color: var(--c-accent-line);
  background: var(--c-accent-soft);
  color: var(--c-accent);
  text-decoration: none;
}

/* Steps list */
.steps { counter-reset: step; list-style: none; margin: 0 0 var(--s-6); padding-left: 0.9rem; }
.steps > li {
  counter-increment: step;
  position: relative;
  margin: 0;
  padding: 0 0 var(--s-5) var(--s-7);
  border-left: 1px solid var(--c-border);
}
.steps > li:last-child { border-left-color: transparent; padding-bottom: 0; }
.steps > li::before {
  content: counter(step);
  position: absolute;
  left: -0.85rem;
  top: 0;
  width: 1.7rem;
  height: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-pill);
  background: var(--c-surface);
  border: 1px solid var(--c-accent-line);
  color: var(--c-accent-ink);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 650;
}
.steps h3 { margin-top: 0 !important; }

/* Cite-this-page block */
.cite {
  margin: var(--s-7) 0 0;
  padding: var(--s-4) var(--s-5);
  background: var(--c-sunken);
  border: 1px dashed var(--c-border-2);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
}
.cite__label {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.cite p { margin: 0; color: var(--c-muted); font-family: var(--font-mono); font-size: var(--fs-xs); line-height: 1.6; }

/* --------------------------------------------------------------------------
   8. Prev / next pager
   -------------------------------------------------------------------------- */

.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: var(--s-3);
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-border);
}
.pager__link {
  display: block;
  padding: var(--s-4);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-raised);
  transition: border-color var(--t-base), background var(--t-base), transform var(--t-base);
}
.pager__link:hover {
  border-color: var(--c-accent-line);
  background: var(--c-accent-soft);
  text-decoration: none;
}
.pager__dir {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.pager__title {
  display: block;
  margin-top: 0.2rem;
  font-size: var(--fs-sm);
  font-weight: 620;
  line-height: 1.4;
  color: var(--c-ink);
}
.pager__link--prev { text-align: left; }
.pager__link--next { text-align: right; }

/* --------------------------------------------------------------------------
   9. On this page (right rail) + inline TOC
   -------------------------------------------------------------------------- */

.toc {
  position: sticky;
  top: var(--topbar-h);
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-7) 0 var(--s-8) var(--s-5);
  border-left: 1px solid var(--c-border);
  scrollbar-width: thin;
}
.toc__title {
  margin: 0 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block;
  padding: 0.25rem 0;
  color: var(--c-faint);
  font-size: var(--fs-xs);
  line-height: 1.45;
  transition: color var(--t-base);
}
.toc a:hover { color: var(--c-accent); text-decoration: none; }
.toc .toc-3 a { padding-left: 0.85rem; color: var(--c-fainter); }

/* Inline (tablet/mobile) TOC */
.toc-inline {
  display: none;
  margin: 0 0 var(--s-6);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-sunken);
}
.toc-inline > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0 var(--s-4);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-faint);
}
.toc-inline > summary::-webkit-details-marker { display: none; }
.toc-inline > summary::after {
  content: "";
  margin-left: auto;
  width: 7px; height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--t-base);
}
.toc-inline[open] > summary::after { transform: rotate(-135deg) translate(-1px, -1px); }
.toc-inline ol { list-style: none; margin: 0; padding: 0 var(--s-4) var(--s-4); }
.toc-inline a {
  display: block;
  padding: 0.3rem 0;
  color: var(--c-muted);
  font-size: var(--fs-sm);
}
.toc-inline .toc-3 a { padding-left: 0.9rem; color: var(--c-faint); font-size: var(--fs-xs); }

/* --------------------------------------------------------------------------
   10. Footer
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--c-border);
  background: var(--c-sunken);
}
.site-footer__inner {
  max-width: 100rem;
  margin: 0 auto;
  padding: var(--s-8) var(--gutter) var(--s-7);
}
.footer-statement {
  max-width: 60ch;
  margin: 0 0 var(--s-7);
}
.footer-statement p { margin: 0 0 var(--s-2); }
.footer-statement .lede {
  font-size: var(--fs-md);
  font-weight: 650;
  color: var(--c-ink);
}
.footer-statement .small { font-size: var(--fs-sm); color: var(--c-muted); }

.footer-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--s-6) var(--s-5);
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-border);
}
.footer-cols h2 {
  margin: 0 0 var(--s-3);
  font-family: var(--font-mono);
  font-size: var(--fs-3xs);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-fainter);
}
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 0 0 0.3rem; }
.footer-cols a { color: var(--c-muted); font-size: var(--fs-sm); }
.footer-cols a:hover { color: var(--c-accent); text-decoration: none; }

.footer-base {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  align-items: baseline;
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-border);
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--c-fainter);
}
.footer-base a { color: var(--c-faint); }

/* --------------------------------------------------------------------------
   11. Utility / misc
   -------------------------------------------------------------------------- */

.lede { font-size: var(--fs-md); }
.small { font-size: var(--fs-sm); }
.muted { color: var(--c-muted); }

.notice {
  margin: 0 0 var(--s-6);
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  background: var(--c-sunken);
  font-size: var(--fs-sm);
  color: var(--c-muted);
}

.link-list { list-style: none; margin: 0 0 var(--s-6); padding: 0; }
.link-list li {
  margin: 0;
  border-bottom: 1px solid var(--c-border);
}
.link-list li:first-child { border-top: 1px solid var(--c-border); }
.link-list a {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0.2rem;
  min-height: 44px;
  color: var(--c-ink);
}
.link-list a:hover { color: var(--c-accent); text-decoration: none; background: var(--c-sunken); }
.link-list .path {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--c-fainter);
}

.sec-index { margin: 0 0 var(--s-7); }
.sec-index__head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: var(--s-3);
}
.sec-index__num {
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
  color: var(--c-accent);
  font-weight: 650;
}

/* --------------------------------------------------------------------------
   12. Responsive
   -------------------------------------------------------------------------- */

/* Tablet + small laptop: drop the right rail, keep the sidebar */
@media (max-width: 1180px) {
  .shell {
    grid-template-columns: var(--w-sidebar) minmax(0, 1fr);
    gap: 0 var(--s-7);
  }
  .toc { display: none; }
  .toc-inline { display: block; }
}

/* Phone / small tablet: sidebar becomes a drawer in the top bar */
@media (max-width: 900px) {
  :root { --gutter: 1rem; }
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .sidebar { display: none; }
  .drawer { display: block; }
  .topbar__divider,
  .crumbs { display: none; }
  .doc { padding-top: var(--s-6); }
  .indexbox ul { columns: 1; }
  .grid, .grid3 { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .kv > div:nth-child(odd) { border-right: 0; border-bottom: 0; padding-bottom: 0.2rem; }
  .keyfacts { display: block; }
  .keyfacts caption { display: block; }
  .keyfacts thead, .keyfacts tbody, .keyfacts tr, .keyfacts th, .keyfacts td { display: block; width: auto; }
  .keyfacts th { border-right: 0; border-bottom: 0; padding-bottom: 0.2rem; white-space: normal; }
  .pager__link--next { text-align: left; }
  .hanchor { display: none; }

  /* Tap targets: every interactive item gets at least 44px of height */
  .drawer__panel .nav-list a,
  .toc-inline ol a,
  .footer-cols a {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding-top: 0;
    padding-bottom: 0;
  }
  .footer-cols li { margin-bottom: 0; }
  .jump a { min-height: 44px; min-width: 44px; justify-content: center; }
  kbd, .chip { white-space: normal; overflow-wrap: anywhere; }
  .topbar__link, .drawer > summary { min-height: 44px; }
  .glossary dt { padding-top: var(--s-5); }
}

@media (max-width: 560px) {
  .wordmark__tld { display: none; }
  .topbar__link span { display: none; }
  .topbar__link { padding: 0 0.6rem; }
}

/* Extra-wide: let the shell breathe */
@media (min-width: 1600px) {
  :root { --w-sidebar: 19rem; --w-toc: 17rem; --gutter: 2.5rem; }
}

/* --------------------------------------------------------------------------
   13. Motion + print
   -------------------------------------------------------------------------- */

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

@media print {
  :root {
    --c-surface: #fff; --c-sunken: #fff; --c-raised: #fff; --c-inset: #fff;
    --c-ink: #000; --c-ink-2: #111; --c-muted: #222; --c-faint: #444; --c-fainter: #555;
    --c-border: #bbb; --c-border-2: #999;
    --c-accent: #000; --c-accent-ink: #000; --c-accent-soft: #fff; --c-accent-line: #999;
  }
  body { font-size: 10.5pt; line-height: 1.45; }
  .topbar, .sidebar, .toc, .toc-inline, .drawer, .pager, .skip-link, .site-footer .footer-cols { display: none !important; }
  .shell { display: block; padding: 0; max-width: none; }
  .doc { padding: 0; }
  .doc__inner, .prose { max-width: none; }
  a { color: #000; text-decoration: underline; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #444; }
  .prose h2, .prose h3 { break-after: avoid; }
  .capsule, .callout, .card, .keyfacts, blockquote, table { break-inside: avoid; }
  .answer { background: #fff !important; color: #000 !important; border: 1px solid #000; }
  .answer .big, .answer strong, .answer p, .answer .label { color: #000 !important; }
  .site-footer { border-top: 1px solid #999; }
  .hanchor { display: none; }
}
