/* ============================================================
   VALEXIS — navigation.css
   Navigation principale (top bar + menu mobile accordéon + sous-menus
   déroulants desktop). Source unique : modifier ici se propage
   partout. Chargé depuis le <head> de toutes les pages.
   Mobile-first.
   ============================================================ */

.nav {
  position: sticky; top: 0; z-index: 100;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  background: rgba(251,251,253,0.9);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: var(--space-4) 0; gap: var(--space-6); }
.nav-logo { display: flex; align-items: baseline; gap: 8px; }
.nav-logo-mark { font-family: var(--font-display); font-weight: 600; font-size: 18px; letter-spacing: 0.16em; color: var(--navy-900); }
.nav-logo-sub { font-family: var(--font-display); font-weight: 300; font-style: italic; font-size: 11px; color: var(--gold-600); }

.nav-menu { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.nav-menu a {
  font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm);
  color: var(--fg1); padding: 10px 0; display: block; position: relative;
  transition: color var(--dur-base) var(--ease-elegant);
}
.nav-menu a.active { color: var(--accent); }
.nav-cta { display: none; }

/* Burger mobile */
.nav-burger {
  width: 40px; height: 40px; display: inline-flex; flex-direction: column;
  justify-content: center; gap: 5px; padding: 8px;
}
.nav-burger span { height: 2px; background: var(--navy-900); border-radius: 2px; transition: all var(--dur-base) var(--ease-elegant); }

/* Menu mobile : caché, déployé via body.nav-open */
.nav-menu {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--paper); border-bottom: 1px solid var(--line);
  padding: var(--space-4) 20px var(--space-6);
  max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height var(--dur-base) var(--ease-elegant), opacity var(--dur-base) var(--ease-elegant);
}
body.nav-open .nav-menu { max-height: calc(100vh - 64px); opacity: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
body.nav-open .nav-burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
body.nav-open .nav-burger span:nth-child(2) { opacity: 0; }
body.nav-open .nav-burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sous-menu — mobile : liste indentée, toujours visible */
.nav-trigger {
  font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm);
  color: var(--fg1); padding: 10px 0; cursor: pointer; border: 0; background: none;
  display: inline-flex; align-items: center;
}
.nav-caret { display: none; }
.nav-sub { margin: 2px 0 8px; padding: 0 0 0 16px; }
.nav-sub-head { display: none; }
.nav-feat { display: none; }
.nav-sub .nav-sub-link {
  display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: start;
  padding: 8px 0;
}
.nav-sub-num {
  font-family: var(--font-display); font-weight: 400; font-size: 11px;
  color: var(--gold-600); padding-top: 3px; letter-spacing: 0.04em;
}
.nav-sub-tx { display: flex; flex-direction: column; gap: 1px; }
.nav-sub .nav-sub-link .t { font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm); color: var(--navy-900); }
.nav-sub .nav-sub-link .s { font-size: 11px; color: var(--fg3); }
.nav-sub .nav-sub-all {
  display: block; padding: 8px 0 8px 34px;
  font-family: var(--font-display); font-weight: 500; font-size: var(--text-sm);
  color: var(--gold-700);
}
.nav-sub .nav-sub-all::after { content: " \2192"; }

/* Sous-menu — mobile : accordéon repliable */
@media (max-width: 959.98px) {
  .nav-menu > li { border-top: 1px solid var(--line); }
  .nav-menu > li:first-child { border-top: 0; }
  .nav-menu > li > a { padding: 14px 0; }
  .nav-trigger {
    padding: 14px 0; width: 100%;
    display: flex; align-items: center; justify-content: space-between;
  }
  .nav-caret {
    display: block; width: 7px; height: 7px; margin-left: 12px; flex: none;
    border-right: 1.5px solid var(--gold-600); border-bottom: 1.5px solid var(--gold-600);
    transform: rotate(45deg); transition: transform var(--dur-base) var(--ease-elegant);
  }
  .nav-has-sub.open .nav-caret { transform: rotate(-135deg); }
  .nav-sub {
    margin: 0; padding: 0 0 0 16px;
    max-height: 0; overflow: hidden; opacity: 0;
    transition: max-height var(--dur-base) var(--ease-elegant), opacity var(--dur-base) var(--ease-elegant);
  }
  .nav-has-sub.open .nav-sub { max-height: 660px; opacity: 1; padding-bottom: 12px; }
}

@media (min-width: 960px) {
  .nav-burger { display: none; }
  .nav-menu {
    position: static; flex-direction: row; align-items: center; gap: var(--space-8);
    background: none; border: 0; padding: 0; max-height: none; opacity: 1; overflow: visible;
  }
  .nav-menu > li > a { padding: 8px 0; }
  .nav-menu > li > a::after {
    content: ""; position: absolute; bottom: 2px; left: 0; height: 1px; width: 0;
    background: var(--gold-500); transition: width var(--dur-base) var(--ease-elegant);
  }
  .nav-menu > li > a:hover { color: var(--navy-900); }
  .nav-menu > li > a:hover::after, .nav-menu > li > a.active::after { width: 100%; }
  .nav-cta { display: flex; align-items: center; }

  /* Déclencheur de panneau */
  .nav-trigger { padding: 8px 0; transition: color var(--dur-base) var(--ease-elegant); }
  .nav-trigger:hover, .nav-has-sub.open .nav-trigger { color: var(--navy-900); }
  .nav-has-sub { position: relative; }
  .nav-caret {
    display: inline-block; width: 0; height: 0; margin-left: 6px; vertical-align: middle;
    border-left: 4px solid transparent; border-right: 4px solid transparent;
    border-top: 5px solid currentColor; opacity: .5;
    transition: transform var(--dur-base) var(--ease-elegant);
  }
  .nav-has-sub.open .nav-caret { transform: rotate(180deg); opacity: .8; }

  /* Panneau déroulant : liste numérotée + bloc featured */
  .nav-sub {
    position: absolute; top: calc(100% + 12px); left: 0;
    width: 500px; padding: 8px; margin: 0;
    display: grid; grid-template-columns: 1.5fr 1fr; gap: 8px;
    background: var(--bone); border: 1px solid var(--line);
    border-radius: 16px; box-shadow: var(--shadow-lg);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity var(--dur-base) var(--ease-elegant), transform var(--dur-base) var(--ease-elegant), visibility var(--dur-base);
  }
  .nav-sub--right { left: auto; right: 0; }
  .nav-sub--wide { width: 760px; grid-template-columns: 1.1fr 1.3fr 1fr; gap: 4px; }
  .nav-has-sub.open .nav-sub { opacity: 1; visibility: visible; transform: translateY(0); }

  .nav-sub-list { padding: 14px 10px; }
  .nav-sub-head {
    display: block; font-family: var(--font-display); font-weight: 500; font-size: 11px;
    text-transform: uppercase; letter-spacing: 0.16em; color: var(--gold-700);
    padding: 0 8px 10px;
  }
  .nav-sub .nav-sub-link {
    grid-template-columns: 30px 1fr; gap: 10px;
    padding: 10px 8px; border-radius: 10px;
    transition: background var(--dur-base) var(--ease-elegant);
  }
  .nav-sub .nav-sub-link:hover { background: var(--paper); }
  .nav-sub .nav-sub-link .t { transition: color var(--dur-base) var(--ease-elegant); }
  .nav-sub .nav-sub-link:hover .t { color: var(--gold-700); }
  .nav-sub a::after { display: none; }
  .nav-sub .nav-sub-all {
    margin-top: 4px; padding: 10px 12px 4px;
    border-top: 1px solid var(--line); color: var(--fg2);
    transition: color var(--dur-base) var(--ease-elegant);
  }
  .nav-sub .nav-sub-all:hover { color: var(--gold-700); }

  /* Bloc featured */
  .nav-feat {
    display: flex; flex-direction: column;
    background: var(--navy-900); border-radius: 12px;
    padding: 22px 20px; position: relative; overflow: hidden;
  }
  .nav-feat::before {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(184,146,75,0.18) 1px, transparent 1px);
    background-size: 20px 20px; opacity: .7;
  }
  .nav-feat > * { position: relative; z-index: 1; }
  .nav-feat-e {
    font-family: var(--font-display); font-weight: 500; font-size: 10.5px;
    text-transform: uppercase; letter-spacing: 0.16em; color: var(--gold-300);
    margin: 0 0 10px;
  }
  .nav-feat-h {
    font-family: var(--font-display); font-weight: 500; font-size: 16px;
    color: var(--silver); line-height: 1.35; margin: 0;
  }
  .nav-feat-p {
    font-size: 12px; color: var(--fg-inv2); line-height: 1.6; margin: 8px 0 16px;
  }
  .nav-feat .nav-feat-b {
    margin-top: auto; align-self: flex-start;
    font-family: var(--font-display); font-weight: 500; font-size: 12.5px;
    color: var(--navy-900); background: var(--gold-500);
    border-radius: 999px; padding: 9px 16px;
    transition: background var(--dur-base) var(--ease-elegant);
  }
  .nav-feat .nav-feat-b:hover { background: var(--gold-400); }
}
