/* =========================================================
   i23.eu — Knowledge Garden
   Foglio di stile principale — mobile-first
   Font: Verdana/Arial per il testo, Courier New per il codice
   ========================================================= */

/* -----------------------------------------------------------
   1. VARIABILI
   ----------------------------------------------------------- */
:root {
    /* palette */
    --giallo: #FFCC00;
    --giallo-dark: #8a6d00; /* testo leggibile su fondo giallo */
    --blu: #336699;
    --blu-dark: #1f4a70;
    --granata: #7B1B02;
    --granata-dark: #5a1401;
    --navy: #0B2942; /* header / hero / footer */
    --navy-2: #0F3355;
    /* neutri */
    --testo: #1B2733;
    --testo-mute: #5C6B78;
    --bordo: #E1E6EA;
    --sfondo-chiaro: #F4F6F8;
    --bianco: #FFFFFF;
    /* tipografia */
    --font-testo: Verdana, Arial, Helvetica, sans-serif;
    --font-codice: "Courier New", Courier, monospace;
    /* layout */
    --max-width: 1180px;
    --radius: 8px;
}

/* -----------------------------------------------------------
   2. RESET DI BASE
   ----------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font-testo);
    font-size: 15px;
    line-height: 1.6;
    color: var(--testo);
    background: var(--bianco);
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

button {
    font-family: inherit;
    cursor: pointer;
}

h1, h2, h3, p {
    margin: 0 0 .5em;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

/* piccole utility di colore testo, riusate in più punti */
.t-blu {
    color: var(--blu);
}

.t-granata {
    color: var(--granata);
}

.t-giallo {
    color: var(--giallo);
}

/* -----------------------------------------------------------
   3. HEADER + NAVIGAZIONE (versione scura — home)
   ----------------------------------------------------------- */
.site-header {
    background: var(--navy);
    color: var(--bianco);
}

    .site-header .container {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
    }

.logo {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

    .logo .logo-mark {
        font-size: 22px;
        font-weight: bold;
    }

        .logo .logo-mark span {
            color: var(--giallo);
        }

    .logo .logo-tag {
        font-size: 9px;
        letter-spacing: 1px;
        color: var(--bordo);
        margin-top: 2px;
    }

/* nav: nascosta di default su mobile, si apre con .is-open */
.main-nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--navy-2);
    padding: 16px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
    overflow-y: auto;
}

    .main-nav.is-open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    .main-nav ul {
        display: flex;
        flex-direction: column;
    }

    .main-nav a {
        display: block;
        padding: 12px 4px;
        font-size: 15px;
        font-weight: bold;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }

        .main-nav a.is-active {
            color: var(--giallo);
        }

.nav-toggle {
    background: none;
    border: none;
    color: var(--bianco);
    font-size: 22px;
    line-height: 1;
    padding: 8px;
}

.search-btn {
    background: var(--giallo);
    color: var(--navy);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -----------------------------------------------------------
   4. HERO (home)
   ----------------------------------------------------------- */
.hero {
    /* overlay scuro (stesso gradiente di prima) sopra la tua foto,
     così il testo bianco resta leggibile qualsiasi immagine tu usi.
     Cambia solo il percorso dentro url(...) */
    background-color: var(--navy); /* fallback: si vede finché non aggiungi img/hero-bg.jpg */
    background-image: linear-gradient(180deg, rgba(11,41,66,.88) 0%, rgba(15,51,85,.92) 100%), url("../img/hero-bg.jpg");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    color: var(--bianco);
    padding: 40px 0 56px;
    position: relative;
}

    .hero h1 {
        font-size: 32px;
        font-weight: bold;
        margin-bottom: 12px;
    }

    .hero .hero-underline {
        width: 56px;
        height: 4px;
        background: var(--giallo);
        margin-bottom: 20px;
    }

    .hero p {
        font-size: 15px;
        color: #cfd9e2;
        max-width: 480px;
        margin-bottom: 24px;
    }

        .hero p strong {
            color: var(--giallo);
            font-weight: bold;
        }

.search-form {
    display: flex;
    max-width: 520px;
}

    .search-form input {
        flex: 1;
        min-width: 0;
        border: none;
        padding: 0 16px;
        height: 48px;
        font-family: var(--font-testo);
        font-size: 14px;
        border-radius: var(--radius) 0 0 var(--radius);
    }

    .search-form button {
        border: none;
        background: var(--giallo);
        color: var(--navy);
        font-weight: bold;
        font-size: 13px;
        letter-spacing: .5px;
        padding: 0 20px;
        border-radius: 0 var(--radius) var(--radius) 0;
    }

/* striscia diagonale tricolore a chiusura hero */
.hero-stripe {
    height: 6px;
    background: linear-gradient(90deg, var(--blu) 0%, var(--blu) 33%, var(--giallo) 33%, var(--giallo) 66%, var(--granata) 66%, var(--granata) 100%);
}

/* -----------------------------------------------------------
   5. SEZIONI GENERICHE (titoli di sezione)
   ----------------------------------------------------------- */
.section {
    padding: 40px 0;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title {
    font-size: 22px;
    font-weight: bold;
    border-bottom: 3px solid var(--giallo);
    padding-bottom: 6px;
    display: inline-block;
}

.section-link {
    font-size: 13px;
    font-weight: bold;
    color: var(--blu);
    white-space: nowrap;
}

/* -----------------------------------------------------------
   6. CARD "ULTIMI AGGIORNAMENTI"
   ----------------------------------------------------------- */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.post-card {
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bianco);
}

    .post-card .thumb {
        height: 130px;
        background: var(--sfondo-chiaro);
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--testo-mute);
        font-size: 13px;
    }

    .post-card .body {
        padding: 14px 16px;
    }

    .post-card .cat {
        display: block;
        font-size: 11px;
        font-weight: bold;
        letter-spacing: .5px;
        margin-bottom: 6px;
    }

        .post-card .cat.cat-db,
        .post-card .cat.cat-kg {
            color: var(--granata);
        }

        .post-card .cat.cat-dev,
        .post-card .cat.cat-net {
            color: var(--blu);
        }

    .post-card h3 {
        font-size: 15px;
        font-weight: bold;
        margin-bottom: 6px;
    }

    .post-card p {
        font-size: 13px;
        color: var(--testo-mute);
        margin-bottom: 10px;
    }

    .post-card .meta {
        display: flex;
        gap: 14px;
        font-size: 11px;
        color: var(--testo-mute);
    }

/* -----------------------------------------------------------
   7. CATEGORIE PRINCIPALI
   ----------------------------------------------------------- */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.cat-box {
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    padding: 20px 8px;
    text-align: center;
    border-bottom: 4px solid var(--blu);
}

    .cat-box.c-db {
        border-bottom-color: var(--granata);
    }

    .cat-box.c-net {
        border-bottom-color: var(--giallo);
    }

    .cat-box.c-hw {
        border-bottom-color: var(--granata);
    }

    .cat-box.c-kg {
        border-bottom-color: var(--blu);
    }

    .cat-box.c-me {
        border-bottom-color: var(--giallo);
    }

    .cat-box .icon {
        font-size: 26px;
        margin-bottom: 10px;
    }

    .cat-box .label {
        font-size: 13px;
        font-weight: bold;
    }

/* -----------------------------------------------------------
   8. BLOCCO "IL MIO KNOWLEDGE GARDEN"
   ----------------------------------------------------------- */
.about-band {
    background: var(--sfondo-chiaro);
    border-radius: var(--radius);
    padding: 24px 20px;
}

    .about-band .avatar {
        width: 72px;
        height: 72px;
        border-radius: 50%;
        background: var(--bordo);
        margin-bottom: 16px;
    }

    .about-band h3 {
        font-size: 18px;
        font-weight: bold;
        border-bottom: 3px solid var(--giallo);
        display: inline-block;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }

    .about-band p {
        font-size: 13.5px;
        color: var(--testo-mute);
    }

    .about-band .about-link {
        color: var(--blu);
        font-weight: bold;
        font-size: 13px;
    }

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 18px;
}

.stat-card {
    background: var(--bianco);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    padding: 14px 8px;
    text-align: center;
}

    .stat-card .num {
        font-size: 20px;
        font-weight: bold;
    }

        .stat-card .num.n-blu {
            color: var(--blu);
        }

        .stat-card .num.n-granata {
            color: var(--granata);
        }

        .stat-card .num.n-giallo {
            color: var(--giallo-dark);
        }

    .stat-card .lbl {
        font-size: 11px;
        color: var(--testo-mute);
    }

/* -----------------------------------------------------------
   9. FOOTER
   ----------------------------------------------------------- */
.site-footer {
    background: var(--navy);
    color: #cfd9e2;
    padding: 32px 0 0;
    margin-top: 20px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 24px;
}

.footer-col h4 {
    color: var(--giallo);
    font-size: 12px;
    letter-spacing: .5px;
    margin-bottom: 12px;
}

.footer-col a {
    display: block;
    font-size: 13px;
    color: #cfd9e2;
    padding: 4px 0;
}

.footer-brand .logo-mark {
    font-size: 22px;
    font-weight: bold;
    color: var(--bianco);
}

    .footer-brand .logo-mark span {
        color: var(--giallo);
    }

.footer-brand p {
    font-style: italic;
    font-size: 12.5px;
    color: #9fb0be;
    margin-top: 10px;
}

.social-row {
    display: flex;
    gap: 10px;
    margin-top: 4px;
}

    .social-row a {
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid #37536b;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 13px;
    }

.footer-bottom {
    border-top: 1px solid #1c3a54;
    padding: 14px 0;
    font-size: 11.5px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .footer-bottom .footer-links a {
        margin-right: 12px;
    }

.site-footer .footer-bottom a {
    color: #9fb0be;
}

.footer-stripe {
    height: 4px;
    background: linear-gradient(90deg, var(--blu) 33%, var(--giallo) 33% 66%, var(--granata) 66%);
}

/* =============================================================
   10. PAGINA SCHEDA (dettaglio guida)
   ============================================================= */

/* header chiaro per le pagine di contenuto */
.page-header {
    background: var(--bianco);
    border-bottom: 1px solid var(--bordo);
}

    .page-header .container {
        height: 56px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .page-header .logo-mark {
        color: var(--testo);
        font-size: 20px;
        font-weight: bold;
    }

        .page-header .logo-mark span {
            color: var(--giallo);
            -webkit-text-stroke: .5px var(--testo);
        }

    .page-header .nav-toggle {
        color: var(--testo);
    }

.breadcrumb {
    font-size: 12px;
    color: var(--testo-mute);
    padding: 20px 0 0;
}

    .breadcrumb a {
        color: var(--blu);
    }

    .breadcrumb .sep {
        margin: 0 4px;
    }

.article-head {
    padding: 10px 0 20px;
}

    .article-head h1 {
        font-size: 22px;
        font-weight: bold;
        margin-bottom: 14px;
    }

.article-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 18px;
}

.btn-outline {
    border: 1px solid var(--bordo);
    background: var(--bianco);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: bold;
    color: var(--testo);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .btn-outline.export {
        color: var(--granata);
        border-color: #f1cfc7;
    }

.abstract-label {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: .5px;
    color: var(--granata);
    margin-bottom: 6px;
}

.article-head .abstract-text {
    font-size: 14px;
    color: var(--testo);
    margin-bottom: 16px;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.tag {
    font-size: 11.5px;
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 4px;
}

    .tag.tag-blu {
        background: var(--blu);
        color: var(--bianco);
    }

    .tag.tag-giallo {
        background: var(--giallo);
        color: var(--giallo-dark);
    }

    .tag.tag-neutro {
        background: var(--sfondo-chiaro);
        color: var(--testo-mute);
    }

.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 12px;
    color: var(--testo-mute);
    border-bottom: 1px solid var(--bordo);
    padding-bottom: 16px;
}

.article-body h2 {
    font-size: 17px;
    font-weight: bold;
    margin-top: 26px;
    margin-bottom: 10px;
}

.article-body p {
    font-size: 14px;
}

/* -----------------------------------------------------------
   11. BLOCCHI DI CODICE — Courier New, specificità esplicita
   per evitare che regole globali (p, pre, a...) le sovrascrivano
   ----------------------------------------------------------- */
.code-block {
    position: relative;
    background: var(--sfondo-chiaro);
    border: 1px solid var(--bordo);
    border-radius: var(--radius);
    margin: 14px 0;
    overflow-x: auto;
}

    .code-block pre.code-pre {
        margin: 0;
        padding: 14px 16px;
        font-family: var(--font-codice) !important;
        font-size: 12.5px;
        line-height: 1.7;
        white-space: pre;
        color: var(--testo);
    }

    .code-block .code-line {
        display: block;
    }

    .code-block .ln {
        display: inline-block;
        width: 22px;
        color: #9aa7b2;
        user-select: none;
    }

    .code-block .kw {
        color: var(--blu);
        font-weight: bold;
    }

    .code-block .str {
        color: var(--granata);
    }

    .code-block .cmt {
        color: #5a8a5a;
        font-style: italic;
    }

.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid var(--bordo);
    background: var(--bianco);
    border-radius: 4px;
    font-size: 11px;
    padding: 4px 8px;
    color: var(--testo-mute);
}

.callout {
    background: #FFF8DE;
    border: 1px solid #F0DFA0;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 20px 0;
    display: flex;
    gap: 10px;
}

    .callout .callout-icon {
        font-size: 16px;
    }

    .callout h4 {
        font-size: 13.5px;
        font-weight: bold;
        margin-bottom: 4px;
    }

    .callout p {
        font-size: 13px;
        color: #6b5a1f;
        margin: 0;
    }

.resources {
    margin-top: 24px;
}

    .resources h4 {
        font-size: 14px;
        font-weight: bold;
        margin-bottom: 10px;
    }

    .resources li {
        margin-bottom: 8px;
    }

    .resources a {
        color: var(--blu);
        font-size: 13.5px;
        text-decoration: underline;
    }

.article-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--bordo);
    margin-top: 28px;
    padding: 16px 0;
    font-size: 13px;
    font-weight: bold;
}

    .article-nav a {
        color: var(--testo);
    }

    .article-nav .next {
        text-align: right;
    }

.page-footer {
    background: var(--navy);
    color: #cfd9e2;
}

    .page-footer .footer-bottom {
        border-top-color: #1c3a54;
    }

        .page-footer .footer-bottom a {
            color: #9fb0be;
        }

.back-to-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--granata);
    color: var(--bianco);
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}

/* =============================================================
   12. BREAKPOINT — TABLET (>= 768px)
   ============================================================= */
@media (min-width: 768px) {
    .nav-toggle {
        display: none;
    }

    .main-nav {
        position: static;
        background: none;
        padding: 0;
        opacity: 1;
        transform: none;
        pointer-events: auto;
        overflow: visible;
    }

        .main-nav ul {
            flex-direction: row;
            gap: 22px;
        }

        .main-nav a {
            border-bottom: none;
            padding: 0;
            font-size: 13px;
        }

            .main-nav a.is-active {
                border-bottom: 2px solid var(--giallo);
                padding-bottom: 4px;
            }

    .hero h1 {
        font-size: 40px;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .cat-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .about-band {
        display: flex;
        align-items: center;
        gap: 24px;
    }

        .about-band .avatar {
            margin-bottom: 0;
        }

        .about-band .text {
            flex: 1;
        }

    .stat-row {
        margin-top: 0;
        width: 260px;
        flex-shrink: 0;
    }

    .footer-grid {
        grid-template-columns: 1.3fr 1fr 1fr 1fr;
    }

    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}

/* =============================================================
   13. BREAKPOINT — DESKTOP (>= 1024px)
   ============================================================= */
@media (min-width: 1024px) {
    body {
        font-size: 16px;
    }

    .card-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .cat-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .hero h1 {
        font-size: 46px;
    }

    .article-head h1 {
        font-size: 26px;
    }
}
