/* Galleria fotografica del sito vetrina.
   CSS dedicato e non Tailwind: il lightbox e' costruito da JS, quindi le sue classi
   non verrebbero viste dal purge di Tailwind. */

/* ---------- Carosello ---------- */

.ed-gallery {
    position: relative;
}

.ed-gallery .swiper {
    max-width: 65rem;
    padding-bottom: 2.5rem;
}

.ed-gallery .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ed-gallery-thumb {
    display: block;
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: 0.75rem;
    background: #f3f4f6;
    cursor: zoom-in;
}

.ed-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

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

/* Velo con l'icona della lente: rende evidente che l'immagine si apre.
   Icona come elemento reale e non come content: il progetto usa Font Awesome Pro,
   che ha una font-family diversa dall'edizione Free. */
.ed-gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    background: rgba(17, 24, 39, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.ed-gallery-thumb:hover .ed-gallery-overlay,
.ed-gallery-thumb:focus-visible .ed-gallery-overlay {
    opacity: 1;
}

.ed-gallery-thumb:focus-visible {
    outline: 3px solid #0649a6;
    outline-offset: 3px;
}

/* Frecce ai lati, verticalmente centrate sulle immagini */
.ed-gallery-nav {
    position: absolute;
    top: calc(50% - 1.25rem);
    transform: translateY(-50%);
    z-index: 10;
    width: 2.75rem;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #fff;
    color: #0649a6;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
    transition: background 0.2s ease, transform 0.2s ease;
}

.ed-gallery-nav:hover {
    background: #0649a6;
    color: #fff;
    transform: translateY(-50%) scale(1.08);
}

.ed-gallery-nav.ed-gallery-prev { left: -0.5rem; }
.ed-gallery-nav.ed-gallery-next { right: -0.5rem; }

.ed-gallery-nav.swiper-button-disabled {
    opacity: 0.35;
    pointer-events: none;
}

@media (min-width: 1024px) {
    .ed-gallery-nav.ed-gallery-prev { left: -1.5rem; }
    .ed-gallery-nav.ed-gallery-next { right: -1.5rem; }
}

.ed-gallery .swiper-pagination-bullet-active {
    background: #0649a6;
}

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

.ed-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    flex-direction: column;
    background: rgba(9, 12, 20, 0.96);
    backdrop-filter: blur(4px);
}

.ed-lightbox.is-open {
    display: flex;
}

body.ed-lightbox-open {
    overflow: hidden;
}

.ed-lightbox-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.875rem 1.25rem;
    color: #fff;
    flex-shrink: 0;
}

.ed-lightbox-title {
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ed-lightbox-counter {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.7);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.ed-lightbox-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ed-lightbox-btn {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease;
}

.ed-lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.28);
}

.ed-lightbox-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ed-lightbox-stage {
    flex: 1;
    min-height: 0;
    position: relative;
}

.ed-lightbox-stage .swiper {
    width: 100%;
    height: 100%;
}

.ed-lightbox-stage .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ed-lightbox-stage .swiper-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Frecce del lightbox: sopra le immagini, non sui bordi dello schermo */
.ed-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    transition: background 0.2s ease;
}

.ed-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.ed-lightbox-nav.ed-lightbox-prev { left: 0.75rem; }
.ed-lightbox-nav.ed-lightbox-next { right: 0.75rem; }

.ed-lightbox-nav.swiper-button-disabled {
    opacity: 0.25;
    pointer-events: none;
}

/* Strisce di miniature, nascosta quando c'e' una sola foto */
.ed-lightbox-thumbs {
    flex-shrink: 0;
    padding: 0.75rem 1rem 1.25rem;
}

.ed-lightbox-thumbs .swiper {
    height: 4.5rem;
}

.ed-lightbox-thumbs .swiper-slide {
    width: 6rem;
    opacity: 0.45;
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.ed-lightbox-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ed-lightbox-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    box-shadow: 0 0 0 2px #fff inset;
}

.ed-lightbox[data-single="true"] .ed-lightbox-thumbs,
.ed-lightbox[data-single="true"] .ed-lightbox-nav {
    display: none;
}

@media (max-width: 640px) {
    .ed-lightbox-thumbs { display: none; }
    .ed-lightbox-title { display: none; }
}
