/* =========================================
   hero-enhanced.css — Hero Cinematic FX Layer
   OWNS:    Grain overlay, atmospheric drifting orbs, panel shimmer and texture,
            one-time panel sweep animation, hero button transition override,
            --hero-glow-primary / --hero-glow-secondary custom properties.
   MAY OVERRIDE: hero.css panel backdrop-filter and border (via !important on
                 .hero-home__panel--enhanced — intentional; see comment at that rule).
   MUST NOT DEFINE: Structural layout, hero copy styles, dock/control styles,
                    or any rule that applies outside the hero section.
   ========================================= */

/* Custom properties for ambient glows and consistent theming */
:root {
  --hero-glow-primary: rgba(var(--scene-accent-rgb, 34, 211, 238), 0.14);
  --hero-glow-secondary: rgba(var(--scene-accent-rgb, 124, 58, 237), 0.08);
}

/* 1. Cinematic Grain Overlay */
.hero-enhanced-fx {
  position: absolute;
  inset: 0;
  z-index: 5; /* Ensures grain is above background image but below main content */
  pointer-events: none; /* Ensure it doesn't block interaction */
  overflow: hidden;
}

.hero-enhanced-fx__grain {
  position: absolute;
  inset: -50%;
  width: 200%;
  height: 200%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3e%3Cfilter id='noiseFilter'%3e%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3e%3C/filter%3e%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3e%3C/svg%3e");
  opacity: 0.035; 
  animation: grain-shift 8s steps(10) infinite;
}

@keyframes grain-shift {
  0%, 100% { transform: translate(0, 0); }
  10% { transform: translate(-2%, -5%); }
  30% { transform: translate(2%, -8%); }
  50% { transform: translate(5%, 4%); }
  70% { transform: translate(-4%, 2%); }
  90% { transform: translate(1%, -2%); }
}

/* 2. Atmospheric Drifting Light Leaks */
.hero-home--enhanced::before,
.hero-home--enhanced::after {
  content: "";
  position: absolute;
  width: 70vw;
  height: 70vw;
  border-radius: 50%;
  filter: blur(110px);
  z-index: 2; /* Below text, above background image */
  pointer-events: none;
  opacity: 0.18; /* Reduced: softer ambient atmosphere, not a dominant feature */
  mix-blend-mode: screen;
}

.hero-home--enhanced::before {
  top: -15%;
  left: -10%;
  background: radial-gradient(circle, var(--hero-glow-primary), transparent 70%);
  animation: drift-slow 28s ease-in-out infinite alternate; /* Slower drift */
}

.hero-home--enhanced::after {
  bottom: -12%; /* Slightly lower */
  right: -5%;
  background: radial-gradient(circle, var(--hero-glow-secondary), transparent 70%);
  animation: drift-slow 24s ease-in-out infinite alternate-reverse; /* Slower drift */
}

@keyframes drift-slow {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(8%, 12%) scale(1.15); }
}

/* 3. Premium Glass Panel Shimmer & Texture */
.hero-home__panel--enhanced {
  overflow: hidden;
  border: 1px solid rgba(148, 190, 255, 0.08) !important;
  -webkit-backdrop-filter: blur(var(--blur-panel-elevated)) saturate(var(--sat-panel-enhanced)) !important;
  backdrop-filter: blur(var(--blur-panel-elevated)) saturate(var(--sat-panel-enhanced)) !important;
  isolation: isolate;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.82), rgba(8, 12, 31, 0.88)) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 52px rgba(0, 0, 0, 0.34),
    0 0 50px rgba(var(--scene-accent-rgb, 56, 189, 248), 0.06) !important;
}

.hero-home__panel--enhanced:hover {
  -webkit-backdrop-filter: blur(var(--blur-panel-hero-hover)) saturate(var(--sat-panel-hero-hover)) !important;
  backdrop-filter: blur(var(--blur-panel-hero-hover)) saturate(var(--sat-panel-hero-hover)) !important;
}

/* Ensure text and content stay above the texture and shimmer layers */
.hero-home__panel--enhanced > * {
  position: relative;
  z-index: 3;
}

/* Shimmer Sweep Layer */
.hero-home__panel--enhanced::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    105deg,
    transparent 20%,
    rgba(255, 255, 255, 0.03) 45%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.03) 55%,
    transparent 80%
  );
  background-size: 200% 100%;
  background-position: 150% 0;
  animation: shimmer-sweep 28s infinite;
  pointer-events: none;
}

/* Subtle Animated SVG Glass Texture Overlay */
.hero-home__panel--enhanced::after {
  content: "";
  position: absolute;
  inset: -10%; /* Oversized for drift animation margin */
  z-index: 1; /* Sits between element background and content */
  pointer-events: none;
  opacity: 0.035; /* Extremely subtle cinematic grain */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3e%3Cfilter id='noiseFilter'%3e%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3e%3C/filter%3e%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3e%3C/svg%3e");
  animation: panel-texture-drift 18s steps(8) infinite;
}

@keyframes shimmer-sweep {
  0% { background-position: 150% 0; }
  15% { background-position: -50% 0; }
  100% { background-position: -50% 0; }
}
 
@keyframes panel-texture-drift {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-1%, -1.5%); }
  40% { transform: translate(1.5%, 0.5%); }
  60% { transform: translate(-0.5%, 1.5%); }
  80% { transform: translate(1%, -1%); }
}

/* 3.5. One-time Transition Sweep */
.hero-home__panel-sweep {
  position: absolute;
  inset: 0;
  z-index: 2; /* Sits above texture, aligned with shimmer */
  pointer-events: none;
  background: linear-gradient(
    110deg,
    transparent 35%,
    rgba(255, 255, 255, 0.15) 49%,
    rgba(255, 255, 255, 0.28) 50%,
    rgba(255, 255, 255, 0.15) 51%,
    transparent 65%
  );
  background-size: 200% 100%;
  background-position: 160% 0;
  opacity: 0;
}

.is-sweeping .hero-home__panel-sweep {
  opacity: 1;
  /* Delay added to align sweep with the start of the image crossfade (~0.3s after transitionStart) */
  animation: panel-sweep-effect 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
}

@keyframes panel-sweep-effect {
  0% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}

/* 4. Enhanced Button & Dock Polish */
.hero-home__actions .button {
  transition: transform 260ms ease, border-color 260ms ease, background 260ms ease, color 260ms ease, box-shadow 260ms ease;
}

.hero-home__actions .button:active {
  transform: translateY(0.5px) scale(0.984);
  transition-property: transform;
  transition-duration: 80ms;
}

/* 5. Mobile Safety: Disable heavy effects on smaller screens */
@media (max-width: 1023px) { /* Use 1023px to match common desktop breakpoint */
  .hero-home--enhanced::before,
  .hero-home--enhanced::after {
    display: none;
  }
}