/* ============================================================
   VARIABILI — override per ogni pagina se necessario
   ============================================================ */
:root {
    --page-accent: #003399;        /* colore EU blu (invariante) */
    --page-accent-light: #e8edf8;  /* sfondo sezioni chiare */
    --page-accent-dark: #001f70;
    --warn-color: #9c2b00;         /* urgenza normativa */
    --success-color: #1a7a40;
    --neutral-50: #f9fafb;
    --neutral-100: #f1f3f5;
    --text-muted: #444f66;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --shadow-card: 0 2px 16px rgba(0,0,0,.08);
    --shadow-hover: 0 8px 32px rgba(0,51,153,.15);
    font-family: 'Inter', sans-serif;
}

html, body {
    max-width: 100vw;
}

*, *::before, *::after {
    box-sizing: border-box;
}

main {
    min-width: 0;
    max-width: 100%;
}

.hero-progress {
    display: flex;
    align-items: center;
    gap: .8rem;
    flex-wrap: wrap;
    justify-content: left;
    margin-bottom: 2rem;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: none;
    background: #003399;
    color: white;
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.priority-badge.green {
    background: var(--success-color);
}

.btn-hero-primary {
    display: inline-flex; align-items: center; gap: .5rem;
    background: #fff;
    color: var(--page-accent);
    font-weight: 700;
    font-size: .9rem;
    padding: .75rem 1.4rem;
    border-radius: 8px;
    text-decoration: none;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}
.btn-hero-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.btn-hero-ghost {
    display: inline-flex; align-items: center; gap: .5rem;
    background: transparent;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    padding: .75rem 1.4rem;
    border-radius: 8px;
    border: 1.5px solid rgba(255,255,255,.4);
    text-decoration: none;
    transition: background .2s, border-color .2s;
}
.btn-hero-ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.7); }

/* ============================================================
   LAYOUT PRINCIPALE (2 colonne su desktop)
   ============================================================ */
.page-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 2.5rem;
    align-items: start;
    padding: 3rem 0 7rem;
}

@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .sidebar {
        order: 0;
        position: static;
        top: auto;
        width: 100%;
        max-width: 100%;
    }
    .toc-card,
    .norm-card-sidebar {
        display: none;
    }

    .calc-sidebar {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ============================================================
   SEZIONI CONTENUTO
   ============================================================ */
.content-section {
    margin-bottom: 2.8rem;
    scroll-margin-top: 120px;
}

/* Etichetta sezione */
.section-label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--page-accent);
    margin-bottom: .6rem;
}
.section-label::before {
    content: '';
    display: inline-block;
    width: 18px; height: 2px;
    background: var(--page-accent);
}

.content-section h2 {
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    line-height: 1.25;
    margin-bottom: 1rem;
}
.content-section p {
    line-height: 1.75;
    margin-bottom: 1rem;
    font-size: .97rem;
}

/* Box normativo */
.norm-box {
    background: var(--page-accent-light);
    border-left: 4px solid var(--page-accent);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 1.2rem 1.4rem;
    margin: 1.5rem 0;
}
.norm-box .norm-label {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--page-accent);
    margin-bottom: .3rem;
}
.norm-box p {
    margin: 0;
    font-size: .93rem;
    color: var(--neutral-900);
    line-height: 1.6;
}
.norm-box .norm-ref {
    margin-top: .5rem;
    font-size: .78rem;
    color: var(--text-muted);
}

/* Box urgenza */
.urgency-box {
    background: #fff5f0;
    border: 1px solid #f5cbb8;
    border-left: 4px solid var(--warn-color);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    padding: 1rem 1.2rem;
    display: flex;
    gap: .8rem;
    align-items: flex-start;
    margin: 1.2rem 0;
}
.urgency-box i { color: var(--warn-color); font-size: 1.1rem; margin-top: .15rem; flex-shrink: 0; }
.urgency-box p { margin: 0; font-size: .9rem; color: #7a2b0a; line-height: 1.55; }
.urgency-box strong { color: var(--warn-color); }

/* ============================================================
   SEZIONE 2 — Guida Tecnica: card confronto materiali
   ============================================================ */
.materials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}
.material-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    transition: box-shadow .2s, border-color .2s;
}
.material-card:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--page-accent);
}
.material-card .mat-icon {
    width: 40px; height: 40px;
    border-radius: 8px;
    background: var(--page-accent-light);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: var(--page-accent);
    margin-bottom: .8rem;
}
.material-card h4 {
    font-size: .95rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin-bottom: .4rem;
}
.material-card p {
    font-size: .82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.material-card .mat-lambda {
    display: inline-block;
    margin-top: .6rem;
    font-size: .75rem;
    font-weight: 600;
    background: var(--page-accent-light);
    color: var(--page-accent);
    padding: .15rem .5rem;
    border-radius: 4px;
}
.material-card.recommended {
    border-color: var(--success-color);
    background: #f0faf4;
}
.material-card.recommended .mat-icon { background: #d4f0e0; color: var(--success-color); }
.recommended-badge {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--success-color);
    border: 1px solid var(--success-color);
    border-radius: 4px;
    padding: .1rem .4rem;
    display: inline-block;
    margin-bottom: .5rem;
}

/* Parametro tecnico evidenziato */
.tech-param {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--neutral-50);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 1rem 1.2rem;
    margin: .8rem 0;
}
.tech-param .param-value {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--page-accent);
    white-space: nowrap;
}
.tech-param .param-label { font-size: .88rem; color: var(--neutral-700); line-height: 1.4; }
.tech-param .param-label strong { display: block; color: var(--neutral-900); margin-bottom: .15rem; }

/* ============================================================
   SEZIONE 3 — Tabella numeri intervento
   ============================================================ */
.numbers-table-wrap {
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    margin: 1.5rem 0;
}
.numbers-table-wrap table {
    width: 100%;
    border-collapse: collapse;
}
.numbers-table-wrap thead {
    background: var(--page-accent);
    color: #fff;
}
.numbers-table-wrap thead th {
    padding: .9rem 1.2rem;
    text-align: left;
    font-size: .8rem;
    font-weight: 600;
    letter-spacing: .06em;
}
.numbers-table-wrap tbody tr {
    border-bottom: 1px solid #f1f3f5;
    transition: background .15s;
}
.numbers-table-wrap tbody tr:last-child { border-bottom: none; }
.numbers-table-wrap tbody tr:hover { background: var(--page-accent-light); }
.numbers-table-wrap td {
    padding: .85rem 1.2rem;
    font-size: .9rem;
    color: var(--neutral-700);
    vertical-align: middle;
}
.numbers-table-wrap td:first-child { font-weight: 600; color: var(--neutral-900); }
.numbers-table-wrap td:last-child { font-weight: 700; color: var(--page-accent); }
.value-pill {
    display: inline-block;
    background: var(--page-accent-light);
    color: var(--page-accent);
    font-weight: 700;
    font-size: .88rem;
    padding: .2rem .7rem;
    border-radius: 99px;
}
.source-note {
    font-size: .75rem;
    color: var(--text-muted);
    padding: .6rem 1.2rem;
    background: var(--neutral-50);
    border-top: 1px solid #e5e7eb;
}

/* ============================================================
   SEZIONE 4 — CTA "Zero Brand"
   ============================================================ */
.cta-trio {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
}
.cta-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-xl);
    padding: 1.6rem;
    display: flex;
    flex-direction: column;
    gap: .8rem;
    box-shadow: var(--shadow-card);
    transition: box-shadow .25s, transform .25s;
}
.cta-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }
.cta-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem;
}
.cta-icon.green { background: #d4f0e0; color: var(--success-color); }
.cta-icon.blue { background: var(--page-accent-light); color: var(--page-accent); }
.cta-icon.orange { background: #fff0e8; color: var(--warn-color); }
.cta-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--neutral-900);
    margin: 0;
}
.cta-card p {
    font-size: .85rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
    flex: 1;
}
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    font-size: .85rem;
    font-weight: 700;
    padding: .65rem 1.1rem;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity .2s, transform .2s;
    border: none;
    cursor: pointer;
    width: fit-content;
}
.btn-cta:hover { opacity: .88; transform: translateY(-1px); }
.btn-cta.green { background: var(--success-color); color: #fff; }
.btn-cta.blue { background: var(--page-accent); color: #fff; }
.btn-cta.orange { background: var(--warn-color); color: #fff; }

.larg {
    width: 200px;
    justify-content: center;
}
/* Form newsletter inline */
.newsletter-inline {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}
.newsletter-inline input[type="email"] {
    flex: 1;
    min-width: 160px;
    padding: .6rem .9rem;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: .85rem;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: border-color .2s;
}
.newsletter-inline input[type="email"]:focus { border-color: var(--page-accent); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

/* Card indice di pagina */
.toc-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    box-shadow: var(--shadow-card);
}
.toc-card h4 {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    margin-bottom: .8rem;
}
.toc-list {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: .1rem;
}
.toc-list a {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .6rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: .84rem;
    color: var(--neutral-700);
    transition: background .15s, color .15s;
}
.toc-list a:hover { background: var(--page-accent-light); color: var(--page-accent); }
.toc-list a.active { background: var(--page-accent-light); color: var(--page-accent); font-weight: 600; }
.toc-list .step-num {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--neutral-100);
    color: var(--text-muted);
    font-size: .7rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

/* Card riferimenti normativi sidebar */
.norm-card-sidebar {
    background: var(--page-accent);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    color: #fff;
}
.norm-card-sidebar h4 {
    font-size: .78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.65);
    margin-bottom: .8rem;
}
.norm-ref-item {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    margin-bottom: .7rem;
    font-size: .83rem;
    line-height: 1.4;
}
.norm-ref-item i { color: rgba(255,255,255,.6); font-size: .8rem; margin-top: .15rem; flex-shrink: 0; }
.norm-ref-item span { color: rgba(255,255,255,.9); }
.norm-ref-item strong { color: #fff; display: block; }

/* Card calcolatore sidebar */
.calc-sidebar {
    background: linear-gradient(135deg, var(--warn-color) 0%, #e05520 100%);
    border-radius: var(--radius-lg);
    padding: 1.3rem;
    color: #fff;
    text-align: center;
}
.calc-sidebar i { font-size: 1.8rem; margin-bottom: .5rem; display: block; }
.calc-sidebar h4 { font-size: .95rem; font-weight: 700; margin-bottom: .4rem; }
.calc-sidebar p { font-size: .8rem; opacity: .85; margin-bottom: .9rem; line-height: 1.4; }
.btn-calc { display: block; background: #fff; color: var(--warn-color); font-weight: 700; font-size: .85rem; padding: .6rem; border-radius: 8px; text-decoration: none; transition: opacity .2s; }
.btn-calc:hover { opacity: .9; }

/* ============================================================
   SEZIONE CORRELATI / ECOSISTEMA
   ============================================================ */
.related-interventions {
    background: var(--neutral-50);
    border-top: 1px solid #e5e7eb;
    padding: 4rem 0;
}
.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}
.related-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-lg);
    padding: 1rem 1.1rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: .8rem;
    transition: box-shadow .2s, border-color .2s;
}
.related-card:hover { box-shadow: var(--shadow-hover); border-color: var(--page-accent); }
.related-card .rel-icon {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: var(--page-accent-light);
    display: flex; align-items: center; justify-content: center;
    color: var(--page-accent);
    font-size: .95rem;
    flex-shrink: 0;
}
.related-card.current-page { border-color: var(--page-accent); background: var(--page-accent-light); pointer-events: none; }
.related-card.current-page .rel-icon { background: var(--page-accent); color: #fff; }
.related-card h5 { font-size: .85rem; font-weight: 600; color: var(--neutral-900); margin: 0 0 .1rem; }
.related-card span { font-size: .75rem; color: var(--text-muted); }
.rel-priority {
    margin-left: auto;
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--neutral-100);
    padding: .1rem .4rem;
    border-radius: 4px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 3rem 0;
}
.highlight-inline {
    background: var(--page-accent-light);
    color: var(--page-accent);
    font-weight: 600;
    padding: .05em .3em;
    border-radius: 3px;
    font-size: .95em;
}
code.formula {
    font-family: 'Courier New', monospace;
    background: #f1f3f5;
    padding: .1em .4em;
    border-radius: 4px;
    font-size: .9em;
    color: #4b5263;
}

@media (max-width: 640px) {
    .cta-trio { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {

    /* Tabella: scroll orizzontale invece di sforare */
    .numbers-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Celle tabella: larghezza minima per non collassare il testo */
    .numbers-table-wrap td,
    .numbers-table-wrap th {
        min-width: 120px;
        font-size: .78rem;
        padding: .65rem .8rem;
    }

    /* Grid materiali: una sola colonna */
    .materials-grid {
        grid-template-columns: 1fr;
    }

    /* tech-param: impila verticalmente */
    .tech-param {
        flex-direction: column;
        align-items: flex-start;
        gap: .5rem;
    }

    /* norm-box e urgency-box: forza dentro il contenitore */
    .norm-box,
    .urgency-box {
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
        width: 100%;
    }
}

@media (max-width: 420px) {
    .numbers-table-wrap th:last-child,
    .numbers-table-wrap td:last-child {
        display: none;
    }
}
