/* ==========================================================================
   Gadgets de Cuisine : en-tête (bascule 5, session 22 ; décision n° 65)
   Reprise du Sacochier (assets/css/header.css), adaptée à la palette A et au logo image.
   Chargée seulement quand gc_refonte( 'entete' ) est vrai, sous body.gc-entete.
   ========================================================================== */

/* --- Bandeau haut -------------------------------------------------------- */

body.gc-entete #top-bar.header-top {
  min-height: 32px;
  background-color: var(--gc-accent);
}

body.gc-entete #top-bar .flex-row {
  min-height: 32px;
}

body.gc-entete #top-bar .nav {
  justify-content: center;
}

body.gc-entete #top-bar .nav > li.html {
  margin: 0;
  padding: 6px 16px;
  white-space: normal;
}

body.gc-entete .gc-bandeau {
  font-family: var(--gc-font-texte);
  font-size: var(--gc-fs-meta);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #FFFFFF;
}

/* --- Ligne du logo ------------------------------------------------------- */

body.gc-entete .header-wrapper,
body.gc-entete .header-bg-color,
body.gc-entete #masthead {
  background-color: var(--gc-carte);
}

body.gc-entete #masthead {
  border-bottom: 1px solid var(--gc-trait);
}

body.gc-entete #logo {
  width: 60px !important;
  max-width: 60px;
  margin-right: 24px;
}

body.gc-entete #logo a.gc-logo {
  display: block;
  width: 60px;
  height: 60px;
  line-height: 0;
}

body.gc-entete #logo img.gc-logo__image {
  display: block;
  width: 60px;
  height: 60px;
  max-height: none;
  padding: 0;
}

body.gc-entete .header-wrapper.stuck #logo img.gc-logo__image,
body.gc-entete .header-wrapper.stuck #logo a.gc-logo {
  width: 52px;
  height: 52px;
}

/* Icônes de droite : cibles de 44 px */

body.gc-entete #masthead .header-nav > li > a.nav-top-link,
body.gc-entete #masthead .header-nav > li > a {
  min-height: var(--gc-cible);
  color: var(--gc-encre);
}

/* Compte : icône (le texte « Se connecter » / « Mon compte » reste le nom accessible du lien) */
body.gc-entete #masthead .account-item > a.nav-top-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--gc-cible);
  height: var(--gc-cible);
  padding: 0;
}

body.gc-entete #masthead .account-item > a.nav-top-link::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  background: center / contain no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2322201E' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c1.5-4 4.5-6 8-6s6.5 2 8 6'/%3E%3C/svg%3E");
}

body.gc-entete #masthead .account-item > a.nav-top-link > span,
body.gc-entete #masthead .account-item > a.nav-top-link > i,
body.gc-entete #masthead .account-item .header-account-title,
body.gc-entete #masthead .cart-item .header-cart-title {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* --- Menu des univers (bureau) ------------------------------------------- */

body.gc-entete .gc-nav-item {
  margin: 0;
}

body.gc-entete .gc-nav__liste {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.gc-entete .gc-nav__univers {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

body.gc-entete .gc-nav__univers > a {
  display: block;
  padding: 10px 10px;
  font-family: var(--gc-font-texte);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--gc-encre);
}

body.gc-entete .gc-nav__univers > a:hover,
body.gc-entete .gc-nav__univers.gc-actif > a {
  color: var(--gc-accent);
  box-shadow: inset 0 -2px 0 var(--gc-accent);
}

body.gc-entete button.gc-nav__ouvrir {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  min-width: 0;
  height: 32px;
  min-height: 0;
  margin: 0 0 0 -6px;
  padding: 0;
  color: var(--gc-encre);
  background: transparent;
  border: 0;
  box-shadow: none;
}

body.gc-entete button.gc-nav__ouvrir::before {
  content: '';
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

body.gc-entete .gc-nav__sous {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 30;
  display: none;
  min-width: 230px;
  margin: 0;
  padding: 8px 0;
  list-style: none;
  background-color: var(--gc-carte);
  border: 1px solid var(--gc-trait);
  border-radius: var(--gc-radius);
  box-shadow: 0 8px 24px rgba(34, 32, 30, 0.08);
}

body.gc-entete .gc-nav__univers:not(.gc-ferme):hover > .gc-nav__sous,
body.gc-entete .gc-nav__univers:not(.gc-ferme):focus-within > .gc-nav__sous,
body.gc-entete .gc-nav__univers.gc-ouvert > .gc-nav__sous {
  display: block;
}

body.gc-entete .gc-nav__sous li {
  margin: 0;
}

body.gc-entete .gc-nav__sous a {
  display: block;
  padding: 9px 18px;
  font-size: var(--gc-fs-petit);
  line-height: 1.4;
  white-space: nowrap;
  color: var(--gc-encre);
}

body.gc-entete .gc-nav__sous a:hover,
body.gc-entete .gc-nav__sous a[aria-current='page'] {
  color: var(--gc-accent);
  background-color: var(--gc-clair);
}

body.gc-entete .gc-nav a:focus-visible,
body.gc-entete .gc-nav button:focus-visible {
  outline: 2px solid var(--gc-accent);
  outline-offset: 2px;
}

/* --- Mobile : bouton ☰ et tiroir (moins de 850 px) ------------------------ */

body.gc-entete .gc-menu-item {
  margin: 0;
}

body.gc-entete button.gc-menu-ouvrir {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--gc-cible);
  min-width: 0;
  height: var(--gc-cible);
  min-height: 0;
  margin: 0;
  padding: 0;
  color: var(--gc-encre);
  background: transparent;
  border: 0;
  box-shadow: none;
}

.gc-menu {
  display: none;
}

body.gc-sans-defilement {
  overflow: hidden;
}

@media (max-width: 849px) {
  body.gc-entete #logo,
  body.gc-entete #logo a.gc-logo,
  body.gc-entete #logo img.gc-logo__image {
    width: 48px !important;
    max-width: 48px;
    height: 48px;
  }

  body.gc-entete #logo {
    margin: 0 auto;
  }

  body.gc-entete .gc-menu {
    display: block;
  }

  .gc-menu__fond {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background-color: rgba(34, 32, 30, 0.5);
  }

  .gc-menu__fond[hidden] {
    display: none;
  }

  .gc-menu__panneau {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100001;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    box-sizing: border-box;
    width: min(88vw, 360px);
    height: 100%;
    overflow: hidden;
    visibility: hidden;
    background-color: var(--gc-carte);
    transform: translateX(-100%);
    transition: transform var(--gc-transition), visibility 0s linear 0.2s;
  }

  .gc-menu--ouvert .gc-menu__panneau {
    visibility: visible;
    transform: none;
    transition: transform var(--gc-transition);
  }

  .gc-menu__entete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 8px 8px 20px;
    border-bottom: 1px solid var(--gc-trait);
  }

  .gc-menu__titre {
    margin: 0;
    font-family: var(--gc-font-titre);
    font-size: 24px;
    font-weight: 600;
    color: var(--gc-encre);
  }

  .gc-menu button.gc-menu__fermer {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--gc-cible);
    min-width: var(--gc-cible);
    height: var(--gc-cible);
    min-height: 0;
    margin: 0;
    padding: 0;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
    color: var(--gc-encre);
    background: transparent;
    border: 0;
  }

  .gc-menu__corps {
    padding-bottom: 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .gc-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .gc-menu li {
    margin: 0;
  }

  .gc-menu__univers {
    border-bottom: 1px solid var(--gc-trait);
  }

  .gc-menu__ligne {
    display: flex;
    align-items: stretch;
  }

  .gc-menu__univers > a,
  .gc-menu__ligne > a {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--gc-encre);
  }

  .gc-menu__univers.gc-actif {
    box-shadow: inset 3px 0 0 var(--gc-accent);
  }

  .gc-menu button.gc-menu__deplier {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    min-width: 0;
    min-height: 52px;
    margin: 0;
    padding: 0;
    color: var(--gc-encre);
    background: transparent;
    border: 0;
    border-left: 1px solid var(--gc-trait);
    border-radius: 0;
    box-shadow: none;
  }

  .gc-menu__deplier::before {
    content: '';
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--gc-transition);
  }

  .gc-menu__deplier[aria-expanded='true']::before {
    margin-top: 4px;
    transform: rotate(-135deg);
  }

  .gc-menu__sous {
    padding: 0 0 8px !important;
  }

  .gc-menu__sous[hidden] {
    display: none;
  }

  .gc-menu__sous a {
    display: flex;
    align-items: center;
    min-height: var(--gc-cible);
    padding: 6px 20px 6px 34px;
    font-size: 15px;
    color: var(--gc-encre);
  }

  .gc-menu__sous a[aria-current='page'] {
    font-weight: 700;
    color: var(--gc-accent);
  }

  .gc-menu__liens {
    padding-top: 12px !important;
  }

  .gc-menu__liens a {
    display: flex;
    align-items: center;
    min-height: var(--gc-cible);
    padding: 6px 20px;
    font-size: 15px;
    color: var(--gc-texte);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gc-menu__panneau,
  .gc-menu--ouvert .gc-menu__panneau {
    transition: none;
  }
}

/* Une ancre atteinte par un lien ne passe pas sous l'en-tête collant. */
body.gc-entete :target {
  scroll-margin-top: 90px;
}
