/**
 * FFM Pitch Hero - Scroll-Driven Transition Component
 *
 * Hero section transitioning from real pitch photo to digital tactical field.
 * Use for: Landing page hero with immersive scroll experience.
 *
 * Location: static/css/bookings/ffm-pitch.css
 *
 * Architecture: JS-driven CSS custom properties
 * - CSS custom properties updated via JS on scroll
 * - Why JS over CSS scroll-driven animations: Safari has no support,
 *   Chrome implementation proved unreliable in Django template context
 *
 * CSS Techniques:
 * - CSS custom properties for JS↔CSS state communication
 * - calc() with custom properties for dynamic transforms
 * - Pseudo-elements (::before, ::after) for layered backgrounds
 * - filter stacking for photo treatment
 * - CSS transitions for smooth interpolation
 *
 * Dependencies:
 * - JS: static/js/ffm-pitch.js (updates --scroll-progress, --photo-opacity, etc.)
 * - SVG: templates/bookings/partials/_tactical_pitch_hero.svg
 * - Brand: static/css/ffm-brand.css (loads first, defines .ffm-hero base)
 *
 * Custom Properties (set by JS):
 * - --scroll-progress: 0-1, scroll position ratio
 * - --photo-opacity: 1-0, photo background fade
 * - --digital-opacity: 0-1, digital pitch fade-in
 * - --arrow-1-opacity: 0-1, first arrow fade (30% scroll)
 * - --arrow-2-opacity: 0-1, second arrow fade (60% scroll)
 */

:root {
    --scroll-progress: 0;
    --photo-opacity: 1;
    --digital-opacity: 0;
    --arrow-1-opacity: 0;
    --arrow-2-opacity: 0;
}

/* Hero section must have position relative for absolute children */
.ffm-hero {
    overflow: hidden;
}

/* Real Pitch Photo Background - Right 40% */
.ffm-hero::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background-image: url("/static/images/svu.4bd72138b097.webp");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter:
        brightness(1.15)
        contrast(1.2)
        saturate(1.3)
        hue-rotate(-10deg);
    opacity: var(--photo-opacity, 1);
    z-index: -1;
    transition: opacity 0.6s ease-out;
}

/* Gradient overlay blending photo into dark theme */
.ffm-hero::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background: linear-gradient(
        to left,
        rgba(13, 17, 23, 0) 0%,
        rgba(13, 17, 23, 0.4) 70%,
        rgba(13, 17, 23, 0.9) 100%
    );
    z-index: -1;
    opacity: var(--photo-opacity, 1);
    transition: opacity 0.6s ease-out;
}

/* Digital Tactical Pitch Container - crosses 40% barrier at 50% */
.ffm-pitch-digital {
    position: absolute;
    top: 0;
    right: 0;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    opacity: var(--digital-opacity, 0);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-out;
}

/* SVG pitch with rotation from -45deg to 0deg */
.ffm-pitch-digital svg {
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 900px;
    transform: rotate(calc(-45deg + var(--scroll-progress, 0) * 45deg));
    transition: transform 0.6s ease-out;
    filter: drop-shadow(0 0 40px rgba(29, 185, 84, 0.5));
}

/* Grid background for digital pitch */
.ffm-pitch-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(0deg, rgba(29, 185, 84, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(29, 185, 84, 0.08) 1px, transparent 1px);
    background-size: 30px 30px;
    opacity: 0.4;
}

/* Floating particles */
.ffm-particles {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
    opacity: var(--digital-opacity, 0);
    transition: opacity 0.8s ease-out;
}

.ffm-particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(29, 185, 84, 0.8);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(29, 185, 84, 0.6);
    animation: particleFloat 8s ease-in-out infinite;
}

.ffm-particle:nth-child(1) { left: 45%; top: 20%; animation-delay: 0s; }
.ffm-particle:nth-child(2) { left: 48%; top: 80%; animation-delay: 1.5s; }
.ffm-particle:nth-child(3) { left: 52%; top: 40%; animation-delay: 3s; }
.ffm-particle:nth-child(4) { left: 55%; top: 60%; animation-delay: 2s; }
.ffm-particle:nth-child(5) { left: 60%; top: 30%; animation-delay: 0.8s; }
.ffm-particle:nth-child(6) { left: 65%; top: 70%; animation-delay: 4s; }
.ffm-particle:nth-child(7) { left: 70%; top: 50%; animation-delay: 1.2s; }
.ffm-particle:nth-child(8) { left: 75%; top: 25%; animation-delay: 3.5s; }
.ffm-particle:nth-child(9) { left: 80%; top: 85%; animation-delay: 2.5s; }
.ffm-particle:nth-child(10) { left: 85%; top: 45%; animation-delay: 1s; }

@keyframes particleFloat {
    0%, 100% {
        transform: translateY(0px) scale(1);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-30px) scale(1.2);
        opacity: 1;
    }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .ffm-hero::before,
    .ffm-hero::after,
    .ffm-pitch-digital {
        width: 50%;
    }
}

@media (max-width: 768px) {
    .ffm-hero::before,
    .ffm-hero::after {
        width: 100%;
        opacity: calc(var(--photo-opacity, 1) * 0.3);
    }

    .ffm-pitch-digital {
        width: 100%;
        padding: 2rem;
    }
}
