/* ================================================================
   Site Header — Scerutti
   ================================================================ */

/* ── Variables ─────────────────────────────────────────────────── */
.site-header {
  --sh-bg:         var(--wp--preset--color--gris-clair, #eff0f2);
  --sh-color:      var(--wp--preset--color--noir, #260e0c);
  --sh-rouge:      var(--wp--preset--color--rouge, #da5241);
  --sh-font:       var(--wp--preset--font-family--monument-condensed, "PPMonumentCondensed", sans-serif);
  /* Fluid : 1.15rem @1100px → 1.375rem @1400px → 1.525rem @1600px */
  --sh-size:       clamp(1.15rem, 0.325rem + 1.2vw, 1.525rem);
  --sh-tracking:   0.04em;   /* tracking 40 → 40/1000em */
  /* Fluid : 215px @1100px → 252px @1400px → 285px @1600px */
  --sh-logo-w:     clamp(215px, 79px + 12.33vw, 285px);
  /* Fluid : 1.25rem @1100px → 1.75rem @1600px */
  --sh-bar-py:     clamp(1.25rem, 0.65rem + 0.55vw, 1.75rem);
  --sh-bar-px:     2.5rem;
  /* Fluid : 0.625rem @1100px → 1rem @1600px */
  --sh-cats-py:    clamp(0.625rem, 0.15rem + 0.44vw, 1rem);
  --sh-cats-px:    2.5rem;
  /* Fluid : hauteur barre cats & languette — 44px @1100px → 56px @1600px */
  --sh-cats-h:     clamp(44px, 20px + 2.2vw, 56px);
  --sh-z:          100;
}

/* ── Conteneur principal ─────────────────────────────────────────*/
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: var(--sh-z);
  background: #fff;
  color: var(--sh-color);
  /* overflow visible : permet à la languette de déborder en bas */
  overflow: visible;
}

/* ── Barre principale : [nav gauche] [logo] [nav droite] ─────────*/
.site-header__bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: var(--sh-bar-py) var(--sh-bar-px);
  overflow: visible;
}

/* ── Logo ────────────────────────────────────────────────────────*/
.site-header__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  line-height: 0;
  position: relative;
  cursor: pointer;
  user-select: none;
}

.site-header__logo,
.site-header__logo * {
  cursor: pointer;
}

.site-header__logo-img {
  width: var(--sh-logo-w);
  height: auto;
  display: block;
  transition: opacity 0.2s;
}

/* Le logo plein est positionné par-dessus le logo normal */
.site-header__logo-img--plein {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
}

.site-header__logo:hover .site-header__logo-img--normal {
  opacity: 0;
}

.site-header__logo:hover .site-header__logo-img--plein {
  opacity: 1;
}

/* ── Menus gauche & droite ───────────────────────────────────────*/
.site-header__nav { display: flex; }
.site-header__nav--gauche { flex: 1; justify-content: flex-start; }
.site-header__nav--droite { flex: 1; justify-content: flex-end; }

/* Menus décalés vers le bas par rapport au logo */
.site-header__nav--gauche,
.site-header__nav--droite {
  align-self: flex-end;
  margin-bottom: -0.75rem;
}

/* ── Liste de menu ───────────────────────────────────────────────*/
.sh-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 2.4rem;
}

.sh-menu > li {
  position: relative;
}

.sh-menu > li > a {
  display: block;
  font-family: var(--sh-font);
  font-size: var(--sh-size);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--sh-tracking);
  color: var(--sh-color);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.2em 0;
  line-height: 1;
  transition: color 0.2s;
  position: relative;
  z-index: 1;
}

.sh-menu > li > a:hover,
.sh-menu > li.current-menu-item > a,
.sh-menu > li.current-menu-ancestor > a {
  color: var(--sh-rouge);
}

/* ── Item « Produits » — rouge, non-clicable ─────────────────────*/
.sh-menu > li.menu-produits > a {
  color: var(--sh-rouge) !important;
  pointer-events: none;
  cursor: default;
}

/* ── Languette-produit sous l'item « Produits » ──────────────────*/
/* Injectée via le filtre walker_nav_menu_start_el */
.sh-menu__languette {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  /* Compense la distance li-bottom → bar-bottom (padding - marge nav) */
  margin-top: calc(-44px + var(--sh-bar-py) - 0.75rem);
  line-height: 0;
  pointer-events: none;
  z-index: -1;         /* derrière le texte du menu */
  color: #eff0f2;      /* couleur exacte de la barre catégories */
}

.sh-menu__languette svg {
  display: block;
  width: auto;
  height: 44px;
}

/* ── Sous-menu WP (SERVICES ▼, etc.) ────────────────────────────*/
.sh-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 220px;
  background: var(--sh-bg);
  box-shadow: 0 8px 24px rgba(38,14,12,0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 10;
}

.sh-menu > li:hover > .sub-menu,
.sh-menu > li:focus-within > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sh-menu .sub-menu li a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-family: var(--sh-font);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: var(--sh-tracking);
  color: var(--sh-color);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.sh-menu .sub-menu li a:hover,
.sh-menu .sub-menu > li.current-menu-item > a {
  color: var(--sh-rouge);
  background: rgba(38,14,12,0.04);
}

/* ── Bouton CONTACT (classe CSS "header-cta" dans menus WP) ──────*/
.sh-menu > li.header-cta > a {
  background: var(--sh-rouge);
  color: #fff !important;
  padding: 0.45em 1.2em;
  border-radius: 50px;
  transition: background 0.2s;
}

.sh-menu > li.header-cta > a:hover {
  background: var(--sh-color);
}

/* ── Row 2 — catégories produits ─────────────────────────────────*/
.site-header__cats {
  position: relative;
  z-index: 1;
  /* Fluid : 44px @1100px → 56px @1600px */
  min-height: var(--sh-cats-h);
  display: flex;
  align-items: center;
  padding: var(--sh-cats-py) var(--sh-cats-px);
  background-color: #eff0f2 !important;
  overflow: visible;
}

.sh-cats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  /* Aligné à gauche comme dans la maquette */
  justify-content: flex-start;
  gap: 2.5rem;
}

.sh-cats__item { position: relative; }

.sh-cats__link {
  display: flex;
  align-items: center;
  gap: 0.35em;
  font-family: var(--sh-font);
  font-size: var(--sh-size);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--sh-tracking);
  color: var(--sh-color);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.2em 0;
  line-height: 1;
  transition: color 0.2s;
}

.sh-cats__link:hover,
.sh-cats__item.is-active > .sh-cats__link { color: var(--sh-rouge); }

/* Flèche ▼ */
.sh-cats__arrow {
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  transition: transform 0.2s;
  margin-top: 0.1em;
}

.sh-cats__item:hover .sh-cats__arrow,
.sh-cats__item:focus-within .sh-cats__arrow {
  transform: rotate(180deg);
}

/* Dropdown produits */
.sh-cats__dropdown {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  min-width: 200px;
  background: var(--sh-bg);
  box-shadow: 0 8px 24px rgba(38,14,12,0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
  z-index: 10;
}

.sh-cats__item:hover .sh-cats__dropdown,
.sh-cats__item:focus-within .sh-cats__dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.sh-cats__dropdown li a {
  display: block;
  padding: 0.5rem 1.25rem;
  font-family: var(--sh-font);
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: var(--sh-tracking);
  color: var(--sh-color);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}

.sh-cats__dropdown li a:hover,
.sh-cats__dropdown li.is-active > a {
  color: var(--sh-rouge);
  background: rgba(38,14,12,0.04);
}

/* ── Languette bas-menu (déborde sous le header) ─────────────────*/
.site-header__languette {
  position: absolute;
  /* Accrochée au bas du header, dépasse vers le bas */
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  line-height: 0;
  color: var(--sh-bg); /* gris-clair → visible contre la page */
  pointer-events: none;
  z-index: 0; /* sous .site-header__bar (2) et .site-header__cats (1) */
}

.site-header__languette svg {
  display: block;
  width: auto;
  height: auto;
}

/* ── Offset du contenu page ──────────────────────────────────────*/
/* JS injecte --header-height sur <html>. Fallback. */
body { padding-top: var(--header-height, 150px); }

/* ================================================================
   Barre mobile
   ================================================================ */

.site-header__mobile-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem;
  background: #fff;
  position: relative;
  z-index: 2;
}

/* Logo mobile : taille réduite */
.site-header__mobile-bar .site-header__logo-img {
  width: 160px;
  height: auto;
}

/* Actions droite : nav-toggle + CTA */
.sh-mobile-actions {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

/* ── Bouton hamburger / fermer ───────────────────────────────*/
.sh-nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--sh-color);
  line-height: 0;
  transition: color 0.2s;
}

.sh-nav-toggle:hover { color: var(--sh-rouge); }

.sh-nav-toggle__icon-close { display: none; }

.sh-nav-toggle[aria-expanded="true"] .sh-nav-toggle__icon-open  { display: none;  }
.sh-nav-toggle[aria-expanded="true"] .sh-nav-toggle__icon-close { display: block; }

/* ── CTA mobile ──────────────────────────────────────────────*/
.sh-mobile-cta {
  font-family: var(--sh-font);
  font-size: 0.9375rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: var(--sh-tracking);
  text-decoration: none;
  background: var(--sh-rouge);
  color: #fff;
  padding: 0.4em 1.1em;
  border-radius: 50px;
  white-space: nowrap;
  transition: background 0.2s;
  line-height: 1;
}

.sh-mobile-cta:hover { background: var(--sh-color); }

/* ── Overlay menu mobile ─────────────────────────────────────*/
.site-header__mobile-overlay {
  position: fixed;
  top: var(--header-height, 70px);
  left: 0;
  width: 100%;
  /* dvh : tient compte du chrome navigateur mobile */
  height: calc(100dvh - var(--header-height, 70px));
  background: var(--sh-bg);
  z-index: 98;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem 1.5rem;

  /* État fermé */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-12px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s;
}

/* État ouvert — déclenché par .mobile-nav-open sur #site-header */
.site-header.mobile-nav-open .site-header__mobile-overlay {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Liste des items */
.sh-mobile-menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sh-mobile-menu > li > a {
  display: block;
  font-family: var(--sh-font);
  font-size: clamp(2rem, 7vw, 3.5rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-color);
  text-decoration: none;
  line-height: 1.15;
  padding: 0.3em 0;
  transition: color 0.2s;
}

.sh-mobile-menu > li > a:hover,
.sh-mobile-menu > li.current-menu-item > a,
.sh-mobile-menu > li.current-menu-ancestor > a { color: var(--sh-rouge); }

/* Sous-menu mobile */
.sh-mobile-menu .sub-menu {
  list-style: none;
  margin: 0;
  padding: 0 0 0.5rem 0.75rem;
}

.sh-mobile-menu .sub-menu li a {
  display: block;
  font-family: var(--sh-font);
  font-size: clamp(1rem, 3.5vw, 1.5rem);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--sh-color);
  text-decoration: none;
  padding: 0.25em 0;
  transition: color 0.2s;
}

.sh-mobile-menu .sub-menu li a:hover,
.sh-mobile-menu .sub-menu li.current-menu-item > a { color: var(--sh-rouge); }

/* ── Responsive : < 1024px ───────────────────────────────────*/
@media (max-width: 1023px) {
  .site-header__bar,
  .site-header__cats,
  .site-header__languette { display: none; }

  .site-header__mobile-bar { display: flex; }
}
