:root {
  --choc-dark: #241209;
  --choc-mid: #4a2410;
  --choc-warm: #8a4a1f;
  --choc-gold: #d9a54a;
  --cream: #f7ecd9;
  --black: #050302;
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--black);
  color: var(--cream);
  scroll-behavior: smooth;
}

section { position: relative; }

.btn {
  font-family: inherit;
  font-size: 1.05rem;
  padding: 0.9rem 2rem;
  border-radius: 999px;
  border: 2px solid var(--choc-gold);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.btn--primary {
  background: var(--choc-gold);
  color: var(--choc-dark);
}
.btn--primary:hover { transform: translateY(-2px); background: #eec06a; }
.btn--ghost {
  background: transparent;
  color: var(--cream);
}
.btn--ghost:hover { transform: translateY(-2px); background: rgba(217,165,74,0.15); }

/* ===================== PROGRESS RAIL ===================== */
.progress-rail {
  position: fixed;
  top: 0;
  right: 1.75rem;
  height: 100vh;
  display: flex;
  align-items: center;
  z-index: 500;
  transition: opacity 0.3s ease;
}
/* While actively dragging the chocolate piece, get out of the way a
   little so it never visually competes with the drop target. */
.progress-rail.is-dimmed { opacity: 0.3; }
.progress-rail__line {
  /* Spans the full height so it visually touches both the first stop
     (לחץ) and the last (המסקנה) — previously it stopped short (12%-88%)
     while the dots themselves (via justify-content:space-between) reached
     all the way to the edges, leaving the top/bottom stops looking
     disconnected from the line. */
  position: absolute;
  right: 5px;
  top: 0;
  height: 100%;
  width: 2px;
  background: rgba(247,236,217,0.15);
}
.progress-rail__fill {
  width: 100%;
  height: 0%;
  background: var(--choc-gold);
  transition: height 0.35s ease;
}
.progress-rail__stops {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  position: relative;
}
.stop {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
}
.stop__dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: transparent;
  border: 2px solid rgba(247,236,217,0.35);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
}
/* visited: a chapter already told — filled, so the rail reads at a glance
   how much of the story has passed (○ upcoming vs ● told). */
.stop.visited .stop__dot {
  background: rgba(217,165,74,0.55);
  border-color: rgba(217,165,74,0.55);
}
.stop.active .stop__dot {
  background: var(--choc-gold);
  border-color: var(--cream);
  transform: scale(1.35);
}
.stop__label {
  font-size: 0.78rem;
  opacity: 0.55;
  white-space: nowrap;
  transition: opacity 0.3s ease, color 0.3s ease;
}
.stop.active .stop__label { opacity: 1; color: var(--choc-gold); font-weight: 600; }

.stop__tooltip {
  position: absolute;
  right: 26px;
  top: 50%;
  transform: translateY(-50%) translateX(6px);
  background: var(--choc-dark);
  color: var(--cream);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.stop__dot:hover .stop__tooltip {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

@media (max-width: 860px) {
  .progress-rail {
    top: auto;
    bottom: 0.75rem;
    right: 50%;
    transform: translateX(50%);
    height: auto;
    width: 92%;
  }
  .progress-rail__line { display: none; }
  .progress-rail__stops {
    flex-direction: row;
    background: rgba(5,3,2,0.65);
    backdrop-filter: blur(6px);
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
  }
  .stop { flex-direction: column; gap: 0.25rem; }
  .stop__label { font-size: 0.62rem; }
  .stop__tooltip { display: none; }
}

/* ===================== VIDEO STAGE (SECTIONS 1-4) ===================== */
/* One pinned 16:9 "screen" (like a 1920x1080 frame); the 4 videos sit
   stacked as layers on top of each other and scrolling through the tall
   wrapper below crossfades which layer is visible. */
.video-stage-wrap {
  position: relative;
  height: 800vh; /* 4 chapters of scroll-scrubbed video, ~200vh each */
  background: var(--black);
}
.video-stage-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--black);
}
.video-stage {
  position: relative;
  background: var(--black);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0,0,0,0.6);
}
.stage-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 0;
  /* opacity + which frame is drawn are set per-frame from JS, in lockstep
     with scroll position — no CSS transition, so there is zero lag between
     the scrollbar and the picture (this is the scroll-scrubbed timeline).
     All 4 canvases stay mounted for the entire cinematic experience;
     only their opacity ever changes. */
}

.stage-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5,3,2,0.85) 0%, rgba(5,3,2,0.15) 45%, rgba(5,3,2,0.5) 100%);
  z-index: 2;
}

.stage-text {
  position: absolute;
  left: 50%;
  bottom: 14%;
  width: 90%;
  max-width: 760px;
  z-index: 3;
  text-align: center;
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--cream);
  text-shadow: 0 4px 28px rgba(0,0,0,0.75);
  opacity: 0;
  pointer-events: none;
  /* transform/opacity set per-frame from JS, one sentence at a time, in
     lockstep with scroll position — see .stage-canvas note above. No
     card, no box, no border: just type, held by negative space. */
}

@media (max-width: 600px) {
  .stage-text { width: 88%; bottom: 11%; font-size: 1.3rem; }
}

/* ===================== SECTION 5 — BLACK SCREEN / CHOCOLATE BAR ===================== */
/* Tall wrapper (extra scroll room) + sticky 100vh pin — identical
   structure to the video stage above. The extra height isn't arbitrary:
   it's scroll budget for (1) settling into the fully-framed puzzle,
   (2) unhurried time to notice + attempt the drag, (3) the post-solve
   caption beats, before the pin naturally releases into the quiz. This
   guarantees the puzzle is ALWAYS fully visible and centered — never
   half-scrolled into an awkward position — for as long as the user is
   anywhere within this section. */
.black-section {
  position: relative;
  height: 220vh;
  background: var(--black);
}
.black-section__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--black);
}
.black-section__inner {
  text-align: center;
  position: relative;
  width: 100%;
}
.black-section__inner h2 {
  font-size: 2.4rem;
  margin: 0 0 0.5rem;
}
.black-section__inner h3 {
  font-size: 1.3rem;
  font-weight: 400;
  opacity: 0.85;
  margin: 0 0 3rem;
}

.reveal-line {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.reveal-line.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== chocolate bar puzzle ===== */
.choco-stage {
  --piece: 84px;
  --gap: 4px;
  position: relative;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.choco-bar {
  display: grid;
  grid-template-columns: repeat(4, var(--piece));
  grid-template-rows: repeat(2, var(--piece));
  gap: var(--gap);
  padding: 10px;
  border-radius: 10px;
  background: linear-gradient(145deg, #1c0f07, #0d0603);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: box-shadow 0.6s ease;
}
.choco-bar.is-solved {
  animation: bar-glow 1.1s ease;
}

.choco-cell {
  width: var(--piece);
  height: var(--piece);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 35%),
    linear-gradient(135deg, var(--choc-warm), var(--choc-mid) 70%);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,0.15),
    inset 0 -3px 4px rgba(0,0,0,0.5),
    0 1px 0 rgba(0,0,0,0.4);
}

.choco-slot {
  width: var(--piece);
  height: var(--piece);
  border-radius: 4px;
  background: linear-gradient(145deg, #150b05, #050301);
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.85), inset 0 0 0 1px rgba(217,165,74,0.18);
  animation: slot-breathe 3.2s ease-in-out infinite;
}
.choco-slot.is-target-active {
  animation: none;
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.85), inset 0 0 0 2px rgba(217,165,74,0.6);
}

@keyframes slot-breathe {
  0%, 100% { box-shadow: inset 0 4px 8px rgba(0,0,0,0.85), inset 0 0 0 1px rgba(217,165,74,0.16); }
  50% { box-shadow: inset 0 4px 8px rgba(0,0,0,0.85), inset 0 0 0 1px rgba(217,165,74,0.4); }
}

.choco-piece {
  position: absolute;
  width: var(--piece);
  height: var(--piece);
  border-radius: 4px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 35%),
    linear-gradient(135deg, var(--choc-warm), var(--choc-mid) 70%);
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,0.18),
    inset 0 -3px 4px rgba(0,0,0,0.5),
    0 10px 18px rgba(0,0,0,0.5);
  /* rest position: just outside the bar, bottom-right */
  top: calc(50% + var(--piece) * 0.45);
  left: calc(50% + var(--piece) * 2.4);
  cursor: grab;
  touch-action: none;
  transition: transform 0.4s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s ease, left 0.4s ease, top 0.4s ease;
}
.choco-piece:focus-visible {
  outline: 2px solid var(--choc-gold);
  outline-offset: 3px;
}
.choco-piece.dragging {
  cursor: grabbing;
  transition: box-shadow 0.2s ease;
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,0.18),
    inset 0 -3px 4px rgba(0,0,0,0.5),
    0 22px 34px rgba(0,0,0,0.65);
  z-index: 5;
}
.choco-piece.placed {
  box-shadow:
    inset 0 2px 2px rgba(255,255,255,0.15),
    inset 0 -3px 4px rgba(0,0,0,0.5),
    0 1px 0 rgba(0,0,0,0.4);
}

@keyframes bar-glow {
  0%, 100% { box-shadow: 0 20px 50px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.04); }
  40% { box-shadow: 0 20px 50px rgba(0,0,0,0.6), 0 0 40px rgba(217,165,74,0.55), inset 0 1px 0 rgba(255,255,255,0.08); }
}

.choco-story-text {
  position: absolute;
  bottom: -4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 90vw;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--cream);
  text-shadow: 0 2px 16px rgba(0,0,0,0.6);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.choco-story-text.is-visible { opacity: 0.95; }

@media (max-width: 600px) {
  .choco-story-text { font-size: 1.15rem; bottom: -3.2rem; }
}

@media (max-width: 600px) {
  .choco-stage { --piece: 62px; height: 220px; }
}

/* ===================== SECTION 6 — QUIZ ===================== */
.quiz-section {
  min-height: 100vh;
  background: linear-gradient(180deg, var(--black) 0%, var(--choc-dark) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.quiz-intro {
  text-align: center;
  max-width: 480px;
}
.quiz-intro h2 { font-size: 2rem; margin-bottom: 1rem; }
.quiz-intro p { opacity: 0.85; line-height: 1.7; margin-bottom: 2rem; }

.quiz-flow {
  width: 100%;
  max-width: 560px;
}
.quiz-progress { margin-bottom: 2rem; }
.quiz-progress__text { font-size: 0.9rem; opacity: 0.75; }
.quiz-progress__bar {
  margin-top: 0.6rem;
  height: 4px;
  border-radius: 4px;
  background: rgba(247,236,217,0.15);
  overflow: hidden;
}
.quiz-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--choc-gold);
  transition: width 0.4s ease;
}

.quiz-cards { position: relative; min-height: 260px; }
.quiz-card {
  display: none;
  animation: card-in 0.5s ease;
}
.quiz-card.active { display: block; }
@keyframes card-in {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}
.quiz-card h3 { font-size: 1.35rem; margin-bottom: 1.5rem; line-height: 1.5; }
.quiz-card__options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.quiz-option {
  text-align: right;
  font-family: inherit;
  font-size: 1rem;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  border: 1.5px solid rgba(247,236,217,0.25);
  background: rgba(247,236,217,0.04);
  color: var(--cream);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}
.quiz-option:hover { border-color: var(--choc-gold); background: rgba(217,165,74,0.1); }
.quiz-option.selected { border-color: var(--choc-gold); background: rgba(217,165,74,0.2); transform: translateX(-4px); }

/* ===================== SECTION 7 — RESULT ===================== */
.result-section {
  min-height: 100vh;
  background: var(--choc-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.result-section__inner { max-width: 560px; text-align: center; }
.result-section__inner h2 { font-size: 1.1rem; opacity: 0.6; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 1.5rem; }
.result-section__inner h3 { font-size: 1.7rem; line-height: 1.5; margin-bottom: 1.25rem; }
.result-section__inner p { opacity: 0.85; line-height: 1.7; margin-bottom: 2rem; }

/* ===================== SECTION 8 — ENDING ===================== */
.ending-section {
  min-height: 100vh;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.ending-section__inner { max-width: 680px; text-align: center; }
.ending-section__inner p {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0 0 0.5rem;
}
.ending-section__actions {
  margin-top: 2.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .ending-section__inner p { font-size: 1.4rem; }
}

/* ===================== FOOTER ===================== */
.site-footer {
  background: var(--black);
  border-top: 1px solid rgba(247,236,217,0.1);
  padding: 2.5rem 1.5rem 6rem;
  text-align: center;
}
.site-footer__links {
  display: flex;
  gap: 1.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.site-footer__links a {
  color: var(--cream);
  opacity: 0.7;
  text-decoration: none;
  font-size: 0.9rem;
}
.site-footer__links a:hover { opacity: 1; color: var(--choc-gold); }
.site-footer__tagline { font-size: 0.8rem; opacity: 0.45; }

@media (max-width: 860px) {
  .site-footer { padding-bottom: 5.5rem; }
}

/* ===================== REDUCED MOTION ===================== */
/* The scroll-scrubbed cinematic itself is left alone: it only ever moves
   in direct 1:1 response to the user's own scroll input (never on its
   own), which isn't the kind of motion these settings are meant to
   suppress. What we do turn off/shorten here is everything that animates
   on its own: reveal fades, the slot's idle "breathing" glow, the solved
   bar's glow pulse, and native smooth-scroll easing on nav/anchor jumps. */
@media (prefers-reduced-motion: reduce) {
  html, body { scroll-behavior: auto; }

  .reveal-line {
    transition: opacity 0.15s linear;
    transform: none;
  }
  .reveal-line.is-visible { transform: none; }

  .choco-slot { animation: none; }
  .choco-bar.is-solved { animation: none; }
  .choco-piece { transition: box-shadow 0.15s linear; }
  .choco-story-text { transition: opacity 0.15s linear; }

  .stop__dot, .stop__label, .progress-rail__fill {
    transition-duration: 0.01ms;
  }
}
