/* =========================================
   STILE PAGINA ARTICOLO SINGOLO (COMPLETO)
   ========================================= */

/* Contenitore che centra l'articolo */
.articolo-full {
    background-color: #ffffff;
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(74, 64, 54, 0.06);
    
    /* Centra l'articolo nella pagina */
    max-width: 800px; 
    margin: 0 auto; 
    width: 100%;
    box-sizing: border-box; /* FIX: il padding non sfora la larghezza */
}

/* Immagine grande arrotondata */
.img-copertina {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 20px;
    margin-bottom: 30px;
}

/* Data piccola sopra il titolo */
.data-pubblicazione {
    color: var(--colore-principale);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: block;
    margin-bottom: 10px;
}

/* Titolo Grande H1 */
.articolo-full h1 {
    color: var(--text-color);
    font-size: 2.5rem;
    margin: 0 0 30px 0;
    line-height: 1.2;
}

/* --- TIPOGRAFIA BASE --- */
.contenuto-testo {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #444;
}

/* Paragrafi */
.contenuto-testo p {
    margin-bottom: 25px;
}

/* Sottotitoli H2 */
.contenuto-testo h2 {
    color: var(--text-color);
    margin-top: 50px;
    margin-bottom: 15px;
    font-size: 1.8rem;
    font-weight: 700;
}

/* Sottotitoli H3 */
.contenuto-testo h3 {
    color: var(--text-color);
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 1.4rem;
    font-weight: 600;
}

/* --- STILI SPECIALI (Code, Link, Liste) --- */

/* 1. Codice Inline */
.contenuto-testo code {
    background-color: #F0E6D8;
    color: #c7254e;
    padding: 3px 6px;
    border-radius: 6px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
}

/* 2. Blocco di Codice */
.contenuto-testo pre {
    background-color: #282c34;
    color: #abb2bf;
    padding: 20px;
    border-radius: 12px;
    overflow-x: auto;
    margin: 25px 0;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}

.contenuto-testo pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.95rem;
}

/* 3. Link nel testo */
.contenuto-testo a {
    color: var(--colore-principale);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: all 0.2s;
}

.contenuto-testo a:hover {
    background-color: rgba(193, 154, 107, 0.1);
    color: #b08d55;
    text-decoration: none;
}

/* 4. Liste */
.contenuto-testo ul, .contenuto-testo ol {
    margin-bottom: 25px;
    padding-left: 20px;
}

.contenuto-testo li {
    margin-bottom: 10px;
    padding-left: 10px;
}

.contenuto-testo ul li::marker {
    color: var(--colore-principale);
    font-size: 1.2em;
}

/* 5. Grassetto e Corsivo */
.contenuto-testo strong {
    color: var(--text-color);
    font-weight: 700;
}

.contenuto-testo em {
    color: var(--text-color);
    font-style: italic;
}

/* 6. Linea Orizzontale */
.contenuto-testo hr {
    border: 0;
    height: 2px;
    background-image: linear-gradient(to right, rgba(0, 0, 0, 0), var(--colore-bordo), rgba(0, 0, 0, 0));
    margin: 40px 0;
}

/* 7. Citazioni */
.contenuto-testo blockquote {
    background-color: #F9F7F2;
    border-left: 5px solid var(--colore-principale);
    padding: 20px 25px;
    margin: 30px 0;
    border-radius: 0 12px 12px 0;
    font-style: italic;
    font-size: 1.2rem;
    color: var(--text-color);
    position: relative;
}

/* --- BOTTONE TORNA INDIETRO --- */
.btn-torna-indietro {
    display: inline-block;
    margin-top: 50px;
    padding: 12px 30px;
    background-color: var(--text-color);
    color: #fff;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: 0.3s;
}

.btn-torna-indietro:hover {
    background-color: var(--colore-principale);
    transform: translateX(-5px);
    box-shadow: 0 5px 15px rgba(193, 154, 107, 0.3);
}

/* --- TASTI TASTIERA --- */
.contenuto-testo kbd {
    background-color: #ffffff;
    border: 1px solid #d1d5db;
    border-bottom: 3px solid #d1d5db;
    border-radius: 6px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.9em;
    color: #374151;
    box-shadow: 0 1px 1px rgba(0,0,0,0.1);
    display: inline-block;
    margin: 0 2px;
}

/* --- BOX NOTA / SUGGERIMENTO --- */
.contenuto-testo .callout {
    background-color: #FFF8E1;
    border-left: 5px solid #FFC107;
    padding: 15px 20px;
    margin: 25px 0;
    border-radius: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-sizing: border-box; /* FIX: evita overflow su mobile */
}

.callout-icon {
    font-size: 1.2rem;
}

/* --- IMMAGINI CON DIDASCALIA --- */
.contenuto-testo figure {
    margin: 30px 0;
    text-align: center;
}

.contenuto-testo figure img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    display: block;
    margin: 0 auto;
}

.contenuto-testo figcaption {
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- TABELLE PULITE --- */
.contenuto-testo table {
    width: 100%;
    border-collapse: collapse;
    margin: 25px 0;
    font-size: 0.95rem;
    border-radius: 8px;
    overflow: hidden;
}

.contenuto-testo th, 
.contenuto-testo td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--colore-bordo);
}

.contenuto-testo th {
    background-color: #F9F7F2;
    color: var(--text-color);
    font-weight: 700;
}

.contenuto-testo tr:hover {
    background-color: #fafafa;
}

/* --- MIGLIORAMENTO CORSIVO --- */
.contenuto-testo em, 
.contenuto-testo i {
    font-style: italic;
    font-weight: 500;
    color: var(--text-muted);
}

/* =========================================
   STILE INDICE (TOC)
   ========================================= */

.toc-container {
    background-color: #F9F7F2;
    border: 1px solid var(--colore-bordo);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 40px;
    box-sizing: border-box; /* FIX: evita overflow su mobile */
}

.toc-container h4 {
    margin: 0 0 15px 0;
    color: var(--text-color);
    font-size: 1.1rem;
    border-bottom: 2px solid var(--colore-bordo);
    padding-bottom: 10px;
}

#toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#toc-list li {
    margin-bottom: 8px;
}

#toc-list a {
    display: block;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

#toc-list a:hover {
    background-color: rgba(193, 154, 107, 0.1);
    color: var(--text-color);
    padding-left: 12px;
}

.toc-h3 a {
    padding-left: 25px;
    font-size: 0.9rem;
    opacity: 0.85;
}

.toc-h3 a:hover {
    padding-left: 30px;
}

.no-index-msg {
    color: var(--text-muted);
    font-style: italic;
    padding: 10px;
    text-align: center;
    border: 1px dashed var(--colore-bordo);
    border-radius: 8px;
    background-color: rgba(0,0,0,0.02);
}

/* =========================================
   SPAZIO AUTORE
   ========================================= */

.author-space {
    background-color: #FFF8E1;
    border-left: 5px solid #C19A6B;
    border-radius: 0 12px 12px 0;
    padding: 20px 25px;
    margin: 30px 0;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    color: #5D4037;
    position: relative;
    box-sizing: border-box; /* FIX: evita overflow su mobile */
}

.author-icon {
    font-size: 1.5rem;
    background-color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(193, 154, 107, 0.2);
    flex-shrink: 0;
}

.author-space h4 {
    margin: 0 0 5px 0;
    color: #C19A6B;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.author-space p {
    margin: 0;
    font-style: italic;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* =========================================
   SEZIONE COMMENTI (GISCUS)
   ========================================= */

.comments-section {
    background-color: #F9F7F2;
    border: 1px solid #E8E2D9;
    border-radius: 24px;
    padding: 40px;
    margin-top: 60px;
    box-shadow: 0 10px 30px rgba(74, 64, 54, 0.05);

    /* FIX: centra la sezione come l'articolo */
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

.comments-section h3 {
    text-align: center;
    margin: 0 0 30px 0;
    color: var(--colore-principale);
    font-size: 2rem;
}

/* Giscus customizations */
.gsc-header {
    border-bottom: 1px solid var(--colore-bordo) !important;
    padding-bottom: 15px !important;
    background-color: transparent !important;
}

.gsc-header .gsc-header-title {
    color: var(--text-color) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
}

.gsc-input-box {
    background-color: #ffffff !important;
    border: 2px solid var(--colore-bordo) !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02) !important;
    transition: border-color 0.3s ease !important;
}

.gsc-input-box:focus-within {
    border-color: var(--colore-principale) !important;
    background-color: #fff !important;
}

.gsc-button {
    border-radius: 50px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
}

.gsc-submit {
    background-color: var(--text-color) !important;
    color: #fff !important;
}

.gsc-submit:hover {
    background-color: var(--colore-principale) !important;
    transform: translateY(-2px) !important;
}

.gsc-cancel {
    background-color: transparent !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--colore-bordo) !important;
}

.gsc-cancel:hover {
    background-color: #f0e6d8 !important;
}

.gsc-comment-content p {
    color: #555 !important;
    font-family: var(--font-family) !important;
}

.gsc-reactions {
    border-bottom: 1px solid var(--colore-bordo) !important;
    padding-bottom: 15px !important;
    margin-bottom: 20px !important;
}

.gsc-reaction:hover {
    background-color: rgba(193, 154, 107, 0.05) !important;
}

/* =========================================
   RESPONSIVE PER PAGINA ARTICOLO
   ========================================= */

@media (max-width: 900px) {
    .img-copertina {
        height: auto;
        max-height: 60vh;
    }

    .articolo-full {
        padding: 30px;
        margin: 20px auto;
        max-width: calc(100% - 40px);
        box-sizing: border-box; /* FIX PRINCIPALE */
    }

    .comments-section {
        margin-top: 30px;
        margin-left: 20px;
        margin-right: 20px;
        max-width: calc(100% - 40px);
        box-sizing: border-box; /* FIX PRINCIPALE */
    }

    .articolo-full h1 {
        font-size: 2rem;
    }

    .contenuto-testo {
        font-size: 1rem;
        line-height: 1.7;
    }
}

@media (max-width: 600px) {
    .img-copertina {
        height: auto;
        max-height: 45vh;
        border-radius: 12px;
        margin-bottom: 20px;
    }

    .articolo-full {
        padding: 20px;
        border-radius: 16px;
        margin: 10px auto;
        max-width: calc(100% - 24px);
        box-sizing: border-box; /* FIX PRINCIPALE */
    }

    .comments-section {
        padding: 25px 20px;
        margin-left: 12px;
        margin-right: 12px;
        max-width: calc(100% - 24px);
        box-sizing: border-box; /* FIX PRINCIPALE */
        border-radius: 16px;
    }

    .articolo-full h1 {
        font-size: 1.6rem;
    }

    .contenuto-testo {
        font-size: 0.98rem;
        line-height: 1.6;
    }

    .author-space {
        flex-direction: column; /* Impila icona e testo su schermi stretti */
        gap: 10px;
    }

    .contenuto-testo blockquote {
        padding: 15px 18px;
        font-size: 1.05rem;
    }
}
