/**
 * /assets/css/pages/gallery.css
 *
 * Gallery page styles including video player and story carousel components
 * Immersive, cinematic presentation for yacht imagery
 */

/* ========================================
   VIDEO PLAYER COMPONENT
   ======================================== */
.video-player-section {
    padding: 0;
}

.video-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.video-container {
    position: relative;
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.3);
}

.video-local-wrap,
.video-youtube-wrap {
    position: absolute;
    inset: 0;
}

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

.video-youtube-poster {
    position: relative;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.video-youtube-poster img {
    transition: transform 0.7s ease;
}

.video-youtube-poster:hover img {
    transform: scale(1.03);
}

.video-youtube-frame {
    position: absolute;
    inset: 0;
}

.video-youtube-frame iframe {
    width: 100%;
    height: 100%;
}

.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(2, 2, 4, 0.3);
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.video-youtube-poster:hover .video-overlay,
.video-poster-wrap:hover .video-overlay {
    opacity: 0.1;
}

/* Video Poster (for local videos) */
.video-poster-wrap {
    position: absolute;
    inset: 0;
    cursor: pointer;
    z-index: 5;
}

.video-poster-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease;
}

.video-poster-wrap:hover img {
    transform: scale(1.03);
}

.video-hidden {
    opacity: 0;
    pointer-events: none;
}

.video-local-wrap.video-playing .video-poster-wrap {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.video-local-wrap.video-playing .video-element,
.video-local-wrap.video-playing .video-controls-overlay,
.video-local-wrap.video-playing .video-progress-bar {
    opacity: 1;
    pointer-events: auto;
}

/* Play Button */
.video-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: rgba(248, 246, 241, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(248, 246, 241, 0.2);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.video-play-btn svg {
    width: 28px;
    height: 28px;
    margin-left: 4px;
}

.video-play-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-play-btn:hover svg {
    color: var(--dark);
}

/* Video spinner element */
.video-spinner {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 3px solid rgba(212, 175, 55, 0.2);
    border-top-color: var(--gold);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}

/* Loading state for play button */
.video-play-btn.loading {
    pointer-events: none;
    background: rgba(212, 175, 55, 0.2);
    border-color: var(--gold);
}

.video-play-btn.loading .play-icon {
    opacity: 0;
}

.video-play-btn.loading .video-spinner {
    opacity: 1;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Video Controls Overlay */
.video-controls-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

/* Hide controls overlay when video is playing */
.video-local-wrap.video-playing .video-controls-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Show controls overlay only when controls-visible class is present */
.video-local-wrap.video-playing.controls-visible .video-controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* Play/Pause icon visibility */
.video-toggle .play-icon { display: block; }
.video-toggle .pause-icon { display: none; }
.video-toggle.playing .play-icon { display: none; }
.video-toggle.playing .pause-icon { display: block; }

/* Video Controls Bar */
.video-controls-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 20;
}

/* Show controls bar when controls-visible class is present */
.video-local-wrap.video-playing.controls-visible .video-controls-bar {
    opacity: 1;
    pointer-events: auto;
}

/* Progress Bar */
.video-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(248, 246, 241, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.video-progress-fill {
    height: 100%;
    background: var(--gold);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

/* Fullscreen Button */
.video-fullscreen-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(248, 246, 241, 0.1);
    border: 1px solid rgba(248, 246, 241, 0.2);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.video-fullscreen-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--dark);
}

.video-fullscreen-btn svg {
    width: 18px;
    height: 18px;
}

.video-fullscreen-btn .compress-icon {
    display: none;
}

.video-container.is-fullscreen .video-fullscreen-btn .expand-icon {
    display: none;
}

.video-container.is-fullscreen .video-fullscreen-btn .compress-icon {
    display: block;
}

/* Fullscreen mode styles */
.video-container.is-fullscreen {
    position: fixed;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    background: #000;
    border-radius: 0;
}

.video-container.is-fullscreen .video-local-wrap,
.video-container.is-fullscreen .video-element {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-container.is-fullscreen .video-controls-bar {
    opacity: 0;
    pointer-events: none;
    padding: 1rem 2rem;
}

.video-container.is-fullscreen .video-controls-overlay {
    opacity: 0;
    pointer-events: none;
}

.video-container.is-fullscreen .video-local-wrap.controls-visible .video-controls-bar,
.video-container.is-fullscreen .video-local-wrap.controls-visible .video-controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

.video-container.is-fullscreen .video-fullscreen-btn {
    width: 44px;
    height: 44px;
}

.video-container.is-fullscreen .video-fullscreen-btn svg {
    width: 22px;
    height: 22px;
}

@media (max-width: 768px) {
    .video-play-btn {
        width: 80px;
        height: 80px;
    }

    .video-play-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ========================================
   STORY CAROUSEL COMPONENT
   ======================================== */
.story-carousel-section {
    padding: 8rem 8vw;
    overflow: hidden;
}

.story-carousel-header {
    margin-bottom: 4rem;
}

.story-carousel {
    position: relative;
}

/* Progress */
.carousel-progress {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.carousel-progress-track {
    flex: 1;
    height: 2px;
    background: rgba(248, 246, 241, 0.1);
    border-radius: 1px;
    overflow: hidden;
}

.carousel-progress-fill {
    height: 100%;
    background: var(--gold);
    width: 12.5%;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-counter {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-style: italic;
    color: var(--cream);
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.carousel-current {
    color: var(--gold);
    min-width: 1.5rem;
}

.carousel-divider {
    color: rgba(248, 246, 241, 0.3);
}

.carousel-total {
    color: rgba(248, 246, 241, 0.4);
}

/* Viewport & Track */
.carousel-viewport {
    position: relative;
    overflow: hidden;
    border-radius: 1rem;
}

.carousel-track {
    display: flex;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-slide {
    flex: 0 0 100%;
    position: relative;
}

.carousel-image-wrap {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    cursor: pointer;
}

.carousel-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-image-wrap:hover .carousel-image {
    transform: scale(1.03);
}

.carousel-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(2, 2, 4, 0.5) 0%,
        transparent 40%
    );
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.carousel-caption {
    position: absolute;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    color: var(--cream);
    font-size: 1rem;
    font-weight: 300;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
}

/* Navigation Buttons */
.carousel-nav {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 1.5rem;
    pointer-events: none;
    z-index: 10;
}

.carousel-nav-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(2, 2, 4, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(248, 246, 241, 0.15);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
    transition: all 0.4s ease;
    opacity: 0;
}

.story-carousel:hover .carousel-nav-btn {
    opacity: 1;
}

.carousel-nav-btn:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--dark);
}

.carousel-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-nav-btn svg {
    width: 24px;
    height: 24px;
}

/* Thumbnails */
.carousel-thumbnails {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.carousel-thumbnails::-webkit-scrollbar {
    display: none;
}

.carousel-thumb {
    flex: 0 0 80px;
    height: 60px;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid transparent;
    opacity: 0.4;
    cursor: pointer;
    transition: all 0.4s ease;
    padding: 0;
    background: none;
}

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

.carousel-thumb:hover {
    opacity: 0.7;
}

.carousel-thumb.active {
    opacity: 1;
    border-color: var(--gold);
}

/* Carousel Lightbox */
.carousel-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(2, 2, 4, 0.98);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.carousel-lightbox .lightbox-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.carousel-lightbox .lightbox-image {
    max-width: 90vw;
    max-height: 78vh;
    object-fit: contain;
    border-radius: 0.5rem;
    opacity: 0;
    transform: scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
}

.carousel-lightbox.active .lightbox-image {
    opacity: 1;
    transform: scale(1);
}

.carousel-lightbox .lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(248, 246, 241, 0.1);
    border: 1px solid rgba(248, 246, 241, 0.2);
    color: var(--cream);
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.carousel-lightbox .lightbox-close:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--dark);
}

/* Controls bar: prev | counter | next — below the image */
.carousel-lightbox .lightbox-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-top: 1.75rem;
    opacity: 0;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-lightbox.active .lightbox-controls {
    opacity: 1;
}

.carousel-lightbox .lightbox-nav {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(248, 246, 241, 0.08);
    border: 1px solid rgba(248, 246, 241, 0.18);
    color: var(--cream);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.carousel-lightbox .lightbox-nav:hover {
    background: var(--gold);
    border-color: var(--gold);
    color: var(--dark);
}

.carousel-lightbox .lightbox-nav svg {
    width: 20px;
    height: 20px;
}

.carousel-lightbox .lightbox-counter {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-style: italic;
    color: rgba(248, 246, 241, 0.55);
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    min-width: 5rem;
    justify-content: center;
}

.carousel-lightbox .lightbox-current {
    color: var(--gold);
}

.carousel-lightbox .lightbox-divider {
    color: rgba(248, 246, 241, 0.3);
}

/* Responsive */
@media (max-width: 1024px) {
    .carousel-nav-btn {
        width: 48px;
        height: 48px;
        opacity: 1;
    }

    .carousel-nav-btn svg {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 768px) {
    .story-carousel-section {
        padding: 5rem 6vw;
    }

    .carousel-image-wrap {
        aspect-ratio: 4 / 3;
    }

    .carousel-nav {
        padding: 0 0.75rem;
    }

    .carousel-nav-btn {
        width: 40px;
        height: 40px;
    }

    .carousel-thumb {
        flex: 0 0 60px;
        height: 45px;
    }

    /* Smaller nav buttons on mobile */
    .carousel-lightbox .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .carousel-lightbox .lightbox-nav svg {
        width: 18px;
        height: 18px;
    }

    .carousel-lightbox .lightbox-controls {
        gap: 1.25rem;
        margin-top: 1.25rem;
    }
}

/* ========================================
   GALLERY GRID INTRO
   ======================================== */
.gallery-intro {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.gallery-intro-text {
    max-width: 500px;
}

.gallery-intro-visual {
    position: relative;
}

@media (max-width: 1024px) {
    .gallery-intro {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ========================================
   GALLERY SECTION DIVIDER
   ======================================== */
.gallery-divider {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 4rem 0;
}

.gallery-divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(
        to right,
        transparent,
        rgba(196, 164, 105, 0.3),
        transparent
    );
}

.gallery-divider-icon {
    width: 40px;
    height: 40px;
    stroke: var(--gold);
    opacity: 0.5;
}
