/* ─── BLOG — Light Theme ─── */

.blog-gallery-1 { grid-template-columns: 1fr; }

/* Layout */
.blog-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* ─── LISTA ─── */
.blog-list-header {
    text-align: center;
    margin-bottom: 56px;
}
.blog-list-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}
.blog-list-header p {
    font-size: 1.1rem;
    color: #64748b;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Griglia card */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 32px;
}

/* Card */
.blog-card {
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    overflow: hidden;
    background: #ffffff;
    border: 3px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    text-decoration: none;
    color: inherit;
}
.blog-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.1);
    border-color: #3b82f6;
}

.blog-card-image {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f1f5f9;
}
.blog-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.blog-card:hover .blog-card-image img {
    transform: scale(1.05);
}
.blog-card-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}

.blog-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card-date {
    font-size: 0.8rem;
    color: #3b82f6;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}
.blog-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.4;
}
.blog-card-excerpt {
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.7;
    flex: 1;
    margin-bottom: 16px;
}
.blog-card-readmore {
    font-size: 0.9rem;
    font-weight: 600;
    color: #3b82f6;
    transition: color 0.2s;
}
.blog-card:hover .blog-card-readmore {
    color: #2563eb;
}

/* Empty state */
.blog-empty {
    text-align: center;
    padding: 80px 20px;
}
.blog-empty-icon {
    color: #cbd5e1;
    margin-bottom: 20px;
}
.blog-empty p {
    color: #94a3b8;
    font-size: 1.1rem;
}

/* ─── ARTICOLO SINGOLO ─── */
.blog-article {
    max-width: 800px;
    margin: 0 auto;
}

.blog-article-header h1 {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.3;
    color: #1e293b;
    margin-bottom: 16px;
}

.blog-article-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.blog-article-langs a {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    transition: background 0.2s;
}
.blog-article-langs a:hover {
    background: #e2e8f0;
}

/* ─── Contenuto articolo ─── */
.blog-article-content {
    font-size: 1.05rem;
    line-height: 1.85;
    color: #334155;
}
.blog-article-content h2 {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1e293b;
    margin: 48px 0 16px;
}
.blog-article-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1e293b;
    margin: 36px 0 12px;
}
.blog-article-content p {
    margin-bottom: 20px;
}
.blog-article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 24px 0;
}
.blog-article-content blockquote {
    border-left: 4px solid #3b82f6;
    padding: 16px 24px;
    margin: 24px 0;
    background: #f8fafc;
    border-radius: 0 8px 8px 0;
    color: #475569;
    font-style: italic;
}
.blog-article-content pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 24px 0;
    font-size: 0.9rem;
}
.blog-article-content ul,
.blog-article-content ol {
    margin: 16px 0;
    padding-left: 28px;
}
.blog-article-content li {
    margin-bottom: 8px;
}

/* ─── Link nel testo — ESCLUSI i bottoni .blog-btn ─── */
.blog-article-content a:not(.blog-btn) {
    color: #3b82f6;
    text-decoration: underline;
    text-decoration-color: #93c5fd;
    text-underline-offset: 2px;
}
.blog-article-content a:not(.blog-btn):hover {
    color: #2563eb;
    text-decoration-color: #3b82f6;
}


/* ══════════════════════════════════════════════════════════
   HEROLARGE — FULL WIDTH
   Posizionato FUORI dal wrapper .portal-page/.blog-article
   dal cron generator. Queste regole VINCONO su tutto il tema.
   ══════════════════════════════════════════════════════════ */

section.herolarge {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    min-height: 500px;              /* default, sovrascrivibile da inline style */
    margin: 0 !important;
    padding: 0 !important;
    padding-top: 80px !important;        /* compensa header fisso 80px */
    box-sizing: border-box !important;
    background-size: cover !important;
    background-position: center !important;
    position: relative !important;
}

/* Larghezza: Schermo intero — breakout a piena viewport quando l'hero
   è rimasto DENTRO l'articolo (pagina dinamica servita da DB) */
.blog-article-content section.herolarge:not(.herolarge-content-width) {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;
    padding-top: 0 !important;   /* dentro l'articolo l'header fisso è già compensato */
    border-radius: 0 !important;
}

/* Larghezza: Contenuto — resta nel flusso dell'articolo, card arrotondata */
section.herolarge.herolarge-content-width {
    padding-top: 0 !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

section.herolarge .herolarge-overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(0,0,0,0.45) !important;
    z-index: 0 !important;
}

section.herolarge .herolarge-content {
    position: relative !important;
    z-index: 1 !important;
    text-align: center !important;
    color: #fff !important;
    padding: 60px 20px !important;
    max-width: 800px !important;
}

section.herolarge .herolarge-content h1 {
    font-size: 2.8rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin-bottom: 16px !important;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3) !important;
}

section.herolarge .herolarge-content p {
    font-size: 1.2rem !important;
    color: rgba(255,255,255,0.9) !important;
    margin-bottom: 24px !important;
}


/* ══════════════════════════════════════════════════════════
   BOTTONI BLOG — namespace .blog-btn
   Separato da .btn del sito per ZERO conflitti.
   Specificità altissima per vincere su tema + ::before/::after
   ══════════════════════════════════════════════════════════ */

/* Reset totale — vince su qualsiasi regola del tema */
section.herolarge a.blog-btn,
section.herolarge .herolarge-content a.blog-btn,
.blog-article-content a.blog-btn,
.blog-cta-section a.blog-btn,
.blog-card-block a.blog-btn,
a.blog-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 14px 28px !important;
    border-radius: 12px !important;
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none !important;
    transition: all 0.3s ease !important;
    cursor: pointer !important;
    border: none !important;
    line-height: 1.2 !important;
    position: relative !important;
    overflow: visible !important;
    background-image: none !important;
    box-sizing: border-box !important;
    color: #fff !important;
}

/* Kill qualsiasi pseudo-element ereditato dal tema (.btn::before, .btn::after) */
section.herolarge a.blog-btn::before,
section.herolarge a.blog-btn::after,
a.blog-btn::before,
a.blog-btn::after {
    content: none !important;
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* ─── Freccia animata — SOLO per .blog-btn-arrow ─── */
a.blog-btn.blog-btn-arrow::after {
    content: '→' !important;
    display: inline-block !important;
    margin-left: 6px !important;
    transition: transform 0.2s !important;
    width: auto !important;
    height: auto !important;
}
a.blog-btn.blog-btn-arrow:hover::after {
    transform: translateX(4px) !important;
}

/* ─── ROSSO ─── */
section.herolarge a.blog-btn.blog-btn-red,
a.blog-btn.blog-btn-red {
    background: #DC2626 !important;
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.3) !important;
}
section.herolarge a.blog-btn.blog-btn-red:hover,
a.blog-btn.blog-btn-red:hover {
    background: #B91C1C !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 28px rgba(220, 38, 38, 0.4) !important;
}

/* ─── NERO ─── */
section.herolarge a.blog-btn.blog-btn-black,
a.blog-btn.blog-btn-black {
    background: #0F172A !important;
    color: #fff !important;
    border: 2px solid rgba(255,255,255,0.3) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}
section.herolarge a.blog-btn.blog-btn-black:hover,
a.blog-btn.blog-btn-black:hover {
    background: #1E293B !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3) !important;
}

/* ─── GRADIENTE BLU (primary) ─── */
section.herolarge a.blog-btn.blog-btn-primary,
a.blog-btn.blog-btn-primary {
    background: linear-gradient(135deg, #2563EB, #8B5CF6) !important;
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25) !important;
}
section.herolarge a.blog-btn.blog-btn-primary:hover,
a.blog-btn.blog-btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.35) !important;
}

/* ─── OUTLINE BIANCO (secondary) ─── */
section.herolarge a.blog-btn.blog-btn-secondary,
a.blog-btn.blog-btn-secondary {
    background: #fff !important;
    border: 2px solid #E2E8F0 !important;
    color: #0F172A !important;
    box-shadow: 0 4px 15px rgba(15, 23, 42, 0.08) !important;
}
section.herolarge a.blog-btn.blog-btn-secondary:hover,
a.blog-btn.blog-btn-secondary:hover {
    border-color: #94A3B8 !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12) !important;
}

/* ─── BIANCO PIENO ─── */
section.herolarge a.blog-btn.blog-btn-white,
a.blog-btn.blog-btn-white {
    background: #fff !important;
    color: #0F172A !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
}
section.herolarge a.blog-btn.blog-btn-white:hover,
a.blog-btn.blog-btn-white:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

/* ─── Gruppo bottoni ─── */
section.herolarge .blog-btn-group,
.blog-btn-group {
    display: flex !important;
    gap: 16px !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    margin-top: 20px !important;
}

/* ─── Override su sfondo scuro (herolarge) ─── */
section.herolarge .blog-btn-black {
    border-color: #fff !important;
}

/* ─── Override tema: impedisci che body a:not(.btn):hover colori i blog-btn ─── */
body.theme-professional-light a.blog-btn,
body.theme-professional-light a.blog-btn:hover,
body.theme-professional-light section.herolarge a.blog-btn,
body.theme-professional-light section.herolarge a.blog-btn:hover {
    text-decoration: none !important;
}
body.theme-professional-light a.blog-btn.blog-btn-red:hover,
body.theme-professional-light section.herolarge a.blog-btn.blog-btn-red:hover {
    color: #fff !important;
}
body.theme-professional-light a.blog-btn.blog-btn-black:hover,
body.theme-professional-light section.herolarge a.blog-btn.blog-btn-black:hover {
    color: #fff !important;
}


/* ══════════════════════════════════════════════════════════
   FALLBACK: herolarge dentro blog-article-content
   (vecchi articoli non rigenerati)
   ══════════════════════════════════════════════════════════ */

.blog-article-content .herolarge {
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
    max-width: 100vw;
    position: relative;
    border-radius: 0;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    margin-top: -40px;
    margin-bottom: 40px;
}
.blog-article-content .herolarge .herolarge-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
}
.blog-article-content .herolarge .herolarge-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 60px 20px;
    max-width: 800px;
}
.blog-article-content .herolarge .herolarge-content h1 {
    font-size: 2.8rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.blog-article-content .herolarge .herolarge-content p {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.9);
    margin-bottom: 24px;
}


/* ─── Hero (non-large) ─── */
.blog-article-content .hero {
    padding: 48px 0;
    margin-bottom: 32px;
}
.blog-article-content .hero .hero-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}
.blog-article-content .hero .hero-content h1 {
    font-size: 2.2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 12px;
}
.blog-article-content .hero .hero-subtitle {
    font-size: 1.1rem;
    color: #64748b;
    margin-bottom: 24px;
}
.blog-article-content .hero .blog-btn-group {
    justify-content: center !important;
}

/* ─── Card block dentro articolo ─── */
.blog-article-content .blog-card-block {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    margin: 24px 0;
    background: #fff;
}
.blog-article-content .blog-card-block .card-image img {
    width: 100%;
    height: auto;
    display: block;
}
.blog-article-content .blog-card-block .card-body {
    padding: 24px;
}
.blog-article-content .blog-card-block .card-body h3 {
    margin-top: 0;
}

/* ─── CTA — varianti sfondo ─── */
.blog-article-content .blog-cta-section {
    text-align: center;
    padding: 48px 32px;
    border-radius: 16px;
    margin: 40px 0;
}
.blog-article-content .blog-cta-section h2 {
    margin-top: 0;
}
.blog-article-content .blog-cta-section.cta-light {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
}
.blog-article-content .blog-cta-section.cta-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: #fff;
}
.blog-article-content .blog-cta-section.cta-gradient h2 {
    color: #fff;
}
.blog-article-content .blog-cta-section.cta-gradient p {
    color: rgba(255,255,255,0.9);
}
.blog-article-content .blog-cta-section.cta-dark {
    background: #0F172A;
    color: #fff;
}
.blog-article-content .blog-cta-section.cta-dark h2 {
    color: #fff;
}
.blog-article-content .blog-cta-section.cta-dark p {
    color: rgba(255,255,255,0.8);
}

/* CTA bottoni — centrati */
.blog-article-content .blog-cta-section .blog-btn-group {
    justify-content: center !important;
}

/* Footer articolo */
.blog-article-footer {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}
.blog-back-link {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.2s;
}
.blog-back-link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ══════════════════════════════════════════════════════════
   GALLERIA IMMAGINI
   ══════════════════════════════════════════════════════════ */

.blog-gallery {
    display: grid;
    gap: 12px;
    margin: 24px 0;
}
.blog-gallery-2 { grid-template-columns: repeat(2, 1fr); }
.blog-gallery-3 { grid-template-columns: repeat(3, 1fr); }
.blog-gallery-4 { grid-template-columns: repeat(4, 1fr); }

.blog-gallery-item {
    margin: 0;
    overflow: hidden;
    border-radius: 12px;
    position: relative;
}
.blog-gallery-item[onclick] {
    cursor: pointer;
}
.blog-gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.blog-gallery-item:hover img {
    transform: scale(1.05);
}
.blog-gallery-item figcaption {
    padding: 8px 12px;
    font-size: 13px;
    color: #64748b;
    background: #f8fafc;
    line-height: 1.4;
}

/* Lightbox */
.blog-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.2s ease;
}
.blog-lightbox-overlay img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.blog-lightbox-caption {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    text-align: center;
    z-index: 10000;
    max-width: 600px;
}
.blog-lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    color: #fff;
    font-size: 32px;
    cursor: pointer;
    z-index: 10000;
    background: none;
    border: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.blog-lightbox-close:hover {
    opacity: 1;
}

@keyframes fadeIn {
    from { opacity: 0 }
    to { opacity: 1 }
}


/* ─── Responsive ─── */
@media (max-width: 768px) {
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .blog-list-header h1 {
        font-size: 1.8rem;
    }
    .blog-article-header h1 {
        font-size: 1.6rem;
    }

    /* HeroLarge responsive */
    section.herolarge {
        min-height: 350px !important;
        padding-top: 70px !important;  /* header mobile più piccolo */
    }
    section.herolarge .herolarge-content h1 {
        font-size: 1.8rem !important;
    }
    .blog-article-content .herolarge {
        min-height: 350px;
    }
    .blog-article-content .herolarge .herolarge-content h1 {
        font-size: 1.8rem;
    }

    /* Bottoni responsive */
    section.herolarge a.blog-btn,
    a.blog-btn {
        padding: 12px 22px !important;
        font-size: 14px !important;
    }
    section.herolarge .blog-btn-group,
    .blog-btn-group {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .blog-btn-group .blog-btn {
        justify-content: center !important;
    }

    /* Gallery responsive */
    .blog-gallery-3,
    .blog-gallery-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .blog-gallery-2,
    .blog-gallery-3,
    .blog-gallery-4 {
        grid-template-columns: 1fr;
    }
    .blog-gallery-item img {
        height: 180px;
    }
}
