/* Page-specific CSS for Image Gallery. Shared design tokens/utilities live in layout.css. */
.gallery-page {
    overflow-x: hidden;
}

.gallery-section {
    padding: 0 0 3.75rem;
    margin: 0 0 3.75rem;
    border-bottom: 1px solid rgba(13, 48, 35, 0.12);
}

.gallery-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: 0;
}

.gallery-section__header {
    max-width: 920px;
    margin-bottom: 1.4rem;
}

.gallery-section__eyebrow {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0.55rem;
    color: #d79d1e;
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gallery-section__title {
    color: #08291d;
    /* --font-display is not defined anywhere on the site, so the fallback is what renders; it now
       names the site's display face (the one .font-display uses) instead of dropping to Georgia. */
    font-family: var(--font-display, "Playfair Display", Georgia, serif);
    font-size: clamp(1.55rem, 3vw, 2.65rem);
    font-weight: 800;
    line-height: 1.16;
    overflow-wrap: anywhere;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.gallery-card {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    padding: 0;
    border: 1px solid rgba(13, 48, 35, 0.12);
    border-radius: 0.75rem;
    background: #f8f2e4;
    box-shadow: 0 14px 28px rgba(8, 41, 29, 0.08);
    cursor: pointer;
}

.gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease, filter 300ms ease;
}

.gallery-card__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 1.65rem;
    background: rgba(8, 41, 29, 0);
    opacity: 0;
    transition: opacity 250ms ease, background-color 250ms ease;
}

.gallery-card:hover img,
.gallery-card:focus-visible img {
    transform: scale(1.06);
    filter: saturate(1.04);
}

.gallery-card:hover .gallery-card__overlay,
.gallery-card:focus-visible .gallery-card__overlay {
    background: rgba(8, 41, 29, 0.42);
    opacity: 1;
}

.gallery-card:focus-visible {
    outline: 3px solid #f6c22b;
    outline-offset: 3px;
}

/* Cards waiting behind "Load More". Needed explicitly: .gallery-card's display:block has the same
   specificity as the base [hidden] rule and loads later, so it would otherwise win and show them. */
.gallery-card[hidden] {
    display: none;
}

/* ---- Album list ---------------------------------------------------------------------------- */

.gallery-album-meta {
    margin-top: 0.55rem;
    color: #6b7280;
    font-size: 0.95rem;
}

.gallery-album-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
    margin-top: 0.4rem;
}

.gallery-album-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(13, 48, 35, 0.12);
    border-radius: 0.75rem;
    background: #ffffff;
    box-shadow: 0 14px 28px rgba(8, 41, 29, 0.08);
    color: inherit;
    text-decoration: none;
    transition: transform 250ms ease, box-shadow 250ms ease;
}

.gallery-album-card:hover,
.gallery-album-card:focus-visible {
    transform: translateY(-3px);
    box-shadow: 0 20px 36px rgba(8, 41, 29, 0.14);
}

.gallery-album-card:focus-visible {
    outline: 3px solid #f6c22b;
    outline-offset: 3px;
}

.gallery-album-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f8f2e4;
}

.gallery-album-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms ease;
}

.gallery-album-card:hover .gallery-album-card__media img,
.gallery-album-card:focus-visible .gallery-album-card__media img {
    transform: scale(1.05);
}

.gallery-album-card__video {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 3.25rem;
    background: linear-gradient(135deg, #0d3023, #1e7e56);
}

.gallery-album-card__count {
    position: absolute;
    left: 0.75rem;
    bottom: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(8, 41, 29, 0.78);
}

.gallery-album-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1.1rem 1.2rem 1.25rem;
}

.gallery-album-card__title {
    display: -webkit-box;
    overflow: hidden;
    color: #08291d;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 1.12rem;
    font-weight: 700;
    line-height: 1.35;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.gallery-album-card__cta {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: auto;
    color: #1e7e56;
    font-size: 0.9rem;
    font-weight: 700;
}

/* ---- Album page ---------------------------------------------------------------------------- */

.gallery-back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
    color: #1e7e56;
    font-size: 0.95rem;
    font-weight: 600;
    transition: color 200ms ease;
}

.gallery-back-link:hover,
.gallery-back-link:focus-visible {
    color: #0d3023;
}

/* Long album titles are truncated in the hero breadcrumb; the full title is the heading below. */
.gallery-breadcrumb-current {
    display: inline-block;
    max-width: min(60vw, 26rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.gallery-load-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    margin-top: 2.25rem;
}

.gallery-load-more__status {
    color: #6b7280;
    font-size: 0.9rem;
}

/* Responsive 16:9 video embed for sections that have a video instead of photos on the reference gallery */
.gallery-video {
    position: relative;
    width: 100%;
    max-width: 920px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border: 1px solid rgba(13, 48, 35, 0.12);
    border-radius: 0.75rem;
    background: #f8f2e4;
    box-shadow: 0 14px 28px rgba(8, 41, 29, 0.08);
}

.gallery-video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}

.gallery-lightbox.is-open {
    display: flex;
}

.gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(3, 20, 14, 0.88);
    cursor: zoom-out;
}

.gallery-lightbox__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    width: min(1120px, 100%);
    gap: 0.85rem;
}

.gallery-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    margin: 0;
}

.gallery-lightbox__image {
    display: block;
    max-width: 100%;
    max-height: 82vh;
    border-radius: 0.6rem;
    object-fit: contain;
    background: #0a2118;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.38);
}

.gallery-lightbox__caption {
    margin-top: 0.8rem;
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.9rem;
    text-align: center;
}

.gallery-lightbox__close,
.gallery-lightbox__nav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.9rem;
    height: 2.9rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: background-color 200ms ease, transform 200ms ease;
}

.gallery-lightbox__close {
    position: absolute;
    top: -3.4rem;
    right: 0;
}

.gallery-lightbox__close i,
.gallery-lightbox__nav i {
    font-size: 1.45rem;
}

.gallery-lightbox__close:hover,
.gallery-lightbox__close:focus-visible,
.gallery-lightbox__nav:hover,
.gallery-lightbox__nav:focus-visible {
    background: rgba(246, 194, 43, 0.9);
    color: #08291d;
    transform: translateY(-1px);
    outline: 0;
}

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

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

    .gallery-album-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 560px) {
    .gallery-album-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .gallery-section {
        padding-bottom: 2.75rem;
        margin-bottom: 2.75rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .gallery-card {
        border-radius: 0.6rem;
    }

    .gallery-lightbox {
        padding: 0.85rem;
    }

    .gallery-lightbox__dialog {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .gallery-lightbox__image {
        max-height: 74vh;
    }

    .gallery-lightbox__nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
    }

    .gallery-lightbox__nav:hover,
    .gallery-lightbox__nav:focus-visible {
        transform: translateY(-50%);
    }

    .gallery-lightbox__nav--prev {
        left: 0.5rem;
    }

    .gallery-lightbox__nav--next {
        right: 0.5rem;
    }

    .gallery-lightbox__close {
        top: 0.5rem;
        right: 0.5rem;
    }
}

@media (max-width: 420px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }
}
