/* ============================================================
   Warp-in overlay on the simulator page. It mirrors the hero backdrop exactly
   (same gradient, same four nebula glows, same globe and floor) and carries a
   loader whose status line follows the app's real boot stages.
   ============================================================ */

/* ── Arrival overlay backdrop ─────────────────────────────────────── */

#warpOverlay {
    display: none;
}

html.warp-in #warpOverlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100000;
    overflow: hidden;
    background: linear-gradient(135deg, #080820 0%, #0a1628 40%, #0d0825 70%, #080820 100%);
    transition: opacity 0.6s ease;
}

html.warp-in[data-theme="light"] #warpOverlay {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f4fc 40%, #f5f0ff 70%, #f0f4ff 100%);
}

html.warp-in #warpOverlay.is-fading {
    opacity: 0;
    pointer-events: none;
}

/* The hero's box, reproduced at the same viewport offset and height, so the
   scene does not shift when the home page's navbar is no longer above it. */
#warpScene {
    position: absolute;
    left: 0;
    /* The home page keeps a scrollbar gutter; match its width so right-anchored
       elements (the globe) do not shift. */
    width: var(--warp-width, 100%);
    top: var(--warp-top, 0px);
    height: var(--warp-height, 100vh);
    overflow: hidden;
}

#warpOverlay canvas {
    position: absolute;
    display: block;
}

#warpScene #quantumCanvas {
    inset: 0;
    width: 100%;
    height: 100%;
}

#warpOverlay .hero-globe-canvas {
    top: 50%;
    right: -4%;
    width: min(860px, 58vw);
    aspect-ratio: 1;
    margin-top: min(-430px, -29vw);
    opacity: 0.95;
}

#warpOverlay .hero-surface-canvas {
    left: -15%;
    bottom: -2%;
    width: 130%;
    height: 50%;
}

/* The hero's nebula glows, same boxes and colours, at their warp brightness. */
#warpOverlay .warp-glow {
    position: absolute;
    /* Opacity and transform are handed over from the hero's live values. */
    opacity: 0.5;
    transform-origin: center;
    pointer-events: none;
}

html[data-theme="light"] #warpOverlay .warp-glow {
    opacity: 0.28;
}

/* ── Loader ───────────────────────────────────────────────────────── */

.warp-loader {
    position: absolute;
    left: 50%;
    top: 46%;
    transform: translate(-50%, -50%);
    width: min(360px, 82vw);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: #dfe9ff;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    text-align: center;
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.warp-loader.is-on {
    opacity: 1;
}

html[data-theme="light"] .warp-loader {
    color: #1e2748;
}

/* Circuit: a pulse runs down each wire and the gates flare as it passes. */
.warp-circuit {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.warp-pulse {
    animation: warp-pulse 1.3s linear infinite;
    animation-delay: var(--d, 0s);
}

@keyframes warp-pulse {
    0%   { transform: translateX(0);     opacity: 0; }
    6%   { opacity: 1; }
    94%  { opacity: 1; }
    100% { transform: translateX(196px); opacity: 0; }
}

.warp-gate {
    animation: warp-gate 1.3s ease-out infinite;
    animation-delay: var(--d, 0s);
    transform-box: fill-box;
    transform-origin: center;
}

@keyframes warp-gate {
    0%, 100% { filter: brightness(0.85); transform: scale(1); }
    12%      { filter: brightness(1.7) drop-shadow(0 0 6px rgba(200, 220, 255, 0.9)); transform: scale(1.12); }
    40%      { filter: brightness(1); transform: scale(1); }
}

.warp-text {
    font-size: 0.86rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    min-height: 1.4em;
    white-space: nowrap;
    color: #eaf2ff;
    text-shadow: 0 0 14px rgba(120, 200, 255, 0.45);
}

html[data-theme="light"] .warp-text {
    color: #1e2748;
    text-shadow: none;
}

.warp-text::after {
    content: '';
    display: inline-block;
    width: 1.6em;
    text-align: left;
    animation: warp-dots 1.2s steps(4, end) infinite;
}

@keyframes warp-dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

.warp-sub {
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(190, 205, 255, 0.55);
}

html[data-theme="light"] .warp-sub {
    color: rgba(30, 39, 72, 0.5);
}

/* Indeterminate bar: a cyan-to-violet sweep. */
.warp-bar {
    position: relative;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: rgba(150, 170, 255, 0.18);
    overflow: hidden;
}

.warp-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 38%;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, #4dc3ff 30%, #c76bcb 70%, transparent);
    animation: warp-sweep 1.1s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes warp-sweep {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(265%); }
}

@media (prefers-reduced-motion: reduce) {
    .warp-pulse,
    .warp-gate,
    .warp-bar::before,
    .warp-text::after {
        animation: none;
    }
}
