/* Défilement fluide vers les ancres internes (sommaires), sans masquer la cible sous l'en-tête. */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.75rem;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* En-tête et pied de page fixes, alimentés par la charte du site. */
#en-tete-site,
#pied-de-page-site {
  position: relative;
  z-index: 20;
  width: 100%;
  color: var(--text);
  font-family: inherit;
}

#en-tete-site {
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 16%, transparent);
}

#en-tete-site .header-inner {
  width: 100%;
  max-width: var(--site-content-width, var(--mb-wide, var(--container)));
  margin-inline: auto;
  min-height: 5.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: .65rem var(--site-content-gutter, var(--mb-gutter, 1.25rem));
}

#en-tete-site .brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--primary);
  font-family: var(--font-heading, inherit);
  font-weight: 700;
  text-decoration: none;
}

#en-tete-site .brand-logo {
  display: block;
  width: auto;
  height: clamp(2.5rem, 3.4vw, 3.25rem);
  max-width: min(16rem, 45vw);
  object-fit: contain;
}

#en-tete-site .brand-placeholder {
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 2.75rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--bg);
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
}

#en-tete-site .brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#en-tete-site .site-navigation {
  margin-left: auto;
}

#en-tete-site .site-navigation ul {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .35rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#en-tete-site .site-navigation a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
}

#en-tete-site .site-navigation a:hover,
#en-tete-site .site-navigation a:focus-visible,
#en-tete-site .current-menu-item > a,
#en-tete-site .current-menu-ancestor > a {
  color: var(--primary);
  border-bottom-color: var(--accent);
}

.site-main {
  min-height: 55vh;
}

#pied-de-page-site {
  margin: 0;
  padding: 2.25rem 0 1.25rem;
  background: var(--primary);
  color: var(--bg);
  border: 0;
  opacity: 1;
}

#pied-de-page-site .footer-inner {
  width: 100%;
  max-width: var(--site-content-width, var(--mb-wide, var(--container)));
  margin-inline: auto;
  padding-inline: var(--site-content-gutter, var(--mb-gutter, 1.25rem));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.5rem 3rem;
}

#pied-de-page-site .footer-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .25rem;
  color: var(--bg);
  text-decoration: none;
}

#pied-de-page-site .footer-brand-name {
  font-family: var(--font-heading, inherit);
  font-size: 1.25rem;
  font-weight: 700;
}

#pied-de-page-site .footer-tagline {
  max-width: 44rem;
  opacity: .78;
  font-size: .9rem;
}

#pied-de-page-site .footer-navigation ul {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

#pied-de-page-site a {
  color: var(--bg);
}

#pied-de-page-site .footer-navigation a {
  display: inline-flex;
  min-height: 2.5rem;
  align-items: center;
  font-weight: 600;
  text-decoration: none;
}

#pied-de-page-site a:hover,
#pied-de-page-site a:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: .25rem;
}

#pied-de-page-site .footer-legal {
  grid-column: 1 / -1;
  width: 100%;
  margin: 0;
  padding-top: 1rem;
  border-top: 1px solid color-mix(in srgb, var(--bg) 28%, transparent);
  color: var(--bg);
  opacity: .72;
  font-size: .82rem;
}

#en-tete-site a:focus-visible,
#pied-de-page-site a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 4px;
}

@media (max-width: 760px) {
  #en-tete-site .header-inner {
    min-height: auto;
    align-items: flex-start;
    flex-direction: column;
    gap: .75rem;
  }

  #en-tete-site .site-navigation,
  #en-tete-site .site-navigation ul {
    width: 100%;
  }

  #en-tete-site .site-navigation ul {
    justify-content: flex-start;
    gap: .15rem 1rem;
  }

  #en-tete-site .site-navigation a {
    min-height: 2.5rem;
  }

  #en-tete-site .brand-logo {
    height: 2.25rem;
    max-width: min(12rem, 60vw);
  }

  #pied-de-page-site .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  #pied-de-page-site .footer-navigation ul {
    justify-content: flex-start;
  }

  #pied-de-page-site .footer-legal {
    grid-column: 1;
  }
}