/* navbar.css — Navbar fissa e responsive (modulare, senza inline) */

/* BASE */
nav.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #000;
  padding: 6px 12px;              /* desktop slim */
  min-height: var(--navbar-h, 52px);
  box-sizing: border-box;
  width: 100%;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  flex-wrap: wrap;
  font-family: var(--font-ui);
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.06em;         /* leggermente più compatta */
  z-index: 999;
}

/* Stato fisso (desktop e mobile) */
nav.navbar.navbar--fixed{
  position: fixed;
  top: 0; left: 0; right: 0;
}

/* Logo */
.nav-left .logo {
  font-weight: 600;
  font-size: 1.05rem;             /* desktop sottile */
  color: var(--accent-color);
  text-decoration: none;
}

/* Centro: menu desktop */
.nav-center { flex: 1; display: flex; justify-content: center; }

.menu {
  display: flex;
  gap: 1.2rem;                    /* leggermente ridotto */
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  font-weight: 300;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu a { color: #fff; font-weight: 300; transition: color 0.2s; font-family: var(--font-ui); }
.menu a:hover,
.menu a.active { color: var(--accent-color); font-weight: 600; }

/* Destra: toggle lingua + hamburger */
.nav-right { display: flex; align-items: center; gap: .75rem; }

/* Language switch */
.lang-switch button{
  background: none;
  border: none;
  color: var(--accent-color);
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: .95rem;               /* desktop leggermente più piccolo */
  cursor: pointer;
  padding: 0 .25rem;
  transition: color 0.3s;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lang-switch button:hover:not([aria-checked="true"]) { color: var(--light-accent); }
.lang-switch button[aria-checked="true"] { color: #fff; font-weight: 600; text-decoration: underline; cursor: default; pointer-events: none; }

/* ===== Responsive: hamburger e pannello mobile ===== */
/* Nascondo il checkbox di controllo */
.nav-toggle{ position:absolute; left:-9999px; }

/* L’hamburger di default è nascosto (desktop); i suoi dettagli grafici sono in hamburger.css */
.hamburger{ display:none; }

@media (max-width: 1199px){
  /* Navbar più sottile su mobile */
  nav.navbar{ padding: 4px 10px; min-height: var(--navbar-h, 48px); letter-spacing: 0.05em; }
  .nav-right{ gap: .5rem; }
  .nav-left .logo{ font-size: 1rem; }
  .lang-switch button{ font-size: .85rem; padding: 0 .2rem; }

  /* Su mobile/tablet: nascondo il menu inline e mostro l'hamburger */
  .nav-center{ display:none; }
  .hamburger{ display:inline-flex; line-height: 1; }

  /* Quando il toggle è attivo, mostro un pannello fisso sotto la navbar */
  .nav-toggle:checked ~ .nav-center{
    display:block;
    position:fixed;
    top: var(--navbar-h);         /* offset: legge da layout.css (48px) */
    left:0; right:0;
    background:#000;
    border-bottom:1px solid rgba(255,255,255,.08);
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    z-index: 998;                 /* sopra ai contenuti, sotto la navbar */
    padding: 10px 12px;
  }

  .nav-toggle:checked ~ .nav-center .menu{ display:flex; flex-direction: column; gap:10px; }
  .nav-toggle:checked ~ .nav-center .menu a,
  .nav-toggle:checked ~ .nav-center .menu .nav-dropdown-toggle { padding: 6px 0; }
}

/* ===== Dropdown Menu ===== */
.nav-item-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  background: none;
  border: none;
  color: #fff;
  font-family: var(--font-ui);
  font-weight: 300;
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  transition: color 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.nav-dropdown-toggle:hover,
.nav-dropdown-toggle.active {
  color: var(--accent-color);
  font-weight: 600;
}

.nav-dropdown-toggle i {
  font-size: 0.75em;
  transition: transform 0.3s ease;
}

.nav-item-dropdown:hover .nav-dropdown-toggle i,
.nav-item-dropdown.dropdown-open .nav-dropdown-toggle i {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 0.5rem;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  list-style: none;
  padding: 0.5rem 0;
  min-width: 200px;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-50%) translateY(-10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.nav-item-dropdown:hover .nav-dropdown-menu,
.nav-item-dropdown.dropdown-open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.nav-dropdown-item {
  display: block;
  padding: 0.625rem 1.25rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.9em;
  font-weight: 300;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-dropdown-item:hover {
  background: rgba(212, 175, 55, 0.1);
  color: var(--accent-color);
  border-left-color: var(--accent-color);
}

/* Mobile dropdown styles - ACCORDION STYLE */
@media (max-width: 1199px) {
  /* L'item dropdown deve comportarsi come gli altri list items */
  .nav-item-dropdown {
    width: 100%;
  }

  /* Il toggle deve essere allineato esattamente come gli altri link */
  .nav-dropdown-toggle {
    display: flex !important;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0 !important;
    text-align: left;
    /* Rimuovo qualsiasi offset che potrebbe spostarlo */
    margin: 0 !important;
    position: static;
    /* Stesso stile degli altri link */
    color: #fff;
    font-weight: 300;
    font-family: var(--font-ui);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: none;
    border: none;
    cursor: pointer;
  }

  /* ACCORDION: il menu si espande SOTTO il toggle, tra gli altri elementi */
  .nav-dropdown-menu {
    position: static;
    transform: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: transparent;
    min-width: auto;
    width: 100%;
    box-sizing: border-box;
    list-style: none;
    /* Nascosto di default */
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
  }

  /* Quando aperto: si espande verso il basso */
  .nav-item-dropdown.dropdown-open .nav-dropdown-menu {
    opacity: 1;
    max-height: 500px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem 0; /* Nessun indent - allineato come gli altri */
    background: transparent; /* Nessuno sfondo separato */
    border: none; /* Nessun bordo separato */
    margin: 0.25rem 0;
  }

  .nav-dropdown-item {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.85em; /* Leggermente più piccolo per distinguerli */
    text-align: right; /* Allineato a destra come gli altri link */
    width: 100%;
    box-sizing: border-box;
    color: #fff;
    text-decoration: none;
    border: none;
  }

  .nav-dropdown-item:hover {
    color: var(--accent-color);
  }
}

/* Accessibilità focus */
.lang-switch button:focus-visible,
.hamburger:focus-visible,
.nav-dropdown-toggle:focus-visible{ outline:2px solid var(--accent-color); outline-offset:2px; }