/* ===========================================
   RESET
   =========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ===========================================
   BODY DEL BLOG
   =========================================== */
.blog-body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
        "Segoe UI", Roboto, sans-serif;
    background: radial-gradient(circle at 0% 0%, #f7f8ff 0, #e7e9ff 35%, #f5f5ff 70%, #ffffff 100%);
    color: #111827;
    -webkit-font-smoothing: antialiased;
}

.blog-body a {
    text-decoration: none;
    color: inherit;
}

/* ===========================================
   PULSANTE FLOTANTE HOME (→ codfis.it)
   =========================================== */
.blog-home-btn {
    position: fixed;
    left: 16px;
    top: 16px;
    z-index: 50;
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
    font-size: 14px;
    font-weight: 600;
    color: #0b3c7a;
}

/* ===========================================
   CONTENITORE CENTRALE
   =========================================== */
.blog-shell {
    max-width: 720px;
    margin: 0 auto;
    padding: 72px 16px 48px 16px; /* spazio per il bottone flottante */
}

/* ===========================================
   HERO (HOME + ARTICOLO)
   =========================================== */
.hero-wrapper {
    display: flex;
    justify-content: center; /* sempre centrata */
    margin-bottom: 24px;
}

.hero-link {
    display: block;
    width: 100%;
}

/* immagine hero di base (home) */
.hero-blog {
    display: block;
    width: 100%;
    max-width: 720px;
    border-radius: 20px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

/* Articolo singolo */
.article-page .hero-wrapper {
    margin-top: 6px;
    margin-bottom: 18px;
}

/* qui centro davvero la hero ridimensionandola sul link */
.article-page .hero-link {
    max-width: 520px;
    margin: 0 auto;
}

.article-page .hero-blog {
    width: 100%;
    max-width: none;
    border-radius: 18px;
}

/* ===========================================
   RICERCA
   =========================================== */
.search-box {
    margin: 12px 0 10px 0;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,0.12);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(18px);
    font-size: 15px;
}

.search-hint {
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 16px;
}

/* ===========================================
   LISTA POST (home + risultati)
   =========================================== */
.posts-grid,
.search-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 28px;
}

.post-card {
    border-radius: 18px;
    padding: 16px 18px;
    background: rgba(255,255,255,0.92);
    box-shadow: 0 10px 25px rgba(15,23,42,0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(209,213,219,0.7);
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(15,23,42,0.12);
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
}

.post-meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 8px;
}

.post-excerpt {
    font-size: 14px;
    color: #374151;
}

/* ===========================================
   ARTICOLO SINGOLO
   =========================================== */
.article-title {
    font-size: 24px;
    font-weight: 700;
    margin: 6px 0 6px 0;
}

.article-meta {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
}

.article-content {
    font-size: 16px;
    line-height: 1.65;
    background: rgba(255,255,255,0.9);
    border-radius: 18px;
    padding: 16px 18px 20px 18px;
    box-shadow: 0 12px 28px rgba(15,23,42,0.08);
    border: 1px solid rgba(209,213,219,0.7);
    margin-bottom: 24px;

    /* evita lo “sbrodolamento” di parole lunghissime */
    overflow-wrap: anywhere;
    word-break: break-word;
}

.article-content a {
    color: #2563eb; /* blu moderno */
    font-weight: 600;
    text-decoration: underline;
}

.article-content a:hover {
    color: #1d4ed8; /* blu più scuro */
    text-decoration-thickness: 2px;
}


/* TITOLI INTERNI (H1–H4) BEN VISIBILI E DISTANZIATI */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
    font-weight: 700;
    color: #111827;
    line-height: 1.4;
}

.article-content h1 {
    font-size: 22px;
    margin: 18px 0 10px;
}

.article-content h2 {
    font-size: 20px;
    margin: 18px 0 8px;
}

.article-content h3 {
    font-size: 18px;
    margin: 16px 0 6px;
}

.article-content h4 {
    font-size: 16px;
    margin: 14px 0 6px;
}

/* spazi paragrafi */
.article-content p + p {
    margin-top: 10px;
}

/* spazio tra tabelle/liste e il paragrafo successivo */
.article-content table + p,
.article-content ul + p,
.article-content ol + p {
    margin-top: 10px;
}

/* spazio tra paragrafi/liste/tabelle e il titolo successivo */
.article-content p + h2,
.article-content p + h3,
.article-content p + h4,
.article-content ul + h2,
.article-content ul + h3,
.article-content ul + h4,
.article-content ol + h2,
.article-content ol + h3,
.article-content ol + h4,
.article-content table + h2,
.article-content table + h3,
.article-content table + h4 {
    margin-top: 18px;
}

/* liste leggibili */
.article-content ul,
.article-content ol {
    margin: 8px 0 10px 22px;
    padding-left: 18px;
}

.article-content li + li {
    margin-top: 4px;
}

/* tabelle compatte e responsive */
.article-content table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 10px 0 14px 0;
    font-size: 14px;
}

.article-content th,
.article-content td {
    border: 1px solid #e5e7eb;
    padding: 6px 8px;
    text-align: left;
}

.article-content th {
    background: #f3f4f6;
    font-weight: 600;
}

/* Link “Torna al Blog” */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #111827;
    margin: 10px 0 8px 0;
}

.back-link::before {
    content: "⭠";
    font-size: 16px;
}

/* ===========================================
   SHARE BUTTONS
   =========================================== */
.share-section {
    margin: 16px 0 20px 0;
}

.share-label {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 6px;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.share-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(209,213,219,0.9);
    box-shadow: 0 6px 16px rgba(15,23,42,0.08);
}

/* ===========================================
   ARTICOLI CORRELATI
   =========================================== */
.related-section {
    margin-top: 24px;
    margin-bottom: 28px;
}

.related-title {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 14px;
}

.related-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.related-card {
    border-radius: 16px;
    padding: 14px 16px;
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(209,213,219,0.8);
    box-shadow: 0 10px 22px rgba(15,23,42,0.08);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.related-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px rgba(15,23,42,0.11);
}

/* ===========================================
   FOOTER BLOG – stile CodFis vetroso
   =========================================== */
.blog-body footer {
    max-width: 880px;
    margin: 28px auto 20px;
    padding: 18px 20px 20px;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
    color: #111827;

    background: radial-gradient(circle at 0% 0%, #ffe5fb 0, #ffd6f5 30%, #ffe9fb 65%, #ffeefe 100%);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(190, 24, 93, 0.18);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.blog-body footer a {
    color: #0b3c7a;
    text-decoration: none;
    font-weight: 500;
}

.blog-body footer a:hover {
    text-decoration: underline;
    opacity: 0.9;
}

.footer-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.footer-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.footer-btn-primary {
    background: #020617;
    color: #ffffff !important;
}

.footer-btn-secondary {
    background: rgba(255,255,255,0.98);
    color: #020617 !important;
    border: 1px solid #020617;
}

.footer-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(15,23,42,0.32);
    opacity: 0.96;
}

.logo-footer-link {
    display: inline-block;
    margin-top: 10px;
}

.logo-footer {
    display: block;
    margin: 6px auto 0;
    height: 36px;
}

/* ===========================================
   URL PER LA STAMPA (nascosta a schermo)
   =========================================== */
.print-url {
    display: none;
}

/* ===========================================
   RESPONSIVE
   =========================================== */
@media (max-width: 480px) {
    .blog-shell {
        padding: 64px 12px 40px 12px;
    }

    .article-title {
        font-size: 21px;
    }

    .article-content {
        padding: 14px 14px 18px 14px;
    }

    .article-page .hero-link {
        max-width: 100%;
    }

    .article-content table {
        font-size: 13px;
    }

    .blog-body footer {
        margin: 24px 12px 16px;
        padding: 16px 14px 18px;
        border-radius: 22px;
    }

    .footer-btn {
        width: 100%;
        max-width: 260px;
    }
}

/* ===========================================
   STAMPA – URL + hero piccola + testo
   =========================================== */
@media print {

    .blog-body {
        background: #ffffff !important;
    }

    /* Nascondo elementi inutili in stampa */
    .blog-home-btn,
    .search-box,
    .search-hint,
    .share-section,
    .related-section,
    footer,
    .back-link {
        display: none !important;
    }

    .blog-shell {
        max-width: 800px;
        margin: 0 auto;
        padding: 16px 20px;
    }

    .print-url {
        display: block;
        font-size: 12px;
        color: #555;
        margin-bottom: 8px;
        word-break: break-all;
    }

    /* HERO PICCOLA, CENTRATA, PROPORZIONATA */
    .hero-wrapper {
        justify-content: center !important;
        margin: 0 0 8px 0 !important;
    }

    .hero-blog {
        max-height: 40px !important;  /* circa 40px di altezza */
        height: auto !important;
        width: auto !important;
        max-width: 100% !important;
        box-shadow: none !important;
        border-radius: 10px !important;
        margin: 0 auto 6px auto !important;
    }

    .article-title {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .article-meta {
        font-size: 12px;
        margin-bottom: 10px;
    }

    .article-content {
        box-shadow: none;
        border: none;
        background: #ffffff;
        padding: 0;
        margin: 0;
        font-size: 14px;
        line-height: 1.6;
    }

    .article-content table {
        font-size: 13px;
    }
}
