/* ================================================================
   Blog Juster — blog.css
   Dipende da: Porto theme.css, Bootstrap, FontAwesome
   ================================================================ */

/* ── Variabili ────────────────────────────────────────────────── */
:root {
    --blog-primary: var(--color-primary, #1565c0);
    --blog-dark: #1a2744;
    --blog-grey: #6b7280;
    --blog-light: #f8fafc;
    --blog-border: #e5e7eb;
}

/* ── Blog Hero (pagina listing) ───────────────────────────────── */
.blog-hero {
    position: relative;
    overflow: hidden;
    min-height: 400px;
    display: flex;
    align-items: flex-end;
    color: #fff;
    background: #0a1628;
}
.blog-hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.28;
    display: block;
}
.blog-hero-overlay {
    position: relative;
    z-index: 1;
    width: 100%;
    padding: 100px 0 64px;
    background: linear-gradient(
        0deg,
        rgba(10, 22, 40, 0.96) 0%,
        rgba(10, 22, 40, 0.65) 50%,
        rgba(10, 22, 40, 0.18) 100%
    );
}
.blog-hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
}
.blog-hero p {
    font-size: 1.1rem;
    color: #fff;
    opacity: 0.88;
    max-width: 560px;
    line-height: 1.65;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}
@media (max-width: 768px) {
    .blog-hero {
        min-height: 260px;
    }
    .blog-hero-overlay {
        padding: 72px 0 40px;
    }
    .blog-hero h1 {
        font-size: 1.9rem;
    }
}

/* ── Breadcrumb ────────────────────────────────────────────────── */
.blog-breadcrumb {
    background: #f0f4f8;
    border-bottom: 1px solid var(--blog-border);
    padding: 12px 0;
}
.blog-breadcrumb .breadcrumb {
    margin: 0;
    font-size: 0.85rem;
}
.blog-breadcrumb .breadcrumb-item a {
    color: var(--blog-primary);
    text-decoration: none;
}
.blog-breadcrumb .breadcrumb-item a:hover {
    text-decoration: underline;
}
.blog-breadcrumb .breadcrumb-item.active {
    color: var(--blog-grey);
}
.blog-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    color: #9ca3af;
}

/* ── Badge categoria ───────────────────────────────────────────── */
.blog-category {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--blog-primary);
    background: rgba(21, 101, 192, 0.09);
    padding: 4px 11px;
    border-radius: 20px;
    margin-bottom: 10px;
    text-decoration: none;
}
.blog-category:hover {
    background: rgba(21, 101, 192, 0.16);
    color: var(--blog-primary);
}
.blog-category.cat-white {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

/* ── Blog List Item (card orizzontale — pagina listing) ────────── */
.blog-list-item {
    border-bottom: 1px solid var(--blog-border);
    padding: 40px 0;
    transition: background 0.2s;
}
.blog-list-item:first-child {
    padding-top: 0;
}
.blog-list-item:last-child {
    border-bottom: none;
}

.blog-list-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    background: linear-gradient(135deg, #0c2a4a, #1565c0);
}
.blog-list-thumb-wrap {
    border-radius: 10px;
    overflow: hidden;
    display: block;
}
.blog-list-thumb-wrap:hover .blog-list-thumb {
    transform: scale(1.03);
    transition: transform 0.4s ease;
}

.blog-list-item h2 {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 12px;
}
.blog-list-item h2 a {
    color: var(--blog-dark);
    text-decoration: none;
    transition: color 0.2s;
}
.blog-list-item h2 a:hover {
    color: var(--blog-primary);
}

.blog-excerpt {
    color: #4b5563;
    font-size: 0.95rem;
    line-height: 1.68;
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-meta {
    font-size: 0.8rem;
    color: #9ca3af;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}
.blog-meta .dot {
    color: #d1d5db;
}

/* Pulsante "Leggi tutto" */
.btn-blog-read {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--blog-primary);
    text-decoration: none;
    padding: 0;
    border-bottom: 2px solid transparent;
    transition:
        border-color 0.2s,
        gap 0.2s;
}
.btn-blog-read:hover {
    color: var(--blog-primary);
    border-bottom-color: var(--blog-primary);
    gap: 10px;
}

/* ── Card verticale (homepage spotlight) ───────────────────────── */
.blog-card {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    height: 100%;
    transition:
        transform 0.28s,
        box-shadow 0.28s;
    display: flex;
    flex-direction: column;
    background: #fff;
}
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.13);
}
.blog-card-img-wrap {
    overflow: hidden;
    aspect-ratio: 16 / 9;
    display: block;
}
.blog-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s;
    background: linear-gradient(135deg, #0c2a4a, #1565c0);
}
.blog-card:hover .blog-card-img {
    transform: scale(1.04);
}

.blog-card-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.blog-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--blog-dark);
    margin-bottom: 10px;
    text-decoration: none;
    display: block;
}
.blog-card-title:hover {
    color: var(--blog-primary);
}

.blog-card-excerpt {
    font-size: 0.875rem;
    color: var(--blog-grey);
    line-height: 1.65;
    flex: 1;
    margin-bottom: 18px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.blog-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 16px;
    border-top: 1px solid #f3f4f6;
    margin-top: auto;
}
.blog-card-date {
    font-size: 0.78rem;
    color: #9ca3af;
}

/* ── Featured card (homepage — 1a uscita) ─────────────────────── */
.blog-featured-card {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.11);
    background: #fff;
    transition:
        transform 0.28s,
        box-shadow 0.28s;
}
.blog-featured-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.16);
}
.blog-featured-img-wrap {
    overflow: hidden;
    height: 320px;
}
.blog-featured-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s;
}
.blog-featured-card:hover .blog-featured-img {
    transform: scale(1.03);
}
.blog-featured-body {
    padding: 32px 36px 36px;
}
.blog-featured-title {
    font-size: 1.55rem;
    font-weight: 800;
    color: var(--blog-dark);
    margin-bottom: 12px;
    line-height: 1.3;
    text-decoration: none;
    display: block;
}
.blog-featured-title:hover {
    color: var(--blog-primary);
}
.blog-featured-excerpt {
    color: #4b5563;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 24px;
}
@media (max-width: 768px) {
    .blog-featured-img-wrap {
        height: 220px;
    }
    .blog-featured-body {
        padding: 24px;
    }
    .blog-featured-title {
        font-size: 1.25rem;
    }
}

/* ── Paginazione ──────────────────────────────────────────────── */
.blog-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 48px 0 8px;
    flex-wrap: wrap;
}
.blog-pagination a,
.blog-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--blog-border);
    color: #374151;
    padding: 0 8px;
    transition: all 0.2s;
}
.blog-pagination a:hover {
    background: var(--blog-primary);
    border-color: var(--blog-primary);
    color: #fff;
}
.blog-pagination .active {
    background: var(--blog-primary);
    border-color: var(--blog-primary);
    color: #fff;
}
.blog-pagination .disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ── Post hero (singola pagina post) ─────────────────────────── */
.post-hero {
    position: relative;
    height: 440px;
    overflow: hidden;
    background: linear-gradient(135deg, #0a1628, #1565c0);
}
.post-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.45;
}
.post-hero-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 56px;
    background: linear-gradient(
        0deg,
        rgba(10, 22, 40, 0.9) 0%,
        rgba(10, 22, 40, 0.4) 55%,
        transparent 100%
    );
    color: #fff;
}
@media (max-width: 768px) {
    .post-hero {
        height: 300px;
    }
    .post-hero-overlay {
        padding: 28px 20px;
    }
}
.post-hero-category {
    margin-bottom: 14px;
}
.post-hero-title {
    font-size: 2.3rem;
    font-weight: 800;
    line-height: 1.22;
    max-width: 820px;
    margin-bottom: 14px;
    color: #fff;
}
@media (max-width: 768px) {
    .post-hero-title {
        font-size: 1.5rem;
    }
}
.post-hero-meta {
    font-size: 0.875rem;
    opacity: 0.78;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* ── Corpo del post ───────────────────────────────────────────── */
.post-body-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 24px 40px;
    font-size: 1.05rem;
    color: #374151;
    line-height: 1.82;
}
.post-body-wrap h2 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--blog-dark);
    margin: 52px 0 18px;
    padding-top: 8px;
    border-top: 3px solid #e5e7eb;
}
.post-body-wrap h2:first-of-type {
    border-top: none;
}
.post-body-wrap h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--blog-dark);
    margin: 32px 0 12px;
}
.post-body-wrap p {
    margin-bottom: 20px;
}
.post-body-wrap ul,
.post-body-wrap ol {
    margin-bottom: 22px;
    padding-left: 26px;
}
.post-body-wrap li {
    margin-bottom: 9px;
    line-height: 1.72;
}
.post-body-wrap strong {
    color: var(--blog-dark);
    font-weight: 700;
}
.post-body-wrap a {
    color: var(--blog-primary);
}
.post-body-wrap a:hover {
    text-decoration: underline;
}

/* Tabelle nel post */
.post-body-wrap table {
    width: 100%;
    border-collapse: collapse;
    margin: 28px 0;
    font-size: 0.92rem;
}
.post-body-wrap th {
    background: var(--blog-dark);
    color: #fff;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
}
.post-body-wrap td {
    padding: 11px 16px;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: top;
}
.post-body-wrap tr:nth-child(even) td {
    background: #f8fafc;
}
@media (max-width: 640px) {
    .post-body-wrap {
        overflow-x: auto;
    }
    .post-body-wrap table {
        min-width: 520px;
    }
}

/* Box evidenziato */
.post-highlight {
    background: #e8f4fd;
    border-left: 4px solid var(--blog-primary, #1565c0);
    border-radius: 0 10px 10px 0;
    padding: 20px 24px;
    margin: 32px 0;
    font-size: 1rem;
    color: #1e3a5f;
    font-weight: 500;
    line-height: 1.65;
}

/* Lista checkmark */
.post-check-list {
    list-style: none;
    padding: 0;
    margin-bottom: 22px;
}
.post-check-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 11px;
    line-height: 1.65;
}
.post-check-list li::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    min-width: 20px;
    background: var(--blog-primary, #1565c0)
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1' stroke='white' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
        center / 11px no-repeat;
    border-radius: 50%;
    margin-top: 3px;
}

/* TOC */
.post-toc {
    background: #f8fafc;
    border: 1px solid var(--blog-border);
    border-radius: 12px;
    padding: 22px 26px;
    margin-bottom: 44px;
}
.post-toc-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: #9ca3af;
    margin-bottom: 14px;
}
.post-toc ol {
    margin: 0;
    padding-left: 20px;
}
.post-toc li {
    margin-bottom: 8px;
}
.post-toc a {
    color: #374151;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}
.post-toc a:hover {
    color: var(--blog-primary);
}

/* ── Author box ───────────────────────────────────────────────── */
.post-author {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 26px 28px;
    background: #f8fafc;
    border-radius: 14px;
    margin: 44px 0 36px;
}
.post-author-avatar {
    width: 60px;
    height: 60px;
    min-width: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1565c0, #0d47a1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
}
.post-author-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--blog-dark);
}
.post-author-info p {
    font-size: 0.85rem;
    color: var(--blog-grey);
    margin: 0;
    line-height: 1.5;
}

/* ── CTA box nel post ─────────────────────────────────────────── */
.post-cta {
    background: linear-gradient(135deg, #0a1628 0%, #1565c0 100%);
    border-radius: 18px;
    padding: 52px 44px;
    text-align: center;
    color: #fff;
    margin: 52px 0;
}
.post-cta h3 {
    font-size: 1.9rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 14px;
    line-height: 1.25;
}
.post-cta p {
    color: #fff;
    opacity: 0.85;
    margin-bottom: 30px;
    font-size: 1rem;
}
@media (max-width: 576px) {
    .post-cta {
        padding: 36px 24px;
    }
    .post-cta h3 {
        font-size: 1.45rem;
    }
}

/* ── Related posts ────────────────────────────────────────────── */
.post-related {
    background: #f0f4f8;
    padding: 60px 0;
}
.post-related h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--blog-dark);
    margin-bottom: 32px;
}

/* ── Progress bar lettura ─────────────────────────────────────── */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, #1565c0, #38bdf8);
    z-index: 9999;
    transition: width 0.08s linear;
}

/* ── Sezione Blog in homepage ─────────────────────────────────── */
#blog-preview {
    background: #f0f4f8;
}
