:root {
  --fg: #111;
  --muted: #5a5a5a;
  --soft: #7a7a7a;
  --accent: #990000;
  --accent2: #182B49;
  --accent-grad: linear-gradient(135deg, #990000 0%, #d4553a 55%, #182B49 100%);
  --bg: #fcfcfa;
  --card: #f4f2ee;
  --card2: #ffffff;
  --border: #e4e1dc;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.04);
  --code-bg: #1a1a1a;
  --code-fg: #e8e8e8;
  --fig-filter: none;
}

html[data-theme="dark"] {
  --fg: #e8e8e8;
  --muted: #a8a8a8;
  --soft: #888;
  --accent: #ff6b6b;
  --accent2: #7aa7ff;
  --accent-grad: linear-gradient(135deg, #ff6b6b 0%, #ffa36b 55%, #7aa7ff 100%);
  --bg: #111315;
  --card: #1a1d20;
  --card2: #1e2125;
  --border: #2a2e33;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
  --code-bg: #0d0f11;
  --code-fg: #d8d8d8;
  --fig-filter: invert(0.92) hue-rotate(180deg);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --fg: #e8e8e8;
    --muted: #a8a8a8;
    --soft: #888;
    --accent: #ff6b6b;
    --accent2: #7aa7ff;
    --accent-grad: linear-gradient(135deg, #ff6b6b 0%, #ffa36b 55%, #7aa7ff 100%);
    --bg: #111315;
    --card: #1a1d20;
    --card2: #1e2125;
    --border: #2a2e33;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
    --code-bg: #0d0f11;
    --code-fg: #d8d8d8;
    --fig-filter: invert(0.92) hue-rotate(180deg);
  }
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 20px;
}
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 28px 96px;
}

/* ===== Theme toggle ===== */
.theme-toggle {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card2);
  color: var(--fg);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.15s;
}
.theme-toggle:hover { transform: scale(1.08); }

/* ===== Hero ===== */
.hero {
  text-align: center;
  margin-bottom: 32px;
  padding: 0 0 20px;
  position: relative;
}

h1.paper-title {
  font-size: 2.35rem;
  line-height: 1.22;
  margin: 0 0 16px;
  font-weight: 700;
  letter-spacing: -0.015em;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hf-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--fg);
  text-decoration: none;
  padding: 5px 12px;
  margin-bottom: 16px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
  transition: border-color 0.15s, transform 0.15s;
}
.hf-chip:hover {
  border-color: var(--accent2);
  transform: translateY(-1px);
  text-decoration: none;
}

/* Figure lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 32px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.lightbox-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox-overlay img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  filter: none;
  background: #fff;
}
figure img { cursor: zoom-in; }

.paper-subtitle {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 640px;
  margin: -8px auto 20px;
}

.authors { font-size: 1.15rem; margin: 12px 0 4px; line-height: 1.5; }
.authors span.author { white-space: nowrap; margin: 0 6px; }
.affil { color: var(--muted); font-size: 1rem; margin-top: 2px; }

.usc { color: #c04040; font-weight: 700; }
.ucsd { color: #5582c8; font-weight: 700; }
html[data-theme="light"] .usc, html:not([data-theme]) .usc { color: #990000; }
html[data-theme="light"] .ucsd, html:not([data-theme]) .ucsd { color: #182B49; }

.seal {
  display: inline-block;
  width: 18px;
  height: 18px;
  vertical-align: super;
  margin: 0 1px 0 3px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}
.seal.usc-seal {
  background-image: url('images/logo/usc_seal_red.svg');
}
.seal.ucsd-seal {
  background-image: url('images/logo/ucsd_seal.svg');
}
.affil .seal { width: 24px; height: 24px; vertical-align: -6px; margin-right: 6px; }

.authors a.author {
  color: var(--fg);
  text-decoration: none;
  margin: 0 4px;
  white-space: nowrap;
  border-bottom: 1px dotted var(--soft);
}
.authors a.author:hover {
  color: var(--fg);
  text-decoration: none;
  border-bottom-color: var(--fg);
}

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 22px 0 0;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  background: var(--card2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: transform 0.15s ease, border-color 0.15s, background 0.15s;
}
.links a:hover {
  transform: translateY(-1px);
  border-color: var(--accent2);
  text-decoration: none;
}
.links a.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.links a.primary:hover { background: var(--accent2); border-color: var(--accent2); }

/* ===== Headings ===== */
h2 {
  font-size: 1.55rem;
  margin-top: 56px;
  margin-bottom: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: relative;
  padding-left: 14px;
  scroll-margin-top: 16px;
}
h2::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  background: var(--accent2);
  border-radius: 2px;
}

h3 {
  font-size: 1.2rem;
  margin-top: 30px;
  margin-bottom: 8px;
  font-weight: 600;
}

p { margin: 12px 0; }

/* ===== Figures ===== */
figure {
  margin: 28px 0;
  text-align: center;
  background: var(--card2);
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  filter: var(--fig-filter);
  transition: filter 0.2s;
}
figcaption {
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 12px;
  text-align: left;
  line-height: 1.55;
}

/* ===== Abstract ===== */
.abstract {
  background: var(--card2);
  padding: 24px 28px;
  border-radius: 12px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.abstract p { margin: 10px 0; }
.abstract p:first-child { margin-top: 0; }
.abstract p:last-child { margin-bottom: 0; }

/* ===== Q&A reveal cards (slide-up drawer) ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 30px 0;
}
.stat {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 180px;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, var(--card2)) 0%, var(--card2) 100%);
  box-shadow: var(--shadow);
  cursor: pointer;
  outline: none;
  transition: box-shadow 0.35s cubic-bezier(0.4, 0, 0.2, 1), transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .stat:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 20px 40px rgba(153,0,0,0.12);
    transform: translateY(-2px);
  }
}
.stat.flipped {
  box-shadow: 0 4px 8px rgba(0,0,0,0.06), 0 20px 40px rgba(153,0,0,0.12);
}
.stat .face {
  grid-row: 1;
  grid-column: 1;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-width: 0;
}
.stat .front { color: var(--fg); position: relative; padding-bottom: 36px; }
.stat .back {
  background: var(--accent-grad);
  color: #fff;
  transform: translateY(24%);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.12s,
    opacity 0.3s ease 0.12s,
    visibility 0s linear 0.45s;
  will-change: transform, opacity;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .stat:hover .back,
  .stat:focus-visible .back {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0s,
      opacity 0.28s ease 0s,
      visibility 0s linear 0s;
  }
}
.stat.flipped .back {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    transform 0.45s cubic-bezier(0.4, 0, 0.2, 1) 0s,
    opacity 0.25s ease 0s,
    visibility 0s linear 0s;
}
.stat:hover .back,
.stat.flipped .back,
.stat:focus-visible .back {
  transform: translateY(0);
}
.stat .icon {
  font-size: clamp(1.4rem, 1.1rem + 1vw, 1.8rem);
  line-height: 1;
  margin-bottom: 14px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08));
}
.stat .q {
  font-size: clamp(0.92rem, 0.85rem + 0.3vw, 1.02rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
}
.stat .front::after {
  content: "tap to reveal ↑";
  position: absolute;
  bottom: 12px;
  left: 0; right: 0;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.7;
}
@media (hover: hover) and (pointer: fine) {
  .stat .front::after { content: "hover to reveal ↑"; }
}
.stat .a {
  font-size: clamp(1.3rem, 1.15rem + 0.7vw, 1.6rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.stat .detail {
  font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem);
  line-height: 1.5;
  color: rgba(255,255,255,0.96);
}
.stat .back .detail em,
.stat .back .detail strong { color: #fff; }
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .stat { min-height: 0; }
  .stat .face { padding: 20px 18px; }
}

/* Hero pullquote */
.pullquote {
  font-size: 1.25rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--fg);
  max-width: 720px;
  margin: 28px auto 8px;
  text-align: center;
  padding: 22px 28px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.pullquote .em {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.pullquote .break { display: block; margin-top: 4px; }

/* Section-break quote */
.sectionquote {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 680px;
  margin: 48px auto;
  text-align: center;
  font-style: italic;
  line-height: 1.55;
}

/* Setup + Finding panel */
.setupfind {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 28px 0 32px;
}
.sf-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 24px 18px;
  box-shadow: var(--shadow);
  border-top: 4px solid var(--accent2);
}
.sf-card.sf-finding { border-top-color: var(--accent); }
.sf-tag {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: 700;
  background: color-mix(in srgb, var(--accent2) 12%, transparent);
  color: var(--accent2);
}
.sf-finding .sf-tag {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}
.sf-card ul {
  margin: 6px 0 0;
  padding-left: 18px;
}
.sf-card li {
  margin: 8px 0;
  font-size: 0.94rem;
  line-height: 1.5;
  color: var(--fg);
}
.sf-card li strong { color: var(--fg); }
@media (max-width: 700px) {
  .setupfind { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  h1.paper-title { font-size: 1.9rem; }
}

/* ===== TL;DR grid ===== */
.tldr-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin: 22px 0;
}
.tldr-card {
  background: var(--card2);
  padding: 22px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform 0.18s, box-shadow 0.18s;
}
.tldr-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 14px 32px rgba(0,0,0,0.10);
}
.tldr-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--accent2);
  opacity: 0.7;
}
.tldr-card .icon { font-size: 1.5rem; margin-bottom: 8px; display: block; }
.tldr-card h4 { margin: 0 0 8px; font-size: 1.05rem; font-weight: 700; }
.tldr-card p { margin: 0; font-size: 0.96rem; color: var(--muted); line-height: 1.55; }
@media (max-width: 640px) { .tldr-grid { grid-template-columns: 1fr; } }

/* ===== Contribution list ===== */
.contribs {
  list-style: none;
  padding: 0;
  margin: 20px 0;
  counter-reset: contrib;
}
.contribs li {
  background: var(--card2);
  padding: 16px 20px 16px 52px;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  position: relative;
  box-shadow: var(--shadow);
}
.contribs li::before {
  content: counter(contrib);
  counter-increment: contrib;
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  background: var(--accent-grad);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
}

/* ===== Code / BibTeX ===== */
code, pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
}
pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 20px 22px;
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.55;
  box-shadow: var(--shadow);
}
p code, li code {
  background: var(--card);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.85em;
}

a { color: var(--accent); }
a:hover { text-decoration: underline; }

blockquote {
  margin: 20px 0;
  padding: 14px 22px;
  border-left: 3px solid var(--accent2);
  background: var(--card);
  color: var(--fg);
  font-style: italic;
  border-radius: 0 8px 8px 0;
}

footer {
  margin-top: 72px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--soft);
  font-size: 0.88rem;
  text-align: center;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 0.92rem;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  transition: color 0.15s, background 0.15s;
}
.back-link:hover { color: var(--accent); background: var(--card2); text-decoration: none; }

/* Dissociation card row */
.dissoc {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 22px 0;
}
.dissoc .card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.dissoc .card.yes { border-top: 4px solid #2a8f4a; }
.dissoc .card.no  { border-top: 4px solid var(--accent); }
.dissoc .card h4 { margin: 0 0 8px; font-size: 1rem; }
.dissoc .card p { margin: 0; color: var(--muted); font-size: 0.94rem; }
.dissoc .tag {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
  font-weight: 600;
}
.dissoc .yes .tag { background: color-mix(in srgb, #2a8f4a 15%, transparent); color: #2a8f4a; }
.dissoc .no  .tag { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
@media (max-width: 640px) { .dissoc { grid-template-columns: 1fr; } }

/* Citation popover (anthropic-style) */
a.cite {
  position: relative;
  cursor: pointer;
}
.cite-popover {
  position: absolute;
  z-index: 200;
  background: var(--card2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 16px 40px rgba(0,0,0,0.10);
  padding: 12px 14px;
  font-size: 0.85rem;
  line-height: 1.45;
  width: 320px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s, transform 0.12s;
}
.cite-popover.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cite-popover .cite-title { font-weight: 600; margin: 0 0 4px; color: var(--fg); }
.cite-popover .cite-authors { color: var(--muted); margin: 0 0 4px; }
.cite-popover .cite-venue { color: var(--soft); font-style: italic; margin: 0 0 8px; }
.cite-popover .cite-link {
  display: inline-block;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}
.cite-popover .cite-link:hover { opacity: 0.85; text-decoration: none; }

/* Theorem / definition boxes for blog */
.theorem, .definition {
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent2);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 22px 0;
  box-shadow: var(--shadow);
}
.theorem .label, .definition .label {
  display: inline-block;
  font-weight: 700;
  color: var(--accent2);
  margin-right: 6px;
}
.theorem p, .definition p { margin: 8px 0; }
.theorem ol { margin: 8px 0 0 0; padding-left: 22px; }
.theorem ol li { margin: 6px 0; }

/* Math-style inline */
.math {
  font-family: "STIX Two Math", "Cambria Math", "Latin Modern Math", Georgia, serif;
  font-style: italic;
}

/* ========================================================================
 * BibTeX copy button
 * ====================================================================== */
.bibtex-wrap { position: relative; }
.bibtex-wrap pre {
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  box-shadow: none;
  font-size: 0.82rem;
  padding: 18px 20px;
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-family: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  z-index: 2;
}
.copy-btn:hover {
  color: var(--fg);
  border-color: var(--fg);
}
.copy-btn.copied {
  color: #2a8f4a;
  border-color: #2a8f4a;
}

/* ========================================================================
 * Table of contents (blog)
 * ====================================================================== */
.toc {
  font-size: 0.84rem;
  padding: 14px 16px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin: 0 0 24px 0;
}
body.blog .toc {
  /* Fallback for narrow viewports: inline, above content */
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}
@media (min-width: 1120px) {
  body.blog .toc {
    position: fixed;
    top: 80px;
    left: 28px;
    width: 220px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0 10px 0 0;
    margin: 0;
  }
}
.toc-title {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: toc;
}
.toc li {
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.35;
}
.toc li::before {
  content: counter(toc);
  counter-increment: toc;
  position: absolute;
  left: 0; top: 4px;
  font-size: 0.7rem;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
}
.toc a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.12s;
}
.toc a:hover { color: var(--accent); text-decoration: none; }
.toc li.active a { color: var(--fg); font-weight: 600; }

/* ========================================================================
 * BLOG: Transformer-Circuits / Anthropic research aesthetic
 * Applies only when <body class="blog">
 * ====================================================================== */
body.blog {
  font-family: "Source Serif 4", "Source Serif Pro", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  font-size: 19px;
  line-height: 1.7;
}
body.blog .container {
  max-width: 820px;
  padding: 48px 24px 96px;
}
@media (min-width: 1120px) {
  body.blog .container {
    margin-left: 280px;
    margin-right: 0;
    padding-right: 32px;
  }
}
@media (min-width: 1440px) {
  body.blog .container {
    margin-left: 320px;
  }
}
body.blog .hero {
  text-align: left;
  margin-bottom: 40px;
}
body.blog h1.paper-title {
  font-size: 2.1rem;
  line-height: 1.22;
  background: none;
  -webkit-background-clip: unset;
  color: var(--fg);
  font-weight: 600;
  letter-spacing: -0.01em;
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  text-align: left;
  margin-bottom: 32px;
}

/* Anthropic-style author / meta grid */
body.blog .meta-grid {
  display: grid;
  grid-template-columns: 1fr minmax(260px, 300px);
  gap: 28px;
  align-items: start;
  margin-bottom: 18px;
}
body.blog .meta-right .meta-value { white-space: nowrap; }
body.blog .meta-label {
  font-family: "Geist", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 8px;
}
body.blog .meta-value,
body.blog .meta-value * {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--fg);
}
body.blog .meta-col { min-width: 0; }
body.blog .meta-right { text-align: left; }
body.blog .meta-value .author {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 0;
  background: none;
  font-weight: 400;
  margin: 0;
  white-space: normal;
}
body.blog .meta-value .author:hover { color: var(--accent); text-decoration: none; }
body.blog .meta-value .author sup,
body.blog .meta-value sup {
  font-size: 0.72em;
  vertical-align: super;
  line-height: 0;
  color: var(--muted);
  margin-left: 1px;
}
body.blog .meta-note {
  font-family: "Geist", sans-serif;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  margin-bottom: 22px;
}
body.blog .links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin: 0;
}
body.blog .back-link { margin-bottom: 18px; }

/* TL;DR summary block */
body.blog .tldr-block {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 20px 0 22px;
  margin: 24px 0 40px;
}
body.blog .tldr-block .meta-label {
  margin-bottom: 10px;
}
body.blog .tldr-block p {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--fg);
  margin: 0;
}

@media (max-width: 640px) {
  body.blog .meta-grid { grid-template-columns: 1fr; gap: 18px; }
}
body.blog .authors,
body.blog .affil,
body.blog .links a,
body.blog .back-link,
body.blog .toc,
body.blog figcaption,
body.blog .copy-btn,
body.blog .cite-popover,
body.blog .theme-toggle,
body.blog .theorem .label {
  font-family: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
}
body.blog h2 {
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--fg);
  padding-left: 0;
  margin-top: 56px;
  margin-bottom: 14px;
}
body.blog h2::before { display: none; }
body.blog h3 {
  font-family: "Geist", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
  margin-top: 28px;
}
body.blog p { margin: 14px 0; }
body.blog blockquote {
  border-left: 2px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-style: italic;
  padding: 4px 20px;
  margin: 24px 0;
  border-radius: 0;
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
}
body.blog figure {
  margin: 32px 0;
  max-width: 100%;
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  text-align: center;
  counter-increment: figure;
}
body.blog figure img {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 4px;
}
body.blog figcaption {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: left;
  margin: 10px auto 0;
  max-width: 720px;
  padding: 0 12px;
}
body.blog figcaption::before {
  content: "Figure " counter(figure) ". ";
  font-weight: 600;
  color: var(--fg);
}
body.blog .theorem, body.blog .definition {
  background: var(--card2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  padding: 18px 22px;
  border-radius: 0;
  box-shadow: none;
  font-family: "Source Serif 4", "Source Serif Pro", Georgia, serif;
}
body.blog .theorem .label {
  color: var(--fg);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}
body.blog ol, body.blog ul { padding-left: 24px; }
body.blog li { margin: 6px 0; }
body.blog a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
body.blog a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}
body.blog .links a, body.blog .back-link, body.blog .copy-btn { text-decoration: none; }
body.blog pre {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82rem;
}
body.blog code, body.blog li code, body.blog p code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}
body.blog .hero { margin-bottom: 32px; padding-bottom: 0; }
body.blog h1 + .paper-subtitle { display: none; }
body.blog footer { font-family: "Geist", sans-serif; }
@media (max-width: 900px) {
  body.blog figure { margin: 32px 0; }
  body.blog figcaption { padding: 0; }
}

/* Reading-progress bar (kept subtle; used on blog) */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent-grad);
  width: 0%;
  z-index: 200;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ========================================================================
 * Print stylesheet
 * ====================================================================== */
@media print {
  .theme-toggle, .back-link, .toc, .scroll-cue, .copy-btn,
  .lightbox-overlay, .progress { display: none !important; }
  html { scroll-behavior: auto; }
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
    line-height: 1.5;
  }
  .container { max-width: none; padding: 0 !important; }
  a { color: #000 !important; text-decoration: underline; }
  .hero { text-align: left; page-break-after: avoid; }
  h1.paper-title {
    color: #000 !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    font-size: 20pt;
  }
  h2, h3 { page-break-after: avoid; }
  figure { page-break-inside: avoid; box-shadow: none !important; border: 0 !important; }
  figure img { max-width: 100% !important; filter: none !important; }
  .stat, .dissoc .card, .tldr-card, .contribs li, .abstract, .sf-card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    background: #fff !important;
    color: #000 !important;
  }
  .stat .back { display: none !important; }
  .stat .front { color: #000 !important; }
  .stat .front::after { display: none !important; }
  pre {
    background: #f4f4f4 !important;
    color: #000 !important;
    border: 1px solid #ddd;
  }
}
