/* ==========================================================================
   Photo Gallery — gallery.php
   Same palette and type as the Faculty, Contact and Our Graduates pages.
   Everything is scoped under .gal so it cannot leak into the shared header,
   footer or the Bootstrap 3 / style-v1.css rules used on the rest of the site.
   ========================================================================== */

.gal,
.gal-lightbox {
    --gal-navy: #243a73;
    --gal-navy-deep: #1a2b57;
    --gal-navy-soft: #eef1f8;
    --gal-gold: #faa619;
    --gal-ink: #1c2541;
    --gal-text: #3d4458;
    --gal-muted: #586074;
    --gal-line: #e6e3da;
    --gal-cream: #faf8f3;
    --gal-card: #ffffff;
    --gal-radius: 14px;
    --gal-shadow: 0 1px 2px rgba(28, 37, 65, .04), 0 2px 8px rgba(28, 37, 65, .04);
    --gal-shadow-hover: 0 4px 10px rgba(28, 37, 65, .08), 0 14px 32px rgba(28, 37, 65, .12);
    --gal-serif: "Noto Serif", Georgia, "Times New Roman", serif;
    --gal-sans: "Open Sans", "Segoe UI", Arial, sans-serif;
}

.gal {
    display: block;
    background: var(--gal-cream);
    color: var(--gal-text);
    font-family: var(--gal-sans);
    font-size: 15px;
    /* style-v1.css sets body line-height in em, which would inherit as a fixed px value */
    line-height: 1.6;
}

/* style-v1.css paints #content white with no padding, and its id selector outranks .gal */
#content.gal {
    padding: 56px 0 72px;
    background: var(--gal-cream);
}

/* The hero's bottom margin would otherwise show as a white band above the cream page */
.ph {
    margin-bottom: 0;
}

/* Below the overlapping stat card, continue the page's cream instead of the white body */
.ph__stats-wrap {
    background: linear-gradient(180deg, transparent 44px, #faf8f3 44px);
}

.gal *,
.gal *::before,
.gal *::after,
.gal-lightbox *,
.gal-lightbox *::before,
.gal-lightbox *::after {
    box-sizing: border-box;
}

.gal [hidden] {
    display: none !important;
}

.gal :focus-visible,
.gal-lightbox :focus-visible {
    outline: 3px solid var(--gal-gold);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Album filter
   -------------------------------------------------------------------------- */

.gal-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.gal .gal-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 8px 0 18px;
    border: 1px solid var(--gal-line);
    border-radius: 999px !important;
    background: var(--gal-card);
    color: var(--gal-ink);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}

.gal .gal-chip:hover {
    border-color: var(--gal-navy);
    color: var(--gal-navy);
}

.gal .gal-chip[aria-pressed="true"] {
    background: var(--gal-navy);
    border-color: var(--gal-navy);
    color: #fff;
}

.gal-chip__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 26px;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--gal-navy-soft);
    color: var(--gal-navy);
    font-size: 12px;
    font-weight: 700;
}

.gal-chip[aria-pressed="true"] .gal-chip__count {
    background: rgba(255, 255, 255, .18);
    color: #fff;
}

/* --------------------------------------------------------------------------
   Grid: the first photo is featured at double size
   -------------------------------------------------------------------------- */

.gal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: dense;
    gap: 16px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.gal-item {
    min-width: 0;
}

.gal-grid .gal-item.is-featured {
    grid-column: span 2;
    grid-row: span 2;
}

.gal-grid .is-featured .gal-tile {
    aspect-ratio: auto;
}

.gal .gal-tile {
    position: relative;
    display: block;
    height: 100%;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--gal-navy-soft);
    border-radius: var(--gal-radius);
    box-shadow: var(--gal-shadow);
    text-decoration: none;
    transition: box-shadow .3s, transform .3s;
}

.gal .gal-tile:hover,
.gal .gal-tile:focus-visible {
    box-shadow: var(--gal-shadow-hover);
    transform: translateY(-2px);
}

.gal-tile img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}

.gal-tile:hover img {
    transform: scale(1.04);
}

.gal-tile__caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 36px 16px 12px;
    background: linear-gradient(180deg, rgba(26, 43, 87, 0) 0%, rgba(26, 43, 87, .82) 100%);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .25s, transform .25s;
}

.gal-tile__zoom {
    position: absolute;
    top: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--gal-navy);
    font-size: 14px;
    opacity: 0;
    transition: opacity .25s;
}

.gal-tile:hover .gal-tile__caption,
.gal-tile:focus-visible .gal-tile__caption,
.gal-tile:hover .gal-tile__zoom,
.gal-tile:focus-visible .gal-tile__zoom {
    opacity: 1;
    transform: none;
}

.is-featured .gal-tile__caption {
    padding: 48px 22px 18px;
    font-size: 15px;
}

/* Touch screens have no hover: keep the caption visible */
@media (hover: none) {
    .gal-tile__caption {
        opacity: 1;
        transform: none;
    }
}

/* --------------------------------------------------------------------------
   Show more + empty state
   -------------------------------------------------------------------------- */

.gal-more {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 36px;
}

.gal-more__status {
    margin: 0;
    font-size: 13px;
    color: var(--gal-muted);
}

.gal .gal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 26px;
    border: 1px solid var(--gal-navy);
    border-radius: 999px !important;
    background: var(--gal-navy);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s, border-color .2s;
}

.gal .gal-btn:hover {
    background: var(--gal-navy-deep);
    border-color: var(--gal-navy-deep);
}

.gal-empty {
    max-width: 520px;
    margin: 0 auto;
    padding: 40px 24px;
    background: var(--gal-card);
    border: 1px dashed var(--gal-line);
    border-radius: var(--gal-radius);
    text-align: center;
    color: var(--gal-muted);
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.gal-lightbox {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(12, 18, 36, .95);
    color: #fff;
    font-family: var(--gal-sans);
}

.gal-lightbox::backdrop {
    background: rgba(12, 18, 36, .6);
}

.gal-lightbox[open] {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gal-fade .2s ease;
}

@keyframes gal-fade {
    from {
        opacity: 0;
    }
}

.gal-lightbox__figure {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: calc(100vw - 160px);
    margin: 0;
}

.gal-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: calc(100vh - 140px);
    max-height: calc(100dvh - 140px);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
    user-select: none;
}

.gal-lightbox__caption {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 16px;
    font-size: 14px;
    color: rgba(255, 255, 255, .86);
    text-align: center;
}

.gal-lightbox__count {
    color: var(--gal-gold);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.gal-lightbox__btn {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: background-color .2s, border-color .2s;
}

.gal-lightbox__btn:hover {
    background: rgba(255, 255, 255, .18);
    border-color: rgba(255, 255, 255, .6);
}

.gal-lightbox__close {
    top: 18px;
    right: 18px;
}

.gal-lightbox__prev,
.gal-lightbox__next {
    top: 50%;
    transform: translateY(-50%);
}

.gal-lightbox__prev {
    left: 20px;
}

.gal-lightbox__next {
    right: 20px;
}

/* Scroll lock while the viewer is open */
html.gal-locked,
html.gal-locked body {
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .gal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    #content.gal {
        padding: 44px 0 56px;
    }

    .gal-filters {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        margin: 0 -15px 22px;
        padding: 2px 15px;
        scrollbar-width: none;
    }

    .gal-filters::-webkit-scrollbar {
        display: none;
    }

    .gal .gal-chip {
        flex: 0 0 auto;
    }

    .gal-grid {
        gap: 10px;
    }

    .gal .gal-tile {
        border-radius: 10px;
    }

    .gal-lightbox__figure {
        max-width: calc(100vw - 24px);
    }

    .gal-lightbox__prev,
    .gal-lightbox__next {
        top: auto;
        bottom: 18px;
        transform: none;
    }

    .gal-lightbox__prev {
        left: calc(50% - 60px);
    }

    .gal-lightbox__next {
        right: calc(50% - 60px);
    }

    .gal-lightbox__img {
        max-height: calc(100vh - 190px);
        max-height: calc(100dvh - 190px);
    }
}

@media (max-width: 480px) {
    .gal-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .gal-grid .gal-item.is-featured {
        grid-column: auto;
        grid-row: auto;
    }

    .gal-grid .is-featured .gal-tile {
        aspect-ratio: 16 / 9;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gal *,
    .gal-lightbox,
    .gal-lightbox * {
        transition: none !important;
        animation: none !important;
    }

    .gal .gal-tile:hover,
    .gal-tile:hover img {
        transform: none;
    }
}
