/* Site header: logo + main menu (Apparence → Menus). Loaded on every page.
   The bar stays at the top of the screen and slims down once the page scrolls (site-header.js);
   .sfg-head keeps the bar's place in the page, so nothing jumps underneath.
   Menu items with the CSS class access-portefeuille (client portals) or bouton-rendez-vous (main action)
   are drawn as buttons. (The old theme's CSS already styles a .rendez-vous class, with a calendar icon.) */

/* Header heights, shared with the blocks: the homepage banner fills the rest of the screen (--sfg-head-h),
   and what sticks while scrolling stays below the slim bar (--sfg-sticky-top). */
:root {
  --sfg-head-h: 104px;
  --sfg-head-slim: 72px;
  --sfg-sticky-top: calc(var(--sfg-head-slim) + var(--wp-admin--admin-bar--height, 0px));
  scroll-padding-top: calc(var(--sfg-sticky-top) + 16px); /* anchors (#membres, #contact…) land below the bar */
}

.sfg-head {
  z-index: 100;
  flex-shrink: 0; /* the theme lays the body out as a flex column */
  height: var(--sfg-head-h);
}
.sfg-head__bar {
  --sfg-head-gap: clamp(18px, 1.8vw, 30px);
  position: fixed;
  top: var(--wp-admin--admin-bar--height, 0px);
  inset-inline: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  height: var(--sfg-head-h);
  padding-inline: clamp(20px, 3vw, 64px);
  background: #ffffff;
  border-bottom: 1px solid transparent;
  transition: height .4s var(--sfg-ease), border-color .4s, box-shadow .4s;
}
.sfg-head.is-scrolled .sfg-head__bar {
  height: var(--sfg-head-slim);
  border-bottom-color: var(--sfg-line);
  box-shadow: 0 10px 30px rgba(14, 26, 46, .06);
}
.sfg-head__brand { flex: none; display: block; line-height: 0; }
.sfg-head__brand img { display: block; width: auto; height: 72px; max-width: 100%; transition: height .4s var(--sfg-ease); }
.sfg-head.is-scrolled .sfg-head__brand img { height: 52px; }

.sfg-head__menu,
.sfg-head__menu ul { margin: 0; padding: 0; list-style: none; }
.sfg-head__menu { display: flex; align-items: center; gap: var(--sfg-head-gap); }
.sfg-head__menu li { position: relative; margin: 0; padding: 0; }
.sfg-head__menu a {
  display: block;
  font-family: var(--sfg-font);
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .25s, background-color .25s, background-size .45s var(--sfg-ease);
}
.sfg-head__menu a:hover,
.sfg-head__menu a:focus { text-decoration: none; }

/* Top level: small capitals, with a gold line under the current section and on hover */
.sfg-head__menu > li > a {
  padding-block: 10px;
  font-size: 12.5px;
  letter-spacing: .1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--sfg-navy);
  background: linear-gradient(var(--sfg-accent), var(--sfg-accent)) 0 100% / 0 1px no-repeat;
}
.sfg-head__menu > li > a:hover,
.sfg-head__menu > li:focus-within > a,
.sfg-head__menu > .current-menu-item > a,
.sfg-head__menu > .current-menu-ancestor > a,
.sfg-head__menu > .current-page-ancestor > a { color: var(--sfg-navy); background-size: 100% 1px; }

/* Small arrow on the items that open a sub-menu */
.sfg-head__menu > .menu-item-has-children > a { display: flex; align-items: center; gap: 9px; }
.sfg-head__menu > .menu-item-has-children > a::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: -4px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  transition: transform .3s var(--sfg-ease);
}
.sfg-head__menu > .menu-item-has-children:hover > a::after,
.sfg-head__menu > .menu-item-has-children:focus-within > a::after { transform: translateY(4px) rotate(-135deg); }

/* « Accès portefeuille »: outlined button */
.sfg-head__menu > .access-portefeuille { margin-left: clamp(0px, 1vw, 12px); }
.sfg-head__menu > li.access-portefeuille > a {
  padding: 13px 16px;
  font-size: 12.5px;
  letter-spacing: .1em;
  border: 1px solid var(--sfg-navy);
  background: none;
  cursor: default;
}
.sfg-head__menu > li.access-portefeuille:hover > a,
.sfg-head__menu > li.access-portefeuille:focus-within > a { color: #ffffff; background: var(--sfg-navy); }

/* « Prendre rendez-vous »: filled button, right next to the portfolio */
.sfg-head__menu > .bouton-rendez-vous { margin-left: calc(10px - var(--sfg-head-gap)); }
.sfg-head__menu > li.bouton-rendez-vous > a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-size: 12.5px;
  letter-spacing: .1em;
  color: #ffffff;
  background: var(--sfg-navy);
}
.sfg-head__menu > li.bouton-rendez-vous > a::after { content: "→"; letter-spacing: 0; transition: transform .3s var(--sfg-ease); }
.sfg-head__menu > li.bouton-rendez-vous > a:hover,
.sfg-head__menu > li.bouton-rendez-vous > a:focus-visible { color: #ffffff; background: var(--sfg-blue); }
.sfg-head__menu > li.bouton-rendez-vous > a:hover::after { transform: translateX(4px); }

/* Drop-down menus */
.sfg-head__menu .sub-menu {
  position: absolute;
  top: 100%;
  left: -22px;
  z-index: 2;
  min-width: calc(100% + 44px);
  padding-block: 10px;
  background: #ffffff;
  border: 1px solid var(--sfg-line);
  box-shadow: 0 18px 40px rgba(14, 26, 46, .1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .25s, transform .25s var(--sfg-ease), visibility .25s;
}
.sfg-head__menu > .access-portefeuille > .sub-menu { left: auto; right: 0; min-width: 100%; }
.sfg-head__menu li:hover > .sub-menu,
.sfg-head__menu li:focus-within > .sub-menu { opacity: 1; visibility: visible; transform: none; }
.sfg-head__menu .sub-menu a {
  padding: 10px 22px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--sfg-navy);
}
.sfg-head__menu .sub-menu a:hover,
.sfg-head__menu .sub-menu a:focus,
.sfg-head__menu .sub-menu .current-menu-item > a { color: var(--sfg-accent); background: var(--sfg-surface); }

/* Hamburger */
.sfg-head__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 10px;
  margin-right: -10px;
  background: none;
  border: 0;
  cursor: pointer;
}
.sfg-head__toggle span { display: block; width: 24px; height: 2px; background: var(--sfg-navy); transition: transform .3s, opacity .3s; }
.sfg-head.is-open .sfg-head__toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sfg-head.is-open .sfg-head__toggle span:nth-child(2) { opacity: 0; }
.sfg-head.is-open .sfg-head__toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Below 1280 px the menu no longer fits on one line: it opens from the hamburger, under the bar */
@media (max-width: 1279px) {
  :root { --sfg-head-h: 82px; --sfg-head-slim: 64px; }
  .sfg-head__bar { padding-inline: clamp(16px, 4vw, 40px); }
  .sfg-head__brand img { height: 58px; }
  .sfg-head.is-scrolled .sfg-head__brand img { height: 46px; }
  .sfg-head__toggle { display: flex; }

  .sfg-head__nav {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline: 0;
    max-height: calc(100svh - 100% - var(--wp-admin--admin-bar--height, 0px));
    overflow-y: auto;
    padding: 4px clamp(16px, 4vw, 40px) 28px;
    background: #ffffff;
    border-top: 1px solid var(--sfg-line);
    box-shadow: 0 18px 40px rgba(14, 26, 46, .12);
  }
  .sfg-head.is-open .sfg-head__nav { display: block; }
  .sfg-head__menu { flex-direction: column; align-items: stretch; gap: 0; }
  .sfg-head__menu > li { border-bottom: 1px solid var(--sfg-line); }
  .sfg-head__menu > li > a { padding-block: 16px; font-size: 14px; background: none; }
  .sfg-head__menu > li > a:hover,
  .sfg-head__menu > .current-menu-item > a,
  .sfg-head__menu > .current-menu-ancestor > a,
  .sfg-head__menu > .current-page-ancestor > a { color: var(--sfg-accent); }
  .sfg-head__menu > .menu-item-has-children > a::after { display: none; }

  /* Sub-pages listed under their section, always visible */
  .sfg-head__menu .sub-menu {
    position: static;
    min-width: 0;
    padding: 0 0 12px 16px;
    background: none;
    border: 0;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .sfg-head__menu .sub-menu a { padding: 9px 0; font-size: 16px; color: var(--sfg-muted); }
  .sfg-head__menu .sub-menu a:hover,
  .sfg-head__menu .sub-menu a:focus,
  .sfg-head__menu .sub-menu .current-menu-item > a { color: var(--sfg-accent); background: none; }

  /* Portals: a small title over their links; then the main action, full width */
  .sfg-head__menu > .access-portefeuille { margin: 20px 0 0; border-bottom: 0; }
  .sfg-head__menu > li.access-portefeuille > a,
  .sfg-head__menu > li.access-portefeuille:hover > a,
  .sfg-head__menu > li.access-portefeuille:focus-within > a { padding: 0 0 4px; color: var(--sfg-accent); background: none; border: 0; }
  .sfg-head__menu > .access-portefeuille > .sub-menu { padding-left: 0; }
  .sfg-head__menu > .bouton-rendez-vous { margin: 20px 0 0; border-bottom: 0; }
  .sfg-head__menu > li.bouton-rendez-vous > a { justify-content: space-between; padding: 17px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .sfg-head *,
  .sfg-head *::before,
  .sfg-head *::after { transition: none !important; }
}
