/* =========================================================
   PREMIUM CHURCH GALLERY
   External stylesheet for gallery.php
   Responsive: 4 columns desktop, 3 tablet, 2 mobile
========================================================= */

.gallery-page {
    --gallery-accent: var(--main-color, #7a1d7c) !important;
    --gallery-gold: #d8b46a !important;
    --gallery-ink: #25232a !important;
    --gallery-muted: #77737b !important;
    --gallery-border: rgba(36, 29, 40, 0.09) !important;
    --gallery-card-radius: 16px !important;
}

/* Hero and page spacing */
.gallery-page .extra-hero {
    position: relative !important;
    overflow: hidden !important;
}

.gallery-page .extra-hero-inner {
    position: relative !important;
    z-index: 1 !important;
}

.gallery-page .extra-breadcrumb {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
}

.gallery-page .extra-kicker {
    display: inline-flex !important;
    align-items: center !important;
    gap: 9px !important;
    letter-spacing: .16em !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.5 !important;
}

.gallery-page .extra-kicker::before {
    content: "" !important;
    width: 24px !important;
    height: 2px !important;
    border-radius: 2px !important;
    background: var(--gallery-gold) !important;
}

.gallery-page .extra-hero h1 {
    max-width: 850px !important;
    text-wrap: balance !important;
}

.gallery-page .extra-hero p {
    max-width: 620px !important;
    line-height: 1.8 !important;
}

/* Main content */
.gallery-page .extra-content {
    padding-top: clamp(38px, 5vw, 76px) !important;
    padding-bottom: clamp(48px, 6vw, 88px) !important;
}

.gallery-page .gallery-page-heading {
    display: flex !important;
    align-items: flex-end !important;
    justify-content: space-between !important;
    gap: 28px !important;
    margin-bottom: 28px !important;
}

.gallery-page .gallery-page-heading > div:first-child {
    min-width: 0 !important;
}

.gallery-page .gallery-page-heading h2 {
    margin: 10px 0 8px !important;
    text-wrap: balance !important;
}

.gallery-page .gallery-page-heading p {
    max-width: 620px !important;
    margin: 0 !important;
    color: var(--gallery-muted) !important;
    line-height: 1.75 !important;
}

.gallery-page .gallery-page-mark {
    display: inline-flex !important;
    flex: 0 0 auto !important;
    align-items: center !important;
    gap: 11px !important;
    padding: 13px 16px !important;
    border: 1px solid var(--gallery-border) !important;
    border-radius: 999px !important;
    background: rgba(255, 255, 255, .72) !important;
    color: var(--gallery-muted) !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: .12em !important;
}

.gallery-page .gallery-page-mark i {
    display: grid !important;
    place-items: center !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: rgba(216, 180, 106, .16) !important;
    color: #a47b31 !important;
    font-size: 15px !important;
}

/* Results / count bar */
.gallery-page .gallery-results-bar {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 14px !important;
    margin: 0 0 22px !important;
    padding: 13px 16px !important;
    border: 1px solid var(--gallery-border) !important;
    border-radius: 12px !important;
    background: linear-gradient(135deg, #fff, #fbf9f6) !important;
    color: var(--gallery-muted) !important;
    font-size: 12px !important;
    line-height: 1.5 !important;
}

.gallery-page .gallery-results-bar > span {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.gallery-page .gallery-results-bar > span:first-child {
    color: var(--gallery-ink) !important;
    font-weight: 800 !important;
}

.gallery-page .gallery-results-bar i {
    color: #b28b48 !important;
    font-size: 15px !important;
}

/* Responsive image grid */
.gallery-page .gallery-page-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 22px !important;
    align-items: stretch !important;
    width: 100% !important;
}

.gallery-page .gallery-page-item {
    position: relative !important;
    min-width: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    isolation: isolate !important;
    border: 1px solid rgba(28, 24, 32, .07) !important;
    border-radius: var(--gallery-card-radius) !important;
    background: #f3f0eb !important;
    box-shadow: 0 8px 28px rgba(26, 20, 30, .07) !important;
    transform: translateZ(0) !important;
    transition: box-shadow .3s ease, transform .3s ease, border-color .3s ease !important;
}

.gallery-page .gallery-page-item > a {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    overflow: hidden !important;
    aspect-ratio: 4 / 3 !important;
    background: #eee9e1 !important;
    color: #fff !important;
    text-decoration: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.gallery-page .gallery-page-item img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
    transition: transform .65s cubic-bezier(.2, .7, .2, 1), filter .4s ease !important;
}

.gallery-page .gallery-page-item > a::after {
    content: "" !important;
    position: absolute !important;
    inset: 25% 0 0 !important;
    z-index: 1 !important;
    background: linear-gradient(
        180deg,
        rgba(15, 12, 18, 0) 0%,
        rgba(15, 12, 18, .08) 28%,
        rgba(15, 12, 18, .72) 100%
    );
    pointer-events: none !important;
    transition: opacity .3s ease !important;
}

.gallery-page .gallery-image-overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 2 !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    padding: 14px !important;
    pointer-events: none !important;
}

.gallery-page .gallery-image-zoom {
    display: flex !important;
    align-self: flex-end !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    border: 1px solid rgba(255, 255, 255, .58) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .18) !important;
    color: #fff !important;
    font-size: 14px !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    opacity: 0 !important;
    transform: translateY(5px) scale(.94) !important;
    transition: opacity .25s ease, transform .25s ease, background .25s ease !important;
}

.gallery-page .gallery-image-caption {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
}

.gallery-page .gallery-image-caption small {
    color: #f5d79a !important;
    font-size: 10px !important;
    font-weight: 800 !important;
    letter-spacing: .12em !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere !important;
}

/* Hover effects for mouse / trackpad */
@media (hover: hover) and (pointer: fine) {
    .gallery-page .gallery-page-item:hover {
        transform: translateY(-5px) !important;
        border-color: rgba(216, 180, 106, .45) !important;
        box-shadow: 0 18px 40px rgba(26, 20, 30, .15) !important;
    }

    .gallery-page .gallery-page-item:hover img,
    .gallery-page .gallery-page-item:focus-within img {
        transform: scale(1.07) !important;
    }

    .gallery-page .gallery-page-item:hover .gallery-image-zoom,
    .gallery-page .gallery-page-item:focus-within .gallery-image-zoom {
        opacity: 1 !important;
        transform: translateY(0) scale(1) !important;
    }
}

/* Keyboard accessibility */
.gallery-page .gallery-page-item > a:focus-visible {
    outline: 3px solid var(--gallery-gold) !important;
    outline-offset: -4px !important;
}

.gallery-page .gallery-page-item > a:focus-visible .gallery-image-zoom {
    opacity: 1 !important;
    transform: none !important;
}

/* Empty state */
.gallery-page .gallery-empty-state {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    padding: clamp(36px, 7vw, 76px) 24px !important;
    border: 1px dashed rgba(122, 29, 124, .22) !important;
    border-radius: 20px !important;
    background: linear-gradient(145deg, #fff, #fbf8fc) !important;
    text-align: center !important;
}

.gallery-page .gallery-empty-icon {
    display: grid !important;
    place-items: center !important;
    width: 66px !important;
    height: 66px !important;
    margin-bottom: 18px !important;
    border-radius: 50% !important;
    background: rgba(122, 29, 124, .08) !important;
    color: var(--gallery-accent) !important;
    font-size: 25px !important;
}

.gallery-page .gallery-empty-state h3 {
    margin: 0 0 10px !important;
    text-wrap: balance !important;
}

.gallery-page .gallery-empty-state p {
    max-width: 500px !important;
    margin: 0 !important;
    color: var(--gallery-muted) !important;
    line-height: 1.8 !important;
}

/* Pagination spacing, without overriding the site's pagination component */
.gallery-page .pagination,
.gallery-page nav[aria-label*="Pagination"] {
    margin-top: 34px !important;
}

/* Bottom call to action */
.gallery-page .gallery-bottom-cta {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 28px !important;
    margin-top: clamp(42px, 6vw, 76px) !important;
    padding: clamp(24px, 4vw, 42px) !important;
    overflow: hidden !important;
    border: 1px solid rgba(216, 180, 106, .25) !important;
    border-radius: 20px !important;
    background:
        radial-gradient(circle at 100% 0%, rgba(216, 180, 106, .15), transparent 36%),
        linear-gradient(135deg, #fff, #fbf8f2);
    box-shadow: 0 12px 34px rgba(26, 20, 30, .055) !important;
}

.gallery-page .gallery-bottom-cta > div {
    min-width: 0 !important;
}

.gallery-page .gallery-bottom-cta h2 {
    margin: 9px 0 8px !important;
    text-wrap: balance !important;
}

.gallery-page .gallery-bottom-cta p {
    max-width: 600px !important;
    margin: 0 !important;
    color: var(--gallery-muted) !important;
    line-height: 1.75 !important;
}

.gallery-page .gallery-bottom-cta .btn-gold {
    flex: 0 0 auto !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    min-height: 48px !important;
    padding: 13px 20px !important;
    border-radius: 999px !important;
    text-decoration: none !important;
    white-space: nowrap !important;
    transition: transform .25s ease, box-shadow .25s ease !important;
}

.gallery-page .gallery-bottom-cta .btn-gold:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 22px rgba(0, 0, 0, .12) !important;
}

/* Laptop / smaller desktop */
@media (max-width: 1199px) {
    .gallery-page .gallery-page-grid {
        gap: 18px !important;
    }

    .gallery-page .gallery-image-overlay {
        padding: 12px !important;
    }
}

/* Tablet: 3 columns */
@media (max-width: 991px) {
    .gallery-page .gallery-page-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 16px !important;
    }

    .gallery-page .gallery-page-heading {
        gap: 18px !important;
    }

    .gallery-page .gallery-page-mark {
        padding: 10px 13px !important;
        letter-spacing: .08em !important;
    }
}

/* Mobile: keep two equal columns */
@media (max-width: 767px) {
    .gallery-page .extra-content {
        padding-top: 34px !important;
        padding-bottom: 48px !important;
    }

    .gallery-page .gallery-page-heading {
        align-items: flex-start !important;
        margin-bottom: 20px !important;
    }

    .gallery-page .gallery-page-heading h2 {
        margin-top: 8px !important;
    }

    .gallery-page .gallery-page-mark {
        display: none !important;
    }

    .gallery-page .gallery-results-bar {
        gap: 8px !important;
        margin-bottom: 15px !important;
        padding: 11px 12px !important;
        border-radius: 10px !important;
        font-size: 11px !important;
    }

    .gallery-page .gallery-page-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 13px !important;
    }

    .gallery-page .gallery-page-item {
        border-radius: 12px !important;
        box-shadow: 0 5px 18px rgba(26, 20, 30, .07) !important;
    }

    .gallery-page .gallery-page-item > a {
        aspect-ratio: 4 / 4.35 !important;
    }

    .gallery-page .gallery-image-overlay {
        padding: 9px !important;
    }

    .gallery-page .gallery-image-zoom {
        width: 31px !important;
        height: 31px !important;
        font-size: 12px !important;
        opacity: 1 !important;
        transform: none !important;
        background: rgba(20, 17, 22, .24) !important;
    }

    .gallery-page .gallery-image-caption small {
        font-size: 8px !important;
        letter-spacing: .07em !important;
    }

    .gallery-page .gallery-bottom-cta {
        align-items: flex-start !important;
        flex-direction: column !important;
        gap: 20px !important;
        margin-top: 38px !important;
        padding: 24px 20px !important;
        border-radius: 16px !important;
    }

    .gallery-page .gallery-bottom-cta .btn-gold {
        width: 100% !important;
        white-space: normal !important;
    }
}

/* Small phones */
@media (max-width: 420px) {
    .gallery-page .gallery-page-grid {
        gap: 9px !important;
    }

    .gallery-page .gallery-page-item {
        border-radius: 10px !important;
    }

    .gallery-page .gallery-page-item > a {
        aspect-ratio: 1 / 1.12 !important;
    }

    .gallery-page .gallery-image-overlay {
        padding: 7px !important;
    }

    .gallery-page .gallery-image-zoom {
        width: 28px !important;
        height: 28px !important;
        font-size: 11px !important;
    }

    .gallery-page .gallery-image-caption small {
        font-size: 7px !important;
        letter-spacing: .045em !important;
    }

    .gallery-page .gallery-results-bar {
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    .gallery-page .gallery-page-heading p,
    .gallery-page .gallery-bottom-cta p {
        font-size: 13px !important;
        line-height: 1.7 !important;
    }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
    .gallery-page .gallery-page-item,
    .gallery-page .gallery-page-item img,
    .gallery-page .gallery-image-zoom,
    .gallery-page .gallery-bottom-cta .btn-gold {
        transition: none !important;
        transform: none !important;
    }
}


/* =========================================================
   FINAL IMAGE-FIT OVERRIDE
   Prevents theme styles from leaving blank space under images.
========================================================= */
.gallery-page .gallery-page-grid .gallery-page-item,
.gallery-page .gallery-page-grid .gallery-page-item > a {
    height: auto !important;
    min-height: 0 !important;
    line-height: 0 !important;
}

.gallery-page .gallery-page-grid .gallery-page-item {
    display: block !important;
    padding: 0 !important;
}

.gallery-page .gallery-page-grid .gallery-page-item > a {
    display: block !important;
    position: relative !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    overflow: hidden !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #eee9e1 !important;
}

.gallery-page .gallery-page-grid .gallery-page-item > a > img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    object-fit: cover !important;
    object-position: center center !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    vertical-align: top !important;
    line-height: 0 !important;
}

.gallery-page .gallery-page-grid .gallery-page-item > a::after {
    inset: 0 !important;
    background: linear-gradient(
        180deg,
        rgba(15, 12, 18, 0) 35%,
        rgba(15, 12, 18, .12) 55%,
        rgba(15, 12, 18, .78) 100%
    ) !important;
}

.gallery-page .gallery-page-grid .gallery-image-overlay {
    position: absolute !important;
    inset: 0 !important;
    line-height: normal !important;
}

@media (max-width: 767px) {
    .gallery-page .gallery-page-grid .gallery-page-item > a {
        aspect-ratio: 4 / 4.35 !important;
    }
}

@media (max-width: 420px) {
    .gallery-page .gallery-page-grid .gallery-page-item > a {
        aspect-ratio: 1 / 1.12 !important;
    }
}



.gallery-page .gallery-page-grid > figure.gallery-card-fixed {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    aspect-ratio: 4 / 3 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    line-height: 0 !important;
}

.gallery-page .gallery-page-grid > figure.gallery-card-fixed > a.gallery-lightbox-link {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
}

.gallery-page .gallery-page-grid > figure.gallery-card-fixed > a.gallery-lightbox-link > img {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
    object-fit: cover !important;
    object-position: center !important;
}