:root {
  --bg: #ffffff;
  --bg-alt: #f7f5fc;
  --text: #1c2430;
  --muted: #5d6b7a;
  --brand: #2e1065;
  --brand-2: #7c3aed;
  --accent: #c026d3;
  --line: #e7e2f3;
  --card: #ffffff;
  --shadow: 0 16px 40px rgba(46, 16, 101, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--brand-2); text-decoration: none; font-weight: 650; }
a:hover { text-decoration: underline; }

code {
  background: #f3effb;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.1rem 0.35rem;
}

pre {
  overflow-x: auto;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: inherit;
}

/* ==========================================
   Hero: pinned video chapter (modeled on roboracer.ai).
   The header is taller than the viewport; the stage sticks
   while scroll progress drives the reveal in main.js below.
   ========================================== */

.hero {
  position: relative;
  height: 320vh;
  background: #07070d;
  color: #f5f5fa;
}

.hero-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: 50% 50%;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: #07070d;
  opacity: 0.4;
  pointer-events: none;
}

.hero .nav, .hero-content, .scroll-hint { position: relative; z-index: 1; }
.hero .nav { width: 100%; max-width: none; padding: 1.4rem 2rem; }
.hero .nav-links { max-width: 100%; }

.nav { width: 100%; }

.nav {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.2rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  color: var(--brand);
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  font-size: 1.05rem;
}

.nav-links a {
  position: relative;
  color: #f5f5fa;
  font-weight: 600;
  transition: color 0.2s;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: -4px;
  height: 2px;
  background: linear-gradient(90deg, #00d1da, #fb00ff);
  transition: left 0.22s ease, right 0.22s ease;
}

.nav-links a:hover {
  color: #fff;
  text-decoration: none;
}

.nav-links a:hover::after { left: 0; right: 0; }

@media (prefers-reduced-motion: reduce) {
  .nav-links a, .nav-links a::after { transition: none; }
}
.hero .brand { color: #f5f5fa; font-size: 1.2rem; }

.hero-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 1rem 4rem;
  text-align: center;
}

.eyebrow {
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 850;
  font-size: 0.82rem;
}

h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(2.3rem, 6vw, 5rem);
  line-height: 1.04;
  letter-spacing: -0.06em;
}

.hero-title {
  margin: 0;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 4.8vw;
  line-height: 1.15;
  letter-spacing: -0.03em;
  white-space: nowrap;
  position: relative;
  color: #f5f5fa;
  transform-origin: 50% 50%;
}

/* Each word carries the same full-width gradient, offset by its
   position (set in JS), so the words read as one continuous sweep. */
.hero-unit {
  display: inline-block;
  padding: 0.12em 0;
  margin: -0.12em 0;
  background-image: linear-gradient(90deg, #00d1da 0%, #fb00ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.hero-desc {
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero .subtitle {
  margin: 0;
  max-width: 62ch;
  font-size: clamp(1.25rem, 1.9vw, 1.75rem);
  line-height: 1.55;
  color: rgba(245, 245, 250, 0.9);
}

.hero .button {
  font-size: 1.05rem;
  padding: 0.9rem 1.4rem;
  background: transparent;
  color: #f5f5fa;
  border-color: rgba(245, 245, 250, 0.5);
  box-shadow: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.hero .button.primary { background: #f5f5fa; color: #07070d; border-color: #f5f5fa; }

.hero .button:hover {
  background: #c400f0;
  border-color: #c400f0;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 2rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(245, 245, 250, 0.7);
}

.scroll-hint::after {
  content: "";
  width: 1px;
  height: 2.5rem;
  background: linear-gradient(#f5f5fa, transparent);
  animation: scroll-hint 1.8s ease-in-out infinite;
}

@keyframes scroll-hint {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform: scaleY(1); transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* Without the scroll script (or with reduced motion) the hero is a
   plain full-screen section with everything visible. */
.hero.static { height: auto; }
.hero.static .hero-stage { position: relative; }
.hero.static .hero-overlay { opacity: 0.75; }
.hero.static .scroll-hint { display: none; }

@media (max-width: 820px) {
  .section { padding-left: 1.25rem; padding-right: 1.25rem; }
  .section.alt { padding-left: 1.25rem; padding-right: 1.25rem; }
  .hero .nav { padding: 1rem 1.25rem; }
  .hero-title { font-size: 5vw; }
  .hero-desc { margin-top: 1.5rem; }
}

.subtitle {
  max-width: 780px;
  margin: 1.5rem auto 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
}

.button-row {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.82rem 1.1rem;
  border-radius: 10px;
  border: 1px solid var(--brand-2);
  color: var(--brand);
  background: #fff;
  box-shadow: 0 8px 20px rgba(46,16,101,0.08);
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.button::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.55) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
}

.button:hover::after { transform: translateX(120%); }

.button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(46,16,101,0.16);
}

.button.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

@media (prefers-reduced-motion: reduce) {
  .button, .button::after { transition: none; }
}

.note {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1.25rem;
}

.section {
  max-width: 1320px;
  margin: 0 auto;
  padding: 4.5rem 2rem;
}

.section.alt {
  max-width: none;
  background: var(--bg-alt);
  padding-left: max(2rem, calc((100vw - 1320px) / 2 + 2rem));
  padding-right: max(2rem, calc((100vw - 1320px) / 2 + 2rem));
}

h2 {
  position: relative;
  color: #000;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.04em;
  margin: 0 0 1.5rem;
  padding-bottom: 0.9rem;
}

h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, #00d1da 0%, #7c3aed 50%, #fb00ff 100%);
}

h3 { color: var(--brand); line-height: 1.25; margin-top: 0; }

.cards, .materials-grid {
  display: grid;
  gap: 1rem;
  margin-top: 1.75rem;
}

.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.materials-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card, .material {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 0 100%);
  padding: 1.35rem;
  box-shadow: 0 10px 30px rgba(46,16,101,0.06);
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.card::before, .material::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #00d1da 0%, #7c3aed 50%, #fb00ff 100%);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.card:hover, .material:hover {
  transform: translateY(-6px);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 20px 44px rgba(46,16,101,0.16);
}

.card:hover::before, .material:hover::before { transform: scaleX(1); }

@media (prefers-reduced-motion: reduce) {
  .card, .material { transition: none; }
}

.timeline {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.slot {
  position: relative;
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 1rem;
  align-items: start;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  padding: 1.25rem;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(.2,.8,.2,1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.slot::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00d1da 0%, #7c3aed 50%, #fb00ff 100%);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.slot:hover {
  transform: translateX(4px);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 14px 32px rgba(46,16,101,0.1);
}

.slot:hover::before { transform: scaleY(1); }

@media (prefers-reduced-motion: reduce) {
  .slot { transition: none; }
}

.step-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

.slot.break { background: #fdf4ff; border-color: rgba(192,38,211,0.28); }

.time {
  color: var(--accent);
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.9rem;
}

.details ul { margin-bottom: 0; padding-left: 1.25rem; }

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
}

.link-row a {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  background: #faf8fe;
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.link-row a:hover {
  border-color: var(--brand-2);
  background: #fff;
  transform: translateY(-1px);
  text-decoration: none;
}

.speaker {
  text-align: center;
}

.module h3 {
  text-align: center;
}

.speaker-photo {
  width: 180px;
  height: 180px;
  min-width: 180px;
  min-height: 180px;
  max-width: 180px;
  max-height: 180px;

  display: block;
  margin: 0 auto 1rem auto;

  object-fit: cover;
  object-position: center;

  border-radius: 50%;
  border: 4px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  margin: 0 auto 1rem;
  border: 2px solid #000;
  background: #fff;
  display: grid;
  place-items: center;
}

.avatar span {
  color: #000;
  font-weight: 850;
  font-size: 1.05rem;
}

.speaker-affiliation {
  font-size: 0.92rem;
  line-height: 1.45;
  color: #555;
  margin-top: 0.5rem;
}

.speaker h3 {
  margin-bottom: 0.6rem;
}

.resource-list { padding-left: 1.25rem; }

.badge-row { text-align: center; margin: 0.1rem 0 1rem; }

.module-gif {
  margin-top: 1.1rem;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  box-shadow: 0 10px 24px rgba(46, 16, 101, 0.14);
}

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

.speed-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  background: linear-gradient(100deg, #00d1da 0%, #7c3aed 55%, #fb00ff 100%);
  color: #fff;
  font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  padding: 0.34rem 1.1rem;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 10px 100%, 0 50%);
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
  animation: badge-pulse 2.6s ease-in-out infinite;
}

.speed-badge .bolt { width: 0.8em; height: 0.8em; }

@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35); transform: scale(1); }
  50% { box-shadow: 0 8px 22px rgba(124, 58, 237, 0.55); transform: scale(1.035); }
}

@media (prefers-reduced-motion: reduce) {
  .speed-badge { animation: none; }
}

.abstraction-description { font-size: 0.94rem; }

/* ==========================================
   Icons
   ========================================== */

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  vertical-align: -0.2em;
  flex: none;
}

.material-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.6rem;
}

.material-head h3 { margin: 0; }

.material-icon {
  width: 1.6em;
  height: 1.6em;
  font-size: 1.05rem;
  border-radius: 50%;
  background: #fff;
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--brand-2);
  flex: none;
}

.material-icon .icon { width: 0.95em; height: 0.95em; }

.material-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.material-list li a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem 0.55rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease, padding-left 0.18s ease;
}

.material-list li a::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, #00d1da, #fb00ff);
  transform: scaleY(0);
  transition: transform 0.18s ease;
}

.material-list li a:hover {
  border-color: var(--brand-2);
  text-decoration: none;
  transform: translateX(2px);
}

.material-list li a:hover::before { transform: scaleY(1); }

@media (prefers-reduced-motion: reduce) {
  .material-list li a, .material-list li a::before, .link-row a { transition: none; }
}

.material-list .link-icon { width: 1.25em; height: 1.25em; }

.step-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--brand-2);
  margin-bottom: 0.85rem;
}

.step-icon .icon { width: 22px; height: 22px; }

.cards.five { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.85rem; }

.cards.five .speaker-photo {
  width: 118px;
  height: 118px;
  min-width: 118px;
  min-height: 118px;
  max-width: 118px;
  max-height: 118px;
}

.cards.five .speaker-affiliation { font-size: 0.85rem; }

@media (max-width: 980px) {
  .cards.five { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}

@media (max-width: 600px) {
  .cards.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.cards.six { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.7rem; }

.cards.six .speaker-photo {
  width: 100px;
  height: 100px;
  min-width: 100px;
  min-height: 100px;
  max-width: 100px;
  max-height: 100px;
}

.cards.six .speaker-affiliation { font-size: 0.8rem; }

.cards.six .speaker h3 {
  font-size: 0.98rem;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .cards.six { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
}

@media (max-width: 600px) {
  .cards.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


.footer {
  border-top: 1px solid var(--line);
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  background: #fff;
}

/* ==========================================
   Graphical Abstract
   ========================================== */

.graphical-abstract {
    max-width: 610px;
    margin: 2rem auto 0 auto;
    text-align: center;
}

.graphical-abstract img {
    width: 100%;
    height: auto;
    display: block;

    /* optional */
    border-radius: 8px;

    /* remove card-like styling */
    padding: 0;
    background: transparent;
    box-shadow: none;
}

.legend-sampling {
    color: #8BC34A;
    font-weight: 600;
}

.legend-model {
    color: #B39DDB;
    font-weight: 600;
}

.legend-loss {
    color: #E57373;
    font-weight: 600;
}

.legend-prior {
    color: #64B5F6;
    font-weight: 600;
}

/* ==========================================
   Tutorial slide preview cards
   ========================================== */

.slide-card {
  display: block;
  color: var(--text);
}

.slide-card:hover { text-decoration: none; }

.slide-card h3 { margin: 0.85rem 0 0; }

.slide-thumb {
  position: relative;
  display: block;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #0b0b14;
  box-shadow: 0 10px 24px rgba(46, 16, 101, 0.18);
}

.slide-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.35s ease;
}

.slide-thumb-play {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  background: linear-gradient(0deg, rgba(11, 11, 20, 0.88) 0%, rgba(11, 11, 20, 0) 100%);
  transform: translateY(6px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.slide-thumb-play .icon { width: 1.1em; height: 1.1em; }

.slide-card:hover .slide-thumb img { transform: scale(1.04); }
.slide-card:hover .slide-thumb-play { transform: translateY(0); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .slide-thumb img, .slide-thumb-play { transition: none; }
}

@media (max-width: 820px) {
  .nav { align-items: flex-start; flex-direction: column; }
  .cards.three, .materials-grid { grid-template-columns: 1fr; }
  .slot { grid-template-columns: 1fr; }
}

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

.reveal-up {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-up.is-visible { opacity: 1; transform: translateY(0); }

.reveal { opacity: 0; transition: opacity 0.6s ease; }

.reveal.is-visible { opacity: 1; }

.cards.three .reveal:nth-child(2) { transition-delay: 0.08s; }
.cards.three .reveal:nth-child(3) { transition-delay: 0.16s; }
.materials-grid .reveal:nth-child(2) { transition-delay: 0.08s; }
.materials-grid .reveal:nth-child(3) { transition-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  .reveal-up, .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

