/* ================================================================
   BRAND.CSS — componenti condivisi delle pagine "vetrina"
   Usato da: index.html (homepage) + pagine menu dei corsi
   (fdp.html, Basi_dati.html, menu_algoritmi.html).
   Richiede style.css (design token in :root). Le pagine di
   contenuto NON caricano questo file.
================================================================= */

body.page-home {
    font-family: var(--font-sans);
    color: var(--ink-soft);
    background: var(--paper);
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body.page-home main { flex: 1 0 auto; width: 100%; }
body.page-home main section { width: 100%; }

/* Filo di accento in cima ad ogni pagina */
body.page-home::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand-600), var(--green));
    z-index: 1000;
}

/* ================================================================
   SFONDO DECORATIVO (statico: griglia di punti + due aloni)
================================================================= */
.bg-decor {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 820px;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
    background:
        radial-gradient(620px 420px at 10% -4%, rgba(47, 143, 209, .20), transparent 70%),
        radial-gradient(540px 380px at 94% 10%, rgba(34, 197, 94, .13), transparent 70%);
}
.bg-decor::before {
    content: none;
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(0, 61, 107, .14) 1px, transparent 1.3px);
    background-size: 24px 24px;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
            mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
}
body.page-home > .site-nav,
body.page-home > main,
body.page-home > .site-footer { position: relative; z-index: 1; }

/* ================================================================
   BARRA DI NAVIGAZIONE
================================================================= */
body.page-home > .site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(244, 246, 249, .75);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
            backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, .06);
}
.site-nav-inner {
    max-width: 1120px;
    height: 64px;
    margin: 0 auto;
    padding: 0 1.5em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1em;
}
.nav-brand {
    display: inline-flex;
    align-items: center;
    gap: .6em;
    font-size: 1.08rem;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--brand-700);
    text-decoration: none;
}
.nav-brand img {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    box-shadow: 0 2px 8px rgba(0, 61, 107, .2);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: .2em;
}
.nav-links a {
    font-size: .9rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    padding: .45em .9em;
    border-radius: 999px;
    transition: color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.nav-links a:hover {
    color: var(--brand-700);
    background: rgba(0, 90, 156, .07);
}
/* la guida al PC: la voce che porta ai link di affiliazione, messa in evidenza */
.nav-links a.nav-guide {
    color: var(--brand-600);
    font-weight: 600;
    background: rgba(0, 90, 156, .08);
}
.nav-links a.nav-guide:hover { color: #ffffff; background: var(--brand-600); }
.nav-links a[aria-current="page"] {
    color: var(--brand-700);
    font-weight: 600;
    background: var(--paper-0);
    box-shadow: var(--shadow-sm);
}

/* ================================================================
   REVEAL ON SCROLL (progressive enhancement)
   Senza JS o con prefers-reduced-motion: contenuto visibile subito.
================================================================= */
html.js [data-reveal] {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity .6s ease, transform .6s ease;
    transition-delay: var(--delay, 0s);
}
html.js [data-reveal].in-view {
    opacity: 1;
    transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
    html.js [data-reveal] {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* ================================================================
   COMPONENTI CONDIVISI
================================================================= */

/* Etichetta sopra i titoli: piccola, sobria, nel colore del marchio */
.eyebrow {
    display: inline-block;
    font-size: .88rem;
    font-weight: 600;
    letter-spacing: -.005em;
    color: var(--brand-600);
}
.section-eyebrow {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--brand-600);
    margin-bottom: .6em;
}

.section-heading { max-width: 640px; margin-bottom: 2.4em; }
.section-heading.centered { text-align: center; margin: 0 auto 2.6em; }
body.page-home .section-heading h2 {
    font-size: clamp(1.7rem, 3.2vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -.03em;
    color: var(--ink);
    margin: 0 0 .45em;
    line-height: 1.2;
}
.section-heading p {
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
}

/* Pulsanti */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .55em;
    font-size: .98rem;
    font-weight: 600;
    text-decoration: none;
    padding: .78em 1.4em;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-primary {
    color: #ffffff;
    background: var(--brand-600);
}
.btn-primary:hover { background: var(--brand-700); }
.btn-ghost {
    color: var(--brand-700);
    background: var(--paper-0);
    border-color: var(--line-strong);
}
.btn-ghost:hover { border-color: var(--brand-400); }
.btn:focus-visible { outline: 3px solid rgba(0, 90, 156, .35); outline-offset: 2px; }

/* Pillole "--flag" in stile opzioni da riga di comando */
.flags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .7em;
    padding: 0;
    margin: 0;
}
.flags li {
    font-size: .86rem;
    font-weight: 500;
    color: var(--brand-700);
    background: var(--paper-0);
    border: 1px solid var(--line);
    padding: .5em 1em;
    border-radius: 999px;
}
.flags li::before {
    content: "✓ ";
    color: var(--green-text);
    font-weight: 700;
}

/* Pillole neutre per metadati (moduli, livello, ecc.) */
.meta-pill {
    display: inline-flex;
    align-items: center;
    gap: .45em;
    font-family: var(--font-mono);
    font-size: .8rem;
    color: var(--brand-700);
    background: rgba(255, 255, 255, .75);
    border: 1px solid var(--line);
    padding: .45em .95em;
    border-radius: 999px;
}

/* ================================================================
   FOOTER
================================================================= */
body.page-home > .site-footer {
    background: var(--paper-0);
    border-top: 1px solid var(--line);
    padding: 2.4rem 1.5rem 2.2rem;
}
body.page-home .footer-brand {
    display: inline-flex;
    align-items: center;
    gap: .55em;
}
body.page-home .footer-brand img {
    width: 26px;
    height: 26px;
    border-radius: 7px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .3em 1.4em;
    margin: .3em 0 .2em;
}
.footer-links a {
    font-size: .9rem;
    color: var(--muted);
    text-decoration: none;
    transition: color .2s ease;
}
.footer-links a:hover { color: var(--brand-600); }
body.page-home .footer-desc {
    font-family: var(--font-mono);
    font-size: .82rem;
    color: var(--subtle);
}

/* ================================================================
   RESPONSIVE
================================================================= */
@media (max-width: 680px) {
    .site-nav-inner { height: 58px; padding: 0 16px; gap: .5em; }
    .nav-brand { flex-shrink: 0; font-size: 1rem; }
    /* I link restano raggiungibili: diventano una riga che scorre in orizzontale */
    .nav-links {
        flex: 1 1 auto;
        /* niente flex-end: con l'overflow renderebbe irraggiungibili i primi link */
        justify-content: flex-start;
        gap: 0;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .nav-links::-webkit-scrollbar { display: none; }
    /* su telefono la guida al PC viene per prima: altrimenti resterebbe fuori schermo */
    .nav-links a.nav-guide { order: -1; }
    .nav-links a {
        flex-shrink: 0;
        font-size: .82rem;
        padding: .4em .62em;
        white-space: nowrap;
    }
    .flags { gap: .5em; }
    .flags li { font-size: .74rem; padding: .45em .85em; }
}

.footer-note {
    max-width: 44em;
    margin: .2em auto 0;
    font-size: .74rem;
    line-height: 1.5;
    color: var(--subtle);
}
