/* --- Gallery Page Specific Styles --- */
/* Relies on variables and base styles defined in ../styles.css */

/* ── Info box override: wider on desktop for a 4-col grid ── */
#gallery-box {
    width: clamp(320px, 80vw, 900px);
}

/* ── Photo grid ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    width: 100%;
}

.photo-thumb {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background-color: var(--color-bg-cream);
}

.photo-thumb:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Smooth load-in */
    transition: opacity 0.3s ease;
}

.photo-thumb img[src=""] {
    opacity: 0;
}

/* ── Empty state ── */
#no-photos-msg {
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
    padding: 20px 0;
}

/* ── Lightbox ── */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease-out;
}

.lightbox.hidden {
    display: none;
}

.lightbox img {
    max-width: 95vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

#lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, border-color 0.2s ease;
    backdrop-filter: blur(4px);
}

#lightbox-close:hover {
    background: rgba(255, 255, 255, 0.30);
    border-color: rgba(255, 255, 255, 0.8);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ── Responsive ── */

/* High-DPI portrait (phones) → 2 columns */
@media (min-resolution: 2dppx) and (orientation: portrait),
       (-webkit-min-device-pixel-ratio: 2) and (orientation: portrait) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    #gallery-box {
        width: min(51vh, 99vw);
        font-size: 1.5em;
    }
}

/* Small screens in landscape */
@media (max-height: 500px) and (orientation: landscape) {
    #gallery-box {
        width: 90vw;
    }
}
