/* =========================================================
   GALLERY STYLES
   Global (not scoped), because the lightbox is added to the page by
   wwwroot/js/photo-gallery.js. Used by Gallery.razor (/gallery).
   ========================================================= */

/* ---------- Page ---------- */
.gallery-page {
    background: #faf8f3;
    padding: 32px 0 64px 0;
    min-height: 70vh;
}

.gallery-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

.gallery-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.8rem;
    font-weight: 700;
    color: #2E7D32;
    margin: 0 0 6px 0;
}

.gallery-title {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    line-height: 1.1;
    margin: 0;
    color: #1f2d24;
}

.gallery-subtitle {
    font-size: 1.1rem;
    color: #6b7c72;
    margin: 4px 0 28px 0;
}

.gallery-empty {
    color: #6b7c72;
    text-align: center;
    padding: 60px 0;
}

/* ---------- Grid: "masonry" columns, photos keep their own shape ---------- */
photo-gallery {
    display: block;
    columns: 4 240px;      /* as many columns of at least 240px as fit, max 4 */
    column-gap: 16px;
}

.gallery-item {
    display: block;
    position: relative;
    break-inside: avoid;
    margin-bottom: 16px;
    border-radius: 18px;
    overflow: hidden;
    background: #e8f3e9;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    text-decoration: none;
    color: white;
}

    .gallery-item img {
        width: 100%;
        height: auto;          /* width/height attributes keep the space while loading */
        display: block;
        transition: transform 0.5s;
    }

    .gallery-item:hover img {
        transform: scale(1.05);
    }

.gallery-item-title {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 28px 14px 12px 14px;
    background: linear-gradient(to top, rgba(10, 30, 15, 0.78), transparent);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
}

/* ---------- Lightbox ---------- */
html.pg-no-scroll {
    overflow: hidden;
}

.pg-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;               /* above the sticky header and MudBlazor */
    background: rgba(8, 18, 11, 0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pg-fade 0.2s ease-out;
    touch-action: pan-y;         /* we handle sideways swipes ourselves */
}

@keyframes pg-fade {
    from {
        opacity: 0;
    }
}

.pg-figure {
    margin: 0;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 56px 72px 16px 72px;
    box-sizing: border-box;
}

.pg-image {
    max-width: 100%;
    max-height: calc(100vh - 140px);
    object-fit: contain;
    border-radius: 10px;
    opacity: 0;
    transition: opacity 0.25s;
    user-select: none;
    -webkit-user-drag: none;
}

    .pg-image.pg-loaded {
        opacity: 1;
    }

.pg-caption {
    display: flex;
    gap: 16px;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 14px;
    color: #f3ecd8;
    text-align: center;
    font-family: Roboto, sans-serif;
}

.pg-title {
    font-size: 1.1rem;
    font-weight: 600;
}

.pg-counter {
    font-size: 0.85rem;
    opacity: 0.6;
}

/* Buttons */
.pg-close,
.pg-prev,
.pg-next {
    position: absolute;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: white;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: Arial, sans-serif;
    transition: background 0.2s;
}

    .pg-close:hover,
    .pg-prev:hover,
    .pg-next:hover {
        background: rgba(255, 255, 255, 0.25);
    }

.pg-close {
    top: 14px;
    right: 14px;
    width: 46px;
    height: 46px;
    font-size: 22px;
}

.pg-prev,
.pg-next {
    top: 50%;
    width: 52px;
    height: 52px;
    margin-top: -26px;
    font-size: 38px;
    line-height: 1;
    padding-bottom: 4px;
}

.pg-prev {
    left: 14px;
}

.pg-next {
    right: 14px;
}

.pg-single .pg-prev,
.pg-single .pg-next {
    display: none;
}

/* ---------- Phone ---------- */
@media (max-width: 600px) {
    .gallery-page {
        padding: 20px 0 40px 0;
    }

    .gallery-wrap {
        padding: 0 12px;
    }

    photo-gallery {
        columns: 2;              /* two photos side by side */
        column-gap: 10px;
    }

    .gallery-item {
        margin-bottom: 10px;
        border-radius: 14px;
    }

    .gallery-item-title {
        font-size: 0.8rem;
        padding: 22px 10px 8px 10px;
    }

    /* Lightbox: photo uses the whole width, swipe instead of arrows */
    .pg-figure {
        padding: 60px 0 16px 0;
    }

    .pg-image {
        border-radius: 0;
    }

    .pg-prev,
    .pg-next {
        display: none;
    }

    .pg-caption {
        padding: 0 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pg-overlay {
        animation: none;
    }

    .gallery-item img {
        transition: none;
    }
}
