/**
 * Event Photo Galleries
 *
 * Uniform grid: every tile is the same 4:3 box with the photo cropped to
 * fill it, so galleries mixing portrait and landscape shots still read as a
 * tidy grid. The full uncropped image opens in the lightbox.
 */

.srpc-galleries {
    margin: 40px 0;
}

.srpc-galleries-heading {
    font-size: 28px;
    margin: 0 0 24px;
    color: #1a3a52;
}

.srpc-gallery-event {
    margin-bottom: 40px;
}

.srpc-gallery-event-header {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e5e5e5;
}

.srpc-gallery-event-title {
    font-size: 20px;
    line-height: 1.2;
    margin: 0;
}

.srpc-gallery-event-title a {
    color: #1a3a52;
    text-decoration: none;
}

.srpc-gallery-event-title a:hover {
    color: #ff6b35;
    text-decoration: underline;
}

.srpc-gallery-event-date {
    font-size: 15px;
    color: #777;
}

/* --- Grid --- */

.srpc-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px;
}

.srpc-gallery-tile {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    margin: 0;
    border: none;
    border-radius: 4px;
    overflow: hidden;
    background: #eee;
    cursor: pointer;
}

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

.srpc-gallery-tile:hover img,
.srpc-gallery-tile:focus-visible img {
    transform: scale(1.06);
}

.srpc-gallery-tile:focus-visible {
    outline: 3px solid #ff6b35;
    outline-offset: 2px;
}

/* "+N more" overlay on the final visible tile */
.srpc-gallery-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(26, 58, 82, 0.72);
    color: #fff;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.srpc-galleries-more {
    margin-top: 8px;
}

.srpc-galleries-more-link {
    display: inline-block;
    background: #1a3a52;
    color: #fff !important;
    padding: 10px 24px;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
}

.srpc-galleries-more-link:hover {
    background: #ff6b35;
}

/* --- Lightbox --- */

.srpc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.srpc-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.srpc-lightbox img {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 2px;
}

.srpc-lightbox-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    line-height: 1;
}

.srpc-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.srpc-lightbox-close {
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 30px;
}

.srpc-lightbox-prev,
.srpc-lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 72px;
    border-radius: 4px;
    font-size: 34px;
}

.srpc-lightbox-prev { left: 16px; }
.srpc-lightbox-next { right: 16px; }

.srpc-lightbox-counter {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.85);
    font-size: 14px;
    letter-spacing: 0.04em;
}

body.srpc-lightbox-open {
    overflow: hidden;
}

/* --- Responsive --- */

@media (max-width: 782px) {
    .srpc-gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .srpc-galleries-heading { font-size: 24px; }
    .srpc-gallery-event-title { font-size: 18px; }

    .srpc-lightbox-prev,
    .srpc-lightbox-next {
        width: 42px;
        height: 58px;
        font-size: 26px;
    }

    .srpc-lightbox-prev { left: 6px; }
    .srpc-lightbox-next { right: 6px; }
}

@media (max-width: 420px) {
    .srpc-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .srpc-gallery-tile img,
    .srpc-lightbox {
        transition: none;
    }

    .srpc-gallery-tile:hover img,
    .srpc-gallery-tile:focus-visible img {
        transform: none;
    }
}
