/* =====================================================================
   En-tête unique de xtranumerik.ca (refonte 2026-10-07)
   ---------------------------------------------------------------------
   Injecté par /assets/js/xtr-header.js. Classes préfixées « xh- » pour ne
   jamais croiser les règles !important de brand-creme.css (qui visent
   header, .header, .btn, .nav-link, .cta-button…) : c'est pourquoi le
   conteneur est un <div role="banner"> et non un <header>.

   Empilement : 5000 = au-dessus des contrôles Leaflet (1000) et sous le
   chargeur de l'accueil (#page-loader, 9999) et les fenêtres du magasin
   (100000+). Aucun transform/filter/backdrop-filter sur le conteneur :
   le panier flottant (#floating-cart), déplacé dans l'en-tête, doit garder
   son positionnement « fixed » sur mobile.
   ===================================================================== */
:root {
  --xh-h: 72px;
  --xh-bg: #FFFCF8;
  --xh-line: #E7DECF;
  --xh-ink: #2E1A47;
  --xh-muted: #5b4d6e;
  --xh-mauve: #6D28D9;
  --xh-mauve-soft: #F4EEFA;
  --xh-red: #E11D48;
  --xh-red-dark: #BE123C;
}
@media (max-width: 899px) { :root { --xh-h: 64px; } }

body.xh-on { padding-top: var(--xh-h) !important; }

.xh {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5000;
  height: var(--xh-h);
  background: var(--xh-bg);
  border-bottom: 1px solid var(--xh-line);
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--xh-ink);
  transition: box-shadow .2s ease;
}
.xh.xh--scrolled { box-shadow: 0 2px 4px rgba(46, 26, 71, .05), 0 8px 24px rgba(46, 26, 71, .08); }
.xh *, .xh *::before, .xh *::after { box-sizing: border-box; }

.xh-bar {
  max-width: 1360px; height: 100%; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; gap: 28px;
}
.xh-logo { display: flex; align-items: center; flex: 0 0 auto; line-height: 0; }
.xh-logo img { height: 44px; width: auto; display: block; border-radius: 6px; }

/* ---- Navigation principale ---- */
.xh-nav { display: flex; align-items: center; gap: 4px; flex: 1 1 auto; min-width: 0; }
.xh a.xh-link {
  position: relative; display: inline-flex; align-items: center; height: 40px; padding: 0 12px;
  color: var(--xh-ink); font-size: 15px; font-weight: 600; text-decoration: none;
  border-radius: 8px; white-space: nowrap; transition: color .15s, background .15s;
}
.xh a.xh-link:hover { color: var(--xh-mauve); background: var(--xh-mauve-soft); }
.xh a.xh-link[aria-current="page"] { color: var(--xh-mauve); }
.xh a.xh-link[aria-current="page"]::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 4px;
  height: 2px; border-radius: 2px; background: var(--xh-mauve);
}

/* ---- Actions (langue, compte, panier, appels à l'action) ---- */
.xh-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.xh a.xh-lang {
  display: inline-flex; align-items: center; justify-content: center; height: 36px; min-width: 40px; padding: 0 10px;
  color: var(--xh-ink); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-decoration: none;
  border: 1px solid var(--xh-line); border-radius: 8px; background: #fff;
}
.xh a.xh-lang:hover { border-color: var(--xh-mauve); color: var(--xh-mauve); }

.xh a.xh-btn, .xh button.xh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px; border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 700; line-height: 1; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.xh a.xh-btn:active { transform: scale(.98); }
.xh a.xh-btn--primary { background: var(--xh-red); color: #fff; border: 1px solid var(--xh-red); }
.xh a.xh-btn--primary:hover { background: var(--xh-red-dark); border-color: var(--xh-red-dark); color: #fff; }
.xh a.xh-btn--ghost { background: transparent; color: var(--xh-ink); border: 1.5px solid var(--xh-ink); }
.xh a.xh-btn--ghost:hover { background: var(--xh-mauve-soft); color: var(--xh-ink); }

/* ---- Compte (Connexion / Espace client) ---- */
.xh-auth { position: relative; }
.xh button.xh-auth-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px;
  background: transparent; border: 0; border-radius: 8px; cursor: pointer;
  color: var(--xh-ink); font-family: inherit; font-size: 15px; font-weight: 600;
}
.xh button.xh-auth-btn:hover, .xh-auth.is-open button.xh-auth-btn { background: var(--xh-mauve-soft); }
.xh-auth-caret { font-size: 11px; transition: transform .15s; }
.xh-auth.is-open .xh-auth-caret { transform: rotate(180deg); }
.xh-auth-menu {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 240px; padding: 6px;
  background: #fff; border: 1px solid var(--xh-line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(46, 26, 71, .16); display: none;
}
.xh-auth.is-open .xh-auth-menu { display: block; }
.xh a.xh-menu-item {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--xh-ink); font-size: 14.5px; font-weight: 600; text-decoration: none;
}
.xh a.xh-menu-item:hover { background: var(--xh-mauve-soft); color: var(--xh-mauve); }
.xh a.xh-menu-item--strong { color: var(--xh-mauve); }
.xh a.xh-menu-item--out { color: #9f1239; }

/* ---- Panier du magasin (#floating-cart) déplacé dans l'en-tête — bureau ---- */
@media (min-width: 900px) {
  .xh-actions .floating-cart {
    position: relative !important; top: auto !important; bottom: auto !important; left: auto !important; right: auto !important;
    width: auto !important; height: 42px !important; min-height: 0 !important; margin: 0 !important;
    border-radius: 10px !important; padding: 0 14px !important; display: inline-flex; align-items: center;
    box-shadow: none !important;
  }
  .xh-actions .floating-cart:hover { transform: none !important; }
  .xh-actions .floating-cart .cart-notification-badge { top: -7px; right: -7px; }
  .xh-actions .cart-dropdown { top: calc(100% + 12px) !important; bottom: auto !important; left: auto !important; right: 0 !important; }
}

/* ---- Bouton menu (mobile) et panneau ---- */
.xh button.xh-burger {
  display: none; margin-left: auto; width: 44px; height: 44px; padding: 0;
  align-items: center; justify-content: center; background: transparent; border: 0; border-radius: 10px;
  color: var(--xh-ink); cursor: pointer;
}
.xh button.xh-burger:hover { background: var(--xh-mauve-soft); }
.xh-burger svg { width: 26px; height: 26px; }
.xh-panel {
  position: fixed; top: var(--xh-h); left: 0; right: 0; bottom: 0; overflow-y: auto; z-index: 1100; /* > panier (999) dans le même empilement */
  background: var(--xh-bg); border-top: 1px solid var(--xh-line); padding: 16px 20px 32px;
}
.xh-panel[hidden] { display: none; }
.xh-panel a.xh-link { display: flex; height: 52px; font-size: 17px; border-bottom: 1px solid var(--xh-line); border-radius: 0; padding: 0 4px; }
.xh-panel a.xh-link[aria-current="page"]::after { display: none; }
.xh-panel-ctas { display: grid; gap: 10px; margin: 20px 0; }
.xh-panel-ctas a.xh-btn { width: 100%; height: 48px; }
.xh-panel-account { display: grid; gap: 2px; margin-top: 8px; }
.xh-panel-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--xh-muted); margin: 18px 4px 6px; }
.xh-panel a.xh-lang { margin-top: 18px; }

/* ---- Points de rupture ---- */
@media (max-width: 1399px) {
  .xh-bar { gap: 18px; }
  .xh-actions a.xh-btn--ghost { display: none; }
}
/* Sous 1180 px : menu repliable (navigation, compte, langue et appels à
   l'action passent dans le panneau) ; le panier reste dans la barre. */
@media (max-width: 1179px) {
  .xh-bar { padding: 0 16px; gap: 12px; }
  .xh-nav, .xh-actions .xh-lang, .xh-actions .xh-auth, .xh-actions a.xh-btn { display: none; }
  .xh-actions { margin-left: auto; }
  .xh button.xh-burger { display: inline-flex; margin-left: 0; }
}
@media (max-width: 899px) {
  .xh-logo img { height: 38px; }
}

/* Visibilité clavier */
.xh a:focus-visible, .xh button:focus-visible { outline: 2px solid var(--xh-mauve); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .xh, .xh * { transition: none !important; } }

/* Ancres : compenser la barre fixe (ex. « Réserver mes écrans » -> #map-section). */
#map-section, #xtrf, #xtrc-contact-form { scroll-margin-top: calc(var(--xh-h) + 12px); }

/* iOS Safari : pas de zoom automatique au toucher du champ de recherche de la carte
   (auto-header.js le faisait globalement ; règle ciblée ici). */
@supports (-webkit-touch-callout: none) { .loc-search__input { font-size: 16px; } }

/* Lien d'évitement des anciennes pages (.skip-link) : masqué jusqu'au focus clavier
   (l'ancien en-tête le recouvrait ; il dépassait de 2 px au-dessus de la barre). */
body.xh-on a.skip-link:not(:focus) { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
body.xh-on a.skip-link:focus { z-index: 6000; }
