/*
 * phyto_silentmenu — menu principal (maquette A5 : barre plate, sous-menus en colonnes, tiroir mobile).
 * Surchargeable par thème : themes/<thème>/modules/phyto_silentmenu/views/css/front.css
 *
 * Point de bascule desktop/mobile : 992 px.
 *   --psm-bp documente la valeur et est lu par front.js (constante BREAKPOINT = 992 par défaut).
 *   Les media queries ne pouvant pas lire une variable CSS, elles utilisent (max-width: 991.98px).
 *   Un thème qui change le point de bascule modifie --psm-bp ET les media queries de ce fichier.
 */

.psm,
.psm-backdrop,
.psm-preview {
  --psm-bp: 992px;
  --psm-ink: #231d1a;
  --psm-ink-2: #4a423d;
  --psm-muted: #8a817b;
  --psm-line: #ece7e2;
  --psm-bg: #ffffff;
  --psm-bg-soft: #faf7f2;
  --psm-band: #ebebeb;
  --psm-band-hover: #dedede;
  --psm-gold: #feb11c;
  --psm-gold-soft: #fff4dc;
  --psm-green: #3f6b3a;
  --psm-green-soft: #e9f1e5;
  --psm-red: #d8432f;
  --psm-blue: #00a1e1;
  --psm-radius: 10px;
  --psm-shadow: 0 18px 40px -12px rgba(35, 29, 26, .25);
  --psm-font: Lato, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --psm-z-sub: 1000;
  --psm-z-drawer: 1060;
}

/* ---------- Remise à zéro locale (le thème et Bootstrap stylent ul, a, button) ---------- */
.psm,
.psm * {
  box-sizing: border-box;
}
.psm {
  font-family: var(--psm-font);
  color: var(--psm-ink);
  -webkit-font-smoothing: antialiased;
}
.psm ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* :where() garde ces remises à zéro à la spécificité d'un simple sélecteur d'élément,
   pour que les règles .psm-link, .psm-toggle… ci-dessous l'emportent. */
:where(.psm) a,
:where(.psm) a:hover,
:where(.psm) a:focus {
  color: inherit;
  text-decoration: none;
}
:where(.psm) button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
}
.psm a:focus-visible,
.psm button:focus-visible {
  outline: 2px solid var(--psm-gold);
  outline-offset: -2px;
}
.psm svg {
  display: block;
}
.psm-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Badges (tags) et compteurs ---------- */
.psm-badge {
  display: inline-block;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 4px;
  line-height: 1;
  vertical-align: 2px;
  margin-left: 6px;
}
.psm-badge--new { background: var(--psm-gold); color: var(--psm-ink); }
.psm-badge--soon { background: var(--psm-green-soft); color: var(--psm-green); }
.psm-badge--hot { background: var(--psm-red); color: #fff; }
.psm-badge--blue { background: var(--psm-blue); color: #fff; }
.psm-count {
  color: var(--psm-muted);
  font-size: 12px;
  margin-left: 4px;
}

/* ---------- Bandeau d'aperçu ---------- */
.psm-preview {
  font-family: var(--psm-font);
  background: var(--psm-gold-soft);
  border-bottom: 1px solid var(--psm-gold);
  color: var(--psm-ink);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 6px 16px;
}
.psm-preview-exit {
  margin-left: 12px;
  font-weight: 400;
  text-decoration: underline;
  color: inherit;
}

/* ============================================================
   Desktop (>= 992 px) : barre centrée, sous-menus au survol / clic
   ============================================================ */
.psm {
  border-top: 1px solid var(--psm-line);
}
.psm-drawer-head,
.psm-backdrop {
  display: none;
}
.psm-bar {
  display: flex;
  justify-content: center;
  align-items: stretch;
  gap: 18px;
}
/* Espaceurs : la barre reste centrée, les entrées « alignées à droite » passent après le second. */
.psm-bar::before,
.psm-bar::after {
  content: "";
  flex: 1 1 0;
}
.psm-bar::after { order: 1; }
.psm-item--right { order: 2; }
/* Position « À gauche » (réglage BO) : sans l'espaceur de gauche, les onglets partent du bord gauche ;
   l'espaceur de droite garde les onglets « alignés à droite » au bord droit. */
.psm--left .psm-bar::before { display: none; }

.psm-item {
  position: relative;
  display: flex;
  align-items: stretch;
}
/* Couleurs par onglet (variables posées en style inline sur .psm-item par menu.tpl) :
   uniquement sur les enfants directs de l'onglet, jamais dans le sous-menu. Le chevron suit currentColor. */
.psm-item > .psm-link,
.psm-item > .psm-toggle {
  color: var(--psm-item-color, var(--psm-ink));
}
.psm-sub {
  --psm-item-color: initial;
  --psm-item-hover: initial;
}

.psm-link,
.psm-toggle {
  display: flex;
  align-items: center;
  height: 52px;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.psm-link {
  gap: 4px;
  padding: 0 16px;
}
.psm-item--sub > .psm-link {
  padding-right: 4px;
}
.psm-toggle {
  padding: 0 16px 0 0;
}
.psm-chev {
  width: 10px;
  height: 10px;
  transition: transform .2s;
}
.psm-item.is-open > .psm-toggle .psm-chev {
  transform: rotate(180deg);
}
.psm-item:hover > .psm-link,
.psm-item:hover > .psm-toggle,
.psm-item.is-open > .psm-link,
.psm-item.is-open > .psm-toggle,
.psm-item.is-current > .psm-link,
.psm-item.is-current > .psm-toggle {
  border-bottom-color: var(--psm-item-hover, var(--psm-gold));
}
.psm-link .psm-badge {
  vertical-align: 0;
}

/* Sous-menu */
.psm-sub {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: var(--psm-z-sub);
  display: grid;
  grid-template-columns: repeat(var(--psm-cols, 1), minmax(200px, 1fr));
  min-width: 240px;
  padding: 0;
  overflow: hidden;
  background: var(--psm-bg);
  border: 1px solid var(--psm-line);
  border-radius: 0 0 var(--psm-radius) var(--psm-radius);
  box-shadow: var(--psm-shadow);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: .18s;
}
.psm-item--sub:not(.is-suppressed):hover > .psm-sub,
.psm-item.is-open > .psm-sub {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.psm-item--right > .psm-sub {
  left: auto;
  right: 0;
}

/* Colonnes */
.psm-col {
  padding: 10px 0;
}
.psm-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.psm-a,
.psm-col-title {
  display: block;
  padding: 8px 20px;
}
.psm-a {
  font-size: 14px;
}
a.psm-a:hover {
  background: var(--psm-bg-soft);
  color: #000;
}
.psm-col-title {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 4px;
}

/* Plusieurs colonnes (A5 « Seeds ») */
.psm-col:not(:only-of-type) {
  padding: 22px 8px 18px;
}
.psm-col:not(:only-of-type) .psm-a,
.psm-col:not(:only-of-type) .psm-col-title {
  padding: 7px 16px;
  border-radius: 6px;
}
.psm-list--sub {
  margin-top: 2px;
}

/* Colonne à « têtes de groupe » : liens de niveau 3 en gras, séparés par un filet */
.psm-col--heads > .psm-list > .psm-entry > .psm-a {
  font-size: 15px;
  font-weight: 900;
  margin-bottom: 4px;
}
.psm-col--heads > .psm-list > .psm-entry + .psm-entry > .psm-a {
  margin: 0;
  padding-top: 14px;
  padding-bottom: 12px;
  border-top: 1px solid var(--psm-line);
  border-radius: 0;
}

/* Bande grise « voir tout » */
.psm-all {
  grid-column: 1 / -1;
  display: block;
  padding: 14px 20px;
  background: var(--psm-band);
  color: var(--psm-ink);
  font-size: 15px;
  font-weight: 500;
}
.psm .psm-all:hover {
  background: var(--psm-band-hover);
  color: var(--psm-ink);
}
.psm-col:not(:only-of-type) ~ .psm-all {
  padding: 14px 24px;
}
.psm-all--mobile {
  display: none;
}

/* ============================================================
   Mobile (< 992 px) : tiroir latéral gauche, accordéons
   ============================================================ */
@media (max-width: 991.98px) {
  .psm {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--psm-z-drawer);
    width: min(86vw, 360px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--psm-bg);
    border: 0;
    box-shadow: var(--psm-shadow);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .25s, visibility 0s linear .25s;
  }
  html.psm-open .psm {
    transform: none;
    visibility: visible;
    transition: transform .25s, visibility 0s;
  }
  html.psm-open,
  html.psm-open body {
    overflow: hidden;
  }
  .psm-backdrop {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: calc(var(--psm-z-drawer) - 1);
    background: rgba(0, 0, 0, .4);
  }
  html.psm-open .psm-backdrop {
    display: block;
  }

  .psm-drawer-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--psm-line);
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
  }
  .psm-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: -8px -8px -8px 0;
  }

  .psm-bar {
    flex-direction: column;
    gap: 0;
  }
  .psm-bar::before,
  .psm-bar::after {
    display: none;
  }
  .psm-item--right {
    order: 0;
  }
  .psm-item {
    flex-wrap: wrap;
    border-bottom: 1px solid var(--psm-line);
  }
  .psm-link,
  .psm-toggle {
    height: 54px;
    border-bottom: 0;
  }
  .psm-link,
  .psm-item--sub > .psm-link {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 20px;
  }
  .psm-item--sub > .psm-link {
    padding-right: 0;
  }
  .psm-toggle {
    flex: 0 0 54px;
    justify-content: center;
    padding: 0;
  }
  .psm-item.is-current > .psm-link {
    box-shadow: inset 3px 0 0 var(--psm-gold);
  }

  .psm-sub,
  .psm-item--right > .psm-sub {
    position: static;
    flex: 0 0 100%;
    display: none;
    min-width: 0;
    padding: 6px 0;
    background: var(--psm-bg-soft);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  /* Pas de règle :hover ici : sur écran tactile le survol « colle » à l'élément touché. */
  .psm-item.is-open > .psm-sub {
    display: block;
  }
  .psm-col,
  .psm-col:not(:only-of-type) {
    padding: 0;
  }
  /* Colonnes empilées : elles se lisent comme une seule liste. Pas d'espace propre aux colonnes
     entre elles ; la jonction reprend exactement le filet entre deux têtes de groupe
     (écart de 2 px de .psm-list, filet sur toute la largeur du lien, 14 px / 12 px). */
  .psm-col:not(:only-of-type) {
    padding: 0 4px;
  }
  .psm-sub > .psm-col:first-of-type {
    padding-top: 10px;
  }
  .psm-sub > .psm-col:last-of-type {
    padding-bottom: 10px;
  }
  .psm-col + .psm-col {
    padding-top: 2px;
  }
  .psm-col + .psm-col > .psm-col-title,
  .psm-col + .psm-col > .psm-list:first-child > .psm-entry:first-child > .psm-a {
    margin: 0;
    padding-top: 14px;
    padding-bottom: 12px;
    border-top: 1px solid var(--psm-line);
    border-radius: 0;
  }
  /* Titre → premier lien : même écart que tête de groupe → sous-liens (.psm-list--sub). */
  .psm-col + .psm-col > .psm-col-title + .psm-list {
    margin-top: 2px;
  }
  .psm-all,
  .psm-col:not(:only-of-type) ~ .psm-all {
    margin-bottom: -6px;
    padding: 14px 20px;
    border-radius: 0;
  }
  .psm-all--mobile {
    display: block;
    margin: -6px 0 0;
    background: transparent;
    font-weight: 700;
    border-bottom: 1px solid var(--psm-line);
  }
}
