/* ============================================
   Landing Intro (particle) + Hero
   Intro: redesign directions / pilots-intro
   Title: https://reactbits.dev/text-animations/fold-text
   ============================================ */

/* ---------- Particle intro curtain ---------- */
.lp-intro {
    position: fixed;
    inset: 0;
    z-index: 100001;
    background: #000;
    opacity: 1;
    visibility: visible;
    transition:
        opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0s;
    will-change: opacity, transform;
}

.lp-intro.is-exiting {
    opacity: 0;
    transform: translateY(-8%);
    pointer-events: none;
    transition:
        opacity 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        transform 0.72s cubic-bezier(0.22, 1, 0.36, 1),
        visibility 0s linear 0.72s;
    visibility: hidden;
}

.lp-intro.is-dismissed {
    display: none !important;
}

.lp-intro__frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

html.lp-intro-lock,
html.lp-intro-lock body,
body.lp-intro-pending,
body.lp-intro-active,
body.lp-intro-exiting,
body.lp-intro-lock {
    overflow: hidden !important;
}

body.lp-intro-pending #header,
body.lp-intro-pending header#header,
body.lp-intro-pending .ct-header,
body.lp-intro-pending [data-header],
body.lp-intro-pending #footer,
body.lp-intro-pending footer.ct-footer,
body.lp-intro-pending .ct-footer,
body.lp-intro-pending .custom-global-footer,
body.lp-intro-pending .landing-page > :not([data-lp-intro]):not([data-lp-hero]),
body.lp-intro-active #header,
body.lp-intro-active header#header,
body.lp-intro-active .ct-header,
body.lp-intro-active [data-header],
body.lp-intro-active #footer,
body.lp-intro-active footer.ct-footer,
body.lp-intro-active .ct-footer,
body.lp-intro-active .custom-global-footer,
body.lp-intro-active .landing-page > :not([data-lp-intro]):not([data-lp-hero]) {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

body.lp-intro-pending .lp-hero__veil,
body.lp-intro-active .lp-hero__veil {
    opacity: 0 !important;
    visibility: hidden !important;
}

.landing-page.is-intro-pending .stat-item,
.landing-page.is-intro-pending .player-card,
.landing-page.is-intro-pending .shorts-item {
    animation-play-state: paused;
}

/* ---------- Hero ---------- */
.landing-hero.lp-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--navy-dark);
    color: var(--white);
}

.lp-hero__atmosphere {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.lp-hero__atmosphere-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lp-hero__atmosphere-media.lp-hero__atmosphere-photo,
.lp-hero__atmosphere-fallback {
    background-size: cover;
    background-position: center;
}

.lp-hero__atmosphere-fallback {
    background: #000;
}

/* Black while the reel buffers (no poster image) */
.lp-hero__atmosphere-media[data-lp-hero-video] {
    background: #000;
}

/*
 * Video plays at full opacity under a black shade.
 * We lift the shade once playback is rolling so motion + reveal feel one.
 */
.lp-hero__atmosphere-shade {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
    opacity: 1;
    pointer-events: none;
    transition: opacity 2.1s cubic-bezier(0.33, 0.1, 0.25, 1);
    will-change: opacity;
}

.lp-hero__atmosphere-shade.is-clear {
    opacity: 0;
}

/* Subtle settle zoom while the shade lifts */
.lp-hero__atmosphere-enter {
    opacity: 1;
    transform: scale(1.045);
    transition: transform 2.4s cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

.lp-hero__atmosphere-enter.is-in {
    transform: scale(1);
}

iframe.lp-hero__atmosphere-media {
    top: 50%;
    left: 50%;
    width: 100vw;
    height: 56.25vw;
    min-height: 100%;
    min-width: 177.78vh;
    transform: translate(-50%, -50%);
    border: 0;
}

iframe.lp-hero__atmosphere-media.lp-hero__atmosphere-enter {
    transform: translate(-50%, -50%) scale(1.04);
}

iframe.lp-hero__atmosphere-media.lp-hero__atmosphere-enter.is-in {
    transform: translate(-50%, -50%) scale(1);
}

.lp-hero__veil {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(
        180deg,
        rgba(15, 15, 26, 0.42) 0%,
        rgba(15, 15, 26, 0.55) 45%,
        rgba(15, 15, 26, 0.72) 100%
    );
    opacity: 0;
    transition: opacity 0.85s ease;
    will-change: opacity;
}

.landing-page.is-hero-ready .lp-hero__veil {
    opacity: 1;
}

.lp-hero__stage {
    position: relative;
    width: min(1200px, 94vw);
    margin: 0 auto;
    padding: clamp(4.5rem, 10vh, 6rem) 0 clamp(1.5rem, 4vh, 3rem);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(0.55rem, 1.4vh, 1rem);
}

.lp-hero__kicker {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(0.75rem, 1.8vw, 0.95rem);
    font-weight: 600;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--primary);
}

.lp-hero__title {
    margin: 0;
    width: 100%;
    font-family: 'Noto Sans TC', var(--font-display), sans-serif;
    font-size: clamp(3.25rem, 12vw, 7.5rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.02em;
}

/* React Bits FoldText — 3D hinge unfold */
.fold-text,
.lp-fold-text {
    display: block;
    width: 100%;
    color: var(--fold-text-color, #f7f2e8);
    /* Don't use `inherit` here — it pulls from the parent, not .lp-hero__title */
    font-size: var(--fold-text-font-size, clamp(3.25rem, 12vw, 7.5rem));
    font-weight: var(--fold-text-font-weight, 800);
    line-height: 0.95;
    letter-spacing: -0.02em;
    white-space: pre-wrap;
    user-select: text;
}

.lp-hero__title.lp-fold-text {
    font-size: clamp(3.25rem, 12vw, 7.5rem);
}

.fold-text-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.fold-text-visual {
    display: inline;
}

.fold-text-segment {
    display: inline-block;
    line-height: inherit;
    perspective: var(--fold-perspective, 700px);
    transform-style: preserve-3d;
    vertical-align: baseline;
}

.fold-text-piece {
    position: relative;
    display: inline-block;
    color: rgba(247, 242, 232, 0.9);
    line-height: inherit;
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.22),
        0 0 18px rgba(255, 255, 255, 0.12),
        0 10px 28px rgba(0, 0, 0, 0.4);
}

.fold-text-piece::after {
    content: '';
    position: absolute;
    inset: -0.08em -0.02em;
    pointer-events: none;
    opacity: var(--fold-crease, 0);
    mix-blend-mode: multiply;
    border-radius: 0.08em;
}

.fold-text-piece[data-fold-hinge='top']::after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='bottom']::after {
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='left']::after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.fold-text-piece[data-fold-hinge='right']::after {
    background: linear-gradient(270deg, rgba(0, 0, 0, 0.58) 0%, rgba(0, 0, 0, 0.22) 42%, rgba(255, 255, 255, 0.26) 100%);
}

.lp-hero__english {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 2.4vw, 1.35rem);
    font-weight: 500;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: var(--gold-light);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.lp-hero__tagline {
    margin: 0;
    max-width: 28ch;
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 2.5vw, 1.45rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 20px rgba(0, 0, 0, 0.35);
}

.lp-hero__kicker {
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.15), 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Staggered fade-in for kicker / english / tagline */
.lp-reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--lp-reveal-i, 0) * 90ms);
}

.landing-page.is-hero-ready .lp-reveal {
    opacity: 1;
    transform: translateY(0);
}

/* ZH FoldText owns its reveal — keep wrapper visible, no CSS fade fight */
.landing-page.is-hero-ready .lp-hero__title.lp-reveal {
    opacity: 1;
    transform: none;
    transition: none;
}

.lp-hero [data-reveal]:nth-child(1) { --lp-reveal-i: 0; }
.lp-hero [data-reveal]:nth-child(2) { --lp-reveal-i: 1; }
.lp-hero [data-reveal]:nth-child(3) { --lp-reveal-i: 2; }
.lp-hero [data-reveal]:nth-child(4) { --lp-reveal-i: 3; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .lp-reveal {
        transition: none !important;
        animation: none !important;
    }

    .landing-page.is-hero-ready .lp-reveal {
        opacity: 1;
        transform: none;
    }

    .fold-text-piece {
        transform: none !important;
    }

    .fold-text-piece::after {
        opacity: 0 !important;
    }

    .lp-hero__title.lp-fold-text {
        line-height: 1.05;
        font-size: clamp(2.6rem, 10vw, 5rem);
        color: #f7f2e8;
        text-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
    }

    .lp-hero__atmosphere-enter {
        transition: none !important;
        transform: none !important;
    }

    .lp-hero__atmosphere-shade {
        transition: none !important;
    }

    .lp-hero__atmosphere-shade.is-clear {
        opacity: 0 !important;
    }

    iframe.lp-hero__atmosphere-media.lp-hero__atmosphere-enter,
    iframe.lp-hero__atmosphere-media.lp-hero__atmosphere-enter.is-in {
        transform: translate(-50%, -50%) !important;
    }

    .lp-intro.is-exiting {
        transition: none !important;
    }
}

/* ---------- Narrow viewports ---------- */
@media (max-width: 720px) {
    .lp-hero__title {
        font-size: clamp(2.6rem, 13vw, 4.2rem);
    }

    .lp-hero__english {
        letter-spacing: 0.22em;
    }
}
