:root {
    --gallery-bg-top: #243754;
    --gallery-bg-mid: #172742;
    --gallery-bg-bottom: #0a1426;
    --gallery-surface: rgba(255, 255, 255, 0.08);
    --gallery-surface-strong: rgba(255, 255, 255, 0.14);
    --gallery-border: rgba(255, 255, 255, 0.12);
    --gallery-text: #f5f7fb;
    --gallery-muted: rgba(231, 236, 244, 0.82);
    --gallery-accent: #d4af37;
    --gallery-accent-deep: #f1d77a;
    --gallery-shadow: 0 18px 44px rgba(0, 0, 0, 0.28);
    --gallery-glow: 0 24px 60px rgba(9, 20, 38, 0.45);
    --gallery-panel: rgba(16, 26, 43, 0.58);
    --gallery-panel-border: rgba(255, 255, 255, 0.09);
    --gallery-blue-glow: rgba(96, 150, 230, 0.22);
    --gallery-gold-glow: rgba(212, 175, 55, 0.22);
}

.gallery-page {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top center, rgba(255, 255, 255, 0.08) 0%, transparent 22%),
        radial-gradient(circle at 12% 15%, rgba(212, 175, 55, 0.18) 0%, transparent 18%),
        radial-gradient(circle at 86% 12%, rgba(94, 134, 189, 0.22) 0%, transparent 22%),
        radial-gradient(circle at 50% 28%, rgba(255, 255, 255, 0.05) 0%, transparent 26%),
        linear-gradient(145deg, #324a6d 0%, #1a2c49 38%, #0d182c 100%);
    color: var(--gallery-text);
    padding: 34px 0 120px;
}

.gallery-page::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(120deg, rgba(255, 255, 255, 0.03), transparent 32%, transparent 68%, rgba(255, 255, 255, 0.025)),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 118px);
    opacity: 0.6;
    pointer-events: none;
}

.gallery-page::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 90px;
    width: min(1100px, 92vw);
    height: 520px;
    transform: translateX(-50%);
    background:
        radial-gradient(circle, rgba(212, 175, 55, 0.12) 0%, transparent 46%),
        radial-gradient(circle at 72% 34%, rgba(95, 143, 214, 0.18) 0%, transparent 42%);
    filter: blur(44px);
    opacity: 0.9;
    pointer-events: none;
}

.gallery-page .gallery-shell {
    isolation: isolate;
}

.gallery-shell {
    width: min(1220px, calc(100% - 36px));
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.gallery-hero {
    padding: 22px 0 28px;
}

.gallery-kicker {
    margin: 0 0 10px;
    text-align: center;
    color: var(--gallery-accent-deep);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-transform: uppercase;
}

.gallery-title {
    margin: 0;
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 4.5vw, 4.9rem);
    line-height: 1.02;
    color: #f3f6fb;
    max-width: 1320px;
    margin-left: auto;
    margin-right: auto;
    white-space: nowrap;
    text-shadow: 0 14px 36px rgba(7, 15, 29, 0.48);
}

.gallery-divider {
    width: 170px;
    height: 4px;
    margin: 20px auto 0;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.16), var(--gallery-accent), rgba(212, 175, 55, 0.16), transparent);
    box-shadow: 0 0 28px rgba(212, 175, 55, 0.35);
}

.gallery-intro {
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
    font-size: 1.12rem;
    line-height: 1.9;
    color: var(--gallery-muted);
    text-shadow: 0 2px 16px rgba(7, 15, 29, 0.22);
}

.gallery-section {
    padding-top: 34px;
}

.gallery-section + .gallery-section {
    margin-top: 46px;
    position: relative;
}

.gallery-section + .gallery-section::before {
    content: "";
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    width: min(820px, 80%);
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, 0.28), transparent);
    opacity: 0.8;
}

.gallery-section .gallery-shell {
    padding: 28px;
    border-radius: 36px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015)),
        var(--gallery-panel);
    border: 1px solid var(--gallery-panel-border);
    box-shadow:
        0 22px 54px rgba(5, 12, 24, 0.32),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.gallery-section .gallery-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 36px;
    background:
        radial-gradient(circle at 12% 10%, rgba(212, 175, 55, 0.14), transparent 22%),
        radial-gradient(circle at 88% 0%, rgba(98, 151, 230, 0.14), transparent 22%);
    pointer-events: none;
}

.gallery-feature {
    position: relative;
    min-height: 370px;
    margin: 0 0 30px;
    border-radius: 34px;
    overflow: hidden;
    background: #203148;
    box-shadow:
        var(--gallery-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    isolation: isolate;
}

.gallery-feature-image {
    display: block;
    width: 100%;
    height: 370px;
    object-fit: cover;
    object-position: center top;
    filter: saturate(0.95) brightness(0.88);
    transform: scale(1.02);
    background: #203148;
    transition: transform 0.7s ease, filter 0.7s ease;
}

.gallery-feature:hover .gallery-feature-image {
    transform: scale(1.06);
    filter: saturate(1.02) brightness(0.96);
}

.gallery-feature-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 34px 42px;
    background:
        linear-gradient(180deg, rgba(7, 16, 29, 0.12) 0%, rgba(7, 16, 29, 0.46) 45%, rgba(7, 16, 29, 0.86) 100%);
    color: #ffffff;
}

.gallery-feature::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.12), transparent 30%, transparent 70%, rgba(84, 129, 191, 0.14));
    pointer-events: none;
}

.gallery-feature::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 33px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    pointer-events: none;
    z-index: 1;
}

#annual-day-celebrations .gallery-feature-image {
    object-position: center 22%;
}

#sports-athletics .gallery-feature-image {
    object-position: center 28%;
}

#scouts-guides .gallery-feature-image {
    object-position: center 24%;
}

#classroom-learning .gallery-feature-image {
    object-position: center 24%;
}

#leadership-legacy .gallery-feature-image {
    object-position: center 18%;
}

.gallery-feature-tag {
    display: inline-flex;
    margin-bottom: 14px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.22);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.gallery-feature-overlay h2 {
    margin: 0 0 10px;
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.1rem, 3.3vw, 3.15rem);
    line-height: 1.04;
    letter-spacing: -0.02em;
    text-shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
    white-space: nowrap;
    padding: 14px 26px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(8, 17, 30, 0.48), rgba(8, 17, 30, 0.18));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
}

.gallery-feature-overlay p {
    max-width: 760px;
    margin: 0;
    font-size: 1rem;
    line-height: 1.75;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

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

.gallery-subtitle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 34px auto 18px;
    padding: 12px 18px;
    border-radius: 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.94);
    background:
        radial-gradient(circle at 0% 50%, rgba(212, 175, 55, 0.22), transparent 52%),
        linear-gradient(135deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(212, 175, 55, 0.28);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
    width: fit-content;
}

.gallery-subtitle::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: rgba(212, 175, 55, 0.92);
    box-shadow: 0 0 0 6px rgba(212, 175, 55, 0.14);
    flex: 0 0 auto;
}

.gallery-card {
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05)),
        var(--gallery-surface);
    border: 1px solid var(--gallery-border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    position: relative;
}

.gallery-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 30%);
    opacity: 0.75;
    pointer-events: none;
    z-index: 1;
}

.gallery-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--gallery-glow);
    border-color: rgba(212, 175, 55, 0.32);
}

.gallery-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 28%;
    background: linear-gradient(180deg, transparent, rgba(7, 15, 29, 0.18));
    pointer-events: none;
}

.gallery-section:nth-of-type(odd) .gallery-feature {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(212, 175, 55, 0.08);
}

.gallery-section:nth-of-type(even) .gallery-feature {
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(113, 158, 214, 0.08);
}

.gallery-card img {
    display: block;
    width: 100%;
    height: 292px;
    object-fit: cover;
    object-position: center center;
    cursor: zoom-in;
    transition: transform 0.35s ease, filter 0.35s ease;
}

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

.gallery-feature-image {
    cursor: zoom-in;
}

.extra-photo {
    display: none;
}

.gallery-section.is-expanded .extra-photo {
    display: block;
}

.gallery-actions {
    display: flex;
    justify-content: center;
    margin-top: 30px;
}

.gallery-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: 1px solid rgba(241, 215, 122, 0.28);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08)),
        var(--gallery-surface-strong);
    color: #f4e4aa;
    padding: 15px 32px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(14px);
    text-decoration: none;
}

.gallery-toggle::after {
    content: "\2192";
    font-size: 1rem;
    transition: transform 0.2s ease;
}

.gallery-toggle:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

.gallery-toggle:hover::after {
    transform: translateX(3px);
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px;
    background: rgba(5, 10, 18, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.gallery-lightbox[hidden] {
    display: none;
}

.gallery-lightbox-dialog {
    position: relative;
    width: min(1200px, 100%);
    max-height: 100%;
    padding: 74px 24px 24px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(18, 28, 44, 0.98), rgba(11, 18, 31, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-close {
    position: absolute;
    top: 18px;
    left: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    min-height: 46px;
    padding: 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(241, 215, 122, 0.32);
    background: rgba(255, 255, 255, 0.08);
    color: #f4e4aa;
    font-weight: 800;
    letter-spacing: 0.04em;
    cursor: pointer;
}

.gallery-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.14);
}

.gallery-lightbox-image {
    display: block;
    width: 100%;
    max-width: 100%;
    max-height: min(78vh, 860px);
    margin: 0 auto;
    object-fit: contain;
    object-position: center;
    border-radius: 20px;
}

@media (max-width: 1280px) {
    .gallery-shell {
        width: min(1220px, calc(100% - 30px));
    }

    .gallery-title {
        font-size: clamp(2.1rem, 3.5vw, 3.8rem);
    }

    .gallery-feature-overlay h2 {
        font-size: clamp(1.8rem, 2.7vw, 2.55rem);
    }

    .gallery-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 22px;
    }

    .gallery-card img {
        height: 250px;
    }
}

@media (max-width: 960px) {
    .gallery-page {
        padding: 18px 0 72px;
    }

    .gallery-shell {
        width: min(1220px, calc(100% - 24px));
    }

    .gallery-section .gallery-shell {
        padding: 20px;
        border-radius: 28px;
    }

    .gallery-hero {
        padding: 10px 0 14px;
    }

    .gallery-title {
        font-size: clamp(1.9rem, 4.4vw, 2.9rem);
        white-space: normal;
    }

    .gallery-divider {
        width: 110px;
        margin: 14px auto 18px;
    }

    .gallery-section {
        padding-top: 20px;
    }

    .gallery-section + .gallery-section {
        margin-top: 24px;
    }

    .gallery-feature,
    .gallery-feature-image {
        min-height: 290px;
        height: 290px;
    }

    .gallery-feature-overlay {
        padding: 22px 16px;
    }

    .gallery-feature-overlay h2 {
        font-size: clamp(1.45rem, 3.5vw, 1.95rem);
        white-space: normal;
    }

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

    .gallery-card {
        border-radius: 18px;
    }

    .gallery-card img {
        height: 220px;
    }

    .gallery-actions {
        margin-top: 22px;
    }

    .gallery-toggle {
        padding: 12px 22px;
        font-size: 0.9rem;
    }
}

@media (max-width: 640px) {
    .gallery-lightbox {
        padding: 16px;
    }

    .gallery-lightbox-dialog {
        padding: 68px 12px 12px;
        border-radius: 22px;
    }

    .gallery-lightbox-close {
        top: 12px;
        left: 12px;
        min-width: 92px;
        min-height: 40px;
        font-size: 0.92rem;
    }

    .gallery-lightbox-image {
        max-height: 74vh;
    }
}

@media (max-width: 768px) {
    .gallery-page {
        padding: 12px 0 60px;
    }

    .gallery-shell {
        width: min(1220px, calc(100% - 24px));
    }

    .gallery-hero {
        padding: 12px 0 24px;
    }

    .gallery-feature,
    .gallery-feature-image {
        min-height: 300px;
        height: 300px;
    }

    .gallery-feature-overlay {
        padding: 24px 18px;
    }

    .gallery-feature-overlay h2 {
        font-size: clamp(1.5rem, 4vw, 2rem);
        padding: 10px 18px;
        white-space: normal;
    }
}

@media (max-width: 640px) {
    .gallery-section .gallery-shell {
        padding: 16px;
        border-radius: 24px;
    }

    .gallery-title {
        font-size: clamp(2.4rem, 12vw, 3.6rem);
        white-space: normal;
    }

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

    .gallery-feature,
    .gallery-feature-image {
        min-height: 260px;
        height: 260px;
    }

    .gallery-feature-overlay {
        padding: 20px 14px;
    }

    .gallery-feature-overlay h2 {
        font-size: 1.35rem;
        white-space: normal;
        padding: 9px 14px;
    }

    .gallery-card img {
        height: 240px;
    }

    .gallery-intro {
        font-size: 1rem;
    }
}

@media (max-width: 420px) {
    .gallery-shell {
        width: calc(100% - 18px);
    }

    .gallery-section .gallery-shell {
        padding: 14px;
    }

    .gallery-title {
        font-size: clamp(1.7rem, 9vw, 2.4rem);
    }

    .gallery-feature,
    .gallery-feature-image {
        min-height: 230px;
        height: 230px;
    }

    .gallery-feature-overlay {
        padding: 16px 12px;
    }

    .gallery-feature-overlay h2 {
        font-size: 1.15rem;
    }

    .gallery-card img {
        height: 220px;
    }

    .gallery-lightbox-dialog {
        padding-top: 60px;
    }
}
