/* =========================================================
   EVIDENT project page: custom styles
   Modern look on top of Tailwind utility classes.
   ========================================================= */

:root {
  --slot1: #ff6b6b; /* coral - person */
  --slot2: #4ecdc4; /* turquoise - object */
  --slot3: #ffd93d; /* gold - context */
  --slot4: #a78bfa; /* violet - background */
  --ink: #0a0e27;
  --ink2: #11163a;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- NAV ---------------- */
#topnav {
  backdrop-filter: blur(0px);
  background: transparent;
}
#topnav.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px) saturate(1.5);
  box-shadow: 0 1px 0 rgba(10, 14, 39, 0.06);
}
.slot-logo {
  width: 22px;
  height: 22px;
  display: inline-block;
  border-radius: 6px;
  background: conic-gradient(
    from 0deg,
    var(--slot1) 0deg 90deg,
    var(--slot2) 90deg 180deg,
    var(--slot3) 180deg 270deg,
    var(--slot4) 270deg 360deg
  );
  box-shadow: 0 2px 10px rgba(167, 139, 250, 0.4);
}

/* Nav link colors swap based on scroll state for contrast on dark/light bg */
.nav-brand,
.nav-link {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  transition: color 0.2s ease;
}
.nav-link:hover {
  color: #ffd93d;
}
#topnav.scrolled .nav-brand,
#topnav.scrolled .nav-link {
  color: rgba(10, 14, 39, 0.78);
}
#topnav.scrolled .nav-link:hover {
  color: var(--ink);
}

/* ---------------- HERO ---------------- */
.hero-bg-grid {
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center top, black 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center top, black 0%, transparent 75%);
}
.hero-bg-glow {
  background:
    radial-gradient(ellipse 60% 50% at 30% 20%, rgba(255, 107, 107, 0.22), transparent 70%),
    radial-gradient(ellipse 60% 50% at 70% 30%, rgba(78, 205, 196, 0.18), transparent 70%),
    radial-gradient(ellipse 60% 60% at 50% 80%, rgba(167, 139, 250, 0.18), transparent 70%);
  filter: blur(10px);
}

/* Bottom wave: fixed height, sits BELOW content so it never clips text */
.hero-section { padding-bottom: 0; }
.hero-wave {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  width: 100%;
  height: 70px;
  display: block;
  pointer-events: none;
  z-index: 1;
}
.hero-tldr {
  position: relative;
  z-index: 20;
}

.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 9px 22px;
  border-radius: 999px;
  color: var(--slot3);
  border: 1.5px solid transparent;
  background:
    linear-gradient(var(--ink2), var(--ink2)) padding-box,
    linear-gradient(120deg, var(--slot1), var(--slot3), var(--slot2), var(--slot4)) border-box;
  box-shadow: 0 0 28px rgba(255, 217, 61, 0.22);
  text-decoration: none;
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.venue-badge i { font-size: 14px; }
.venue-badge-link:hover {
  box-shadow: 0 0 36px rgba(255, 217, 61, 0.38);
  transform: translateY(-1px);
}


.hero-grad {
  background: linear-gradient(120deg, #ff6b6b 0%, #ffd93d 40%, #4ecdc4 70%, #a78bfa 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  background-size: 200% 200%;
  animation: grad-shift 6s ease-in-out infinite;
}
@keyframes grad-shift {
  0%, 100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}

.author-link {
  color: white;
  text-decoration: none;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.4);
  transition: border-color 0.2s, color 0.2s;
}
.author-link:hover {
  color: #ffd93d;
  border-bottom-color: #ffd93d;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(8px);
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn-pill:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.36);
  transform: translateY(-2px);
}
.btn-pill[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ---------------- SECTION TITLES ---------------- */
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  font-weight: 700;
  color: rgba(10, 14, 39, 0.5);
  margin-bottom: 8px;
}
section.bg-ink .kicker { color: rgba(255, 255, 255, 0.55); }

.section-title {
  font-family: 'Inter', sans-serif;
  font-weight: 800;
  font-size: clamp(1.75rem, 3.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin-bottom: 16px;
}
.section-sub {
  font-size: 1.05rem;
  line-height: 1.65;
  color: rgba(10, 14, 39, 0.65);
}
section.bg-ink .section-sub { color: rgba(255, 255, 255, 0.7); }

/* ---------------- TEASER SLOT STAGE ---------------- */
.slot-stage {
  position: relative;
  background: radial-gradient(ellipse at top, #fff 0%, #f5f7ff 100%);
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 24px;
  padding: 24px;
  box-shadow:
    0 30px 80px -30px rgba(10, 14, 39, 0.18),
    0 0 0 1px rgba(10, 14, 39, 0.02);
  overflow: hidden;
}
#slot-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 16px;
  background: linear-gradient(135deg, #fafbff 0%, #f0f2fb 100%);
}

.slot-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 18px;
  font-size: 13px;
}
/* 5-pill variant used by the hero animation steps */
.slot-steps.slot-steps-5 {
  grid-template-columns: repeat(5, 1fr);
  font-size: 12.5px;
}
.slot-steps.slot-steps-5 .step { padding: 9px 10px; }
.slot-steps .step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(10, 14, 39, 0.04);
  color: rgba(10, 14, 39, 0.55);
  font-weight: 500;
  transition: all 0.4s ease;
  border: 1px solid transparent;
}
.slot-steps .step.active {
  background: white;
  color: var(--ink);
  border-color: rgba(167, 139, 250, 0.4);
  box-shadow: 0 6px 20px -8px rgba(167, 139, 250, 0.4);
}
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.slot-steps .step.active .step-num {
  background: linear-gradient(135deg, var(--slot1), var(--slot4));
}

.slot-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  margin-top: 14px;
  font-size: 13px;
  color: rgba(10, 14, 39, 0.65);
}
.slot-legend em { font-style: normal; color: rgba(10, 14, 39, 0.45); }
.legend-note {
  color: rgba(10, 14, 39, 0.45);
  font-style: italic;
  margin-left: 6px;
}
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  display: inline-block;
  margin-right: -10px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 12px rgba(0, 0, 0, 0.08);
}

/* ---------------- OBSERVATION (paper Fig. 2) ---------------- */
.observation-wrap {
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  max-width: 1100px;
  background: #ffffff;
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 12px 40px -22px rgba(10, 14, 39, 0.20);
}
.observation-figure {
  width: 100%;
  height: auto;
  display: block;
  /* Reveal from left to right when scrolled into view: mimics
     each of the four diagnostic panels appearing in sequence. */
  clip-path: inset(0 100% 0 0);
  transition: clip-path 2.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.observation-wrap.in-view .observation-figure {
  clip-path: inset(0 0 0 0);
}

.observation-captions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 38px auto 0;
  max-width: 1100px;
}
@media (max-width: 900px) {
  .observation-captions { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .observation-captions { grid-template-columns: 1fr; }
}
.obs-cap {
  background: #f8faff;
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 12px;
  padding: 16px 16px 14px;
  font-size: 13.5px;
  line-height: 1.5;
  color: rgba(10, 14, 39, 0.78);
  position: relative;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.observation-captions.in-view .obs-cap { opacity: 1; transform: none; }
.observation-captions.in-view .obs-cap:nth-child(1) { transition-delay: 0.7s; }
.observation-captions.in-view .obs-cap:nth-child(2) { transition-delay: 1.1s; }
.observation-captions.in-view .obs-cap:nth-child(3) { transition-delay: 1.5s; }
.observation-captions.in-view .obs-cap:nth-child(4) { transition-delay: 1.9s; }
.obs-cap::before {
  content: attr(data-letter);
  position: absolute;
  top: -10px;
  left: 14px;
  background: var(--ink);
  color: white;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 11px;
  font-family: 'Instrument Serif', serif;
  letter-spacing: 0.04em;
}
.obs-cap strong { color: var(--ink); }

/* ---------------- MAINFIGURE (paper Fig. 3) ---------------- */
.mainfigure-wrap {
  margin: 56px auto 0;
  max-width: 1100px;
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 18px 48px -24px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.10);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.mainfigure-wrap.in-view {
  opacity: 1;
  transform: none;
}
.mainfigure-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.mainfigure-cap {
  margin-top: 14px;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(10, 14, 39, 0.62);
  text-align: center;
}
.mainfigure-cap strong { color: var(--ink); }

/* ---------------- METHOD STAGE: 3-col variant ---------------- */
.method-stage.method-stage-3col {
  grid-template-columns: 1fr auto 1fr auto 1fr;
}

/* ---------------- MOTIVATION DIAG CARDS ---------------- */
.diag-card {
  position: relative;
  background: white;
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 6px 24px -12px rgba(10, 14, 39, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.diag-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px -16px rgba(10, 14, 39, 0.18);
}
.diag-tag {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  font-weight: 600;
}
.diag-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.diag-body {
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(10, 14, 39, 0.7);
  margin-bottom: 16px;
}
.diag-bar {
  background: rgba(10, 14, 39, 0.06);
  border-radius: 6px;
  height: 26px;
  margin-bottom: 8px;
  overflow: hidden;
}
.diag-bar-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.similarity-track {
  position: relative;
  height: 36px;
  margin: 14px 4px 4px;
}
.track-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #34d399 0%, #f59e0b 50%, #f43f5e 100%);
  transform: translateY(-50%);
}
.dot-similar, .dot-dissimilar {
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  border: 3px solid #34d399;
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px rgba(52, 211, 153, 0.4);
}
.dot-similar { left: 8%; }
.dot-dissimilar { left: 92%; border-color: #f43f5e; box-shadow: 0 4px 12px rgba(244, 63, 94, 0.4); }

.perturb-cell {
  background: rgba(10, 14, 39, 0.03);
  border-radius: 12px;
  padding: 14px 16px;
}

.mmd-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.mmd-label {
  font-size: 13px;
  font-weight: 600;
  color: rgba(10, 14, 39, 0.7);
}
.mmd-bar {
  background: rgba(10, 14, 39, 0.06);
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
}
.mmd-fill {
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: white;
  font-size: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
}
.mmd-fill-bad { background: linear-gradient(90deg, #fb7185, #ef4444); }
.mmd-fill-good { background: linear-gradient(90deg, #34d399, #10b981); }

/* ---------------- METHOD STAGE ---------------- */
.method-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  padding: 28px 20px;
}
@media (max-width: 900px) {
  .method-stage {
    grid-template-columns: 1fr;
  }
  .method-arrow { transform: rotate(90deg); margin: -4px 0; }
}
.method-col {
  text-align: center;
}
.method-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 12px;
  font-weight: 600;
}
.method-caption {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 10px;
}
.method-arrow {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 300;
}

.token-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 3px;
  width: 130px;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
}
.token-grid > div {
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.18);
}

.bottleneck {
  width: 50px;
  height: 130px;
  margin: 0 auto;
  background: linear-gradient(
    180deg,
    rgba(255, 107, 107, 0.5) 0%,
    rgba(78, 205, 196, 0.5) 33%,
    rgba(255, 217, 61, 0.5) 66%,
    rgba(167, 139, 250, 0.5) 100%
  );
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}
.bottleneck::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: shimmer 2.4s ease-in-out infinite;
}
@keyframes shimmer {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.slot-orbs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 130px;
  margin: 0 auto;
}
.orb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.6), var(--c) 60%);
  box-shadow: 0 0 20px var(--c), inset -4px -4px 12px rgba(0, 0, 0, 0.2);
  animation: orb-pulse 2.4s ease-in-out infinite;
  animation-delay: var(--d);
}
@keyframes orb-pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50%      { transform: scale(1.08); filter: brightness(1.2); }
}

.method-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px;
}
.method-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.method-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}
.method-body {
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.98rem;
  line-height: 1.65;
  margin-bottom: 14px;
}
.method-eq {
  font-family: 'JetBrains Mono', monospace;
  background: rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--slot2);
  padding: 12px 16px;
  border-radius: 4px;
  color: white;
  font-size: 0.92rem;
  margin-bottom: 14px;
  overflow-x: auto;
}

/* ---------------- TASK PIPELINE STRIP ---------------- */
.task-pipeline-wrap {
  margin-top: 72px;     /* clear breathing room from the method-stage diagram above */
  position: relative;
}
.task-pipeline-wrap::before {
  /* faint divider line above the heading so it's clearly its own section */
  content: '';
  display: block;
  width: 60px;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto 22px;
}
.task-pipeline-heading {
  text-align: center;
  margin-bottom: 22px;
}
.task-pipeline-kicker {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 6px;
}
.task-pipeline-h {
  font-size: 1.25rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: -0.01em;
}
.task-pipeline {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1.1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 18px;
  padding: 22px 18px;
}
/* Default: show horizontal arrow, hide vertical */
.task-pipe-arrow .arrow-v { display: none; }
.task-pipe-arrow .arrow-h { display: inline; }
@media (max-width: 900px) {
  .task-pipeline {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 18px 14px;
  }
  /* Use a real down-arrow glyph instead of rotating the right-arrow.
     Rotation can shift the glyph optically inside its grid cell and
     make the arrow appear to "stick" to the next item, which is the
     bug the user was seeing. */
  .task-pipe-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 22px;
    font-size: 20px;
    line-height: 1;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    padding: 0;
  }
  .task-pipe-arrow .arrow-h { display: none; }
  .task-pipe-arrow .arrow-v { display: inline; }
}
.task-pipe-item {
  text-align: center;
  padding: 10px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.task-pipe-item.task-pipe-ours {
  background: linear-gradient(135deg, rgba(78, 205, 196, 0.16), rgba(167, 139, 250, 0.16));
  border-color: rgba(78, 205, 196, 0.4);
  box-shadow: 0 0 24px -8px rgba(78, 205, 196, 0.4);
}
.task-pipe-icon {
  font-size: 22px;
  margin-bottom: 8px;
}
.task-pipe-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.01em;
}
.task-pipe-sub {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 4px;
  line-height: 1.4;
}
.task-pipe-arrow {
  color: rgba(255, 255, 255, 0.35);
  font-size: 18px;
}

.param-callout {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 28px;
  align-items: center;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(167, 139, 250, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  padding: 28px 36px;
  text-align: center;
}
.param-divider {
  width: 1px;
  height: 60px;
  background: rgba(255, 255, 255, 0.18);
}
@media (max-width: 800px) {
  .param-callout { grid-template-columns: 1fr; }
  .param-divider { width: 60px; height: 1px; margin: 0 auto; }
}

/* ---------------- SLOT VISUALIZATION (paper Fig. 4) ---------------- */
.slotviz-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .slotviz-layout {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}
.slotviz-fig {
  margin: 0;
  background: white;
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 14px 40px -20px rgba(10, 14, 39, 0.22);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.slotviz-fig.in-view { opacity: 1; transform: none; }
.slotviz-fig img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
}
.slotviz-fig figcaption {
  margin-top: 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: rgba(10, 14, 39, 0.55);
  text-align: center;
}
@media (max-width: 900px) {
  .slotviz-fig {
    max-width: 460px;
    margin: 0 auto;
  }
}

.slotviz-text {
  min-width: 0;
}
.slotviz-h {
  font-size: clamp(1.25rem, 2.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  color: var(--ink);
  margin-bottom: 16px;
}
.slotviz-h em {
  font-style: italic;
  color: #4ecdc4;
}
.slotviz-p {
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(10, 14, 39, 0.75);
  margin-bottom: 14px;
}
.slotviz-bullets {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}
.slotviz-bullets li {
  position: relative;
  padding-left: 26px;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(10, 14, 39, 0.78);
  margin-bottom: 9px;
}
.bullet-dot {
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 10px rgba(0, 0, 0, 0.06);
}

/* ---------------- SLOT VISUALIZATION GRID (deprecated procedural) ---------------- */
.slot-vis-grid {
  display: grid;
  grid-template-columns: 90px repeat(5, 1fr);
  gap: 10px;
  background: white;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(10, 14, 39, 0.08);
  box-shadow: 0 12px 40px -20px rgba(10, 14, 39, 0.18);
}
.vis-row {
  display: contents;
}
.vis-cell {
  aspect-ratio: 16/9;
  border-radius: 10px;
  background: rgba(10, 14, 39, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: rgba(10, 14, 39, 0.75);
  position: relative;
  overflow: hidden;
}
.vis-cell.vis-label {
  background: transparent;
  color: rgba(10, 14, 39, 0.7);
  font-size: 13px;
}
.vis-row.vis-header .vis-cell {
  background: transparent;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: rgba(10, 14, 39, 0.55);
}

/* ---------------- RESULTS ---------------- */
.result-card {
  background: linear-gradient(135deg, white 0%, #f8faff 100%);
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 18px;
  padding: 26px;
  text-align: center;
  box-shadow: 0 8px 30px -16px rgba(10, 14, 39, 0.14);
  transition: transform 0.2s ease;
}
.result-card:hover { transform: translateY(-3px); }
.result-source {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(10, 14, 39, 0.55);
  font-weight: 600;
}
.result-delta {
  font-size: 3.4rem;
  font-weight: 800;
  background: linear-gradient(120deg, #10b981, #4ecdc4);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 8px 0;
  letter-spacing: -0.02em;
}
.result-delta-neutral {
  background: linear-gradient(120deg, #6b7280, #94a3b8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.result-meta {
  font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
  color: rgba(10, 14, 39, 0.55);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 30px -16px rgba(10, 14, 39, 0.14);
}
.results-table th,
.results-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(10, 14, 39, 0.06);
}
.results-table th {
  background: var(--ink);
  color: white;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.results-table tbody tr:nth-child(even) {
  background: rgba(10, 14, 39, 0.025);
}
.results-table tbody tr.row-ours {
  background: linear-gradient(90deg, rgba(78, 205, 196, 0.08), rgba(167, 139, 250, 0.08));
}
.results-table tbody tr.row-ours td {
  font-weight: 600;
}

/* Full results table (paper Table 1): 15 cols, denser styling */
.results-table-full {
  font-size: 12.5px;
  min-width: 1100px;
}
.results-table-full th,
.results-table-full td {
  padding: 7px 8px;
}
.results-table-full th {
  font-size: 10.5px;
  white-space: nowrap;
}
.results-table-full th.target-group {
  background: linear-gradient(90deg, #1c2150, #11163a);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  letter-spacing: 0.18em;
  font-size: 11px;
}
.results-table-full td.src-cell {
  font-weight: 700;
  background: rgba(10, 14, 39, 0.04);
  border-right: 1px solid rgba(10, 14, 39, 0.08);
  vertical-align: middle;
  font-size: 12px;
  letter-spacing: 0.01em;
}
.results-table-full tr.group-head td {
  border-top: 2px solid rgba(10, 14, 39, 0.12);
}
.results-table-full td.na {
  color: rgba(10, 14, 39, 0.30);
}
/* Vertical dividers between dataset groups (every 4 cols inside metrics) */
.results-table-full thead th:nth-of-type(2),
.results-table-full thead th:nth-of-type(3),
.results-table-full thead th:nth-of-type(4),
.results-table-full tbody tr td:nth-last-of-type(8),
.results-table-full tbody tr td:nth-last-of-type(4) {
  border-left: 1px solid rgba(10, 14, 39, 0.12);
}

/* ---------------- BIBTEX ---------------- */
.bibtex-card {
  position: relative;
  background: var(--ink);
  color: #e6e9f5;
  border-radius: 14px;
  padding: 26px 28px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  line-height: 1.65;
  box-shadow: 0 16px 40px -16px rgba(10, 14, 39, 0.4);
  overflow-x: auto;
}
.bibtex-card pre {
  white-space: pre;
  margin: 0;
}
.bibtex-copy {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.18s ease;
  font-family: 'Inter', sans-serif;
}
.bibtex-copy:hover { background: rgba(255, 255, 255, 0.16); }
.bibtex-copy.copied {
  background: rgba(52, 211, 153, 0.3);
  border-color: rgba(52, 211, 153, 0.6);
}

/* ---------------- HELPERS ---------------- */
.text-slot1 { color: var(--slot1); }
.text-slot2 { color: var(--slot2); }
.text-slot3 { color: var(--slot3); }
.text-slot4 { color: var(--slot4); }

/* ---------------- LIGHTBOX (click-to-zoom for figures) ---------------- */
.zoomable {
  cursor: zoom-in;
  transition: filter 0.18s ease, transform 0.18s ease;
}
.zoomable:hover {
  filter: brightness(0.97);
}
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 14, 39, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
}
.lightbox.open {
  display: flex;
  animation: lightbox-fade-in 0.25s ease-out;
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.lightbox-img {
  max-width: 100%;
  max-height: calc(100vh - 64px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
  cursor: default;
  /* allow native pinch-zoom on touchscreens */
  touch-action: pinch-zoom;
  -webkit-user-select: none;
  user-select: none;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: white;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s ease, transform 0.18s ease;
  font-family: 'Inter', sans-serif;
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.05);
}
@media (max-width: 600px) {
  .lightbox { padding: 12px; }
  .lightbox-close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 22px; }
}

.footer-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(255, 255, 255, 0.3);
  transition: color 0.18s ease, text-decoration-color 0.18s ease;
}
.footer-link:hover {
  color: #ffd93d;
  text-decoration-color: #ffd93d;
}

/* =========================================================
   MOBILE RESPONSIVE OVERRIDES
   ========================================================= */
@media (max-width: 767px) {
  /* Less padding around the canvas so the animation gets more pixels */
  .slot-stage {
    padding: 12px;
    border-radius: 16px;
  }

  /* Step pills: 5 columns is too cramped: stack into 2 cols, last spans both */
  .slot-steps,
  .slot-steps.slot-steps-5 {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    font-size: 12px;
  }
  .slot-steps .step {
    padding: 8px 10px;
  }
  .slot-steps.slot-steps-5 .step:last-child {
    grid-column: 1 / -1; /* the LLM → [t_s, t_e] pill spans the full row */
  }
  .step-num {
    width: 18px;
    height: 18px;
    font-size: 10px;
  }

  /* Legend wraps on narrow viewports */
  .slot-legend {
    gap: 12px;
    font-size: 12px;
  }
  .legend-note {
    flex-basis: 100%;
    text-align: center;
    margin-left: 0;
    margin-top: 4px;
  }

  /* Vis grid: 6-column grid is way too narrow on phones.
     Switch to 1-column rows: each row shows the frame + slots in a horizontal sub-grid. */
  .slot-vis-grid {
    grid-template-columns: 1fr;
    padding: 12px;
    gap: 8px;
  }
  .vis-row {
    display: grid;
    grid-template-columns: 70px repeat(5, 1fr);
    gap: 6px;
  }
  .vis-row.vis-header {
    display: none; /* hide the column-header row on mobile to save space */
  }
  .vis-cell {
    font-size: 11px;
  }

  /* Result cards: stack vertically */
  .result-delta {
    font-size: 2.8rem;
  }

  /* Param callout: stacked already via existing @media; tighten spacing */
  .param-callout {
    padding: 22px 18px;
    gap: 16px;
  }

  /* BibTeX card: smaller font + horizontal scroll already enabled */
  .bibtex-card {
    font-size: 0.78rem;
    padding: 18px;
  }

  /* Hero title size */
  .section-title {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }

  /* Make the diagnostic card hover lift not jumpy on touch */
  .diag-card:hover {
    transform: none;
  }
}


/* =========================================================
   EVIDENT additions
   ========================================================= */
.observation-captions.observation-captions-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) {
  .observation-captions.observation-captions-3 { grid-template-columns: 1fr; }
}

/* Gating figure is landscape: text left, wider figure right */
.slotviz-layout.slotviz-layout-wide {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
}
@media (max-width: 900px) {
  .slotviz-layout.slotviz-layout-wide { grid-template-columns: 1fr; }
  .slotviz-layout-wide .slotviz-fig { max-width: none; }
}

/* In-Domain cells (source = target) are de-emphasized, as in the paper */
.results-table-full td.id { color: rgba(10, 14, 39, 0.38); }
.results-table-full tbody tr.row-ours td.id { font-weight: 500; }
.results-table-full tbody tr.row-zs { background: rgba(10, 14, 39, 0.035); }

/* Ablation tables (paper Table 2) */
.ablation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}
@media (max-width: 900px) {
  .ablation-grid { grid-template-columns: minmax(0, 1fr); }   /* 1fr would grow to the tables' min-content width */
}
.ablation-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}
.ablation-table { font-size: 13px; }
.ablation-table th {
  font-size: 10.5px;
  white-space: nowrap;
  padding: 8px 8px;
}
.ablation-table td { padding: 8px 8px; }
.ablation-note {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(10, 14, 39, 0.6);
}

/* Other-backbone table */
.backbone-table td.id { color: rgba(10, 14, 39, 0.38); }
.backbone-table tbody tr.group-sep td { border-top: 2px solid rgba(10, 14, 39, 0.12); }

/* ---------------- HERO TITLE: hand-drawn EVID + ENT annotation ---------------- */
.hero-title {
  padding-bottom: 2.6rem;           /* room for brackets + notes */
}
.hand-part {
  position: relative;
  display: inline-block;
}
.hand-bracket {
  position: absolute;
  left: 3%;
  width: 94%;
  top: 100%;
  height: 0.26em;
  margin-top: -0.04em;
  overflow: visible;
}
.hand-bracket path {
  fill: none;
  stroke-width: 2.8px;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 800;            /* screen px (non-scaling stroke) */
  stroke-dashoffset: 800;
  animation: hand-draw 0.9s cubic-bezier(0.55, 0.1, 0.3, 1) forwards;
}
.hand-note {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.26em);
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 0.4em;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  animation: hand-note-in 0.5s ease forwards;
}
.hand-evid .hand-bracket path { stroke: var(--slot3); animation-delay: 0.5s; }
.hand-ent  .hand-bracket path { stroke: var(--slot2); animation-delay: 1.15s; }
.hand-evid .hand-note { color: var(--slot3); transform: translateX(-50%) rotate(-4deg); animation-delay: 1.15s; }
.hand-ent  .hand-note { color: var(--slot2); transform: translateX(-50%) rotate(3deg);  animation-delay: 1.8s; }

@keyframes hand-draw { to { stroke-dashoffset: 0; } }
@keyframes hand-note-in { to { opacity: 1; } }

@media (max-width: 767px) {
  .hero-title { padding-bottom: 2rem; }
  .hand-note { font-size: 0.46em; }
}
@media (prefers-reduced-motion: reduce) {
  .hand-bracket path { animation: none; stroke-dashoffset: 0; }
  .hand-note { animation: none; opacity: 1; }
}

/* ---------------- Stacked sub-sections (analysis + results) ---------------- */
.stack-gap { height: 72px; }
.panel-head { text-align: center; margin-bottom: 28px; }
.panel-title {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.panel-sub {
  max-width: 48rem;
  margin: 10px auto 0;
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(10, 14, 39, 0.62);
}

/* Appendix ablations, folded by default */
.more-ablations {
  margin-top: 28px;
  border-top: 1px solid rgba(10, 14, 39, 0.08);
  padding-top: 20px;
}
.more-ablations summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  list-style: none;
  text-align: center;
}
.more-ablations summary::-webkit-details-marker { display: none; }
.more-ablations summary::before {
  content: '+';
  display: inline-block;
  width: 1.2em;
  font-weight: 700;
  color: var(--slot2);
}
.more-ablations[open] summary::before { content: '−'; }

/* ---------------- HERO KEY POINTS (one per line) ---------------- */
.hero-points {
  max-width: 46rem;
  margin-left: auto;
  margin-right: auto;
  display: grid;
  gap: 12px;
  list-style: none;
  padding: 0;
}
.hero-points li {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: baseline;
  gap: 14px;
  text-align: left;
  font-size: 1.06rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}
.hero-points strong { color: #fff; font-weight: 600; }
.hp-tag {
  justify-self: end;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid currentColor;
}
.hp-problem  { color: var(--slot1); }
.hp-idea     { color: var(--slot2); }
.hp-evidence { color: var(--slot3); }
.hp-result   { color: var(--slot4); }
@media (max-width: 640px) {
  .hero-points li { grid-template-columns: 1fr; gap: 4px; font-size: 0.98rem; }
  .hp-tag { justify-self: start; }
}

/* ---------------- OOD GAINS: animated grouped bars ---------------- */
.viz-root {
  --surface-1: #ffffff;
  --text-primary: #0a0e27;
  --text-secondary: #52566b;
  --text-muted: #8a8fa3;
  --grid: #eceef3;
  --series-base: #a3acbd;   /* LoRA baseline (neutral reference) */
  --series-ours: #0f766e;   /* EVIDENT */
}
.gains-chart {
  position: relative;
  background: var(--surface-1);
  border: 1px solid rgba(10, 14, 39, 0.08);
  border-radius: 18px;
  padding: 22px 24px 16px;
  box-shadow: 0 8px 30px -16px rgba(10, 14, 39, 0.14);
}
.gains-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 14px 24px; }
.gains-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.gains-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 6px; font-size: 13px; color: var(--text-secondary); }
.gains-legend span { display: inline-flex; align-items: center; gap: 7px; }
.gains-legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dot-base { background: var(--series-base); }
.dot-ours { background: var(--series-ours); }
.gains-side { display: flex; align-items: center; gap: 18px; }
.gains-avg { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; }
.gains-avg span { font-size: 34px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.gains-avg small { margin-top: 4px; font-size: 12px; color: var(--text-muted); }
.gains-toggle { display: inline-flex; padding: 3px; border-radius: 999px; background: rgba(10, 14, 39, 0.06); }
.gains-toggle button {
  font: 600 13px Inter, sans-serif; padding: 6px 13px; border-radius: 999px; border: 0;
  background: transparent; color: var(--text-secondary); cursor: pointer;
}
.gains-toggle button[aria-pressed='true'] { background: #fff; color: var(--text-primary); box-shadow: 0 1px 6px -2px rgba(10, 14, 39, 0.3); }
.gains-toggle button:focus-visible { outline: 2px solid var(--series-ours); outline-offset: 2px; }
.gains-plot { margin-top: 8px; min-width: 0; }
.gains-plot svg { display: block; overflow: visible; }
.gains-cap { margin-top: 4px; font-size: 12.5px; color: var(--text-muted); }
.g-grid { stroke: var(--grid); stroke-width: 1; }
.g-base-line { stroke: #c9ccd6; stroke-width: 1.2; }
.g-axis { font: 400 12px 'JetBrains Mono', monospace; fill: var(--text-muted); }
.g-label { font: 600 13.5px Inter, sans-serif; fill: var(--text-secondary); }
.g-bar { stroke: var(--surface-1); stroke-width: 0; }
.g-base { fill: var(--series-base); }
.g-ours { fill: var(--series-ours); }
.g-val { font: 500 12.5px 'JetBrains Mono', monospace; fill: var(--text-secondary); }
.g-val-ours { font-weight: 700; fill: var(--text-primary); }
.g-badge-bg { fill: #e6f4f1; stroke: var(--series-ours); stroke-width: 1; }
.g-badge-t { font: 700 12.5px Inter, sans-serif; fill: var(--text-primary); }
.g-hit { fill: transparent; }
.g-row { outline: none; }
.g-row:hover .g-hit, .g-row:focus-visible .g-hit { fill: rgba(10, 14, 39, 0.03); }
.gains-tip {
  position: absolute; pointer-events: none; opacity: 0; transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  background: var(--text-primary); color: #fff; font-size: 12.5px; line-height: 1.45;
  padding: 8px 11px; border-radius: 8px; white-space: nowrap; z-index: 5;
}
.gains-tip.on { opacity: 1; transform: none; }
.gains-tip .tip-d { color: #5eead4; font-weight: 700; }
@media (max-width: 640px) {
  .gains-side { flex-wrap: wrap; gap: 10px 18px; }
  .gains-chart { padding: 18px 14px 14px; }
  .gains-avg span { font-size: 28px; }
  .g-label { font-size: 12px; }
  .g-val { font-size: 11px; }
}

/* ---------------- PIPELINE ANIMATION (paper-figure style) ---------------- */
.ev-stage {
  background: #ffffff;
  border: 1px solid #e3e3e3;
  border-radius: 10px;
  padding: 18px 18px 14px;
}
.ev-anim svg { width: 100%; height: auto; display: block; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }
.ev-svg [data-in] { opacity: 0; transition: opacity 0.5s ease; }
.ev-svg [data-in].on { opacity: 1; }
.ev-svg .ev-faint.on { opacity: 0.55; }
.ev-svg .ev-frame { transition: opacity 0.5s ease; }
.ev-svg .ev-frame.on.dim { opacity: 0.32; }
.ev-svg .ev-ent { transition: opacity 0.9s ease; }
.ev-svg [data-hl] .ev-box { transition: stroke-width 0.25s ease, filter 0.25s ease; }
.ev-svg [data-hl].hl .ev-box { stroke-width: 3.6; filter: drop-shadow(0 0 6px rgba(217, 38, 44, 0.35)); }
.ev-svg .ev-flow.on { stroke-dasharray: 7 6; animation: ev-flow 0.9s linear infinite; }
@keyframes ev-flow { to { stroke-dashoffset: -13; } }
.ev-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  margin-top: 12px;
  padding: 0;
  list-style: none;
  counter-reset: evstep;
}
.ev-steps li { counter-increment: evstep; }
.ev-steps button {
  font: 500 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #8a8a8a;
  background: none;
  border: 0;
  padding: 4px 2px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.ev-steps button[data-step]::before { content: counter(evstep) '. '; }
.ev-steps li.ev-ctl { counter-increment: none; margin-left: 10px; }
.ev-steps .ev-pause { color: #4472c4; font-weight: 600; }
.ev-steps button:hover { color: #111; }
.ev-steps button[aria-current='step'] { color: #111; font-weight: 700; border-bottom-color: #d9262c; }
.ev-steps button:focus-visible { outline: 2px solid #4472c4; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  .ev-svg [data-in], .ev-svg .ev-ent, .ev-svg .ev-frame { transition: none; }
  .ev-svg .ev-flow.on { animation: none; }
}

/* ---------------- TL;DR label + folded abstract (hero) ---------------- */
.tldr-kicker {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.5);
  scroll-margin-top: 90px;
}
.hero-abstract {
  max-width: 46rem;
  margin: 22px auto 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.98rem;
  line-height: 1.7;
}
.hero-abstract summary {
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.55);
  list-style: none;
}
.hero-abstract summary::-webkit-details-marker { display: none; }
.hero-abstract summary::after { content: ' \25BE'; }
.hero-abstract[open] summary::after { content: ' \25B4'; }
.hero-abstract summary:hover { color: #fff; }
.hero-abstract p { margin-top: 14px; text-align: left; }

/* Step caption above the animation */
.ev-caption {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  min-height: 3.2em;                 /* room for two lines, so the stage never jumps */
  margin: 2px auto 10px;
  max-width: 52rem;
  font: 500 clamp(17px, 2vw, 21px)/1.45 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #111;
  text-align: left;
  opacity: 0;
  transform: translateY(4px);
}
.ev-caption.show { opacity: 1; transform: none; transition: opacity 0.45s ease, transform 0.45s ease; }
.ev-cap-num {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  margin-top: -0.05em;
  border-radius: 999px;
  background: #d9262c;
  color: #fff;
  font-weight: 700;
  font-size: 0.85em;
}
.ev-cap-num:empty { display: none; }
/* decoder blocks are neutral (pre-trained); when active they darken instead of glowing red */
.ev-svg [data-hl].hl .ev-box.ev-dec { stroke: #3a3a3a; filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.18)); }
/* spotlight: zones outside the current step recede (filter composes with the fade-in opacity) */
.ev-svg [data-zone] { transition: opacity 0.5s ease, filter 0.6s ease; }
.ev-svg.spot [data-zone]:not(.focus) { filter: grayscale(0.85) opacity(0.28); }
@media (prefers-reduced-motion: reduce) { .ev-svg [data-zone] { transition: none; } }

/* ---------------- FIGURE SPOTLIGHT (analysis figures <-> caption cards) ---------------- */
.spot-stage { position: relative; }
.spot-veil {
  position: absolute; top: -2px; bottom: -2px;
  background: rgba(255, 255, 255, 0.8);
  opacity: 0; pointer-events: none;
  transition: opacity 0.45s ease;
}
.spot-veil.dim { opacity: 1; }
.spot-ring {
  position: absolute; top: -6px; bottom: -6px;
  border: 2px solid var(--ink); border-radius: 10px;
  opacity: 0; pointer-events: none;
  transition: left 0.45s ease, width 0.45s ease, opacity 0.3s ease;
}
figure.spotting .spot-ring { opacity: 1; }
.obs-cap[role='button'] { cursor: pointer; }
.obs-cap.active {
  background: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 10px 28px -16px rgba(10, 14, 39, 0.45);
}
.obs-cap.active::before { background: #d9262c; }
.observation-captions.in-view .obs-cap.muted { opacity: 0.5; }
.observation-captions.revealed .obs-cap { transition-delay: 0s !important; transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease, border-color 0.3s ease; }
.obs-cap:focus-visible { outline: 2px solid #4472c4; outline-offset: 2px; }

/* ---------------- TYPE SCALE: larger reading sizes ---------------- */
@media (min-width: 1024px) { html { font-size: 17px; } }
.kicker { font-size: 13px; }
.section-sub { font-size: 1.15rem; line-height: 1.65; }
.obs-cap { font-size: 1rem; line-height: 1.55; padding: 18px 18px 16px; }
.obs-cap::before { font-size: 13px; padding: 2px 11px; }
.mainfigure-cap { font-size: 0.92rem; }
.method-body { font-size: 1.05rem; }
.slotviz-p { font-size: 1.08rem; }
.panel-sub { font-size: 1.1rem; }
.ablation-title { font-size: 1.05rem; }
.ablation-note { font-size: 0.92rem; }
.results-table { font-size: 15px; }
.results-table-full { font-size: 13.5px; }
.results-table-full th { font-size: 11.5px; }
.ablation-table { font-size: 14px; }
.gains-title { font-size: 1.1rem; }
.gains-legend { font-size: 14px; }
.gains-cap { font-size: 0.88rem; }
.g-label { font-size: 15px; }
.g-val { font-size: 13.5px; }
.g-axis { font-size: 13px; }
.g-badge-t { font-size: 13.5px; }
.ev-steps button { font-size: 15px; }
@media (max-width: 640px) {
  .g-label { font-size: 12.5px; }
  .g-val { font-size: 12px; }
  .obs-cap { font-size: 0.98rem; }
}
/* slot attention iterations */
.ev-svg .ev-sa .ev-box { transition: fill 0.2s ease, stroke-width 0.2s ease; }
.ev-svg .ev-sa .ev-box.pulse { fill: #f4a3a6; stroke-width: 4; }
.ev-svg .ev-loop { transition: stroke 0.2s ease, stroke-width 0.2s ease; }
.ev-svg .ev-loop.spin { stroke: #d9262c; stroke-width: 2.6; }
.ev-svg .ev-card { transition: opacity 0.6s ease; }
.gains-avg small { white-space: nowrap; }

/* ---------------- TEASER ANIMATION (looping SVG, same as the GitHub thumbnail) ---------------- */
.teaser-anim { margin: 0 auto; max-width: 1100px; }
.teaser-anim img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 14px;
  box-shadow: 0 18px 48px -28px rgba(10, 14, 39, 0.55);
}

/* ---------------- RE-COUPLING: rebuttal Fig. 2(c), redrawn and animated (white card on the dark band) ---------------- */
.recouple {
  --rc-id: #606cfc;              /* ID (Cha.), paper blue */
  --rc-ood: #f2555a;             /* OOD (QVH), paper red deepened to 3:1 on white */
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 16px;
  padding: 20px 24px 14px;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}
.rc-word-off { color: rgba(255, 255, 255, 0.42); text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: rgba(238, 95, 98, 0.8); }
.rc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; font-size: 13.5px; color: #52566b; }
.rc-legend span { display: inline-flex; align-items: center; gap: 7px; }
.rc-legend-sep { width: 1px; height: 14px; background: #dfe1e8; }
.rc-key { display: inline-block; width: 22px; height: 0; border-top: 3px solid; }
.rc-key-id { border-color: var(--rc-id); }
.rc-key-ood { border-color: var(--rc-ood); }
.rc-key-dash { border-top: 2px dashed #9aa0b4; }
.rc-key-solid { border-top: 3px solid #0a0e27; }
.rc-plot { margin-top: 6px; min-width: 0; }
.rc-plot svg { display: block; overflow: visible; }
.rc-grid { stroke: #eceef3; stroke-width: 1; }
.rc-zero { stroke: #c9ccd6; stroke-width: 1.2; }
.rc-axis { font: 400 12px 'JetBrains Mono', monospace; fill: #8a8fa3; }
.rc-axis-t { font: 500 12.5px Inter, sans-serif; fill: #8a8fa3; }
.rc-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.rc-line.rc-id { stroke: var(--rc-id); }
.rc-line.rc-ood { stroke: var(--rc-ood); }
.rc-line.rc-base { stroke-width: 2.2; stroke-dasharray: 7 5; transition: opacity 0.6s ease; }
.rc-line.rc-ev { stroke-width: 3.4; }
.rc-band { fill: rgba(242, 85, 90, 0.13); stroke: none; }
.recouple.s2 .rc-line.rc-base { opacity: 0.42; }
.rc-dot { stroke: #fff; stroke-width: 2; opacity: 0; transition: opacity 0.3s ease; }
.rc-dot.rc-id { fill: var(--rc-id); }
.rc-dot.rc-ood { fill: var(--rc-ood); }
@media (max-width: 640px) {
  .recouple { padding: 14px 12px 10px; }
  .rc-legend { font-size: 12px; gap: 4px 12px; }
  .rc-legend-sep { display: none; }
}
@media (max-width: 480px) {
  /* 5-column ablation tables: fit a phone width instead of scrolling */
  .ablation-table { font-size: 12.5px; }
  .ablation-table th { font-size: 9.5px; letter-spacing: 0; padding: 7px 4px; }
  .ablation-table td { padding: 7px 4px; }
}
@media (max-width: 400px) {
  .ablation-table { font-size: 12px; }
  .ablation-table th { font-size: 9px; padding: 6px 3px; }
  .ablation-table td { padding: 6px 3px; }
}
