/* ==========================================================================
   Fullscreen / Cinema Module — fullscreen.css
   Cinema mode: dark backdrop + centred video modal on ALL devices.
   Native Fullscreen API is NOT used — avoids the jarring browser takeover
   and gives a premium "lightbox" feel on desktop, and a clean overlay on
   mobile / iOS Safari.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. EXPAND TRIGGER BUTTON (injected per card by fullscreen.js)
   -------------------------------------------------------------------------- */

.fs-trigger-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 20;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
    pointer-events: none;
}

/* Show on card hover — desktop */
.video-card:hover .fs-trigger-btn {
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
}

/* Always visible on touch screens (tablet/desktop) */
@media (hover: none) {
    .fs-trigger-btn {
        opacity: 0.75;
        transform: scale(1);
        pointer-events: auto;
    }
}

/* Hide cinema mode entirely on mobile */
@media (max-width: 900px) {
    .fs-trigger-btn {
        display: none !important;
    }
}

.fs-trigger-btn:hover {
    background: rgba(0, 0, 0, 0.80);
    transform: scale(1.1);
}

.fs-trigger-btn:active {
    transform: scale(0.95);
}

.fs-trigger-btn svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   2. CINEMA BACKDROP
   Semi-transparent dark overlay covering the whole viewport.
   Sits behind the cinema card (z-index: 99998).
   -------------------------------------------------------------------------- */

.fs-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 99998;
    cursor: pointer; /* clicking backdrop also closes */

    /* Transition states */
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.fs-backdrop.fs-backdrop-visible {
    opacity: 1;
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.88);
    /* Subtle blur of content behind — only where supported */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* --------------------------------------------------------------------------
   3. CINEMA CARD — the .video-card in cinema mode
   Floats above the backdrop, centred on screen.
   -------------------------------------------------------------------------- */

.is-cinema-mode {
    position: fixed !important;
    z-index: 99999 !important;
    border-radius: 16px !important;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.8) !important;
    transform: none !important;
    overflow: hidden !important;
    background: #000 !important;

    /* Centre on viewport */
    top: 50% !important;
    left: 50% !important;
    translate: -50% -50% !important;

    /* Entrance animation */
    animation: cinema-in 0.38s cubic-bezier(0.34, 1.30, 0.64, 1) forwards;
}

@keyframes cinema-in {
    from {
        scale: 0.88;
        opacity: 0;
    }
    to {
        scale: 1;
        opacity: 1;
    }
}

/* --- LANDSCAPE (16:9) cinema sizing --- */
/* Take up 90% of viewport width, cap at 1280px, height auto from aspect ratio */
.is-cinema-mode[data-fs-orientation="landscape"] {
    width: min(90vw, 1280px) !important;
    height: auto !important;
}

/* --- PORTRAIT (9:16) cinema sizing --- */
/* Take up as much height as available, width auto from aspect ratio */
.is-cinema-mode[data-fs-orientation="portrait"] {
    height: min(90dvh, 900px) !important;
    width: auto !important;
    /* Ensure it never overflows narrow screens */
    max-width: calc(min(90dvh, 900px) * 0.5625) !important;
}

/* Wistia player fills the card completely */
.is-cinema-mode wistia-player {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
}

/* --------------------------------------------------------------------------
   4. SCROLL LOCK ON BODY
   -------------------------------------------------------------------------- */

body.fs-body-lock {
    overflow: hidden;
    touch-action: none;
}

/* --------------------------------------------------------------------------
   5. CLOSE BUTTON
   Top-right of viewport, above both backdrop and card.
   -------------------------------------------------------------------------- */

.fs-close-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 100000;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.7) rotate(-90deg);
    transition:
        opacity 0.3s ease,
        transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
        background 0.2s ease;
    pointer-events: none;
}

.fs-close-btn.fs-close-visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
    pointer-events: auto;
}

.fs-close-btn:hover {
    background: rgba(255, 255, 255, 0.30);
    transform: scale(1.12) !important;
}

.fs-close-btn:active {
    transform: scale(0.92) !important;
}

.fs-close-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: #fff;
    stroke-width: 2.5;
    stroke-linecap: round;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   7. UNMUTE HINT BUTTON
   Appears at the bottom-centre of the cinema modal after muted autoplay.
   One click = user gesture = browser allows sound.
   -------------------------------------------------------------------------- */

.fs-unmute-btn {
    position: fixed;
    bottom: 28px;
    left: 50%;
    translate: -50% 0;
    z-index: 100001; /* above cinema card and close btn */

    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px 10px 16px;
    border: none;
    border-radius: 50px;
    cursor: pointer;

    background: rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    white-space: nowrap;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);

    /* Start hidden, slide up on .fs-unmute-visible */
    opacity: 0;
    transform: translateY(16px);
    pointer-events: none;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.fs-unmute-btn.fs-unmute-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.fs-unmute-btn:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-2px);
}

.fs-unmute-btn:active {
    transform: scale(0.96);
}

.fs-unmute-btn svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   8. POST-CINEMA CARD FLASH
   Brief glowing pulse on the card that was just watched.
   Applied by JS for ~1.6s then removed.
   -------------------------------------------------------------------------- */

@keyframes fs-card-flash {
    0%   { box-shadow: 0 10px 30px rgba(0,0,0,0.10), 0 0  0px  0px rgba(255, 40,  40, 0.00); outline: 4px solid rgba(255, 40,  40, 0.00); }
    18%  { box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 0 60px 20px rgba(255, 40,  40, 0.90); outline: 4px solid rgba(255, 40,  40, 1.00); }
    45%  { box-shadow: 0 10px 30px rgba(0,0,0,0.10), 0 0 20px 30px rgba(255, 40,  40, 0.00); outline: 4px solid rgba(255, 40,  40, 0.00); }
    65%  { box-shadow: 0 16px 40px rgba(0,0,0,0.18), 0 0 40px 10px rgba(255, 40,  40, 0.50); outline: 4px solid rgba(255, 40,  40, 0.60); }
    100% { box-shadow: 0 10px 30px rgba(0,0,0,0.10), 0 0  0px  0px rgba(255, 40,  40, 0.00); outline: 4px solid rgba(255, 40,  40, 0.00); }
}

.fs-card-flash {
    animation: fs-card-flash 1.8s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    outline-offset: 4px;
}

/* --------------------------------------------------------------------------
   8. SAFE-AREA INSETS (notch / Dynamic Island)
   -------------------------------------------------------------------------- */

@supports (padding-top: env(safe-area-inset-top)) {
    .fs-close-btn {
        top: calc(16px + env(safe-area-inset-top));
        right: calc(16px + env(safe-area-inset-right));
    }
}
