/* BASE */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #080808;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}


/* GALLERY SECTION */

.vehicle-gallery {
    padding: 90px 6%;
    background: #080808;
    color: #fff;
}

.gallery-heading {
    text-align: center;
    margin-bottom: 45px;
}

.gallery-heading h2 {
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: 4px;
    font-weight: 700;
}

.gallery-heading p {
    color: #999;
    font-size: 14px;
    letter-spacing: 1px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.gallery-item {
    margin: 0;
    overflow: hidden;
    cursor: pointer;
    position: relative;
    background: #111;
}

.gallery-item:focus-visible {
    outline: 2px solid #e82127;
    outline-offset: 3px;
}

.gallery-item img {
    width: 100%;
    height: 350px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease, opacity 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.04);
    opacity: 0.85;
}

.gallery-item figcaption {
    padding: 15px;
    color: #ccc;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
}


/* FULL-SCREEN LIGHTBOX */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.99);

    display: flex;
    align-items: center;
    justify-content: center;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

.lightbox-content {
    width: 80%;
    height: 85%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 70%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
}

.lightbox-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    color: #fff;
}

.lightbox-info p {
    font-size: 14px;
    letter-spacing: 1px;
}

.lightbox-info span {
    color: #aaa;
    font-size: 13px;
}


/* LIGHTBOX BUTTONS */

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    border: none;
    background: transparent;
    color: #fff;
    cursor: pointer;
    transition: 0.3s ease;
    z-index: 10;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    color: #e82127;
}

.lightbox-close {
    top: 25px;
    right: 35px;
    font-size: 45px;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 35px;
    padding: 20px;
}

.lightbox-prev {
    left: 25px;
}

.lightbox-next {
    right: 25px;
}


/* MOBILE RESPONSIVENESS */

@media (max-width: 768px) {

    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .gallery-item img {
        height: 260px;
    }

    .vehicle-gallery {
        padding: 60px 5%;
    }

    .lightbox-content {
        width: 90%;
        height: 75%;
    }

    .lightbox-content img {
        max-height: 55%;
    }

    .lightbox-prev {
        left: 0;
    }

    .lightbox-next {
        right: 0;
    }

    .lightbox-prev,
    .lightbox-next {
        font-size: 25px;
        padding: 10px;
    }

    .lightbox-close {
        top: 15px;
        right: 20px;
        font-size: 38px;
    }

    .lightbox-info p {
        font-size: 11px;
    }
}


/* THUMBNAIL STRIP */

.lightbox-thumbnails {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;

    width: 100%;
    max-width: 850px;
    margin: 20px auto 0;
    padding: 12px 30px;

    overflow-x: auto;
    overflow-y: hidden;

    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;

    scrollbar-width: none;

    position: relative;
}

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

/* THUMBNAIL BUTTONS */

.lightbox-thumb {
    flex: 0 0 90px;
    height: 65px;

    padding: 0;
    border: 2px solid transparent;
    border-radius: 5px;

    overflow: hidden;
    background: #111;

    opacity: 0.6;
    cursor: pointer;

    scroll-snap-align: center;

    transition:
        opacity 0.3s ease,
        border-color 0.3s ease,
        transform 0.3s ease;
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: #e82127;
    transform: scale(1.05);
}

.lightbox-thumb:focus-visible {
    outline: 2px solid white;
    outline-offset: 3px;
}

/* EDGE FADE */

.thumbnail-wrapper {
    position: relative;
    width: 100%;
    max-width: 850px;
    margin: 0 auto;
}

.thumbnail-wrapper::before,
.thumbnail-wrapper::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 35px;
    z-index: 2;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.thumbnail-wrapper::before {
    left: 0;
    background: linear-gradient(
        to right,
        rgba(0, 0, 0, 0.95),
        transparent
    );
}

.thumbnail-wrapper::after {
    right: 0;
    background: linear-gradient(
        to left,
        rgba(0, 0, 0, 0.95),
        transparent
    );
}

.thumbnail-wrapper.can-scroll-left::before,
.thumbnail-wrapper.can-scroll-right::after {
    opacity: 1;
}

/* MOBILE OPTIMIZATION */

@media (max-width: 768px) {

    .lightbox-thumbnails {
        justify-content: flex-start;
        gap: 12px;
        padding: 14px 24px;
        margin-top: 15px;
    }

    .lightbox-thumb {
        flex: 0 0 100px;
        height: 72px;
        border-radius: 6px;
    }

    .thumbnail-wrapper::before,
    .thumbnail-wrapper::after {
        width: 25px;
    }

}
