/**
 * LOCATION STUDIO — Scroll Animations & 3D Depth System
 * ═══════════════════════════════════════════════════════
 * Intersection Observer–driven reveals with cinematic depth.
 * No external libraries. Pure CSS + JS.
 */

/* ─── 3D Perspective on main content only (not body — breaks position:fixed lightbox) ─── */
main {
    perspective: 1200px;
    perspective-origin: 50% 50%;
}

/* ─── Base: hidden state for all animated elements ─── */
[data-anim] {
    opacity: 0;
    will-change: transform, opacity;
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Once visible */
[data-anim].is-visible {
    opacity: 1;
    transform: none !important;
}

/* ─── Reveal Variants ─── */

/* Fade up (default) */
[data-anim="fade-up"] {
    transform: translateY(60px) translateZ(-30px);
}

/* Fade up shorter distance */
[data-anim="fade-up-sm"] {
    transform: translateY(30px);
}

/* Fade from left */
[data-anim="fade-left"] {
    transform: translateX(-80px) rotateY(4deg);
}

/* Fade from right */
[data-anim="fade-right"] {
    transform: translateX(80px) rotateY(-4deg);
}

/* Scale up from center */
[data-anim="zoom-in"] {
    transform: scale(0.85) translateZ(-50px);
}

/* Rise with 3D tilt */
[data-anim="rise-3d"] {
    transform: translateY(80px) rotateX(8deg) translateZ(-40px);
    transform-origin: bottom center;
}

/* Flip in from bottom */
[data-anim="flip-up"] {
    transform: translateY(40px) rotateX(15deg);
    transform-origin: bottom center;
    transition-duration: 0.9s;
}

/* Slide in scale */
[data-anim="slide-scale"] {
    transform: translateY(50px) scale(0.92);
}

/* ─── Stagger Delays for Grid Children ─── */
[data-anim-stagger] > *:nth-child(1) { transition-delay: 0s; }
[data-anim-stagger] > *:nth-child(2) { transition-delay: 0.12s; }
[data-anim-stagger] > *:nth-child(3) { transition-delay: 0.24s; }
[data-anim-stagger] > *:nth-child(4) { transition-delay: 0.36s; }
[data-anim-stagger] > *:nth-child(5) { transition-delay: 0.48s; }
[data-anim-stagger] > *:nth-child(6) { transition-delay: 0.60s; }

/* ─── 3D Tilt on Hover (Cards) ─── */
.tilt-3d {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.tilt-3d:hover {
    transform: translateY(-6px) rotateX(2deg) rotateY(-2deg) scale(1.02);
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(230, 0, 0, 0.06);
}

/* ─── 3D Depth Float for Photos ─── */
.depth-float {
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.5s ease;
    transform-style: preserve-3d;
}

.depth-float:hover {
    transform: translateZ(20px) translateY(-8px) scale(1.03);
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(230, 0, 0, 0.1);
}

/* ─── Parallax Layers ─── */
[data-parallax] {
    will-change: transform;
    transition: transform 0.1s linear;
}

/* ─── Hero Entrance ─── */
.hero-content [data-anim="hero-title"] {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation: heroReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.2s forwards;
}

.hero-content [data-anim="hero-sub"] {
    opacity: 0;
    transform: translateY(30px);
    animation: heroReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.5s forwards;
}

.hero-content [data-anim="hero-cta"] {
    opacity: 0;
    transform: translateY(20px);
    animation: heroReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.8s forwards;
}

@keyframes heroReveal {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ─── Hall Hero (sub-pages) ─── */
.hall-hero [data-anim="hero-title"] {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    animation: heroReveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) 0.15s forwards;
}

.hall-hero [data-anim="hero-sub"],
.hall-hero .hall-subtitle {
    opacity: 0;
    transform: translateY(30px);
    animation: heroReveal 1s cubic-bezier(0.16, 1, 0.3, 1) 0.4s forwards;
}

.hall-hero .hall-description {
    opacity: 0;
    transform: translateY(25px);
    animation: heroReveal 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.55s forwards;
}

.hall-hero .btn-primary {
    opacity: 0;
    transform: translateY(20px);
    animation: heroReveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.75s forwards;
}

/* ─── Glow pulse on section headings ─── */
[data-anim].is-visible .accent {
    animation: accentGlow 2s ease-in-out 0.5s;
}

@keyframes accentGlow {
    0%, 100% { text-shadow: none; }
    50% { text-shadow: 0 0 30px rgba(230, 0, 0, 0.35), 0 0 60px rgba(230, 0, 0, 0.15); }
}

/* ─── Reportage photo depth ─── */
.rp-photo {
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.5s ease;
}

.rp-photo:hover {
    transform: translateZ(15px) translateY(-5px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

/* ─── Button hover depth ─── */
.btn-primary {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-3px) translateZ(10px);
    box-shadow: 0 15px 40px rgba(230, 0, 0, 0.3);
}

/* ─── Video card 3D hover ─── */
.gallery-item--video {
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease, border-color 0.4s ease;
}

.gallery-item--video:hover {
    transform: translateY(-8px) rotateX(2deg) translateZ(15px);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4), 0 0 30px rgba(230, 0, 0, 0.08);
}

/* ─── CTA section glow entrance ─── */
.prod-cta[data-anim="fade-up"].is-visible {
    animation: ctaGlow 3s ease-in-out 0.8s;
}

@keyframes ctaGlow {
    0%, 100% { box-shadow: none; }
    50% { box-shadow: 0 0 80px rgba(230, 0, 0, 0.08); }
}

/* ─── Smooth line separator animation ─── */
[data-anim].is-visible::after {
    content: none;
}

/* ─── Advantage / Step cards ─── */
.advantage-card,
.step-card {
    transform-style: preserve-3d;
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
}

.advantage-card:hover,
.step-card:hover {
    transform: translateY(-4px) translateZ(10px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

/* ─── Contact cards depth ─── */
.contact-info,
.map-container {
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.contact-info:hover {
    transform: translateY(-3px);
}

/* ─── Production card hover lift ─── */
.production-card {
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1), box-shadow 0.4s ease;
    transform-style: preserve-3d;
}

.production-card:hover {
    transform: translateY(-6px) translateZ(12px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

/* ─── Reduce motion for accessibility ─── */
@media (prefers-reduced-motion: reduce) {
    [data-anim] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    .tilt-3d:hover,
    .depth-float:hover,
    .rp-photo:hover,
    .gallery-item--video:hover,
    .advantage-card:hover,
    .production-card:hover {
        transform: none !important;
    }

    .hero-content [data-anim="hero-title"],
    .hero-content [data-anim="hero-sub"],
    .hero-content [data-anim="hero-cta"],
    .hall-hero [data-anim="hero-title"],
    .hall-hero .hall-subtitle,
    .hall-hero .hall-description,
    .hall-hero .btn-primary {
        opacity: 1 !important;
        transform: none !important;
        animation: none !important;
    }
}

/* ─── Mobile: tone down 3D ─── */
@media (max-width: 768px) {
    body {
        perspective: none;
    }

    [data-anim="fade-left"],
    [data-anim="fade-right"] {
        transform: translateY(40px);
    }

    [data-anim="rise-3d"],
    [data-anim="flip-up"] {
        transform: translateY(40px);
    }

    .tilt-3d:hover,
    .depth-float:hover {
        transform: translateY(-3px);
    }
}
