.image-gallery {
    padding: 0;
    --gallery-background: #29241f;
    --gallery-accent: #b48b4b;
    --gallery-text: #fffdf8;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-gallery__carousel {
    position: relative;
}

.image-gallery__viewport {
    overflow: hidden;
    position: relative;
    background: var(--gallery-background);
}

.image-gallery__track {
    display: flex;
    transition: transform 0.45s ease;
    will-change: transform;
}

.image-gallery__item {
    position: relative;
    flex: 0 0 100%;
    overflow: hidden;
    border-radius: 0;
    aspect-ratio: 16 / 9;
    min-height: 280px;
    height: var(--image-gallery-height, 600px);
    background-color: var(--gallery-background);
    cursor: pointer;
    transform: translate3d(0, 0, 0);
    margin: 0 !important;
}

.image-gallery__item::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.05) 0%, rgba(15, 23, 42, 0.7) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.image-gallery__item:hover::after,
.image-gallery__item:focus-within::after {
    opacity: 1;
}

.image-gallery__thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    display: block;
}

.image-gallery__item:hover .image-gallery__thumb,
.image-gallery__item:focus-within .image-gallery__thumb {
    transform: scale(1.08);
}

.image-gallery__caption {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    z-index: 2;
    color: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.image-gallery__caption-title {
    font-weight: 600;
}

.image-gallery__caption-text {
    font-size: 0.9rem;
    color: rgba(241, 245, 249, 0.85);
}

.image-gallery__control {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.6);
    border: none;
    color: var(--gallery-text);
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
    z-index: 5;
}

.image-gallery__control:hover,
.image-gallery__control:focus-visible {
    background: rgba(116, 47, 60, 0.9);
    transform: translateY(-50%) scale(1.05);
}

.image-gallery__control[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.image-gallery__control--prev {
    left: 0.75rem;
}

.image-gallery__control--next {
    right: 0.75rem;
}

.image-gallery__link {
    position: absolute;
    inset: 0;
    z-index: 3;
    text-decoration: none;
    color: inherit;
}

.image-gallery__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Lightbox viewer */
.image-gallery__lightbox {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    z-index: 2000;
    backdrop-filter: blur(6px);
}

.image-gallery__lightbox.is-active {
    display: flex;
}

.image-gallery__lightbox-content {
    position: relative;
    max-width: min(90vw, 1100px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    color: var(--gallery-text);
    opacity: 0;
    transform: translateY(1rem);
    animation: gallery-fade-in 0.25s ease forwards;
}

.image-gallery__lightbox-image {
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.35);
}

.image-gallery__lightbox-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.image-gallery__lightbox-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.image-gallery__lightbox-description {
    font-size: 0.95rem;
    color: rgba(226, 232, 240, 0.8);
}

.image-gallery__lightbox-close,
.image-gallery__lightbox-prev,
.image-gallery__lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(15, 23, 42, 0.45);
    border: 0;
    color: var(--gallery-text);
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.image-gallery__lightbox-prev {
    left: -4rem;
}

.image-gallery__lightbox-next {
    right: -4rem;
}

.image-gallery__lightbox-close {
    top: -3rem;
    right: 0;
    transform: none;
}

.image-gallery__lightbox-close:hover,
.image-gallery__lightbox-prev:hover,
.image-gallery__lightbox-next:hover,
.image-gallery__lightbox-close:focus-visible,
.image-gallery__lightbox-prev:focus-visible,
.image-gallery__lightbox-next:focus-visible {
    background: rgba(116, 47, 60, 0.9);
}

@media (max-width: 900px) {
    .image-gallery__control {
        width: 2.25rem;
        height: 2.25rem;
        font-size: 1.25rem;
    }

    .image-gallery__control--prev {
        left: 0.5rem;
    }

    .image-gallery__control--next {
        right: 0.5rem;
    }

    .image-gallery__lightbox-prev {
        left: 0.5rem;
    }

    .image-gallery__lightbox-next {
        right: 0.5rem;
    }

    .image-gallery__lightbox-close {
        top: 0.75rem;
        right: 0.75rem;
    }
}

@media (max-width: 576px) {
    .image-gallery__item {
        min-height: 200px;
        height: min(var(--image-gallery-height, 600px), 320px);
    }
}

@keyframes gallery-fade-in {
    from {
        opacity: 0;
        transform: translateY(1rem);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
