:root {
    --gallery-ink: #10120f;
    --gallery-paper: #f1eee6;
    --gallery-gold: #d0a45e;
    --gallery-muted: #696b63;
    --gallery-line: rgba(16, 18, 15, 0.15);
}

.gallery-page {
    margin: 0;
    background: var(--gallery-paper);
    color: var(--gallery-ink);
}

.gallery-hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    height: auto;
    max-height: none;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
    isolation: isolate;
    padding: 170px clamp(24px, 8vw, 150px) 82px;
    background: none;
}

.gallery-hero::before {
    position: absolute;
    inset: 0;
    z-index: -3;
    content: "";
    background-image: url("../images/melidoni-village-hero.jpg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    transform: scale(1.02);
}

.gallery-hero-glow {
    position: absolute;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        linear-gradient(
            90deg,
            rgba(3, 4, 3, 0.91),
            rgba(3, 4, 3, 0.48) 58%,
            rgba(3, 4, 3, 0.16)
        ),
        linear-gradient(
            180deg,
            rgba(3, 4, 3, 0.18),
            rgba(3, 4, 3, 0.88)
        );
}

.gallery-hero-content {
    width: min(850px, 100%);
    color: #fff;
}

.gallery-hero h1 {
    margin: 14px 0 22px;
    color: #fffaf0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.5rem, 4vw, 4.4rem);
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.035em;
}

.gallery-hero-content > p:not(.section-eyebrow) {
    max-width: 690px;
    margin: 0;
    color: rgba(255, 255, 255, 0.68);
    font-size: 1.05rem;
    line-height: 1.8;
}

.gallery-content {
    padding: clamp(85px, 10vw, 145px) clamp(20px, 7vw, 130px);
}

.gallery-heading {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
    gap: 50px;
    align-items: end;
    width: min(1500px, 100%);
    margin: 0 auto 48px;
}

.gallery-heading h2 {
    margin: 15px 0 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 48px;
    font-weight: 400;
    line-height: 1.08;
}

.gallery-heading > p {
    max-width: 570px;
    margin: 0;
    color: var(--gallery-muted);
    line-height: 1.8;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: min(1500px, 100%);
    margin: 0 auto 50px;
    padding-bottom: 25px;
    border-bottom: 1px solid var(--gallery-line);
}

.gallery-filters a {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    padding: 11px 16px;
    border: 1px solid var(--gallery-line);
    color: var(--gallery-ink);
    font-size: 0.75rem;
    font-weight: 750;
    letter-spacing: 0.75px;
    text-decoration: none;
    transition: 180ms ease;
}

.gallery-filters a:hover,
.gallery-filters a.is-active {
    border-color: #171916;
    background: #171916;
    color: #fff;
}

.gallery-filters small {
    color: var(--gallery-gold);
    font-size: 0.68rem;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
    width: min(1500px, 100%);
    margin: 0 auto;
}

.gallery-card {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--gallery-line);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.38);
}

.gallery-card.is-featured {
    grid-column: span 2;
}

.gallery-image-button {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 23px 23px 0 0;
    background: #141713;
    cursor: zoom-in;
}

.gallery-card.is-featured .gallery-image-button {
    aspect-ratio: 16 / 9;
}

.gallery-image-button img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 500ms ease, opacity 300ms ease;
}

.gallery-image-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #fff;
    background: rgba(6, 8, 6, 0.34);
    font-size: 26px;
    opacity: 0;
    transition: opacity 250ms ease;
}

.gallery-image-button:hover img {
    transform: scale(1.035);
}

.gallery-image-button:hover .gallery-image-overlay,
.gallery-image-button:focus-visible .gallery-image-overlay {
    opacity: 1;
}

.gallery-card-content {
    padding: 24px 25px 28px;
}

.gallery-card-content small {
    color: #a8762e;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
}

.gallery-card-content h3 {
    margin: 10px 0 0;
    font: 400 1.65rem/1.2 Georgia, "Times New Roman", serif;
}

.gallery-card-content p {
    margin: 13px 0 0;
    color: var(--gallery-muted);
    line-height: 1.7;
}

.gallery-empty {
    width: min(900px, 100%);
    margin: 30px auto 0;
    padding: 85px 25px;
    border: 1px solid var(--gallery-line);
    text-align: center;
}

.gallery-empty i {
    color: var(--gallery-gold);
    font-size: 48px;
}

.gallery-empty h3 {
    margin: 20px 0 10px;
    font: 400 1.8rem/1.2 Georgia, serif;
}

.gallery-empty p {
    margin: 0;
    color: var(--gallery-muted);
}

.gallery-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    padding: 45px clamp(24px, 6vw, 100px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: #070807;
    color: #fff;
}

.gallery-footer p {
    margin: 0;
    color: rgba(255, 255, 255, 0.48);
    font-size: 0.78rem;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: none;
    padding: 70px 24px 30px;
    overflow: auto;
    background: rgba(3, 4, 3, 0.96);
}

.gallery-lightbox.is-open {
    display: grid;
    place-items: center;
}

.gallery-lightbox-open {
    overflow: hidden;
}

.gallery-lightbox-inner {
    width: min(1400px, 100%);
}

.gallery-lightbox-inner img {
    display: block;
    width: 100%;
    max-height: 76vh;
    border-radius: 14px;
    object-fit: contain;
}

.gallery-lightbox-close {
    position: fixed;
    top: 20px;
    right: 22px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    background: rgba(0, 0, 0, 0.35);
    font-size: 18px;
    cursor: pointer;
}

.gallery-lightbox-caption {
    padding: 22px 0 0;
    color: #fff;
}

.gallery-lightbox-caption h2 {
    margin: 0;
    font: 400 1.8rem/1.2 Georgia, serif;
}

.gallery-lightbox-caption p {
    max-width: 850px;
    margin: 10px 0 0;
    color: rgba(255, 255, 255, 0.62);
    line-height: 1.7;
}

@media (max-width: 1050px) {
    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .gallery-hero {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    height: auto;
    max-height: none;
    padding: 176px 20px 62px;
}

.gallery-hero::before {
    background-position: 58% center;
}

.gallery-hero-glow {
    background:
        linear-gradient(
            180deg,
            rgba(3, 4, 3, 0.30),
            rgba(3, 4, 3, 0.96) 80%
        );
}

    .gallery-hero h1 {
        font-size: clamp(2.65rem, 12vw, 3.7rem);
    }

    .gallery-content {
        padding: 75px 20px;
    }

    .gallery-heading {
        grid-template-columns: 1fr;
        gap: 22px;
        margin-bottom: 35px;
    }

    .gallery-heading h2 {
        font-size: clamp(2.4rem, 11vw, 3.4rem);
    }

    .gallery-filters {
        flex-wrap: nowrap;
        margin-right: -20px;
        margin-bottom: 35px;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .gallery-filters::-webkit-scrollbar {
        display: none;
    }

    .gallery-filters a {
        flex: 0 0 auto;
    }

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

    .gallery-card.is-featured {
        grid-column: auto;
    }

    .gallery-card.is-featured .gallery-image-button,
    .gallery-image-button {
        aspect-ratio: 4 / 3;
    }

    .gallery-footer {
        align-items: flex-start;
        flex-direction: column;
        padding: 40px 20px;
    }

    .gallery-lightbox {
        padding: 70px 15px 25px;
    }
}
@media (min-width: 768px) {
    .gallery-page .gallery-hero h1 {
        font-size: clamp(2.5rem, 3vw, 3.4rem);
    }
}
#galleryFilters {
    scroll-margin-top: 110px;
}

.gallery-lightbox {
    overflow: hidden;
}

.gallery-lightbox-toolbar {
    position: fixed;
    top: 20px;
    right: 22px;
    left: 22px;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    pointer-events: none;
}

.gallery-lightbox-counter {
    margin-right: auto;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.gallery-lightbox-toolbar button {
    pointer-events: auto;
}

.gallery-lightbox-toolbar .gallery-lightbox-close,
.gallery-lightbox-play {
    position: static;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    color: #fff;
    background: rgba(7, 8, 7, 0.56);
    font-size: 17px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition:
        border-color 200ms ease,
        background-color 200ms ease,
        transform 200ms ease;
}

.gallery-lightbox-toolbar .gallery-lightbox-close:hover,
.gallery-lightbox-play:hover {
    border-color: rgba(208, 164, 94, 0.8);
    background: rgba(208, 164, 94, 0.2);
    transform: scale(1.05);
}

.gallery-lightbox-navigation {
    position: fixed;
    top: 50%;
    z-index: 4;
    display: grid;
    width: 52px;
    height: 52px;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.23);
    border-radius: 50%;
    color: #fff;
    background: rgba(7, 8, 7, 0.52);
    font-size: 22px;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition:
        border-color 200ms ease,
        background-color 200ms ease,
        transform 200ms ease;
}

.gallery-lightbox-navigation:hover {
    border-color: rgba(208, 164, 94, 0.8);
    background: rgba(208, 164, 94, 0.2);
}

.gallery-lightbox-previous {
    left: 24px;
}

.gallery-lightbox-next {
    right: 24px;
}

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

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

.gallery-lightbox-inner {
    position: relative;
    width: min(1180px, calc(100% - 140px));
}

.gallery-lightbox-image-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    height: min(68vh, 760px);
    gap: 0;
    place-items: center;
    overflow: hidden;
    border-radius: 28px;
    background: #090a09;
}

.gallery-lightbox-image-stage img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 28px !important;
    clip-path: inset(0 round 28px);
    object-fit: contain;
    opacity: 1;
    transform: scale(1);
    transition:
        opacity 360ms ease,
        transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: opacity, transform;
}

.gallery-lightbox.is-changing .gallery-lightbox-image-stage img {
    opacity: 0;
    transform: scale(0.985);
}

.gallery-lightbox-caption {
    transition:
        opacity 250ms ease,
        transform 250ms ease;
}

.gallery-lightbox.is-changing .gallery-lightbox-caption {
    opacity: 0;
    transform: translateY(7px);
}

.gallery-lightbox-progress {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 5;
    height: 3px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.10);
}

.gallery-lightbox-progress span {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        #a8752f,
        #e3bd79
    );
    transform: scaleX(0);
    transform-origin: left center;
}

.gallery-lightbox-progress span.is-running {
    animation: gallerySlideshowProgress 5s linear forwards;
}

@keyframes gallerySlideshowProgress {
    from {
        transform: scaleX(0);
    }

    to {
        transform: scaleX(1);
    }
}

@media (max-width: 767.98px) {
    .gallery-card {
        border-radius: 14px;
    }

    .gallery-image-button {
        border-radius: 13px 13px 0 0;
    }

    .gallery-lightbox-image-stage,
    .gallery-lightbox-image-stage img {
        border-radius: 14px !important;
    }

    .gallery-lightbox {
        padding: 70px 14px 88px;
    }

    .gallery-lightbox-toolbar {
        top: 14px;
        right: 14px;
        left: 14px;
        z-index: 100;
    }

    .gallery-lightbox-toolbar .gallery-lightbox-close,
    .gallery-lightbox-play {
        width: 42px;
        height: 42px;
    }

    .gallery-lightbox-toolbar .gallery-lightbox-close {
        position: fixed !important;
        top: max(14px, env(safe-area-inset-top));
        right: 14px;
        left: auto;
        z-index: 2147483646;
        display: grid !important;
        pointer-events: auto !important;
        touch-action: manipulation;
        color: #fff !important;
        background: rgba(7, 8, 7, 0.88) !important;
    }

    .gallery-lightbox-toolbar .gallery-lightbox-close span {
        display: block;
        font-family: Arial, sans-serif;
        font-size: 30px;
        font-weight: 300;
        line-height: 1;
    }

    .gallery-lightbox-inner {
        width: 100%;
    }

    .gallery-lightbox-image-stage {
        width: 100%;
        height: clamp(280px, calc(100dvh - 210px), 560px);
        min-height: 0;
    }

    .gallery-lightbox-image-stage img {
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 100%;
        overflow: hidden;
        border-radius: 18px !important;
        clip-path: inset(0 round 18px) !important;
    }

    .gallery-lightbox-navigation {
        top: auto;
        bottom: 20px;
        z-index: 10;
        display: grid !important;
        width: 44px;
        height: 44px;
        font-size: 18px;
        transform: none;
    }

    .gallery-lightbox-previous {
        right: auto;
        left: calc(50% - 78px);
    }

    .gallery-lightbox-next {
        right: calc(50% - 78px);
        left: auto;
    }

    .gallery-lightbox-play {
        position: fixed !important;
        right: auto !important;
        bottom: 20px;
        left: 50%;
        z-index: 10;
        display: grid !important;
        transform: translateX(-50%);
    }

    .gallery-lightbox-play:hover {
        transform: translateX(-50%);
    }

    .gallery-lightbox-previous:hover,
    .gallery-lightbox-next:hover {
        transform: none;
    }

    .gallery-lightbox-caption {
        padding: 14px 10px 0;
        text-align: center;
    }

    .gallery-lightbox-caption h2 {
        font-size: 1.45rem;
    }

    .gallery-lightbox-caption p {
        font-size: 0.86rem;
        line-height: 1.6;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-lightbox-image-stage img,
    .gallery-lightbox-caption {
        transition: none;
    }
}
