/* ======= Styles globaux ======= */

body {
  margin: 0;
  padding-top: 90px; /* place pour header */
  font-family: Arial, sans-serif;
}

#menu {
  position: fixed;
  top: 0;
  width: 100%;
  background: white;
  z-index: 1000;
  box-shadow: none;
  transition: all 0.4s ease;
  padding: 30px 0;
}

/* Menu shrink au scroll */
#menu.shrink {
  padding: 20px 0; /* un peu plus d’espace sous burger */
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* Container nav et burger */
.nav-container {
  max-width: 1200px;
  margin: auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between; /* logo à gauche, burger à droite */
  align-items: center;
  position: relative;
}

/* Zone logo */
.logo {
  font-weight: bold;
  font-size: 24px;
  color: #333;
}

/* Menu principal desktop */
.navbar {
  display: flex;
  gap: 40px;
  font-weight: bold;
  font-size: 18px;
  border-left: 3px solid #ccc; /* ligne ombrée gauche */
}

.navbar a {
  color: #333;
  text-decoration: none;
  padding: 5px 0;
  cursor: pointer;
}

/* Burger - bouton menu hamburger */
.burger {
  display: none;
  width: 30px;
  height: 22px;
  position: relative;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
  margin-left: 20px;
  z-index: 10001;
  transition: opacity 0.3s ease;
}

/* Cacher burger quand menu ouvert */
.navbar.open ~ .burger {
  opacity: 0;
  pointer-events: none;
}

.burger span {
  display: block;
  height: 4px;
  background: #333;
  margin: 4px 0;
  border-radius: 2px;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 50%;
  right: 20px;
  width: 30px;
  height: 30px;
  cursor: pointer;
  background: transparent;
  border: none;
  z-index: 10002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: opacity 0.3s ease;
  transform: translateY(-50%);
}

.navbar.open + .close-btn {
  display: flex;
  opacity: 1;
}

.close-btn span {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}

.close-btn span::before,
.close-btn span::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 4px;
  background-color: #000;
  border-radius: 2px;
  transform-origin: center;
}

.close-btn span::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.close-btn span::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {

  /* Affiche burger */
  .burger {
    display: block;
  }

  /* Menu desktop caché */
  .navbar {
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    right: -100%;    /* caché à droite hors écran */
    width: 100%;     /* largeur complète */
    background: white;
    box-shadow: -4px 0 10px rgba(0, 0, 0, 0.2);
    border-radius: 0;
    transition: right 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    padding-top: 90px;
    overflow-y: auto;
    border-left: 3px solid #ccc; /* ligne ombrée gauche */
  }

  /* Menu ouvert */
  .navbar.open {
    right: 0;
  }

  .navbar a {
    display: block;
    padding: 12px 30px 12px 20px; /* marge plus large à gauche */
    border-top: 1px solid #eee;
    width: 100%;
    box-sizing: border-box;
    color: #000; /* texte noir sur fond blanc */
    font-weight: bold;
    font-size: 20px;

    /* Animation initiale pour cacher */
    opacity: 0;
    transform: translateY(80px);
    transition: none;
  }

  /* Animation ouverture - cascade du bas vers le haut */
  @keyframes appear-up {
    0% {
      opacity: 0;
      transform: translateY(80px);
    }
    100% {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Animation fermeture - cascade inversée du haut vers le bas */
  @keyframes disappear-down {
    0% {
      opacity: 1;
      transform: translateY(0);
    }
    100% {
      opacity: 0;
      transform: translateY(80px);
    }
  }

  /* Ouverture : liens apparaissent en cascade */
  .navbar.open a:nth-child(1) {
    animation: appear-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.15s;
  }
  .navbar.open a:nth-child(2) {
    animation: appear-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.3s;
  }
  .navbar.open a:nth-child(3) {
    animation: appear-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.45s;
  }

  /* Fermeture : liens disparaissent en cascade inverse, avec descente visible */
  .navbar.closing a:nth-child(1) {
    animation: disappear-down 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.45s;
  }
  .navbar.closing a:nth-child(2) {
    animation: disappear-down 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.3s;
  }
  .navbar.closing a:nth-child(3) {
    animation: disappear-down 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: 0.15s;
  }

  .navbar a:first-child {
    border-top: none;
  }
}
