/* ==========================================================================
   Nav unificata KB — Infodiz
   19/11/2026: allinea il menu desktop della KB EN (che non c'era) a quello
   della IT, e porta il drawer (gia' presente in EN) anche in IT.

   Un unico file per EN e IT: il CSS del drawer e' quello EN gia' funzionante,
   cosi' i due drawer sono identici per costruzione.

   Va caricato DOPO nis2-kit.css e DOPO il <style> inline della pagina EN.
   ========================================================================== */

/* ===== PALETTE (allineata alla homepage, 19/11/2026) =====
   La KB usava --cyan #0891b2 (contrasto 3.68:1 su bianco, sotto AA).
   La homepage usa --primary #0056d2 (6.44:1, AA) e --accent #00d4aa.
   Unifico sul design system della homepage: contrasto dei link migliora.
   --accent resta solo per forme/gradienti: non e' mai testo (1.91:1). */
:root {
    --cyan: #0056d2;          /* = homepage --primary */
    --cyan-dark: #1d4ed8;
    --cyan-500: #3b82f6;
    --cyan-100: #dbeafe;
    --cyan-50: #eff6ff;
    --teal: #00d4aa;           /* = homepage --accent */
    --primary: #0056d2;
    --accent: #00d4aa;
}

/* ===== NAVIGATION ===== */
.nav { background: white; border-bottom: 1px solid var(--border-light); position: sticky; top: 0; z-index: 100; }
.nav--scrolled { box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05); }
.nav__inner { max-width: var(--max-width); margin: 0 auto; padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.nav__logo { display: flex; align-items: center; gap: 0.625rem; font-weight: 800; font-size: 1.25rem; color: var(--ink); }
.nav__logo img { height: 36px; width: auto; border-radius: 8px; }
.nav__logo span { background: var(--gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

.nav__cta-group { display: flex; align-items: center; gap: 0.75rem; }

/* ===== DESKTOP MENU (unificato EN/IT, 19/11/2026) ===== */
.nav__menu { display: flex; align-items: center; gap: 0.25rem; margin-left: 1.5rem; }
.nav__item { position: relative; }

.nav__link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink-muted);
    border-radius: var(--radius-sm);
    transition: color 0.18s ease, background 0.18s ease;
    white-space: nowrap;
}
.nav__link:hover { color: var(--cyan); background: var(--surface-warm); }
.nav__link.active { color: var(--cyan); background: var(--cyan-50); }
.nav__link .chev { font-size: 0.625rem; opacity: 0.55; transition: transform 0.2s ease; }
.nav__item:hover .nav__link .chev { transform: rotate(180deg); }

/* Dropdown hover */
.nav__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 230px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 60;
}
.nav__item:hover .nav__dropdown,
.nav__item:focus-within .nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.nav__dropdown a {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--ink-muted);
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.nav__dropdown a:hover { background: var(--surface-warm); color: var(--cyan); }
.nav__dropdown a.active { color: var(--cyan); font-weight: 600; }
.nav__dropdown a .icon { font-size: 1rem; width: 20px; text-align: center; flex-shrink: 0; }

/* CTA + hamburger */
.nav__cta-group { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.nav__ham {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s var(--transition);
    margin-left: auto;
}
.nav__ham:active { background: var(--surface-warm); transform: scale(0.95); }
.nav__ham span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    border-radius: 2px;
    transition: all 0.3s var(--transition);
}
.nav__ham.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__ham.is-open span:nth-child(2) { opacity: 0; }
.nav__ham.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Il menu desktop sparisce sotto i 900px: li' c'e' il drawer.
   L'hamburger serve solo se la pagina NON ha un drawer. */
@media (max-width: 900px) {
    .nav__menu { display: none; }
    .nav__cta-group { display: none; }
    /* L'hamburger apre il drawer: serve su TUTTE le pagine sotto i 900px.
       (Prima avevo messo body:not(.has-drawer): sbagliato, perche' tutte
       le pagine hanno il drawer e il pulsante non compariva mai.) */
    .nav__ham { display: flex; }
}

/* ===== DRAWER ===== */
.drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 85%;
    max-width: 340px;
    height: 100vh;
    height: 100dvh;
    background: white;
    z-index: 300;
    transform: translateX(100%);
    transition: transform 0.35s var(--transition);
    display: flex;
    flex-direction: column;
    box-shadow: -10px 0 40px rgba(15,23,42,0.15);
}
.drawer.is-open { transform: translateX(0); }

.drawer__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 250;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--transition);
}
.drawer__backdrop.is-open { opacity: 1; visibility: visible; }

/* Drawer Header */
.drawer__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.drawer__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 17px;
    color: var(--ink);
}
.drawer__logo img { height: 32px; width: auto; border-radius: 8px; }
.drawer__close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: var(--slate);
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}
.drawer__close:active { background: var(--surface-warm); transform: scale(0.92); }

/* Drawer Body */
.drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    -webkit-overflow-scrolling: touch;
}
.drawer__section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-light);
    padding: 16px 12px 8px;
}

/* Menu Items */
.drawer__item {
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2px;
}
.drawer__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    text-decoration: none;
    color: var(--ink-muted);
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.drawer__link:active { background: var(--surface-warm); }
.drawer__link.is-active {
    background: var(--cyan-50);
    color: var(--cyan-dark);
}
.drawer__icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--surface-warm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}
.drawer__link.is-active .drawer__icon { background: var(--cyan-100); }
.drawer__arrow {
    margin-left: auto;
    font-size: 12px;
    color: var(--slate-light);
    transition: transform 0.25s var(--transition);
}
.drawer__item.is-open .drawer__arrow { transform: rotate(180deg); }

/* Submenu (accordion) */
.drawer__submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--transition);
    padding-left: 44px;
}
.drawer__item.is-open .drawer__submenu { max-height: 300px; }
.drawer__subitem {
    display: block;
    padding: 10px 12px;
    text-decoration: none;
    color: var(--slate);
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
}
.drawer__subitem:active { background: var(--surface-warm); color: var(--cyan); }
.drawer__subitem .icon { font-size: 13px; opacity: 0.7; width: 20px; text-align: center; }
.drawer__sep {
    height: 1px;
    background: var(--border-light);
    margin: 8px 12px;
}

/* Drawer Footer */
.drawer__footer {
    padding: 16px;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
    background: white;
}
.drawer__cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: var(--gradient);
    color: white;
    font-weight: 700;
    font-size: 15px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(8,145,178,0.3);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.drawer__cta:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(8,145,178,0.25); }
.drawer__lang {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--slate);
    text-decoration: none;
    border-radius: 10px;
    transition: all 0.15s;
}
.drawer__lang:active { background: var(--surface-warm); }

/* Scrollbar */
.drawer__body::-webkit-scrollbar { width: 4px; }
.drawer__body::-webkit-scrollbar-track { background: transparent; }
.drawer__body::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
