/* =====================================================================
   EduFlow - Blog CSS
   File: /css/blog.css  — usato da /blog/index.php e /blog/post.php
   Impaginazione allineata a quella del blog ORDO (stessa struttura di
   hero, card, articolo, share bar, correlati e CTA finale), con i colori
   e i token del brand EduFlow. Caricato DOPO /css/landing.css, da cui
   arrivano header e footer condivisi.
   ===================================================================== */
:root {
    --blog-accent:       #2563eb;
    --blog-accent-dark:  #1e40af;
    --blog-accent-soft:  #eff6ff;
    --blog-ink:          #111827;
    --blog-ink-soft:     #374151;
    --blog-muted:        #6b7280;
    --blog-line:         #e5e7eb;
    --blog-bg:           #ffffff;
    --blog-bg-soft:      #f9fafb;
    --blog-radius:       14px;
    --blog-radius-lg:    20px;
    --blog-shadow-sm:    0 1px 3px rgba(0,0,0,0.06);
    --blog-shadow-md:    0 4px 16px rgba(0,0,0,0.08);
    --blog-shadow-lg:    0 12px 40px rgba(0,0,0,0.12);

    /* Retrocompatibilita' con i nomi usati prima in questo file */
    --blog-text-main: var(--blog-ink-soft);
    --blog-text-dark: var(--blog-ink);
    --blog-bg-card:   var(--blog-bg);
}

/* ===== INDICE: HERO =====
   Il blog non aveva un <h1>: la pagina apriva direttamente con la griglia.
   L'hero da' alla lista un titolo vero, utile a lettori e motori. */
.blog-hero {
    padding: 60px 0 20px;
    text-align: center;
}
.blog-hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--blog-ink);
    letter-spacing: -0.8px;
    line-height: 1.2;
    margin-bottom: 14px;
}
.blog-hero p {
    color: var(--blog-muted);
    font-size: 1.1rem;
    max-width: 660px;
    margin: 0 auto;
}

/* ===== INDICE: GRIGLIA E CARD ===== */
.section {
    padding-bottom: 80px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 28px;
    margin-top: 40px;
}

.feature-card {
    background: var(--blog-bg);
    border: 1px solid var(--blog-line);
    border-radius: var(--blog-radius-lg);
    padding: 0;                 /* il padding lo gestisce .card-body */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease, box-shadow .25s ease;
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--blog-shadow-lg);
}
.feature-card .thumb {
    height: 190px;
    overflow: hidden;
    background: var(--blog-bg-soft);
}
.feature-card .thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.card-body {
    padding: 22px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.card-body h3 {
    font-size: 1.2rem;
    line-height: 1.35;
    color: var(--blog-ink);
    margin-bottom: 12px;
}
.card-body p {
    font-size: 0.95rem;
    color: var(--blog-ink-soft);
    margin-bottom: 20px;
}

/* Badge e meta */
.badge-categoria {
    align-self: flex-start;
    background: var(--blog-accent-soft);
    color: var(--blog-accent);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    display: inline-block;
    width: fit-content;
    margin-bottom: 12px;
}

.post-meta {
    font-size: 0.82rem;
    color: var(--blog-muted);
    margin-bottom: 10px;
}

/* Link stile "Google/SaaS" */
.btn-google-style {
    color: var(--blog-accent);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: auto;
    transition: gap 0.2s ease;
}
.btn-google-style:hover { gap: 11px; }
a.btn-google-style { color: var(--blog-accent); }

.btn-google-style i.fa-arrow-left { transition: transform 0.2s ease; }
.btn-google-style:hover i.fa-arrow-left { transform: translateX(-5px); }

.empty-state {
    text-align: center;
    color: var(--blog-muted);
    padding: 80px 0;
    font-size: 1.1rem;
}

/* ===== ARTICOLO SINGOLO ===== */
.blog-container {
    max-width: 850px;
    margin: 48px auto 0;      /* l'header e' sticky, non fixed: bastano 48px */
    padding: 0 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.post-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--blog-line);
    padding-bottom: 34px;
}
.post-header .badge {
    display: inline-block;
    background: var(--blog-accent-soft);
    color: var(--blog-accent);
    padding: 5px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 16px;
}
.post-single h1 {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--blog-ink);
    line-height: 1.2;
    letter-spacing: -0.6px;
    margin-bottom: 16px;
}
.post-header .post-meta { justify-content: center; margin-bottom: 0; }

/* Copertina a tutta larghezza: e' l'elemento che apre l'articolo */
.post-featured-image {
    display: flex;
    justify-content: center;
    margin-bottom: 46px;
    width: 100%;
}
.post-featured-image img {
    width: 100%;
    max-height: 380px;
    object-fit: cover;
    border-radius: var(--blog-radius-lg);
    box-shadow: var(--blog-shadow-lg);
    display: block;
}

/* --- Corpo del testo: spazi pensati per la leggibilita' lunga --- */
.post-body {
    color: var(--blog-ink-soft);
    font-size: 1.12rem;
}
.post-body h2,
.post-body h3,
.post-body h4 {
    color: var(--blog-ink);
    margin-top: 52px;
    margin-bottom: 20px;
    line-height: 1.3;
}
.post-body h2 { font-size: 1.7rem;  font-weight: 700; }
.post-body h3 { font-size: 1.35rem; font-weight: 700; }

.post-body p {
    margin-bottom: 26px;
    line-height: 1.8;
}
.post-body ul,
.post-body ol {
    margin-bottom: 30px;
    padding-left: 24px;
}
.post-body li {
    margin-bottom: 12px;
    line-height: 1.65;
}
.post-body strong {
    color: var(--blog-ink);
    font-weight: 700;
}
.post-body a {
    color: var(--blog-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.post-body a:hover { color: var(--blog-accent-dark); }
.post-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--blog-radius);
    margin: 30px 0;
}
.post-featured-image + .post-body p:first-of-type { margin-top: 6px; }

/* Note box (E-E-A-T: fonti, riferimenti normativi, precisazioni) */
.post-body .note-box {
    background: var(--blog-bg-soft);
    border-left: 4px solid var(--blog-accent);
    padding: 18px 22px;
    border-radius: 10px;
    margin: 36px 0;
    font-size: 0.98rem;
    color: var(--blog-ink-soft);
}
.post-body .note-box p { margin: 0; }

/* CTA box dentro l'articolo */
.cta-box {
    background: linear-gradient(135deg, #eff6ff, #e0e7ff);
    border: 1px solid #c7d2fe;
    padding: 32px;
    border-radius: var(--blog-radius-lg);
    margin: 46px 0;
    box-shadow: var(--blog-shadow-sm);
}
.cta-box h3,
.cta-box h4 {
    color: var(--blog-accent-dark) !important;
    margin-top: 0 !important;
    font-size: 1.35rem;
}
/* Il colore va ripetuto anche nello stato :hover e con un selettore che batta
   `.post-body a:hover`: a parita' di peso quella regola coloriva il testo dello
   stesso blu dello sfondo del pulsante, facendo sparire la scritta. */
.cta-box .btn-google-style,
.post-body .cta-box .btn-google-style {
    background: var(--blog-accent);
    color: #fff;
    min-height: 44px;
    padding: 12px 22px;
    border-radius: 12px;
    margin-top: 12px;
    text-decoration: none;
}
.cta-box .btn-google-style:hover,
.post-body .cta-box .btn-google-style:hover {
    background: var(--blog-accent-dark);
    color: #fff;
    text-decoration: none;
    gap: 11px;
}

/* ===== SHARE BAR ===== */
.share-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 45px;
    padding-top: 28px;
    border-top: 1px solid var(--blog-line);
}
.share-bar__label {
    font-weight: 700;
    color: var(--blog-ink);
    margin-right: 4px;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .2s ease, transform .2s ease;
}
.share-btn:hover { opacity: .9; transform: translateY(-2px); }
.share-btn i { font-size: 18px; }
.share-btn--wa   { background: #25d366; }
.share-btn--fb   { background: #1877f2; }
.share-btn--li   { background: #0a66c2; }
.share-btn--x    { background: #000000; }
.share-btn--copy { background: #475569; }

/* ===== ARTICOLI CORRELATI ===== */
.related-posts {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid var(--blog-line);
}
.related-posts h3 {
    margin-bottom: 22px;
    font-size: 1.3rem;
    color: var(--blog-ink);
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
}
.related-grid > a { text-decoration: none; color: inherit; }
.related-card {
    border: 1px solid var(--blog-line);
    border-radius: var(--blog-radius);
    overflow: hidden;
    height: 100%;
    transition: transform .25s ease, box-shadow .25s ease;
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--blog-shadow-md); }
.related-card img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    display: block;
}
.related-card .rc-body { padding: 14px; }
.related-card .rc-cat {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--blog-accent);
    font-weight: 700;
}
.related-card h4 {
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.4;
    color: var(--blog-ink);
}

.back-link {
    margin-top: 50px;
    padding-top: 26px;
    border-top: 1px solid var(--blog-line);
}

/* ===== CTA IN CODA ALLA PAGINA (prima del footer condiviso) =====
   Stesso gradiente della .cta-section della landing: il footer condiviso e'
   gia' scuro, una seconda fascia scura sopra sembrerebbe un errore. */
.blog-cta-footer {
    background: linear-gradient(135deg, var(--blog-accent) 0%, var(--blog-accent-dark) 100%);
    color: #fff;
    text-align: center;
    padding: 56px 24px;
    margin-top: 60px;
}
.blog-cta-footer h2 {
    font-size: 1.7rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.blog-cta-footer p {
    color: rgba(255,255,255,0.88);
    margin-bottom: 22px;
}
.blog-cta-footer a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    background: #fff;
    color: var(--blog-accent-dark);
    padding: 14px 30px;
    border-radius: 12px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: var(--blog-shadow-md);
    transition: transform .2s ease, box-shadow .2s ease;
}
.blog-cta-footer a:hover { transform: translateY(-2px); box-shadow: var(--blog-shadow-lg); }

/* --- Filtro per argomento nella lista articoli --- */
.blog-filtri[hidden] { display: none; }   /* hidden deve vincere su display:flex */
.blog-filtri {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 32px;
}
.chip-filtro {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--blog-line);
    background: #fff;
    color: var(--blog-ink-soft);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all 0.2s ease;
}
.chip-filtro:hover {
    border-color: #c7d2fe;
    color: var(--blog-accent);
}
.chip-filtro.attivo {
    background: var(--blog-accent);
    border-color: var(--blog-accent);
    color: #fff;
}
.chip-filtro .chip-n {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.06);
}
.chip-filtro.attivo .chip-n {
    background: rgba(255, 255, 255, 0.22);
}
/* Il focus da tastiera deve restare visibile: si naviga anche senza mouse */
.chip-filtro:focus-visible {
    outline: 2px solid var(--blog-accent-dark);
    outline-offset: 2px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
    .section { padding-bottom: 48px; }
}

@media (max-width: 640px) {
    .blog-hero { padding: 40px 0 12px; }
    .blog-hero h1 { font-size: 1.9rem; }
    .blog-hero p { font-size: 1rem; }
    .blog-container { margin-top: 32px; }
    .post-single h1 { font-size: 1.75rem; }
    .post-body { font-size: 1.06rem; }
    .post-body h2 { font-size: 1.45rem; }
    .post-body h3 { font-size: 1.2rem; }
    .post-body h2, .post-body h3, .post-body h4 { margin-top: 40px; }
    .post-featured-image img { max-height: 240px; }
    .features-grid { grid-template-columns: 1fr; gap: 22px; }
    .cta-box { padding: 24px; }
    .blog-cta-footer { padding: 44px 20px; }
    .blog-cta-footer h2 { font-size: 1.4rem; }
}

@media (max-width: 600px) {
    .share-btn { flex: 1 1 calc(50% - 10px); }
    .share-bar__label { flex-basis: 100%; margin-bottom: 4px; }
    .blog-filtri { gap: 8px; margin-bottom: 24px; }
    .chip-filtro { padding: 8px 13px; font-size: 0.86rem; }
}
