/* --- PORTFOLIO GRID (shortcode e archivio) --- */
.e061070-portfolio-grid {
    display: grid;
    gap: 2rem;
    margin: 2rem 0;
}
.portfolio-grid--cols-1 { grid-template-columns: 1fr; }
.portfolio-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.portfolio-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.portfolio-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}
.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.1);
}
.portfolio-thumbnail img {
    width: 100%;
    height: auto;
    display: block;
}
.portfolio-content {
    padding: 1.5rem;
}
.portfolio-content h3 {
    font-size: 1.4rem;
    margin: 0 0 0.8rem;
}
.portfolio-content h3 a {
    color: inherit;
    text-decoration: none;
}
.portfolio-excerpt {
    color: #555;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* --- SINGOLO PORTFOLIO - HERO SECTION --- */
.portfolio-hero {
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.portfolio-hero.with-title {
    height: 400px;
}

.portfolio-hero.no-title {
    height: 300px;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,0.4);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
    color: white;
    max-width: 800px;
    padding: 0 2rem;
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    line-height: 1.2;
}

/* --- LAYOUT CONTAINERS --- */
.content-boxed {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.content-fullwidth {
    width: 100%;
    margin: 0 auto;
}

.content-fullwidth.with-sidebar,
.content-boxed.with-sidebar {
    display: flex;
    gap: 3rem;
    align-items: flex-start;
}

.single-portfolio.layout-full-width .content-fullwidth {
    padding: 0;
}

/* --- SINGOLO PORTFOLIO CON SIDEBAR --- */
.single-portfolio.layout-left-sidebar .content-boxed.with-sidebar,
.single-portfolio.layout-left-sidebar .content-fullwidth.with-sidebar {
    display: flex !important;
    flex-direction: row !important;
}

.single-portfolio.layout-left-sidebar .content-boxed.with-sidebar > .sidebar-portfolio,
.single-portfolio.layout-left-sidebar .content-fullwidth.with-sidebar > .sidebar-portfolio {
    order: -1 !important;
}

.sidebar-portfolio {
    width: 300px;
    flex-shrink: 0;
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.sidebar-portfolio .widget-title {
    margin-top: 0;
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 0.5rem;
}

.single-portfolio .main-content {
    flex: 1;
    min-width: 0;
}

/* --- INFO PROGETTO --- */
.project-info-sidebar,
.project-info-main {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.project-info-main h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #333;
    border-bottom: 2px solid #2271b1;
    padding-bottom: 0.5rem;
}

.project-info .info-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.project-info .info-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.project-info .info-item strong {
    color: #2271b1;
    font-weight: 600;
    flex: 0 0 100px;
}

.project-info .info-item span {
    flex: 1;
    text-align: right;
    color: #666;
}

.project-links {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.project-link {
    display: block;
    padding: 0.75rem 1rem;
    background-color: #2271b1;
    color: white !important;
    text-decoration: none;
    border-radius: 6px;
    text-align: center;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid #2271b1;
}

.project-link:hover {
    background-color: #135e96;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* --- Navigazione portfolio (precedente / successivo) --- */
.portfolio-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
    font-size: 1.1rem;
}
.portfolio-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: background 0.2s;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}
.portfolio-nav-link img {
    width: 16px;
    height: 16px;
    filter: brightness(0) saturate(100%) invert(30%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(90%);
}
.portfolio-nav-link:hover:not(.disabled) {
    background: #f0f0f0;
}
.portfolio-nav-link:hover:not(.disabled) img {
    filter: brightness(0) saturate(100%) invert(20%) sepia(20%) saturate(2000%) hue-rotate(184deg) brightness(95%) contrast(90%);
}
.portfolio-nav-link.disabled {
    color: #aaa;
    cursor: not-allowed;
}
.portfolio-nav-link.disabled img {
    opacity: 0.5;
}

/* --- FILTRI PORTFOLIO --- */
.portfolio-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
    justify-content: center;
}
.filter-btn {
    padding: 0.5rem 1.25rem;
    background: transparent;
    border: 1px solid;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    text-decoration: none;
}
.filter-btn:hover,
.filter-btn.active {
    color: white !important;
    font-weight: bold;
}
.filter-btn.active {
    font-weight: bold;
}

/* --- Pulsante "Carica altro" --- */
.portfolio-load-more {
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}
#portfolio-load-more-btn {
    background: var(--wp--style--color--link, #0073aa);
    color: white !important;
    border: none;
    padding: 12px 24px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}
#portfolio-load-more-btn:hover {
    background: var(--wp--style--color--link-hover, #005a87);
}

/* ==============================
   RESPONSIVE: TABLET & MOBILE
   ============================== */

@media (max-width: 992px) {
    .e061070-portfolio-grid {
        grid-template-columns: 1fr !important;
    }
    
    .content-fullwidth.with-sidebar,
    .content-boxed.with-sidebar {
        display: block !important;
        padding: 0 15px;
    }
    
    .sidebar-portfolio {
        width: 100% !important;
        margin-bottom: 2rem;
    }
    
    .single-portfolio .main-content {
        width: 100% !important;
        margin: 0 !important;
    }
    
    .portfolio-hero.with-title {
        height: 300px;
    }
    
    .portfolio-hero.no-title {
        height: 200px;
    }
    
    .hero-title {
        font-size: 2.2rem;
    }
}

@media (max-width: 768px) {
    .portfolio-navigation {
        display: flex;
        flex-direction: row;
        justify-content: center;
        gap: 1rem;
        margin-top: 2rem;
        padding-top: 1.2rem;
        border-top: 1px solid #eee;
    }

    .portfolio-nav-link {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        background: #f5f5f5;
        border-radius: 8px;
        text-decoration: none;
        padding: 0;
        text-transform: none;
        font-weight: normal;
        letter-spacing: normal;
        transition: background 0.2s, transform 0.15s;
    }

    .pn-title {
        display: none;
    }

    .portfolio-nav-link img {
        width: 20px;
        height: 20px;
        filter: brightness(0) saturate(100%) invert(30%) sepia(0%) saturate(0%) hue-rotate(0deg) brightness(95%) contrast(90%);
    }

    .portfolio-nav-link:hover,
    .portfolio-nav-link:focus {
        background: #e9e9e9;
        transform: scale(1.05);
        outline: none;
    }

    .portfolio-nav-empty {
        width: 44px;
        height: 44px;
        visibility: hidden;
    }
    
    .project-info .info-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .project-info .info-item span {
        text-align: left;
    }
    
    .project-links {
        flex-direction: column;
    }
    
    .hero-title {
        font-size: 1.8rem;
        padding: 0 1rem;
    }
}

/* --- Uniforma le immagini nella griglia --- */
.portfolio-thumbnail {
    height: 250px; /* altezza fissa */
    overflow: hidden;
    display: initial;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
}
.portfolio-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* ritaglia l'immagine per coprire l'area */
    object-position: center;
}
@media (max-width: 768px) {
    /* ... le tue regole esistenti per mobile ... */

    /* --- Filtri su un'unica riga su mobile --- */
    .portfolio-filters {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0 10px;
        -webkit-overflow-scrolling: touch;
    }
    .portfolio-filters .filter-btn {
        flex-shrink: 0;
        padding: 0.2rem 0.4rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
}
/* --- Uniforma le anteprime del portfolio --- */
.portfolio-item {
    display: flex;
    flex-direction: column;
    height: 100%;
}
.portfolio-thumbnail {
    height: 280px; /* ← regola questo valore a tuo piacimento */
    overflow: hidden;
    flex-shrink: 0;
    background: #f9f9f9;
}
.portfolio-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}
.portfolio-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.portfolio-grid--cols-1 { grid-template-columns: 1fr; }
.portfolio-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
.portfolio-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
.portfolio-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
.portfolio-grid--cols-5 { grid-template-columns: repeat(5, 1fr); }
.portfolio-grid--cols-6 { grid-template-columns: repeat(6, 1fr); }