﻿/* ==========================================================================
   Galleri-rutnät + lightbox för blogg-/nyhetsinlägg.
   ========================================================================== */

.blog-post__gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
    margin: 32px 0;
}

.blog-post__gallery-thumb {
    display: block;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 4px;
}

    .blog-post__gallery-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        transition: transform 0.3s ease;
    }

    .blog-post__gallery-thumb:hover img {
        transform: scale(1.06);
    }

/* ---------- Lightbox ---------- */

.post-lightbox-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: 1000;
}

    .post-lightbox-backdrop.is-visible {
        opacity: 1;
    }

.post-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

    .post-lightbox.is-visible {
        opacity: 1;
        pointer-events: auto;
    }

.post-lightbox__image {
    max-width: 85vw;
    max-height: 80vh;
    object-fit: contain;
    display: block;
}

.post-lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
}

    .post-lightbox__close:hover {
        background: rgba(255, 255, 255, 0.2);
    }

.post-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    transition: background 0.2s ease;
}

    .post-lightbox__nav:hover {
        background: rgba(255, 255, 255, 0.2);
    }

.post-lightbox__nav--prev {
    left: 20px;
}

.post-lightbox__nav--next {
    right: 20px;
}

.post-lightbox__counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    color: #fff;
    font-size: 13px;
    opacity: 0.8;
}

body.post-lightbox-open {
    overflow: hidden;
}

@media (max-width: 560px) {
    .post-lightbox__nav {
        width: 40px;
        height: 40px;
    }

    .post-lightbox__nav--prev {
        left: 8px;
    }

    .post-lightbox__nav--next {
        right: 8px;
    }
}
