/* ====================================================================
   HACKZEN '26 // PREMIUM FUTURISTIC INTRO LOADER
   Theme: Elegant Cyberpunk / Minimal Cinematic Intro
   ==================================================================== */

/* Scroll Lock when Intro is Active */
html.hz-intro-active,
body.hz-intro-active {
  overflow: hidden !important;
  height: 100vh !important;
  touch-action: none !important;
}

/* Main Intro Screen Backdrop */
.hz-intro-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 999999;
  background-color: #040508;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Orbitron', -apple-system, sans-serif;
  color: #ffffff;
  user-select: none;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.8s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.8s ease;
  will-change: opacity, transform, filter;
}

/* Futuristic Grid Overlay */
.hz-intro-bg-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 26, 74, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 26, 74, 0.04) 1px, transparent 1px);
  background-size: 50px 50px;
  background-position: center center;
  pointer-events: none;
  opacity: 0.7;
}

/* Atmospheric Center Glow & Vignette */
.hz-intro-bg-glow {
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle at 50% 50%, rgba(255, 26, 74, 0.08) 0%, rgba(0, 0, 0, 0) 65%),
    radial-gradient(circle at 50% 50%, rgba(255, 61, 85, 0.03) 0%, rgba(0, 0, 0, 0) 80%),
    radial-gradient(ellipse at 50% 0%, rgba(4, 5, 8, 0.4) 0%, rgba(4, 5, 8, 0.95) 100%);
  pointer-events: none;
}

/* Subtle Scanline Overlay */
.hz-intro-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.18) 0px,
    rgba(0, 0, 0, 0.18) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  opacity: 0.6;
  z-index: 2;
}

/* Center Content Stack */
.hz-intro-content {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  max-width: 90vw;
}

/* Title Container */
.hz-intro-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

/* HACKZEN Main Animated Glitch Heading */
.hz-intro-title {
  position: relative;
  font-size: clamp(2.8rem, 8.5vw, 5.8rem);
  font-weight: 900;
  letter-spacing: 0.18em;
  line-height: 1;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 
    0 0 12px rgba(255, 26, 74, 0.5),
    0 0 30px rgba(255, 26, 74, 0.25),
    0 0 50px rgba(255, 26, 74, 0.12);
  margin: 0;
  padding: 0 0.2em;
  animation: hz-glitch-flicker 4s infinite alternate;
}

/* Glitch Pseudo Layers */
.hz-intro-title::before,
.hz-intro-title::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0 0.2em;
  box-sizing: border-box;
  opacity: 0.8;
  pointer-events: none;
}

/* Red Glitch Accent Layer */
.hz-intro-title::before {
  color: #ff3d55;
  text-shadow: -2px 0 #ff3d55;
  zIndex: -1;
  animation: hz-glitch-anim-1 3.2s infinite linear alternate-reverse;
}

/* Neon Lime / Cyan Glitch Accent Layer */
.hz-intro-title::after {
  color: #ff1a4a;
  text-shadow: 2px 0 #ff1a4a;
  zIndex: -2;
  animation: hz-glitch-anim-2 2.7s infinite linear alternate-reverse;
}

/* Year Badge ('26) */
.hz-intro-year {
  font-size: clamp(1.8rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: 0.15em;
  color: #ff1a4a;
  text-shadow: 
    0 0 14px rgba(255, 26, 74, 0.8),
    0 0 35px rgba(255, 26, 74, 0.4);
  margin-top: 0.1rem;
  line-height: 1;
}

/* Widely Spaced Monospace Subtitle */
.hz-intro-subtitle {
  font-family: 'JetBrains Mono', 'Space Grotesk', monospace;
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  font-weight: 500;
  letter-spacing: clamp(0.28em, 0.7vw, 0.55em);
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  margin-top: 1.8rem;
  margin-bottom: 2.2rem;
  white-space: nowrap;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

/* Clean Animated Loading Bar Container */
.hz-intro-progress-box {
  width: clamp(240px, 55vw, 340px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Loading Bar Track */
.hz-intro-progress-track {
  width: 100%;
  height: 4px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  border: 1px solid rgba(255, 26, 74, 0.25);
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.8);
}

/* Loading Bar Fill */
.hz-intro-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff1a4a 0%, #39ff14 100%);
  box-shadow: 
    0 0 12px #ff1a4a,
    0 0 24px rgba(255, 26, 74, 0.6);
  border-radius: 2px;
  transition: width 0.06s linear;
  will-change: width;
}

/* Percentage Font */
.hz-intro-percentage {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  color: #ff1a4a;
  margin-top: 0.75rem;
  text-shadow: 0 0 10px rgba(255, 26, 74, 0.5);
}

/* ====================================================================
   COMPLETION & EXIT TRANSITION ANIMATIONS
   ==================================================================== */

/* Intensified Glow & Flicker State (triggered at 100%) */
.hz-intro-screen.hz-intro-complete .hz-intro-title {
  text-shadow: 
    0 0 25px rgba(255, 26, 74, 1),
    0 0 50px rgba(255, 26, 74, 0.8),
    0 0 80px rgba(255, 26, 74, 0.5);
  animation: hz-intro-finish-pulse 0.4s ease forwards;
}

.hz-intro-screen.hz-intro-complete .hz-intro-year {
  text-shadow: 
    0 0 25px rgba(255, 26, 74, 1),
    0 0 55px rgba(255, 26, 74, 0.8);
}

/* Hidden Transition State */
.hz-intro-screen.hz-intro-hidden {
  opacity: 0;
  transform: scale(1.04);
  filter: blur(6px);
  pointer-events: none !important;
  visibility: hidden;
}

/* ====================================================================
   KEYFRAME ANIMATIONS
   ==================================================================== */

/* Subtle RGB Glitch Layer 1 (Red Shift) */
@keyframes hz-glitch-anim-1 {
  0% {
    clip-path: inset(20% 0 70% 0);
    transform: translate(-2px, 0);
  }
  10% {
    clip-path: inset(50% 0 30% 0);
    transform: translate(1px, -1px);
  }
  20% {
    clip-path: inset(10% 0 80% 0);
    transform: translate(-1px, 1px);
  }
  30% {
    clip-path: inset(80% 0 5% 0);
    transform: translate(2px, 0);
  }
  35%, 100% {
    clip-path: inset(0 100% 0 0);
    transform: translate(0, 0);
  }
}

/* Subtle RGB Glitch Layer 2 (Neon Lime Shift) */
@keyframes hz-glitch-anim-2 {
  0% {
    clip-path: inset(65% 0 15% 0);
    transform: translate(2px, 0);
  }
  12% {
    clip-path: inset(15% 0 65% 0);
    transform: translate(-1px, 1px);
  }
  25% {
    clip-path: inset(40% 0 45% 0);
    transform: translate(1px, -1px);
  }
  32% {
    clip-path: inset(75% 0 10% 0);
    transform: translate(-2px, 0);
  }
  38%, 100% {
    clip-path: inset(0 100% 0 0);
    transform: translate(0, 0);
  }
}

/* Digital Flicker / Glow Fluctuations */
@keyframes hz-glitch-flicker {
  0%, 100% { opacity: 1; }
  41% { opacity: 1; }
  42% { opacity: 0.85; transform: skewX(-0.5deg); }
  43% { opacity: 1; transform: skewX(0deg); }
  85% { opacity: 1; }
  86% { opacity: 0.9; transform: translate(-1px, 0); }
  87% { opacity: 1; transform: translate(0, 0); }
}

/* Brief Finish Flash Pulse */
@keyframes hz-intro-finish-pulse {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.02);
    filter: brightness(1.4);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* ====================================================================
   PREFERS REDUCED MOTION
   ==================================================================== */
@media (prefers-reduced-motion: reduce) {
  .hz-intro-title,
  .hz-intro-title::before,
  .hz-intro-title::after {
    animation: none !important;
  }
  .hz-intro-screen {
    transition: opacity 0.4s ease !important;
  }
}
