/* Public gallery + admin section builder */

.gallery-page .gallery-section {
    margin-bottom: 3.5rem;
}

.gallery-page .gallery-section:last-child {
    margin-bottom: 0;
}

.gallery-section-header {
    max-width: 42rem;
    margin-bottom: 1.75rem;
}

.gallery-section-heading {
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    font-weight: 700;
    color: var(--pr-navy);
    margin-bottom: 0.65rem;
}

.gallery-section-desc {
    color: var(--pr-slate);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 0;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.gallery-item {
    margin: 0;
}

.gallery-item-link {
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: linear-gradient(135deg, var(--pr-blue-light), var(--pr-blue));
    aspect-ratio: 4 / 3;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.gallery-item-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.gallery-item-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item-caption {
    margin-top: 0.65rem;
    font-size: 0.9rem;
    color: var(--pr-slate);
    line-height: 1.45;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(11, 45, 66, 0.88);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    gap: 1rem;
}

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

.gallery-lightbox img {
    max-width: min(96vw, 1100px);
    max-height: 78vh;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.gallery-lightbox-caption {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    max-width: 40rem;
    margin: 0;
}

.gallery-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

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

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

.gallery-images-panel {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pr-border);
}

.gallery-image-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.gallery-admin-card .featured-media-card-preview {
    height: 88px;
}

@media (max-width: 575.98px) {
    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.85rem;
    }
}
