/* =============================================================
   DIFC GUIDE 2026 — Editorial Microsite
   10 Leaves × Legability · 2026 Edition
   ============================================================= */

/* -------- Design Tokens -------- */
:root {
  --navy: #222D5A;
  --navy-deep: #1a1f3a;
  --navy-soft: #2b3968;
  --gold: #B2955C;
  --gold-light: #D4B97A;
  --gold-dark: #8f7646;
  --cream: #F8F4F0;
  --cream-deep: #F1EBE2;
  --surface: #FFFFFF;
  --ink: #0A0A0A;
  --ink-2: #1a1a1a;
  --slate: #3D5070;
  --steel: #688EA8;
  --border: #D4CCC2;
  --border-soft: #E8E2D8;
  --muted: #BABDC2;
  --muted-text: #6B7184;
  --plum: #3C245C;
  --plum-deep: #2A1840;
  --plum-light: #5C3A88;
  --plum-wash: #f1ecf5;
  --legability-gold: #B09060;

  --bg: var(--cream);
  --surface-bg: var(--surface);
  --text: var(--ink);
  --text-muted: var(--muted-text);
  --heading: var(--navy-deep);
  --rule: var(--border);
  --rule-soft: var(--border-soft);
  --accent: var(--gold);
  --link: var(--navy);

  --ff-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --ff-serif: 'Cormorant Garamond', 'Georgia', serif;
  --ff-mono: 'IBM Plex Mono', 'SF Mono', Consolas, monospace;

  --max-read: 72ch;
  --max-wide: 1320px;
  --nav-w: 280px;
  --toc-w: 240px;
  --topbar-h: 64px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-fast: 180ms;
  --t-med: 320ms;
  --t-slow: 600ms;
}

[data-theme="dark"] {
  --bg: #0F131F;
  --surface-bg: #161b2a;
  --text: #E8E6E1;
  --text-muted: #9aa0b5;
  --heading: #F1EEE6;
  --rule: #2b3144;
  --rule-soft: #232839;
  --cream: #0F131F;
  --cream-deep: #161b2a;
  --surface: #161b2a;
  --navy-deep: #0B0F1A;
  --plum-wash: #1c1428;
  --link: var(--gold-light);
}

/* -------- Reset / Base -------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--ff-sans);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.8;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background var(--t-med) var(--ease), color var(--t-med) var(--ease);
}
img, svg { max-width: 100%; display: block; }
a { color: var(--link); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--gold); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

/* -------- Typography -------- */
h1, h2, h3, h4, h5 { color: var(--heading); font-weight: 300; letter-spacing: -0.01em; margin-top: 0; line-height: 1.2; }
h1 { font-weight: 300; font-size: 2.25rem; letter-spacing: -0.02em; margin: 0 0 1.5rem; }
h2 { font-weight: 400; font-size: 1.5rem; letter-spacing: -0.01em; margin: 3rem 0 1rem; }
h3 { font-weight: 500; font-size: 1.1rem; letter-spacing: 0.02em; margin: 2rem 0 .75rem; text-transform: none; }
h4 { font-weight: 500; font-size: 1rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1.25rem; }
strong { font-weight: 500; color: var(--heading); }
em { font-style: italic; }
ul, ol { padding-left: 1.25rem; margin: 0 0 1.5rem; }
ul li, ol li { margin-bottom: .5rem; }
ul li::marker { color: var(--gold); }
blockquote {
  margin: 2rem 0;
  padding: .25rem 0 .25rem 1.5rem;
  border-left: 2px solid var(--gold);
  font-family: var(--ff-serif);
  font-size: 1.4rem;
  font-weight: 300;
  font-style: italic;
  line-height: 1.5;
  color: var(--heading);
}

.eyebrow {
  font-family: var(--ff-mono);
  font-weight: 300;
  font-size: .75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1rem;
}
.caption { font-family: var(--ff-mono); font-weight: 300; font-size: .8rem; letter-spacing: 0.08em; color: var(--text-muted); }
.mono { font-family: var(--ff-mono); }

/* -------- Topbar -------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 3vw, 2rem);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--rule-soft);
}
.topbar__brand {
  font-family: var(--ff-mono);
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}
.topbar__brand a { color: inherit; }
.topbar__nav {
  display: none;
  gap: 1.75rem;
  align-items: center;
}
.topbar__nav a {
  font-family: var(--ff-sans);
  font-size: .82rem;
  letter-spacing: .04em;
  color: var(--text);
  text-transform: none;
  font-weight: 400;
  position: relative;
}
.topbar__nav a.active,
.topbar__nav a:hover { color: var(--gold); }
.topbar__right { display: flex; align-items: center; gap: .75rem; }
.topbar__btn {
  font-family: var(--ff-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .55rem .85rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.topbar__btn:hover { border-color: var(--gold); color: var(--gold); }
.topbar__btn--solid { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.topbar__btn--solid:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy-deep); }
.topbar__btn--icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.topbar__btn--icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.5; }

@media (min-width: 1024px) {
  .topbar__nav { display: flex; }
}

/* Hamburger visibility */
.topbar__ham { display: inline-flex; }
@media (min-width: 1024px) { .topbar__ham { display: none; } }

/* -------- Shell -------- */
.shell {
  display: grid;
  grid-template-columns: 1fr;
  max-width: var(--max-wide);
  margin: 0 auto;
  gap: 0;
  padding: 0 clamp(1rem, 3vw, 2rem);
}
@media (min-width: 1024px) {
  .shell {
    grid-template-columns: var(--nav-w) minmax(0, 1fr);
    gap: 2.5rem;
  }
  .shell--with-toc {
    grid-template-columns: var(--nav-w) minmax(0, 1fr) var(--toc-w);
    gap: 2rem;
  }
}

/* -------- Side Nav -------- */
.sidenav {
  display: none;
  padding: 2.5rem 0 2rem;
  position: sticky;
  top: var(--topbar-h);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  border-right: 1px solid var(--rule-soft);
  padding-right: 1.25rem;
}
@media (min-width: 1024px) { .sidenav { display: block; } }

.sidenav__section { margin-bottom: 1.5rem; }
.sidenav__label {
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .5rem;
  display: block;
}
.sidenav__link {
  display: block;
  padding: .35rem 0;
  font-size: .92rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  padding-left: .75rem;
  margin-left: -.75rem;
  transition: all var(--t-fast) var(--ease);
}
.sidenav__link:hover { color: var(--text); border-left-color: var(--rule); }
.sidenav__link.active { color: var(--gold); border-left-color: var(--gold); font-weight: 400; }

/* Mobile drawer */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}
.drawer[aria-hidden="false"] { display: block; }
.drawer__scrim {
  position: absolute; inset: 0;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(2px);
}
.drawer__panel {
  position: absolute;
  top: 0; left: 0;
  height: 100dvh;
  width: min(88vw, 360px);
  background: var(--bg);
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  transform: translateX(-100%);
  transition: transform var(--t-med) var(--ease);
}
.drawer[aria-hidden="false"] .drawer__panel { transform: translateX(0); }
.drawer__close {
  float: right;
  background: transparent;
  border: 1px solid var(--rule);
  width: 36px; height: 36px; border-radius: 999px;
  cursor: pointer;
  color: var(--text);
  display: inline-flex; align-items: center; justify-content: center;
}

/* -------- Main & Article -------- */
.main { min-width: 0; padding: 2.5rem 0 4rem; }
.article { max-width: var(--max-read); }
.article > * { max-width: 100%; }

.article-meta {
  display: flex; flex-wrap: wrap; gap: 1.25rem;
  margin: -.5rem 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--ff-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.author-badge {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  padding: .5rem .9rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.author-badge .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.author-badge--10leaves .dot { background: var(--gold); }
.author-badge--10leaves .who { color: var(--gold); }
.author-badge--legability .dot { background: var(--plum-light); }
.author-badge--legability .who { color: var(--plum-light); font-family: var(--ff-serif); font-style: italic; letter-spacing: .04em; text-transform: none; font-size: .95rem; }
.author-badge--joint .dot { background: linear-gradient(90deg, var(--gold), var(--plum-light)); }

/* -------- Right TOC -------- */
.toc {
  display: none;
  position: sticky;
  top: calc(var(--topbar-h) + 2rem);
  align-self: start;
  max-height: calc(100vh - var(--topbar-h) - 2rem);
  overflow-y: auto;
  padding: 0 0 1.5rem .5rem;
  border-left: 1px solid var(--rule-soft);
}
@media (min-width: 1280px) { .shell--with-toc .toc { display: block; } }
.toc__label {
  font-family: var(--ff-mono);
  font-size: .68rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold);
  padding-left: 1rem;
  margin-bottom: .5rem;
}
.toc a {
  display: block;
  padding: .25rem 0 .25rem 1rem;
  font-size: .85rem;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  line-height: 1.4;
  margin-bottom: .25rem;
}
.toc a.h3 { padding-left: 1.75rem; font-size: .8rem; }
.toc a:hover, .toc a.active { color: var(--gold); border-left-color: var(--gold); }

/* -------- Footer -------- */
.footer {
  background: var(--navy-deep);
  color: #d3d6e0;
  padding: 4rem clamp(1rem, 3vw, 2rem) 2rem;
  margin-top: 4rem;
}
.footer__inner { max-width: var(--max-wide); margin: 0 auto; }
.footer__top { display: grid; grid-template-columns: 1fr; gap: 2rem; padding-bottom: 2rem; border-bottom: 1px solid #2a3456; }
@media (min-width: 768px) { .footer__top { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer__brand { color: var(--gold); font-family: var(--ff-mono); letter-spacing: .3em; font-size: .72rem; text-transform: uppercase; margin-bottom: 1rem; }
.footer h4 { color: #fff; font-weight: 400; font-size: .9rem; margin-bottom: 1rem; letter-spacing: .08em; text-transform: uppercase; }
.footer a { color: #b7bdd0; font-size: .88rem; display: block; padding: .25rem 0; }
.footer a:hover { color: var(--gold); }
.footer__bottom {
  padding-top: 1.5rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
  font-family: var(--ff-mono);
  font-size: .7rem;
  letter-spacing: .1em;
  color: #8590af;
}

/* -------- Buttons / CTAs -------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.4rem;
  font-family: var(--ff-mono);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--gold);
  color: var(--gold);
  background: transparent;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.btn:hover { background: var(--gold); color: var(--navy-deep); }
.btn--solid { background: var(--gold); color: var(--navy-deep); }
.btn--solid:hover { background: var(--gold-light); border-color: var(--gold-light); color: var(--navy-deep); }
.btn--ghost { border-color: var(--rule); color: var(--text); }
.btn--ghost:hover { border-color: var(--gold); color: var(--gold); background: transparent; }
.btn--lg { padding: 1.05rem 1.8rem; font-size: .85rem; }
.btn .arr { transition: transform var(--t-fast) var(--ease); }
.btn:hover .arr { transform: translateX(3px); }

/* -------- Landing Hero -------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  padding: 0 clamp(1.25rem, 5vw, 4rem) clamp(3rem, 8vh, 6rem);
  color: #fff;
  overflow: hidden;
  isolation: isolate;
}
.hero__bg {
  position: absolute; inset: 0; z-index: -2;
  background-size: cover; background-position: center;
}
.hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 14, 30, 0.25) 0%, rgba(10, 14, 30, 0.55) 60%, rgba(10, 14, 30, 0.85) 100%);
}
.hero__inner { position: relative; max-width: 1200px; width: 100%; margin: 0 auto; }
.hero__eyebrow {
  font-family: var(--ff-mono);
  font-size: .72rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold-light);
  margin-bottom: 1.5rem;
}
.hero__title {
  font-family: var(--ff-sans);
  font-weight: 200;
  font-size: clamp(3rem, 8vw, 6.25rem);
  letter-spacing: -0.04em;
  line-height: 1;
  margin: 0 0 1.25rem;
  color: #fff;
  max-width: 18ch;
}
.hero__sub {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  line-height: 1.5;
  max-width: 44ch;
  color: #eae2d0;
  margin: 0 0 2rem;
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: .9rem; margin-bottom: 2rem; }
.hero__ctas .btn { color: #fff; border-color: rgba(255,255,255,0.55); }
.hero__ctas .btn--solid { background: var(--gold); border-color: var(--gold); color: var(--navy-deep); }
.hero__ctas .btn--solid:hover { background: var(--gold-light); border-color: var(--gold-light); }
.hero__ctas .btn:not(.btn--solid):hover { background: rgba(255,255,255,.08); border-color: #fff; color: #fff; }
.hero__scroll {
  position: absolute;
  left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  font-family: var(--ff-mono); font-size: .65rem; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(255,255,255,.75);
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.hero__scroll::after {
  content: ""; width: 1px; height: 28px; background: rgba(255,255,255,.45);
  animation: scrollHint 2.2s var(--ease) infinite;
}
@keyframes scrollHint { 0% { transform: scaleY(0); transform-origin: top } 50% { transform: scaleY(1); transform-origin: top } 50.01% { transform-origin: bottom } 100% { transform: scaleY(0); transform-origin: bottom } }

/* -------- Sections -------- */
.section { padding: clamp(4rem, 9vw, 7rem) clamp(1rem, 3vw, 2rem); }
.section__inner { max-width: var(--max-wide); margin: 0 auto; }
.section__kicker {
  font-family: var(--ff-mono);
  font-size: .75rem;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}
.section__title {
  font-family: var(--ff-sans);
  font-weight: 200;
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--heading);
  margin: 0 0 2rem;
  max-width: 22ch;
}
.section--plum { background: var(--plum); color: #f3ebe0; }
.section--plum .section__kicker { color: var(--gold-light); }
.section--plum .section__title { color: #f3ebe0; font-family: var(--ff-serif); font-weight: 300; font-style: italic; }

/* Executive summary */
.exec { padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 3vw, 2rem); }
.exec__grid { max-width: var(--max-wide); margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 2rem; }
@media (min-width: 900px) { .exec__grid { grid-template-columns: 1fr 1.2fr; gap: 4rem; } }
.exec__lede {
  font-family: var(--ff-serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.5;
  color: var(--heading);
}
.exec__body p { font-size: 1.02rem; color: var(--text); }

/* Data Ribbon */
.ribbon {
  background: var(--navy-deep);
  color: #fff;
  padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 3vw, 2rem);
  border-top: 1px solid rgba(255,255,255,.08);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ribbon__grid {
  max-width: var(--max-wide); margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2rem 1.5rem;
}
@media (min-width: 700px) { .ribbon__grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .ribbon__grid { grid-template-columns: repeat(6, 1fr); } }
.stat { position: relative; padding-left: 1rem; border-left: 1px solid rgba(255,255,255,.15); }
.stat__num {
  font-family: var(--ff-sans);
  font-weight: 200;
  font-size: clamp(2rem, 3.6vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: #fff;
  margin-bottom: .4rem;
}
.stat__num em { font-style: normal; color: var(--gold-light); }
.stat__label {
  font-family: var(--ff-mono);
  font-size: .7rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #c3c9dc;
}

/* Section grid cards */
.cards { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1080px) { .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  position: relative;
  background: var(--surface-bg);
  border: 1px solid var(--rule);
  padding: 2rem 1.75rem 2.25rem;
  border-radius: 2px;
  overflow: hidden;
  transition: transform var(--t-med) var(--ease), border-color var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  min-height: 340px;
}
.card:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 28px 60px -35px rgba(34, 45, 90, 0.35); }
.card__num {
  font-family: var(--ff-mono);
  font-size: .7rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}
.card__title {
  font-family: var(--ff-sans);
  font-weight: 300;
  font-size: 1.7rem;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 1rem 0 .8rem;
  color: var(--heading);
}
.card__desc { font-size: .95rem; line-height: 1.6; color: var(--text-muted); margin: 0 0 1.5rem; flex-grow: 1; }
.card__cta {
  font-family: var(--ff-mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex; align-items: center; gap: .5rem;
}
.card__cta .arr { transition: transform var(--t-med) var(--ease); }
.card:hover .card__cta .arr { transform: translateX(4px); }
.card--legability .card__num { color: var(--plum-light); }
.card--legability .card__title { font-family: var(--ff-serif); font-style: italic; font-weight: 400; }
.card--legability:hover { border-color: var(--plum-light); box-shadow: 0 28px 60px -35px rgba(60, 36, 92, 0.35); }
.card--legability .card__cta { color: var(--plum-light); }

.card__img {
  margin: -2rem -1.75rem 1.25rem;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--navy);
}

/* About publishers */
.pub {
  display: grid; grid-template-columns: 1fr; gap: 2rem;
  max-width: var(--max-wide); margin: 0 auto;
}
@media (min-width: 900px) { .pub { grid-template-columns: 1fr 1fr; gap: 4rem; position: relative; } }
.pub__item h3 { font-family: var(--ff-sans); font-weight: 300; font-size: 1.8rem; letter-spacing: -.01em; color: var(--heading); margin-bottom: 1rem; }
.pub__item--legability h3 { font-family: var(--ff-serif); font-style: italic; font-weight: 400; color: var(--plum); }
[data-theme="dark"] .pub__item--legability h3 { color: var(--plum-light); }
.pub__item .tag { font-family: var(--ff-mono); font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.pub__item--legability .tag { color: var(--plum-light); }
@media (min-width: 900px) {
  .pub::before {
    content: ""; position: absolute; left: 50%; top: 0; bottom: 0;
    width: 1px; background: linear-gradient(180deg, transparent, var(--gold) 30%, var(--gold) 70%, transparent);
    opacity: .45;
  }
}

/* Full-width download strip */
.download-strip {
  background: var(--navy);
  color: #fff;
  padding: clamp(3rem, 6vw, 5rem) clamp(1rem, 3vw, 2rem);
  text-align: center;
}
.download-strip h2 { color: #fff; font-family: var(--ff-sans); font-weight: 200; font-size: clamp(1.75rem, 4vw, 2.6rem); letter-spacing: -.02em; margin-bottom: 1rem; }
.download-strip p { color: #c3c9dc; max-width: 48ch; margin: 0 auto 2rem; }
.download-strip .btn { border-color: var(--gold); color: var(--gold); }
.download-strip .btn:hover { background: var(--gold); color: var(--navy-deep); }
.download-strip .btn--solid { background: var(--gold); color: var(--navy-deep); }

/* -------- Tables -------- */
.table-wrap { overflow-x: auto; margin: 2rem 0; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface-bg); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .85rem 1rem; text-align: left; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th {
  background: var(--navy);
  color: #f7f1e6;
  font-family: var(--ff-mono);
  font-weight: 400;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  border-bottom: 0;
  white-space: nowrap;
}
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 70%, transparent); }
tbody tr:hover { background: color-mix(in srgb, var(--gold) 5%, var(--surface-bg)); }
tbody tr:last-child td { border-bottom: 0; }

/* -------- Pull quote (Legability) -------- */
.pullquote {
  position: relative;
  margin: 2.5rem 0;
  padding: 1.5rem 1.5rem 1.5rem 3rem;
  font-family: var(--ff-serif);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(1.4rem, 2.3vw, 2rem);
  line-height: 1.4;
  color: var(--plum);
  border-top: 1px solid var(--plum-light);
  border-bottom: 1px solid var(--plum-light);
  background: var(--plum-wash);
}
[data-theme="dark"] .pullquote { color: #dfd2ee; background: color-mix(in srgb, var(--plum) 30%, var(--surface-bg)); }
.pullquote::before {
  content: "";
  position: absolute;
  left: 1.2rem; top: 2.3rem;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold);
}

/* -------- Data callout (10 Leaves) -------- */
.data-callout {
  margin: 2.5rem 0;
  padding: 2rem 1.75rem;
  background: var(--surface-bg);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--gold);
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 600px) { .data-callout { grid-template-columns: auto 1fr; gap: 2rem; align-items: center; } }
.data-callout__num {
  font-family: var(--ff-sans);
  font-weight: 200;
  font-size: clamp(3rem, 6vw, 4.5rem);
  letter-spacing: -.04em;
  line-height: 1;
  color: var(--gold);
}
.data-callout__label { font-size: .95rem; color: var(--text); line-height: 1.5; }

/* -------- Source footnotes -------- */
sup.fn a {
  display: inline-block;
  font-family: var(--ff-mono);
  font-size: .7em;
  font-weight: 400;
  padding: 0 .25em;
  color: var(--gold);
  border-bottom: 0;
  vertical-align: super;
}
sup.fn a:hover { color: var(--gold-dark); background: color-mix(in srgb, var(--gold) 15%, transparent); border-radius: 2px; }
.sources {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
.sources h2 { font-size: 1rem; font-family: var(--ff-mono); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 400; margin: 0 0 1.25rem; }
.sources ol { font-family: var(--ff-mono); font-size: .78rem; line-height: 1.7; color: var(--text-muted); padding-left: 1.5rem; }
.sources ol li { margin-bottom: .4rem; letter-spacing: .01em; }
.sources ol li a { color: var(--text); word-break: break-word; }
.sources ol li a:hover { color: var(--gold); }

/* -------- Prev/Next nav -------- */
.pager {
  display: grid; grid-template-columns: 1fr; gap: 1rem;
  margin: 3.5rem 0 0;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}
@media (min-width: 600px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a {
  padding: 1.25rem 1.35rem;
  border: 1px solid var(--rule);
  display: block;
  transition: all var(--t-fast) var(--ease);
}
.pager a:hover { border-color: var(--gold); background: color-mix(in srgb, var(--gold) 4%, var(--surface-bg)); }
.pager__dir { font-family: var(--ff-mono); font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: var(--text-muted); }
.pager__title { font-size: 1.05rem; color: var(--heading); margin-top: .3rem; }
.pager__next { text-align: right; }

/* -------- Part hero -------- */
.part-hero {
  padding: clamp(4rem, 9vw, 7rem) clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--rule-soft);
}
.part-hero__inner { max-width: 62ch; }
.part-hero__num { font-family: var(--ff-mono); font-size: .8rem; letter-spacing: .3em; text-transform: uppercase; color: var(--gold); margin-bottom: 1.5rem; }
.part-hero__title {
  font-family: var(--ff-sans); font-weight: 200;
  font-size: clamp(2.5rem, 6.5vw, 5rem);
  letter-spacing: -0.04em;
  line-height: 1.02;
  margin: 0 0 1.5rem;
  color: var(--heading);
}
.part-hero__sub {
  font-family: var(--ff-serif); font-weight: 300; font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.55rem); line-height: 1.5;
  color: var(--slate);
}
[data-theme="dark"] .part-hero__sub { color: var(--text-muted); }

.part-hero--plum { background: var(--plum); color: #f3ebe0; border-bottom-color: rgba(255,255,255,.08); }
.part-hero--plum .part-hero__num { color: var(--gold-light); }
.part-hero--plum .part-hero__title { font-family: var(--ff-serif); font-weight: 300; font-style: italic; color: #f3ebe0; }
.part-hero--plum .part-hero__sub { color: #d9cfe2; }

/* Part index list */
.part-index { max-width: var(--max-read); }
.part-index__item {
  display: block;
  padding: 2rem 0;
  border-bottom: 1px solid var(--rule-soft);
  transition: padding var(--t-fast) var(--ease);
  color: inherit;
}
.part-index__item:hover { padding-left: .75rem; border-bottom-color: var(--gold); }
.part-index__num { font-family: var(--ff-mono); font-size: .72rem; letter-spacing: .22em; color: var(--gold); text-transform: uppercase; }
.part-index__title { font-family: var(--ff-sans); font-weight: 300; font-size: 1.6rem; letter-spacing: -.01em; color: var(--heading); margin: .4rem 0 .5rem; line-height: 1.2; }
.part-index__desc { color: var(--text-muted); font-size: .95rem; line-height: 1.6; }
.part-hero--plum + .main .part-index__num,
.section--plum .part-index__num { color: var(--plum-light); }

/* -------- Search overlay -------- */
.search {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background: rgba(10, 14, 30, 0.6);
  backdrop-filter: blur(6px);
  padding: clamp(2rem, 10vh, 6rem) 1rem 2rem;
}
.search[aria-hidden="false"] { display: block; }
.search__panel {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface-bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
}
.search__input {
  display: block;
  width: 100%;
  padding: 1.25rem 1.5rem;
  font-family: var(--ff-sans);
  font-size: 1.05rem;
  background: transparent;
  border: 0;
  color: var(--text);
  outline: none;
  border-bottom: 1px solid var(--rule);
}
.search__input::placeholder { color: var(--text-muted); }
.search__results { max-height: 60vh; overflow-y: auto; }
.search__result {
  display: block; padding: .9rem 1.5rem; border-bottom: 1px solid var(--rule-soft);
  color: var(--text);
}
.search__result:hover, .search__result.active { background: color-mix(in srgb, var(--gold) 8%, transparent); }
.search__result .label { font-family: var(--ff-mono); font-size: .65rem; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); }
.search__result .title { font-size: 1rem; margin: .2rem 0 .1rem; color: var(--heading); }
.search__result .snip { font-size: .82rem; color: var(--text-muted); line-height: 1.45; }
.search__hint { padding: .75rem 1.5rem; font-family: var(--ff-mono); font-size: .7rem; letter-spacing: .14em; color: var(--text-muted); text-transform: uppercase; border-top: 1px solid var(--rule-soft); display: flex; justify-content: space-between; }

/* -------- Progressive reveal -------- */
/* Article bodies must NEVER be hidden — only optional secondary elements fade in. */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
/* Opt-in fade only for elements explicitly marked .reveal--fade */
.reveal--fade {
  opacity: 0;
  transform: translateY(40px);
  will-change: opacity, transform;
}
.reveal--fade.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal, .reveal--fade { opacity: 1; transform: none; transition: none; }
  .hero__scroll::after { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* -------- Utility -------- */
.container { max-width: var(--max-wide); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }
.prose img { border-radius: 3px; margin: 2rem 0; }

/* -------- Print -------- */
@media print {
  .topbar, .sidenav, .toc, .footer, .drawer, .search, .hero__scroll, .pager, .download-strip { display: none !important; }
  body { background: #fff; color: #000; }
  .shell { display: block; max-width: none; padding: 0; }
  .article { max-width: none; }
  a { color: #000; text-decoration: underline; }
}
