/* ===== SPLASH SCREEN REFACTORED ===== */

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  /* Animation Durations */
  --splash-fade-duration: 1s;
  --splash-reveal-duration: 1.2s;
  --splash-shimmer-duration: 1.6s;

  /* Colors - Primary */
  --splash-color-white: #ffffff;
  --splash-color-primary-bg: rgba(10, 22, 40, 0.96);
  --splash-color-secondary-bg: rgba(15, 52, 96, 0.92);

  /* Colors - Accents */
  --splash-accent-cyan: #00d4ff;
  --splash-accent-cyan-light: rgba(0, 212, 255, 0.18);
  --splash-accent-teal: #48b89f;
  --splash-accent-teal-light: rgba(72, 184, 159, 0.28);
  --splash-accent-teal-lighter: rgba(72, 184, 159, 0.4);

  /* Colors - Text & UI */
  --splash-text-primary: rgba(255, 255, 255, 0.95);
  --splash-text-secondary: rgba(255, 255, 255, 0.8);
  --splash-text-muted: rgba(255, 255, 255, 0.4);
  --splash-text-dim: rgba(255, 255, 255, 0.08);

  /* Gradients */
  --splash-progress-gradient: linear-gradient(90deg, #48b89f 0%, #75d6ff 45%, #b7f0ff 100%);
  --splash-progress-glow: 0 0 18px rgba(72, 184, 159, 0.8), 0 0 26px rgba(0, 212, 255, 0.5);

  /* Typography */
  --splash-font-display: 'Orbitron', sans-serif;
  --splash-font-mono: 'Orbitron', monospace;

  /* Sizing - Content */
  --splash-content-width-desktop: 420px;
  --splash-content-width-tablet: 360px;
  --splash-content-width-mobile: 310px;

  /* Sizing - Font Sizes (Desktop base) */
  --splash-domain-size-desktop: 1.1rem;
  --splash-progress-width-desktop: 220px;

  /* Sizing - Font Sizes (Tablet) */
  --splash-domain-size-tablet: 0.9rem;
  --splash-progress-width-tablet: 200px;

  /* Sizing - Font Sizes (Mobile) */
  --splash-domain-size-mobile: 0.78rem;
  --splash-progress-width-mobile: min(200px, 60vw);

  /* Spacing */
  --splash-gap-content: 1.2rem;
  --splash-margin-logo-bottom: 0.7rem;
  --splash-margin-domain-bottom: 1.5rem;

  /* Borders & Effects */
  --splash-border-light: rgba(255, 255, 255, 0.12);
  --splash-border-accent: rgba(0, 212, 255, 0.18);
  --splash-shadow-inset: inset 0 0 20px rgba(0, 0, 0, 0.2);
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --splash-fade-duration: 0.1s;
    --splash-reveal-duration: 0.1s;
  }
}

/* ===== PAGE WRAPPER (Main content behind splash) ===== */
.page-wrapper {
  opacity: 1;
  visibility: visible;
  filter: blur(12px) saturate(0.75);
  transform: scale(0.985);
  transition: 
    opacity var(--splash-fade-duration) ease,
    visibility var(--splash-fade-duration) ease,
    filter var(--splash-fade-duration) ease,
    transform var(--splash-fade-duration) ease;
}

body.page-ready .page-wrapper {
  opacity: 1;
  visibility: visible;
  filter: blur(0) saturate(1);
  transform: scale(1);
}

/* ===== SPLASH SCREEN (Container) ===== */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  animation: none;
  transition: opacity 0.7s ease;
  will-change: opacity;
}

.splash-screen.is-started {
  opacity: 1;
  visibility: visible;
  animation: none;
}

.splash-screen::before {
  content: "";
  position: absolute;
  inset: 12% 18%;
  border: 1px solid var(--splash-border-accent);
  border-radius: 32px;
  box-shadow: inset 0 0 40px rgba(0, 212, 255, 0.08);
  display: none;
  pointer-events: none;
}

/* ===== SPLASH CONTENT (Inner flex container) ===== */
.splash-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: var(--splash-content-width-desktop);
  max-width: 82vw;
  gap: var(--splash-gap-content);
  will-change: opacity;
}

/* ===== SPLASH ELEMENTS (Domain) ===== */
.splash-domain {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  display: block;
  width: fit-content;
  margin: 0 auto;
}

/* Domain Text */
.splash-domain {
  font-family: var(--splash-font-mono);
  font-size: clamp(0.7rem, 1.5vw, var(--splash-domain-size-desktop));
  letter-spacing: 0.35em;
  color: var(--splash-text-secondary);
  text-transform: uppercase;
  font-weight: 500;
}

/* ===== PROGRESS BAR ===== */
.splash-progress-wrap {
  width: var(--splash-progress-width-desktop);
  max-width: 52vw;
  margin: 0.8rem auto 0;
  opacity: 0.9;
}

.splash-progress-track {
  position: relative;
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
}

.splash-progress-fill {
  position: relative;
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--splash-progress-gradient);
  box-shadow: var(--splash-progress-glow);
  transition: width 0.18s ease-out;
  will-change: width;
}

.splash-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: splashShimmer var(--splash-shimmer-duration) ease-in-out infinite;
}

/* ===== SPLASH TAG ===== */
.splash-tag {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(72, 184, 159, 0.95);
}

/* ===== SPLASH HIDE STATE ===== */
.splash-screen.hide {
  opacity: 0;
  visibility: visible;
  animation: none;
}

/* ===== ANIMATIONS ===== */

@keyframes splashShimmer {
  0% {
    transform: translateX(-100%);
    opacity: 0.2;
  }
  50% {
    opacity: 1;
  }
  100% {
    transform: translateX(100%);
    opacity: 0.2;
  }
}

/* ===== MEDIA QUERIES: TABLET LANDSCAPE (900px - 1439px) ===== */
@media (max-width: 1439px) and (min-width: 900px) {
  .splash-content {
    --splash-content-width-desktop: 400px;
  }

  .splash-domain {
    font-size: clamp(0.65rem, 1.2vw, 1rem);
    letter-spacing: 0.32em;
  }

  .splash-progress-wrap {
    width: 210px;
  }
}

/* ===== MEDIA QUERIES: TABLET PORTRAIT (600px - 899px) ===== */
@media (max-width: 899px) and (min-width: 600px) {
  .splash-content {
    --splash-content-width-tablet: 360px;
    width: var(--splash-content-width-tablet);
    max-width: 86vw;
  }

  .splash-domain {
    font-size: clamp(0.62rem, 2vw, 0.9rem);
    letter-spacing: 0.24em;
  }

  .splash-progress-wrap {
    width: var(--splash-progress-width-tablet);
    max-width: 60vw;
  }
}

/* ===== MEDIA QUERIES: MOBILE LANDSCAPE (480px - 599px) ===== */
@media (max-width: 599px) and (min-width: 480px) {
  .splash-content {
    --splash-content-width-mobile: 310px;
    width: var(--splash-content-width-mobile);
    max-width: 88vw;
    gap: 1rem;
  }

  .splash-domain {
    font-size: clamp(0.54rem, 2.8vw, 0.8rem);
    letter-spacing: 0.18em;
    margin-bottom: 1rem;
  }

  .splash-progress-wrap {
    width: var(--splash-progress-width-mobile);
    margin-top: 0.6rem;
  }
}

/* ===== MEDIA QUERIES: MOBILE PORTRAIT (320px - 479px) ===== */
@media (max-width: 479px) {
  .splash-content {
    --splash-content-width-mobile: 290px;
    width: var(--splash-content-width-mobile);
    max-width: 88vw;
    gap: 0.9rem;
  }

  .splash-domain {
    font-size: clamp(0.5rem, 3vw, 0.7rem);
    letter-spacing: 0.15em;
    margin-bottom: 0.8rem;
  }

  .splash-progress-wrap {
    width: var(--splash-progress-width-mobile);
    margin-top: 0.5rem;
  }

  .splash-progress-track {
    height: 6px;
  }

  @media (prefers-reduced-motion: no-preference) {
    .splash-reveal {
      animation-duration: 0.9s;
    }
  }
}

/* ===== ACCESSIBILITY: Reduced Motion ===== */
@media (prefers-reduced-motion: reduce) {
  .splash-screen {
    animation: none;
  }

  .splash-content {
    animation: none;
    opacity: 1;
    transform: scale(1);
  }

  .page-wrapper {
    animation: none;
  }
}

/* ===== PRINT STYLES (Optional) ===== */
@media print {
  .splash-screen {
    display: none !important;
  }
}
