/* Gallery frontend styles */

/* ------------------------------------------------------------------ */
/* Archive grid                                                         */
/* ------------------------------------------------------------------ */

.sfr-gallery-archive {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin: 32px 0;
}

/* When rendered by the gallery-display block, honour the chosen column count */
.sfr-gallery-display-all .sfr-gallery-archive {
    grid-template-columns: repeat(var(--sfr-gallery-columns, 3), 1fr);
}

@media (max-width: 900px) {
    .sfr-gallery-display-all .sfr-gallery-archive {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .sfr-gallery-display-all .sfr-gallery-archive {
        grid-template-columns: 1fr;
    }
}

.sfr-gallery-card {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #1e1e1e;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.sfr-gallery-card a {
    display: block;
    text-decoration: none;
    color: inherit;
}

.sfr-gallery-card img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    transition: opacity 0.2s;
}

.sfr-gallery-card:hover img {
    opacity: 0.85;
}

.sfr-gallery-card-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: #fff;
}

.sfr-gallery-card-info h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
}

.sfr-gallery-card-info span {
    font-size: 13px;
    opacity: 0.8;
}

/* ------------------------------------------------------------------ */
/* Single gallery                                                       */
/* ------------------------------------------------------------------ */

.sfr-gallery-single {
    margin: 24px 0;
}

.sfr-gallery-single h1 {
    margin-bottom: 8px;
}

.sfr-gallery-single .gallery-desc {
    color: #555;
    margin-bottom: 16px;
    font-size: 15px;
}

.sfr-gallery-single .gallery-content {
    margin-bottom: 24px;
}

/* Square tile grid */
.sfr-gallery-lightbox-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin: 24px 0;
}

@media (max-width: 640px) {
    .sfr-gallery-lightbox-grid { grid-template-columns: repeat(2, 1fr); }
}

.sfr-gallery-thumb {
    display: block;
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 4px;
    cursor: pointer;
    background: #1e1e1e;
}

.sfr-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.sfr-gallery-thumb:hover img {
    transform: scale(1.05);
    opacity: 0.82;
}

/* Caption overlay — slides up on hover */
.sfr-gallery-thumb-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 10px 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.65), transparent);
    color: #fff;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.sfr-gallery-thumb:hover .sfr-gallery-thumb-caption {
    opacity: 1;
    transform: translateY(0);
}

/* ------------------------------------------------------------------ */
/* Lightbox                                                             */
/* ------------------------------------------------------------------ */

#sfr-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.sfr-lightbox-open {
    display: flex !important;
}

.sfr-lightbox-content {
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.sfr-lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 3px;
    transition: opacity 0.2s ease;
}

.sfr-lightbox-caption {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-top: 12px;
    text-align: center;
    max-width: 600px;
}

/* Shared button base */
.sfr-lightbox-close,
.sfr-lightbox-prev,
.sfr-lightbox-next {
    position: fixed;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    line-height: 1;
    padding: 0;
}

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

.sfr-lightbox-close {
    top: 16px;
    right: 16px;
}

.sfr-lightbox-prev {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.sfr-lightbox-next {
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
}
