/* =====================================================
   SECTION STORY — Scroll-driven 6-phase narrative
   Sticky inner viewport, scrub-driven phase transitions.
   ===================================================== */

.story {
  position: relative;
  background: var(--story-bg, #F4ECDD);
  /* 5 phases × 110vh each + runway. Less than the old 680vh since
     Teruji & Tersertifikasi phase was removed. */
  height: calc(560vh);
  color: var(--ink);
  overflow: clip;
  isolation: isolate;
  transition: background-color 0.18s linear;
}

.story-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}

/* ─── Wave dividers — organic transitions to neighbour sections ─── */
.story-divider {
  position: absolute;
  left: 0; right: 0;
  width: 100%;
  height: 90px;
  pointer-events: none;
  color: var(--story-bg, #F4ECDD);   /* svg fills with currentColor */
  z-index: 4;
  display: block;
}
.story-divider svg { width: 100%; height: 100%; display: block; }
.story-divider-top    { top: 0; transform: rotate(180deg); }
.story-divider-bottom { bottom: 0; }

@media (max-width: 760px) {
  .story-divider { height: 56px; }
}

/* ─── Photo + Text alternating rows (phases 1-3) ─────────────── */
.story-row {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(40px, 6vw, 96px);
  align-items: center;
  padding: clamp(80px, 10vh, 120px) clamp(28px, 6vw, 96px);
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 2;
}
.story-row-left .story-row-img  { order: 1; }
.story-row-left .story-row-text { order: 2; }
.story-row-right .story-row-img  { order: 2; }
.story-row-right .story-row-text { order: 1; }

.story-row-img {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 4 / 5;
  border-radius: 28px;
  overflow: hidden;
  margin-inline: auto;
  box-shadow:
    0 30px 60px -28px rgba(31,22,18,0.40),
    0 8px 18px -10px rgba(31,22,18,0.18),
    0 0 0 1px rgba(31,22,18,0.04);
  background: rgba(31,22,18,0.06);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.story-row-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-row-img-tag {
  position: absolute;
  top: 16px; left: 16px;
  display: inline-flex; align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(31,22,18,0.08);
}

.story-row-text {
  position: relative;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 2vw, 24px);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}
.story-row-kicker {
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange-deep);
  font-family: ui-monospace, 'JetBrains Mono', monospace;
}
.story-row-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 132px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}
.story-row-title em {
  font-style: italic;
  color: var(--orange-deep);
}
.story-row-body {
  font-size: clamp(15px, 1.2vw, 18px);
  line-height: 1.55;
  color: var(--ink-mute);
  margin: 0;
  max-width: 44ch;
  text-wrap: pretty;
}

@media (max-width: 760px) {
  .story-row {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 80px 24px 60px;
    align-content: start;
    overflow-y: auto;
    /* On phones we stack image-on-top regardless of "side" */
  }
  .story-row-left .story-row-img,
  .story-row-right .story-row-img { order: 1; }
  .story-row-left .story-row-text,
  .story-row-right .story-row-text { order: 2; }
  .story-row-img { max-width: 260px; aspect-ratio: 4/5; border-radius: 22px; }
  .story-row-title { font-size: clamp(40px, 13vw, 64px); }
}

/* ─── Phase 4-6 finale: shared photo + 3 swapping text blocks ── */
.story-finale {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
.story-finale > * { pointer-events: auto; }

.story-cert-img {
  position: absolute;
  /* Bigger, anchored to the bottom so the woman "pops up" from the
     bottom edge — like the photo is standing in the section. */
  width: clamp(420px, 52vw, 760px);
  height: clamp(560px, 70vw, 960px);
  transition: top 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              left 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 3;
  will-change: transform, left, top;
  /* Anchor from the bottom so scaling keeps the feet planted */
  transform-origin: 50% 100%;
}
.story-cert-img img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  display: block;
  z-index: 2;
  filter: drop-shadow(0 30px 50px rgba(31,22,18,0.18));
}
.story-cert-halo {
  position: absolute;
  top: 50%; left: 50%;
  width: 110%; height: 90%;
  transform: translate(-50%, -45%);
  background: radial-gradient(closest-side, rgba(232,93,26,0.18), rgba(232,93,26,0));
  filter: blur(24px);
  z-index: 1;
  pointer-events: none;
}

/* ─── Phase 3 overlay: "Teruji & Tersertifikasi" ───────────────
   Sit on the LEFT (vertically middle). The bottom-anchored woman
   photo lives center-bottom so left-middle text leaves her face
   visible while still feeling overlapped/integrated. */
.story-cert-overlay {
  position: absolute;
  top: 50%; left: clamp(28px, 6vw, 96px);
  transform: translateY(-50%);
  text-align: left;
  z-index: 4;
  pointer-events: none;
  width: min(48%, 520px);
  transition: opacity 0.5s ease;
}
.story-cert-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(6px);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-family: ui-monospace, monospace;
  border: 1px solid rgba(31,22,18,0.08);
  margin-bottom: 18px;
}
.story-cert-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--orange);
  animation: story-pulse 1.6s ease-in-out infinite;
}
@keyframes story-pulse {
  0%, 100% { transform: scale(1);   opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}
.story-cert-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(48px, 8vw, 120px);
  line-height: 0.95;
  letter-spacing: -0.04em;
  color: var(--ink);
  margin: 0 0 24px;
  text-shadow: 0 2px 10px rgba(244,236,221,0.7);
}
.story-cert-title em { font-style: italic; color: var(--orange-deep); }
.story-cert-stamps {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-start;
}
.story-cert-stamp {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* ─── Phase 6: rotating certification seals overlay the photo ────
   Three "deal sticker" badges with curved text that spin slowly,
   positioned over the woman photo on the left side of the screen.
   Each seal sets --spin (duration) and --dir (normal/reverse) so
   neighbouring seals rotate against each other for visual rhythm. */
.story-seals {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.story-seal {
  position: absolute;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 10px 20px rgba(31,22,18,0.22));
  --spin: 12s;
  --dir: normal;
}
.story-seal-svg {
  width: 100%;
  height: 100%;
  animation: story-seal-spin var(--spin) linear infinite;
  animation-direction: var(--dir);
}
@keyframes story-seal-spin {
  from { transform: rotate(0deg);   }
  to   { transform: rotate(360deg); }
}
.story-seal-core {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  text-align: center;
}
.story-seal-main {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 400;
}
.story-seal-sub {
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  font-family: ui-monospace, 'JetBrains Mono', monospace;
  opacity: 0.85;
}
@media (max-width: 760px) {
  .story-seal { transform: scale(0.7); }
}

/* ─── Phase 5: "Yojea" brand word + tagline. RIGHT-positioned column;
   text inside is LEFT-aligned so it shares the same left edge as the
   "Bingung beli Yojea di mana?" block in the bottom-right. */
.story-brand-block {
  position: absolute;
  top: 50%; right: clamp(28px, 6vw, 96px);
  transform: translateY(-50%);
  text-align: left;
  width: min(46%, 540px);
  z-index: 4;
  transition: opacity 0.5s ease,
              top 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              right 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.story-brand-block.is-shifted {
  /* Phase 6 — same size, just moved to TOP-RIGHT. Sits closer to the
     buy block below so the right column reads as a single tight unit. */
  top: clamp(56px, 14vh, 140px);
  transform: translateY(0);
}
.story-brand-word {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(96px, 14vw, 200px);
  line-height: 0.88;
  letter-spacing: -0.05em;
  color: var(--orange-deep);
  margin: 0 0 14px;
  text-shadow: 0 4px 18px rgba(244,236,221,0.6);
}
.story-brand-desc {
  font-family: var(--serif);
  font-size: clamp(20px, 1.9vw, 28px);
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
  font-weight: 400;
}
.story-brand-desc em { font-style: italic; color: var(--orange-deep); }

/* ─── Phase 6: "Bingung Beli Yojea Dimana?" + buy channels.
   Sits in the right column directly under the Yojea brand headline.
   Vertical gap intentionally tight so the two blocks read as one unit. */
.story-buy {
  position: absolute;
  bottom: clamp(60px, 10vh, 120px);
  right: clamp(28px, 6vw, 96px);
  top: auto;
  transform: none;
  width: min(46%, 540px);
  z-index: 4;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: clamp(10px, 1.2vw, 16px);
  text-align: left;
}
.story-buy-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange-deep);
  font-family: ui-monospace, monospace;
}
.story-buy-line {
  width: 28px; height: 1px;
  background: var(--orange-deep);
}
.story-buy-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 72px);
  line-height: 1.0;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin: 0;
}
.story-buy-title em { font-style: italic; color: var(--orange-deep); }
.story-buy-sub {
  font-size: clamp(14px, 1.05vw, 17px);
  line-height: 1.55;
  color: var(--ink-mute);
  margin: 0;
  max-width: 42ch;
}
.story-buy-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}
.story-buy-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  border: 1px solid rgba(31,22,18,0.07);
  box-shadow: 0 6px 18px -10px rgba(31,22,18,0.20);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}
.story-buy-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--ch-color);
  opacity: 0;
  transition: opacity 0.25s ease;
  z-index: 0;
}
.story-buy-card > * { position: relative; z-index: 1; }
.story-buy-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px -14px rgba(31,22,18,0.32);
  color: #fff;
}
.story-buy-card:hover::before { opacity: 1; }

.story-buy-card-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: var(--ch-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.25s ease, color 0.25s ease;
}
.story-buy-card:hover .story-buy-card-icon {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.story-buy-card-icon svg { width: 20px; height: 20px; }
.story-buy-card-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.story-buy-card-label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: inherit;
}
.story-buy-card-sub {
  font-size: 11.5px;
  color: var(--ink-mute);
  font-weight: 500;
  transition: color 0.25s ease;
}
.story-buy-card:hover .story-buy-card-sub { color: rgba(255,255,255,0.85); }
.story-buy-card-arrow {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(31,22,18,0.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--ink);
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}
.story-buy-card:hover .story-buy-card-arrow {
  background: rgba(255,255,255,0.20);
  color: #fff;
  transform: translateX(3px);
}
.story-buy-card-arrow svg { width: 12px; height: 12px; }

/* ─── Featured "Web Yojea" card — full-width, animated, catchy ─── */
.story-buy-card--featured {
  background: linear-gradient(115deg, #C8612B 0%, #E08A3C 48%, #C8612B 100%);
  border: 1px solid rgba(200,97,43,0.5);
  color: #fff;
  box-shadow: 0 14px 30px -12px rgba(200,97,43,0.5);
  padding-bottom: 30px;            /* room for marquee strip */
  animation: storyBuyPulse 2.6s ease-in-out infinite;
}
.story-buy-card--featured::before { display: none; }
.story-buy-card--featured:hover {
  transform: translateY(-3px);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.25),
              0 18px 40px -10px rgba(224,138,60,0.85),
              0 0 34px rgba(224,138,60,0.6);
}
.story-buy-card--featured .story-buy-card-icon {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.story-buy-card--featured .story-buy-card-sub {
  color: rgba(255,255,255,0.92);
  font-weight: 600;
}
.story-buy-card--featured .story-buy-card-arrow {
  background: rgba(255,255,255,0.22);
  color: #fff;
}
.story-buy-card--featured:hover .story-buy-card-arrow { transform: translateX(3px); }

/* Yellow glow that travels around the border on hover.
   A masked conic-gradient ring (only the 2px border shows) whose bright
   arc rotates via an animated --story-angle custom property. */
@property --story-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.story-buy-card--featured::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 2px;
  background: conic-gradient(
    from var(--story-angle),
    transparent 0deg,
    transparent 210deg,
    rgba(255,236,150,0.0) 235deg,
    #FFE680 280deg,
    #FFF8CC 300deg,
    #FFE680 320deg,
    transparent 348deg,
    transparent 360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
          mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  z-index: 4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}
.story-buy-card--featured:hover::after {
  opacity: 1;
  filter: drop-shadow(0 0 5px rgba(255,228,120,0.95));
  animation: storyBuyRotate 1.8s linear infinite;
}
@keyframes storyBuyRotate {
  to { --story-angle: 360deg; }
}

/* On hover the icon/text/arrow glide to the right to make room for the
   reveal message; the marquee strip stays put. */
.story-buy-card--featured .story-buy-card-icon,
.story-buy-card--featured .story-buy-card-text,
.story-buy-card--featured .story-buy-card-arrow {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.3s ease, background 0.25s ease, color 0.25s ease;
}
.story-buy-card--featured:hover .story-buy-card-icon,
.story-buy-card--featured:hover .story-buy-card-text {
  transform: translateX(115%);
  opacity: 0;
}
.story-buy-card--featured:hover .story-buy-card-arrow {
  transform: translateX(14px);
}

/* Reveal message slides in from the left on hover */
.story-buy-reveal {
  position: absolute;
  left: 16px;
  right: 48px;
  top: 50%;
  z-index: 1;
  transform: translate(-30px, calc(-50% + 0px));
  margin-top: -4px;                 /* nudge up to clear the marquee strip */
  opacity: 0;
  pointer-events: none;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
  text-wrap: balance;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}
.story-buy-card--featured:hover .story-buy-reveal {
  transform: translate(0, calc(-50% - 4px));
  opacity: 1;
}

@keyframes storyBuyPulse {
  0%, 100% { box-shadow: 0 14px 30px -12px rgba(200,97,43,0.5); }
  50%      { box-shadow: 0 16px 38px -10px rgba(200,97,43,0.72); }
}

/* Diagonal shine sweep across the card */
.story-buy-shine {
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255,255,255,0.55) 50%,
    transparent 100%
  );
  transform: skewX(-18deg);
  animation: storyBuyShine 3.4s ease-in-out infinite;
}
@keyframes storyBuyShine {
  0%   { left: -60%; }
  55%  { left: 130%; }
  100% { left: 130%; }
}

/* "Hemat" badge next to the label */
/* Featured card: stack the "Hemat" badge ABOVE the "Web Yojea" label */
.story-buy-card--featured .story-buy-card-label {
  display: flex;
  flex-direction: column-reverse;   /* badge (last child) sits on top */
  align-items: flex-start;
  gap: 4px;
}

/* "Hemat" badge — pill sitting above the label */
.story-buy-badge {
  display: inline-block;
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff;
  color: #C8612B;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Scrolling marquee strip pinned to the bottom of the featured card */
.story-buy-marquee {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: rgba(0,0,0,0.16);
  z-index: 3;
}
.story-buy-marquee-track {
  display: flex;
  flex: none;
  white-space: nowrap;
  animation: storyBuyMarquee 14s linear infinite;
}
.story-buy-marquee-track span {
  padding: 0 22px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: rgba(255,255,255,0.95);
}
@keyframes storyBuyMarquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .story-buy-card--featured { animation: none; }
  .story-buy-shine { display: none; }
  .story-buy-card--featured:hover::after { animation: none; }
  .story-buy-marquee-track { animation-duration: 28s; }
}

@media (max-width: 980px) {
  .story-buy {
    right: 24px; left: 24px;
    width: auto;
    bottom: 24px;
  }
  .story-buy-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .story { height: 720vh; }
  .story-cert-img {
    width: clamp(280px, 70vw, 400px);
    height: clamp(380px, 90vw, 540px);
  }
  .story-brand-word { font-size: clamp(60px, 16vw, 100px); }
  .story-brand-block.is-shifted { top: clamp(20px, 4vh, 40px); }
  .story-buy-title { font-size: clamp(28px, 7vw, 40px); }
}

/* ─── Phase rail (tiny progress indicator, right edge) ────────── */
.story-rail {
  position: absolute;
  top: 50%; right: 18px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 5;
  pointer-events: none;
}
.story-rail-dot {
  position: relative;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(31,22,18,0.2);
  transition: all 0.3s ease;
}
.story-rail-dot.is-passed { background: var(--orange-deep); }
.story-rail-dot.is-active {
  background: var(--orange-deep);
  transform: scale(1.6);
  box-shadow: 0 0 0 4px rgba(232,93,26,0.18);
}
.story-rail-num {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
  font-family: ui-monospace, monospace;
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.story-rail-dot.is-active .story-rail-num { opacity: 1; color: var(--orange-deep); }

@media (max-width: 760px) {
  .story-rail { display: none; }
}
