/* ============================================================
   Stream-R1 — paper page
   Display: Instrument Serif · Body: Inter · UI: Space Grotesk
   ============================================================ */

:root {
  --bg: #fafaf7;
  --bg-alt: #f4f3ee;
  --bg-tinted: #efece4;
  --bg-deep: #1a1916;
  --surface: #ffffff;
  --line: rgba(26, 25, 22, 0.08);
  --line-strong: rgba(26, 25, 22, 0.18);

  --text: #1a1916;
  --text-muted: #4a4842;
  --text-dim: #898578;
  --text-faint: #b3afa1;

  --ink: #2c2a25;

  --accent: #c4561e;
  --accent-strong: #8c3a13;
  --accent-soft: rgba(196, 86, 30, 0.08);

  --highlight: #fce8a8;
  --highlight-strong: #f5d56b;

  --grad-1: #ff8a3d;
  --grad-2: #d83a8c;
  --grad-3: #6a4cff;

  --shadow-xs: 0 1px 2px rgba(15, 14, 11, 0.05);
  --shadow-sm: 0 2px 6px rgba(15, 14, 11, 0.06), 0 6px 18px rgba(15, 14, 11, 0.04);
  --shadow-md: 0 8px 28px rgba(15, 14, 11, 0.08), 0 2px 6px rgba(15, 14, 11, 0.04);
  --shadow-lg: 0 24px 60px rgba(15, 14, 11, 0.12), 0 6px 16px rgba(15, 14, 11, 0.05);
  --shadow-pop: 0 32px 80px rgba(15, 14, 11, 0.32), 0 8px 24px rgba(15, 14, 11, 0.16);

  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --radius-xl: 40px;

  --container: 1200px;
  --container-narrow: 820px;
  --nav-height: 60px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 12px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-width: 0;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 1200px 700px at 80% -200px, rgba(255, 138, 61, 0.08), transparent 60%),
    radial-gradient(ellipse 900px 600px at 0% 30%, rgba(106, 76, 255, 0.05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "ss01", "cv11";
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.01em;
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s ease; }
a:hover { color: var(--accent-strong); }

img, video { display: block; max-width: 100%; }

code, .citation-block {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-feature-settings: "ss01";
}

.container {
  width: min(100% - 48px, var(--container));
  margin: 0 auto;
}

.container.narrow { max-width: var(--container-narrow); }

::selection {
  background: var(--highlight-strong);
  color: var(--ink);
}

/* ============================================================
   Reading progress bar
   ============================================================ */

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  height: 2px;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2) 60%, var(--grad-3));
  transition: width 0.12s linear;
  pointer-events: none;
  box-shadow: 0 0 12px rgba(216, 58, 140, 0.5);
}

/* ============================================================
   Sticky nav
   ============================================================ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(250, 250, 247, 0.8);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: 18px;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2) 60%, var(--grad-3));
  box-shadow: 0 0 0 4px rgba(216, 58, 140, 0.1);
  animation: pulse 3.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.18); }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(12px, 1.6vw, 26px);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  position: relative;
  color: var(--text-muted);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.nav-links a:hover { color: var(--text); }

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -16px;
  height: 1px;
  background: var(--text);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.nav-links a:hover::after { transform: scaleX(1); }

/* ============================================================
   Hero
   ============================================================ */

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(72px, 9vw, 140px) 0 clamp(40px, 5vw, 60px);
}

.hero-canvas {
  position: absolute;
  inset: -10% -5% 0 -5%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 18% 10%, rgba(255, 138, 61, 0.20), transparent 65%),
    radial-gradient(ellipse 50% 50% at 82% 0%, rgba(216, 58, 140, 0.16), transparent 65%),
    radial-gradient(ellipse 50% 60% at 50% 100%, rgba(106, 76, 255, 0.10), transparent 70%);
  filter: saturate(1.15) blur(2px);
  opacity: 0.95;
  animation: hero-shift 18s ease-in-out infinite;
}

@keyframes hero-shift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  33%      { transform: translate3d(-1.5%, 1%, 0) scale(1.03); }
  66%      { transform: translate3d(1%, -1.5%, 0) scale(0.99); }
}

.hero-grain {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.45 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.hero-watermark {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: -1;
  transform: translate(-50%, -50%);
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: clamp(160px, 26vw, 480px);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: rgba(26, 25, 22, 0.04);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.hero-inner {
  position: relative;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text-muted);
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 28px;
}

.eyebrow .dot {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2) 60%, var(--grad-3));
  box-shadow: 0 0 0 3px rgba(216, 58, 140, 0.15);
  animation: pulse 3.6s ease-in-out infinite;
}

/* === Title === */

.title {
  margin: 0 auto 18px;
  max-width: 1000px;
  color: var(--ink);
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1;
  text-wrap: balance;
}

.title .title-mark {
  display: block;
  font-size: clamp(72px, 13vw, 188px);
  font-style: italic;
  line-height: 0.9;
  background: linear-gradient(125deg, var(--ink) 30%, var(--accent) 70%, var(--grad-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.04em;
  margin-bottom: 0.05em;
  animation: title-rise 1s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.title .title-line {
  display: block;
  font-family: "Inter", sans-serif;
  font-style: normal;
  font-weight: 600;
  font-size: clamp(20px, 2.6vw, 34px);
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.18;
  margin-top: 8px;
  animation: title-rise 1s 0.12s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.title .title-sub {
  display: block;
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-size: clamp(20px, 2.6vw, 34px);
  letter-spacing: -0.005em;
  color: var(--text-muted);
  line-height: 1.18;
  margin-top: 6px;
  animation: title-rise 1s 0.24s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

@keyframes title-rise {
  from { opacity: 0; transform: translate3d(0, 22px, 0); filter: blur(8px); }
  to   { opacity: 1; transform: translate3d(0, 0, 0);    filter: blur(0); }
}

/* === Authors === */

.authors {
  margin: 32px auto 30px;
  max-width: 760px;
  color: var(--text-muted);
  animation: title-rise 1s 0.36s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.authors-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 16px;
  font-family: "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.author { white-space: nowrap; }
.author strong { color: var(--text); font-weight: 600; }
.author sup {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.7em;
  margin-left: 1px;
}
.author-mark { color: var(--accent); }

.author-link {
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(196, 86, 30, 0.4);
  padding-bottom: 1px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.author-link:hover {
  border-bottom-color: var(--accent);
}
.author-link:hover strong { color: var(--accent); }

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 22px;
  margin-top: 12px;
  color: var(--text-muted);
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 16px;
}
.affiliations sup {
  color: var(--accent);
  font-weight: 600;
  margin-right: 2px;
  font-style: normal;
}

.author-notes {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
  color: var(--text-dim);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
}
.author-notes sup { color: var(--accent); margin-right: 2px; }

/* === Buttons === */

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
  animation: title-rise 1s 0.48s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: "Space Grotesk", "Inter", sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 20px rgba(15, 14, 11, 0.18);
}
.btn-primary:hover {
  background: #2c2a25; color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(15, 14, 11, 0.24);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
  color: var(--text);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn[aria-disabled="true"] { opacity: 0.55; cursor: default; pointer-events: none; }

.btn .badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-tinted);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================================
   Hero marquee — 8 cases × 10s, full-bleed, scrolling
   ============================================================ */

.hero-marquee {
  position: relative;
  margin-top: clamp(40px, 6vw, 72px);
  padding: 28px 0 22px;
  overflow: visible;
  animation: title-rise 1.1s 0.6s cubic-bezier(0.2, 0.85, 0.3, 1) both;
}

.hero-marquee .marquee-track {
  --marquee-duration: 75s;
  display: flex;
  gap: 16px;
  width: max-content;
  padding: 28px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
  mask-image: linear-gradient(90deg, transparent, black 5%, black 95%, transparent);
  animation: marquee-left var(--marquee-duration) linear infinite;
}

.hero-marquee:hover .marquee-track {
  animation-play-state: paused;
}

.marquee-hint {
  margin-top: 4px;
  text-align: center;
  color: var(--text-dim);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
}

@keyframes marquee-left {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

@keyframes marquee-right {
  from { transform: translate3d(-50%, 0, 0); }
  to   { transform: translate3d(0, 0, 0); }
}

/* ============================================================
   Marquee video card (shared by hero + duration rows)
   ============================================================ */

.marquee-video {
  position: relative;
  flex: 0 0 auto;
  width: clamp(220px, 22vw, 320px);
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  border-radius: var(--radius-md);
  background:
    linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.07) 50%, transparent 65%) -200% 0 / 200% 100% no-repeat,
    linear-gradient(135deg, #1a1612, #0a0908);
  animation: marquee-shimmer 1.8s linear infinite;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform 0.35s cubic-bezier(0.2, 0.85, 0.3, 1),
    box-shadow 0.35s ease,
    z-index 0s 0.35s;
  isolation: isolate;
}

@keyframes marquee-shimmer {
  to { background-position: 200% 0, 0 0; }
}

.marquee-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: transparent;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.marquee-video.has-data video {
  opacity: 1;
}

.marquee-video::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.4));
  opacity: 0.6;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.marquee-video::before {
  content: "";
  position: absolute;
  inset: 12px;
  border: 2px solid rgba(255, 255, 255, 0);
  border-radius: var(--radius-sm);
  z-index: 3;
  transition: border-color 0.25s ease;
  pointer-events: none;
}

.marquee-tag {
  position: absolute;
  bottom: 10px;
  left: 12px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-family: "Space Grotesk", monospace;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  pointer-events: none;
}

.marquee-video:hover {
  transform: scale(1.32);
  box-shadow: var(--shadow-pop);
  transition-delay: 0s;
  z-index: 12;
}

.marquee-video:hover::after { opacity: 0.15; }
.marquee-video:hover::before { border-color: rgba(255, 255, 255, 0.55); }

/* Fullscreen-hint icon overlays on hover */
.marquee-video:hover .marquee-tag {
  background: var(--accent);
}

.marquee-video:focus-visible {
  outline: 0;
  z-index: 12;
  transform: scale(1.32);
  box-shadow: var(--shadow-pop), 0 0 0 3px rgba(196, 86, 30, 0.45);
}

/* ============================================================
   Section base
   ============================================================ */

.section {
  padding: clamp(72px, 9vw, 130px) 0;
  scroll-margin-top: var(--nav-height);
  position: relative;
}

.section-light { background: var(--bg-alt); }

.section-feature {
  background:
    radial-gradient(ellipse 50% 40% at 50% 0%, rgba(255, 138, 61, 0.08), transparent 60%),
    var(--bg-alt);
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-tinted);
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.section-title {
  margin-bottom: 18px;
  color: var(--ink);
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(34px, 4.4vw, 60px);
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.section-title em { font-style: italic; color: var(--accent); }

.section-copy {
  max-width: 70ch;
  margin: 0 0 40px;
  color: var(--text-muted);
  font-size: 17.5px;
  line-height: 1.65;
}
.section-copy strong { color: var(--text); font-weight: 600; }
.section-copy em {
  font-style: italic;
  background: linear-gradient(125deg, var(--grad-1), var(--grad-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 600;
}

.lead {
  margin-bottom: 24px;
  color: var(--text);
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: clamp(24px, 2.6vw, 34px);
  font-weight: 400;
  line-height: 1.32;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lead em {
  font-style: italic;
  background: linear-gradient(125deg, var(--grad-1), var(--grad-2) 60%, var(--grad-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.abstract-body {
  color: var(--text-muted);
  font-size: 17.5px;
  line-height: 1.7;
}
.abstract-body strong { color: var(--text); font-weight: 600; }

/* === Pillars === */

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 56px;
}

.pillars article {
  position: relative;
  padding: 28px 26px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  overflow: hidden;
}

.pillars article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2) 60%, var(--grad-3));
  transform: scaleX(0.18);
  transform-origin: left center;
  transition: transform 0.4s cubic-bezier(0.2, 0.85, 0.3, 1);
}

.pillars article:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.pillars article:hover::before { transform: scaleX(1); }

.pillar-num {
  display: inline-block;
  margin-bottom: 14px;
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 26px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.pillars h3 {
  margin-bottom: 10px;
  color: var(--ink);
  font-family: "Inter", sans-serif;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.pillars p { color: var(--text-muted); font-size: 15px; line-height: 1.65; }
.pillars code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--bg-tinted);
  color: var(--text);
  font-size: 0.9em;
}

/* === Figure panels === */

.figure-panel { margin: 0; }

.figure-panel img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.figure-panel.figure-wide img { max-width: 100%; }

.figure-panel figcaption {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.65;
  text-align: left;
}
.figure-panel figcaption strong { color: var(--text); font-weight: 600; }
.figure-panel code {
  padding: 1px 6px;
  border-radius: 5px;
  background: var(--bg-tinted);
  font-size: 0.92em;
}

/* ============================================================
   Long Video — 4-row marquee
   ============================================================ */

.duration-marquees {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 28px;
}

.duration-row {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding: 0;
  overflow: hidden;
}

.duration-row .marquee-track {
  --marquee-duration: 90s;
  display: flex;
  gap: 18px;
  width: max-content;
  padding: 28px 0;
}

.duration-row[data-direction="left"] .marquee-track {
  animation: marquee-left var(--marquee-duration) linear infinite;
}

.duration-row[data-direction="right"] .marquee-track {
  animation: marquee-right var(--marquee-duration) linear infinite;
}

.duration-row:nth-child(1) .marquee-track { --marquee-duration: 70s; }
.duration-row:nth-child(2) .marquee-track { --marquee-duration: 88s; }
.duration-row:nth-child(3) .marquee-track { --marquee-duration: 110s; }
.duration-row:nth-child(4) .marquee-track { --marquee-duration: 130s; }

.duration-row:hover .marquee-track {
  animation-play-state: paused;
}

/* Bigger marquee videos in the duration rows */
.duration-row .marquee-video {
  width: clamp(320px, 32vw, 480px);
}

/* ============================================================
   Duration display — huge italic title at row's edge,
   videos scroll behind & "fade into" the title
   ============================================================ */

.duration-display {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: clamp(280px, 32vw, 460px);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.duration-row[data-direction="left"] .duration-display {
  left: 0;
}

.duration-row[data-direction="right"] .duration-display {
  right: 0;
  justify-content: flex-end;
}

.duration-display-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.duration-row[data-direction="left"] .duration-display-bg {
  background: linear-gradient(
    90deg,
    var(--bg-alt) 0%,
    var(--bg-alt) 80%,
    rgba(244, 243, 238, 0.92) 90%,
    rgba(244, 243, 238, 0.5) 96%,
    transparent 100%
  );
}

.duration-row[data-direction="right"] .duration-display-bg {
  background: linear-gradient(
    270deg,
    var(--bg-alt) 0%,
    var(--bg-alt) 80%,
    rgba(244, 243, 238, 0.92) 90%,
    rgba(244, 243, 238, 0.5) 96%,
    transparent 100%
  );
}

.duration-display-text {
  position: relative;
  z-index: 1;
  padding: 0 clamp(28px, 5vw, 72px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: "Instrument Serif", "Source Serif 4", Georgia, serif;
  font-style: italic;
  line-height: 0.95;
  max-height: 100%;
  overflow: visible;
}

.duration-row[data-direction="right"] .duration-display-text {
  align-items: flex-end;
  text-align: right;
}

.duration-display-num {
  font-style: normal;
  font-size: clamp(72px, 11vw, 140px);
  line-height: 1;
  letter-spacing: -0.02em;
  background: linear-gradient(
    125deg,
    var(--ink) 25%,
    var(--accent) 70%,
    var(--grad-2) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 400;
  text-shadow: 0 4px 24px rgba(196, 86, 30, 0.08);
  padding-top: 0.04em;
  padding-bottom: 0.02em;
}

.duration-display-unit {
  font-size: clamp(22px, 2.6vw, 40px);
  color: var(--text-muted);
  margin-top: -0.05em;
  letter-spacing: -0.005em;
  font-weight: 400;
}

/* Subtle pulse highlight when its row is hovered */
.duration-row:hover .duration-display-num {
  animation: number-glow 3s ease-in-out infinite;
}

@keyframes number-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(196, 86, 30, 0)); }
  50%      { filter: drop-shadow(0 0 18px rgba(216, 58, 140, 0.18)); }
}

/* ============================================================
   Comparison
   ============================================================ */

.compare-grid { display: grid; gap: 14px; }

.compare-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 8px;
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compare-header span:last-child em {
  color: var(--accent);
  font-style: italic;
  text-transform: none;
  font-size: 11px;
  margin-left: 4px;
  font-family: "Instrument Serif", serif;
}

.compare-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.compare-cell {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  background: #0a0908;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.compare-row.is-active .compare-cell {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.compare-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fff;
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.compare-tag.tag-ours {
  background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
  box-shadow: 0 4px 14px rgba(216, 58, 140, 0.32);
}

.compare-tag.tag-baseline {
  background: rgba(0, 0, 0, 0.62);
}

/* ============================================================
   Saliency Visualization
   ============================================================ */

.vis {
  margin: 0 auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.vis-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.vis-cell { margin: 0; position: relative; }

.vis-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-tinted);
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.vis-tag.vis-tag-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.vis-img-stack {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-tinted);
}

.vis-img-stack .vis-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.01);
  transition: opacity 0.4s ease;
}
.vis-img-stack .vis-img.is-active { opacity: 1; }

.vis-readout {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--bg-alt);
  border: 1px solid var(--line);
}

.vis-readout-label {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vis-readout-value {
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 32px;
  color: var(--accent);
  letter-spacing: -0.02em;
  min-width: 4ch;
  transition: color 0.3s ease;
  font-feature-settings: "tnum";
}

.vis-readout-bar {
  flex: 1 1 auto;
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--bg-tinted);
  overflow: hidden;
}

.vis-readout-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  width: var(--vis-bar, 0%);
  background: linear-gradient(90deg, var(--grad-1), var(--grad-2));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.2, 0.85, 0.3, 1);
}

.vis-control { margin-top: 26px; padding: 0 6px; }

.vis-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--vis-progress, 0%),
    var(--bg-tinted) var(--vis-progress, 0%),
    var(--bg-tinted) 100%
  );
  outline: none;
  cursor: pointer;
}

.vis-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.16),
    0 4px 14px rgba(0, 0, 0, 0.12),
    0 0 0 1.5px var(--accent);
  cursor: grab;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vis-slider::-webkit-slider-thumb:hover { transform: scale(1.08); }
.vis-slider::-webkit-slider-thumb:active { cursor: grabbing; transform: scale(1.12); }
.vis-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.16),
    0 4px 14px rgba(0, 0, 0, 0.12),
    0 0 0 1.5px var(--accent);
  cursor: grab;
}

.vis-ticks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 16px;
  color: var(--text-dim);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

.vis-ticks span em {
  display: block;
  font-style: italic;
  font-family: "Instrument Serif", serif;
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 2px;
}

.vis-ticks span.is-active { color: var(--accent); font-weight: 600; }
.vis-ticks span.is-active em { color: var(--accent-strong); }

.vis-footnote {
  margin-top: 22px;
  padding-left: 14px;
  border-left: 2px solid var(--accent);
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.6;
}
.vis-footnote strong {
  color: var(--accent);
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.95em;
}

/* ============================================================
   Results & Tables
   ============================================================ */

.result-block { margin-bottom: 44px; }

.result-title {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 400;
  letter-spacing: -0.015em;
}

.result-caption {
  margin-bottom: 18px;
  color: var(--text-muted);
  font-size: 14.5px;
  line-height: 1.6;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.result-table th, .result-table td {
  padding: 12px 14px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.result-table th {
  background: var(--bg-alt);
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.result-table th.th-group {
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-style: italic;
  font-family: "Instrument Serif", serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.result-table th:first-child, .result-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.result-table tbody tr:last-child td { border-bottom: 0; }

.result-table .group-row td {
  padding: 9px 14px;
  background: var(--bg-tinted);
  color: var(--text-dim);
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
}

.result-table .ours-row td {
  background: var(--bg-alt);
  color: var(--ink);
  position: relative;
}

.result-table .ours-row td:first-child {
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.result-table .ours-row td:first-child em {
  color: var(--accent);
  font-style: italic;
  font-family: "Instrument Serif", serif;
  font-size: 0.95em;
  margin-left: 4px;
}

.result-table .best {
  position: relative;
  font-weight: 700;
  color: var(--ink);
  isolation: isolate;
}

.result-table .best::before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 8px; right: 8px; bottom: 8px;
  height: 9px;
  background: var(--highlight);
  border-radius: 2px;
  transform: skewX(-8deg);
}

.ablation-table th { vertical-align: middle; }

.result-figures {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  margin-top: 44px;
}

/* ============================================================
   Citation
   ============================================================ */

.citation-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.copy-citation-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.copy-citation-btn:hover {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--bg-alt);
}

.copy-citation-btn .check-icon { display: none; }

.copy-citation-btn.is-copied {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.copy-citation-btn.is-copied .copy-icon { display: none; }
.copy-citation-btn.is-copied .check-icon { display: block; }

.citation-block {
  margin: 0;
  padding: 28px 32px;
  background: var(--bg-alt);
  color: var(--text);
  font-size: 13px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-x: auto;
}

.citation-block code {
  font-family: inherit;
  white-space: inherit;
  background: transparent;
  padding: 0;
}

/* ============================================================
   Footer
   ============================================================ */

footer {
  padding: 44px 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 13px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: "Instrument Serif", serif;
  font-style: italic;
  font-size: 18px;
}

.footer-links {
  display: flex;
  gap: 18px;
  font-family: "Space Grotesk", sans-serif;
}

.footer-links a, .footer-links span { color: var(--text-muted); }
.footer-links a:hover { color: var(--text); }

.footer-meta { color: var(--text-dim); font-family: "Space Grotesk", sans-serif; }

/* ============================================================
   Scroll-reveal
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition:
    opacity 0.9s cubic-bezier(0.2, 0.85, 0.3, 1),
    transform 0.9s cubic-bezier(0.2, 0.85, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.is-revealed { opacity: 1; transform: translateY(0); }

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  .marquee-track { animation: none !important; }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 980px) {
  .pillars { grid-template-columns: 1fr; }
  .duration-display { width: clamp(220px, 36vw, 320px); }
  .duration-display-num { font-size: clamp(56px, 10vw, 100px); }
  .duration-display-unit { font-size: clamp(16px, 2vw, 22px); }
  .duration-row .marquee-video { width: clamp(280px, 36vw, 380px); }
}

@media (max-width: 640px) {
  :root { --nav-height: 54px; }

  .container { width: min(100% - 32px, var(--container)); }

  .title .title-mark { font-size: clamp(56px, 18vw, 92px); }
  .title .title-line { font-size: 18px; }
  .title .title-sub  { font-size: 18px; }

  .authors-line { font-size: 14px; gap: 4px 12px; }
  .affiliations { font-size: 14px; }

  .hero-watermark { font-size: 30vw; }

  .hero-marquee .marquee-track {
    -webkit-mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, black 8%, black 92%, transparent);
  }

  .marquee-video { width: 200px; }
  .marquee-video:hover { transform: scale(1.18); }

  /* Mobile: title above the marquee row instead of overlay */
  .duration-row { display: flex; flex-direction: column; }
  .duration-display {
    position: relative;
    width: 100%;
    height: auto;
    padding: 12px 16px 0;
    z-index: 1;
  }
  .duration-display-bg { display: none; }
  .duration-display-text { padding: 0; flex-direction: row; align-items: baseline; gap: 10px; }
  .duration-display-num { font-size: 56px; line-height: 1; }
  .duration-display-unit { font-size: 18px; margin-top: 0; }
  .duration-row[data-direction="right"] .duration-display-text {
    align-items: baseline;
    flex-direction: row;
    text-align: left;
    justify-content: flex-start;
  }
  .duration-row[data-direction="right"] .duration-display { right: auto; }
  .duration-row .marquee-track { padding: 16px 0 22px; }
  .duration-row .marquee-video { width: 220px; }

  .compare-row, .compare-header { grid-template-columns: 1fr; }
  .compare-header { display: none; }

  .vis { padding: 18px; }
  .vis-pair { grid-template-columns: 1fr; gap: 14px; }
  .vis-readout { flex-direction: column; align-items: stretch; gap: 10px; }
  .vis-readout-bar { width: 100%; }

  .citation-block { padding: 18px; font-size: 12px; }
  .copy-citation-btn .copy-text { display: none; }
}
