/* ==========================================================================
   BCA STORE — Premium App Launch Experience v3.0 (Supersonic Edition)
   Holographic Real Logo Projection · 60 FPS · Dual Theme · HUD Corner Locks
   ========================================================================== */

/* ── Loader Theme Tokens ─────────────────────────────────────────────────── */
:root {
  --launch-bg: #050811;
  /* Cyber dark slate base */
  --launch-fg: #f0f4f8;
  --launch-fg-sub: #64748b;
  --launch-accent: #1d4ed8;
  --launch-accent-glow: rgba(29, 78, 216, 0.25);
  --launch-line-track: rgba(255, 255, 255, 0.08);
  --launch-line-fill: linear-gradient(90deg, #1d4ed8, #7c3aed);
  --launch-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --launch-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --grid-color: rgba(29, 78, 216, 0.04);
}

[data-theme="dark"] {
  --launch-bg: #000000;
  /* Pitch black AMOLED */
  --launch-fg: #f8fafc;
  --launch-fg-sub: #94a3b8;
  --launch-accent: #00f0ff;
  /* Electric Cyber Cyan */
  --launch-accent-glow: rgba(0, 240, 255, 0.22);
  --launch-line-track: rgba(255, 255, 255, 0.1);
  --launch-line-fill: linear-gradient(90deg, #00f0ff, #a855f7);
  --grid-color: rgba(0, 240, 255, 0.02);
}

[data-theme="emerald-flow"] {
  --launch-bg: #01160f;
  /* Cyber Emerald deep green */
  --launch-fg: #ecfdf5;
  --launch-fg-sub: #6ee7b7;
  --launch-accent: #059669;
  --launch-accent-glow: rgba(5, 150, 105, 0.25);
  --launch-line-track: rgba(255, 255, 255, 0.08);
  --launch-line-fill: linear-gradient(90deg, #059669, #34d399);
  --grid-color: rgba(5, 150, 105, 0.03);
}

[data-theme="arctic-prism"] {
  --launch-bg: #060b13;
  /* Deep glacial blue */
  --launch-fg: #f0f9ff;
  --launch-fg-sub: #bae6fd;
  --launch-accent: #27c7c9;
  --launch-accent-glow: rgba(39, 199, 201, 0.25);
  --launch-line-track: rgba(255, 255, 255, 0.08);
  --launch-line-fill: linear-gradient(90deg, #27c7c9, #6366f1);
  --grid-color: rgba(39, 199, 201, 0.03);
}

/* ── Scroll Lock ─────────────────────────────────────────────────────────── */
html.bca-loader-lock,
body.bca-loader-lock {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none !important;
}

/* ── Fullscreen Launch Overlay ───────────────────────────────────────────── */
#bca-store-loader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--launch-bg);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  will-change: opacity;
  height: 100vh;
  height: 100dvh;
}

/* Holographic Digital Grid Overlay */
#bca-store-loader-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center center;
  opacity: 0.85;
  z-index: 1;
  pointer-events: none;
}

/* Ambient glow behind logo */
#bca-store-loader-overlay::before {
  content: '';
  position: absolute;
  width: clamp(280px, 45vw, 480px);
  height: clamp(280px, 45vw, 480px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--launch-accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.6);
  z-index: 2;
  transition: opacity 800ms ease 100ms, transform 800ms var(--launch-ease) 100ms;
}

#bca-store-loader-overlay.launch-phase-active::before {
  opacity: 1;
  transform: scale(1.15);
}

/* ── Exit Transition ─────────────────────────────────────────────────────── */
#bca-store-loader-overlay.launch-exiting {
  opacity: 0;
  transform: scale(1.025) translateY(-5px);
  transition:
    opacity 450ms var(--launch-ease-out),
    transform 450ms var(--launch-ease-out);
  pointer-events: none;
}

#bca-store-loader-overlay.launch-gone {
  display: none !important;
}

/* ── Composition Container ───────────────────────────────────────────────── */
.launch-composition {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* ── Hologram Tech Frame Container ───────────────────────────────────────── */
.hologram-frame {
  position: relative;
  width: clamp(180px, 25vw, 240px);
  height: clamp(180px, 25vw, 240px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: clamp(24px, 3.5vw, 36px);
  z-index: 3;
}

/* ── Projector Light Cone Beam ───────────────────────────────────────────── */
.hologram-beam {
  position: absolute;
  bottom: -10%;
  width: 140%;
  height: 90%;
  background: linear-gradient(to top, var(--launch-accent-glow), transparent);
  clip-path: polygon(25% 100%, 75% 100%, 100% 0%, 0% 0%);
  opacity: 0;
  transform: scaleY(0);
  transform-origin: bottom center;
  transition: opacity 700ms ease, transform 700ms var(--launch-ease);
  pointer-events: none;
  z-index: 1;
}

.launch-phase-assemble .hologram-beam {
  opacity: 0.45;
  transform: scaleY(1);
}

/* ── Laser Scan Sweep Line ───────────────────────────────────────────────── */
.scanner-bar {
  position: absolute;
  left: -8%;
  width: 116%;
  height: 3px;
  background: var(--launch-accent);
  box-shadow:
    0 0 10px var(--launch-accent),
    0 0 20px var(--launch-accent);
  z-index: 4;
  opacity: 0;
  pointer-events: none;
}

.scanner-bar.active {
  animation: laserScan 800ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes laserScan {
  0% {
    top: -5%;
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  80% {
    opacity: 1;
  }

  100% {
    top: 105%;
    opacity: 0;
  }
}

/* ── Supersonic Shockwave Pulse ──────────────────────────────────────────── */
.hud-shockwave {
  position: absolute;
  border-radius: 50%;
  border: 2px solid var(--launch-accent);
  width: 100px;
  height: 100px;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.6);
  z-index: 2;
}

.hud-shockwave.pulse {
  animation: shockwavePulse 650ms cubic-bezier(0.1, 0.8, 0.25, 1) forwards;
}

@keyframes shockwavePulse {
  0% {
    transform: scale(0.6);
    opacity: 0.9;
  }

  100% {
    transform: scale(3.8);
    opacity: 0;
    filter: blur(5px);
  }
}

/* ── Real Logo Image & Holographic Glow ──────────────────────────────────── */
.real-logo-img {
  width: 90%;
  height: 90%;
  border-radius: 25%;
  object-fit: cover;
  z-index: 3;
  opacity: 0;
  will-change: opacity, transform, filter;
  transition: opacity 300ms ease, transform 500ms var(--launch-ease);
}

.logo-glow-clone {
  position: absolute;
  width: 90%;
  height: 90%;
  border-radius: 25%;
  object-fit: cover;
  z-index: 2;
  filter: blur(16px);
  opacity: 0;
  will-change: opacity, transform;
  transition: opacity 500ms ease, transform 500ms var(--launch-ease);
}

/* Hologram Glitch projection animation */
.launch-phase-project .real-logo-img {
  opacity: 1;
  animation: hologramFlicker 380ms ease-out forwards;
}

.launch-phase-project .logo-glow-clone {
  opacity: 0.7;
  animation: hologramFlicker 380ms ease-out forwards;
}

@keyframes hologramFlicker {
  0% {
    opacity: 0.2;
    filter: hue-rotate(90deg) brightness(1.6);
  }

  20% {
    opacity: 0.8;
  }

  35% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.9;
    filter: hue-rotate(0deg) brightness(1.2);
  }

  70% {
    opacity: 0.5;
  }

  85% {
    opacity: 0.95;
  }

  100% {
    opacity: 1;
  }
}

/* ── Wordmark Typography ─────────────────────────────────────────────────── */
.launch-wordmark {
  display: flex;
  align-items: baseline;
  gap: clamp(6px, 1.2vw, 10px);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  margin-bottom: clamp(24px, 3.5vw, 38px);
  z-index: 3;

  /* Initial state */
  opacity: 0;
  transform: translateY(12px);
  filter: blur(5px);
  will-change: opacity, transform, filter;
  transition:
    opacity 500ms var(--launch-ease-out),
    transform 500ms var(--launch-ease-out),
    filter 450ms ease;
}

.launch-wordmark.launch-reveal {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.launch-wordmark-bca {
  color: var(--launch-fg);
}

.launch-wordmark-store {
  background: var(--launch-line-fill);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Progress Line ───────────────────────────────────────────────────────── */
.launch-progress-track {
  width: clamp(140px, 22vw, 220px);
  height: 3px;
  border-radius: 999px;
  background: var(--launch-line-track);
  overflow: hidden;
  position: relative;
  z-index: 3;

  /* Initial state */
  opacity: 0;
  transform: scaleX(0.6);
  will-change: opacity, transform;
  transition:
    opacity 350ms ease,
    transform 350ms var(--launch-ease-out);
}

.launch-progress-track.launch-reveal {
  opacity: 1;
  transform: scaleX(1);
}

.launch-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: var(--launch-line-fill);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

.launch-progress-fill.launch-filling {
  animation: launchProgressFill 1300ms cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

@keyframes launchProgressFill {
  0% {
    transform: scaleX(0);
  }

  20% {
    transform: scaleX(0.22);
  }

  50% {
    transform: scaleX(0.55);
  }

  75% {
    transform: scaleX(0.82);
  }

  90% {
    transform: scaleX(0.94);
  }

  100% {
    transform: scaleX(1);
  }
}

/* Traveling shimmer sweep on progress fill */
.launch-progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: launchShimmer 1.1s ease-in-out infinite;
}

@keyframes launchShimmer {
  0% {
    left: -40%;
  }

  100% {
    left: 140%;
  }
}

.launch-progress-fill.launch-complete {
  box-shadow: 0 0 15px var(--launch-accent);
  transition: box-shadow 300ms ease;
}

/* ── Desktop Enhancements (min-width: 1024px) ────────────────────────────── */
@media (min-width: 1024px) {
  .hologram-frame {
    width: 240px;
    height: 240px;
    margin-bottom: 36px;
  }

  .launch-wordmark {
    font-size: 36px;
    gap: 12px;
    letter-spacing: 0.10em;
    margin-bottom: 36px;
  }

  .launch-progress-track {
    width: 240px;
  }

  #bca-store-loader-overlay::before {
    width: 520px;
    height: 520px;
  }
}

/* ── Mobile Fine-tuning (max-width: 480px) & BIG SIZE OVERRIDES ─────────── */
@media (max-width: 480px) {
  .hologram-frame {
    width: 170px !important;
    /* MUCH BIGGER SIZE ON PHONES */
    height: 170px !important;
    margin-bottom: 28px !important;
  }

  .launch-wordmark {
    font-size: 27px !important;
    /* Extremely clear and large on phone screen */
    gap: 8px !important;
    margin-bottom: 24px !important;
  }

  .launch-progress-track {
    width: 150px !important;
  }
}

/* ── Accessibility: Reduced Motion ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  #bca-store-loader-overlay {
    transition: opacity 200ms ease !important;
  }

  #bca-store-loader-overlay::before,
  #bca-store-loader-overlay::after,
  .hologram-beam,
  .scanner-bar,
  .hud-shockwave {
    display: none !important;
  }

  .real-logo-img,
  .launch-wordmark,
  .launch-progress-track {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }

  .launch-progress-fill {
    transform: scaleX(1) !important;
    animation: none !important;
  }

  .launch-progress-fill::after {
    display: none !important;
  }
}

/* ── Safe Area Insets ────────────────────────────────────────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  #bca-store-loader-overlay {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}