/* ===== CD54 BILLARD - HEADER FIXE (STICKY) ===== */

/* --- Header fixe + Glassmorphism --- */
.site-header,
.ast-primary-header,
#masthead {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 999 !important;
  transition: all 0.3s ease !important;
  /* Glassmorphism */
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05) !important;
}

/* Header au scroll - plus opaque */
body.scrolled .site-header,
body.scrolled .ast-primary-header,
body.scrolled #masthead {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: var(--cd54-shadow-md, 0 4px 20px rgba(0, 0, 0, 0.08)) !important;
}

/* Compenser l'espace du header fixe */
body {
  padding-top: 80px !important;
}

/* Ajustement pour mobile */
@media (max-width: 782px) {
  body {
    padding-top: 60px !important;
  }

  /* Header mobile visible et compact */
  .site-header,
  .ast-primary-header,
  #masthead {
    min-height: 60px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Logo mobile dans le header */
  header .custom-logo-link img,
  .site-header .custom-logo-link img {
    max-width: 50px !important;
    width: 50px !important;
    height: 50px !important;
    max-height: 50px !important;
    position: relative !important;
    top: 0 !important;
  }

  /* Menu burger Astra visible */
  .ast-mobile-menu-buttons,
  .ast-button-wrap,
  .menu-toggle {
    display: flex !important;
    z-index: 1000 !important;
  }
}

/* Logo - Override du CSS inline d'Astra */
/* Note: position et top sont définis spécifiquement dans homepage.css et ci-dessous pour body:not(.home) */
header .custom-logo-link img,
.site-header .custom-logo-link img {
  max-width: 100px !important;
  width: 100px !important;
  height: 100px !important;
  max-height: 100px !important;
  transition: all 0.3s ease !important;
}

/* Override du SVG logo Astra */
.astra-logo-svg {
  width: 100px !important;
}

/* --- Animation au scroll HOMEPAGE uniquement --- */
body.home.scrolled header .custom-logo-link img,
body.home.scrolled .site-header .custom-logo-link img {
  max-width: 80px !important;
  width: 80px !important;
  height: 80px !important;
  max-height: 80px !important;
  top: -180px !important;
}

/* --- Menu horizontal fixe --- */
.main-header-menu {
  display: flex !important;
  align-items: center !important;
}

/* --- Fix pour éviter que le contenu passe sous le header --- */
.ast-separate-container .site-content {
  margin-top: 20px !important;
}

/* ============================================================
   PAGES (SAUF HOMEPAGE) - Structure header identique à homepage
   Adapté de homepage.css lignes 1146-1166
   ============================================================ */

/* --- Logo à cheval sur le contenu (comme homepage) --- */
body:not(.home) .ast-primary-header-bar .site-branding {
  position: relative !important;
  z-index: 100 !important;
  margin-bottom: -100px !important;
}

body:not(.home) header .custom-logo-link img,
body:not(.home) .site-header .custom-logo-link img {
  max-width: 125px !important;
  width: 125px !important;
  height: 125px !important;
  max-height: 125px !important;
  position: absolute !important;
  top: -125px !important;
  filter: drop-shadow(0 4px 10px rgb(0 0 0 / 0.15)) !important;
  transition: all 0.3s ease !important;
}

body:not(.home) .ast-primary-header-bar {
  display: contents !important;
}

/* Animation logo au scroll - pages */
body:not(.home).scrolled .main-header-bar-wrap {
  position: relative !important;
  height: 0 !important;
}

body:not(.home).scrolled header .custom-logo-link img,
body:not(.home).scrolled .site-header .custom-logo-link img {
  max-width: 100px !important;
  width: 100px !important;
  height: 100px !important;
  max-height: 100px !important;
  top: -120px !important;
}

/* --- Titre "Le billard en Meurthe-et-Moselle" (comme homepage) --- */
body:not(.home) .ast-primary-header::after {
  content: '« Le billard en Meurthe‑et‑Moselle »' !important;
  position: fixed !important;
  top: 75% !important;
  left: var(--cd54-title-left, 140px) !important;
  font-family: 'Outfit', Arial, sans-serif !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  font-style: italic !important;
  color: #374151 !important;
  letter-spacing: 0.5px !important;
  white-space: nowrap !important;
  z-index: 100 !important;
  transition: all 0.3s ease !important;
  text-shadow:
    0 1px 0 rgb(255 255 255),
    0 -1px 0 rgb(0 0 0 / 0.03) !important;
  padding-bottom: 6px !important;
  background-image: linear-gradient(90deg, transparent, #DD183B 15%, #DD183B 85%, transparent) !important;
  background-size: 100% 2px !important;
  background-repeat: no-repeat !important;
  background-position: bottom !important;
}

/* Titre suit le logo lors du scroll (comme homepage) */
body:not(.home).scrolled .ast-primary-header::after {
  top: 70% !important;
  position: fixed !important;
}

/* --- Menu horizontal centré --- */
body:not(.home) .ast-above-header-bar .ast-builder-grid-row {
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

body:not(.home) .ast-above-header-bar .main-header-menu {
  display: flex !important;
  justify-content: center !important;
  gap: 10px !important;
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body:not(.home) .ast-above-header-bar .menu-item {
  display: inline-block !important;
  list-style: none !important;
}

body:not(.home) .ast-above-header-bar .menu-link {
  display: block !important;
  color: #1a1a2e !important;
  font-weight: 600 !important;
  font-size: 19px !important;
  padding: 8px 16px !important;
  text-decoration: none !important;
  transition: color 0.3s ease !important;
}

body:not(.home) .ast-above-header-bar .menu-link:hover {
  color: #DD183B !important;
}

/* --- Sous-menus dropdown --- */
.sub-menu,
.ast-above-header-bar .sub-menu,
.main-header-menu .sub-menu {
  display: flex !important;
  flex-direction: column !important;
}

/* Icônes sociales */
body:not(.home) .ast-builder-social-element {
  visibility: visible !important;
  opacity: 1 !important;
}

/* Espacement contenu pages (pas homepage, pas articles) */
body:not(.home):not(.single) #page .site-content {
  flex-grow: 1 !important;
  padding-top: 80px !important;
}

/* Articles : pas de padding-top (le hero gère l'espacement) */
body.single #page .site-content {
  flex-grow: 1 !important;
  padding-top: 0 !important;
}

body:not(.home) .ast-separate-container .site-content {
  margin-top: 20px !important;
}

/* Masquer titre et ajuster logo sur mobile */
@media (max-width: 782px) {
  body:not(.home) .ast-primary-header::after {
    display: none !important;
  }

  body:not(.home) .ast-primary-header-bar .site-branding {
    margin-bottom: 0 !important;
  }

  body:not(.home) .site-content,
  body:not(.home) .ast-separate-container .site-content {
    padding-top: 10px !important;
    margin-top: 10px !important;
  }

  body:not(.home) header .custom-logo-link img,
  body:not(.home) .site-header .custom-logo-link img {
    max-width: 50px !important;
    width: 50px !important;
    height: 50px !important;
    max-height: 50px !important;
    position: relative !important;
    top: 0 !important;
  }
}
