/**
 * Story scrollytelling page — flat design only.
 * Each slide is a flat "scene": one background color + one accent color.
 * Entrance choreography lives in story.js; idle loops live here.
 */

/* ============ Shell ============ */
.story-page {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #0A1614;
    color: #FAF6EF;
    font-family: var(--mk-font, 'body-font', 'Vazirmatn', Tahoma, sans-serif);
    -webkit-font-smoothing: antialiased;
}

.story-shell {
    position: relative;
    width: 100%;
    height: 100dvh;
    overflow: hidden;
}

.story-track {
    height: 100dvh;
    overflow-y: scroll;
    overflow-x: hidden;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.story-track::-webkit-scrollbar {
    display: none;
}

/* ============ Slide scene ============ */
.story-slide {
    position: relative;
    height: 100dvh;
    min-height: 100dvh;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--story-bg, #0A1614);
    /* ink = text color of the scene */
    --story-ink: #FAF6EF;
    --story-ink-soft: rgba(250, 246, 239, 0.62);
    --story-line: rgba(250, 246, 239, 0.16);
}

.story-slide[data-mode="light"] {
    --story-ink: #16302D;
    --story-ink-soft: rgba(22, 48, 45, 0.62);
    --story-line: rgba(22, 48, 45, 0.14);
}

/* Flat decorative shapes — pure solid circles */
.story-deco {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.story-deco::before {
    content: '';
    position: absolute;
    width: 56vmax;
    height: 56vmax;
    border-radius: 50%;
    background: var(--story-accent, #00A297);
    opacity: 0.07;
    top: -22vmax;
    inset-inline-start: -18vmax;
}

.story-deco::after {
    content: '';
    position: absolute;
    width: 20vmax;
    height: 20vmax;
    border-radius: 50%;
    border: 2px solid var(--story-accent, #00A297);
    opacity: 0.14;
    bottom: -6vmax;
    inset-inline-end: -5vmax;
}

.story-slide:nth-child(even) .story-deco::before {
    inset-inline-start: auto;
    inset-inline-end: -18vmax;
}

.story-slide:nth-child(even) .story-deco::after {
    inset-inline-end: auto;
    inset-inline-start: -5vmax;
}

.story-slide-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(1.25rem, 3.5vh, 2.5rem);
    padding: 5rem 1.5rem 4rem;
    max-width: 760px;
    width: 100%;
    text-align: center;
}

/* ============ Typography ============ */
.story-copy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    will-change: transform, opacity;
}

.story-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--story-accent, #00A297);
    background: transparent;
    border: 1.5px solid var(--story-accent, #00A297);
    border-radius: 999px;
    padding: 0.3rem 0.95rem;
    margin-bottom: 0.5rem;
}

/* kicker that links to the module page — same look, subtle affordance.
   No transform here: it would fight the GSAP entrance tween. */
a.story-kicker--link {
    text-decoration: none;
    cursor: pointer;
    transition: background 0.25s, color 0.25s;
}

a.story-kicker--link:hover {
    background: var(--story-accent, #00A297);
    color: var(--story-bg, #0A1614);
}

.story-headline {
    font-size: clamp(1.75rem, 3.2vw + 1rem, 3rem);
    font-weight: 800;
    line-height: 1.35;
    margin: 0;
    color: var(--story-ink);
    text-wrap: balance;
}

/* word-stagger spans injected by story.js */
.story-headline .story-w {
    display: inline-block;
    will-change: transform, opacity;
}

.story-subtext {
    font-size: clamp(1rem, 0.6vw + 0.9rem, 1.25rem);
    color: var(--story-ink-soft);
    margin: 0;
    line-height: 1.8;
    max-width: 34rem;
    text-wrap: balance;
}

/* ============ CTA contact actions ============ */
.story-contact-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.1rem;
}

.story-contact-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.9rem 1.7rem;
    background: #0A1614;
    color: #FAF6EF;
    text-decoration: none;
    border-radius: 999px;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.story-contact-btn i {
    font-size: 1.35rem;
}

.story-contact-btn:hover {
    color: #FAF6EF;
    transform: translateY(-3px) scale(1.03);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.story-contact-btn--whatsapp {
    background: #FAF6EF;
    color: #0A1614;
}

.story-contact-btn--whatsapp:hover {
    color: #0A1614;
}

.story-contact-btn--telegram {
    background: transparent;
    color: var(--story-ink);
    box-shadow: none;
    border: 2px solid var(--story-ink);
}

.story-contact-btn--telegram:hover {
    color: var(--story-ink);
    box-shadow: none;
}

.story-contact-note {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--story-ink-soft);
    direction: ltr;
    letter-spacing: 0.06em;
}

/* ============ Visual stage ============ */
.story-visual-wrap {
    width: 100%;
    max-width: 460px;
    min-height: clamp(180px, 30vh, 280px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-visual {
    width: 100%;
    will-change: transform, opacity;
}

.story-svg {
    width: 100%;
    max-width: 420px;
    height: auto;
    display: block;
    margin: 0 auto;
    overflow: visible;
}

/* ============ Scroll hint — cascading double chevron, glued to the bottom edge ============ */
.story-scroll-hint {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    pointer-events: none;
}

.story-scroll-hint-chevron {
    display: block;
    width: 14px;
    height: 14px;
    /* physical left edge (not inline-start) so the chevron points down in RTL too */
    border-left: 2.5px solid var(--story-ink-soft);
    border-bottom: 2.5px solid var(--story-ink-soft);
    transform: translateY(0) rotate(-45deg);
    margin-top: -7px;
    animation: storyChevronDrop 1.8s ease-in-out infinite;
}

.story-scroll-hint-chevron--2 {
    animation-delay: 0.25s;
}

@keyframes storyChevronDrop {
    0% { opacity: 0; transform: translateY(-7px) rotate(-45deg); }
    45% { opacity: 1; }
    100% { opacity: 0; transform: translateY(7px) rotate(-45deg); }
}

/* ============ Chrome / navigation ============ */
.story-chrome {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    pointer-events: none;
}

.story-chrome > * {
    pointer-events: auto;
}

.story-chrome-logo img {
    display: block;
    height: 36px;
    width: auto;
    border-radius: 8px;
    transition: filter 0.4s ease;
}

/* smart logo: the source logo is white — darken it on light scenes */
.story-chrome[data-mode="light"] .story-chrome-logo img {
    filter: invert(1) hue-rotate(180deg);
}

@media (max-width: 767px) {
    .story-chrome-logo img {
        height: 30px;
    }
}

.story-chrome-chapters {
    display: none;
    gap: 0.35rem;
    background: rgba(10, 22, 20, 0.55);
    backdrop-filter: blur(8px);
    border-radius: 999px;
    padding: 0.3rem 0.4rem;
}

@media (min-width: 768px) {
    .story-chrome-chapters {
        display: flex;
    }
}

.story-chapter-label {
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    color: rgba(250, 246, 239, 0.55);
    padding: 0.3rem 0.8rem;
    border-radius: 999px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: color 0.3s, background 0.3s;
}

.story-chapter-label:hover {
    color: #FAF6EF;
}

.story-chapter-label.is-active {
    color: #0A1614;
    background: #FAF6EF;
}

/* ============ Worm dots navigation (side, vertical) ============ */
.story-dots {
    position: fixed;
    inset-inline-end: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 105;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.story-dots[data-mode="light"] {
    --story-dot-ink: #16302D;
}

.story-dot {
    width: 7px;
    height: 7px;
    padding: 0;
    border: none;
    border-radius: 999px;
    background: var(--story-dot-ink, #FAF6EF);
    opacity: 0.3;
    cursor: pointer;
    transition: height 0.35s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.3s, background 0.3s;
}

.story-dot:hover {
    opacity: 0.7;
}

.story-dot.is-active {
    height: 26px;
    opacity: 1;
    background: var(--story-accent-live, #00A297);
}

@media (max-width: 767px) {
    .story-dots {
        inset-inline-end: 0.4rem;
        gap: 6px;
    }

    .story-dot {
        width: 5px;
        height: 5px;
    }

    .story-dot.is-active {
        height: 18px;
    }
}

/* Top progress bar */
.story-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    z-index: 110;
    background: rgba(255, 255, 255, 0.12);
}

.story-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--story-accent-live, #00A297);
    border-radius: 0 2px 2px 0;
    transition: width 0.25s ease-out, background 0.4s;
}

.story-chrome-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.story-chrome-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.95rem;
    border-radius: 999px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    transition: transform 0.2s, background 0.2s, color 0.2s;
}

.story-chrome-btn--primary {
    background: #FAF6EF;
    color: #0A1614;
}

.story-chrome-btn--primary:hover {
    color: #0A1614;
    transform: translateY(-1px);
}

.story-chrome-btn--ghost {
    background: rgba(10, 22, 20, 0.4);
    backdrop-filter: blur(8px);
    color: #FAF6EF;
    padding: 0.5rem 0.6rem;
}

.story-chrome-btn--ghost:hover {
    background: rgba(10, 22, 20, 0.65);
    color: #FAF6EF;
}

/* =====================================================
   Visual scenes — idle loop animations (flat, minimal)
   Entrance choreography is handled by story.js
   ===================================================== */

/* --- night_clock: minute hand sweeps forever --- */
.story-v-clock-minute {
    transform-origin: 100px 100px;
    animation: storyClockSweep 6s linear infinite;
}

@keyframes storyClockSweep {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.story-v-clock-hour {
    transform-origin: 100px 100px;
    animation: storyClockSweep 72s linear infinite;
}

.story-v-zzz {
    animation: storyFloatUp 3s ease-in-out infinite;
    opacity: 0.7;
}

.story-v-zzz--2 { animation-delay: 1s; }
.story-v-zzz--3 { animation-delay: 2s; }

@keyframes storyFloatUp {
    0% { transform: translateY(0); opacity: 0; }
    30% { opacity: 0.8; }
    100% { transform: translateY(-16px); opacity: 0; }
}

/* --- chaos_papers: papers jitter nervously --- */
.story-v-paper {
    animation: storyJitter 1.6s ease-in-out infinite;
}

.story-v-paper--2 { animation-delay: -0.4s; }
.story-v-paper--3 { animation-delay: -0.8s; }
.story-v-paper--4 { animation-delay: -1.2s; }
.story-v-paper--5 { animation-delay: -0.6s; }

@keyframes storyJitter {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(1.5px, -1px) rotate(0.8deg); }
    50% { transform: translate(-1px, 1.5px) rotate(-0.8deg); }
    75% { transform: translate(1px, 1px) rotate(0.4deg); }
}

/* --- one_place: orbit ring slowly rotates --- */
.story-v-orbit-ring {
    transform-origin: 200px 140px;
    animation: storyOrbit 22s linear infinite;
}

@keyframes storyOrbit {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.story-v-core-pulse {
    transform-origin: 200px 140px;
    animation: storyPulse 2.6s ease-in-out infinite;
}

@keyframes storyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.07); }
}

/* --- pos_scan: laser beam sweeps the barcode --- */
.story-v-laser {
    animation: storyLaser 1.8s ease-in-out infinite;
}

@keyframes storyLaser {
    0%, 100% { transform: translateY(0); opacity: 0.95; }
    50% { transform: translateY(34px); opacity: 0.6; }
}

/* --- inventory_sync: sync arrows spin gently --- */
.story-v-sync {
    transform-origin: 200px 130px;
    animation: storyOrbit 8s linear infinite;
}

/* --- sms_club: bubbles bob --- */
.story-v-bob {
    animation: storyBob 3.2s ease-in-out infinite;
}

.story-v-bob--2 { animation-delay: -1.1s; }
.story-v-bob--3 { animation-delay: -2.2s; }

@keyframes storyBob {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px); }
}

/* --- map_route: pin gently bounces --- */
.story-v-pin-bounce {
    animation: storyPinBounce 2.4s ease-in-out infinite;
}

@keyframes storyPinBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* --- ai_employee: robot blinks + antenna glows --- */
.story-v-eye {
    animation: storyBlink 3.4s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

@keyframes storyBlink {
    0%, 91%, 100% { transform: scaleY(1); }
    94% { transform: scaleY(0.08); }
}

.story-v-antenna-dot {
    animation: storyGlowDot 1.8s ease-in-out infinite;
}

@keyframes storyGlowDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

/* --- seo_writer: cursor caret blinks --- */
.story-v-caret {
    animation: storyCaret 0.9s steps(1) infinite;
}

@keyframes storyCaret {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* --- wallet_meter: drip drop loops --- */
.story-v-drip {
    animation: storyDrip 2.2s ease-in infinite;
}

@keyframes storyDrip {
    0% { transform: translateY(-6px); opacity: 0; }
    25% { opacity: 1; }
    70% { transform: translateY(26px); opacity: 1; }
    100% { transform: translateY(30px); opacity: 0; }
}

/* --- trust_shield: badges hover --- */
.story-v-badge {
    animation: storyBob 4s ease-in-out infinite;
}

.story-v-badge--2 { animation-delay: -1.3s; }
.story-v-badge--3 { animation-delay: -2.6s; }

/* --- cta_demo: reach ring pulses --- */
.story-v-cta-ring {
    transform-origin: 200px 140px;
    animation: storyPulse 2.2s ease-in-out infinite;
}

/* --- night_report / cta_demo: stars & sparkles twinkle --- */
.story-v-star {
    animation: storyGlowDot 2.6s ease-in-out infinite;
}

.story-v-star--2 { animation-delay: -0.9s; }
.story-v-star--3 { animation-delay: -1.8s; }

/* ============ Stats grid ============ */
.story-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    max-width: 440px;
}

.story-stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.25rem 1rem;
    background: transparent;
    border: 2px solid var(--story-line);
    border-radius: 18px;
}

.story-stat-value {
    font-size: clamp(1.9rem, 5vw, 2.6rem);
    font-weight: 800;
    color: var(--story-accent, #00A297);
    direction: ltr;
    line-height: 1.1;
}

.story-stat-label {
    font-size: 0.82rem;
    color: var(--story-ink-soft);
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
    .story-track {
        scroll-snap-type: none;
    }

    .story-slide {
        scroll-snap-stop: normal;
        min-height: auto;
        height: auto;
        padding: 4rem 0;
    }

    .story-scroll-hint,
    .story-v-clock-minute,
    .story-v-clock-hour,
    .story-v-zzz,
    .story-v-paper,
    .story-v-orbit-ring,
    .story-v-core-pulse,
    .story-v-laser,
    .story-v-sync,
    .story-v-bob,
    .story-v-pin-bounce,
    .story-v-eye,
    .story-v-antenna-dot,
    .story-v-caret,
    .story-v-drip,
    .story-v-badge,
    .story-v-cta-ring,
    .story-v-star,
    .story-scroll-hint-chevron {
        animation: none;
    }
}

/* ============ Responsive ============ */
@media (max-width: 767px) {
    .story-slide-inner {
        padding: 4.25rem 1.1rem 3.25rem;
        gap: 1.1rem;
    }

    .story-visual-wrap {
        min-height: 150px;
        max-width: 300px;
    }

    .story-svg {
        max-width: 300px;
    }

    .story-headline {
        font-size: clamp(1.45rem, 6.4vw, 1.9rem);
    }

    .story-chrome-btn span {
        display: none;
    }

    .story-stats-grid {
        gap: 0.7rem;
        max-width: 340px;
    }

    .story-stat-item {
        padding: 0.9rem 0.5rem;
    }
}
