/* GRID */

.fb-gallery-container {
    display: grid;
    grid-template-columns: repeat(var(--fb-gallery-per-row, 4), 1fr);
    gap: 20px;
}

@media screen and (max-width: 900px) {
    .fb-gallery-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 600px) {
    .fb-gallery-container {
        grid-template-columns: 1fr;
    }
}

/* TILE (button, not a link — opens the lightbox) */

.fb-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    text-align: inherit;
    cursor: pointer;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease-in-out;
    font-family: Montserrat, sans-serif;
}

.fb-gallery-item:hover,
.fb-gallery-item:focus-visible {
    transform: scale(1.05);
}

.fb-gallery-featured-image {
    display: block;
}

.fb-gallery-featured-image img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.fb-gallery-featured-image--placeholder {
    width: 100%;
    height: 220px;
    background: #e2e2e2;
}

.fb-gallery-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-weight: 700;
    font-size: 1.6em;
    line-height: 1.2;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fb-gallery-item:hover .fb-gallery-title,
.fb-gallery-item:focus-visible .fb-gallery-title {
    opacity: 1;
}

/* SINGLE GALLERY PAGE */

.fb-gallery-single-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.fb-gallery-single-title {
    text-align: center;
    margin-bottom: 30px;
    font-family: Montserrat, sans-serif;
}

.fb-gallery-single-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media screen and (max-width: 900px) {
    .fb-gallery-single-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 600px) {
    .fb-gallery-single-grid {
        grid-template-columns: 1fr;
    }
}

.fb-gallery-single-thumb {
    border-radius: 12px;
    box-shadow: none;
}

.fb-gallery-single-thumb img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* LIGHTBOX */

.fb-gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.92);
}

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

.fb-gallery-lightbox-image {
    max-width: 90vw;
    max-height: 85vh;
    display: block;
    border-radius: 8px;
    opacity: 1;
    transition: opacity 0.15s ease;
}

/* Shown briefly while a not-yet-preloaded image is still downloading. */
.fb-gallery-lightbox.is-loading .fb-gallery-lightbox-image {
    opacity: 0.25;
}

.fb-gallery-lightbox.is-loading::after {
    content: "";
    position: absolute;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    animation: fb-gallery-spin 0.8s linear infinite;
}

@keyframes fb-gallery-spin {
    to { transform: rotate(360deg); }
}

.fb-gallery-lightbox-close,
.fb-gallery-lightbox-prev,
.fb-gallery-lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fb-gallery-lightbox-close:hover,
.fb-gallery-lightbox-prev:hover,
.fb-gallery-lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
}

.fb-gallery-lightbox-close {
    top: 20px;
    right: 20px;
}

.fb-gallery-lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.fb-gallery-lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.fb-gallery-lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    text-align: center;
    color: #fff;
    font-family: Montserrat, sans-serif;
    font-size: 1em;
}
