/* =============================================
   GALERIE PÊLE-MÊLE — Marquee + Lightbox
   ============================================= */

/* ---- Hero override for gallery ---- */
.gallery-hero {
    padding: 8rem 0 3rem;
    background: var(--color-secondary);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.gallery-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 60% 30%, rgba(209, 73, 0, 0.12) 0%, transparent 70%);
    pointer-events: none;
}

.gallery-hero h1 {
    color: #fff;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.gallery-hero p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.15rem;
    max-width: 500px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ---- Marquee Container ---- */
.marquee-container {
    overflow: hidden;
    padding: 2rem 0 4rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ---- Marquee Row ---- */
.marquee-row {
    overflow: hidden;
    position: relative;
    width: 100%;
}

/* Fade edges */
.marquee-row::before,
.marquee-row::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}

.marquee-row::before {
    left: 0;
    background: linear-gradient(to right, var(--color-bg-light), transparent);
}

.marquee-row::after {
    right: 0;
    background: linear-gradient(to left, var(--color-bg-light), transparent);
}

/* ---- Marquee Track ---- */
.marquee-track {
    display: flex;
    gap: 1rem;
    width: max-content;
    will-change: transform;
}

/* Left scroll (default) */
.marquee-row:nth-child(odd) .marquee-track {
    animation: marquee-left 45s linear infinite;
}

/* Right scroll (alternating) */
.marquee-row:nth-child(even) .marquee-track {
    animation: marquee-right 50s linear infinite;
}

/* Pause on row hover */
.marquee-row:hover .marquee-track {
    animation-play-state: paused;
}

@keyframes marquee-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

@keyframes marquee-right {
    0% {
        transform: translateX(-50%);
    }

    100% {
        transform: translateX(0);
    }
}

/* ---- Gallery Item ---- */
.gallery-item {
    flex-shrink: 0;
    width: 320px;
    height: 220px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.4s ease;
    display: block;
}

/* Hover effect */
.gallery-item:hover {
    transform: scale(1.04);
    box-shadow: 0 20px 40px -8px rgba(0, 0, 0, 0.25),
        0 8px 16px -4px rgba(0, 0, 0, 0.15);
    z-index: 3;
}

.gallery-item:hover img {
    transform: scale(1.08);
    filter: brightness(1.05) contrast(1.02);
}

/* Overlay gradient on hover */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, transparent 50%, rgba(0, 0, 0, 0.5) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    border-radius: inherit;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Hover caption preview */
.gallery-item .item-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-body);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 4;
    pointer-events: none;
}

.gallery-item:hover .item-caption {
    transform: translateY(0);
}

/* ---- Lightbox ---- */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 15, 26, 0.6);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

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

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: scale(0.92) translateY(20px);
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.lightbox-overlay.active .lightbox-content {
    transform: scale(1) translateY(0);
}

.lightbox-content img {
    max-width: 100%;
    max-height: 75vh;
    object-fit: contain;
    border-radius: var(--radius-lg);
    box-shadow: 0 32px 64px -12px rgba(0, 0, 0, 0.5),
        0 16px 32px -8px rgba(0, 0, 0, 0.3);
}

.lightbox-caption {
    margin-top: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    font-family: var(--font-body);
    font-weight: 400;
    text-align: center;
    max-width: 600px;
    line-height: 1.5;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-full);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    width: 42px;
    height: 42px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(12px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
    stroke-width: 2;
}

/* Navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.12);
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.18);
}

.lightbox-nav.prev {
    left: -70px;
}

.lightbox-nav.prev:hover {
    transform: translateY(-50%) translateX(-3px);
}

.lightbox-nav.next {
    right: -70px;
}

.lightbox-nav.next:hover {
    transform: translateY(-50%) translateX(3px);
}

.lightbox-nav svg {
    width: 22px;
    height: 22px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
}

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .gallery-item {
        width: 260px;
        height: 180px;
    }

    .lightbox-nav.prev {
        left: -55px;
    }

    .lightbox-nav.next {
        right: -55px;
    }
}

@media (max-width: 768px) {
    .marquee-container {
        gap: 0.75rem;
        padding: 1.5rem 0 3rem;
    }

    .gallery-item {
        width: 220px;
        height: 155px;
    }

    .marquee-row::before,
    .marquee-row::after {
        width: 40px;
    }

    .gallery-hero {
        padding: 7rem 0 2rem;
    }

    .lightbox-nav.prev {
        left: 10px;
    }

    .lightbox-nav.next {
        right: 10px;
    }

    .lightbox-nav {
        width: 40px;
        height: 40px;
    }

    .lightbox-close {
        top: -45px;
        right: 5px;
    }

    .lightbox-caption {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
}

@media (max-width: 480px) {
    .gallery-item {
        width: 180px;
        height: 130px;
    }

    .marquee-container {
        gap: 0.5rem;
    }

    .lightbox-content {
        max-width: 95vw;
    }
}

/* Prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .marquee-track {
        animation: none !important;
    }

    .gallery-item,
    .gallery-item img,
    .lightbox-overlay,
    .lightbox-content {
        transition: none !important;
    }
}