/*
  -----------------------------------------------------------------------------
  CINEMATIC VISUAL EFFECTS (VFX)
  -----------------------------------------------------------------------------
  Digital Comp. Department
*/

/* ----------------------------------------------------------------------------
   1. FILM GRAIN OVERLAY
   Uses SVG noise data URI for performance and resolution independence.
   ---------------------------------------------------------------------------- */
.film-grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: var(--z-lens-fx);
    opacity: var(--film-grain-opacity);
    /* Pure CSS noise generator pattern */
    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)' opacity='1'/%3E%3C/svg%3E");
    mix-blend-mode: overlay;
    /* Grain Dance Animation */
    animation: grain-dance 8s steps(10) infinite;
}

@keyframes grain-dance {

    0%,
    100% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-5%, -5%);
    }

    20% {
        transform: translate(-10%, 5%);
    }

    30% {
        transform: translate(5%, -10%);
    }

    40% {
        transform: translate(-5%, 15%);
    }

    50% {
        transform: translate(-10%, 5%);
    }

    60% {
        transform: translate(15%, 0);
    }

    70% {
        transform: translate(0, 10%);
    }

    80% {
        transform: translate(-15%, 0);
    }

    90% {
        transform: translate(10%, 5%);
    }
}

/* ----------------------------------------------------------------------------
   2. VIGNETTE & LENS
   ---------------------------------------------------------------------------- */
.vignette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: var(--z-lens-fx);
    background: var(--vignette-strength);
    /* Smooth edges */
    box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.5);
}

/* ----------------------------------------------------------------------------
   3. ANIMATION UTILITIES
   ---------------------------------------------------------------------------- */

/* Fade Up (The standard entrance) */
.cinema-fade-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fade-up-anim var(--duration-fade) var(--ease-cinema) forwards;
}

@keyframes fade-up-anim {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slow Dolly Reveal (Zoom out slightly) */
.cinema-dolly-in {
    opacity: 0;
    transform: scale(0.95);
    animation: dolly-in-anim var(--duration-reveal) var(--ease-drama) forwards;
}

@keyframes dolly-in-anim {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Text Reveal (Clip path wipe) */
.cinema-text-wipe {
    clip-path: polygon(0 0, 0 100%, 0 100%, 0 0);
    animation: wipe-right var(--duration-cut) var(--ease-cinema) forwards;
}

@keyframes wipe-right {
    to {
        clip-path: polygon(0 0, 0 100%, 100% 100%, 100% 0);
    }
}

/* ----------------------------------------------------------------------------
   4. FOCUS & BLUR
   ---------------------------------------------------------------------------- */
.blur-backdrop {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.focus-isolation:hover {
    z-index: var(--z-prop);
}

.dim-surroundings {
    transition: opacity var(--duration-cut) var(--ease-cinema);
}

body:has(.focus-isolation:hover) .dim-surroundings:not(:hover) {
    opacity: 0.4;
    filter: blur(2px);
    transition: opacity var(--duration-cut) var(--ease-cinema), filter var(--duration-cut) var(--ease-cinema);
}

/* ----------------------------------------------------------------------------
   5. SCANLINES (Retro-Futurism optional)
   ---------------------------------------------------------------------------- */
.scanlines {
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0),
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.1) 50%,
            rgba(0, 0, 0, 0.1));
    background-size: 100% 4px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: var(--z-overlay);
    mix-blend-mode: overlay;
    opacity: 0.3;
}