/* =====================================================================
   PE Group of Institutions: GALLERY PAGE ONLY styles
   Loaded only by gallery.blade.php (through @push('styles')).
   Reuses the colour tokens from pe-header.css, with fallbacks.
   ===================================================================== */

.pg-head, .pg-shots {
    --pg-forest: var(--pe-forest, #17392c);
    --pg-green: var(--pe-green, #2f6b4f);
    --pg-sage: var(--pe-sage, #7c8c6b);
    --pg-sage-50: var(--pe-sage-50, #f3f6f0);
    --pg-sage-100: var(--pe-sage-100, #e5ebe0);
    --pg-mustard: var(--pe-mustard, #d9a036);
    --pg-ink: var(--pe-ink, #1c2521);
    --pg-muted: var(--pe-muted, #5b675f);
    --pg-line: #dfe4dd;

    color: var(--pg-ink);
    font-family: var(--pe-font-ui, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif);
}
.pg-head *, .pg-shots *,
.pg-head *::before, .pg-shots *::before { box-sizing: border-box; }
.pg-head ol, .pg-shots ul { margin: 0; padding: 0; list-style: none; }
.pg-shots :focus-visible { outline: 2px solid var(--pg-forest); outline-offset: 3px; }
.pg-head :focus-visible { outline: 2px solid var(--pg-mustard); outline-offset: 3px; }

.pe-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

/* =====================================================================
   Page header
   ===================================================================== */
.pg-head {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding-block: clamp(28px, 3.5vw, 48px) clamp(32px, 4vw, 56px);
    background: var(--pg-forest);
    color: #cfdac9;
}
.pg-head::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(46% 70% at 82% 18%, rgba(124, 140, 107, .4), transparent 70%),
        radial-gradient(rgba(255, 255, 255, .07) 1px, transparent 1.5px) 0 0 / 22px 22px;
}
.pg-head::after {
    content: "";
    position: absolute;
    right: -3%;
    bottom: -58%;
    z-index: -1;
    width: min(30%, 320px);
    aspect-ratio: 4 / 5;
    border: 28px solid rgba(255, 255, 255, .07);
    border-radius: 50% 50% 0 0 / 40% 40% 0 0;
    pointer-events: none;
}
.pg-crumbs { margin-bottom: clamp(14px, 2vw, 22px); font-size: .875rem; }
.pg-crumbs ol { display: flex; flex-wrap: wrap; gap: 8px; }
.pg-crumbs li + li::before { content: "/"; margin-right: 8px; color: rgba(255, 255, 255, .4); }
.pg-crumbs a { color: #cfdac9; text-decoration: none; }
.pg-crumbs a:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.pg-crumbs li[aria-current] { color: var(--pg-mustard); font-weight: 600; }
.pg-head__title {
    margin: 0 0 12px;
    color: #fff;
    font-family: var(--pe-font-display, Georgia, "Times New Roman", serif);
    font-size: clamp(1.875rem, 1.2rem + 2.4vw, 3rem);
    font-weight: 400;
    line-height: 1.1;
}
.pg-head__lead {
    max-width: 46rem;
    margin: 0;
    font-size: clamp(1rem, .95rem + .3vw, 1.125rem);
    line-height: 1.65;
}

/* =====================================================================
   Filters
   ===================================================================== */
.pg-shots { padding-block: clamp(28px, 4vw, 48px) clamp(40px, 5vw, 72px); }
.pg-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: clamp(20px, 3vw, 28px);
}
.pg-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border: 1.5px solid var(--pg-line);
    border-radius: 999px;
    background: #fff;
    color: var(--pg-ink);
    font: inherit;
    font-size: .9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color .2s, border-color .2s, color .2s;
}
.pg-filter:hover { border-color: var(--pg-sage); }
.pg-filter.is-active {
    border-color: var(--pg-forest);
    background: var(--pg-forest);
    color: #fff;
}
.pg-filter__count {
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--pg-sage-100);
    color: var(--pg-forest);
    font-size: .75rem;
}
.pg-filter.is-active .pg-filter__count { background: rgba(255, 255, 255, .18); color: #fff; }

/* =====================================================================
   Photo grid
   ===================================================================== */
.pg-grid {
    display: grid;
    grid-auto-flow: dense;        /* fills the gaps left by the taller photos */
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: 200px;
    gap: 16px;
}
.pg-item { display: block; }
.pg-item.is-tall { grid-row: span 2; }       /* a few taller photos break up the grid */
.pg-item[hidden] { display: none; }

.pg-item__link {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
    background:
        radial-gradient(circle at 50% 35%, rgba(255, 255, 255, .18), transparent 60%),
        linear-gradient(160deg, var(--pg-sage), var(--pg-forest));
    cursor: zoom-in;
}
.pg-item__link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.pg-item__link::after {
    /* fade at the bottom so the caption stays readable */
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 45%;
    background: linear-gradient(to top, rgba(10, 26, 19, .7), transparent);
    opacity: 0;
    transition: opacity .3s;
}
.pg-item__link:hover img,
.pg-item__link:focus-visible img { transform: scale(1.05); }
.pg-item__link:hover::after,
.pg-item__link:focus-visible::after { opacity: 1; }

.pg-item__caption {
    position: absolute;
    right: 14px;
    bottom: 14px;
    left: 14px;
    z-index: 1;
    color: #fff;
    font-size: .95rem;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity .3s, transform .3s;
}
.pg-item__zoom {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: var(--pg-forest);
    font-size: .95rem;
    opacity: 0;
    transform: scale(.85);
    transition: opacity .3s, transform .3s;
}
.pg-item__link:hover .pg-item__caption,
.pg-item__link:focus-visible .pg-item__caption { opacity: 1; transform: none; }
.pg-item__link:hover .pg-item__zoom,
.pg-item__link:focus-visible .pg-item__zoom { opacity: 1; transform: none; }

.pg-empty {
    margin: 0;
    padding: 40px 0;
    color: var(--pg-muted);
    font-size: 1.0625rem;
    text-align: center;
}
.pg-empty[hidden] { display: none; }

/* =====================================================================
   Large view
   ===================================================================== */
.pg-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: clamp(12px, 3vw, 40px);
}
.pg-lightbox[hidden] { display: none; }
.pg-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 20, 14, .88);
    -webkit-backdrop-filter: blur(4px);
            backdrop-filter: blur(4px);
}
.pg-lightbox__panel {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(8px, 2vw, 20px);
    width: min(1100px, 100%);
    max-height: 100%;
}
.pg-lightbox__figure {
    display: grid;
    gap: 12px;
    margin: 0;
    min-width: 0;
    justify-items: center;
}
.pg-lightbox__figure img {
    max-width: 100%;
    max-height: min(74vh, 720px);
    border-radius: 14px;
    background: #0e1f17;
    object-fit: contain;
}
.pg-lightbox__figure figcaption {
    color: #e6efe4;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
}
.pg-lightbox__btn {
    display: grid;
    place-items: center;
    width: 50px;
    height: 50px;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 50%;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-size: 1.15rem;
    cursor: pointer;
    transition: background-color .2s, color .2s, border-color .2s;
}
.pg-lightbox__btn:hover { background: #fff; border-color: #fff; color: var(--pg-forest); }
.pg-lightbox__close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    transform: translateY(-120%);
}
.pg-lightbox__count {
    position: absolute;
    bottom: 0;
    left: 50%;
    margin: 0;
    color: rgba(255, 255, 255, .75);
    font-size: .875rem;
    transform: translate(-50%, 190%);
}
.pg-lightbox :focus-visible { outline: 2px solid var(--pg-mustard); outline-offset: 3px; }
html.pg-lock, html.pg-lock body { overflow: hidden; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1199.98px) {
    .pg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
    .pg-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 190px; gap: 14px; }
    /* on touch screens the caption is always visible: there is no hover */
    .pg-item__caption { opacity: 1; transform: none; }
    .pg-item__link::after { opacity: 1; }
    .pg-item__zoom { display: none; }
}
@media (max-width: 767.98px) {
    .pg-grid { grid-auto-rows: 170px; gap: 12px; }
    .pg-filter { min-height: 42px; padding: 0 16px; font-size: .875rem; }
}
@media (max-width: 479.98px) {
    .pg-grid { grid-template-columns: minmax(0, 1fr); grid-auto-rows: 230px; }
    .pg-item.is-tall { grid-row: span 1; }     /* one column: every photo the same height */
    .pg-lightbox__panel { grid-template-columns: minmax(0, 1fr); }
    .pg-lightbox__prev { position: absolute; bottom: 0; left: 0; transform: translateY(150%); }
    .pg-lightbox__next { position: absolute; right: 0; bottom: 0; transform: translateY(150%); }
    .pg-lightbox__count { transform: translate(-50%, 230%); }
}

@media (prefers-reduced-motion: reduce) {
    .pg-item__link img, .pg-item__caption, .pg-item__zoom, .pg-item__link::after,
    .pg-filter, .pg-lightbox__btn { transition-duration: .01ms !important; }
    .pg-item__link:hover img { transform: none; }
}
