/* ============================================================ */
/* Waabi-inspired scroll experience                             */
/* MuJoCo-themed background: blue-grey sky + checkerboard floor */
/* ============================================================ */

:root {
  --wa-dark: #191818;
  --wa-cream: #e8e6e3;
  --wa-cream-lt: #f4f2ef;
  --wa-accent: #4f46e5;
  --wa-text-dark: #191818;
  --wa-text-light: #e8e6e3;
  --wa-radius: 2rem;
  --wa-ease: cubic-bezier(.19,1,.22,1);
  /* MuJoCo palette — warm beige sim space */
  --mj-sky-top: #A8BCCF;
  --mj-sky-mid: #C8CDBE;
  --mj-horizon: #DDD5C4;
  --mj-ground: #D8CCAF;
}

/* -- Fixed MuJoCo background (single layer behind all scroll sections) -- */
.mujoco-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(180deg,
      var(--mj-sky-top)   0%,
      var(--mj-sky-mid)   22%,
      var(--mj-horizon)   35%,
      var(--mj-ground)    100%
    );
  pointer-events: none;
}

/* Soft horizon glow */
.mujoco-bg__horizon {
  position: absolute;
  left: 0;
  right: 0;
  top: 32%;
  height: 10%;
  background: radial-gradient(ellipse 100% 100% at 50% 50%, rgba(230,218,190,0.55) 0%, transparent 70%);
  pointer-events: none;
}

/* 3D perspective grid floor — major + minor gridlines */
.mujoco-bg__checker {
  position: absolute;
  left: -100%;
  top: 35%;
  width: 300%;
  height: 200%;
  background:
    /* Major gridlines */
    linear-gradient(90deg, rgba(140,120,90,0.25) 1px, transparent 1px),
    linear-gradient(0deg,  rgba(140,120,90,0.25) 1px, transparent 1px),
    /* Minor sub-grid */
    linear-gradient(90deg, rgba(140,120,90,0.08) 1px, transparent 1px),
    linear-gradient(0deg,  rgba(140,120,90,0.08) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 20px 20px, 20px 20px;
  transform: perspective(300px) rotateX(45deg);
  transform-origin: top center;
  -webkit-mask-image: radial-gradient(ellipse 100% 120% at 50% 0%, black 20%, transparent 55%);
  mask-image: radial-gradient(ellipse 100% 120% at 50% 0%, black 20%, transparent 55%);
}

/* -- Scenes (full-viewport sections, transparent over fixed bg) -- */
.wa-scene {
  position: relative;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  background: transparent;
}

/* Prevent flash of unstyled content before GSAP initialises */
#scene-hero {
  visibility: hidden;
}
#scene-hero.gsap-ready {
  visibility: visible;
}

/* ── Act 1: Hero Video → Gallery zoom-out ── */

#scene-hero {
  min-height: 100vh;
}

/* Full-viewport teaser overlay */
.teaser-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  background: #000;
  pointer-events: none;
  will-change: opacity;
}

.teaser-overlay video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Title overlay — sits above the gallery, fades out on scroll */
.wa-hero-title {
  position: absolute;
  inset: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.35);
  pointer-events: none;
}

/* Video inside the grid cell */
.wa-gallery__item--video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wa-hero__name {
  font-family: 'Instrument Serif', 'Georgia', serif;
  font-size: 7rem;
  font-weight: 400;
  color: #fff;
  letter-spacing: -2px;
  line-height: 1;
  margin-bottom: 1.2rem;
}

.wa-hero__name em {
  font-style: italic;
}

.wa-hero__sub {
  font-family: 'Inter', sans-serif;
  font-size: 1.8rem;
  font-weight: 300;
  color: rgba(255,255,255,0.85);
  text-align: center;
  line-height: 1.6;
}

/* Gallery grid */
.wa-gallery {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.wa-gallery__item {
  border-radius: 0;
  overflow: hidden;
  background: var(--wa-dark);
  aspect-ratio: auto;
}

.wa-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wa-gallery__item--video {
  background: #000;
  z-index: 15;
  position: relative;
}



.wa-gallery__label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 0.8rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.wa-gallery__item--video:hover .wa-gallery__label {
  opacity: 1;
}

/* ── Pop-up containers (cream on dark) ── */

.wa-popup {
  background: var(--wa-cream);
  border-radius: var(--wa-radius);
  max-width: 1100px;
  max-height: calc(100vh - 8rem);
  width: calc(100% - 4rem);
  margin: 0 auto;
  overflow: hidden;
  box-shadow: 0 30px 100px rgba(0,0,0,0.3);
  will-change: transform, opacity;
  display: flex;
  flex-direction: column;
}

.wa-popup--glass {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255,255,255,0.2);
}

.wa-popup__inner {
  padding: 3rem;
}

.wa-popup__inner--split {
  display: flex;
  gap: 2rem;
  padding: 2rem;
  align-items: stretch;
}

.wa-popup__inner--stacked {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem;
}

/* ── Full-viewport split pane (Act 2 chat → code squeeze) ── */
.wa-scene--fullscreen {
  position: relative;
  overflow: hidden;
}

/* Override .wa-scene--dark flex centering + padding for Act 2 full-bleed layout */
#scene-problem {
  display: block;
  padding: 0;
}

.act2-split {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  opacity: 0;
}

/* Act 2 browser fills the entire viewport — doubled selector for specificity over base .browser-mockup */
.browser-mockup.browser-mockup--act2 {
  width: 100%;
  height: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.browser-mockup--act2 .browser-mockup__body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Chat pane — squeezes left when code opens */
.browser-mockup--act2 .browser-mockup__main {
  flex: 1 1 0%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.browser-mockup--act2 .browser-chat {
  flex: 1;
  overflow-y: auto;
}

.browser-mockup--act2 .browser-output {
  flex-shrink: 0;
}

/* Code pane — expands from right inside the browser window */
.browser-mockup__codepane {
  flex: 0 0 0%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-left: 1px solid #444;
}

.browser-mockup__codepane .code-editor {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  background: #1e1e2e;
}

.browser-mockup__codepane .code-editor__tab {
  padding: 6px 14px;
  background: #2a2a3e;
  border-bottom: 1px solid #333;
  font-size: 0.75rem;
  color: #8b949e;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

.browser-mockup__codepane .code-editor__body {
  flex: 1;
  overflow: auto;
}

.browser-mockup__codepane .code-editor__body pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Browser sidebar: allow GSAP to tween width to 0 during squeeze */
.browser-mockup--act2 .browser-mockup__sidebar {
  overflow: hidden;
  flex-shrink: 0;
}

/* ── Centered variation tree layout (Act 3, no chat) ── */
.wa-popup__inner--centered {
  padding: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wa-popup__inner--centered .variation-tree {
  max-width: 700px;
  width: 100%;
}

.wa-popup__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wa-popup__col--text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.wa-popup__heading {
  font-family: 'Instrument Serif', 'Georgia', serif;
  font-size: 2.4rem;
  font-weight: 400;
  color: var(--wa-text-dark);
  margin-bottom: 1.5rem;
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.wa-popup__heading--center {
  text-align: center;
}

.wa-popup__footer {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Text inside cream popups: dark text */
.wa-popup .stream-text__line {
  color: var(--wa-text-dark);
  font-size: 1.1rem;
  line-height: 1.7;
  font-weight: 400;
}

.wa-popup .stream-text__line .stream-char.revealed {
  color: var(--wa-text-dark);
}

.wa-popup .stream-text {
  max-width: 520px;
}

/* Badges inside cream popups */
.wa-popup .contrib-badge {
  background: rgba(79, 70, 229, 0.08);
  color: var(--wa-accent);
  border-color: rgba(79, 70, 229, 0.2);
}

/* Chat inside cream popups */
.wa-popup .scroll-chat {
  background: var(--wa-dark);
  border: none;
  border-radius: 1rem;
}

/* Graph overlay */
.wa-graph-overlay {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 2rem;
}

/* Scene centering for popup sections */
.wa-scene--dark,
.wa-scene--cream {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
}

/* Dark text overrides — all scenes share the MuJoCo light background */
.wa-scene .stream-text__line { color: var(--wa-text-dark); }
.wa-scene .stream-text__line .stream-char.revealed { color: var(--wa-text-dark); }
.wa-scene .crowd-counter__num { color: var(--wa-text-dark); text-shadow: none; }
.wa-scene .crowd-counter__label { color: #6b7280; }
.wa-scene .d3-nodes text { fill: var(--wa-text-dark); }
.wa-scene .scroll-cta__btn--secondary { color: var(--wa-text-dark); border-color: #b0ada8; }
.wa-scene .scroll-cta__btn--secondary:hover { background: rgba(0,0,0,0.05); color: var(--wa-text-dark); }

/* ── Code editor ── */
.code-editor {
  width: 100%;
  max-width: 100%;
  height: 100%;
  background: var(--wa-dark);
  border-radius: 1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-editor__toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: #222;
  border-bottom: 1px solid #333;
}

.code-editor__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.code-editor__dot--red { background: #ff5f56; }
.code-editor__dot--yellow { background: #ffbd2e; }
.code-editor__dot--green { background: #27c93f; }

.code-editor__filename {
  margin-left: 10px;
  font-size: 0.8rem;
  color: #8b949e;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
}

.code-editor__body {
  flex: 1;
  overflow: hidden;
  padding: 0;
}

.code-editor__body pre {
  margin: 0;
  padding: 16px;
  background: var(--wa-dark);
  min-height: 100%;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.code-editor__body code {
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Source Code Pro', Consolas, 'Courier New', monospace;
  font-size: 13px;
  font-variant-ligatures: contextual;
  -webkit-font-smoothing: antialiased;
}

/* ── Browser mockup ── */
.browser-mockup {
  width: 100%;
  max-width: 900px;
  background: var(--wa-dark);
  border-radius: 1rem;
  overflow: hidden;
}

.browser-mockup__toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #222;
  border-bottom: 1px solid #333;
}

.browser-mockup__dots {
  display: flex;
  gap: 6px;
}

.browser-mockup__url {
  flex: 1;
  background: var(--wa-dark);
  border: 1px solid #333;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.8rem;
  color: #8b949e;
  font-family: 'Inter', sans-serif;
}

.browser-mockup__url-icon {
  margin-right: 6px;
}

.browser-mockup__body {
  display: flex;
  min-height: 280px;
}

.browser-mockup__sidebar {
  width: 170px;
  background: #222;
  border-right: 1px solid #333;
  padding: 14px 0;
}

.browser-sidebar__title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--wa-text-light);
  padding: 0 14px 10px;
  border-bottom: 1px solid #333;
  margin-bottom: 6px;
}

.browser-sidebar__item {
  padding: 7px 14px;
  font-size: 0.78rem;
  color: #8b949e;
  cursor: pointer;
}

.browser-sidebar__item--active {
  background: rgba(79, 70, 229, 0.15);
  color: #a5b4fc;
  border-right: 2px solid var(--wa-accent);
}

.browser-mockup__main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.browser-chat {
  flex: 1;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.browser-chat__msg { display: flex; }
.browser-chat__msg--user { justify-content: flex-end; }
.browser-chat__msg--system { justify-content: flex-start; }

.browser-chat__bubble {
  max-width: 75%;
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.browser-chat__bubble--user {
  background: #3730a3;
  color: #e5e7eb;
  border-bottom-right-radius: 3px;
}

.browser-chat__bubble--system {
  background: #2a2a2a;
  color: #c9d1d9;
  border-bottom-left-radius: 3px;
}

/* ── Typing indicator dots ── */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 8px;
  height: 20px;
}
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.browser-chat__status {
  display: block;
  font-size: 0.68rem;
  color: #4ade80;
  margin-bottom: 3px;
  font-family: monospace;
}

.browser-chat__snapshot {
  display: block;
  width: 100%;
  max-width: 220px;
  margin-top: 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.browser-chat__snapshot-label {
  display: block;
  font-size: 0.62rem;
  color: #4ade80;
  margin-top: 4px;
  font-family: monospace;
}

.browser-output {
  border-top: 1px solid #333;
  padding: 12px 14px;
  background: var(--wa-dark);
}

.browser-output__header {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #8b949e;
  margin-bottom: 6px;
  font-weight: 600;
}

.browser-output__field {
  font-size: 0.78rem;
  color: #c9d1d9;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', Consolas, monospace;
  margin-bottom: 3px;
  line-height: 1.5;
}

.browser-output__key {
  color: #a5b4fc;
  font-weight: 600;
}

/* ── Streaming text ── */
.stream-text {
  max-width: 480px;
}

.stream-text--mt { margin-top: 1.5rem; }

.stream-text--center {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
}

.stream-text--large .stream-text__line {
  font-size: 1.6rem;
  line-height: 1.5;
}

.stream-text__line {
  font-size: 1.15rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 0.8rem;
  font-weight: 300;
}

.stream-text__line .stream-char {
  color: transparent;
  transition: color 0.12s var(--wa-ease);
}

.stream-text__line .stream-char.revealed {
  color: rgba(255, 255, 255, 0.9);
}

/* ── Scroll chat ── */
.scroll-chat {
  background: rgba(17, 24, 39, 0.9);
  border-radius: 1rem;
  padding: 1rem;
  border: 1px solid rgba(75, 85, 99, 0.3);
  width: 100%;
}

.scroll-chat__msg { margin-bottom: 0.65rem; }
.scroll-chat__msg:last-child { margin-bottom: 0; }

.scroll-chat__label {
  display: block;
  font-size: 0.62rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.scroll-chat__msg--user .scroll-chat__label { text-align: right; }
.scroll-chat__msg--user { text-align: right; }

.scroll-chat__bubble {
  padding: 9px 13px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #e5e7eb;
}

.scroll-chat__bubble--user {
  background: #3730a3;
  border-bottom-right-radius: 3px;
  margin-left: 20%;
}

.scroll-chat__bubble--system {
  background: #374151;
  border-bottom-left-radius: 3px;
  margin-right: 20%;
}

/* ── Variation tree ── */
.variation-tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.variation-base { margin-bottom: 0; }

.variation-branch {
  width: 2px;
  height: 36px;
  background: linear-gradient(to bottom, var(--wa-accent), rgba(79, 70, 229, 0.2));
}

.variation-children {
  display: flex;
  gap: 14px;
  position: relative;
}

.variation-children::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: rgba(79, 70, 229, 0.25);
}

.variation-card {
  background: rgba(79, 70, 229, 0.06);
  border: 1px solid rgba(79, 70, 229, 0.15);
  border-radius: 1rem;
  padding: 0;
  text-align: center;
  min-width: 120px;
  transition: transform 0.25s var(--wa-ease), border-color 0.25s, box-shadow 0.25s;
  overflow: hidden;
  position: relative;
}

.variation-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 70, 229, 0.5);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.2);
}

.variation-card--base {
  background: rgba(79, 70, 229, 0.1);
  border-color: rgba(79, 70, 229, 0.3);
}

/* Video rollout cards */
.variation-card--video {
  min-width: 180px;
  max-width: 220px;
  aspect-ratio: 4 / 3;
  background: #1a1a1a;
}

.variation-card__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.variation-card__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,0.85));
  text-align: left;
}

.variation-card__title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  line-height: 1.2;
}

.variation-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.variation-card__status {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.variation-card__status--pass {
  background: rgba(52, 211, 153, 0.2);
  color: #34d399;
}

.variation-card__status--fail {
  background: rgba(244, 114, 182, 0.2);
  color: #f472b6;
}

.variation-card__desc { font-size: 0.72rem; color: #6b7280; }

/* ── Contribution badges ── */
.contrib-badge {
  display: inline-block;
  background: rgba(79, 70, 229, 0.1);
  color: var(--wa-accent);
  border: 1px solid rgba(79, 70, 229, 0.2);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin-top: 1.2rem;
  opacity: 0;
}

.contrib-badge--large {
  font-size: 0.95rem;
  padding: 8px 20px;
  margin-top: 1rem;
}

/* ── D3 graph container ── */
.d3-graph-container {
  position: absolute;
  inset: -35%;
  z-index: 1;
  opacity: 0.45;
}

.d3-graph-container svg { width: 100%; height: 100%; overflow: visible; }
.d3-links line { stroke-width: 2.5; }
.d3-nodes text { pointer-events: none; }
.camera-group { will-change: transform; }

/* ── Counter & CTA ── */
.crowd-counter {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-bottom: 1.5rem;
}

.crowd-counter__num {
  display: block;
  font-family: 'Instrument Serif', serif;
  font-size: 5rem;
  font-weight: 400;
  color: #fff;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.crowd-counter__label {
  display: block;
  font-size: 1rem;
  color: #9ca3af;
  margin-top: 0.4rem;
}

.scroll-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 1.5rem;
  opacity: 0;
}

.scroll-cta__btn {
  padding: 12px 28px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.25s var(--wa-ease), box-shadow 0.25s;
  pointer-events: auto;
}

.scroll-cta__btn:hover { transform: translateY(-2px); }

.scroll-cta__btn--primary {
  background: var(--wa-accent);
  color: #fff;
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.35);
}

.scroll-cta__btn--primary:hover {
  box-shadow: 0 8px 30px rgba(79, 70, 229, 0.5);
  color: #fff;
}

.scroll-cta__btn--secondary {
  background: transparent;
  color: var(--wa-text-light);
  border: 1px solid #4b5563;
}

.scroll-cta__btn--secondary:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

/* GPU hints */
.wa-gallery__item--video,
.wa-popup,
.act2-split,
.code-editor,
.browser-mockup,
.variation-tree,
.d3-graph-container {
  will-change: transform, opacity;
}

/* ===== Mobile ===== */
@media screen and (max-width: 768px) {
  .wa-hero__name { font-size: 3.8rem; }
  .wa-hero__sub { font-size: 1rem; }

  .wa-gallery__grid {
    gap: 0.5rem;
  }

  .wa-popup { width: calc(100% - 2rem); border-radius: 1.4rem; }
  .wa-popup__inner { padding: 1.5rem; }
  .wa-popup__inner--split { flex-direction: column; gap: 1.5rem; padding: 1.5rem; }
  .wa-popup__heading { font-size: 1.8rem; }

  .code-editor { height: 280px; }

  .browser-mockup__sidebar { display: none; }

  /* Act 2 mobile: code pane fills viewport for cross-fade (no split) */
  .browser-mockup__codepane {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border-left: none;
  }

  .stream-text__line { font-size: 0.95rem; }
  .stream-text--large .stream-text__line { font-size: 1.2rem; }

  .crowd-counter__num { font-size: 3rem; }

  .variation-children { flex-direction: column; align-items: center; }
  .variation-children::before { display: none; }
  .variation-card { min-width: 140px; }
  .variation-card--video { max-width: 160px; }

  .scroll-chat__bubble--user { margin-left: 10%; }
  .scroll-chat__bubble--system { margin-right: 10%; }
}

/* ===== Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .act2-split {
    opacity: 1 !important;
  }
}

/* ===== Base ===== */
body {
  font-family: 'Inter', sans-serif;
  color: var(--wa-text-dark, #191818);
  background: var(--wa-dark, #191818);
  overflow-x: hidden;
}

/* Wrapper for all content below the scroll experience */
.page-body {
  position: relative;
  z-index: 10;
  background: #fff;
}

/* -- Hero static section (scrolls naturally after scroll experience) -- */
.hero-static {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: transparent;
}

.hero-static__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1;
}

/* -- Hero overlay content (title + nav + tabs) -- */
.hero-overlay-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 2rem;
  position: relative;
  z-index: 2;
}

.bridge-title__name {
  font-family: 'Inter', sans-serif;
  font-size: 7rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 1rem;
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.25);
}

.bridge-title__sub {
  font-size: 1.8rem;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.5;
  letter-spacing: 0.5px;
  text-align: center;
  text-shadow: 0 1px 15px rgba(0, 0, 0, 0.2);
}

/* Nav links (top of hero overlay) */
.hero-overlay-nav {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.hero-overlay-nav__link {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.2s;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.15);
}

.hero-overlay-nav__link:hover {
  color: #fff;
}

.hero-overlay-nav__link--btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 6px 16px;
  border-radius: 6px;
}

.hero-overlay-nav__link--btn:hover {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Mobile links */
.hero-overlay-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 1.5rem;
}

/* Bottom tabs */
.hero-overlay-tabs {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 0;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-overlay-tabs a {
  color: rgba(255, 255, 255, 0.75);
  padding: 1rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
  border-bottom: 2px solid transparent;
}

.hero-overlay-tabs a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border-bottom-color: #4f46e5;
}

@media screen and (max-width: 768px) {
  .bridge-title__name {
    font-size: 3.5rem;
  }
  .bridge-title__sub {
    font-size: 1.1rem;
  }
}

/* ===== General Publication Styles ===== */
.publication-title {
  font-family: 'Inter', sans-serif;
}

.publication-authors {
  font-family: 'Inter', sans-serif;
}

.publication-authors a {
  color: #4f46e5 !important;
}

.publication-authors a:hover {
  text-decoration: underline;
}

.publication-venue {
  color: #6b7280;
  width: fit-content;
  font-weight: bold;
}

.publication-awards {
  color: #ff3860;
  width: fit-content;
  font-weight: bolder;
}

.author-block {
  display: inline-block;
}

.publication-video {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  overflow: hidden;
  border-radius: 10px !important;
}

.publication-video iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.footer .icon-link {
  font-size: 25px;
  color: #000;
}

.link-block a {
  margin-top: 5px;
  margin-bottom: 5px;
}


/* ===== Dark Section ===== */
.section-dark {
  background-color: #111827;
}


/* ===== Hero Fullscreen Video Overlay ===== */
.overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.4);
  z-index: 1;
  transition: opacity 1.0s;
}

.hero-body,
.hero-head,
.hero-foot {
  z-index: 2;
  transition: opacity 1.0s;
}


/* ===== 4a. Simulation Gallery – Grid + Spotlight ===== */
.sim-gallery-spotlight {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 16 / 9;
}

.sim-gallery-spotlight video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sim-spotlight-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.6rem 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  pointer-events: none;
}

.sim-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
}

.sim-gallery-card {
  cursor: pointer;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  background: #f9fafb;
}

.sim-gallery-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.sim-gallery-card.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}

.sim-gallery-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.sim-gallery-card span {
  display: block;
  padding: 6px 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1a1a1a;
}

.sim-gallery-card.placeholder {
  cursor: default;
  opacity: 0.65;
  border-style: dashed;
  position: relative;
  overflow: hidden;
}

.sim-gallery-card.placeholder:hover {
  transform: none;
  box-shadow: none;
}

@media screen and (max-width: 768px) {
  .sim-gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .sim-gallery-spotlight {
    border-radius: 8px;
  }
}

@media screen and (max-width: 480px) {
  .sim-gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 4b. Task Variants (CAT4D style) ===== */
.gallery-scene-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.gallery-scene-pill {
  cursor: pointer;
  padding: 6px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s;
  width: 120px;
}

.gallery-scene-pill:hover {
  transform: scale(1.05);
}

.gallery-scene-pill.active {
  border-color: #4f46e5;
  background: rgba(79, 70, 229, 0.08);
}

.scene-thumb-img {
  width: 100%;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 4px;
}

.gallery-scene-pill span {
  font-size: 0.8rem;
  font-weight: 600;
}

.gallery-pill-label {
  font-size: 1rem;
  margin-right: 0.5rem;
}


/* ===== 5. Chat Interface (VLM-TAMP style) ===== */
.chat-body {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 0.5rem;
}

.chat-container {
  display: flex;
  width: 100%;
  max-width: 960px;
  height: 580px;
  background-color: #1f2937;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.chat-sidebar {
  width: 25%;
  min-width: 160px;
  background-color: #111827;
  color: white;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.chat-sidebar-title {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 16px;
  color: #e5e7eb;
}

.chat-sidebar-item {
  margin-bottom: 6px;
  cursor: pointer;
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  color: #d1d5db;
  transition: background 0.2s;
}

.chat-sidebar-item:hover {
  background-color: #374151;
}

.chat-sidebar-item.selected {
  background-color: #374151;
  color: white;
}

.chat-sidenote {
  color: #9ca3af;
  font-size: 11px;
}

.chat-window {
  width: 75%;
  display: flex;
  flex-direction: column;
}

.chat-header {
  color: #9ca3af;
  background-color: #111827;
  padding: 10px 16px;
  display: flex;
  gap: 16px;
  align-items: center;
  font-size: 13px;
  border-bottom: 1px solid #374151;
  flex-wrap: wrap;
}

.chat-select {
  background-color: #374151;
  border: 1px solid #4b5563;
  color: #d1d5db;
  padding: 3px 8px;
  font-size: 13px;
  border-radius: 6px;
  margin-left: 4px;
}

.chat-content {
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-content::-webkit-scrollbar {
  width: 5px;
}

.chat-content::-webkit-scrollbar-track {
  background: transparent;
}

.chat-content::-webkit-scrollbar-thumb {
  background: #6b7280;
  border-radius: 5px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}

.chat-msg-user {
  align-self: flex-end;
}

.chat-msg-assistant {
  align-self: flex-start;
}

.chat-msg-label {
  font-size: 10px;
  color: #9ca3af;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chat-msg-user .chat-msg-label {
  text-align: right;
}

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  color: #e5e7eb;
}

.chat-msg-bubble code {
  background: #111827;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #7ec8e3;
}

.chat-msg-bubble-user {
  background-color: #3730a3;
  border-bottom-right-radius: 4px;
}

.chat-msg-bubble-assistant {
  background-color: #374151;
  border-bottom-left-radius: 4px;
}

.chat-msg-img {
  width: 100%;
  height: 100px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #9ca3af;
}

.chat-expand-toggle {
  color: #a5b4fc;
  cursor: pointer;
  font-size: 11px;
  margin-top: 6px;
  text-decoration: underline;
}

.chat-expand-toggle:hover {
  color: #c7d2fe;
}

/* Task Detail View (inside chat container) */
.taskview-panel {
  padding: 24px;
  color: #e5e7eb;
}

.taskview-header {
  margin-bottom: 12px;
}

.taskview-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
}

.taskview-meta {
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 4px;
}

.taskview-description {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #d1d5db;
  margin-bottom: 12px;
}

.taskview-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.taskview-badge {
  background: #374151;
  color: #d1d5db;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #4b5563;
}

.taskview-badge.badge-cat {
  background: rgba(79, 70, 229, 0.15);
  color: #a5b4fc;
  border-color: rgba(79, 70, 229, 0.3);
}

.taskview-separator {
  border-top: 1px solid #374151;
  margin: 16px 0;
}

.taskview-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-bottom: 12px;
}

.taskview-preview {
  display: flex;
  align-items: center;
  gap: 16px;
}

.taskview-preview-col {
  flex: 1;
  text-align: center;
}

.taskview-preview-col img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #4b5563;
}

.taskview-preview-col span {
  display: block;
  font-size: 0.8rem;
  color: #9ca3af;
  margin-top: 6px;
}

.taskview-arrow {
  font-size: 2.5rem;
  color: #6b7280;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.taskview-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: 4px 0;
}

.taskview-chevron {
  font-size: 0.9rem;
  color: #9ca3af;
  transition: transform 0.2s;
}

.taskview-code {
  max-height: 300px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #374151;
  margin-top: 8px;
}

.taskview-code pre {
  margin: 0;
  padding: 16px;
  background: #111827;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
}

/* Mobile chat adjustments */
@media screen and (max-width: 768px) {
  .chat-container {
    flex-direction: column;
    height: auto;
    min-height: 500px;
  }
  .chat-sidebar {
    width: 100%;
    min-width: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
    gap: 8px;
  }
  .chat-sidebar-title {
    display: none;
  }
  .chat-sidebar-item {
    white-space: nowrap;
    margin-bottom: 0;
  }
  .chat-sidebar-item br,
  .chat-sidebar-item .chat-sidenote {
    display: none;
  }
  .chat-window {
    width: 100%;
  }
  .taskview-preview {
    flex-direction: column;
    gap: 8px;
  }
  .taskview-arrow {
    transform: rotate(90deg);
    margin-bottom: 0;
  }
}


/* ===== 7. Policy Evaluation Gallery ===== */

/* Toggle pills (matches results-pill pattern) */
.eval-toggle-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.eval-pill {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1.5px solid #e5e7eb;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.19,1,.22,1);
  font-family: 'Inter', sans-serif;
}

.eval-pill:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.eval-pill.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

/* Task card grid (mirrors .sim-gallery-grid) */
.eval-task-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  max-width: 800px;
  margin: 0 auto 2rem;
}

.eval-thumb {
  cursor: pointer;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  background: #f9fafb;
}

.eval-thumb:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.eval-thumb.active {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.2);
}

.eval-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.eval-thumb-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: #6366f1;
}

.eval-thumb span {
  display: block;
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
  color: #1a1a1a;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Spotlight video (mirrors .sim-gallery-spotlight) */
.eval-spotlight {
  position: relative;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

.eval-spotlight video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.eval-spotlight-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  pointer-events: none;
}

/* Model selector */
.eval-model-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.eval-model-pill {
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid #e5e7eb;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Inter', sans-serif;
}

.eval-model-pill:hover {
  border-color: var(--model-color, #4f46e5);
  color: var(--model-color, #4f46e5);
}

.eval-model-pill.active {
  background: var(--model-color, #4f46e5);
  border-color: var(--model-color, #4f46e5);
  color: #fff;
}

/* Episode navigator row */
.eval-episode-nav-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #374151;
}

.eval-nav-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
  color: #374151;
  padding: 0;
  line-height: 1;
}

.eval-nav-btn:hover {
  background: #e5e7eb;
  border-color: #4f46e5;
  color: #4f46e5;
}

/* Episode overview grid */
.eval-grid-section {
  max-width: 800px;
  margin: 0 auto;
}

.eval-episode-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 5px;
}

.eval-ep-cell {
  aspect-ratio: 1;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  user-select: none;
  border: 2px solid transparent;
}

.eval-ep-cell:hover {
  transform: scale(1.15);
  z-index: 2;
}

.eval-ep-cell.success {
  background: #d1fae5;
  color: #065f46;
}

.eval-ep-cell.fail {
  background: #fee2e2;
  color: #991b1b;
}

.eval-ep-cell.active {
  border-color: #1e1b4b;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.4);
  transform: scale(1.1);
  z-index: 3;
}

/* Success rate bar chart */
.eval-chart-section {
  max-width: 800px;
  margin: 0 auto;
}

.eval-chart-container {
  background: #111827;
  border-radius: 8px;
  border: 1px solid #374151;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eval-bar-row {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
}

.eval-bar-row:last-child {
  margin-bottom: 0;
}

.eval-bar-label {
  width: 120px;
  flex-shrink: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #d1d5db;
  text-align: right;
  padding-right: 14px;
  white-space: nowrap;
}

.eval-bar-track {
  flex: 1;
  height: 40px;
  background: #1f2937;
  border-radius: 8px;
  overflow: hidden;
}

.eval-bar-fill {
  height: 100%;
  border-radius: 8px;
  width: 0%;
}

.eval-bar-val {
  width: 56px;
  flex-shrink: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #e5e7eb;
  text-align: left;
  padding-left: 12px;
  font-variant-numeric: tabular-nums;
}

/* Mobile responsiveness for eval gallery */
@media screen and (max-width: 768px) {
  .eval-task-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .eval-spotlight {
    border-radius: 8px;
  }
  .eval-episode-grid {
    gap: 3px;
  }
  .eval-ep-cell {
    font-size: 0.55rem;
  }
  .eval-model-pill {
    padding: 6px 12px;
    font-size: 0.72rem;
  }
  .eval-bar-label {
    width: 80px;
    font-size: 0.72rem;
  }
  .eval-bar-track {
    height: 28px;
  }
}

@media screen and (max-width: 480px) {
  .eval-task-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ===== 8. Animated Bar Graph ===== */
/* ── Results pill toggles ── */
.results-pills {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.results-pill {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1.5px solid #e5e7eb;
  background: transparent;
  font-size: 0.85rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(.19,1,.22,1);
  font-family: 'Inter', sans-serif;
}

.results-pill:hover {
  border-color: #4f46e5;
  color: #4f46e5;
}

.results-pill.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}

/* ── D3 results chart ── */
.results-chart-wrap {
  position: relative;
  margin-bottom: 1rem;
}

.results-chart-wrap svg {
  overflow: visible;
}

.rc-x-axis text {
  font-size: 13px;
  font-weight: 600;
  fill: #6b7280;
  font-family: 'Inter', sans-serif;
}

.rc-bar {
  transition: opacity 0.2s;
}

.rc-tooltip {
  position: absolute;
  pointer-events: none;
  background: #1a1a1a;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  transform: translateX(-50%);
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: opacity 0.2s;
  z-index: 10;
}

/* ── Results legend ── */
.results-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
}

.results-legend__item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #6b7280;
  font-family: 'Inter', sans-serif;
}

.results-legend__color {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

/* ── D3 force graph styles ── */
.d3-graph-container .d3-node--dimmed { opacity: 0.08 !important; transition: opacity 0.3s; }
.d3-graph-container .d3-link--dimmed { stroke-opacity: 0.03 !important; transition: stroke-opacity 0.3s; }
.d3-graph-container .d3-link--highlight { stroke-opacity: 0.8 !important; stroke-width: 2.5 !important; stroke-dasharray: 6,3 !important; }

.d3-graph-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(10,10,10,0.92);
  color: #fff;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  transform: translateX(-50%);
  white-space: nowrap;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.d3-ripples circle { pointer-events: none; }

/* Mobile results */
@media screen and (max-width: 768px) {
  .results-chart-wrap svg {
    height: 280px;
  }
  .results-pill {
    padding: 6px 14px;
    font-size: 0.75rem;
  }
}


/* ============================================================ */
/* Sticky Navigation Bar                                         */
/* ============================================================ */
.page-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.page-nav__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 2rem;
}

.page-nav__logo {
  font-family: 'Instrument Serif', serif;
  font-size: 1.3rem;
  color: var(--wa-text-dark);
  text-decoration: none;
  font-weight: 400;
}

.page-nav__links {
  display: flex;
  gap: 1.5rem;
}

.page-nav__links a {
  color: #6b7280;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.page-nav__links a:hover,
.page-nav__links a.active {
  color: var(--wa-accent);
  border-bottom-color: var(--wa-accent);
}

.page-nav__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-nav__link {
  color: #6b7280;
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.2s;
}

.page-nav__link:hover {
  color: var(--wa-text-dark);
}

.page-nav__btn {
  background: var(--wa-accent);
  color: #fff;
  padding: 6px 18px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
}

.page-nav__btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  color: #fff;
}


/* ============================================================ */
/* Code Rain Effect (Act 2 Enhancement)                          */
/* ============================================================ */
/* ============================================================ */
/* Floating Statement (Act 2 problem text)                       */
/* ============================================================ */
.wa-floating-statement {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.wa-floating-statement__line {
  font-family: 'Instrument Serif', serif;
  font-size: 2.8rem;
  color: var(--wa-text-dark);
  text-align: center;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  font-weight: 400;
}

.wa-floating-statement__line--accent {
  color: var(--wa-accent);
  font-style: italic;
}

@media screen and (max-width: 768px) {
  .wa-floating-statement__line {
    font-size: 1.6rem;
  }
}


/* ============================================================ */
/* Task Preview Card (Act 2 right column)                        */
/* ============================================================ */
.wa-popup__col--preview {
  display: flex;
  flex-direction: column;
  justify-content: stretch;
}

.task-preview-card {
  background: var(--wa-dark);
  border-radius: 1rem;
  padding: 1.5rem;
  color: #e5e7eb;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.task-preview-card__images {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1rem;
}

.task-preview-card__img {
  flex: 1;
  text-align: center;
}

.task-preview-card__img img {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #374151;
}

.task-preview-card__badge {
  display: inline-block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.task-preview-card__title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 0.3rem;
}

.task-preview-card__desc {
  font-size: 0.85rem;
  color: #9ca3af;
  margin: 0 0 1rem;
}

.task-preview-card__img span {
  display: block;
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 4px;
}

.task-preview-card__arrow {
  font-size: 1.4rem;
  color: #6b7280;
  flex-shrink: 0;
}

.task-preview-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.task-preview-card__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.7rem 1rem;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 0.75rem;
}

.task-status__icon {
  color: #4ade80;
  font-size: 1.1rem;
  font-weight: 700;
}

.task-status__text {
  font-size: 0.85rem;
  color: #d1d5db;
  font-weight: 500;
}

@media screen and (max-width: 768px) {
  .task-preview-card__images {
    gap: 8px;
  }
  .task-preview-card__title {
    font-size: 1.1rem;
  }
}


.code-rain__char {
  color: transparent;
  transition: color 0.05s ease;
  font-family: 'Fira Code', 'Cascadia Code', 'JetBrains Mono', 'Source Code Pro', Consolas, monospace;
  font-size: 13px;
  font-variant-ligatures: contextual;
  -webkit-font-smoothing: antialiased;
}

.code-rain__char.revealed {
  color: #c9d1d9;
}

.code-rain__char.revealed.glow {
  color: #a5b4fc;
  text-shadow: 0 0 8px rgba(165, 180, 252, 0.6), 0 0 20px rgba(79, 70, 229, 0.3);
  transition: color 0.05s ease, text-shadow 0.3s ease;
}

/* Syntax token colors (Material Dark palette) — need .revealed for specificity */
.code-rain__char.revealed.code-rain__char--keyword { color: #c792ea; }
.code-rain__char.revealed.code-rain__char--string { color: #c3e88d; }
.code-rain__char.revealed.code-rain__char--comment { color: #546e7a; font-style: italic; }
.code-rain__char.revealed.code-rain__char--number { color: #f78c6c; }
.code-rain__char.revealed.code-rain__char--decorator { color: #ffcb6b; }
.code-rain__char.revealed.code-rain__char--builtin { color: #82aaff; }
.code-rain__char.revealed.code-rain__char--function { color: #82aaff; }
.code-rain__char.revealed.code-rain__char--classname { color: #ffcb6b; }

/* GPU compositing hint for scroll scenes with filter transitions */
.wa-scene { will-change: transform; }

.code-rain__cursor {
  color: #a5b4fc;
  animation: cursorBlink 0.8s step-end infinite;
  font-weight: 100;
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.code-rain__canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}


/* ============================================================ */
/* Key Stats Bar                                                  */
/* ============================================================ */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 3rem;
  flex-wrap: wrap;
}

.stats-bar__item {
  text-align: center;
  min-width: 140px;
}

.stats-bar__num {
  display: block;
  font-family: 'Instrument Serif', serif;
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--wa-accent);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stats-bar__label {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 0.4rem;
  font-weight: 500;
}

@media screen and (max-width: 768px) {
  .stats-bar {
    gap: 1.5rem;
  }
  .stats-bar__item {
    min-width: 100px;
  }
  .stats-bar__num {
    font-size: 2.2rem;
  }
  .stats-bar__label {
    font-size: 0.75rem;
  }
}


/* ============================================================ */
/* Validation Flow (vertical pipeline with input → stages → output) */
/* ============================================================ */
.vf {
  max-width: 720px;
  margin: 0 auto;
}

/* --- Input card --- */
.vf__input {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.vf__input-card {
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.25);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  max-width: 440px;
  width: 100%;
}

.vf__input-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #a5b4fc;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.vf__input-text {
  font-size: 1rem;
  color: #e5e7eb;
  font-style: italic;
  line-height: 1.5;
}

/* --- Stages (vertical timeline) --- */
.vf__stages {
  position: relative;
  padding-left: 44px;
}

.vf__stage {
  position: relative;
  display: flex;
  gap: 1rem;
  padding-bottom: 1.8rem;
  align-items: flex-start;
}

.vf__stage:last-child { padding-bottom: 0; }

/* Vertical connecting line */
.vf__stage-line {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(79, 70, 229, 0.2);
  transform: translateX(19px);
}

.vf__stage:last-child .vf__stage-line {
  display: none;
}

/* Node (circle icon) */
.vf__stage-node {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(79, 70, 229, 0.12);
  border: 2px solid rgba(79, 70, 229, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  transition: border-color 0.5s, background 0.5s, box-shadow 0.5s;
}

.vf__stage-icon {
  font-size: 0.95rem;
  color: #a5b4fc;
}

.vf__stage--active .vf__stage-node {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.1);
  box-shadow: 0 0 14px rgba(74, 222, 128, 0.25);
}

.vf__stage-node--warn {
  border-color: #fbbf24 !important;
  background: rgba(251, 191, 36, 0.1) !important;
}

.vf__stage--active .vf__stage-node--warn {
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.2);
}

/* Content */
.vf__stage-content {
  padding-top: 6px;
  min-width: 0;
}

.vf__stage-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e5e7eb;
  margin: 0 0 0.2rem;
}

.vf__stage-desc {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0 0 0.4rem;
  line-height: 1.4;
}

.vf__stage-status {
  font-size: 0.75rem;
  color: #4ade80;
  font-weight: 600;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 0.4s, transform 0.4s;
}

.vf__stage--active .vf__stage-status {
  opacity: 1;
  transform: translateX(0);
}

.vf__stage-status--warn {
  color: #fbbf24 !important;
}

.vf__check {
  margin-right: 4px;
}

.vf__warn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fbbf24;
  color: #111827;
  font-size: 0.6rem;
  font-weight: 800;
  margin-right: 4px;
}

/* Repair loop */
.vf__repair-loop {
  margin-top: 0.5rem;
  padding: 0.6rem 0.8rem;
  background: rgba(251, 191, 36, 0.06);
  border-left: 2px solid rgba(251, 191, 36, 0.3);
  border-radius: 0 6px 6px 0;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.4s 0.2s, transform 0.4s 0.2s;
}

.vf__stage--active .vf__repair-loop {
  opacity: 1;
  transform: translateY(0);
}

.vf__repair-label {
  font-size: 0.75rem;
  color: #d1d5db;
  margin-bottom: 0.3rem;
  font-style: italic;
}

.vf__repair-loop .vf__stage-status {
  opacity: 1;
  transform: none;
}

/* --- Output --- */
.vf__output {
  margin-top: 2rem;
  text-align: center;
}

.vf__output-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 20px;
  padding: 6px 20px;
  margin-bottom: 1.2rem;
}

.vf__output-video {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #374151;
  max-width: 640px;
  margin: 0 auto;
}

.vf__output-video video {
  width: 100%;
  display: block;
}

.vf__output-caption {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.6rem;
}

@media screen and (max-width: 768px) {
  .vf__stages {
    padding-left: 32px;
  }
  .vf__stage-node {
    width: 32px;
    height: 32px;
  }
  .vf__stage-line {
    transform: translateX(15px);
  }
  .vf__stage-icon {
    font-size: 0.8rem;
  }
  .vf__stage-title {
    font-size: 0.85rem;
  }
}


/* ============================================================ */
/* Q&A Accordion                                                  */
/* ============================================================ */
.qa-accordion {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.qa-item {
  border-bottom: 1px solid #e5e7eb;
}

.qa-item__question {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 1.2rem 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  color: var(--wa-text-dark);
  text-align: left;
  font-family: 'Inter', sans-serif;
  transition: color 0.2s;
}

.qa-item__question:hover {
  color: var(--wa-accent);
}

.qa-item__chevron {
  font-size: 1.4rem;
  color: #9ca3af;
  transition: transform 0.3s cubic-bezier(.19,1,.22,1);
  flex-shrink: 0;
  margin-left: 1rem;
}

.qa-item.open .qa-item__chevron {
  transform: rotate(45deg);
}

.qa-item__answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(.19,1,.22,1), padding 0.4s;
  padding: 0 0;
}

.qa-item.open .qa-item__answer {
  max-height: 300px;
  padding: 0 0 1.2rem 0;
}

.qa-item__answer p {
  color: #4b5563;
  line-height: 1.7;
}


/* ============================================================ */
/* Section Reveal (scroll entrance animations)                    */
/* ============================================================ */
.section-reveal {
  will-change: transform, opacity;
}


/* ============================================================ */
/* Placeholder card enhancement — show images with opacity        */
/* ============================================================ */
.sim-gallery-card.placeholder {
  opacity: 0.65;
  border-style: dashed;
  position: relative;
}

.sim-gallery-card.placeholder::after {
  content: 'Coming Soon';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 4px 0;
  text-align: center;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.sim-gallery-card.placeholder img {
  filter: grayscale(0.3);
}

.sim-gallery-card.placeholder span {
  display: none;
}

/* ── Mobile responsive: typing dots ── */
@media (max-width: 767px) {
  .typing-dots span {
    width: 5px;
    height: 5px;
  }
  .typing-dots {
    gap: 2px;
    padding: 3px 6px;
  }
}

/* ── Reduced motion: disable custom keyframe animations ── */
@media (prefers-reduced-motion: reduce) {
  .typing-dots span {
    animation: none;
    opacity: 0.6;
  }
  .code-rain__char.glow {
    text-shadow: none;
  }
}
