/* ═══════════════════════════════════════
   35mm FILM LIGHT LEAK & PRISM OVERLAY
   Organic · Turbulence · Grain
   ═══════════════════════════════════════ */

/* Fade the hero light-leak layers out toward the bottom so their edge is never
   visible as a hard seam where the hero meets the next section. */
.light-leak-overlay,
.light-leak-spots,
.light-leak-turbulence {
  -webkit-mask-image: linear-gradient(to bottom, #000 55%, rgba(0, 0, 0, 0) 92%);
          mask-image: linear-gradient(to bottom, #000 55%, rgba(0, 0, 0, 0) 92%);
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
          mask-size: 100% 100%;
}

.light-leak-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: screen;
  overflow: hidden;
}

/* ─── PRIMARY LIGHT BURNS (intensified + softer/blurrier edges) ─── */
.light-leak-overlay::before {
  content: '';
  position: absolute;
  inset: -50%;
  animation: lightLeakDrift 40s ease-in-out infinite alternate;
  background:
    /* Hot orange/red burn — bottom-left corner — extremely diffuse */
    radial-gradient(ellipse 100% 90% at 5% 95%,
      rgba(255, 50, 0, 1) 0%,
      rgba(255, 65, 5, 0.82) 3%,
      rgba(255, 80, 10, 0.65) 7%,
      rgba(255, 90, 15, 0.5) 12%,
      rgba(240, 75, 12, 0.38) 18%,
      rgba(220, 60, 15, 0.27) 25%,
      rgba(190, 45, 25, 0.18) 33%,
      rgba(160, 35, 35, 0.11) 42%,
      rgba(130, 20, 40, 0.06) 52%,
      rgba(100, 10, 40, 0.02) 65%,
      transparent 80%
    ),
    /* Deep purple/violet haze — upper-left — massive soft wash */
    radial-gradient(ellipse 100% 95% at 10% 5%,
      rgba(80, 20, 180, 0.7) 0%,
      rgba(85, 22, 185, 0.55) 5%,
      rgba(90, 25, 190, 0.42) 12%,
      rgba(85, 22, 175, 0.3) 22%,
      rgba(70, 18, 155, 0.2) 33%,
      rgba(55, 12, 130, 0.12) 45%,
      rgba(40, 8, 100, 0.05) 60%,
      transparent 78%
    ),
    /* Rainbow prism arc — top-right corner — wide glow */
    radial-gradient(ellipse 80% 80% at 93% 3%,
      rgba(100, 220, 255, 0.5) 0%,
      rgba(80, 235, 200, 0.38) 6%,
      rgba(60, 250, 160, 0.28) 14%,
      rgba(120, 255, 100, 0.2) 24%,
      rgba(200, 240, 60, 0.14) 35%,
      rgba(255, 200, 50, 0.09) 47%,
      rgba(255, 140, 25, 0.05) 60%,
      rgba(255, 80, 0, 0.02) 73%,
      transparent 87%
    ),
    /* Green-yellow-rainbow bleed — bottom-right — ultra wide */
    radial-gradient(ellipse 85% 80% at 96% 92%,
      rgba(80, 255, 30, 0.6) 0%,
      rgba(110, 255, 10, 0.45) 6%,
      rgba(150, 255, 0, 0.33) 14%,
      rgba(200, 240, 0, 0.23) 24%,
      rgba(255, 200, 0, 0.15) 36%,
      rgba(255, 140, 0, 0.08) 50%,
      rgba(255, 80, 20, 0.03) 65%,
      transparent 82%
    ),
    /* Magenta flare — mid-left — very soft halo */
    radial-gradient(ellipse 70% 85% at 2% 50%,
      rgba(255, 20, 70, 0.55) 0%,
      rgba(240, 18, 75, 0.4) 8%,
      rgba(215, 14, 82, 0.28) 18%,
      rgba(180, 10, 75, 0.17) 30%,
      rgba(140, 8, 60, 0.09) 45%,
      rgba(100, 5, 45, 0.03) 62%,
      transparent 80%
    ),
    /* Warm amber wash — bottom edge — ultra-diffuse blanket */
    radial-gradient(ellipse 120% 60% at 45% 100%,
      rgba(255, 120, 0, 0.4) 0%,
      rgba(255, 105, 8, 0.3) 8%,
      rgba(250, 90, 12, 0.2) 18%,
      rgba(235, 75, 15, 0.12) 30%,
      rgba(210, 60, 12, 0.06) 45%,
      rgba(180, 45, 10, 0.02) 60%,
      transparent 78%
    );
}

/* ─── PRISM / CHROMATIC ABERRATION (soft, blurred transitions) ─── */
.light-leak-overlay::after {
  content: '';
  position: absolute;
  inset: -20%;
  opacity: 0.1;
  animation: prismShift 45s linear infinite;
  background:
    /* Diagonal prism refraction — smooth blended colors */
    linear-gradient(
      45deg,
      rgba(255, 0, 0, 0.5) 0%,
      rgba(255, 80, 0, 0.45) 10%,
      rgba(255, 160, 0, 0.4) 18%,
      rgba(255, 230, 0, 0.35) 26%,
      rgba(180, 255, 0, 0.3) 34%,
      rgba(0, 255, 80, 0.3) 42%,
      rgba(0, 220, 180, 0.3) 50%,
      rgba(0, 150, 255, 0.35) 58%,
      rgba(0, 80, 255, 0.4) 66%,
      rgba(60, 0, 255, 0.4) 74%,
      rgba(120, 0, 255, 0.35) 82%,
      rgba(180, 0, 220, 0.3) 90%,
      rgba(200, 0, 180, 0.25) 100%
    ),
    /* Curved rainbow arc — top-right — also softened */
    radial-gradient(ellipse 90% 90% at 100% 0%,
      transparent 25%,
      rgba(255, 0, 50, 0.15) 38%,
      rgba(255, 100, 0, 0.12) 44%,
      rgba(255, 200, 0, 0.1) 50%,
      rgba(100, 255, 50, 0.1) 56%,
      rgba(0, 180, 255, 0.12) 62%,
      rgba(80, 0, 255, 0.1) 68%,
      transparent 80%
    );
  background-size: 400% 400%;
}

/* ─── HEAVY GRAIN & DUST LAYER ─── */
.light-leak-grain {
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  opacity: 0.5;
  animation: grainShift 0.8s steps(3) infinite;
}

.light-leak-grain::before {
  content: '';
  position: absolute;
  inset: 0;
  /* No CSS pattern grain — relying on SVG feTurbulence for true noise */
}

/* Dust specks only — no scratches */
.light-leak-grain::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.2;
  animation: dustDrift 40s linear infinite;
  background:
    /* Scattered dust particles */
    radial-gradient(circle 1.5px at 8% 12%, rgba(255,255,255,0.7) 0%, transparent 100%),
    radial-gradient(circle 1px at 15% 28%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 2px at 22% 55%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(circle 1px at 5% 72%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 33% 18%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 1px at 42% 42%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(circle 2px at 48% 68%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(circle 1px at 55% 8%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 60% 35%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 1px at 65% 78%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(circle 2px at 72% 22%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 1px at 78% 50%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 82% 85%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(circle 1px at 88% 15%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 2px at 92% 62%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(circle 1px at 95% 38%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(circle 1px at 18% 90%, rgba(255,255,255,0.35) 0%, transparent 100%),
    radial-gradient(circle 1.5px at 37% 82%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(circle 1px at 50% 95%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(circle 2px at 75% 5%, rgba(255,255,255,0.4) 0%, transparent 100%);
}

/* ─── TURBULENCE / ORGANIC MOVEMENT (intensified) ─── */
.light-leak-turbulence {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.8;
  animation: turbulencePulse 40s ease-in-out infinite alternate;
}

.light-leak-turbulence::before {
  content: '';
  position: absolute;
  inset: -30%;
  animation: turbulenceDrift 60s ease-in-out infinite;
  background:
    /* Organic blob shapes that simulate turbulence */
    radial-gradient(ellipse 25% 35% at 20% 80%,
      rgba(255, 80, 0, 0.5) 0%,
      rgba(255, 40, 20, 0.25) 40%,
      transparent 70%
    ),
    radial-gradient(ellipse 30% 20% at 75% 20%,
      rgba(50, 100, 200, 0.35) 0%,
      rgba(80, 50, 180, 0.2) 40%,
      transparent 65%
    ),
    radial-gradient(ellipse 20% 30% at 60% 70%,
      rgba(255, 150, 0, 0.3) 0%,
      rgba(200, 80, 0, 0.15) 45%,
      transparent 70%
    ),
    radial-gradient(ellipse 35% 25% at 40% 30%,
      rgba(120, 0, 200, 0.25) 0%,
      rgba(80, 0, 150, 0.1) 50%,
      transparent 70%
    );
}

.light-leak-turbulence::after {
  content: '';
  position: absolute;
  inset: -20%;
  animation: turbulenceDrift2 50s ease-in-out infinite reverse;
  background:
    radial-gradient(ellipse 40% 30% at 10% 40%,
      rgba(255, 50, 100, 0.35) 0%,
      rgba(200, 30, 80, 0.15) 45%,
      transparent 70%
    ),
    radial-gradient(ellipse 25% 40% at 85% 65%,
      rgba(0, 200, 150, 0.3) 0%,
      rgba(0, 150, 100, 0.12) 40%,
      transparent 65%
    ),
    radial-gradient(ellipse 30% 35% at 50% 10%,
      rgba(100, 50, 200, 0.2) 0%,
      rgba(60, 20, 150, 0.08) 50%,
      transparent 70%
    );
}

/* ─── SPOTTY WHITE LIGHT LEAKS WITH CHROMATIC ABERRATION ─── */
.light-leak-spots {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  mix-blend-mode: screen;
  animation: spotsTwinkle 25s ease-in-out infinite;
}

.light-leak-spots::before {
  content: '';
  position: absolute;
  inset: -10%;
  animation: spotsDrift 60s ease-in-out infinite, spotsRotate 90s linear infinite;
  background:
    /* Spot 1 — oblong, tilted, red/cyan fringe — extended falloff */
    radial-gradient(ellipse 18% 10% at 18% 15%,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(255, 255, 255, 0.7) 5%,
      rgba(255, 230, 220, 0.5) 12%,
      rgba(255, 180, 160, 0.3) 20%,
      rgba(255, 100, 80, 0.15) 30%,
      rgba(200, 50, 100, 0.08) 40%,
      rgba(0, 200, 255, 0.05) 52%,
      rgba(0, 100, 200, 0.02) 65%,
      transparent 80%
    ),
    /* Spot 2 — tall narrow, blue/magenta fringe */
    radial-gradient(ellipse 7% 16% at 78% 45%,
      rgba(255, 255, 255, 0.9) 0%,
      rgba(255, 255, 255, 0.65) 6%,
      rgba(230, 230, 255, 0.45) 14%,
      rgba(180, 180, 255, 0.28) 22%,
      rgba(120, 80, 255, 0.15) 32%,
      rgba(200, 50, 220, 0.08) 44%,
      rgba(255, 50, 180, 0.03) 58%,
      transparent 75%
    ),
    /* Spot 3 — wide flat, green/red split */
    radial-gradient(ellipse 14% 6% at 45% 75%,
      rgba(255, 255, 255, 1) 0%,
      rgba(255, 255, 250, 0.75) 5%,
      rgba(255, 250, 220, 0.5) 12%,
      rgba(255, 240, 180, 0.3) 22%,
      rgba(200, 255, 120, 0.15) 34%,
      rgba(0, 255, 120, 0.08) 46%,
      rgba(255, 0, 80, 0.04) 60%,
      transparent 78%
    ),
    /* Spot 4 — irregular tall, magenta/blue edge */
    radial-gradient(ellipse 5% 13% at 8% 60%,
      rgba(255, 255, 255, 1) 0%,
      rgba(255, 255, 255, 0.75) 5%,
      rgba(255, 240, 255, 0.5) 12%,
      rgba(255, 200, 240, 0.3) 22%,
      rgba(255, 100, 220, 0.15) 34%,
      rgba(200, 0, 255, 0.07) 48%,
      rgba(0, 80, 255, 0.03) 62%,
      transparent 80%
    );
}

.light-leak-spots::after {
  content: '';
  position: absolute;
  inset: -10%;
  animation: spotsDrift2 50s ease-in-out infinite reverse, spotsRotate2 75s linear infinite reverse;
  background:
    /* Spot 5 — wide squashed with violet/teal prism edge */
    radial-gradient(ellipse 20% 8% at 72% 18%,
      rgba(255, 255, 255, 0.85) 0%,
      rgba(255, 255, 255, 0.6) 6%,
      rgba(250, 240, 255, 0.4) 14%,
      rgba(230, 200, 255, 0.25) 24%,
      rgba(180, 100, 255, 0.12) 36%,
      rgba(100, 50, 220, 0.06) 50%,
      rgba(0, 180, 200, 0.03) 65%,
      transparent 82%
    );
}

@keyframes spotsTwinkle {
  0% { opacity: 0.3; }
  8% { opacity: 0.6; }
  15% { opacity: 0.2; }
  22% { opacity: 0.55; }
  30% { opacity: 0.15; }
  40% { opacity: 0.7; }
  48% { opacity: 0.25; }
  55% { opacity: 0.5; }
  65% { opacity: 0.1; }
  72% { opacity: 0.6; }
  80% { opacity: 0.35; }
  88% { opacity: 0.65; }
  95% { opacity: 0.2; }
  100% { opacity: 0.3; }
}

@keyframes spotsDrift {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(1.5%, -1%) scale(1.02); }
  66% { transform: translate(-1%, 1.5%) scale(0.98); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes spotsDrift2 {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(-1%, 0.8%) scale(1.01); }
  66% { transform: translate(0.8%, -1%) scale(0.99); }
  100% { transform: translate(0, 0) scale(1); }
}

@keyframes spotsRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes spotsRotate2 {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   KEYFRAME ANIMATIONS
   ═══════════════════════════════════════ */

/* Light burns — slow, subtle drift */
@keyframes lightLeakDrift {
  0% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 0.7;
  }
  20% {
    transform: translate(1.5%, -1%) scale(1.02) rotate(0.2deg);
    opacity: 0.85;
  }
  40% {
    transform: translate(-1%, 1.5%) scale(1.04) rotate(-0.1deg);
    opacity: 0.6;
  }
  60% {
    transform: translate(0.5%, 0.5%) scale(1.01) rotate(0.1deg);
    opacity: 0.8;
  }
  80% {
    transform: translate(-0.5%, -1%) scale(1.03) rotate(-0.15deg);
    opacity: 0.7;
  }
  100% {
    transform: translate(0.5%, -0.5%) scale(1.02) rotate(0.05deg);
    opacity: 0.75;
  }
}

/* Prism band slowly sweeps */
@keyframes prismShift {
  0% {
    background-position: 0% 0%;
    transform: rotate(0deg);
  }
  25% {
    background-position: 50% 100%;
  }
  50% {
    background-position: 100% 50%;
    transform: rotate(1deg);
  }
  75% {
    background-position: 50% 0%;
  }
  100% {
    background-position: 0% 0%;
    transform: rotate(0deg);
  }
}

/* Grain jitter — slow, organic shift */
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-1px, 1px); }
  66% { transform: translate(1px, -1px); }
  100% { transform: translate(0, 0); }
}

/* Dust slowly drifts down */
@keyframes dustDrift {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

/* Turbulence — slow organic swell (intensified range) */
@keyframes turbulencePulse {
  0% { opacity: 0.6; }
  30% { opacity: 0.9; }
  60% { opacity: 0.55; }
  100% { opacity: 0.85; }
}

/* Turbulence blobs drift — slow */
@keyframes turbulenceDrift {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(2%, -1.5%) scale(1.05) rotate(0.5deg); }
  66% { transform: translate(-1.5%, 2%) scale(0.97) rotate(-0.5deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes turbulenceDrift2 {
  0% { transform: translate(0, 0) scale(1) rotate(0deg); }
  33% { transform: translate(-1.5%, 1%) scale(1.03) rotate(-0.3deg); }
  66% { transform: translate(1%, -1.5%) scale(0.96) rotate(0.4deg); }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

/* ─── SVG NOISE GRAIN (true Perlin noise / traditional film grain) ─── */
.light-leak-svg-grain {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  pointer-events: none;
  opacity: 0.18;
  mix-blend-mode: overlay;
  animation: grainShift 0.8s steps(3) infinite;
}

/* Second coarser noise — adds warmth and larger texture variation */
.light-leak-svg-grain--coarse {
  opacity: 0.1;
  mix-blend-mode: soft-light;
  animation: grainShift 1.2s steps(2) infinite reverse;
}
