:root {
  --bg: #0b0f0e;
  --bg-raised: #101614;
  --surface: #151d1a;
  --surface-2: #1a2420;
  --ink: #eef4f1;
  --ink-strong: #ffffff;
  --muted: #a6b3ad;
  --faint: #728079;
  --line: #2a3732;
  --mint: #a8e6cf;
  --mint-strong: #6fd7b1;
  --lilac: #c4b5fd;
  --lilac-soft: #9f8fe8;
  --amber: #f0cb82;
  --max: 1240px;
  --text: 760px;
  --radius: 18px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f7f4;
  --bg-raised: #ffffff;
  --surface: #eef2ee;
  --surface-2: #e5ebe6;
  --ink: #1b2420;
  --ink-strong: #0c1511;
  --muted: #56645e;
  --faint: #6f7d77;
  --line: #cbd4cf;
  --mint: #176c53;
  --mint-strong: #0e7452;
  --lilac: #5d45a8;
  --lilac-soft: #735eb5;
  --amber: #825c18;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--mint) 8%, transparent) 0, transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-underline-offset: .2em; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--mint); outline-offset: 4px; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 1000; padding: .7rem 1rem; background: var(--ink); color: var(--bg); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.reading-progress { position: fixed; inset: 0 0 auto; height: 3px; z-index: 999; background: transparent; }
.reading-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--mint), var(--lilac)); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  padding: .8rem max(1.25rem, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: .7rem; width: max-content; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--mint) 18%, var(--surface)), color-mix(in srgb, var(--lilac) 12%, var(--surface)));
  color: var(--ink-strong);
  font: 700 .78rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.brand b, .brand small { display: block; }
.brand b { font-size: .88rem; letter-spacing: .02em; }
.brand small { margin-top: .1rem; color: var(--muted); font-size: .72rem; }
.header-nav { display: flex; align-items: center; justify-content: center; gap: 1.2rem; }
.header-nav a { color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 650; }
.header-nav a:hover { color: var(--ink); }
.theme-toggle {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: .5rem .72rem;
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
}

main { overflow: clip; }
.hero {
  position: relative;
  width: min(calc(100% - 2.5rem), var(--max));
  min-height: 580px;
  margin: 0 auto;
  padding: clamp(5rem, 10vw, 9rem) 0 4rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: clamp(2.5rem, 7vw, 7rem);
  align-items: end;
}
.hero-grid {
  position: absolute;
  z-index: -1;
  inset: 0 -80vw;
  opacity: .22;
  background-image:
    linear-gradient(color-mix(in srgb, var(--line) 60%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--line) 60%, transparent) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}
.eyebrow, .section-label, .thesis-label, .toc-title {
  margin: 0 0 1rem;
  color: var(--mint);
  font: 750 .72rem/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.hero h1 {
  max-width: 850px;
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(3rem, 6.6vw, 6.5rem);
  font-weight: 760;
  line-height: .96;
  letter-spacing: -.06em;
}
.hero h1 span { color: var(--mint); }
.dek { max-width: 780px; margin: 1.8rem 0 0; color: var(--muted); font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.55; }
.hero-meta { display: flex; flex-wrap: wrap; gap: .55rem 1.25rem; margin-top: 2rem; color: var(--faint); font-size: .82rem; }
.hero-meta strong { color: var(--ink); font-weight: 650; }
.hero-thesis {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, color-mix(in srgb, var(--mint) 7%, var(--surface)), color-mix(in srgb, var(--lilac) 5%, var(--surface)));
  box-shadow: 0 24px 80px rgba(0,0,0,.12);
}
.hero-thesis p { margin: .8rem 0 1.2rem; font-size: 1.04rem; line-height: 1.6; }
.hero-thesis a { color: var(--lilac); font-size: .83rem; font-weight: 700; text-decoration: none; }

.key-figures {
  width: min(calc(100% - 2.5rem), var(--max));
  margin: 0 auto 5rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-raised);
}
.key-figures article { min-height: 190px; padding: 1.35rem; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.key-figures article:last-child { border-right: 0; }
.metric { color: var(--ink-strong); font-size: clamp(1.8rem, 3vw, 2.5rem); font-weight: 760; letter-spacing: -.045em; }
.key-figures p { margin: .45rem 0 1rem; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.key-figures a { margin-top: auto; color: var(--mint); font-size: .74rem; font-weight: 700; text-decoration: none; text-transform: uppercase; letter-spacing: .07em; }

.report-layout {
  width: min(calc(100% - 2.5rem), var(--max));
  margin: 0 auto;
  display: grid;
  grid-template-columns: 270px minmax(0, var(--text));
  justify-content: space-between;
  gap: clamp(3rem, 8vw, 9rem);
  align-items: start;
}
.toc-sticky { position: sticky; top: 100px; max-height: calc(100vh - 120px); overflow: auto; padding-right: .8rem; scrollbar-width: thin; }
#toc ul { margin: 0; padding: 0; list-style: none; }
#toc ul ul { display: none; }
#toc li { margin: 0; }
#toc a { display: block; padding: .43rem .6rem; border-left: 1px solid var(--line); color: var(--faint); font-size: .77rem; line-height: 1.35; text-decoration: none; transition: color .15s, border-color .15s, background .15s; }
#toc a:hover, #toc a[aria-current="location"] { border-left-color: var(--mint); color: var(--ink); background: color-mix(in srgb, var(--mint) 5%, transparent); }
.toc-note { display: grid; grid-template-columns: auto 1fr; gap: .55rem; margin-top: 1.3rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; color: var(--faint); }
.toc-note p { margin: 0; font-size: .69rem; line-height: 1.45; }
.status-dot { width: 7px; height: 7px; margin-top: .3rem; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px color-mix(in srgb, var(--amber) 10%, transparent); }

.article-intro { margin-bottom: 4rem; padding: 1.4rem 1.5rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.article-intro p:last-child { margin: 0; color: var(--muted); font-size: .9rem; }
.prose { min-width: 0; padding-bottom: 7rem; }
.prose h2, .prose h3, .prose h4 { color: var(--ink-strong); text-wrap: balance; }
.prose h2 { margin: 6rem 0 1.5rem; padding-top: .3rem; font-size: clamp(1.85rem, 3.5vw, 2.7rem); line-height: 1.08; letter-spacing: -.035em; }
.prose h3 { margin: 3.4rem 0 1rem; color: var(--mint); font-size: clamp(1.18rem, 2vw, 1.42rem); line-height: 1.25; letter-spacing: -.02em; }
.prose h4 { margin: 2.4rem 0 .8rem; font-size: 1.04rem; }
.prose p { margin: 1rem 0; color: color-mix(in srgb, var(--ink) 94%, var(--muted)); }
.prose strong { color: var(--ink-strong); font-weight: 730; }
.prose em { color: var(--muted); }
.prose > blockquote {
  position: relative;
  margin: 2rem 0 3rem;
  padding: 1.35rem 1.5rem 1.35rem 1.7rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--lilac);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: color-mix(in srgb, var(--lilac) 5%, var(--surface));
}
.prose blockquote p { margin: 0; color: var(--ink); }
.prose hr { height: 1px; margin: 4rem 0; border: 0; background: var(--line); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .55rem 0; }
.prose a[href^="http"] { color: var(--mint); text-decoration-thickness: 1px; }
.prose a[href^="http"]:hover { color: var(--lilac); }
.citation { display: inline-block; padding: 0 .2rem; border: 1px solid color-mix(in srgb, var(--lilac) 45%, var(--line)); border-radius: 4px; color: var(--lilac) !important; font: 680 .78em/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-decoration: none !important; vertical-align: .05em; }
.source-entry { scroll-margin-top: 100px; padding: 1rem 0 1.15rem; border-bottom: 1px solid var(--line); }
.source-entry:target { margin-inline: -.7rem; padding-inline: .7rem; background: color-mix(in srgb, var(--mint) 5%, transparent); border-radius: 8px; }

.table-shell { width: 100%; margin: 1.7rem 0 2rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.prose table { width: 100%; min-width: 640px; border-collapse: collapse; background: var(--bg-raised); font-size: .84rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.prose th, .prose td { padding: .85rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { color: var(--ink-strong); background: var(--surface); text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; }
.prose td[style*="text-align: right"], .prose th[style*="text-align: right"] { text-align: right !important; }

.heading-anchor { margin-left: .35rem; opacity: 0; color: var(--faint) !important; font-size: .7em; text-decoration: none; transition: opacity .15s; }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus { opacity: 1; }

.site-footer {
  width: min(calc(100% - 2.5rem), var(--max));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  border-top: 1px solid var(--line);
  color: var(--faint);
}
.site-footer strong { color: var(--ink); }
.site-footer p { max-width: 640px; margin: .3rem 0 0; font-size: .77rem; }
.site-footer nav { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.site-footer a { font-size: .75rem; color: var(--muted); }

@media (max-width: 1000px) {
  .site-header { grid-template-columns: 1fr auto; }
  .header-nav { display: none; }
  .hero { grid-template-columns: 1fr; min-height: auto; }
  .hero-thesis { max-width: 640px; }
  .key-figures { grid-template-columns: repeat(2, 1fr); }
  .key-figures article:nth-child(2) { border-right: 0; }
  .key-figures article:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .report-layout { grid-template-columns: 1fr; }
  .toc-panel { display: none; }
  .report { max-width: var(--text); margin-inline: auto; width: 100%; }
}

@media (max-width: 620px) {
  body { font-size: 15.5px; }
  .site-header { min-height: 64px; padding-inline: 1rem; }
  .brand small, .theme-label { display: none; }
  .theme-toggle { padding: .5rem .6rem; }
  .hero, .key-figures, .report-layout, .site-footer { width: min(calc(100% - 2rem), var(--max)); }
  .hero { padding-top: 4.5rem; gap: 2rem; }
  .hero h1 { font-size: clamp(2.7rem, 14vw, 4.4rem); }
  .dek { font-size: 1.05rem; }
  .hero-meta { display: grid; gap: .3rem; }
  .hero-thesis { padding: 1.2rem; }
  .key-figures { grid-template-columns: 1fr; }
  .key-figures article { min-height: 155px; border-right: 0; border-bottom: 1px solid var(--line); }
  .key-figures article:last-child { border-bottom: 0; }
  .prose h2 { margin-top: 4.5rem; }
  .prose h3 { margin-top: 2.8rem; }
  .article-intro { padding: 1rem; }
  .site-footer { display: grid; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media print {
  :root { --bg: #fff; --ink: #171b19; --ink-strong: #000; --muted: #4f5954; --faint: #5f6964; --line: #c8cecb; --mint: #1d654f; --lilac: #5d4699; color-scheme: light; }
  body { background: #fff; font-size: 10.5pt; }
  .site-header, .reading-progress, .toc-panel, .theme-toggle, .heading-anchor { display: none !important; }
  .hero { min-height: 0; padding: 1cm 0; grid-template-columns: 1fr; }
  .hero-grid { display: none; }
  .hero h1 { font-size: 32pt; }
  .hero-thesis, .article-intro { break-inside: avoid; }
  .key-figures { break-inside: avoid; margin-bottom: 1cm; }
  .report-layout { display: block; width: 100%; }
  .report { max-width: none; }
  .prose h2 { break-after: avoid; margin-top: 1.4cm; }
  .prose h3 { break-after: avoid; margin-top: .9cm; }
  .table-shell { overflow: visible; break-inside: avoid; }
  .prose table { min-width: 0; font-size: 8pt; }
  .prose a { color: inherit !important; text-decoration: none; }
  .site-footer { width: 100%; }
}
