/* ============================================================
   STORY HERO — Stichting B.A.B.S.
   3-scroll cinematic cacao bean experience
   ============================================================ */

/* ---- Section: 4 viewports tall (opening + 3 scrolls) ---- */
.story {
  position: relative;
  height: 450vh;
}

.story__sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  clip-path: inset(0);
  overflow: hidden;
  background: #FFFAF4;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   AMBIENT BACKGROUND
   ============================================================ */
.story__ambient {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.story__ambient-circle {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.story__ambient-circle--1 {
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(200,134,10,0.055) 0%, transparent 68%);
  top: -20%; left: -14%;
  animation: ambDrift1 20s ease-in-out infinite;
}
.story__ambient-circle--2 {
  width: 560px; height: 560px;
  background: radial-gradient(circle, rgba(107,45,26,0.05) 0%, transparent 68%);
  bottom: -12%; right: -10%;
  animation: ambDrift2 26s ease-in-out infinite;
}

@keyframes ambDrift1 {
  0%,100% { transform: translate(0,0); }
  50%      { transform: translate(45px,-35px); }
}
@keyframes ambDrift2 {
  0%,100% { transform: translate(0,0); }
  50%      { transform: translate(-40px,-50px); }
}

.story__ambient-grain {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  background-size: 180px;
  opacity: 0.55;
  mix-blend-mode: multiply;
  pointer-events: none;
}

/* ============================================================
   3D CACAO BEAN — Three.js canvas
   ============================================================ */
.story__bean-stage {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.story__bean-canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.story__bean-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5;
  transition: opacity 0.6s;
}
.story__bean-loader.hidden { opacity: 0; pointer-events: none; }

.story__bean-loader-ring {
  width: 52px; height: 52px;
  border: 3px solid rgba(200,134,10,0.18);
  border-top-color: #C8860A;
  border-radius: 50%;
  animation: beanSpin 0.9s linear infinite;
}
@keyframes beanSpin { to { transform: rotate(360deg); } }

.story__bean-loader-pct {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #C8860A;
}


/* ============================================================
   STORY CHAPTERS
   ============================================================ */
.story__chapters {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

/* ============================================================
   CHAPTER 0 HERO — grote achtergrond typografie, achter de boon
   ============================================================ */
#chapter0 {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  padding: 0 !important;
  pointer-events: none;
}

#chapter0 .story__chapter-inner--ch0-bg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 0 clamp(20px, 4vw, 60px);
}

#chapter0 .story__ch0-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(5rem, 12vw, 14rem);
  font-weight: 600;
  line-height: 0.95;
  color: #1C0A05;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
  margin-bottom: clamp(14px, 2vh, 24px);
  white-space: nowrap;
}

#chapter0 .story__ch0-word { display: block; }
#chapter0 .story__ch0-word:not(.story__ch0-word--italic) {
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.75);
  paint-order: stroke fill;
}
#chapter0 .story__ch0-word--italic {
  font-style: italic;
  color: #C8860A;
}

#chapter0 .story__ch0-sub {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(92, 61, 40, 0.6);
  margin-bottom: 0;
}

#chapter0 .story__scroll-hint {
  position: absolute;
  bottom: clamp(28px, 5vh, 56px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

/* Chapters 1–3 (inside .story__chapters at z-index 4) */
.story__chapter {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 clamp(24px,6vw,80px);
  padding-top: var(--nav-h, 80px);
  opacity: 0;
  pointer-events: none;
}
.story__chapter.is-active { pointer-events: auto; }

/* ---- Layout variants ---- */
.story__chapter-inner {
  max-width: 480px;
  will-change: opacity, transform;
}

.story__chapter-inner--center {
  margin: 0 auto;
  text-align: center;
  /* push below the bean */
  align-self: flex-end;
  padding-bottom: clamp(48px, 8vh, 96px);
  width: 100%;
  max-width: 520px;
}

.story__chapter-inner--left {
  margin-right: auto;
}

.story__chapter-inner--right {
  margin-left: auto;
  text-align: right;
}

/* Chapter 0 — rechts naast de boon, verticaal gecentreerd */
.story__chapter-inner--ch0 {
  margin-left: auto;
  margin-right: clamp(24px, 6vw, 80px);
  text-align: right;
  align-self: center;
  max-width: 420px;
  padding-right: 0;
}

/* ---- Chapter label ---- */
.story__chapter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #C8860A;
  margin-bottom: 16px;
}
.story__chapter-inner--left  .story__chapter-label::before,
.story__chapter-inner--center .story__chapter-label::before {
  content: '';
  display: block;
  width: 20px; height: 1.5px;
  background: #C8860A;
}
.story__chapter-inner--right .story__chapter-label::after,
.story__chapter-inner--ch0  .story__chapter-label::after {
  content: '';
  display: block;
  width: 20px; height: 1.5px;
  background: #C8860A;
}

/* ---- Title ---- */
.story__chapter-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.9rem, 3.8vw, 3rem);
  font-weight: 600;
  color: #1C0A05;
  line-height: 1.17;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* Opening chapter larger */
#chapter0 .story__chapter-title {
  font-size: clamp(2.8rem, 6.5vw, 4.8rem);
  margin-bottom: 14px;
}

.story__word { display: block; }
.story__word--italic { font-style: italic; color: #C8860A; }

/* ---- Body ---- */
.story__chapter-body {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.88rem,1.4vw,1rem);
  line-height: 1.88;
  color: #5C3D28;
  margin-bottom: 24px;
}

#chapter0 .story__chapter-body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  color: #8B6A50;
  margin-bottom: 40px;
}

/* ---- Tag pill ---- */
.story__chapter-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #7A5A3A;
  padding: 7px 16px;
  border: 1px solid rgba(107,45,26,0.18);
  border-radius: 999px;
  background: rgba(245,230,210,0.55);
  backdrop-filter: blur(8px);
}

/* ---- CTA buttons (chapter 3) ---- */
.story__chapter-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.btn--story-primary {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  background: #1C0A05;
  color: white;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 28px rgba(28,10,5,0.22);
  transition: background 0.22s, transform 0.22s, box-shadow 0.22s;
}
.btn--story-primary svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn--story-primary:hover {
  background: #C8860A;
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(200,134,10,0.35);
}

.btn--story-ghost {
  display: inline-flex;
  align-items: center;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  background: transparent;
  color: #5C3D28;
  border: 1.5px solid rgba(107,45,26,0.25);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.22s;
}
.btn--story-ghost:hover {
  background: rgba(107,45,26,0.06);
  border-color: rgba(107,45,26,0.45);
  transform: translateY(-2px);
}

/* ============================================================
   SCROLL HINT (chapter 0)
   ============================================================ */
.story__scroll-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity 0.5s;
}
.story__scroll-hint.hidden { opacity: 0; pointer-events: none; }

.story__scroll-hint-mouse {
  width: 24px; height: 38px;
  border: 2px solid rgba(107,45,26,0.30);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}
.story__scroll-hint-wheel {
  width: 3px; height: 7px;
  background: #C8860A;
  border-radius: 3px;
  animation: wheelBob 2.2s ease-in-out infinite;
}
@keyframes wheelBob {
  0%        { transform: translateY(0); opacity: 1; }
  55%       { transform: translateY(10px); opacity: 0.15; }
  56%       { transform: translateY(0); opacity: 0; }
  58%       { opacity: 1; }
  100%      { transform: translateY(0); opacity: 1; }
}

.story__scroll-hint span {
  font-family: 'Inter', sans-serif;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #9B7A5E;
}

/* ============================================================
   PROGRESS BAR (right side)
   ============================================================ */
.story__progress {
  position: absolute;
  right: clamp(14px,3vw,40px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 10;
}

.story__progress-track {
  width: 2px;
  height: 100px;
  background: rgba(107,45,26,0.10);
  border-radius: 2px;
  overflow: hidden;
  order: -1;
}
.story__progress-fill {
  width: 100%;
  height: 0%;
  background: linear-gradient(to bottom, #C8860A, #E5A020);
  border-radius: 2px;
}

.story__progress-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.story__progress-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid rgba(107,45,26,0.28);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.28s, border-color 0.28s, transform 0.28s;
}
.story__progress-dot:hover   { transform: scale(1.35); border-color: #C8860A; }
.story__progress-dot.active  { background: #C8860A; border-color: #C8860A; transform: scale(1.25); }

/* ============================================================
   CHAPTER COUNTER (top-right)
   ============================================================ */
.story__counter {
  position: absolute;
  top: calc(var(--nav-h, 80px) + 18px);
  right: clamp(14px,3vw,40px);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.82rem;
  color: rgba(107,45,26,0.38);
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  letter-spacing: 0.06em;
}
.story__counter-sep { opacity: 0.45; }
#storyChapterNum {
  font-weight: 600;
  color: #C8860A;
  min-width: 18px;
  display: inline-block;
  text-align: center;
}

/* ============================================================
   CHAPTER 3 — groot, licht, in front van de boon
   ============================================================ */
#chapter3 {
  position: absolute !important;
  inset: 0 !important;
  z-index: 1 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  padding: 0 !important;
  pointer-events: none;
}

.story__ch3-bg {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  padding: 0 clamp(20px, 4vw, 60px);
  mix-blend-mode: multiply;
}

.story__ch3-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(5rem, 12vw, 14rem);
  font-weight: 600;
  line-height: 0.95;
  color: #1C0A05;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05em;
  margin-bottom: clamp(14px, 2vh, 24px);
  white-space: nowrap;
}

.story__ch3-word { display: block; }
.story__ch3-word:not(.story__ch3-word--italic) {
  -webkit-text-stroke: 1.5px rgba(255, 255, 255, 0.75);
  paint-order: stroke fill;
}
.story__ch3-word--italic {
  font-style: italic;
  color: #C8860A;
  letter-spacing: 0.04em;
}

.story__ch3-sub {
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.65rem, 1vw, 0.85rem);
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(92,61,40,0.6);
  max-width: 500px;
  line-height: 1.8;
  margin: 0;
}

/* ============================================================
   EXIT FADE (smooth transition to rest of page)
   ============================================================ */
.story__exit-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 220px;
  background: linear-gradient(to bottom, transparent 0%, #FFFAF4 100%);
  pointer-events: none;
  z-index: 20;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 899px) {
  .story { height: 500vh; }

  .story__chapter {
    padding-left: 24px;
    padding-right: 24px;
  }

  .story__chapter-inner--left,
  .story__chapter-inner--right {
    margin: 0 auto;
    text-align: center;
    max-width: 92vw;
  }
  .story__chapter-inner--right .story__chapter-label::after { display: none; }
  .story__chapter-inner--right .story__chapter-label::before {
    content: '';
    display: block;
    width: 20px; height: 1.5px;
    background: #C8860A;
  }

  .story__chapter-title { font-size: clamp(1.7rem,7vw,2.6rem); }
  #chapter0 .story__chapter-title { font-size: clamp(2.2rem,9vw,3.4rem); }

  .story__counter { right: 12px; }
  .story__progress { right: 8px; }
}

@media (max-width: 480px) {
  .story { height: 550vh; }
  .story__progress-track { height: 70px; }
  .story__counter { display: none; }

  /* Chapters 1–2: tekst panel onderaan, boon zichtbaar erboven */
  .story__chapter {
    padding-left: 16px;
    padding-right: 16px;
    align-items: flex-end;
    padding-bottom: 28px;
  }
  .story__chapter-inner {
    background: rgba(255, 250, 244, 0.93);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-radius: 18px;
    padding: 20px 22px 18px;
    border: 1px solid rgba(200, 134, 10, 0.14);
    max-width: 100%;
    width: 100%;
    text-align: left !important;
    margin: 0 !important;
  }
  .story__chapter-title { font-size: clamp(1.4rem, 6vw, 2rem); }
  .story__chapter-body { font-size: 0.88rem; }
  .story__chapter-body p { font-size: 0.88rem; }
  .story__chapter-label { margin-bottom: 10px; }

  /* Achtergrond-tekst hoofdstukken (0 en 3): iets kleiner */
  #chapter0 .story__ch0-title,
  .story__ch3-title {
    font-size: clamp(3rem, 14vw, 5.5rem);
    white-space: normal;
    text-align: center;
  }
  #chapter0 .story__ch0-sub,
  .story__ch3-sub {
    font-size: 0.6rem;
    letter-spacing: 0.2em;
  }
}
