/* ===== GALLERIA FOTOGRAFICA — Frontend ===== */

/* Sezione galleria — eredita .sec-header, .sec-eyebrow, .sec-title, .sec-desc da index.css */
.gallery-section {
    padding: 0 16px;
    max-width: 1100px;
    margin: 0 auto 48px;
}

/* Griglia foto */
.gal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.gal-item {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--c-border);
    cursor: pointer;
    background: var(--c-bg-card);
}

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

.gal-img {
    width: 100%;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.gal-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 14px 12px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    font-family: 'DM Mono', monospace;
    font-size: 0.75rem;
    font-weight: 400;
    color: #fff;
    line-height: 1.3;
}

/* ===== LIGHTBOX ===== */
.gal-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.92);
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(20px, env(safe-area-inset-bottom));
}

.gal-lightbox.visible {
    display: flex;
}

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

.gal-lb-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    user-select: none;
    -webkit-user-select: none;
}

.gal-lb-label {
    margin-top: 12px;
    font-family: 'DM Mono', monospace;
    font-size: 0.8rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    min-height: 1.2em;
}

.gal-lb-close,
.gal-lb-prev,
.gal-lb-next {
    position: absolute;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.2s;
    z-index: 10;
    -webkit-tap-highlight-color: transparent;
}

.gal-lb-close:hover,
.gal-lb-prev:hover,
.gal-lb-next:hover {
    color: #fff;
}

.gal-lb-close {
    top: 16px;
    right: 16px;
    font-size: 2rem;
    line-height: 1;
    padding: 8px;
    top: max(16px, env(safe-area-inset-top));
}

.gal-lb-prev,
.gal-lb-next {
    top: 50%;
    transform: translateY(-50%);
    font-size: 2.5rem;
    padding: 16px;
}

.gal-lb-prev {
    left: 8px;
}

.gal-lb-next {
    right: 8px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .gal-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .gal-label {
        font-size: 0.65rem;
        padding: 16px 10px 8px;
    }


    .gal-lb-prev,
    .gal-lb-next {
        font-size: 1.8rem;
        padding: 12px;
    }
}

@media (max-width: 480px) {
    .gal-grid {
        grid-template-columns: 1fr;
    }
}
