/* =========================================================
   MENU + PIED DE PAGE  (v3, pensé d'abord pour ordinateur)
   - Ordinateur : barre horizontale + méga-menu au survol
     ET au clavier (Tab).
   - Mobile / tablette tactile : barre avec bouton burger et
     menu déroulant (ouvert/fermé par script/menu.js).
   ========================================================= */

/* ---------- BARRE DE NAVIGATION (ordinateur) ---------- */
nav {
  position: sticky;
  top: 0;
  z-index: 99;
  width: 100%;
  background: #075c4a;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.nav-barre {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* éléments réservés au mobile : cachés sur ordinateur */
.nav-marque,
.nav-burger,
.sous-menu-toggle {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 1.25rem 0;
  list-style: none;
}

.nav-links > li {
  list-style: none;
}

.nav-links > li > a {
  display: inline-block;
  padding: 9px 15px;
  border-radius: 5px;
  color: #aafcb8;
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.3s ease, color 0.3s ease;
}

/* l'ancien survol utilisait la couleur du fond : il était invisible */
.nav-links > li > a:hover,
.nav-links > li > a:focus-visible {
  background: #0a7a62;
  color: #fff;
}

/* page en cours */
.nav-links a[aria-current="page"] {
  background: rgba(0, 0, 0, 0.28);
  color: #fff;
}

/* ---------- MÉGA-MENU (ordinateur) ---------- */
/* Le menu s'accroche à la barre (<nav>), pas au lien : il ne dépasse
   plus de l'écran sur un portable de 1366 px. */
.mega-box {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 100;
  width: min(960px, 94vw);
  transform: translateX(-50%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* « pont » invisible : le menu ne se ferme pas quand la souris
   traverse l'espace entre le lien et le panneau */
.mega-box::before {
  content: "";
  position: absolute;
  top: -1.25rem;
  right: 0;
  left: 0;
  height: 1.25rem;
}

.has-mega:hover .mega-box,
.has-mega:focus-within .mega-box {
  opacity: 1;
  visibility: visible;
}

/* Échap ferme le menu (script/menu.js) : sélecteur plus précis que le
   survol, pour gagner même quand la souris est encore sur le menu */
nav.mega-ferme .has-mega .mega-box {
  opacity: 0;
  visibility: hidden;
}

.mega-box .content {
  display: flex;
  justify-content: space-around;
  gap: 10px;
  padding: 25px 20px;
  background: #075c4a;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.25);
}

.content .row {
  flex: 1;
}

.content .row .mega-links {
  margin: 0;
  padding: 0;
  list-style: none;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.row .mega-links li {
  padding: 0 10px;
}

.row .mega-links li a {
  display: block;
  padding: 6px 14px;
  border-radius: 5px;
  color: #aafcb8;
  font-size: 17px;
  text-decoration: none;
  transition: background 0.2s ease, color 0.2s ease;
}

.row .mega-links li a:hover,
.row .mega-links li a:focus-visible {
  background: #0a7a62;
  color: #fff;
}

/* ---------- PIED DE PAGE ---------- */
footer {
  padding: 1em 0;
  background: #075c4a;
  color: #aafcb8;
  text-align: center;
}

footer p {
  margin: 0;
}

/* =========================================================
   MOBILE ET TABLETTE : barre + burger
   Se déclenche sous 960 px, ET sur les écrans tactiles (tablette
   en paysage) où le survol n'existe pas.
   ========================================================= */
@media (max-width: 960px), (hover: none) and (pointer: coarse) {

  .nav-barre {
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 0.5rem 1rem;
  }

  .nav-marque {
    display: block;
    padding: 0.5rem 0;
    color: #aafcb8;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
  }

  .nav-burger {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    padding: 0 11px;
    border: 2px solid #aafcb8;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
  }

  .nav-burger span {
    display: block;
    height: 2px;
    background: #aafcb8;
    transition: transform 0.25s ease, opacity 0.2s ease;
  }

  nav.ouvert .nav-burger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  nav.ouvert .nav-burger span:nth-child(2) {
    opacity: 0;
  }

  nav.ouvert .nav-burger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* liste de liens : fermée par défaut, ouverte avec nav.ouvert */
  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    width: 100%;
    max-height: calc(100vh - 70px);
    padding: 0.25rem 0 1rem;
    overflow-y: auto;
  }

  nav.ouvert .nav-links {
    display: flex;
  }

  .nav-links > li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
  }

  .nav-links > li > a {
    flex: 1;
    padding: 14px 12px;
    border-radius: 0;
    font-size: 19px;
  }

  /* bouton qui déplie « Portfolio » */
  .sous-menu-toggle {
    position: relative;
    display: block;
    width: 52px;
    height: 48px;
    border: 0;
    background: transparent;
    cursor: pointer;
  }

  .sous-menu-toggle::before {
    content: "";
    position: absolute;
    top: 16px;
    left: 20px;
    width: 10px;
    height: 10px;
    border-right: 3px solid #aafcb8;
    border-bottom: 3px solid #aafcb8;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
  }

  .has-mega.ouvert .sous-menu-toggle::before {
    top: 21px;
    transform: rotate(-135deg);
  }

  /* le méga-menu devient une simple liste dépliable */
  .mega-box {
    position: static;
    display: none;
    width: 100%;
    transform: none;
    opacity: 1;
    visibility: visible;
  }

  .has-mega.ouvert .mega-box {
    display: block;
  }

  .mega-box::before {
    display: none;
  }

  .mega-box .content {
    flex-direction: column;
    gap: 0;
    padding: 0 0 10px 14px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  .content .row .mega-links {
    border-left: 0;
  }

  .row .mega-links li {
    padding: 0;
  }

  .row .mega-links li a {
    padding: 12px 14px;
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mega-box,
  .nav-burger span,
  .sous-menu-toggle::before,
  .nav-links > li > a {
    transition: none;
  }
}
