/* ── gallery.css ────────────────────────────────────────────────────────────
   Matches the dark/minimal aesthetic of the existing site.
   Assumes the root stylesheet already sets body background, font, and color.
───────────────────────────────────────────────────────────────────────────── */

/* ── Carousel wrapper ───────────────────────────────────────────────────── */
#gallery-carousel {
    position: relative;
    width: 100%;
    max-width: 860px;
    margin: 25% auto;
    user-select: none;
}

#gallery-track-wrapper {
    overflow: hidden;
    border-radius: 2px;
    background: #0a0a0a;
    aspect-ratio: 4 / 3;
    cursor: pointer;
}

#gallery-track {
    display: flex;
    height: 100%;
    transition: transform 0.5s cubic-bezier(0.77, 0, 0.18, 1);
    will-change: transform;
}

/* ── Individual slide ───────────────────────────────────────────────────── */
.gallery-slide {
    flex: 0 0 100%;
    height: 100%;
    position: relative;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.gallery-slide img.loaded {
    opacity: 1;
}

.gallery-slide .slide-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1.25rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.75);
    opacity: 0;
    transform: translateY(6px);
    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
    pointer-events: none;
}

#gallery-carousel:hover .slide-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ── Prev / Next buttons ────────────────────────────────────────────────── */
.gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        opacity 0.2s ease;
    z-index: 10;
    opacity: 0;
}

#gallery-carousel:hover .gallery-btn {
    opacity: 1;
}

.gallery-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

#gallery-prev {
    left: 0.75rem;
}

#gallery-next {
    right: 0.75rem;
}

/* ── Dot indicators ─────────────────────────────────────────────────────── */
#gallery-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.gallery-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition:
        background 0.25s ease,
        transform 0.25s ease;
    border: none;
    padding: 0;
}

.gallery-dot.active {
    background: rgba(255, 255, 255, 0.85);
    transform: scale(1.3);
}

/* ── Counter ────────────────────────────────────────────────────────────── */
#gallery-counter {
    text-align: center;
    margin-top: 0.6rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.3);
}

/* ── Lightbox ───────────────────────────────────────────────────────────── */
#gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.93);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#gallery-lightbox.open {
    opacity: 1;
    pointer-events: all;
}

#lightbox-img-wrapper {
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 2px;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.8);
}

#lightbox-close {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    z-index: 1001;
}

#lightbox-close:hover {
    color: #fff;
}

.lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.6rem;
    cursor: pointer;
    padding: 1rem;
    transition: color 0.2s;
    z-index: 1001;
}

.lightbox-nav:hover {
    color: #fff;
}

#lightbox-prev {
    left: 1rem;
}

#lightbox-next {
    right: 1rem;
}

#lightbox-caption {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.45);
    white-space: nowrap;
}

/* ── Loading skeleton ───────────────────────────────────────────────────── */
#gallery-track-wrapper.loading::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.03) 25%,
        rgba(255, 255, 255, 0.07) 50%,
        rgba(255, 255, 255, 0.03) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .gallery-btn {
        opacity: 1;
        width: 2rem;
        height: 2rem;
        font-size: 0.8rem;
    }

    #gallery-prev {
        left: 0.4rem;
    }
    #gallery-next {
        right: 0.4rem;
    }
}
