/* ==========================================================================
   Sotumec — Header
   ========================================================================== */

.sotumec-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  height: var(--header-height);
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(36, 39, 41, 0.06);
  transition: box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease), backdrop-filter var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

/* Étape 2 : au-delà de 40px de scroll, le header se resserre visuellement
   (fond plus opaque + ombre douce + ligne d'accent bleu très fine). */
body.is-scrolled .sotumec-header {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-sm);
  border-bottom-color: transparent;
}

body.is-scrolled .sotumec-header::after {
  opacity: 1;
}

.sotumec-header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--gradient-blue-anthracite);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}

.sotumec-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  width: 100%;
}

.sotumec-header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
  max-width: min(210px, 28vw);
  margin-block: var(--sp-2);
}

.sotumec-header__logo .custom-logo-link {
  display: flex;
  align-items: center;
  line-height: 0;
  max-width: 100%;
}

.sotumec-header__logo img,
.sotumec-header__logo svg,
.sotumec-header__logo .custom-logo {
  display: block;
  /* Hauteur forcée : le custom_logo WP pose width/height HTML + sizes=100vw
     qui font gonfler le logo au resize / sur mobile. */
  height: 40px !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: 40px !important;
  object-fit: contain;
  object-position: left center;
}

.sotumec-header__nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  flex: 1;
  justify-content: flex-end;
}

.sotumec-menu {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

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

.sotumec-menu > li > a {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  white-space: nowrap;
  font-family: var(--font-sans);
  font-weight: var(--fw-medium);
  font-size: 0.9375rem;
  color: var(--color-text);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-full);
  position: relative;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.sotumec-menu > li > a:hover {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}

.sotumec-menu > li.current-menu-item > a,
.sotumec-menu > li.current-menu-parent > a {
  color: var(--color-primary);
  background: var(--color-bg-alt);
  font-weight: var(--fw-semi);
}

/* --------------------------------------------------------------------------
   Mega-menu "Nos activités"
   -------------------------------------------------------------------------- */

.sotumec-menu__has-children > .sotumec-submenu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translate(-50%, 8px);
  background: var(--sotumec-white);
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  display: grid;
  grid-template-columns: repeat(3, minmax(200px, 1fr));
  gap: var(--sp-2);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), visibility var(--dur) var(--ease);
  z-index: 1001;
}

.sotumec-header__nav .sotumec-menu__has-children:hover > .sotumec-submenu,
.sotumec-header__nav .sotumec-menu__has-children:focus-within > .sotumec-submenu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.sotumec-submenu li a {
  display: block;
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}

.sotumec-submenu li a:hover {
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

/* Étape 2 : items enrichis du mega-menu "Nos activités" (icône + description). */
.sotumec-submenu__item--mega > a {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-3);
  white-space: normal;
  height: 100%;
}

.sotumec-submenu__icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.sotumec-submenu__icon svg {
  width: 20px;
  height: 20px;
}

.sotumec-submenu__text {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sotumec-submenu__title {
  font-weight: var(--fw-semi);
  font-size: var(--fs-body);
  color: var(--color-text);
}

.sotumec-submenu__desc {
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--color-text-muted);
  font-weight: var(--fw-regular);
  white-space: normal;
}

.sotumec-menu__chevron {
  width: 12px;
  height: 12px;
  transition: transform var(--dur) var(--ease);
}

.sotumec-header__nav .sotumec-menu__has-children:hover .sotumec-menu__chevron {
  transform: rotate(180deg);
}

/* --------------------------------------------------------------------------
   CTA header
   -------------------------------------------------------------------------- */

.sotumec-header__ctas {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

.sotumec-btn--outline {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.sotumec-btn--outline:hover {
  background: var(--color-primary);
  color: var(--sotumec-white);
}

.sotumec-header__cta {
  flex-shrink: 0;
  background: var(--gradient-blue-anthracite);
  box-shadow: 0 4px 14px rgba(0, 98, 163, 0.28);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}

.sotumec-header__cta:hover {
  box-shadow: 0 6px 20px rgba(0, 98, 163, 0.38);
  transform: translateY(-1px);
}

.sotumec-header__cta--secondary {
  background: transparent;
  box-shadow: none;
}

.sotumec-header__cta--secondary:hover {
  box-shadow: none;
  transform: none;
}

/* 992-1279 px : menu complet + 2 boutons débordaient de ~60 px.
   On resserre et on masque « Nous contacter » (déjà présent dans le menu). */
@media (min-width: 992px) and (max-width: 1279px) {
  .sotumec-header__inner,
  .sotumec-header__nav {
    gap: var(--sp-3);
  }

  .sotumec-menu > li > a {
    padding-inline: var(--sp-2);
  }

  .sotumec-header__cta--secondary {
    display: none;
  }
}

@media (max-width: 991px) {
  .sotumec-header__logo {
    max-width: min(160px, 42vw);
  }

  .sotumec-header__logo img,
  .sotumec-header__logo svg,
  .sotumec-header__logo .custom-logo {
    height: 34px !important;
    max-height: 34px !important;
  }
}

@media (max-width: 575px) {
  .sotumec-header__logo {
    max-width: min(140px, 48vw);
  }

  .sotumec-header__logo img,
  .sotumec-header__logo svg,
  .sotumec-header__logo .custom-logo {
    height: 30px !important;
    max-height: 30px !important;
  }
}

/* --------------------------------------------------------------------------
   Burger (mobile)
   -------------------------------------------------------------------------- */

.sotumec-burger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  flex-shrink: 0;
}

.sotumec-burger svg {
  width: 24px;
  height: 24px;
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   Off-canvas mobile menu
   -------------------------------------------------------------------------- */

.sotumec-offcanvas {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(340px, 86vw);
  background: var(--sotumec-white);
  box-shadow: var(--shadow-lg);
  z-index: 100001;
  padding: var(--sp-8) var(--sp-6);
  transform: translateX(100%);
  transition: transform var(--dur-slow) var(--ease);
  overflow-y: auto;
}

.sotumec-offcanvas.is-open {
  transform: translateX(0);
}

.sotumec-offcanvas__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-8);
}

.sotumec-offcanvas__close {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--color-bg-warm);
}

.sotumec-offcanvas__close svg {
  width: 18px;
  height: 18px;
}

.sotumec-offcanvas .sotumec-menu {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}

.sotumec-offcanvas .sotumec-menu > li {
  border-bottom: 1px solid var(--color-border);
}

.sotumec-offcanvas .sotumec-menu > li > a {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1.25rem;
  margin: var(--sp-1) 0;
}

.sotumec-offcanvas .sotumec-menu > li.current-menu-item > a,
.sotumec-offcanvas .sotumec-menu > li.current-menu-parent > a {
  padding-inline: 1.25rem;
}

.sotumec-offcanvas .sotumec-submenu {
  position: static;
  display: none;
  grid-template-columns: 1fr;
  box-shadow: none;
  padding: 0 0 var(--sp-3) var(--sp-4);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.sotumec-offcanvas .sotumec-menu__has-children.is-open .sotumec-submenu {
  display: grid;
}

/* 22/10/2026 : au toucher, le :hover / :focus-within du méga-menu de bureau
   s'appliquait aussi ici (translate(-50%) → sous-menu sorti du panneau). Les
   règles de bureau sont désormais limitées à .sotumec-header__nav ; ici, lignes
   compactes (pictogramme à gauche du titre) et chevron qui pivote. */
.sotumec-offcanvas .sotumec-submenu {
  gap: 0;
  margin: 0;
  list-style: none;
}

.sotumec-offcanvas .sotumec-submenu li a,
.sotumec-offcanvas .sotumec-submenu__item--mega > a {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.625rem 0.75rem;
  white-space: normal;
  height: auto;
}

.sotumec-offcanvas .sotumec-submenu__icon {
  width: 32px;
  height: 32px;
}

.sotumec-offcanvas .sotumec-submenu__icon svg {
  width: 18px;
  height: 18px;
}

.sotumec-offcanvas .sotumec-submenu__title {
  font-size: 0.9375rem;
}

.sotumec-offcanvas .sotumec-submenu__desc {
  display: none;
}

.sotumec-offcanvas .sotumec-submenu li.sotumec-submenu__item--all > a {
  font-weight: var(--fw-semi);
  color: var(--color-primary);
}

.sotumec-offcanvas .sotumec-menu__has-children.is-open .sotumec-menu__chevron {
  transform: rotate(180deg);
}

.sotumec-offcanvas__overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 39, 41, 0.5);
  z-index: 100000;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}

.sotumec-offcanvas__overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.sotumec-offcanvas__cta {
  margin-top: var(--sp-6);
}

@media (max-width: 991px) {
  .sotumec-header__nav > .sotumec-menu,
  .sotumec-header__ctas {
    display: none;
  }
  .sotumec-burger {
    display: flex;
  }
}
