/**
 * Covenant Path Foundation – Photo Gallery & Lightbox
 * Liquid Glass Design System
 *
 * iPhone Photos-inspired gallery carousel with frosted-glass lightbox.
 * Animations: zoom-open, fade-close, smooth slide transitions.
 *
 * Table of Contents:
 * 1. Section & Header
 * 2. Gallery Viewport & Slides
 * 3. Navigation Controls
 * 4. Thumbnails
 * 5. Dot Indicators (mobile)
 * 6. Lightbox Modal
 * 7. Lightbox Animations
 * 8. Responsive
 * 9. Reduced Motion
 */

/* ===================================
   1. Section & Header
   =================================== */
.section--photo-gallery {
    padding: var(--space-16) 0 var(--space-20);
    position: relative;
    overflow: hidden;
}

.section--photo-gallery .section__header {
    margin-bottom: var(--space-10);
}

/* ===================================
   2. Gallery Viewport & Slides
   =================================== */
.lg-gallery {
    max-width: 960px;
    margin: 0 auto;
}

.lg-gallery__viewport {
    position: relative;
    border-radius: var(--radius-2xl);
    overflow: hidden;
    background: var(--glass-bg-solid);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    box-shadow:
        var(--glass-shadow),
        0 2px 8px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.lg-gallery__track {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

/* Slide */
.lg-gallery__slide {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                visibility 0.6s;
    z-index: 0;
    display: flex;
    flex-direction: column;
}

.lg-gallery__slide.is-active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* Image inside slide */
.lg-gallery__image-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    cursor: zoom-in;
}

/* Ambient blur backdrop – lives as the FIRST child of .lg-gallery__track.
   Updated by JS on every slide change. Shows through during the 0.6 s
   cross-fade, creating a Liquid Glass ambient glow behind the incoming image.
   z-index: 0 + first in DOM  →  behind all slides (z-index: 0 / 1).
   overflow: hidden on the track clips any blur-edge artifacts cleanly. */
.lg-gallery__blur-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: cover;
    background-position: center;
    /* scale(1.12) pushes soft blur edges just outside the overflow boundary */
    transform: scale(1.12);
    filter: blur(32px) saturate(1.5) brightness(0.65);
    -webkit-filter: blur(32px) saturate(1.5) brightness(0.65);
    pointer-events: none;
}

.lg-gallery__image {
    position: relative;    /* needed for zoom-hint z-ordering via DOM order */
    width: 100%;
    height: 100%;
    object-fit: contain;   /* show full image; blur-bg fills the letterbox areas */
    object-position: center;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
}

/* Subtle hover zoom */
.lg-gallery__image-wrap:hover .lg-gallery__image {
    transform: scale(1.03);
}

/* Zoom hint icon */
.lg-gallery__zoom-hint {
    position: absolute;
    bottom: var(--space-4);
    right: var(--space-4);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px) saturate(1.8);
    -webkit-backdrop-filter: blur(12px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--gray-700);
    font-size: var(--text-sm);
    opacity: 0;
    transform: scale(0.8) translateY(4px);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1);
    pointer-events: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lg-gallery__image-wrap:hover .lg-gallery__zoom-hint {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* Caption */
.lg-gallery__caption {
    padding: var(--space-3) var(--space-6);
    text-align: center;
    font-size: var(--text-sm);
    color: var(--gray-600);
    font-family: var(--font-primary);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.4);
    margin: 0;
}

/* ===================================
   3. Navigation Controls
   =================================== */
.lg-gallery__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    color: var(--gray-800);
    font-size: var(--text-lg);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease,
                transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1),
                background 0.2s ease;
}

.lg-gallery__viewport:hover .lg-gallery__nav,
.lg-gallery__nav:focus-visible {
    opacity: 1;
}

.lg-gallery__nav:hover {
    background: rgba(255, 255, 255, 0.92);
    transform: translateY(-50%) scale(1.08);
}

.lg-gallery__nav:active {
    transform: translateY(-50%) scale(0.95);
}

.lg-gallery__nav--prev {
    left: var(--space-4);
}

.lg-gallery__nav--next {
    right: var(--space-4);
}

.lg-gallery__nav:focus-visible {
    outline: 2px solid var(--cpf-primary);
    outline-offset: 2px;
}

/* Slide counter pill */
.lg-gallery__counter {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 10;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-700);
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px) saturate(1.8);
    -webkit-backdrop-filter: blur(12px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: var(--radius-full);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    pointer-events: none;
    font-variant-numeric: tabular-nums;
}

/* ===================================
   4. Thumbnails
   =================================== */
.lg-gallery__thumbnails {
    display: flex;
    gap: var(--space-2);
    justify-content: center;
    padding: var(--space-6) 0 0;
    flex-wrap: wrap;
}

.lg-gallery__thumb {
    position: relative;
    width: 72px;
    height: 54px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
    background: var(--gray-100);
    transition: border-color 0.3s ease,
                transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1),
                box-shadow 0.3s ease;
}

.lg-gallery__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.lg-gallery__thumb:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.lg-gallery__thumb:hover img {
    transform: scale(1.1);
}

.lg-gallery__thumb.is-active {
    border-color: var(--cpf-primary);
    box-shadow: 0 0 0 2px rgba(77, 168, 247, 0.3),
                0 4px 12px rgba(77, 168, 247, 0.15);
}

.lg-gallery__thumb:focus-visible {
    outline: 2px solid var(--cpf-primary);
    outline-offset: 2px;
}

/* ===================================
   5. Dot Indicators (mobile)
   =================================== */
.lg-gallery__dots {
    display: none; /* hidden on desktop, shown on mobile */
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) 0 0;
}

.lg-gallery__dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    border: none;
    padding: 0;
    cursor: pointer;
    background: var(--gray-300);
    transition: all 0.3s cubic-bezier(0.2, 1.1, 0.3, 1);
}

.lg-gallery__dot.is-active {
    background: var(--cpf-primary);
    width: 24px;
    border-radius: 4px;
}

.lg-gallery__dot:focus-visible {
    outline: 2px solid var(--cpf-primary);
    outline-offset: 2px;
}

/* ===================================
   6. Lightbox Modal
   =================================== */

/* Backdrop – deep frosted glass like iPhone Photos */
.lg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Hidden by default */
    visibility: hidden;
    pointer-events: none;
}

.lg-lightbox[aria-hidden="false"] {
    visibility: visible;
    pointer-events: auto;
}

/* Blurred image backdrop.
   JS sets --lb-bg-image via style.setProperty(); ::before applies blur with
   CSS filter (backdrop-filter only blurs content BEHIND the element, not its
   own background-image, so we need a separate pseudo-element + filter). */
.lg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    overflow: hidden;           /* clip the ::before bleed that hides blur-edge halo */
    background-color: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lg-lightbox__backdrop::before {
    content: '';
    position: absolute;
    inset: -50px;               /* extend past edges; filter:blur softens edges */
    background-image: var(--lb-bg-image, none);
    background-size: cover;
    background-position: center;
    filter: blur(45px) saturate(1.6) brightness(0.25);
    z-index: 0;
}

.lg-lightbox[aria-hidden="false"] .lg-lightbox__backdrop {
    opacity: 1;
}

/* Content container */
.lg-lightbox__content {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: var(--space-16) var(--space-6) var(--space-8);
}

/* Close button – top-right frosted pill */
.lg-lightbox__close {
    position: absolute;
    top: var(--space-6);
    right: var(--space-6);
    z-index: 20;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: var(--text-xl);
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.3s ease 0.15s,
                transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1) 0.15s,
                background 0.2s ease;
}

.lg-lightbox[aria-hidden="false"] .lg-lightbox__close {
    opacity: 1;
    transform: scale(1);
}

.lg-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
}

.lg-lightbox__close:active {
    transform: scale(0.92);
}

.lg-lightbox__close:focus-visible {
    outline: 2px solid var(--cpf-primary);
    outline-offset: 2px;
}

/* Lightbox nav arrows */
.lg-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(16px) saturate(1.8);
    -webkit-backdrop-filter: blur(16px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: var(--text-xl);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s,
                transform 0.3s cubic-bezier(0.2, 1.1, 0.3, 1),
                background 0.2s ease;
}

.lg-lightbox[aria-hidden="false"] .lg-lightbox__nav {
    opacity: 0.8;
}

.lg-lightbox__nav:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.22);
    transform: translateY(-50%) scale(1.08);
}

.lg-lightbox__nav:active {
    transform: translateY(-50%) scale(0.92);
}

.lg-lightbox__nav--prev {
    left: var(--space-4);
}

.lg-lightbox__nav--next {
    right: var(--space-4);
}

.lg-lightbox__nav:focus-visible {
    outline: 2px solid var(--cpf-primary);
    outline-offset: 2px;
}

/* Image container */
.lg-lightbox__image-wrap {
    position: relative;
    max-width: 90vw;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lg-lightbox__image {
    max-width: 90vw;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-xl);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5),
                0 8px 24px rgba(0, 0, 0, 0.3);
    /* Zoom-in animation origin */
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.5s cubic-bezier(0.2, 1.1, 0.3, 1);
    will-change: transform, opacity;
}

.lg-lightbox[aria-hidden="false"] .lg-lightbox__image {
    opacity: 1;
    transform: scale(1);
}

/* Closing state animation */
.lg-lightbox.is-closing .lg-lightbox__image {
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.3s ease,
                transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lg-lightbox.is-closing .lg-lightbox__backdrop {
    opacity: 0;
    transition: opacity 0.35s ease;
}

.lg-lightbox.is-closing .lg-lightbox__close,
.lg-lightbox.is-closing .lg-lightbox__nav,
.lg-lightbox.is-closing .lg-lightbox__info {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Slide transition when navigating within lightbox */
.lg-lightbox__image.slide-out-left {
    animation: lbSlideOutLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lg-lightbox__image.slide-out-right {
    animation: lbSlideOutRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.lg-lightbox__image.slide-in-left {
    animation: lbSlideInLeft 0.4s cubic-bezier(0.2, 1.1, 0.3, 1) forwards;
}

.lg-lightbox__image.slide-in-right {
    animation: lbSlideInRight 0.4s cubic-bezier(0.2, 1.1, 0.3, 1) forwards;
}

/* Loading spinner inside lightbox */
.lg-lightbox__loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.lg-lightbox__loader.is-loading {
    opacity: 1;
}

.lg-lightbox__loader .loading-spinner {
    border-top-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.9);
    width: 36px;
    height: 36px;
}

/* Caption bar at bottom */
.lg-lightbox__info {
    margin-top: var(--space-4);
    padding: var(--space-3) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-width: 280px;
    max-width: 600px;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px) saturate(1.8);
    -webkit-backdrop-filter: blur(20px) saturate(1.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease 0.15s,
                transform 0.4s cubic-bezier(0.2, 1.1, 0.3, 1) 0.15s;
}

.lg-lightbox[aria-hidden="false"] .lg-lightbox__info {
    opacity: 1;
    transform: translateY(0);
}

.lg-lightbox__caption {
    margin: 0;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-primary);
    line-height: 1.4;
}

.lg-lightbox__info .lg-lightbox__counter {
    font-size: var(--text-xs);
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* ===================================
   7. Lightbox Animations (Keyframes)
   =================================== */
@keyframes lbSlideOutLeft {
    from { opacity: 1; transform: scale(1) translateX(0); }
    to   { opacity: 0; transform: scale(0.95) translateX(-60px); }
}

@keyframes lbSlideOutRight {
    from { opacity: 1; transform: scale(1) translateX(0); }
    to   { opacity: 0; transform: scale(0.95) translateX(60px); }
}

@keyframes lbSlideInLeft {
    from { opacity: 0; transform: scale(0.95) translateX(60px); }
    to   { opacity: 1; transform: scale(1) translateX(0); }
}

@keyframes lbSlideInRight {
    from { opacity: 0; transform: scale(0.95) translateX(-60px); }
    to   { opacity: 1; transform: scale(1) translateX(0); }
}

/* ===================================
   8. Responsive
   =================================== */

/* Tablet */
@media (max-width: 768px) {
    .lg-gallery {
        max-width: 100%;
    }

    .lg-gallery__track {
        aspect-ratio: 3 / 2;
    }

    .lg-gallery__thumbnails {
        display: none;
    }

    .lg-gallery__dots {
        display: flex;
    }

    .lg-gallery__nav {
        width: 40px;
        height: 40px;
        font-size: var(--text-base);
    }

    .lg-gallery__nav--prev {
        left: var(--space-2);
    }
    .lg-gallery__nav--next {
        right: var(--space-2);
    }

    /* Lightbox mobile */
    .lg-lightbox__content {
        padding: var(--space-12) var(--space-3) var(--space-4);
    }

    .lg-lightbox__image {
        max-width: 96vw;
        max-height: 70vh;
        border-radius: var(--radius-lg);
    }

    .lg-lightbox__image-wrap {
        max-width: 96vw;
        max-height: 70vh;
    }

    .lg-lightbox__nav {
        width: 44px;
        height: 44px;
    }

    .lg-lightbox__nav--prev {
        left: var(--space-2);
    }
    .lg-lightbox__nav--next {
        right: var(--space-2);
    }

    .lg-lightbox__info {
        min-width: 200px;
        max-width: 90vw;
        padding: var(--space-2) var(--space-4);
    }

    .lg-lightbox__close {
        top: var(--space-3);
        right: var(--space-3);
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .lg-gallery__viewport {
        border-radius: var(--radius-xl);
    }

    .lg-gallery__track {
        aspect-ratio: 1 / 1;
    }

    .lg-gallery__caption {
        font-size: var(--text-xs);
        padding: var(--space-2) var(--space-4);
    }

    .lg-gallery__counter {
        font-size: 0.65rem;
    }

    .lg-lightbox__image {
        border-radius: var(--radius-md);
    }
}

/* Large desktop */
@media (min-width: 1200px) {
    .lg-gallery {
        max-width: 1040px;
    }

    .lg-gallery__thumb {
        width: 88px;
        height: 66px;
    }
}

/* ===================================
   9. Reduced Motion
   =================================== */
@media (prefers-reduced-motion: reduce) {
    .lg-gallery__slide {
        transition: opacity 0.15s ease, visibility 0.15s;
    }

    .lg-gallery__image {
        transition: none;
    }

    .lg-gallery__zoom-hint {
        transition: opacity 0.15s ease;
        transform: scale(1) translateY(0);
    }

    .lg-gallery__nav,
    .lg-gallery__thumb {
        transition: opacity 0.15s ease;
    }

    .lg-lightbox__backdrop {
        transition: opacity 0.15s ease;
    }

    .lg-lightbox__image {
        transition: opacity 0.15s ease;
        transform: scale(1) !important;
    }

    .lg-lightbox__close,
    .lg-lightbox__nav,
    .lg-lightbox__info {
        transition: opacity 0.15s ease;
        transform: none !important;
    }

    .lg-lightbox__image.slide-out-left,
    .lg-lightbox__image.slide-out-right,
    .lg-lightbox__image.slide-in-left,
    .lg-lightbox__image.slide-in-right {
        animation: none !important;
        opacity: 1;
        transform: none;
    }

    /* .lg-gallery__blur-bg has no transition, nothing to disable */
}

/* ===================================
   10. Compact Mode (.lg-gallery--compact)
   Inline carousel for program cards / detail pages.
   Smaller viewport, no section wrapper.
   =================================== */
.lg-gallery--compact {
    max-width: 100%;
    margin: 0;
}

.lg-gallery--compact .lg-gallery__viewport {
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.lg-gallery--compact .lg-gallery__track {
    aspect-ratio: 16 / 10;
}

/* Compact carousels match the section carousel: contain + blur-bg so images
   are always fully visible regardless of orientation or aspect ratio. */

.lg-gallery--compact .lg-gallery__caption {
    font-size: var(--text-xs);
    padding: var(--space-1) var(--space-3);
}

.lg-gallery--compact .lg-gallery__nav {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.lg-gallery--compact .lg-gallery__counter {
    font-size: 0.6rem;
    padding: var(--space-1) var(--space-2);
}

.lg-gallery--compact .lg-gallery__zoom-hint {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
}

.lg-gallery--compact .lg-gallery__thumbnails {
    gap: var(--space-1);
    padding: var(--space-2) 0 0;
}

.lg-gallery--compact .lg-gallery__thumb {
    width: 48px;
    height: 36px;
    border-radius: var(--radius-sm);
}

.lg-gallery--compact .lg-gallery__dots {
    padding: var(--space-2) 0 0;
    gap: var(--space-1);
}

.lg-gallery--compact .lg-gallery__dot {
    width: 6px;
    height: 6px;
}

/* Compact inside program cards (homepage) */
.program-card .lg-gallery--compact {
    margin-bottom: var(--space-3);
}

.program-card .lg-gallery--compact .lg-gallery__track {
    aspect-ratio: 4 / 3;
}

.program-card .lg-gallery--compact .lg-gallery__thumbnails {
    display: none;
}

/* Prevent glass-card hover lift on program cards with carousels */
.program-card.glass-card:has(.lg-gallery--compact):hover {
    transform: none;
}

/* Fill the card track and let object-fit:contain (inherited) show the full photo */
.program-card .lg-gallery--compact .lg-gallery__image {
    height: 100%;
    border-radius: 0;
}

/* Compact inside program detail (programs page) */
.program-detail__image .glass-card:has(.lg-gallery--compact) {
    display: block;
    aspect-ratio: auto;
    padding: 0;
    overflow: hidden;
}

.program-detail__image .lg-gallery--compact {
    width: 100%;
}

.program-detail__image .lg-gallery--compact .lg-gallery__track {
    aspect-ratio: 16 / 10;
}

/* Neutralise main.css's .program-detail__image img { object-fit:cover } rule.
   That selector has specificity 0,1,1 (class+element) which beats the base
   .lg-gallery__image rule (0,1,0). Spelling it out here at 0,3,0 wins cleanly. */
.program-detail__image .lg-gallery--compact .lg-gallery__image {
    height: 100%;
    border-radius: 0;
    object-fit: contain;
}

.program-detail__image .lg-gallery--compact .lg-gallery__thumb img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

/* ===================================
   11. Loading Spinner (lightbox loader)
   =================================== */
.loading-spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: rgba(255, 255, 255, 0.9);
    animation: lgSpinner 0.75s linear infinite;
}

@keyframes lgSpinner {
    to { transform: rotate(360deg); }
}

/* Compact inside story section (about page) */
.story__image .glass-card:has(.lg-gallery--compact) {
    padding: 0;
    overflow: hidden;
}

.story__image .lg-gallery--compact .lg-gallery__image {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

.story__image .lg-gallery--compact .lg-gallery__thumb img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}

@media (max-width: 768px) {
    .lg-gallery--compact .lg-gallery__track {
        aspect-ratio: 4 / 3;
    }

    .lg-gallery--compact .lg-gallery__thumbnails {
        display: none;
    }

    .lg-gallery--compact .lg-gallery__nav {
        width: 28px;
        height: 28px;
        font-size: 0.65rem;
    }
}

@media (max-width: 480px) {
    .lg-gallery--compact .lg-gallery__track {
        aspect-ratio: 1 / 1;
    }
}
