:root {
  --bg: #008e72;
  --ink: #1d1d1b;
  --fit: 1;
  --card: 560px;
  --font: "Source Sans Pro", "Source Sans 3", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: #fff;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

p, h2, h3 { margin: 0; }

/* ---------- Stage ---------- */

.story { position: relative; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* One full-size color layer per chapter; the next one wipes in in from the bottom over the previous. */
.bg-colors, .bg-color { position: absolute; inset: 0; }

/* Geometric overlay from the design (black shapes at low opacity), so it tints any chapter color. */
.bg-pattern {
  position: absolute;
  left: -13.03%;
  top: -19.55%;
  width: 126.14%;
  aspect-ratio: 1;
  pointer-events: none;
}
.bg-pattern img { display: block; width: 100%; height: 100%; }

/* ---------- Timeline (desktop: vertical on the left) ---------- */

.timeline {
  position: absolute;
  left: 34px;
  top: 34px;
  bottom: 34px;
  width: 0;
  z-index: 20;
  --p: 0;
}

.rail { position: absolute; inset: 0; }

.rail-dotted {
  position: absolute;
  left: -1px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .7) 0 2px, transparent 2px 5px);
}

.rail-fill {
  position: absolute;
  left: -2px;
  top: 0;
  width: 4px;
  height: calc(var(--p) * 100%);
  background: #fff;
}

.node {
  position: absolute;
  left: 0;
  top: calc(var(--t) * 100%);
  transform: translate(-50%, -50%);
}

.node-mark {
  display: block;
  background: #fff;
  transition: width .25s ease, height .25s ease;
}

.node--card .node-mark { width: 8px; height: 8px; }
.node--card.is-active .node-mark { width: 12px; height: 12px; }

.node--chapter .node-mark {
  width: 20px;
  height: 20px;
  border: 3px solid #fff;
  background: var(--fill, var(--bg));
  transition: background-color .5s ease;
}
.node--chapter.is-reached .node-mark { background: #fff; }

.node-label {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translate(-6px, -50%);
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  letter-spacing: .03em;
  font-feature-settings: "liga" 0;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
.node.is-active .node-label { opacity: 1; transform: translate(0, -50%); }

/* Chapter label sits next to the 20px square, so it starts a bit further out. */
.node--chapter .node-label { left: 34px; }

.caption { display: none; }

/* ---------- Intro slides ---------- */

.intros, .stacks { position: absolute; inset: 0; pointer-events: none; }

.intro {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(560px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  text-align: center;
}

.intro-inner { display: flex; flex-direction: column; align-items: center; }

.intro-icon { width: 96px; height: 96px; margin-bottom: 40px; }

.intro-eyebrow {
  font-weight: 700;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: .03em;
}

.intro-title {
  font-weight: 700;
  font-size: 48px;
  line-height: 1.2;
  letter-spacing: .6px;
  margin-top: 4px;
}

.intro-text {
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: .6px;
  margin-top: 16px;
}

/* ---------- Card stack ---------- */

.stack {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card);
  height: var(--card);
  transform: translate(-50%, -50%) scale(var(--fit));
}

.card {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .22));
  pointer-events: auto;
  will-change: transform;
}

.card-inner {
  position: relative;
  height: 100%;
  background: #fff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}

/* Chamfered corners (25 × 15 px cuts, as in Figma) are set per card in main.js via clip-path. */

.card-media { position: relative; height: 280px; flex: none; }
.card-img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Play button: solid 64px circle stays put, a halo pulses outwards behind it. */
.play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  isolation: isolate;
  transition: transform .25s ease;
}
.play:hover { transform: scale(1.12); }

.play svg { position: absolute; left: 28px; top: 24px; }

.play::before,
.play::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: var(--accent);
  animation: play-pulse 2.4s cubic-bezier(.2, .6, .35, 1) infinite;
}
.play::after { animation-delay: 1.2s; }

@keyframes play-pulse {
  from { transform: scale(1); opacity: .4; }
  to { transform: scale(1.9); opacity: 0; }
}

.play:focus-visible { outline: 2px solid #fff; outline-offset: 4px; }

.card-tag {
  position: absolute;
  left: 0;
  bottom: -5px; /* puts the text baseline on the image's bottom edge; the overhang merges into the white card */
  padding: 12px 24px 0 32px;
  background: #fff;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: .03em;
  white-space: nowrap;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 28px 32px 32px;
}

.card-title {
  font-weight: 700;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: .3px;
}

.card-text {
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: .03em;
  margin-top: 8px;
}

.card-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-date {
  color: var(--accent);
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: .03em;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  line-height: 1.45;
  letter-spacing: .03em;
  transition: filter .2s ease;
}
.card-link:hover { filter: brightness(1.12); }
.card-link img { width: 5px; height: 9px; opacity: .5; transition: opacity .2s ease; }
.card-link:hover img { opacity: 1; }

/* Darkens cards that sit further back in the stack. */
.card-shade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
}

/* ---------- Mobile: timeline becomes a progress bar at the top ---------- */

@media (max-width: 767px) {
  .timeline {
    left: 24px;
    right: 24px;
    top: 24px;
    bottom: auto;
    width: auto;
    height: 0;
  }

  .rail-dotted {
    left: 0;
    right: 0;
    top: -1px;
    bottom: auto;
    width: auto;
    height: 2px;
    background: repeating-linear-gradient(to right, rgba(255, 255, 255, .7) 0 2px, transparent 2px 5px);
  }

  .rail-fill {
    left: 0;
    top: -2px;
    height: 4px;
    width: calc(var(--p) * 100%);
  }

  .node { left: calc(var(--t) * 100%); top: 0; }
  .node--card .node-mark { width: 6px; height: 6px; }
  .node--card.is-active .node-mark { width: 10px; height: 10px; }
  .node--chapter .node-mark { width: 14px; height: 14px; border-width: 2px; }
  .node-label { display: none; }

  .caption {
    display: block;
    position: absolute;
    left: -8px;
    top: 18px;
    font-weight: 700;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: .03em;
    white-space: nowrap;
  }
  .caption span { opacity: .7; font-weight: 400; }

  /* Leave room for the progress bar. */
  .intros, .stacks { top: 56px; }

  .intro-icon { width: 64px; height: 64px; margin-bottom: 24px; }
  .intro-title { font-size: 32px; }
  .intro-text { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .node-mark, .node--chapter .node-mark, .node-label { transition: none; }
  .play::before { animation: none; transform: scale(1.5); opacity: .25; }
  .play::after { animation: none; opacity: 0; }
  .play { transition: none; }
}
