/*
  ========================================================================
    Navigation mobile — commun à toutes les pages du site.

    Logo à gauche, bouton hamburger à droite ; au clic, une couche
    recouvre le fond et les boutons arrivent centrés en colonne.

    À charger APRÈS la feuille de style de la page (style.css,
    extraits.css, userBoard.css, dashboard.css…) pour primer sur
    leurs propres media queries de barre de navigation.

    Le markup est produit par site/partials/header.php.
  ========================================================================
*/

/* Le bouton n'existe qu'en mobile */
.navToggle { display: none; }

@media (max-width: 860px) {

  .nav {
    padding: 12px 16px;
    gap: 12px;
  }

  /* Le logo reste visible par-dessus la couche */
  .brand         { position: relative; z-index: 120; }
  .brand h1      { font-size: 12px; }
  .brand h1 span { display: block; font-size: 10px; }
  .seal          { width: 36px; height: 36px; }

  /* ─── Le bouton ─── */
  .navToggle {
    position: relative;
    z-index: 120;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(201,168,76,.35);
    background: rgba(255,255,255,.04);
    cursor: pointer;
    transition: border-color 220ms ease, background 220ms ease;
  }

  .navToggle-bars {
    position: relative;
    display: block;
    width: 20px;
    height: 14px;
  }

  .navToggle-bars i {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1.5px;
    border-radius: 2px;
    background: var(--gold2, #e8c876);
    transition: transform 280ms cubic-bezier(.6,.05,.3,1), opacity 160ms ease;
  }

  .navToggle-bars i:nth-child(1) { top: 0; }
  .navToggle-bars i:nth-child(2) { top: 50%;  transform: translateY(-50%); }
  .navToggle-bars i:nth-child(3) { top: 100%; transform: translateY(-100%); }

  /* ─── Le bouton, une fois ouvert : croix ─── */
  body.nav-open .navToggle {
    border-color: rgba(201,168,76,.7);
    background: rgba(201,168,76,.12);
  }
  body.nav-open .navToggle-bars i:nth-child(1) { top: 50%; transform: translateY(-50%) rotate(45deg); }
  body.nav-open .navToggle-bars i:nth-child(2) { opacity: 0; transform: translateY(-50%) scaleX(.2); }
  body.nav-open .navToggle-bars i:nth-child(3) { top: 50%; transform: translateY(-50%) rotate(-45deg); }

  /* ─── La couche qui recouvre le fond ─── */
  /* NB : le header porte un backdrop-filter, il devient donc le containing
     block de cet enfant fixed — d'où les dimensions explicites en vw/dvh
     plutôt qu'un inset: 0. Le header étant collé en haut, top/left 0
     correspond bien au coin haut-gauche de l'écran. */
  .navlinks {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 90px 24px 56px;
    background:
      radial-gradient(ellipse 700px 500px at 50% 12%,  rgba(201,168,76,.12) 0%, transparent 60%),
      radial-gradient(ellipse 600px 500px at 50% 100%, rgba(139,30,47,.14)  0%, transparent 60%),
      rgba(8,7,9,.95);
    backdrop-filter: blur(18px) saturate(1.3);
    -webkit-backdrop-filter: blur(18px) saturate(1.3);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 300ms ease, visibility 0s linear 300ms;
  }

  body.nav-open .navlinks {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 300ms ease, visibility 0s;
  }

  /* ─── Les boutons dans la couche ─── */
  .navlinks .pill {
    width: min(320px, 80vw);
    justify-content: center;
    padding: 16px 22px;
    font-size: 13px;
    letter-spacing: .14em;
    border-radius: 14px;
    opacity: 0;
    transform: translateY(16px);
    transition:
      opacity 340ms ease,
      transform 340ms cubic-bezier(.22,.9,.3,1),
      border-color 200ms ease,
      background 200ms ease;
  }

  .navlinks .pill:hover { transform: translateY(16px); }

  body.nav-open .navlinks .pill,
  body.nav-open .navlinks .pill:hover {
    opacity: 1;
    transform: translateY(0);
  }

  /* Apparition en cascade */
  body.nav-open .navlinks > *:nth-child(1) { transition-delay:  80ms; }
  body.nav-open .navlinks > *:nth-child(2) { transition-delay: 130ms; }
  body.nav-open .navlinks > *:nth-child(3) { transition-delay: 180ms; }
  body.nav-open .navlinks > *:nth-child(4) { transition-delay: 230ms; }
  body.nav-open .navlinks > *:nth-child(5) { transition-delay: 280ms; }
  body.nav-open .navlinks > *:nth-child(6) { transition-delay: 330ms; }

  /* Le séparateur devient un filet horizontal */
  .navlinks .navsep {
    display: block;
    width: min(320px, 80vw);
    height: 1px;
    margin: 10px 0;
    background: linear-gradient(90deg, transparent, rgba(201,168,76,.4), transparent);
    opacity: 0;
    transition: opacity 340ms ease;
  }
  body.nav-open .navlinks .navsep { opacity: 1; }
}
