/*
 * Header — barre des réseaux, bande bleue, navigation, recherche, drawer mobile.
 *
 * Reprise de la maquette Kiwanis, classes conservées (.header-topbar,
 * .header-inner, .header-logo, .nav-item, .header-cta, .icon-btn).
 *
 * Écarts volontaires :
 *
 * 1. Focus visible en --accent-soft sur la bande bleue : le --focus par défaut
 *    (bleu profond) y serait invisible. 6.92:1 contre le fond.
 *
 * 2. La navigation est une liste (<ul>), .nav-item reste le lien. Sous-menus
 *    absents de la maquette, mais possibles dans le menu WordPress : ils
 *    s'ouvrent au survol ET au clavier (:focus-within), sinon inatteignables sans
 *    souris (RGAA 10.7 / 12.x).
 *
 * 3. Cibles tactiles portées à 44 px (liens des réseaux, 28 px dans la maquette)
 *    par un pseudo-élément transparent : l'apparence est inchangée.
 *
 * 4. Bouton de recherche en .icon-btn, qui ouvre un champ dans un <details>. Voir
 *    CLAUDE.md, piège n° 7.
 *
 * 5. Sous 980 px, la navigation passe dans un drawer (la maquette n'a pas de
 *    version mobile) ; sous 620 px, le bouton doré passe dans le drawer.
 *
 * Contrastes mesurés : devise --primary sur --surface 10.9:1 ; « Suivez-nous »
 * --text-muted sur --surface 5.02:1 ; navigation blanc à 72 % sur --primary
 * 6.71:1 ; « Cathédrale » --accent-soft sur --primary 6.92:1 ; bouton doré
 * --text sur --accent 6.23:1.
 */

/* ==========================================================================
   Header
   ========================================================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--primary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Liseré de focus visible sur le fond bleu (écart n° 1). */
.header-inner { --focus: var(--accent-soft); }

/* ==========================================================================
   Barre blanche — devise et réseaux sociaux
   ========================================================================== */

.header-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 7px var(--gutter);
}

.header-topbar-tag {
  font-family: var(--ff-editorial);
  font-style: italic;
  font-size: 15px;
  color: var(--primary);
}

.header-topbar-social {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.header-topbar-follow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
}

.header-topbar-link {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--primary);
  transition: all 0.2s;
}

/* Écart n° 3 : zone cliquable de 44 px. */
.header-topbar-link::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.header-topbar-link .icon { width: 15px; height: 15px; }

.header-topbar-link:hover {
  background: var(--primary);
  color: var(--on-primary);
}

/* ==========================================================================
   Bande bleue
   ========================================================================== */

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 18px var(--gutter);
  position: relative;
}

/* --------------------------------------------------------------------------
   Logo et nom du club
   -------------------------------------------------------------------------- */

.header-logo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 0.95;
}

/*
 * Le logo déborde de la bande, au-dessus (sur la barre blanche) et en dessous
 * (sur la page), comme dans la maquette : 104 px de haut pour une bande
 * d'environ 84 px.
 */
.header-logo-mark {
  display: block;
  width: auto;
  height: 104px;
  object-fit: contain;
  margin: -34px 0 -54px;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.35));
}

.header-logo-text { display: flex; flex-direction: column; line-height: 0.95; }

.header-logo-text .top {
  color: #ffffff;
  font-family: var(--ff-heading);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.header-logo-text .bot {
  color: var(--accent-soft);
  font-family: var(--ff-editorial);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Navigation principale
   -------------------------------------------------------------------------- */

.nav { display: flex; justify-content: center; }

.nav-list {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-entry { position: relative; }

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch);
  padding: 10px 14px;
  font-size: var(--fs-nav);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--on-primary-nav);
  border-radius: var(--r-pill);
  transition: color 0.15s;
}

.nav-item:hover,
.nav-entry:focus-within > .nav-item { color: #ffffff; }

.nav-item.active { color: #ffffff; font-weight: 600; }

/* Filet doré sous l'entrée active — 4.13:1 sur le bleu, au-dessus des 3:1 d'un
   indicateur non textuel. */
.nav-item.active::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-item .caret { width: 10px; height: 10px; opacity: 0.7; transition: transform .2s; }

.nav-entry:hover .caret,
.nav-entry:focus-within .caret { transform: rotate(180deg); }

/* Écart n° 2 : sous-menus. */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 240px;
  padding: 10px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  box-shadow: 0 16px 30px rgba(0, 56, 116, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 60;
  --focus: var(--primary);
}

.nav-entry:hover .dropdown,
.nav-entry:focus-within .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-entry:last-child .dropdown { left: auto; right: 0; }

.dropdown a {
  display: block;
  padding: 11px 14px;
  font-size: var(--fs-nav);
  color: var(--text-2);
  transition: color .15s, background .15s;
}

.dropdown a:hover { background: var(--surface-alt); color: var(--primary); }

/* --------------------------------------------------------------------------
   Actions — recherche, bouton doré, bascule du drawer
   -------------------------------------------------------------------------- */

.header-cta { display: flex; gap: 10px; align-items: center; }

.header-cta .icon-btn { color: rgba(255, 255, 255, 0.85); }
.header-cta .icon-btn:hover { background: rgba(255, 255, 255, 0.16); color: #ffffff; }
.header-cta .icon-btn .icon { width: 18px; height: 18px; }

/* Écart n° 4 : la recherche est un <details>. */
.header-search { position: relative; display: flex; align-items: center; }

.search-toggle {
  cursor: pointer;
  list-style: none;
}

.search-toggle::marker,
.search-toggle::-webkit-details-marker { display: none; content: ""; }

.header-search[open] .search-toggle { background: rgba(255, 255, 255, 0.16); color: #ffffff; }

.header-search-form {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(92vw, 400px);
  padding: 6px 6px 6px 18px;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  box-shadow: 0 16px 30px rgba(0, 56, 116, 0.18);
  --focus: var(--primary);
}

.header-search-form input[type="search"] {
  flex: 1;
  min-width: 0;
  height: var(--touch);
  border: none;
  background: none;
  font-size: 15px;
  color: var(--text);
}

.header-search-form input[type="search"]::placeholder { color: var(--text-muted); }

.header-search-form .btn { flex-shrink: 0; padding: 12px 20px; }

.menu-toggle { display: none; }

/* ==========================================================================
   Drawer mobile — masqué au-dessus de 980 px
   ========================================================================== */

.mobile-nav { display: none; }
.mobile-overlay { display: none; }

@media (max-width: 980px) {
  .header-inner {
    grid-template-columns: auto 1fr;
    gap: 16px;
  }

  .nav { display: none; }
  .menu-toggle { display: grid; }
  .header-cta { justify-content: flex-end; }

  .mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 28, 58, 0.55);
    z-index: 190;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
  }

  .mobile-overlay.open { opacity: 1; visibility: visible; }

  /*
   * Fermé, le panneau est aussi « visibility: hidden » : hors écran ne suffit
   * pas, ses liens resteraient atteignables au clavier. La visibilité bascule
   * APRÈS le glissement à la fermeture, AVANT à l'ouverture.
   */
  .mobile-nav {
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(86vw, 360px);
    padding: 22px 22px 32px;
    background: var(--surface);
    z-index: 200;
    overflow-y: auto;
    box-shadow: -12px 0 44px rgba(0, 28, 58, 0.3);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .3s ease, visibility 0s linear .3s;
  }

  .mobile-nav.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform .3s ease, visibility 0s linear 0s;
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .mobile-nav-head .t {
    font-size: var(--fs-eyebrow);
    font-weight: 600;
    letter-spacing: var(--ls-eyebrow);
    text-transform: uppercase;
    color: var(--text-muted);
  }

  .mobile-nav-close {
    width: var(--touch);
    height: var(--touch);
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--text);
  }

  .mobile-nav-close:hover { background: var(--surface-alt); }
  .mobile-nav-close .icon { width: 22px; height: 22px; }

  .mobile-nav > a,
  .mobile-nav .mobile-sub a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    padding: 8px 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--border-soft);
  }

  .mobile-nav > a:hover,
  .mobile-nav .mobile-sub a:hover { background: var(--surface-alt); }

  .mobile-nav > a .icon { width: 20px; height: 20px; color: var(--primary); }

  .mobile-nav .mobile-sub a {
    min-height: 48px;
    padding-left: 44px;
    font-size: 15px;
    font-weight: 400;
    color: var(--text-2);
  }

  .mobile-nav > a[aria-current="page"] { color: var(--primary); font-weight: 700; }

  .mobile-nav .mobile-nav-cta {
    margin-top: 20px;
    justify-content: center;
    border: none;
    border-radius: var(--r-pill);
    background: var(--accent);
    color: var(--text);
    font-size: 14px;
  }

  .mobile-nav .mobile-nav-cta .icon { color: var(--text); width: 16px; height: 16px; }

  .mobile-nav-social {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
  }

  .mobile-nav-social .icon-btn { color: var(--primary); background: var(--primary-pale); }
  .mobile-nav-social .icon-btn:hover { background: var(--primary); color: var(--on-primary); }
  .mobile-nav-social .icon { width: 17px; height: 17px; }

  .header-logo-mark { height: 84px; margin: -26px 0 -42px; }
  .header-logo-text .top { font-size: 21px; }
  .header-logo-text .bot { font-size: 19px; }
}

/* Écart n° 5 : sous 620 px, le bouton doré ne tient plus — il reste dans le drawer. */
@media (max-width: 620px) {
  .header-cta-btn { display: none; }
  .header-topbar-tag { display: none; }

  .header-logo-mark { height: 64px; margin: -18px 0 -30px; }
  .header-logo-text .top { font-size: 18px; }
  .header-logo-text .bot { font-size: 16px; }

  .header-search-form { right: -54px; }
}
