:root {
    --gallery-forest: #173d2b;
    --gallery-forest-dark: #0d241a;
    --gallery-leaf: #2f6a4b;
    --gallery-gold: #d5ad52;
    --gallery-cream: #f7f3e8;
    --gallery-ink: #17221c;
    --gallery-muted: #68736d;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #fff;
    color: var(--gallery-ink);
}

.gallery-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
}

.gallery-navbar .nav-link.active {
    color: #fff;
    font-weight: 700;
    position: relative;
}

.gallery-navbar .nav-link.active::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: .15rem;
    height: 2px;
    background: var(--gallery-gold);
}

.gallery-hero {
    min-height: 68vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    background: url('../images/gallery/gallery-004.webp') center 38% / cover no-repeat;
}

.gallery-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(8, 28, 18, .86) 0%, rgba(8, 28, 18, .62) 46%, rgba(8, 28, 18, .2) 100%);
}

.gallery-hero-overlay {
    position: absolute;
    inset: auto 0 0;
    height: 28%;
    background: linear-gradient(to top, rgba(8, 28, 18, .42), transparent);
    z-index: 1;
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    max-width: 760px;
    margin-left: max(0px, calc((100% - 1140px) / 2));
    padding-top: 5rem;
    padding-bottom: 5rem;
    color: #fff;
}

.gallery-eyebrow,
.gallery-kicker {
    margin: 0 0 .75rem;
    letter-spacing: .13em;
    font-size: .78rem;
    font-weight: 800;
    color: var(--gallery-gold);
}

.gallery-hero h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: .98;
    font-weight: 700;
    margin-bottom: 1.4rem;
}

.gallery-hero p:not(.gallery-eyebrow) {
    font-size: clamp(1.05rem, 1.8vw, 1.3rem);
    line-height: 1.7;
    max-width: 680px;
    color: rgba(255,255,255,.9);
}

.gallery-hero-btn,
.gallery-primary-btn {
    background: var(--gallery-gold);
    border: 1px solid var(--gallery-gold);
    color: #152018;
    font-weight: 800;
    border-radius: 999px;
    padding: .85rem 1.35rem;
    transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.gallery-hero-btn:hover,
.gallery-primary-btn:hover {
    background: #e0bd69;
    border-color: #e0bd69;
    color: #152018;
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,.16);
}

.gallery-intro {
    background: var(--gallery-cream);
    padding: clamp(3.5rem, 7vw, 6.5rem) 0;
}

.gallery-intro-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    gap: clamp(2rem, 6vw, 6rem);
    align-items: end;
}

.gallery-intro h2,
.gallery-toolbar h2,
.gallery-cta h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
    line-height: 1.1;
}

.gallery-intro h2 {
    font-size: clamp(2rem, 4vw, 3.7rem);
    margin: 0;
    max-width: 680px;
}

.gallery-intro-copy {
    color: var(--gallery-muted);
    font-size: 1.08rem;
    line-height: 1.8;
    margin: 0;
}

.gallery-collection {
    padding: clamp(3.5rem, 7vw, 6rem) 0;
    background: #fff;
}

.gallery-toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2.2rem;
}

.gallery-toolbar h2 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    margin: 0;
}

.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .65rem;
}

.gallery-filter {
    border: 1px solid #d8ded9;
    background: #fff;
    color: #304039;
    border-radius: 999px;
    padding: .62rem .9rem;
    font-size: .9rem;
    font-weight: 700;
    transition: .2s ease;
}

.gallery-filter span {
    display: inline-grid;
    place-items: center;
    min-width: 1.55rem;
    height: 1.55rem;
    margin-left: .35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    background: #eef2ef;
    color: #6a756f;
    font-size: .72rem;
}

.gallery-filter:hover,
.gallery-filter.active {
    background: var(--gallery-forest);
    border-color: var(--gallery-forest);
    color: #fff;
}

.gallery-filter.active span,
.gallery-filter:hover span {
    background: rgba(255,255,255,.16);
    color: #fff;
}

.gallery-grid {
    column-count: 4;
    column-gap: 1rem;
}

.gallery-card {
    margin: 0 0 1rem;
    break-inside: avoid;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #edf0ed;
    box-shadow: 0 6px 20px rgba(16, 44, 29, .08);
    transform: translateZ(0);
}

.gallery-card[hidden] {
    display: none !important;
}

.gallery-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    position: relative;
    cursor: zoom-in;
    text-align: left;
}

.gallery-open img {
    display: block;
    width: 100%;
    height: auto;
    transition: transform .45s cubic-bezier(.2,.7,.2,1), filter .35s ease;
}

.gallery-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: flex-start;
    padding: 1rem;
    color: #fff;
    background: linear-gradient(to top, rgba(6, 22, 14, .9) 0%, rgba(6, 22, 14, .5) 36%, transparent 70%);
    opacity: 0;
    transition: opacity .3s ease;
}

.gallery-card:hover .gallery-card-overlay,
.gallery-open:focus-visible .gallery-card-overlay {
    opacity: 1;
}

.gallery-card:hover img {
    transform: scale(1.035);
    filter: saturate(1.05);
}

.gallery-category {
    display: inline-block;
    margin-bottom: .35rem;
    color: #f2d28d;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.gallery-caption {
    display: block;
    font-weight: 700;
    font-size: .96rem;
    line-height: 1.35;
}

.gallery-view {
    margin-top: .6rem;
    font-size: .78rem;
    opacity: .9;
}

.gallery-empty {
    text-align: center;
    color: var(--gallery-muted);
    padding: 4rem 1rem;
}

.gallery-empty i {
    font-size: 2.5rem;
    color: #aab4ae;
    margin-bottom: 1rem;
}

.gallery-cta {
    padding: 0 0 clamp(4rem, 8vw, 7rem);
}

.gallery-cta-box {
    display: grid;
    grid-template-columns: 1.4fr .6fr;
    gap: 3rem;
    align-items: center;
    padding: clamp(2rem, 5vw, 4.5rem);
    border-radius: 24px;
    background: linear-gradient(135deg, var(--gallery-forest-dark), var(--gallery-forest));
    color: #fff;
    box-shadow: 0 24px 55px rgba(13,36,26,.18);
}

.gallery-cta h2 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    margin-bottom: 1rem;
}

.gallery-cta p:not(.gallery-kicker) {
    margin: 0;
    color: rgba(255,255,255,.78);
    line-height: 1.7;
}

.gallery-cta-actions {
    display: flex;
    flex-direction: column;
    gap: .8rem;
}

.gallery-secondary-btn {
    border: 1px solid rgba(255,255,255,.48);
    color: #fff;
    border-radius: 999px;
    padding: .85rem 1.35rem;
    font-weight: 800;
}

.gallery-secondary-btn:hover {
    background: #fff;
    border-color: #fff;
    color: var(--gallery-forest-dark);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: grid;
    place-items: center;
    padding: 1.25rem 5rem;
    background: rgba(4, 12, 8, .95);
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
}

.gallery-lightbox.open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lightbox-content {
    width: min(1120px, 100%);
    height: min(82vh, 850px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-content img {
    max-width: 100%;
    max-height: calc(82vh - 84px);
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 22px 70px rgba(0,0,0,.35);
}

#lightboxCaption {
    color: #fff;
    font-weight: 700;
    text-align: center;
    margin: 1rem 0 .15rem;
}

.lightbox-counter {
    color: rgba(255,255,255,.62);
    font-size: .82rem;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    border: 1px solid rgba(255,255,255,.2);
    background: rgba(255,255,255,.08);
    color: #fff;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    transition: .2s ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background: #fff;
    color: #111;
}

.lightbox-close {
    top: 1.1rem;
    right: 1.1rem;
}

.lightbox-prev { left: 1.2rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.2rem; top: 50%; transform: translateY(-50%); }

.lightbox-loader {
    position: absolute;
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: gallery-spin .8s linear infinite;
    display: none;
}

.lightbox-loader.show { display: block; }

@keyframes gallery-spin { to { transform: rotate(360deg); } }

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

/* Gallery preview on the homepage */
.home-gallery-preview {
    padding: 5rem 0;
    background: #f7f3e8;
}

.home-gallery-preview .home-gallery-heading {
    max-width: 720px;
    margin: 0 auto 2.2rem;
}

.home-gallery-preview .home-gallery-heading h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-weight: 700;
}

.home-gallery-preview-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 155px;
    gap: .8rem;
}

.home-gallery-preview-grid a {
    display: block;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 7px 20px rgba(16,44,29,.12);
}

.home-gallery-preview-grid a:first-child,
.home-gallery-preview-grid a:nth-child(4) {
    grid-column: span 2;
    grid-row: span 2;
}

.home-gallery-preview-grid a:nth-child(2),
.home-gallery-preview-grid a:nth-child(3),
.home-gallery-preview-grid a:nth-child(5),
.home-gallery-preview-grid a:nth-child(6) {
    grid-column: span 2;
}

.home-gallery-preview-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease;
}

.home-gallery-preview-grid a:hover img { transform: scale(1.04); }

.home-gallery-preview .btn {
    border-radius: 999px;
    font-weight: 700;
    padding: .75rem 1.2rem;
}

@media (max-width: 1199.98px) {
    .gallery-grid { column-count: 3; }
    .home-gallery-preview-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 991.98px) {
    .gallery-hero { min-height: 60vh; }
    .gallery-hero::after { background: rgba(8,28,18,.66); }
    .gallery-intro-grid,
    .gallery-cta-box { grid-template-columns: 1fr; }
    .gallery-toolbar { align-items: flex-start; flex-direction: column; }
    .gallery-filters { justify-content: flex-start; }
    .gallery-grid { column-count: 2; }
    .gallery-lightbox { padding: 4.8rem 1rem 5.5rem; }
    .lightbox-prev { left: calc(50% - 58px); top: auto; bottom: 1rem; transform: none; }
    .lightbox-next { right: calc(50% - 58px); top: auto; bottom: 1rem; transform: none; }
    .home-gallery-preview-grid { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 135px; }
}

@media (max-width: 575.98px) {
    .gallery-hero { min-height: 65vh; background-position: 58% center; }
    .gallery-hero-content { padding: 4rem 1.1rem; }
    .gallery-hero h1 { font-size: 3.25rem; }
    .gallery-intro,
    .gallery-collection { padding-left: .2rem; padding-right: .2rem; }
    .gallery-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        padding-bottom: .4rem;
        scrollbar-width: thin;
    }
    .gallery-filter { flex: 0 0 auto; }
    .gallery-grid { column-count: 1; column-gap: 0; }
    .gallery-card { border-radius: 13px; }
    .gallery-card-overlay { opacity: 1; background: linear-gradient(to top, rgba(6,22,14,.82), transparent 55%); }
    .gallery-caption { font-size: .9rem; }
    .gallery-view { display: none; }
    .gallery-cta-box { border-radius: 0; margin-left: -.75rem; margin-right: -.75rem; }
    .home-gallery-preview-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 140px; }
    .home-gallery-preview-grid a,
    .home-gallery-preview-grid a:first-child,
    .home-gallery-preview-grid a:nth-child(4) { grid-column: span 1; grid-row: span 1; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
