/* =======================================================
   FILTRI PORTFOLIO
======================================================= */

.portfolio-filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 10px 0 20px;
    align-items: flex-start;
}

/* ============================================
   NUOVO SWITCH UNICO — PRODOTTI / PRODUZIONE
============================================ */

.toggle-mode {
    width: 100%;
    display: flex;
    justify-content: flex-start;
       transform: scale(.8);
    margin-left: -39px;
    margin-bottom: -5px;
}

.toggle-switch {
    position: relative;
    width: 160px;
    height: 38px;
    background: #ddd;
    border-radius: 50px;
    cursor: pointer;
    overflow: hidden;
    transition: background .25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* TESTO INTERNO */
.toggle-text-left,
.toggle-text-right {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: -0.3px;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity .2s ease;
    color: #000;
}

/* Default → PRODOTTI visibile */
.toggle-text-left { opacity: 1; }
.toggle-text-right { opacity: 0; }

/* KNOB */
.toggle-knob {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #fff;
    right: 3px; /* posizione PRODOTTI */
    top: 3px;
    transition: all .28s cubic-bezier(.25,.8,.25,1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}

/* STATO: PRODUZIONE */
.toggle-switch.is-production {
    background: #000;
}

.toggle-switch.is-production .toggle-knob {
    transform: translateX(-122px); /* knob a sx */
}

.toggle-switch.is-production .toggle-text-left {
    opacity: 0;
}
.toggle-switch.is-production .toggle-text-right {
    opacity: 1;
    color: #fff;
}

/* =======================================================
   FILTRI PRODOTTI / PRODUZIONE
======================================================= */

/* Di default mostro i filtri prodotti */
.filters-prodotti { display: block; }
.filters-produzione {
	display: none;
    max-width: 300px;
    margin-top: 10px;
}

.portfolio-filters .filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.portfolio-filters .filter-btn {
    border: none;
    padding: 6px 13px;
    font-size: 11px;
    text-transform: uppercase;
    border-radius: 999px;
    background: #eee;
    color: #444;
    cursor: pointer;
    letter-spacing: -0.3px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
      gap: 0;
    margin: 10px -5px 0 0;
}

.portfolio-filters .filter-btn:hover {
    background: #000;
    color: #fff;
}

/* Stato attivo */
.portfolio-filters .filter-btn.is-active {
    background: #000;
    color: #fff;
    font-weight: 700;
}
.filters-produzione .filter-btn {
	margin-top:0 !important;
}

/* Icona X prima del testo (solo quando attivo) */
.portfolio-filters .filter-btn.is-active::before {
    content: "×";
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
}

/* Pulsante "Tutti" */
.clear-filters-btn {
    border: none;
    padding: 4px 12px 5px 12px;
    font-size: 10px;
    text-transform: uppercase;
    border-radius: 999px;
    background: #fff;
    color: #333;
    cursor: pointer;
    border: 1px solid #ccc;
    letter-spacing: -0.2px;
    margin-bottom: 6px;
}

.clear-filters-btn:hover {
    background: #000;
    color: #fff;
    border-color: #000;
}


/* =======================================================
   GRIGLIA MASONRY
======================================================= */

.portfolio-grid {
    column-count: 6;
    column-gap: 12px;
}

@media (max-width: 1400px) {
    .portfolio-grid { column-count: 5; }
}
@media (max-width: 1200px) {
    .portfolio-grid { column-count: 4; }
}
@media (max-width: 900px) {
    .portfolio-grid { column-count: 3; }
}
@media (max-width: 600px) {
    .portfolio-grid { column-count: 2; }
}

.portfolio-item {
    break-inside: avoid;
    margin-bottom: 12px;
    cursor: zoom-in;
}

.portfolio-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
    transition: opacity .2s ease, transform .2s ease;
}

.portfolio-item img:hover {
    transform: scale(1.015);
}


/* =======================================================
   LIGHTBOX
======================================================= */

.portfolio-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;

    cursor: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'>\
<line x1='8' y1='8' x2='24' y2='24' stroke='white' stroke-width='3'/>\
<line x1='24' y1='8' x2='8' y2='24' stroke='white' stroke-width='3'/>\
</svg>") 16 16, pointer;
}

.portfolio-lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 6px;
    cursor: default;
    transition: opacity .15s ease;
}

/* Frecce lightbox */
.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 46px;
    height: 46px;
    border-radius: 999px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    font-size: 26px;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255,255,255,0.35);
    transform: translateY(-50%) scale(1.12);
}

.lightbox-prev { left: 35px; }
.lightbox-next { right: 35px; }

@media (max-width: 700px) {
    .lightbox-prev,
    .lightbox-next {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

.portfolio-lightbox {
    justify-content: center !important;
    align-items: center !important;
}

.portfolio-lightbox img {
    display: block;
    margin: auto;
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}


/* =======================================================
   LOAD MORE FEEDBACK
======================================================= */

.portfolio-loading {
    width: 100%;
    text-align: center;
    padding: 20px;
    font-size: 13px;
    color: #888;
}


/* ===========================
   FILTRI STICKY
=========================== */

#portfolio-filters {
    position: relative;
    z-index: 50;
    transition: all 0.2s ease;
}

#portfolio-filters.is-fixed {
    position: fixed;
    top: 147px;
    left: 25px;
    width: calc(100% - 38px);
    padding: 0;
    background: transparent !important;
    box-shadow: none !important;
}
