.gallery-hero {
    padding: 90px 12.5% 84px;
    color: #fff;
    background: linear-gradient(110deg, rgba(48, 39, 31, .9), rgba(96, 72, 48, .62)), url("../images/mexy-voyage-logo.jpg") center 45% / cover;
}

.gallery-hero h1 {
    max-width: 800px;
    margin: 22px 0 14px;
    font: 500 clamp(45px, 6vw, 76px)/1.1 var(--serif);
    letter-spacing: -.04em;
}

.gallery-hero h1 em {
    color: #e2c99e;
    font-weight: 500;
}

.gallery-hero p {
    max-width: 620px;
    margin: 0;
    color: #f0e8dd;
    font: 18px/1.7 var(--serif);
}

.gallery-section {
    padding: 72px 8%;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    gap: 28px;
}

.gallery-card {
    overflow: hidden;
    border: 1px solid rgba(96, 72, 48, .09);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 32px rgba(48, 39, 31, .08);
    transition: transform .25s ease, box-shadow .25s ease;
}

.gallery-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 40px rgba(48, 39, 31, .14);
}

.gallery-card-caption {
    min-height: 76px;
    padding: 15px 18px 17px;
}

.gallery-card-caption p {
    margin: 6px 0 0;
    color: #796b5b;
    font-size: 13px;
    line-height: 1.5;
}

.gallery-media-button {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: #30271f;
    cursor: zoom-in;
}

.gallery-media-button > img,
.gallery-media-button > video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .45s ease;
}

.gallery-card:hover .gallery-media-button > img,
.gallery-card:hover .gallery-media-button > video {
    transform: scale(1.045);
}

.gallery-zoom-icon,
.gallery-play-icon {
    position: absolute;
    z-index: 1;
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 50%;
    background: rgba(48, 39, 31, .66);
    color: #fff;
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}

.gallery-zoom-icon {
    right: 16px;
    bottom: 16px;
    font-size: 21px;
}

.gallery-play-icon {
    top: 50%;
    left: 50%;
    width: 56px;
    height: 56px;
    padding-left: 3px;
    font-size: 20px;
    opacity: 1;
    transform: translate(-50%, -50%) scale(.92);
}

.gallery-card:hover .gallery-zoom-icon,
.gallery-card:hover .gallery-play-icon,
.gallery-media-button:focus-visible .gallery-zoom-icon,
.gallery-media-button:focus-visible .gallery-play-icon {
    opacity: 1;
}

.gallery-card:hover .gallery-play-icon,
.gallery-media-button:focus-visible .gallery-play-icon {
    transform: translate(-50%, -50%) scale(1);
}

.gallery-media-button:focus-visible {
    outline: 3px solid #c9a66b;
    outline-offset: -3px;
}

.gallery-lightbox {
    width: min(1100px, calc(100vw - 32px));
    max-width: none;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 12px;
    background: #171411;
    color: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}

.gallery-lightbox::backdrop {
    background: rgba(20, 17, 14, .86);
    backdrop-filter: blur(5px);
}

.gallery-lightbox-toolbar {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 16px 10px 22px;
    background: #211d19;
}

.gallery-lightbox-title {
    overflow: hidden;
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gallery-lightbox-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.gallery-lightbox-actions button {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    cursor: pointer;
    font: 400 25px/1 Arial, sans-serif;
}

.gallery-lightbox-actions button:hover {
    background: rgba(255, 255, 255, .2);
}

.gallery-lightbox-stage {
    display: grid;
    max-height: calc(100vh - 140px);
    min-height: 220px;
    place-items: center;
    overflow: auto;
    background: #100e0c;
}

.gallery-lightbox-image {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 150px);
    object-fit: contain;
    transition: transform .2s ease;
    transform-origin: center;
    cursor: zoom-in;
}

.gallery-lightbox-stage.is-zoomed {
    display: block;
    cursor: zoom-out;
}

.gallery-lightbox-stage.is-zoomed .gallery-lightbox-image {
    max-width: none;
    max-height: none;
    cursor: zoom-out;
    transform: scale(1.8);
}

.gallery-lightbox-video {
    display: block;
    width: 100%;
    max-height: calc(100vh - 150px);
    background: #100e0c;
}

.gallery-lightbox-description {
    margin: 0;
    padding: 12px 22px 16px;
    color: #d0c6b8;
    font-size: 14px;
    line-height: 1.5;
    background: #211d19;
}

.gallery-lightbox-description[hidden],
.gallery-lightbox-image[hidden],
.gallery-lightbox-video[hidden],
.gallery-lightbox-zoom[hidden] {
    display: none;
}

.gallery-empty {
    grid-column: 1 / -1;
    padding: 56px 24px;
    text-align: center;
    background: #f7f2e9;
}

.gallery-empty > .eyebrow {
    justify-content: center;
}

.gallery-empty h2 {
    margin: 16px 0 6px;
    font: 500 36px var(--serif);
}

.gallery-empty p {
    color: #796b5b;
}

.gallery-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-top: 40px;
    padding-top: 22px;
    border-top: 1px solid rgba(96, 72, 48, .14);
}

.gallery-pagination-summary {
    margin: 0;
    color: #796b5b;
    font-size: 13px;
}

.gallery-pagination-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.gallery-page-link {
    display: inline-flex;
    min-width: 42px;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid rgba(96, 72, 48, .2);
    border-radius: 6px;
    background: #fff;
    color: #30271f;
    font-size: 13px;
    font-weight: 600;
    transition: border-color .2s ease, background-color .2s ease, color .2s ease;
}

a.gallery-page-link:hover,
a.gallery-page-link:focus-visible {
    border-color: #604830;
    background: #f7f2e9;
}

.gallery-page-link.is-current {
    border-color: #163e31;
    background: #163e31;
    color: #fff;
}

.gallery-page-direction {
    padding-right: 15px;
    padding-left: 15px;
}

.admin-gallery-preview {
    overflow: hidden;
    background: #30271f;
}

.admin-gallery-preview img,
.admin-gallery-preview video {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
}

@media (max-width: 600px) {
    .gallery-hero {
        padding: 65px 7%;
    }

    .gallery-section {
        padding: 46px 6%;
    }

    .gallery-pagination {
        align-items: flex-start;
        flex-direction: column;
        gap: 14px;
    }

    .gallery-pagination-controls {
        justify-content: flex-start;
    }

    .gallery-page-direction {
        min-width: 42px;
        padding: 8px 10px;
        font-size: 0;
    }

    .gallery-page-direction span {
        font-size: 15px;
    }

    .gallery-zoom-icon {
        width: 36px;
        height: 36px;
        opacity: 1;
    }

    .gallery-play-icon {
        opacity: 1;
    }

    .gallery-lightbox {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
        border-radius: 8px;
    }

    .gallery-lightbox-stage {
        min-height: 180px;
        max-height: calc(100vh - 100px);
    }

    .gallery-lightbox-image,
    .gallery-lightbox-video {
        max-height: calc(100vh - 110px);
    }
}
