/* ==========================================================================
   LUNARO FILMS — CINEMATIC 3D & CASA NOPAL MOTION LAYER
   Preserves 100% of existing design tokens, colors, typography, and layout.
   Integrates: Lenis smooth scroll, Curtain Stamp Loader, Hero Cursor Photo
   Trail, Masked Line Reveals (.ln > span), Word-by-Word Scroll Scrub,
   Scroll-Tilted Cards, Cursor Hover Preview, Drifting 3D Polaroid Strip,
   Continuous Film Ticker, Magnetic Buttons, Three.js Bokeh & 3D Glare.
   ========================================================================== */

:root {
    --lf-ease-cinema: cubic-bezier(0.22, 1, 0.36, 1);
    --lf-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --lf-gold-glow: rgba(197, 160, 89, 0.28);
}

/* Prevent horizontal overflow from 3D transforms */
html, body {
    overflow-x: hidden;
}

/* --- 1. CURTAIN STAMP LOADER (ROTATING EMBLEM + EXIT REVEAL) --- */
.lf-loader {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: radial-gradient(circle at center, #161412 0%, #0a0a0a 72%);
    color: #fdfcf8;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: transform 0.95s var(--lf-ease-cinema), opacity 0.75s var(--lf-ease-cinema);
    will-change: transform, opacity;
}
.lf-loader.out {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}
.lf-loader-mark {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    transition: transform 0.65s var(--lf-ease-cinema), opacity 0.55s ease;
}
.lf-loader.out .lf-loader-mark {
    transform: translateY(-28px) scale(0.92);
    opacity: 0;
}
.lf-loader-emblem {
    width: 78px;
    height: 78px;
    object-fit: contain;
    opacity: 0;
    transform: scale(0.65) rotate(-180deg);
    filter: drop-shadow(0 0 18px rgba(197, 160, 89, 0.38));
    transition: opacity 0.6s var(--lf-ease-cinema), transform 1.15s var(--lf-ease-cinema);
    will-change: transform, opacity;
}
.lf-loader.in .lf-loader-emblem {
    opacity: 1;
    transform: scale(1) rotate(360deg);
}
.lf-loader-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.45rem;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #fdfcf8;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s var(--lf-ease-cinema) 0.2s, transform 0.6s var(--lf-ease-cinema) 0.2s;
}
.lf-loader-stamp {
    font-family: 'Montserrat', 'Raleway', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.36em;
    text-transform: uppercase;
    color: #c5a059;
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.6s var(--lf-ease-cinema) 0.32s, transform 0.6s var(--lf-ease-cinema) 0.32s;
}
.lf-loader.in .lf-loader-title,
.lf-loader.in .lf-loader-stamp {
    opacity: 1;
    transform: translateY(0);
}

/* --- 2. PAGE TRANSITION CURTAIN --- */
.lf-curtain {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #0a0a0a;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s var(--lf-ease-cinema);
}
.lf-curtain.is-active {
    opacity: 1;
    pointer-events: all;
}

/* --- 3. WEBGL AMBIENT BOKEH CANVAS --- */
.lf-webgl-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0.78;
    mix-blend-mode: screen;
}

/* --- 4. HERO CINEMATIC DEPTH, VIGNETTE & CURSOR PHOTO TRAIL --- */
.hero {
    transform-style: preserve-3d;
}

.lf-hero-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 2;
    background: radial-gradient(ellipse at center, transparent 48%, rgba(0, 0, 0, 0.42) 100%);
}

.lf-hero-trail {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 4;
    overflow: hidden;
}

.lf-trail-img {
    position: fixed;
    width: clamp(130px, 14vw, 200px);
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid rgba(253, 252, 248, 0.85);
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 9;
    transform-origin: center center;
    will-change: transform, opacity;
}

/* Subtle homepage hero scroll cue preserving original visual balance */
.lf-hero-scroll-cue {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-radius: 999px;
    background: rgba(10, 10, 10, 0.48);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(210, 180, 140, 0.4);
    color: #fdfcf8;
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    pointer-events: auto;
    transition: background 0.3s ease, transform 0.3s ease;
}
.lf-hero-scroll-cue:hover {
    background: rgba(197, 160, 89, 0.85);
    transform: translateX(-50%) translateY(-2px);
}

/* --- 5. MASKED LINE REVEAL (.ln > span) & SCRUBBED WORDS --- */
.ln {
    display: block;
    overflow: hidden;
}
.ln > span {
    display: inline-block;
    transform: translateY(112%);
    transition: transform 0.85s var(--lf-ease-out);
    will-change: transform;
}
.is-in .ln > span,
.hero-ready .ln > span {
    transform: translateY(0);
}

[data-reveal] {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.8s var(--lf-ease-out), transform 0.8s var(--lf-ease-out);
}
[data-reveal].is-in {
    opacity: 1;
    transform: translateY(0);
}

[data-scrub] .w {
    display: inline-block;
    transition: opacity 0.28s linear, color 0.28s linear;
    opacity: 0.26;
}

/* --- 6. CONTINUOUS CINEMA TICKER (CASA NOPAL MARQUEE) --- */
.lf-ticker-wrap {
    width: 100%;
    overflow: hidden;
    background: #1a1a1a;
    color: #f2e8dc;
    border-top: 1px solid rgba(210, 180, 140, 0.25);
    border-bottom: 1px solid rgba(210, 180, 140, 0.25);
    padding: 14px 0;
}
.lf-ticker-track {
    display: flex;
    width: max-content;
    white-space: nowrap;
    gap: 38px;
    animation: lfTicker 32s linear infinite;
    will-change: transform;
}
.lf-ticker-wrap:hover .lf-ticker-track {
    animation-play-state: paused;
}
.lf-ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 18px;
    font-family: 'Playfair Display', serif;
    font-size: 0.98rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fdfcf8;
}
.lf-ticker-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #c5a059;
    display: inline-block;
}
@keyframes lfTicker {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

/* --- 8. CURSOR HOVER PREVIEW (CASA NOPAL .cursor-preview) --- */
.lf-cursor-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 220px;
    aspect-ratio: 4 / 3;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid rgba(197, 160, 89, 0.85);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 950;
    opacity: 0;
    transform: translate3d(-999px, -999px, 0) scale(0.86);
    transition: opacity 0.26s ease, transform 0.32s var(--lf-ease-out);
    background: #0a0a0a;
}
.lf-cursor-preview.is-visible {
    opacity: 1;
}
.lf-cursor-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- 9. 3D TILT & SPECULAR LIGHT REFLECTION --- */
[data-tilt-3d] {
    transform-style: preserve-3d;
    will-change: transform;
    position: relative;
}

.lf-glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    z-index: 4;
    opacity: 0;
    transition: opacity 0.4s ease;
    background: radial-gradient(
        circle 280px at var(--gx, 50%) var(--gy, 50%),
        rgba(255, 255, 255, 0.22),
        rgba(210, 180, 140, 0.08) 45%,
        transparent 70%
    );
}

[data-tilt-3d]:hover .lf-glare {
    opacity: 1;
}

.service-card[data-tilt-3d],
.testimonial-card[data-tilt-3d] {
    transition: box-shadow 0.45s var(--lf-ease-cinema), border-color 0.4s ease;
}

.service-card[data-tilt-3d]:hover {
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(210, 180, 140, 0.45);
}

.testimonial-card[data-tilt-3d]:hover {
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.08);
    border-color: rgba(210, 180, 140, 0.5);
}

/* About image 3D frame */
.about-img[data-tilt-3d] {
    perspective: 1100px;
}

.about-img img {
    transition: transform 0.6s var(--lf-ease-cinema), box-shadow 0.6s var(--lf-ease-cinema);
}

/* Gallery photo items: subtle 3D depth */
.photo-item {
    transform-style: preserve-3d;
    will-change: transform;
    cursor: zoom-in;
}

.photo-item:hover {
    box-shadow: 0 16px 35px rgba(0, 0, 0, 0.18), 0 0 20px rgba(197, 160, 89, 0.16);
}

/* Video cards: consistent 3D elevation across all 4 service pages */
.video-card {
    position: relative;
    border-radius: 12px;
    aspect-ratio: 16 / 9;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    transform-style: preserve-3d;
    will-change: transform;
}

.video-thumb {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Hero Ken Burns subtle motion (when using still cinema frame) */
@keyframes lfKenBurns {
    0% { transform: scale(1) translate3d(0, 0, 0); }
    50% { transform: scale(1.06) translate3d(-1%, -1%, 0); }
    100% { transform: scale(1) translate3d(0, 0, 0); }
}

.lf-ken-burns {
    animation: lfKenBurns 18s ease-in-out infinite;
    will-change: transform;
}

/* --- 10. UNIFIED LIGHTBOX WITH PREV / NEXT / CLOSE CONTROLS --- */
#lightbox {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 5, 0.94);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 5000;
    padding: 24px;
}

#lightImg {
    max-width: 88vw;
    max-height: 82vh;
    object-fit: contain;
    border-radius: 8px;
    border: 2px solid #c5a059;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

.lf-lb-btn {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(197, 160, 89, 0.65);
    background: rgba(10, 10, 10, 0.72);
    color: #fff;
    font-size: 18px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5005;
    transition: background 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}
.lf-lb-btn:hover {
    background: #c5a059;
    border-color: #c5a059;
    color: #0a0a0a;
}
#prevBtn.lf-lb-btn { left: 24px; }
#nextBtn.lf-lb-btn { right: 24px; }

.lf-lb-close {
    position: fixed;
    top: 22px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(10, 10, 10, 0.72);
    color: #fff;
    font-size: 22px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5006;
    transition: background 0.25s ease, border-color 0.25s ease;
}
.lf-lb-close:hover {
    background: #c5a059;
    border-color: #c5a059;
    color: #0a0a0a;
}

/* ==========================================================================
   COMPREHENSIVE RESPONSIVE MEDIA QUERIES (320px to 1920px+)
   ========================================================================== */

@media (min-width: 1920px) {
    .hero-container { max-width: 1640px; }
    .about, .contact-details-section { max-width: 1320px; }
    .service-grid { max-width: 1360px; }
}

@media (max-width: 1440px) {
    .hero-container { width: 92%; }
}

@media (max-width: 1366px) {
    .hero-text h1 { font-size: clamp(3.2rem, 5.5vw, 5.5rem); }
    .video-card-3d { max-width: 620px; }
}

@media (max-width: 1024px) {
    .navbar { padding: 10px 24px; }
    .nav-links { gap: 20px; }
    .video-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

@media (max-width: 768px) {
    .navbar { padding: 12px 20px; }
    .logo-image { height: 48px; }
    .section-title { font-size: 2.3rem; margin-bottom: 35px; }
    .floating-btns { bottom: 16px; right: 16px; }
    .float-btn { width: 44px; height: 44px; font-size: 1.25rem; }
    .lf-lb-btn { width: 40px; height: 40px; font-size: 15px; }
    #prevBtn.lf-lb-btn { left: 10px; }
    #nextBtn.lf-lb-btn { right: 10px; }
    .lf-cursor-preview { display: none !important; }
}

@media (max-width: 430px) {
    .hero-text h1 { font-size: 2.85rem; }
    .hero-text p { font-size: 0.95rem; letter-spacing: 1.5px; }
    .gallery { padding: 64px 4%; }
    .video-grid { padding: 40px 4%; gap: 20px; grid-template-columns: 1fr; }
    .services-section { padding: 60px 16px; }
    .testimonial-section { padding: 60px 16px; }
    .testimonial-card { padding: 26px 18px; }
    .contact-details-section { padding: 56px 16px; }
    .contact-flex { padding: 20px 16px; gap: 24px; }
}

@media (max-width: 390px) {
    .hero-text h1 { font-size: 2.55rem; }
    .section-title { font-size: 2rem; }
    .book-now-btn { padding: 10px 18px; font-size: 11px; }
    .back-btn { padding: 8px 16px; font-size: 11px; }
}

@media (max-width: 360px) {
    .hero-text h1 { font-size: 2.2rem; }
    .hero-text p { font-size: 0.85rem; }
    .service-grid { grid-template-columns: 1fr; }
    .contact-book-btn { padding: 14px 16px; font-size: 0.75rem; letter-spacing: 1px; }
    .book-now-btn { top: 14px; right: 14px; padding: 8px 14px; font-size: 10px; }
    .back-nav { top: 14px; left: 14px; }
    .back-btn { padding: 7px 14px; font-size: 10px; }
}

/* Touch devices: disable hover glare, trail, and cursor preview */
@media (hover: none) {
    .lf-glare,
    .lf-cursor-preview,
    .lf-trail-img { display: none !important; }
}

/* Reduced Motion Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .lf-webgl-canvas,
    .lf-loader,
    .lf-cursor-preview,
    .lf-trail-img { display: none !important; }
    .lf-ken-burns,
    .lf-ticker-track { animation: none !important; }
    .ln > span { transform: none !important; }
    [data-reveal] { opacity: 1 !important; transform: none !important; }
    [data-scrub] .w { opacity: 1 !important; }
}
