/* ═══════════════════════════════════════════════════════════
   R32 — Story: اسکرولی، مرحله‌ای و ثابت
   ═══════════════════════════════════════════════════════════ */
.story-sequence {
  position: relative;
  height: 940vh;
  scroll-margin-top: var(--header-h);
  background: var(--bg);
  transition: background-color .7s var(--ease-out);
}

.story-sequence__sticky {
  position: sticky;
  top: 0;
  height: 100svh;
  overflow: hidden;
  background: transparent;
}
.story-sequence__inner,
.story-sequence__track { height: 100%; }
.story-sequence__inner { width: 100%; max-width: none; padding: 0; }
.story-sequence__track { position: relative; }

.story-scene {
  --scene-rgb: 240, 86, 61;
  --scene-title-rgb: 240, 86, 61;
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow: hidden;
}
.story-scene__icon-col {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: visible;
}
.story-scene__icon-shell {
  --icon-size: min(45vw, 50vh);
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--icon-size);
  height: var(--icon-size);
  display: grid;
  place-items: center;
  color: rgb(var(--scene-rgb));
  opacity: 0;
  transform: translate(-50%, -50%);
  transform-origin: center;
  overflow: visible;
  will-change: transform, opacity, filter, color;
}
.story-scene__icon {
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.story-scene__icon-path {
  fill: none;
  stroke: currentColor;
  stroke-width: .50;
  stroke-linecap: round;
  stroke-linejoin: round;
  shape-rendering: geometricPrecision;
}
.story-scene__icon--sparkles .story-scene__icon-path { stroke-width: .56; }
.story-scene__icon-glow,
.story-scene__icon-shell::after { display: none !important; content: none !important; }

.story-scene__content-col {
  position: absolute;
  z-index: 6;
  top: 50%;
  width: min(43vw, 42rem);
  direction: rtl;
  transform: translateY(-50%);
}
.story-scene[data-align="left"] .story-scene__content-col {
  right: clamp(1rem, 3.3vw, 3.6rem);
  text-align: right;
}
.story-scene[data-align="right"] .story-scene__content-col {
  left: clamp(1rem, 3.3vw, 3.6rem);
  text-align: right;
}
.story-scene__panel {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0;
  transform: translate3d(0, 2.5rem, 0);
  will-change: opacity, transform;
}
.story-scene__title {
  min-height: 1.16em;
  margin: 0 0 1.05rem;
  color: rgb(var(--scene-title-rgb));
  font-size: clamp(2.35rem, 5vw, 5rem);
  font-weight: 950;
  line-height: 1.08;
  text-wrap: balance;
}
.story-scene__typed {
  min-height: 11rem;
  max-width: 38rem;
  color: rgba(250,250,247,.92);
  font-size: clamp(1.04rem, 1.55vw, 1.28rem);
  font-weight: 470;
  line-height: 2.08;
}
[data-theme="light"] .story-scene__typed { color: rgba(20,23,28,.91); }
.story-scene__typed p { margin: 0; white-space: pre-wrap; }
.story-scene__cursor {
  display: inline-block;
  width: .54ch;
  height: 1em;
  margin-inline-start: .12rem;
  translate: none;
  border-radius: .28rem;
  background: var(--c-spark);
  box-shadow: 0 0 .95rem rgba(240,86,61,.76), 0 0 2.3rem rgba(240,86,61,.3);
  vertical-align: baseline;
  animation: story-cursor-blink .9s steps(1) infinite;
}
.story-scene__eyebrow,
.story-scene__keywords { display: none !important; }
@keyframes story-cursor-blink { 0%,47% { opacity: 1; } 48%,100% { opacity: .18; } }

/* پس‌زمینه صحنه‌ها پشت نور قرار می‌گیرد، نه روی آن. */
[data-theme="dark"] .story-sequence[data-active-scene="2"] { background: var(--c-ink); }
[data-theme="light"] .story-sequence[data-active-scene="2"],
[data-theme="light"] .story-sequence[data-active-scene="3"] { background: var(--bg); }

.story-scene[data-icon="crown"] .story-scene__title { color: rgb(240,180,41) !important; }
[data-theme="dark"] .story-scene[data-icon="crown"] .story-scene__typed,
[data-theme="dark"] .story-scene[data-icon="crown"] .story-scene__typed p { color: #fff !important; }
[data-theme="light"] .story-scene[data-icon="crown"] .story-scene__typed,
[data-theme="light"] .story-scene[data-icon="crown"] .story-scene__typed p { color: rgba(20,23,28,.91) !important; }

/* حالت مرحله‌ای: یک صحنه کامل در هر حرکت اسکرول. */
[data-animation-enabled="true"][data-animation-mode="staged"] .story-sequence {
  height: 100svh;
  min-height: 100svh;
}
[data-animation-enabled="true"][data-animation-mode="staged"] .story-sequence__sticky {
  position: relative;
  top: auto;
}

/* حالت غیرفعال: چهار سکشن کامل و ثابت زیر هم. */
[data-animation-enabled="false"] .story-sequence {
  height: auto;
  background: var(--bg);
}
[data-animation-enabled="false"] .story-sequence__sticky {
  position: relative;
  top: auto;
  height: auto;
  overflow: visible;
}
[data-animation-enabled="false"] .story-sequence__inner,
[data-animation-enabled="false"] .story-sequence__track { height: auto; }
[data-animation-enabled="false"] .story-sequence__track {
  display: grid;
}
[data-animation-enabled="false"] .story-scene {
  position: relative;
  inset: auto;
  min-height: 100svh;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  overflow: hidden;
  background: var(--bg);
}
[data-animation-enabled="false"] .story-scene::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 50%;
  width: clamp(30rem, 50vw, 46rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle,
    rgba(var(--scene-rgb), .66) 0%,
    rgba(var(--scene-rgb), .30) 28%,
    rgba(var(--scene-rgb), .10) 55%,
    transparent 79%);
  filter: blur(13px) saturate(1.08);
  animation: static-story-light 4.8s ease-in-out infinite;
  pointer-events: none;
}
[data-animation-enabled="false"] .story-scene[data-align="left"]::before {
  left: 0;
  transform: translate(-50%, -50%);
}
[data-animation-enabled="false"] .story-scene[data-align="right"]::before {
  right: 0;
  transform: translate(50%, -50%);
}
@keyframes static-story-light {
  0%,100% { opacity: .56; }
  50% { opacity: .88; }
}
[data-animation-enabled="false"] .story-scene__icon-shell {
  opacity: 1 !important;
  filter: none;
  transform: translate(-50%, -50%) !important;
}
[data-animation-enabled="false"] .story-scene[data-align="left"] .story-scene__icon-shell {
  left: calc(var(--icon-size) / 2 + clamp(1rem, 3vw, 2rem));
}
[data-animation-enabled="false"] .story-scene[data-align="right"] .story-scene__icon-shell {
  left: calc(100% - var(--icon-size) / 2 - clamp(1rem, 3vw, 2rem));
}
[data-animation-enabled="false"] .story-scene__panel {
  opacity: 1 !important;
  transform: none !important;
}
[data-animation-enabled="false"] .story-scene__icon-path {
  stroke-dasharray: none !important;
  stroke-dashoffset: 0 !important;
  opacity: 1 !important;
}
[data-animation-enabled="false"] .story-scene__cursor { display: none !important; }
[data-animation-enabled="false"][data-theme="dark"] .story-scene[data-icon="crown"] { background: var(--c-ink); }

@media (max-width: 980px) {
  [data-animation-enabled="true"][data-animation-mode="scroll"] .story-sequence { height: 1000vh; }
  .story-scene__icon-shell { --icon-size: min(66vw, 46vh); }
  .story-scene__content-col,
  .story-scene[data-align="left"] .story-scene__content-col,
  .story-scene[data-align="right"] .story-scene__content-col {
    left: clamp(1rem, 5vw, 3rem);
    right: clamp(1rem, 5vw, 3rem);
    top: auto;
    bottom: clamp(2rem, 8vh, 5rem);
    width: auto;
    transform: none;
  }
  .story-scene__title { font-size: clamp(2.2rem, 8vw, 4rem); }
  .story-scene__typed { min-height: 10rem; max-width: none; }

  [data-animation-enabled="false"] .story-scene { min-height: 110svh; }
  [data-animation-enabled="false"] .story-scene__content-col { bottom: 2rem; }
  [data-animation-enabled="false"] .story-scene[data-align="left"] .story-scene__icon-shell,
  [data-animation-enabled="false"] .story-scene[data-align="right"] .story-scene__icon-shell {
    left: 50%;
    top: 27%;
  }
  [data-animation-enabled="false"] .story-scene::before {
    top: 27%;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, -50%) !important;
  }
}

@media (max-width: 640px) {
  [data-animation-enabled="true"][data-animation-mode="scroll"] .story-sequence { height: 1080vh; }
  .story-scene__icon-shell { --icon-size: min(74vw, 41vh); }
  .story-scene__content-col,
  .story-scene[data-align="left"] .story-scene__content-col,
  .story-scene[data-align="right"] .story-scene__content-col {
    left: 1rem;
    right: 1rem;
    bottom: 2.2rem;
  }
  .story-scene__typed { min-height: 12.5rem; font-size: .98rem; line-height: 1.95; }
}

@media (prefers-reduced-motion: reduce) {
  [data-animation-enabled="false"] .story-scene::before { animation-duration: 7s; }
}

/* ═══════════════════════════════════════════════════════════
   R33 — قاب تمام‌صفحه و قفل‌شده برای اجرای مرحله‌ای
   ═══════════════════════════════════════════════════════════ */
[data-animation-enabled="true"][data-animation-mode="staged"] .story-sequence {
  height: 100svh !important;
  min-height: 100svh;
  overflow: clip;
}
[data-animation-enabled="true"][data-animation-mode="staged"] .story-sequence__sticky {
  position: relative !important;
  inset: auto;
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
}
[data-story-stage-active="true"] {
  overscroll-behavior-y: none;
}
[data-story-stage-active="true"] body {
  overscroll-behavior-y: none;
}
