/* ============================================
   INTRO SPLASH
   First-load cinematic: legacy logo → glitch →
   shatter → new identity → curtain rise.
   Orchestrated by scripts/splash.js (sessionStorage gated).
   ============================================ */

body.intro-locked {
    overflow: hidden;
}

.intro-splash {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: radial-gradient(ellipse at center, #0a0024 0%, #03000c 80%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.6s ease;
}

.intro-splash.dismissing {
    transform: translateY(-105%);
    opacity: 0.85;
    pointer-events: none;
}

.intro-splash::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(139, 61, 255, 0.3), transparent 55%),
        radial-gradient(circle at 70% 60%, rgba(45, 212, 255, 0.18), transparent 55%);
    pointer-events: none;
}

.intro-splash::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139, 61, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139, 61, 255, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    opacity: 0.5;
}

/* ------ White flash at the shatter climax ------ */
.intro-flash {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
}

.intro-flash.fire {
    animation: introFlash 0.5s ease-out;
}

@keyframes introFlash {
    0%   { opacity: 0; }
    30%  { opacity: 0.95; }
    100% { opacity: 0; }
}

/* ------ Legacy logo + RGB-split copies ------ */
.intro-legacy-wrap {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, 80vw);
    aspect-ratio: 463 / 222;
    z-index: 3;
    opacity: 0;
    animation: introLegacyIn 1.0s cubic-bezier(0.25, 1, 0.4, 1) 0.15s forwards;
}

.intro-legacy-wrap.shaking {
    animation: introLegacyShake 0.4s steps(8) infinite;
}

.intro-legacy-wrap.shattering {
    animation: introLegacyOut 0.4s ease-in forwards;
}

.intro-legacy {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 40px rgba(139, 61, 255, 0.5));
}

.intro-legacy--r,
.intro-legacy--b {
    opacity: 0;
    mix-blend-mode: screen;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.intro-legacy--r {
    filter: drop-shadow(0 0 0 #ff2070) hue-rotate(-30deg) saturate(2);
}

.intro-legacy--b {
    filter: drop-shadow(0 0 0 #20a0ff) hue-rotate(60deg) saturate(2);
}

.intro-legacy-wrap.glitch .intro-legacy--r {
    opacity: 0.7;
    transform: translate(-8px, 2px);
}

.intro-legacy-wrap.glitch .intro-legacy--b {
    opacity: 0.7;
    transform: translate(8px, -2px);
}

@keyframes introLegacyIn {
    0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.85); filter: blur(8px); }
    60%  { opacity: 1; transform: translate(-50%, -50%) scale(1.02); filter: blur(0); }
    100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes introLegacyShake {
    0%   { transform: translate(-50%, -50%); }
    25%  { transform: translate(calc(-50% - 4px), calc(-50% + 2px)); }
    50%  { transform: translate(calc(-50% + 3px), calc(-50% - 2px)); }
    75%  { transform: translate(calc(-50% - 2px), calc(-50% + 3px)); }
    100% { transform: translate(-50%, -50%); }
}

@keyframes introLegacyOut {
    0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.35); filter: blur(20px) brightness(3); }
}

/* ------ Particle burst (spawned by scripts/splash.js) ------ */
.intro-particle {
    position: absolute;
    border-radius: 4px;
    pointer-events: none;
    z-index: 4;
    will-change: transform, opacity;
    animation: introParticle 1.4s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes introParticle {
    0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; filter: brightness(2.2); }
    70%  { opacity: 1; filter: brightness(1.5); }
    100% { transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--rot, 180deg)) scale(0.4); opacity: 0; filter: brightness(1); }
}

/* ------ New identity reveal ------ */
.intro-new {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    text-align: center;
    opacity: 0;
    z-index: 6;
    pointer-events: none;
    transition: opacity 0.7s ease, transform 0.9s cubic-bezier(0.2, 1, 0.3, 1);
}

.intro-new.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* New logo image — dark background removed via SVG luminance filter */
.intro-new-logo {
    display: block;
    max-width: min(780px, 88vw);
    width: 100%;
    height: auto;
    margin: 0 auto;
    filter:
        url(#bgKnockoutDark)
        drop-shadow(0 0 30px rgba(139, 61, 255, 0.6))
        drop-shadow(0 0 70px rgba(45, 212, 255, 0.35));
}

.intro-new-tag {
    margin-top: 24px;
    font-family: var(--font-mono);
    font-size: clamp(11px, 1.1vw, 14px);
    color: var(--acid);
    letter-spacing: 0.4em;
    text-transform: uppercase;
    text-shadow: 0 0 14px rgba(182, 255, 60, 0.5);
    opacity: 0;
    transition: opacity 0.6s ease 0.3s;
}

.intro-new.show .intro-new-tag {
    opacity: 1;
}

/* ------ Light streaks converging into the new logo ------ */
.intro-streak {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 60vh;
    background: linear-gradient(180deg, transparent, var(--acid), transparent);
    transform-origin: center;
    opacity: 0;
    z-index: 5;
    pointer-events: none;
    mix-blend-mode: screen;
    animation: introStreak 0.9s cubic-bezier(0.2, 1, 0.3, 1) forwards;
}

@keyframes introStreak {
    0%   { opacity: 0;   transform: translate(-50%, -50%) rotate(var(--ang, 0deg)) scaleY(1.5); }
    40%  { opacity: 0.9; }
    100% { opacity: 0;   transform: translate(-50%, -50%) rotate(var(--ang, 0deg)) scaleY(0); }
}

/* ------ Skip button ------ */
.intro-skip {
    position: absolute;
    bottom: 28px;
    right: 28px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(139, 61, 255, 0.4);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 100px;
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    backdrop-filter: blur(8px);
}

.intro-skip:hover {
    color: var(--acid);
    border-color: var(--acid);
}

@media (prefers-reduced-motion: reduce) {
    .intro-splash { display: none; }
}

@media (max-width: 600px) {
    .intro-skip { bottom: 16px; right: 16px; }
}
