/* ==========================================================
   INTRO SPLASH — cinematic boot sequence with logo video
   ========================================================== */

#intro-splash {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(ellipse at center, #0d1219 0%, #05080b 70%, #000 100%);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.8s ease, visibility 0.8s ease;
    will-change: opacity;
}

#intro-splash.is-hiding   { opacity: 0; pointer-events: none; }
#intro-splash.is-hidden   { opacity: 0; visibility: hidden; pointer-events: none; }

body.intro-active { overflow: hidden; }

/* ── Background grid layer ───────────────────────────────── */
.intro-grid {
    position: absolute;
    inset: -10%;
    background-image:
        linear-gradient(rgba(0, 255, 163, 0.10) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 163, 0.10) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image:    radial-gradient(ellipse at center, #000 30%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
    animation: introGridDrift 16s linear infinite;
    opacity: 0.65;
}

@keyframes introGridDrift {
    0%   { transform: translate(0, 0)       scale(1);    }
    100% { transform: translate(44px, 44px) scale(1.05); }
}

/* ── Concentric scanner rings ────────────────────────────── */
.intro-ring {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 163, 0.35);
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.intro-ring--a { width: 280px; height: 280px; animation: introRingPulse 4s ease-out infinite;            }
.intro-ring--b { width: 480px; height: 480px; animation: introRingPulse 4s ease-out infinite 0.9s;       border-style: dashed; opacity: 0.6; }
.intro-ring--c { width: 720px; height: 720px; animation: introRingPulse 4s ease-out infinite 1.8s;       opacity: 0.4; }
.intro-ring--d { width: 1100px; height: 1100px; animation: introRingPulse 5s ease-out infinite 2.5s;     border-style: dotted; opacity: 0.25; }

@keyframes introRingPulse {
    0%   { transform: translate(-50%, -50%) scale(0.85); opacity: 0;    border-color: rgba(0, 255, 163, 0.7); }
    25%  {                                               opacity: 0.9;  }
    100% { transform: translate(-50%, -50%) scale(1.4);  opacity: 0;    border-color: rgba(0, 255, 163, 0.1); }
}

/* ── Rotating dashed orbits ──────────────────────────────── */
.intro-orbit {
    position: absolute;
    top: 50%; left: 50%;
    border-radius: 50%;
    border: 1px dashed rgba(0, 255, 163, 0.22);
    transform-origin: center;
    pointer-events: none;
}
.intro-orbit--1 { width: 360px;  height: 360px;  margin: -180px 0 0 -180px;  animation: introSpin 18s linear infinite; }
.intro-orbit--2 { width: 560px;  height: 560px;  margin: -280px 0 0 -280px;  animation: introSpin 32s linear infinite reverse; border-style: dotted; }
.intro-orbit--3 { width: 820px;  height: 820px;  margin: -410px 0 0 -410px;  animation: introSpin 50s linear infinite; opacity: 0.5; }

.intro-orbit::before {
    content: "";
    position: absolute;
    top: -4px; left: 50%;
    width: 8px; height: 8px;
    margin-left: -4px;
    background: #00ffa3;
    border-radius: 50%;
    box-shadow: 0 0 12px #00ffa3, 0 0 24px rgba(0, 255, 163, 0.6);
}
.intro-orbit--2::before { background: #00f5a0; }
.intro-orbit--3::before { width: 6px; height: 6px; opacity: 0.7; }

@keyframes introSpin {
    0%   { transform: rotate(0deg);   }
    100% { transform: rotate(360deg); }
}

/* ── Corner brackets (HUD frame) ─────────────────────────── */
.intro-bracket {
    position: absolute;
    width: 56px; height: 56px;
    border: 2px solid rgba(0, 255, 163, 0.85);
    pointer-events: none;
    animation: introBracketIn 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.intro-bracket--tl { top: 32px;    left: 32px;    border-right: 0; border-bottom: 0; animation-delay: 0.1s;  }
.intro-bracket--tr { top: 32px;    right: 32px;   border-left: 0;  border-bottom: 0; animation-delay: 0.2s;  }
.intro-bracket--bl { bottom: 32px; left: 32px;    border-right: 0; border-top: 0;    animation-delay: 0.3s;  }
.intro-bracket--br { bottom: 32px; right: 32px;   border-left: 0;  border-top: 0;    animation-delay: 0.4s;  }

@keyframes introBracketIn {
    0%   { opacity: 0; transform: scale(0.6); }
    100% { opacity: 1; transform: scale(1);   }
}

/* ── Center stage: video wrapper with glow ───────────────── */
.intro-stage {
    position: relative;
    width: min(560px, 75vw);
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: introStageIn 1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.3s both;
}

@keyframes introStageIn {
    0%   { opacity: 0; transform: scale(0.8); filter: blur(12px); }
    100% { opacity: 1; transform: scale(1);   filter: blur(0);    }
}

.intro-stage::before {
    /* radial glow halo behind the video */
    content: "";
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle, rgba(0, 255, 163, 0.35) 0%, rgba(0, 255, 163, 0.08) 35%, transparent 70%);
    filter: blur(30px);
    animation: introHaloPulse 2.4s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes introHaloPulse {
    0%   { opacity: 0.55; transform: scale(0.95); }
    100% { opacity: 1;    transform: scale(1.08); }
}

.intro-video {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(0, 255, 163, 0.45))
            drop-shadow(0 0 50px rgba(0, 255, 163, 0.25));
    /* Use blend mode to drop the black background */
    mix-blend-mode: screen;
}

/* ── Scan beam over the stage ────────────────────────────── */
.intro-scanbeam {
    position: absolute;
    left: 0; right: 0;
    height: 80px;
    background: linear-gradient(to bottom,
        transparent 0%,
        rgba(0, 255, 163, 0.04) 30%,
        rgba(0, 255, 163, 0.18) 50%,
        rgba(0, 255, 163, 0.04) 70%,
        transparent 100%);
    animation: introScanbeam 3s ease-in-out infinite;
    pointer-events: none;
    mix-blend-mode: screen;
}

@keyframes introScanbeam {
    0%   { top: -10%;  }
    100% { top: 110%;  }
}

/* ── CRT scanlines overlay ───────────────────────────────── */
.intro-scanlines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(0, 0, 0, 0.18) 3px,
        transparent 4px
    );
    mix-blend-mode: multiply;
    pointer-events: none;
}

/* ── Top status text ─────────────────────────────────────── */
.intro-top-text {
    position: absolute;
    top: 64px; left: 0; right: 0;
    text-align: center;
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 11px;
    letter-spacing: 0.45em;
    color: rgba(0, 255, 163, 0.7);
    text-transform: uppercase;
    opacity: 0.7;
}

.intro-top-text__dot {
    display: inline-block;
    width: 6px; height: 6px;
    background: #00ffa3;
    border-radius: 50%;
    margin: 0 8px 1px;
    box-shadow: 0 0 8px #00ffa3;
    animation: introDotBlink 1.2s ease-in-out infinite;
}

@keyframes introDotBlink {
    0%, 100% { opacity: 1;   }
    50%      { opacity: 0.2; }
}
@keyframes introTextFlicker {
    0%, 96%, 100% { opacity: 1;    }
    97%           { opacity: 0.3;  }
    98%           { opacity: 0.85; }
}

/* ── Bottom block: brand text + progress bar + status ───── */
.intro-bottom {
    position: absolute;
    bottom: 80px;
    left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    animation: introBottomIn 0.8s ease 1.1s both;
}

@keyframes introBottomIn {
    0%   { opacity: 0; transform: translateY(20px); }
    100% { opacity: 1; transform: translateY(0);    }
}

.intro-brand-text {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 13px;
    letter-spacing: 0.3em;
    color: rgba(0, 255, 163, 0.85);
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0, 255, 163, 0.5);
    min-height: 1.2em;
    direction: ltr;
}

.intro-brand-text__cursor {
    display: inline-block;
    width: 8px;
    background: #00ffa3;
    margin-left: 4px;
    animation: introCursorBlink 0.8s steps(2) infinite;
    color: transparent;
}

@keyframes introCursorBlink {
    0%, 50%   { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.intro-progress {
    position: relative;
    width: min(360px, 60vw);
    height: 3px;
    background: rgba(0, 255, 163, 0.12);
    border-radius: 2px;
    overflow: hidden;
}

.intro-progress__bar {
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 0%;
    background: linear-gradient(to right, rgba(0, 255, 163, 0.4), #00ffa3);
    box-shadow: 0 0 12px rgba(0, 255, 163, 0.7);
    transition: width 0.18s ease;
}

.intro-progress__bar::after {
    /* moving glint */
    content: "";
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 14px;
    background: linear-gradient(to right, transparent, #fff);
    opacity: 0.6;
}

.intro-status {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    color: rgba(0, 255, 163, 0.55);
    text-transform: uppercase;
    direction: ltr;
}

/* ── Equalizer bars (audio-style) ────────────────────────── */
.intro-eq {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 18px;
    margin-top: 4px;
}

.intro-eq__bar {
    width: 3px;
    background: #00ffa3;
    border-radius: 1px;
    box-shadow: 0 0 4px rgba(0, 255, 163, 0.7);
    animation: introEqBar 0.9s ease-in-out infinite;
}
.intro-eq__bar:nth-child(1) { animation-delay: 0s;    }
.intro-eq__bar:nth-child(2) { animation-delay: 0.1s;  }
.intro-eq__bar:nth-child(3) { animation-delay: 0.25s; }
.intro-eq__bar:nth-child(4) { animation-delay: 0.18s; }
.intro-eq__bar:nth-child(5) { animation-delay: 0.32s; }
.intro-eq__bar:nth-child(6) { animation-delay: 0.05s; }
.intro-eq__bar:nth-child(7) { animation-delay: 0.22s; }

@keyframes introEqBar {
    0%, 100% { height: 20%; }
    50%      { height: 100%; }
}

/* ── Floating particles canvas ───────────────────────────── */
#intro-particles {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ── Glitch flash effect ─────────────────────────────────── */
.intro-glitch {
    position: absolute;
    inset: 0;
    background: rgba(0, 255, 163, 0.5);
    mix-blend-mode: screen;
    opacity: 0;
    pointer-events: none;
}
.intro-glitch.is-flash { animation: introFlash 0.18s ease-out; }

@keyframes introFlash {
    0%   { opacity: 0;    }
    20%  { opacity: 0.65; }
    100% { opacity: 0;    }
}

/* ── Skip button (small, bottom-right corner) ────────────── */
.intro-skip {
    position: absolute;
    bottom: 24px; right: 24px;
    background: rgba(0, 255, 163, 0.05);
    border: 1px solid rgba(0, 255, 163, 0.3);
    color: rgba(0, 255, 163, 0.75);
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 7px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    direction: ltr;
}
.intro-skip:hover {
    background: rgba(0, 255, 163, 0.12);
    border-color: rgba(0, 255, 163, 0.6);
    color: #00ffa3;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .intro-bracket { width: 38px; height: 38px; }
    .intro-bracket--tl, .intro-bracket--tr { top: 18px; }
    .intro-bracket--bl, .intro-bracket--br { bottom: 18px; }
    .intro-bracket--tl, .intro-bracket--bl { left:  18px; }
    .intro-bracket--tr, .intro-bracket--br { right: 18px; }
    .intro-orbit--3 { display: none; }
    .intro-ring--d  { display: none; }
    .intro-top-text { font-size: 9px; letter-spacing: 0.35em; top: 36px; }
    .intro-bottom { bottom: 50px; gap: 12px; }
    .intro-brand-text { font-size: 11px; letter-spacing: 0.22em; }
    .intro-skip { bottom: 14px; right: 14px; }
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .intro-grid, .intro-orbit, .intro-ring, .intro-scanbeam,
    .intro-eq__bar, .intro-top-text, .intro-stage::before {
        animation: none !important;
    }
}
