/* ── CUSTOM PROPERTIES ──────────────────────────────────────── */
:root {
  --bg:           #ffffff;
  --bg-alt:       #f7f7f9;
  --text:         #1a1a1e;
  --text-muted:   #5b5b66;
  --accent:       #4f46e5;
  --accent-weak:  #eef0fd;
  --border:       #e5e5ea;
  --verdict-null: #6b7280;
  --verdict-warn: #b45309;
  --verdict-pos:  #15803d;

  --pad:      1.25rem;
  --radius:   10px;
  --radius-sm: 6px;
  --nav-h:    56px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: clamp(1rem, 1.5vw + .5rem, 1.125rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

/* ── TYPOGRAPHY ─────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: "Georgia", "Source Serif 4", serif;
  line-height: 1.25;
  color: var(--text);
}
h1 { font-size: clamp(1.6rem, 3vw + .8rem, 2.6rem); margin-bottom: 1.25rem; }
h2 { font-size: clamp(1.25rem, 2vw + .6rem, 1.8rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1rem, 1vw + .4rem, 1.25rem); margin-bottom: .5rem; }

p { max-width: 72ch; margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

a { color: var(--accent); text-decoration: underline; }
a:hover { opacity: .8; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

code {
  font-family: ui-monospace, "JetBrains Mono", monospace;
  font-size: .875em;
  background: var(--bg-alt);
  padding: .1em .35em;
  border-radius: 3px;
}

abbr[title], abbr.tooltip {
  text-decoration: underline dotted var(--text-muted);
  cursor: help;
}

/* ── LAYOUT ─────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  padding-inline: var(--pad);
}
.container-prose { max-width: 700px; }

/* ── STICKY NAV ─────────────────────────────────────────────── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s;
}
.site-nav.scrolled { box-shadow: var(--shadow-sm); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--pad);
}

.nav-wordmark {
  font-family: "Georgia", serif;
  font-weight: bold;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.site-nav nav {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.site-nav nav::-webkit-scrollbar { display: none; }

.site-nav nav a {
  font-size: .875rem;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  padding: .25rem .1rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.site-nav nav a:hover,
.site-nav nav a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-github {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  border-bottom: none !important;
  flex-shrink: 0;
}
.nav-github:hover { color: var(--accent); opacity: 1; }

/* ── SECTIONS ───────────────────────────────────────────────── */
section { padding-block: 4.5rem; }
.section-alt { background: var(--bg-alt); }

/* ── HERO ───────────────────────────────────────────────────── */
.section-hero {
  text-align: center;
  padding-block: 5rem 4rem;
}
.section-hero .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.section-hero h1 { max-width: 780px; }

.authors { font-size: 1rem; color: var(--text-muted); }
.equal { display: inline; }
.affiliation { font-size: .9rem; color: var(--text-muted); }
.venue { font-size: .9rem; color: var(--text-muted); font-style: italic; }

.hero-buttons {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.25rem;
  border-radius: var(--radius);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s, background .15s;
  border: 2px solid transparent;
  line-height: 1;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; color: #fff; }
.btn-secondary { border-color: var(--accent); color: var(--accent); background: transparent; }
.btn-secondary:hover { background: var(--accent-weak); opacity: 1; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── TL;DR ──────────────────────────────────────────────────── */
.tldr {
  max-width: 680px;
  font-size: 1rem;
  background: var(--accent-weak);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: .9rem 1.1rem;
  text-align: left;
  margin-bottom: 0;
}

/* ── STAT CARDS ─────────────────────────────────────────────── */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  width: 100%;
  max-width: 640px;
}
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  box-shadow: var(--shadow-sm);
}
.stat-number {
  font-family: "Georgia", serif;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  font-weight: bold;
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.35;
}

@media (max-width: 560px) {
  .stat-cards { grid-template-columns: 1fr; max-width: 300px; }
}

/* ── EQUATION ───────────────────────────────────────────────── */
.equation-block {
  margin-block: 1.75rem;
  overflow-x: auto;
  text-align: center;
  padding-block: .5rem;
}

/* ── METHOD GLOSS ───────────────────────────────────────────── */
.method-gloss { margin-bottom: 2rem; }
.method-setup {
  font-size: .92rem;
  color: var(--text-muted);
  background: var(--bg-alt);
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-top: .75rem;
}

/* ── FIGURES ────────────────────────────────────────────────── */
.fig-block {
  margin-block: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}
.fig-block img {
  width: 100%;
  height: auto;
  display: block;
}
.fig-block a { display: block; }
.fig-block a:hover img { opacity: .92; transition: opacity .15s; }
.fig-block a:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

figcaption {
  padding: .9rem 1.1rem;
  font-size: .875rem;
  color: var(--text-muted);
  font-style: italic;
  border-top: 1px solid var(--border);
  line-height: 1.55;
}

.fig-wide {
  max-width: 960px;
  margin-inline: auto;
}

.fig-placeholder {
  background: var(--bg-alt);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fig-placeholder p { max-width: 480px; margin: 0 auto; }

/* ── HYPOTHESIS CARDS ───────────────────────────────────────── */
.results-intro {
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hypothesis-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.h-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  box-shadow: var(--shadow-sm);
}
.h-tag {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.h-card h3 { margin-bottom: 0; }
.h-card p { font-size: .95rem; }
.h-metric {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: .5rem;
}

@media (max-width: 700px) {
  .hypothesis-cards { grid-template-columns: 1fr; }
}

/* ── VERDICT CHIPS ──────────────────────────────────────────── */
.verdict {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .25rem .65rem;
  border-radius: 999px;
  border: 1.5px solid currentColor;
  width: fit-content;
}
.verdict-null { color: var(--verdict-null); background: #f3f4f6; }
.verdict-warn { color: var(--verdict-warn); background: #fef3c7; }
.verdict-pos  { color: var(--verdict-pos);  background: #dcfce7; }

/* ── RESULT HEADER ──────────────────────────────────────────── */
.result-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.result-header h2 { margin-bottom: 0; }

/* ── ALPHA TOGGLE ───────────────────────────────────────────── */
.alpha-toggle {
  display: inline-flex;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-block: 1.25rem .75rem;
}
.alpha-btn {
  background: var(--bg);
  border: none;
  border-right: 1px solid var(--border);
  padding: .5rem 1.1rem;
  font-size: .9rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  font-family: inherit;
}
.alpha-btn:last-child { border-right: none; }
.alpha-btn.active,
.alpha-btn:hover { background: var(--accent); color: #fff; }
.alpha-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.alpha-readout {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: .75rem 1rem;
  background: var(--accent-weak);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent);
}
.alpha-ratio {
  font-family: "Georgia", serif;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent);
  white-space: nowrap;
}
.alpha-caption { font-size: .9rem; color: var(--text-muted); }

/* ── CAVEAT BOX ─────────────────────────────────────────────── */
.caveat-box {
  border-left: 4px solid var(--verdict-warn);
  background: #fffbeb;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: .92rem;
  margin-block: 1.25rem;
  color: var(--text);
  max-width: 72ch;
}

/* ── SUPPORTING LINE ────────────────────────────────────────── */
.supporting {
  font-size: .92rem;
  color: var(--text-muted);
  margin-top: .5rem;
}

/* ── VIDEO ──────────────────────────────────────────────────── */
.video-wrap {
  margin-top: 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
  box-shadow: var(--shadow-sm);
}
.video-wrap video {
  width: 100%;
  display: block;
  max-height: 70vh;
}

/* ── BIBTEX ─────────────────────────────────────────────────── */
.bibtex-wrap {
  position: relative;
  margin-top: 1rem;
}
.bibtex {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  font-size: .85rem;
  overflow-x: auto;
  line-height: 1.7;
  font-family: ui-monospace, "JetBrains Mono", monospace;
}
.bibtex code {
  background: none;
  padding: 0;
  font-size: inherit;
  border-radius: 0;
}
.copy-btn {
  position: absolute;
  top: .75rem;
  right: .75rem;
  padding: .3rem .8rem;
  font-size: .8rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity .15s;
  font-family: inherit;
}
.copy-btn:hover { opacity: .85; }
.copy-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── TOOLTIP POPOVER ────────────────────────────────────────── */
.tooltip-popup {
  position: absolute;
  z-index: 200;
  background: var(--text);
  color: #fff;
  font-size: .8rem;
  padding: .4rem .7rem;
  border-radius: var(--radius-sm);
  max-width: 240px;
  line-height: 1.45;
  pointer-events: none;
  white-space: normal;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

/* ── FOOTER ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
  line-height: 1.8;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── RESPONSIVE TWEAKS ──────────────────────────────────────── */
@media (max-width: 640px) {
  section { padding-block: 3rem; }
  .section-hero { padding-block: 3.5rem 2.5rem; }

  .nav-inner { gap: .75rem; }
  .site-nav nav { gap: .75rem; }

  .alpha-readout { gap: .5rem; }
  .alpha-ratio { font-size: 1.25rem; }

  .result-header { gap: .75rem; }
}

@media (max-width: 480px) {
  .hero-buttons { flex-direction: column; align-items: center; }
  .btn { width: 100%; justify-content: center; max-width: 260px; }
}
