/* =============================
   Modern Splash Screen Styling v2.0
   - Fully responsive across all devices
   - Supports Lottie JSON (Bonfire base)
   - Layered animated gradient & noise
   - Accessible, reduced motion aware
   - Mobile-first responsive design
   - Fluid typography and spacing
   ============================= */
:root {
  /* Core brand palette */
  --splash-accent: #fb922b;
  --splash-accent-rgb: 251, 146, 43;
  --splash-bg-start: #181818;
  --splash-bg-mid: #232526;
  --splash-bg-end: #1d1d1d;
  --splash-text: #ffffff;
  --splash-fade-duration: 0.8s;
  --splash-font-stack: "JetBrains Mono", "Consolas", "Fira Mono", monospace;
  
  /* Responsive variables - adjust based on viewport */
  --splash-noise-opacity: 0.12;
  --splash-blur: clamp(12px, 3vw, 22px);
  --splash-border-glow: 0 0 clamp(12px, 2vw, 24px) -4px rgba(var(--splash-accent-rgb), 0.65);
  --splash-divider-height: clamp(60px, 15vh, 120px);
  --splash-divider-width: clamp(3px, 0.5vw, 4px);
  --splash-card-max-width: min(90vw, 560px);
  --splash-progress-height: clamp(3px, 0.5vh, 5px);
  --splash-progress-bg: rgba(255,255,255,0.15);
  --splash-progress-fill: linear-gradient(90deg, rgba(var(--splash-accent-rgb),0.25), var(--splash-accent));
  
  /* Spacing scale */
  --splash-spacing-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --splash-spacing-sm: clamp(0.5rem, 1vw, 0.75rem);
  --splash-spacing-md: clamp(0.75rem, 1.5vw, 1.2rem);
  --splash-spacing-lg: clamp(1rem, 2vw, 1.5rem);
  --splash-spacing-xl: clamp(1.5rem, 3vw, 2.25rem);
}

/* Root overlay - Mobile first approach */
.splash-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  min-height: -webkit-fill-available; /* iOS Safari fix */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(0.5rem, 2vw, 2.5rem);
  z-index: 99999;
  isolation: isolate;
  opacity: 1;
  background: radial-gradient(circle at 30% 30%, rgba(var(--splash-accent-rgb),0.18), transparent 60%),
    linear-gradient(135deg, var(--splash-bg-start) 0%, var(--splash-bg-mid) 50%, var(--splash-bg-end) 100%);
  overflow: hidden;
  transition: opacity var(--splash-fade-duration) cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated ambient gradient layer - optimized for mobile */
.splash-overlay::before,
.splash-overlay::after {
  content: "";
  position: absolute;
  inset: -20%;
  background: conic-gradient(from 0deg, rgba(var(--splash-accent-rgb),0.15), transparent 35%, rgba(var(--splash-accent-rgb),0.25) 55%, transparent 75%, rgba(var(--splash-accent-rgb),0.05));
  animation: rotateAmbient 18s linear infinite;
  mix-blend-mode: plus-lighter;
  pointer-events: none;
  opacity: 0.55;
  will-change: transform;
}
.splash-overlay::after {
  animation-direction: reverse;
  animation-duration: 26s;
  filter: blur(clamp(30px, 8vw, 60px)) saturate(140%);
  opacity: 0.35;
}

.splash-overlay .splash-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-conic-gradient(from 45deg, rgba(255,255,255,var(--splash-noise-opacity)) 0deg 2deg, transparent 2deg 4deg);
  mix-blend-mode: overlay;
  animation: grain 700ms steps(6) infinite;
  opacity: var(--splash-noise-opacity);
  z-index: 0;
}

@keyframes grain {
  0% { transform: translate(0,0); }
  25% { transform: translate(-5%, 3%); }
  50% { transform: translate(4%, -4%); }
  75% { transform: translate(-3%, 2%); }
  100% { transform: translate(0,0); }
}

@keyframes rotateAmbient { to { transform: rotate(360deg); } }


.splash-overlay.hide { opacity: 0; pointer-events: none; }

/* Optional glass card wrapper - fully responsive */
.splash-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--splash-spacing-md);
  backdrop-filter: blur(var(--splash-blur)) saturate(140%);
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: var(--splash-border-glow), 0 4px 28px -8px rgba(0,0,0,0.6);
  padding: var(--splash-spacing-xl) var(--splash-spacing-lg);
  border-radius: clamp(16px, 3vw, 28px);
  max-width: var(--splash-card-max-width);
  width: 100%;
  margin: 0 auto;
}

/* Lottie container - responsive sizing */
.splash-lottie { 
  width: clamp(100px, 25vw, 180px); 
  height: clamp(140px, 35vh, 260px); 
  margin-bottom: var(--splash-spacing-xs);
  max-width: 100%;
  aspect-ratio: 9 / 13; /* Maintain proportions */
  object-fit: contain;
}

/* Title hierarchy - fluid typography */
.splash-title {
  color: var(--splash-text);
  font-size: clamp(1.25rem, 4vw + 0.5rem, 2.35rem);
  font-weight: 700;
  letter-spacing: clamp(0.04em, 0.5vw, 0.08em);
  line-height: 1.2;
  margin: 0;
  text-align: center;
  text-shadow: 0 2px clamp(8px, 2vw, 16px) rgba(var(--splash-accent-rgb),0.6);
  font-family: var(--splash-font-stack);
  word-wrap: break-word;
  max-width: 100%;
}

.splash-sub {
  color: var(--splash-accent);
  font-size: clamp(0.75rem, 2vw + 0.25rem, 1.15rem);
  font-weight: 400;
  letter-spacing: clamp(0.04em, 0.5vw, 0.07em);
  line-height: 1.4;
  margin: 0 0 var(--splash-spacing-sm);
  text-align: center;
  text-shadow: 0 2px 8px #000;
  font-family: var(--splash-font-stack);
  opacity: 0.9;
  max-width: 100%;
  word-wrap: break-word;
}

/* Flex layout - responsive stacking */
.splash-flex-row { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  justify-content: center; 
  gap: var(--splash-spacing-md);
  width: 100%;
}
.splash-divider { display: none; }

/* Horizontal layout for larger screens */
@media (min-width: 768px) {
  .splash-card.layout-horizontal .splash-flex-row { 
    flex-direction: row; 
    flex-wrap: nowrap; 
    gap: clamp(1.5rem, 3vw, 2.5rem); 
  }
  .splash-card.layout-horizontal .splash-divider { display: block; }
  .splash-card.layout-horizontal .splash-lottie { margin-bottom: var(--splash-spacing-xs); }
}

/* Divider styling - responsive sizing */
.splash-divider { 
  width: var(--splash-divider-width); 
  height: var(--splash-divider-height); 
  background: linear-gradient(180deg, var(--splash-accent) 0%, #fff 100%); 
  border-radius: clamp(1px, 0.2vw, 2px); 
  box-shadow: 0 0 clamp(8px, 2vw, 16px) clamp(2px, 0.5vw, 4px) rgba(var(--splash-accent-rgb),0.55); 
  animation: divider-glow 1.2s infinite alternate; 
  min-height: 40px; 
  min-width: 2px;
  flex-shrink: 0;
}
@keyframes divider-glow { 
  0% { box-shadow: 0 0 clamp(8px, 2vw, 16px) clamp(2px, 0.5vw, 4px) rgba(var(--splash-accent-rgb),0.55); } 
  100% { box-shadow: 0 0 clamp(16px, 4vw, 32px) clamp(4px, 1vw, 8px) rgba(var(--splash-accent-rgb),0.8); } 
}

/* Typewriter area - responsive container with fluid sizing */
.splash-typewriter-container {
  min-width: clamp(120px, 30vw, 180px);
  min-height: clamp(40px, 10vh, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--splash-font-stack);
  font-size: clamp(1.1rem, 3vw + 0.25rem, 2.1rem);
  color: var(--splash-text);
  letter-spacing: clamp(0.04em, 0.8vw, 0.08em);
  font-weight: 700;
  text-shadow: 0 2px clamp(8px, 2vw, 16px) rgba(var(--splash-accent-rgb),0.6);
  text-align: center;
  word-break: break-word;
  max-width: clamp(280px, 80vw, 600px);
  padding: clamp(0.5rem, 2vw, 1rem);
}
#splash-typewriter { 
  border-right: clamp(2px, 0.3vw, 3px) solid var(--splash-accent); 
  padding-right: clamp(3px, 0.5vw, 6px); 
  white-space: pre; 
  animation: blink-caret 0.7s step-end infinite; 
}
@keyframes blink-caret { 
  0%, 100% { border-color: var(--splash-accent); } 
  50% { border-color: transparent; } 
}

/* Loader (spinner) - responsive sizing */
.splash-loader { 
  border: clamp(2px, 0.4vw, 3px) solid #222; 
  border-top: clamp(2px, 0.4vw, 3px) solid var(--splash-accent); 
  border-radius: 50%; 
  width: clamp(30px, 6vw, 42px); 
  height: clamp(30px, 6vw, 42px); 
  animation: spin 1.1s linear infinite; 
  margin: clamp(0.5rem, 2vh, 1rem) auto 0; 
  flex-shrink: 0;
}
@keyframes spin { 
  to { transform: rotate(360deg); } 
}

/* Progress bar - responsive wrapper with fluid sizing */
.splash-progress-wrapper { 
  position: relative; 
  width: 100%; 
  max-width: clamp(280px, 80vw, 480px); 
  height: var(--splash-progress-height); 
  background: var(--splash-progress-bg); 
  border-radius: 999px; 
  overflow: hidden; 
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08); 
  margin-top: clamp(0.5rem, 2vh, 1rem);
  margin-inline: auto;
}
.splash-progress-bar { 
  position: absolute; 
  inset: 0; 
  width: 0%; 
  background: var(--splash-progress-fill); 
  animation: progressFill 3.2s ease forwards; 
  border-radius: inherit;
}
@keyframes progressFill { 
  0% { width: 0%; } 
  15% { width: 18%; } 
  40% { width: 48%; } 
  70% { width: 76%; } 
  100% { width: 100%; } 
}

/* Skip button - responsive positioning and sizing */
.splash-skip {
  position: absolute;
  top: clamp(0.75rem, 2vh, 1.5rem);
  right: clamp(0.75rem, 2vw, 1.5rem);
  z-index: 3;
  font-family: var(--splash-font-stack);
  font-size: clamp(0.65rem, 1.5vw, 0.8rem);
  text-transform: uppercase;
  letter-spacing: clamp(0.08em, 0.5vw, 0.15em);
  background: rgba(255,255,255,0.07);
  color: var(--splash-text);
  padding: clamp(0.4rem, 1.5vw, 0.6rem) clamp(0.6rem, 2vw, 0.9rem);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: clamp(6px, 1.5vw, 10px);
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(160%);
  transition: background .35s, color .35s, border-color .35s, transform .2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}
.splash-skip:hover { background: rgba(var(--splash-accent-rgb),0.25); border-color: rgba(var(--splash-accent-rgb),0.6); }
.splash-skip:active { transform: translateY(1px); }
.splash-skip:focus-visible { outline: 2px solid var(--splash-accent); outline-offset: 2px; }

/* Fade-in animation for card children */
.splash-card > * { opacity: 0; transform: translateY(12px); animation: fadeUp .7s cubic-bezier(.4,0,.2,1) forwards; }
.splash-card > *:nth-child(1) { animation-delay: .1s; }
.splash-card > *:nth-child(2) { animation-delay: .2s; }
.splash-card > *:nth-child(3) { animation-delay: .3s; }
.splash-card > *:nth-child(4) { animation-delay: .4s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

/* Black intro overlay (kept) */
#black-intro-overlay { position: fixed; inset: 0; width: 100vw; height: 100vh; background: #000; z-index: 100000; opacity: 1; transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; }

/* Responsive adjustments - mobile-first with fluid scaling */
@media (max-width: 900px) {
  .splash-lottie { 
    max-width: clamp(110px, 50vw, 160px); 
    max-height: clamp(150px, 30vh, 220px);
  }
  .splash-card { 
    padding: clamp(1.2rem, 4vw, 1.8rem) clamp(1rem, 3vw, 1.6rem); 
    gap: clamp(0.75rem, 2vw, 1.2rem); 
  }
  .splash-typewriter-container { 
    font-size: clamp(1rem, 4vw + 0.25rem, 1.6rem); 
    max-width: clamp(260px, 85vw, 400px); 
  }
  .splash-card.layout-horizontal .splash-divider { 
    width: clamp(60px, 15vw, 90px); 
    height: clamp(3px, 0.5vw, 4px); 
    background: linear-gradient(90deg, var(--splash-accent) 0%, #fff 100%); 
    margin: clamp(0.5rem, 2vh, 0.9rem) 0; 
  }
  .splash-skip {
    font-size: clamp(0.6rem, 2vw, 0.75rem);
    padding: clamp(0.35rem, 1.5vw, 0.5rem) clamp(0.5rem, 2vw, 0.75rem);
  }
}

@media (max-width: 600px) {
  .splash-overlay { 
    padding: 0 clamp(0.5rem, 2vw, 1rem); 
  }
  .splash-lottie { 
    max-width: clamp(90px, 60vw, 130px); 
    max-height: clamp(120px, 25vh, 180px); 
  }
  .splash-typewriter-container { 
    font-size: clamp(0.85rem, 5vw + 0.15rem, 1.3rem); 
    max-width: clamp(240px, 92vw, 320px); 
    min-width: 0; 
    padding: clamp(0.5rem, 2vw, 0.75rem);
  }
  .splash-divider { 
    width: clamp(50px, 12vw, 70px); 
    height: clamp(2px, 0.4vw, 3px); 
    min-width: 40px; 
    min-height: 2px; 
    margin: clamp(0.4rem, 1.5vh, 0.6rem) 0; 
  }
  .splash-card {
    padding: clamp(1rem, 3vw, 1.5rem) clamp(0.75rem, 2.5vw, 1.2rem);
    gap: clamp(0.6rem, 2vw, 1rem);
  }
  .splash-skip {
    top: clamp(0.5rem, 1.5vh, 0.75rem);
    right: clamp(0.5rem, 1.5vw, 0.75rem);
    font-size: clamp(0.55rem, 2.5vw, 0.7rem);
    padding: clamp(0.3rem, 1.2vw, 0.45rem) clamp(0.45rem, 1.8vw, 0.65rem);
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .splash-overlay::before, .splash-overlay::after, .splash-noise, .splash-card > *, .splash-progress-bar { animation: none !important; }
  .splash-progress-bar { width: 100%; }
}

/* Utility: instantly hide (JS fallback) */
.splash-overlay[data-hidden="true"] { opacity: 0 !important; pointer-events: none !important; }

