/* ============================================================
   LORCANA MARKET — Motion Design Layer
   ❄️ Winterspell Edition — Enchanted Snow Environment
   Inspired by PGC2 cinematic motion + Disney Lorcana Ch.11
   ============================================================ */

/* ── CSS Custom Properties (motion-specific) ────────────── */
:root {
    --motion-purple:    #7c3aed;
    --motion-purple-50: rgba(124, 58, 237, 0.5);
    --motion-purple-25: rgba(124, 58, 237, 0.25);
    --motion-teal:      #06b6d4;
    --motion-teal-50:   rgba(6, 182, 212, 0.5);
    --motion-gold:      #fbbf24;
    --motion-gold-50:   rgba(251, 191, 36, 0.5);
    --motion-pink:      #ec4899;
    --motion-ease:      cubic-bezier(0.22, 1, 0.36, 1);
    --motion-ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
    --motion-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Winterspell palette */
    --snow-white:       #f0f4ff;
    --snow-white-50:    rgba(240, 244, 255, 0.5);
    --ice-blue:         #a5d8ff;
    --ice-blue-deep:    #4dabf7;
    --frost-cyan:       #99e9f2;
    --aurora-green:     #69db7c;
    --aurora-purple:    #b197fc;
    --aurora-pink:      #f06595;
    --blizzard-white:   rgba(255, 255, 255, 0.08);
}

/* ── 0. Cinematic Curtain (fade dissolve) ───────────────── */
.cinematic-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* iOS Safari: uses actual viewport height */
    background: #000;
    z-index: 99999;
    pointer-events: none;
    /* CSS-only safety net: auto-fade if JS/GSAP never runs */
    animation: curtainSafetyFade 0.8s ease-in 1.5s forwards;
}
/* GSAP will override with inline styles; this only fires if JS fails */
@keyframes curtainSafetyFade {
    to { opacity: 0; visibility: hidden; }
}

/* Header oblong entrance shape (applied during cinematic only) */
.site-header.cinematic-oblong-enter {
    border-radius: 0 0 0 60px;
    overflow: hidden;
}

/* ── 1. Scroll Progress Bar ──────────────────────────────── */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--motion-purple), var(--motion-teal), var(--motion-pink));
    z-index: 10000;
    pointer-events: none;
    transition: none;
    box-shadow: 0 0 8px var(--motion-purple-50), 0 0 20px var(--motion-purple-25);
}

/* ── 2. Section Scroll Reveals ───────────────────────────── */
/* Initial hidden state — GSAP overrides with its own fromTo when available.
   CSS transition serves as fallback when GSAP is absent. */
.section-animate {
    opacity: 0;
    transform: translateY(60px);
    will-change: opacity, transform;
}
/* Direction variants — CSS fallback when GSAP unavailable */
.section-animate.slide-from-top    { transform: translateY(-60px); }
.section-animate.slide-from-right  { transform: translateX(80px); }
.section-animate.slide-from-bottom { transform: translateY(60px); }
.section-animate.slide-from-left   { transform: translateX(-80px); }

.section-animate.in-view {
    opacity: 1;
    transform: translate(0, 0);
    transition: opacity 0.7s var(--motion-ease), transform 0.7s var(--motion-ease);
}

/* On dashboard, GSAP owns all animations — kill CSS transitions to prevent blinking */
body:not(.tcg-game-page) .section-animate.cinematic-gsap {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}
body:not(.tcg-game-page) .section-animate.cinematic-gsap.in-view {
    transition: none !important;
}
body:not(.tcg-game-page) .section-animate.cinematic-gsap .stagger-child {
    animation: none !important;
}

/* Stagger children within a revealed section (non-dashboard pages only) */
.section-animate.in-view .stagger-child {
    animation: staggerFadeUp 0.6s var(--motion-ease) both;
}
.section-animate.in-view .stagger-child:nth-child(1) { animation-delay: 0.05s; }
.section-animate.in-view .stagger-child:nth-child(2) { animation-delay: 0.10s; }
.section-animate.in-view .stagger-child:nth-child(3) { animation-delay: 0.15s; }
.section-animate.in-view .stagger-child:nth-child(4) { animation-delay: 0.20s; }
.section-animate.in-view .stagger-child:nth-child(5) { animation-delay: 0.25s; }
.section-animate.in-view .stagger-child:nth-child(6) { animation-delay: 0.30s; }
.section-animate.in-view .stagger-child:nth-child(7) { animation-delay: 0.35s; }
.section-animate.in-view .stagger-child:nth-child(8) { animation-delay: 0.40s; }
.section-animate.in-view .stagger-child:nth-child(9) { animation-delay: 0.45s; }
.section-animate.in-view .stagger-child:nth-child(10) { animation-delay: 0.50s; }
.section-animate.in-view .stagger-child:nth-child(11) { animation-delay: 0.55s; }

@keyframes staggerFadeUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Card-specific reveal: with subtle scale + glow */
.card-reveal {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.6s var(--motion-ease),
                transform 0.6s var(--motion-ease-bounce);
}
.card-reveal.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ── 3. Back-to-Top — ❄️ Snow Magic Crystal (XL) ────────── */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%,
        rgba(165, 216, 255, 0.15) 0%,
        rgba(153, 233, 242, 0.06) 30%,
        rgba(13, 17, 23, 0.92) 65%
    );
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1.5px solid rgba(165, 216, 255, 0.3);
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.7);
    transition: opacity 0.5s var(--motion-ease),
                visibility 0.5s,
                transform 0.5s var(--motion-ease-bounce),
                border-color 0.4s ease,
                box-shadow 0.4s ease,
                background 0.4s ease;
    overflow: visible;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3),
                0 0 30px rgba(165, 216, 255, 0.06);
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}
.back-to-top:hover {
    border-color: var(--ice-blue);
    background: radial-gradient(circle at 40% 35%,
        rgba(165, 216, 255, 0.25) 0%,
        rgba(153, 233, 242, 0.1) 35%,
        rgba(13, 17, 23, 0.85) 65%
    );
    box-shadow:
        0 0 30px rgba(165, 216, 255, 0.3),
        0 0 60px rgba(165, 216, 255, 0.1),
        0 0 100px rgba(153, 233, 242, 0.05),
        inset 0 0 20px rgba(165, 216, 255, 0.08);
    transform: scale(1.08);
}
.back-to-top:active {
    transform: scale(0.95);
}

/* Progress ring SVG */
.back-to-top svg.progress-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 68px;
    height: 68px;
    transform: rotate(-90deg);
}
.back-to-top .progress-ring__bg {
    fill: none;
    stroke: rgba(165, 216, 255, 0.08);
    stroke-width: 1.5;
}
.back-to-top .progress-ring__circle {
    fill: none;
    stroke: var(--ice-blue);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 207.345;
    stroke-dashoffset: 207.345;
    transition: stroke-dashoffset 0.1s linear;
    filter: drop-shadow(0 0 6px rgba(165, 216, 255, 0.5));
}

/* Snowflake icon — x2 size */
.back-to-top .arrow-icon {
    font-size: 40px;
    line-height: 1;
    color: var(--ice-blue);
    text-shadow:
        0 0 12px rgba(165, 216, 255, 0.6),
        0 0 30px rgba(165, 216, 255, 0.15);
    transition: transform 0.4s var(--motion-ease-bounce),
                text-shadow 0.3s ease,
                filter 0.3s ease;
    animation: snowflakeFloat 6s ease-in-out infinite;
    filter: brightness(1);
}
.back-to-top:hover .arrow-icon {
    transform: scale(1.25) rotate(30deg);
    text-shadow:
        0 0 20px rgba(165, 216, 255, 0.9),
        0 0 40px rgba(165, 216, 255, 0.4),
        0 0 80px rgba(153, 233, 242, 0.2);
    animation: snowflakeSpin 1.5s linear infinite;
    filter: brightness(1.3);
}

@keyframes snowflakeFloat {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    25%  { transform: rotate(5deg) translateY(-2px); }
    50%  { transform: rotate(0deg) translateY(1px); }
    75%  { transform: rotate(-5deg) translateY(-1px); }
}
@keyframes snowflakeSpin {
    from { transform: scale(1.25) rotate(0deg); }
    to   { transform: scale(1.25) rotate(360deg); }
}

/* Orbiting ice crystals */
.orbit-crystal {
    position: absolute;
    font-size: 9px;
    color: var(--ice-blue);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    text-shadow: 0 0 6px rgba(165, 216, 255, 0.7);
}
.back-to-top.visible .orbit-crystal {
    opacity: 0.7;
}
.orbit-crystal.c1 {
    animation: orbit1 4s linear infinite;
}
.orbit-crystal.c2 {
    animation: orbit2 5s linear infinite;
    animation-delay: -1.5s;
}
.orbit-crystal.c3 {
    animation: orbit3 6s linear infinite;
    animation-delay: -3s;
}

@keyframes orbit1 {
    0%   { transform: rotate(0deg) translateX(42px) rotate(0deg); opacity: 0.8; }
    50%  { opacity: 0.3; }
    100% { transform: rotate(360deg) translateX(42px) rotate(-360deg); opacity: 0.8; }
}
@keyframes orbit2 {
    0%   { transform: rotate(0deg) translateX(46px) rotate(0deg); opacity: 0.5; }
    50%  { opacity: 0.2; }
    100% { transform: rotate(-360deg) translateX(46px) rotate(360deg); opacity: 0.5; }
}
@keyframes orbit3 {
    0%   { transform: rotate(120deg) translateX(38px) rotate(-120deg); opacity: 0.4; }
    50%  { opacity: 0.65; }
    100% { transform: rotate(480deg) translateX(38px) rotate(-480deg); opacity: 0.4; }
}

/* Inner frost halo ring */
.back-to-top::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    border: 1px solid rgba(165, 216, 255, 0.1);
    animation: haloBreath 3s ease-in-out infinite;
    pointer-events: none;
}
@keyframes haloBreath {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.05); }
}

/* Mobile: above bottom nav */
@media (max-width: 768px) {
    .back-to-top {
        bottom: 80px;
        right: 16px;
        width: 52px;
        height: 52px;
    }
    .back-to-top .arrow-icon {
        font-size: 34px;
    }
    .back-to-top svg.progress-ring {
        width: 60px;
        height: 60px;
    }
    .orbit-crystal {
        display: none;
    }
}

/* ── 4. Click Ripple / Magic Burst ───────────────────────── */
.click-ripple {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(circle, var(--motion-purple-50) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    animation: rippleExpand 0.6s var(--motion-ease-out) forwards;
}

@keyframes rippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 120px;
        height: 120px;
        opacity: 0;
    }
}

/* ── 5. Sparkle Particles ────────────────────────────────── */
.sparkle {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    animation: sparkleFly 0.8s var(--motion-ease-out) forwards;
}
.sparkle.purple { background: var(--motion-purple); box-shadow: 0 0 6px var(--motion-purple); }
.sparkle.teal   { background: var(--motion-teal);   box-shadow: 0 0 6px var(--motion-teal); }
.sparkle.gold   { background: var(--motion-gold);   box-shadow: 0 0 6px var(--motion-gold); }
.sparkle.pink   { background: var(--motion-pink);   box-shadow: 0 0 6px var(--motion-pink); }

@keyframes sparkleFly {
    0% {
        opacity: 1;
        transform: translate(var(--sx, 0), var(--sy, 0)) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(var(--ex, 20px), var(--ey, -40px)) scale(0);
    }
}

/* ── 6. Cursor Follower (Enchanted Orb) ──────────────────── */
.cursor-orb {
    position: fixed;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 999998;
    background: radial-gradient(circle at 35% 35%,
        rgba(124, 58, 237, 0.25) 0%,
        rgba(124, 58, 237, 0.08) 50%,
        transparent 70%
    );
    border: 1px solid rgba(124, 58, 237, 0.2);
    mix-blend-mode: screen;
    transform: translate(-50%, -50%);
    transition: width 0.3s var(--motion-ease),
                height 0.3s var(--motion-ease),
                background 0.3s ease,
                border-color 0.3s ease;
    will-change: left, top;
}

/* Expand on hovering interactive elements */
.cursor-orb.hovering {
    width: 44px;
    height: 44px;
    background: radial-gradient(circle at 35% 35%,
        rgba(124, 58, 237, 0.15) 0%,
        rgba(124, 58, 237, 0.05) 50%,
        transparent 70%
    );
    border-color: rgba(124, 58, 237, 0.35);
}

/* Tiny dot at exact cursor position */
.cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--motion-purple);
    pointer-events: none;
    z-index: 999999;
    transform: translate(-50%, -50%);
    will-change: left, top;
    box-shadow: 0 0 6px var(--motion-purple-50);
}

/* Hide on touch devices */
@media (hover: none) {
    .cursor-orb,
    .cursor-dot {
        display: none !important;
    }
}

/* ── 7. Nav Tab Hover Shimmer — Ice Edition ──────────────── */
.nav-tab::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(165, 216, 255, 0.06), transparent);
    transition: left 0.6s ease;
    border-radius: inherit;
}
.nav-tab:hover::after {
    left: 100%;
}

/* ── 8. Enchanted Card Hover ─────────────────────────────── */
.summary-card,
.info-card {
    transition: transform 0.35s var(--motion-ease-bounce),
                box-shadow 0.35s ease,
                border-color 0.35s ease;
}
.summary-card:hover,
.info-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.15),
                0 0 40px rgba(124, 58, 237, 0.05);
    border-color: rgba(124, 58, 237, 0.3);
}

/* ── 9. Table Row Hover Glow ─────────────────────────────── */
.data-table tbody tr {
    transition: background 0.2s ease, box-shadow 0.2s ease;
}
.data-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.06);
    box-shadow: inset 3px 0 0 var(--motion-purple);
}

/* ── 10. Button Press Effect ─────────────────────────────── */
.btn {
    transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.btn:active {
    transform: scale(0.96);
}

/* ── 11. Generic Keyframes (used by Section 20, etc.) ────── */
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── 12. Sparkle Burst (back-to-top click) ───────────────── */
.sparkle-burst {
    position: fixed;
    pointer-events: none;
    z-index: 99999;
}

/* ── 13. Active Nav — Ice Glow Indicator ─────────────────── */
/* Old static active indicator removed — replaced by sliding JS indicator */

@keyframes navIcePulse {
    0%, 100% {
        box-shadow: 0 0 6px rgba(165, 216, 255, 0.4);
        opacity: 0.6;
    }
    50% {
        box-shadow: 0 0 14px var(--ice-blue), 0 0 28px rgba(165, 216, 255, 0.15);
        opacity: 1;
    }
}

/* ── 14a. Sliding Nav Indicator ──────────────────────────── */
.nav-slide-indicator {
    position: absolute;
    bottom: 4px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ice-blue), var(--frost-cyan), var(--ice-blue), transparent);
    border-radius: 2px;
    pointer-events: none;
    z-index: 2;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease;
    opacity: 0;
    box-shadow: 0 0 10px rgba(165, 216, 255, 0.4), 0 0 20px rgba(165, 216, 255, 0.15);
    filter: blur(0.5px);
}

/* ── 14b. Header Scroll Hide/Reveal ──────────────────────── */
.site-header {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease,
                box-shadow 0.3s ease;
}
.site-header.header-scrolled {
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3),
                0 0 40px rgba(165, 216, 255, 0.03);
}
.site-header.header-hidden {
    transform: translateY(-100%);
    pointer-events: none;
}

/* ── 14c. Page Transition Overlay ────────────────────────── */
.page-transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 100000;
    pointer-events: none;
    background: var(--bg-primary, #0d1117);
    opacity: 0;
    transition: opacity 0.15s ease;
}
.page-transition-overlay.exiting {
    opacity: 1;
    transition: opacity 0.15s ease;
}
.page-transition-overlay.entering {
    opacity: 1;
    transition: none;
    animation: ptoFadeOut 0.2s ease 0.02s forwards;
}
@keyframes ptoFadeOut {
    from { opacity: 1; }
    to   { opacity: 0; }
}

/* ── 14. Reduced Motion ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .section-animate {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .card-reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .scroll-progress {
        display: none;
    }
    .cursor-orb,
    .cursor-dot {
        display: none !important;
    }
    .click-ripple,
    .sparkle {
        display: none !important;
    }
    .back-to-top {
        transition: opacity 0.2s ease;
        transform: none;
    }
    .nav-tab::after {
        display: none;
    }
    .page-enter .site-header,
    .page-enter .main-content {
        animation: none;
    }
    .nav-slide-indicator {
        transition: none;
    }
    .site-header {
        transition: none;
    }
    .site-header.header-hidden {
        transform: none;
    }
    .page-transition-overlay {
        display: none !important;
    }
    .summary-card:hover,
    .info-card:hover {
        transform: none;
    }
}

/* ================================================================
   ❄️  WINTERSPELL ENVIRONMENT — ADVANCED EFFECTS
   ================================================================ */

/* ── 15. Snowfall Canvas (behind everything) ─────────────── */
#snowCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1.5s ease;
}
#snowCanvas.active {
    opacity: 1;
}

/* ── 16. Aurora Borealis Background ──────────────────────── */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 2s ease;
}
.aurora-bg.active {
    opacity: 1;
}
.aurora-band {
    position: absolute;
    width: 200%;
    height: 40%;
    filter: blur(80px);
    opacity: 0.12;
    border-radius: 50%;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
    animation-direction: alternate;
}
.aurora-band-1 {
    top: -15%;
    left: -30%;
    background: linear-gradient(90deg, var(--aurora-green), var(--aurora-purple), transparent);
    animation: auroraFloat1 12s infinite alternate;
}
.aurora-band-2 {
    top: -10%;
    left: -50%;
    background: linear-gradient(90deg, transparent, var(--aurora-pink), var(--ice-blue), transparent);
    animation: auroraFloat2 16s infinite alternate;
    animation-delay: -4s;
}
.aurora-band-3 {
    top: -20%;
    left: -20%;
    background: linear-gradient(90deg, var(--motion-purple), var(--frost-cyan), transparent);
    animation: auroraFloat3 20s infinite alternate;
    animation-delay: -8s;
}

@keyframes auroraFloat1 {
    0%   { transform: translateX(0) translateY(0) rotate(-5deg); opacity: 0.1; }
    50%  { opacity: 0.18; }
    100% { transform: translateX(15%) translateY(10px) rotate(3deg); opacity: 0.08; }
}
@keyframes auroraFloat2 {
    0%   { transform: translateX(0) rotate(2deg); opacity: 0.08; }
    50%  { opacity: 0.15; }
    100% { transform: translateX(-10%) rotate(-4deg); opacity: 0.06; }
}
@keyframes auroraFloat3 {
    0%   { transform: translateX(5%) rotate(-3deg); opacity: 0.06; }
    50%  { opacity: 0.12; }
    100% { transform: translateX(-8%) rotate(5deg); opacity: 0.1; }
}

/* ── 17. Frost Section Dividers ──────────────────────────── */
.frost-divider {
    position: relative;
    width: 100%;
    height: 40px;
    margin: 0;
    pointer-events: none;
    overflow: hidden;
}
.frost-divider svg {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 100%;
}
.frost-divider .frost-path {
    fill: none;
    stroke: var(--ice-blue);
    stroke-width: 1.5;
    opacity: 0.3;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s var(--motion-ease);
}
.frost-divider.drawn .frost-path {
    stroke-dashoffset: 0;
}
.frost-divider .frost-glow {
    fill: none;
    stroke: var(--ice-blue);
    stroke-width: 4;
    opacity: 0.08;
    filter: blur(3px);
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2.5s var(--motion-ease);
}
.frost-divider.drawn .frost-glow {
    stroke-dashoffset: 0;
}

/* ── 18. Frosted Glass Cards ─────────────────────────────── */
.card-stat,
.info-card {
    position: relative;
    overflow: hidden;
}
.card-stat::before,
.info-card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border-radius: inherit;
    border: 1px solid transparent;
    background: linear-gradient(
        135deg,
        rgba(165, 216, 255, 0.15) 0%,
        transparent 40%,
        transparent 60%,
        rgba(153, 233, 242, 0.1) 100%
    ) border-box;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.8s ease;
}
.card-stat.frost-active::before,
.info-card.frost-active::before {
    opacity: 1;
}

/* Ice shimmer sweep on hover */
.card-stat::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(165, 216, 255, 0.06),
        rgba(255, 255, 255, 0.04),
        transparent
    );
    transition: left 0.8s var(--motion-ease);
    pointer-events: none;
}
.card-stat:hover::after {
    left: 200%;
}

/* ── 19. Snow Accumulation on Headers ────────────────────── */
.snow-cap {
    position: absolute;
    top: -4px;
    left: 0;
    width: 100%;
    height: 10px;
    pointer-events: none;
    z-index: 2;
}
.snow-cap svg {
    width: 100%;
    height: 100%;
}
.snow-cap-fill {
    fill: rgba(240, 244, 255, 0.5);
    filter: blur(0.5px);
}

/* ── 20. Cinematic Page Entrance ─────────────────────────── */
/* CSS fallback only — GSAP cinematic overrides with inline style animation:none */
.page-enter .site-header {
    animation: cinematicSlideDown 1s var(--motion-ease) both;
}
.page-enter .main-content {
    animation: cinematicFadeIn 1.2s var(--motion-ease) 0.3s both;
}
.page-enter .scroll-progress {
    animation: fadeIn 1s ease 1s both;
}

@keyframes cinematicSlideDown {
    0% {
        opacity: 0;
        transform: translateY(-40px);
        filter: blur(8px);
    }
    60% {
        filter: blur(0);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

@keyframes cinematicFadeIn {
    0% {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── 21. Counter Animation (stat values) ─────────────────── */
.stat-value {
    display: inline-block;
}
.stat-value.counting {
    transition: transform 0.1s ease;
}

/* ── 22. Parallax Depth Layers ───────────────────────────── */
.parallax-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

/* ── 23. Breath / Mist Hover Effect ──────────────────────── */
.mist-hover {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 30px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease;
}
.card-stat:hover .mist-hover {
    opacity: 1;
}
.mist-particle {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(165, 216, 255, 0.15), transparent);
    animation: mistFloat 3s ease-in-out infinite;
}
@keyframes mistFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
    50%      { transform: translateY(-15px) scale(1.3); opacity: 0.1; }
}

/* ── 24. Enchanted Scroll Progress (ice gradient) ────────── */
.scroll-progress {
    background: linear-gradient(90deg,
        var(--ice-blue-deep),
        var(--frost-cyan),
        var(--motion-purple),
        var(--aurora-pink)
    ) !important;
    box-shadow: 0 0 12px rgba(165, 216, 255, 0.4),
                0 0 30px rgba(165, 216, 255, 0.15) !important;
    height: 3px;
}

/* ── 25. Winter Cursor Orb (ice crystal) ─────────────────── */
.cursor-orb {
    background: radial-gradient(circle at 35% 35%,
        rgba(165, 216, 255, 0.2) 0%,
        rgba(153, 233, 242, 0.08) 50%,
        transparent 70%
    ) !important;
    border: 1px solid rgba(165, 216, 255, 0.25) !important;
}
.cursor-orb.hovering {
    background: radial-gradient(circle at 35% 35%,
        rgba(165, 216, 255, 0.12) 0%,
        rgba(153, 233, 242, 0.05) 50%,
        transparent 70%
    ) !important;
    border-color: rgba(165, 216, 255, 0.4) !important;
    box-shadow: 0 0 15px rgba(165, 216, 255, 0.15);
}
/* TCG magic cursor: golden sparkle glow on interactive elements */
.cursor-orb.tcg-magic {
    width: 38px !important;
    height: 38px !important;
    background: radial-gradient(circle at 35% 35%,
        rgba(251, 191, 36, 0.3) 0%,
        rgba(251, 191, 36, 0.1) 40%,
        transparent 70%
    ) !important;
    border-color: rgba(251, 191, 36, 0.5) !important;
    box-shadow: 0 0 18px rgba(251, 191, 36, 0.25),
               0 0 40px rgba(251, 191, 36, 0.08) !important;
    animation: tcgOrbPulse 1.2s ease-in-out infinite !important;
}
@keyframes tcgOrbPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-50%, -50%) scale(1.15); }
}
.cursor-dot {
    background: var(--ice-blue) !important;
    box-shadow: 0 0 8px rgba(165, 216, 255, 0.5) !important;
}

/* ── 26. Winter Sparkle Colors ───────────────────────────── */
.sparkle.ice    { background: var(--ice-blue);    box-shadow: 0 0 8px var(--ice-blue); }
.sparkle.frost  { background: var(--frost-cyan);  box-shadow: 0 0 8px var(--frost-cyan); }
.sparkle.snow   { background: var(--snow-white);  box-shadow: 0 0 8px var(--snow-white); }
.sparkle.aurora { background: var(--aurora-green); box-shadow: 0 0 8px var(--aurora-green); }

/* ── 27. Click Ripple — Ice Ring ─────────────────────────── */
.click-ripple {
    background: radial-gradient(circle,
        rgba(165, 216, 255, 0.3) 0%,
        rgba(153, 233, 242, 0.1) 40%,
        transparent 70%
    ) !important;
}

/* ── 28. Winter Table Row Hover ──────────────────────────── */
.data-table tbody tr:hover {
    background: rgba(165, 216, 255, 0.04) !important;
    box-shadow: inset 3px 0 0 var(--ice-blue-deep) !important;
}

/* ── 29. Winterspell Nav Active Glow (unified with #13) ──── */

/* ── 30. Hero Title Frost Text ───────────────────────────── */
.site-title .title-main {
    background: linear-gradient(135deg, #fff, var(--ice-blue), #fff);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: frostShimmer 4s ease-in-out infinite;
}
@keyframes frostShimmer {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ── 31. Section Header Ice Underline ────────────────────── */
.section-header h2 {
    position: relative;
    display: inline-block;
}
.section-header h2::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ice-blue), var(--frost-cyan), transparent);
    border-radius: 2px;
    transition: width 1s var(--motion-ease);
}
.section-animate.in-view .section-header h2::after {
    width: 100%;
}

/* ── 32. Snowflake Cursor Trail ──────────────────────────── */
.cursor-snowflake {
    position: fixed;
    pointer-events: none;
    z-index: 99989;
    font-size: 10px;
    opacity: 0.6;
    animation: snowflakeFade 1.2s ease-out forwards;
    color: var(--ice-blue);
    text-shadow: 0 0 4px rgba(165, 216, 255, 0.5);
}
@keyframes snowflakeFade {
    0% {
        opacity: 0.6;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(30px) rotate(180deg) scale(0.3);
    }
}

/* Blizzard burst — snowflakes fly outward from back-to-top */
@keyframes blizzardFly {
    0% {
        opacity: 0.9;
        transform: translate(0, 0) rotate(0deg) scale(1);
    }
    60% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translate(var(--bx, 40px), var(--by, -40px)) rotate(360deg) scale(0.2);
    }
}

/* ── 33. Frosted Glass Enhancement for Cards ─────────────── */
.card-stat:hover,
.info-card:hover {
    box-shadow: 0 8px 32px rgba(165, 216, 255, 0.1),
                0 0 60px rgba(165, 216, 255, 0.03),
                inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(165, 216, 255, 0.2) !important;
}

/* ── 34. Winter Wind Sway (for specific elements) ────────── */
@keyframes windSway {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(0.5deg); }
    75%      { transform: rotate(-0.5deg); }
}

/* ── 35. Loading Shimmer (skeleton) ──────────────────────── */
@keyframes iceShimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
.ice-shimmer {
    background: linear-gradient(
        90deg,
        transparent 25%,
        rgba(165, 216, 255, 0.05) 50%,
        transparent 75%
    );
    background-size: 200% 100%;
    animation: iceShimmer 2s linear infinite;
}

/* ── 36. Reduced Motion Override ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    #snowCanvas,
    .aurora-bg {
        display: none !important;
    }
    .frost-divider .frost-path,
    .frost-divider .frost-glow {
        stroke-dashoffset: 0 !important;
        transition: none !important;
    }
    .card-stat::before,
    .info-card::before,
    .card-stat::after {
        display: none !important;
    }
    .cursor-snowflake {
        display: none !important;
    }
    .site-title .title-main {
        animation: none !important;
        -webkit-text-fill-color: var(--text-primary) !important;
    }
    .section-header h2::after {
        width: 100% !important;
        transition: none !important;
    }
    .aurora-band {
        animation: none !important;
    }
    .back-to-top .arrow-icon {
        animation: none !important;
    }
    .orbit-crystal {
        display: none !important;
    }
    .back-to-top:hover .arrow-icon {
        animation: none !important;
    }
}
