/* ============================================================
   NAVIGATION — Desktop & Mobile
   ============================================================ */

.nav {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Liste principale --- */
.nav__list {
  display: flex;
  gap: 0;
  list-style: none;
  align-items: stretch;
}

/* --- Item principal --- */
.nav__item {
  position: relative;
}

/* --- Bouton de l'item principal --- */
.nav__btn {
  display: block;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.6rem 1rem;
  font-family: var(--font-main);
  font-size: var(--fs-nav);
  font-weight: var(--fw-regular);
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.nav__btn:hover,
.nav__item:focus-within .nav__btn {
  border-bottom-color: var(--color-orange);
  color: var(--color-black);
}

/* Page active : le bouton du menu correspondant a une bordure orange */
.nav__item--active > .nav__btn {
  border-bottom-color: var(--color-orange);
}

/* --- Sous-menu (dropdown) --- */
.nav__sub {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--color-white);
  border: 1px solid #e0e0e0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  list-style: none;
  z-index: 200;
}

.nav__item:hover .nav__sub,
.nav__item:focus-within .nav__sub {
  display: block;
}

.nav__sub a {
  display: block;
  padding: 0.6rem 1rem;
  font-size: var(--fs-subnav);
  color: var(--color-black);
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav__sub a:last-child {
  border-bottom: none;
}

.nav__sub a:hover {
  background: #fef6e8;
}

/* --- Icône Home ---
   Dans le flux flex de .nav, 30px à droite de "Contact"
   Le bloc entier (nav list + icône) est centré sur la page
------------------------------------------------- */
.nav__home {
  display: flex;
  align-items: center;
  margin-left: 30px;
  padding: 0.6rem 0.25rem;
  color: var(--color-black);
  transition: color 0.2s ease;
  line-height: 1;
}

.nav__home:hover {
  color: var(--color-orange);
}

.nav__home .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: 'FILL' 0, 'wght' 280, 'GRAD' 0, 'opsz' 24;
  height: 1.55rem;
}

/* --- Bouton hamburger (masqué sur desktop) --- */
.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0.5rem;
  cursor: pointer;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-gray-dark);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animation hamburger → croix */
.nav__toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav__toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav__toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   NAVIGATION MOBILE (≤ 960px)
   Breakpoint élevé : les 4 rubriques longues débordent avant 960px
   ============================================================ */
@media (max-width: 960px) {
  .nav {
    /* La nav reprend seulement la place du bouton hamburger */
    width: auto;
    margin-left: auto;
    border-top: none;
    position: static;
    gap: 0.25rem;
  }

  .nav__home {
    display: none;
  }

  .nav__toggle {
    display: flex;
  }

  /* Menu masqué par défaut : dropdown absolu sous le header */
  .nav__list {
    display: none;
    position: absolute;
    /* Le header a position:sticky → ce positionnement est relatif à lui */
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    background: var(--color-white);
    border-top: 1px solid #e0e0e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 200;
  }

  /* Menu ouvert (classe ajoutée par nav.js) */
  .nav__list.is-open {
    display: flex;
  }

  .nav__btn {
    width: 100%;
    text-align: left;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    border-left: 3px solid transparent;
    font-size: var(--fs-body);
  }

  /* Hover : pas de border-bottom orange, texte toujours noir */
  .nav__btn:hover,
  .nav__item:focus-within .nav__btn {
    border-bottom-color: #f0f0f0;
    color: var(--color-black);
  }

  /* Sous-menu ouvert : border-left orange, texte noir */
  .nav__btn[aria-expanded="true"] {
    border-left-color: var(--color-orange);
    color: var(--color-black);
  }

  /* Page active : border-left orange, texte noir */
  .nav__item--active > .nav__btn {
    border-bottom-color: #f0f0f0;
    border-left-color: var(--color-orange);
    color: var(--color-black);
  }

  /* Sous-menus mobiles : position normale (pas absolue) */
  .nav__sub {
    position: static;
    display: none;
    box-shadow: none;
    border: none;
    border-left: 3px solid var(--color-orange);
    background: #fef6e8;
    min-width: unset;
  }

  .nav__sub.is-open {
    display: block;
  }

  /* Sur mobile les sous-menus ne s'ouvrent pas au hover */
  .nav__item:hover .nav__sub {
    display: none;
  }

  .nav__item:hover .nav__sub.is-open {
    display: block;
  }

  .nav__sub a {
    padding: 0.6rem 1rem 0.6rem 1.5rem;
  }

  .nav__sub-item--desktop-only {
    display: none;
  }
}
