/*
 * Photo grid + lightbox styles, linked in <head> via $GLOBALS['page_stylesheets'] (includes/header.php).
 *
 * Moved verbatim from an inline <style> block in includes/photo-grid.php on 2026-10-24. Emitted
 * after the content it styles, it let the browser paint that content without
 * these rules and then reflow it whenever the HTML arrived in more than one
 * piece: the desktop CLS class fixed for gig pages in #1782 (see gig.css).
 */

/* ─── Photo grid ──────────────────────────────────────────────────────── */
.photogrid-heading {
    font-size: 1.5rem;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--pink, #FF006E);
}
.photogrid-empty {
    padding: 24px;
    background: var(--card-bg, rgba(255,255,255,0.05));
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-muted, rgba(255,255,255,0.6));
    line-height: 1.6;
}
.photogrid-empty a { color: var(--pink, #FF006E); text-decoration: none; }
.photogrid-empty a:hover { text-decoration: underline; }

.photogrid-masonry { columns: 4; column-gap: 10px; }
.photogrid-item {
    break-inside: avoid;
    margin-bottom: 10px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.photogrid-item img { width: 100%; height: auto; display: block; transition: transform 0.3s; } /* height:auto lets the width/height attrs act as an aspect-ratio reservation, not a fixed height */
.photogrid-item:hover img { transform: scale(1.04); }
.photogrid-placeholder {
    width: 100%; height: 120px;
    background: rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; color: var(--text-muted, rgba(255,255,255,0.4));
}
.photogrid-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0);
    transition: background 0.25s;
    display: flex; align-items: flex-end; justify-content: space-between;
    padding: 8px; opacity: 0;
}
.photogrid-item:hover .photogrid-overlay { background: rgba(0,0,0,0.45); opacity: 1; }
.photogrid-overlay-info { display: flex; flex-direction: column; gap: 2px; }
.photogrid-photographer { font-size: 0.75rem; color: rgba(255,255,255,0.95); font-weight: 600; }
.photogrid-likes { font-size: 0.72rem; color: rgba(255,255,255,0.8); }
.photogrid-ext { color: rgba(255,255,255,0.85); font-size: 1.1rem; text-decoration: none; align-self: flex-start; }

.photogrid-cta-link { margin-top: 10px; font-size: 0.85rem; color: var(--text-muted, rgba(255,255,255,0.5)); }
.photogrid-cta-link a { color: var(--pink, #FF006E); text-decoration: none; }
.photogrid-cta-link a:hover { text-decoration: underline; }

/* ─── Lightbox overlay ───────────────────────────────────────────────── */
.pgl-overlay {
    display: none;
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.96);
    flex-direction: column;
    align-items: stretch;
    animation: pglFadeIn 0.18s ease;
}
.pgl-overlay.open { display: flex; }
@keyframes pglFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Top bar */
.pgl-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px 10px;
    flex-shrink: 0;
}
.pgl-counter {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.45);
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
}
.pgl-close {
    background: none; border: none;
    color: rgba(255,255,255,0.7);
    font-size: 2.2rem; line-height: 1;
    cursor: pointer; padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}
.pgl-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

/* Stage (fills remaining space) */
.pgl-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0 68px;
    cursor: zoom-out;
}
.pgl-img-wrap {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.pgl-img {
    max-width: 100%;
    max-height: calc(100vh - 130px);
    object-fit: contain;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.22s ease;
    display: block;
}
.pgl-img.loaded { opacity: 1; }

/* Loading spinner */
.pgl-spinner {
    position: absolute;
    width: 36px; height: 36px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: rgba(255,255,255,0.7);
    border-radius: 50%;
    animation: pglSpin 0.7s linear infinite;
    display: none;
}
.pgl-spinner.active { display: block; }
@keyframes pglSpin { to { transform: rotate(360deg); } }

/* Prev / Next arrows */
.pgl-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.14);
    color: rgba(255,255,255,0.8);
    font-size: 2.8rem;
    line-height: 1;
    width: 52px; height: 72px;
    border-radius: 8px;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.18s, color 0.18s;
    z-index: 2;
    padding: 0;
}
.pgl-arrow:hover { background: rgba(255,255,255,0.18); color: #fff; }
.pgl-arrow:disabled { opacity: 0.2; pointer-events: none; }
.pgl-prev { left: 10px; }
.pgl-next { right: 10px; }

/* Caption */
.pgl-caption {
    flex-shrink: 0;
    padding: 10px 20px 16px;
    text-align: center;
    font-size: 0.88rem;
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    flex-wrap: wrap;
}
.pgl-title { color: rgba(255,255,255,0.85); font-weight: 600; }
.pgl-sep { color: rgba(255,255,255,0.3); margin: 0 6px; }
.pgl-credit a { color: var(--pink, #FF006E); text-decoration: none; }
.pgl-credit a:hover { text-decoration: underline; }

/* Hide arrows when only 1 photo */
.pgl-overlay.single .pgl-arrow { display: none; }

/* Light mode */
[data-theme="light"] .photogrid-empty { background: #fff; border: 1px solid rgba(0,0,0,0.08); }
[data-theme="light"] .photogrid-placeholder { background: #f0f0f0; }

@media (max-width: 900px) { .photogrid-masonry { columns: 3; } }
@media (max-width: 600px) {
    .photogrid-masonry { columns: 2; }
    .pgl-stage { padding: 0 48px; }
    .pgl-arrow { width: 40px; height: 60px; font-size: 2.2rem; }
    .pgl-prev { left: 4px; }
    .pgl-next { right: 4px; }
}
