/* ============================================================
   MENU — BASTIDE DE CASENEUVE
   Structure :
     1. Animations
     2. Navbar principale (desktop)
     3. Sous-menu desktop
     4. Bouton hamburger
     5. Menu slide (mobile)
     6. Sous-menu mobile
     7. Menus annexes (langues, Instagram, réserver)
   ============================================================ */

/* ============================================================
   1. ANIMATIONS
   ============================================================ */

@keyframes fade-in {
  from {
    opacity: 0;
    translate: 0;
  }
  to {
    opacity: 1;
    translate: 0;
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    translate: 0 -3rem;
  }
  to {
    opacity: 1;
    translate: 0;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    translate: 0 6rem;
  }
  to {
    opacity: 1;
    translate: 0;
  }
}

/* ============================================================
     2. NAVBAR PRINCIPALE (desktop)
     ============================================================ */

.navbar {
  position: absolute;
  width: 100%;
  height: 2.4rem;
  padding-inline: 1rem;

  display: flex;
  justify-content: space-between;
  align-items: flex-start;

  font-size: 0.7rem;
  line-height: 1.5rem;
  color: white;
  text-transform: uppercase;

  background: linear-gradient(
    rgba(var(--color-green-rgb), 0.35),
    rgba(var(--color-green-rgb), 0)
  );

  opacity: 0;
  translate: 0;
  animation: fade-in 2s 1s ease-in-out forwards;
  transition: visibility 0.3s ease-in-out;
}

.home .navbar {
  animation: slideDown 2.4s 3s ease-in-out forwards;
}
.scroll .navbar {
  display: none;
  opacity: 0;
}

@media (max-width: 800px) {
  .navbar {
    display: none;
  }
}

/* Liste principale */
nav.navbar > ul {
  width: 90%;
  margin: 0.5rem auto 0;
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: flex-start;
  z-index: 10;
  overflow: hidden;
  transition: font-size 0.6s ease-in-out;
}

/* Items de premier niveau */
nav.navbar > ul > li {
  list-style: none;
  display: inline-block;
  position: relative;
  text-align: center;
  margin-inline: 0.2rem;
  margin-bottom: clamp(0.5rem, -0.1667rem + 3.3333vw, 1.5rem);
  min-width: clamp(0rem, -7.9412rem + 35.2941vw, 7.5rem);
  font-size: 0.9rem;
  font-weight: 400;
  white-space: nowrap;
}

/* Liens */
nav.navbar ul a,
nav.navbar a {
  display: block;
  position: relative;
  margin: 0 auto;
  padding-inline: 0.2rem;
  text-decoration: none;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: #666;
  border-bottom: 1px solid transparent;
  width: fit-content;
  text-align: center;
  transition: border 0.5s ease;
}

.home nav.navbar a {
  color: #fff;
}

/* Soulignement animé au survol */
nav.navbar a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  translate: -50%;
  display: block;
  width: 0;
  height: 1px;
  background-color: #666;
  transition: width 0.2s ease-in-out;
}
.home nav.navbar a::after {
  background-color: white;
}
nav.navbar a:hover::after {
  width: 100%;
}

/* ============================================================
     3. SOUS-MENU DESKTOP
     ============================================================ */

/* Indicateur de sous-menu */
nav.navbar > ul > li > span {
  position: relative;
  display: block;
  margin: auto;
  width: fit-content;
}

nav.navbar > ul > li > span::before {
  content: "▼";
  position: absolute;
  bottom: -11px;
  left: 49%;
  font-size: 0.5rem;
  font-weight: 200;
  color: white;
  filter: opacity(0.6);
  transform: rotate(0deg);
}

nav.navbar > ul > li:hover span {
  width: 100%;
}
nav.navbar > ul > li:hover span::before {
  opacity: 0;
}

/* Sous-liste */
nav.navbar > ul > li ul {
  position: relative;
  top: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  width: 100%;
  max-height: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  transition: max-height 0.5s ease-in-out;
}

nav.navbar > ul > li:hover ul {
  max-height: 500px;
}

/* Items de sous-menu */
nav.navbar > ul > li > ul > li {
  display: none;
  width: 100%;
  text-align: center;
  overflow: hidden;
  border-inline: solid 1px #ccc;
}

nav.navbar > ul > li:hover ul > li {
  display: block;
  background: #fff;
}
nav.navbar > ul > li:hover ul > li a:hover {
  background: #dfdddd;
}

nav.navbar > ul > li > ul > li a {
  padding: 0.3rem 0.1rem;
  font-size: 0.8em;
  font-weight: normal;
  letter-spacing: -0.1ch;
  color: #333;
}

.sous-titre-menu {
  background: #e6e1e1;
  font-size: 0.8rem;
  text-transform: none;
  color: #333;
}

/* ============================================================
     4. BOUTON HAMBURGER
     ============================================================ */

.btn-menu {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 12;

  cursor: pointer;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0.6rem;

  font-family: inherit;
  font-size: 0.8rem;
  color: transparent;

  background-color: var(--color-green);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  transition: color 0.2s, background 0.3s;
}

@media (min-width: 800px) {
  .btn-menu {
    opacity: 0;
  }
  .btn-menu.visible {
    opacity: 1;
  }
}

/* État ouvert */
.btn-menu[aria-expanded="true"] {
  background: #fff;
}
.btn-menu[aria-expanded="true"] .btn-menu-icon span {
  opacity: 0;
}
.btn-menu[aria-expanded="true"] .btn-menu-icon::before {
  top: 50%;
  background: #333;
  transform: rotate(-45deg);
  transition: background 0.3s, transform 0.3s, top 0.3s;
}
.btn-menu[aria-expanded="true"] .btn-menu-icon::after {
  top: 50%;
  background: #333;
  transform: rotate(45deg);
  transition: background 0.3s, transform 0.3s, top 0.3s;
}

/* Labels */
.btn-menu-label {
  display: block;
}
.btn-menu-label:last-of-type {
  display: none;
}
.btn-menu[aria-expanded="true"] .btn-menu-label {
  display: none;
}
.btn-menu[aria-expanded="true"] .btn-menu-label:last-of-type {
  display: block;
}

/* Icône (3 traits) */
.btn-menu-icon {
  position: relative;
  display: block;
  width: 1.4rem;
  height: 14px;
  margin: 0 auto 5px;
}

.btn-menu-icon span,
.btn-menu-icon::before,
.btn-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: white;
}
.btn-menu-icon span {
  top: 8px;
  transition: transform 0.3s, opacity 0.3s;
}
.btn-menu-icon::before {
  top: 0;
  transition: background 0.3s, top 0.3s, transform 0.3s;
}
.btn-menu-icon::after {
  top: 16px;
  transition: background 0.3s, top 0.3s, transform 0.3s;
}

.btn-menu:hover .btn-menu-icon span {
  transform: translateX(4px);
}

/* État scroll */
.scroll .btn-menu {
  background-color: rgba(255, 255, 255, 0.8);
  border: solid 1px rgba(0, 0, 0, 0.35);
}
.scroll .btn-menu-icon span,
.scroll .btn-menu-icon::before,
.scroll .btn-menu-icon::after {
  background: #999;
}

/* ============================================================
     5. MENU SLIDE (mobile / hamburger ouvert)
     ============================================================ */

.menu-slide {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  padding: 0.5rem;
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  align-content: center;
  gap: 1rem;
}

.scroll .menu-slide {
  gap: 0;
}

@media (max-width: 600px) {
  .menu-slide {
    gap: 1rem;
  }
  .scroll .menu-slide {
    gap: 0;
  }
}

/* Panneau coulissant */
nav.menu-slide > ul {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 11;

  display: flex;
  flex-flow: column;
  justify-content: center;
  align-items: flex-start;
  gap: 3vh;

  width: min(100vw, 500px);
  height: 100vh;
  padding: 0 2rem;
  margin: 0;

  background: #f1f1f1;
  transform: translateX(-100%);
  transition: transform 0.4s ease-in-out;
}

/* Items */
nav.menu-slide ul li {
  list-style: none;
  white-space: nowrap;
  width: auto;
  max-width: fit-content;
  min-width: 120px;
}

nav.menu-slide > ul > li > span {
  display: block;
  padding-block: 0.6rem;
  margin-bottom: 6px;
  font-size: 1.2rem;
  text-align: center;
}
nav.menu-slide > ul > li > span:nth-child(n + 2) {
  margin-top: 2vh;
}

/* Liens */
nav.menu-slide a {
  position: relative;
  display: block;
  margin-inline: auto;
  padding: 0.5rem 0.2rem;
  max-width: fit-content;
  line-height: 1.2rem;
  font-size: 1.4rem;
  text-transform: uppercase;
  text-decoration: none;
  background: transparent;
}

nav.menu-slide a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  translate: -50%;
  display: block;
  width: 0;
  height: 1px;
  background-color: #666;
  transition: width 0.2s ease-in-out;
}
nav.menu-slide a:hover::after {
  width: 100%;
}

/* ============================================================
     6. SOUS-MENU MOBILE
     ============================================================ */

nav.menu-slide > ul > li > ul {
  position: relative;
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  gap: 1vw;
  padding: 0;
  border: 0;
  min-width: 360px;
  max-width: 100vw;
}

nav.menu-slide > ul > li > ul > li {
  display: inline-block;
  width: auto;
  max-width: fit-content;
  margin: 0;
  border: 0;
  text-align: left;
}

nav.menu-slide > ul > li > ul > li a {
  width: 100%;
  font-size: 0.9rem;
  line-height: 1.2rem;
  border: solid 1px transparent;
}

.sous-titre-menu a {
  min-width: 120px;
}

/* ============================================================
     7. MENUS ANNEXES
     ============================================================ */

/* --- Langues --- */
nav.menu-langues {
  position: absolute;
  top: 0;
  right: 0.25rem;
  z-index: 1;
  width: fit-content;
  height: 1.8rem;
}

nav.menu-langues ul {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  z-index: 2;
}

nav.menu-langues li {
  min-width: fit-content;
  margin-block: 4px;
  transition: 0.3s ease-in-out;
}
nav.menu-langues li:nth-child(2) {
  translate: 0 -1.8rem;
  opacity: 0;
  z-index: 10;
}
nav.menu-langues ul:hover li:nth-child(2) {
  translate: 0;
  opacity: 1;
}

nav.menu-langues a {
  display: block;
  width: 1.8rem;
  height: 1.8rem;
  font-size: 0.7rem;
  line-height: 2.4;
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  color: #666;
  border: solid 1px #666;
  border-radius: 50%;
  transition: all 0.3s ease-in-out;
}
.home nav.menu-langues a {
  color: white;
  border-color: white;
}
.scroll nav.menu-langues a {
  color: #666;
  border-color: #666;
}
.scroll nav.menu-langues li:nth-child(2) a {
  background: white;
}

/* --- Bouton Réserver --- */
nav.menu-slide .reserver-menu {
  font-size: 0.6rem;
}

nav.menu-slide .reserver-menu a {
  padding: 0.2rem 0.25rem;
  text-decoration: none;
  text-transform: uppercase;
  color: white;
  border: 1px solid transparent;
  background-color: rgba(0, 0, 0, 0.05);
  transition: 0.2s ease-in-out;
}
nav.menu-slide .reserver-menu a:hover {
  background: white;
  color: #666;
}

.scroll nav.menu-slide .reserver-menu a {
  color: #666;
}
.scroll nav.menu-slide .reserver-menu a:hover {
  border-color: #666;
}

/* --- Instagram --- */
div.instagram {
  display: none; /* masqué — conserver display:none si intentionnel */
  position: absolute;
  top: 0.5rem;
  right: 2.75rem;
  z-index: 1000;
  height: 2.4rem;
}

div.instagram svg,
.scroll div.instagram svg {
  width: 36px;
  height: 36px;
}
div.instagram svg {
  fill: #fff;
}
.scroll div.instagram svg {
  fill: #666;
}
