/*
 * Défi Races Bovines — bandeau public commun 1.23.02
 *
 * Une seule composition ordinateur et une seule composition mobile.
 * Le logo occupe les deux lignes sur ordinateur ; la navigation reste
 * sur une ligne et le sélecteur de langue demeure dans l'angle supérieur droit.
 */

.app-header {
  color: #fff8e8;
  background: linear-gradient(135deg, #bd7c28 0%, #cf9638 62%, #c78b31 100%) !important;
  border: 3px solid var(--wood, #7c3f19) !important;
  border-radius: 13px !important;
  box-shadow: 0 5px 0 rgba(92, 52, 25, .22) !important;
}

.app-header a { color: inherit; }

.site-header-language {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 2px solid rgba(255, 248, 226, .96);
  border-radius: 999px;
  background: rgba(255, 250, 229, .96);
  box-shadow: 0 2px 0 rgba(70, 38, 18, .14);
  vertical-align: middle;
}

.site-header-language a {
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 30px;
  padding: 4px 8px;
  color: #5b341e;
  font-size: .75rem;
  font-weight: 950;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.site-header-language a + a {
  border-left: 1px solid rgba(93, 53, 26, .35);
}

.site-header-language a:hover,
.site-header-language a:focus-visible {
  background: rgba(230, 221, 164, .8);
  outline: none;
}

.site-header-language a.is-active {
  color: #fff;
  background: #6e3f22;
}

.site-mobile-header-row,
.site-mobile-menu,
.site-mobile-header-controls {
  display: none;
}

@media (min-width: 701px) {
  .app-header.is-unified-desktop,
  .site-shell > .app-header {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr) auto;
    grid-template-rows: minmax(38px, auto) 38px;
    grid-template-areas:
      "logo title utility"
      "logo navigation navigation";
    align-items: center !important;
    column-gap: 13px !important;
    row-gap: 2px !important;
    min-height: 104px !important;
    padding: 9px 16px 10px !important;
  }

  .app-header > .site-desktop-brand {
    display: contents !important;
    color: inherit;
    text-decoration: none;
  }

  .app-header .header-logo {
    grid-area: logo;
    align-self: center;
    justify-self: center;
    width: 82px !important;
    height: 82px !important;
    max-width: 82px !important;
    object-fit: contain;
    filter: drop-shadow(0 2px 0 rgba(65, 34, 17, .22));
  }

  .app-header .brand-text {
    grid-area: title;
    display: flex !important;
    align-items: baseline !important;
    gap: 12px !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .app-header h1 {
    flex: 0 0 auto;
    margin: 0 !important;
    color: #fff8e8 !important;
    font-size: clamp(1.72rem, 2.45vw, 2.12rem) !important;
    line-height: 1 !important;
    letter-spacing: -.015em !important;
    white-space: nowrap !important;
    text-shadow: 0 1px 0 rgba(0, 0, 0, .18);
    text-align: left !important;
  }

  .app-header .subtitle,
  .app-header .credits {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 520px;
    margin: 0 !important;
    color: #fff8e8 !important;
    font-size: .69rem !important;
    font-weight: 850 !important;
    line-height: 1.15 !important;
    text-align: left;
    opacity: .96;
  }

  .app-header .credits { display: none !important; }

  .app-header > .site-header-desktop-language,
  .app-header > .header-extra-topright,
  .app-header > .scoreboard {
    grid-area: utility;
    justify-self: end;
    align-self: center;
  }

  .app-header > .site-header-desktop-language {
    display: flex !important;
    align-items: center;
  }

  .app-header > .header-actions {
    grid-area: navigation;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 9px !important;
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app-header .header-link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    min-height: 35px !important;
    margin: 0 !important;
    padding: 7px 14px !important;
    border: 2px solid rgba(255, 248, 226, .94) !important;
    border-radius: 9px !important;
    background: rgba(255, 248, 226, .09) !important;
    box-shadow: 0 2px 0 rgba(73, 38, 18, .18) !important;
    color: #fff9eb !important;
    font-size: .91rem !important;
    font-weight: 900 !important;
    line-height: 1.05 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: nowrap !important;
  }

  .app-header .header-link:hover,
  .app-header .header-link:focus-visible {
    background: rgba(255, 248, 226, .20) !important;
    transform: translateY(-1px);
    outline: none;
  }

  .app-header .header-link.is-active,
  .app-header .header-link[aria-current="page"] {
    border-color: #166f38 !important;
    background: linear-gradient(180deg, #27a854, #17813f) !important;
    color: #fff !important;
    box-shadow: 0 3px 0 rgba(19, 92, 47, .55) !important;
  }

  .app-header > .site-header-stacked-subtitle,
  .app-header > .site-mobile-header-row,
  .app-header > .site-mobile-menu {
    display: none !important;
  }

  .app-header > .scoreboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(72px, auto));
    gap: 6px;
  }

  .app-header > .scoreboard > div {
    min-width: 76px;
    padding: 4px 7px;
    border: 2px solid rgba(255, 248, 226, .8);
    border-radius: 8px;
    background: rgba(255, 248, 226, .92);
    color: #4b2816;
    box-shadow: none;
  }

  .app-header > .scoreboard span {
    font-size: .62rem;
  }

  .app-header > .scoreboard strong {
    font-size: 1rem;
  }

  /* L'accueil garde son tableau de scores dans le contenu, pas dans le bandeau. */
  .site-shell--home > .app-header > .scoreboard {
    display: none !important;
  }
}

@media (min-width: 701px) and (max-width: 940px) {
  .app-header.is-unified-desktop,
  .site-shell > .app-header {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    grid-template-rows: minmax(34px, auto) 36px;
    min-height: 90px !important;
    column-gap: 10px !important;
    row-gap: 1px !important;
    padding: 8px 12px 9px !important;
  }

  .app-header .header-logo {
    width: 69px !important;
    height: 69px !important;
    max-width: 69px !important;
  }

  .app-header .brand-text { gap: 8px !important; }
  .app-header h1 { font-size: 1.48rem !important; }

  .app-header .subtitle {
    max-width: 300px;
    font-size: .59rem !important;
  }

  .app-header > .header-actions { gap: 6px !important; }

  .app-header .header-link {
    min-height: 33px !important;
    padding: 6px 9px !important;
    font-size: .82rem !important;
  }

  .site-header-language a {
    min-width: 33px;
    min-height: 28px;
    padding-inline: 6px;
  }
}

@media (max-width: 700px) {
  .app-header,
  .app-header.is-unified-desktop,
  .site-shell > .app-header {
    position: relative !important;
    display: block !important;
    min-height: 0 !important;
    padding: 9px 10px !important;
    border-width: 2px !important;
    border-radius: 11px !important;
    overflow: visible !important;
  }

  .site-shell--home > .app-header {
    border-radius: 11px 11px 0 0 !important;
  }

  .app-header > .site-desktop-brand,
  .app-header > .header-actions,
  .app-header > .site-header-desktop-language,
  .app-header > .site-header-stacked-subtitle,
  .app-header > .header-extra-topright {
    display: none !important;
  }

  .app-header > .site-mobile-header-row {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .site-mobile-brand {
    display: flex !important;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: #fff8e8 !important;
    font-size: 1.02rem;
    font-weight: 950;
    line-height: 1.05;
    text-decoration: none;
  }

  .site-mobile-brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .site-mobile-logo {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    object-fit: contain;
  }

  .site-mobile-header-controls {
    display: flex !important;
    flex: 0 0 auto;
    align-items: center;
    gap: 7px;
  }

  .site-header-language:not(.site-header-language-mobile) {
    display: none !important;
  }

  .site-header-language-mobile {
    display: inline-flex !important;
    border-color: rgba(93, 53, 26, .62);
  }

  .site-header-language-mobile a {
    min-width: 32px;
    min-height: 29px;
    padding: 3px 6px;
    font-size: .68rem;
  }

  .site-mobile-menu-button {
    display: grid !important;
    place-content: center;
    gap: 4px;
    width: 37px;
    height: 34px;
    margin: 0;
    padding: 0 !important;
    border: 2px solid rgba(255, 248, 226, .92) !important;
    border-radius: 8px !important;
    background: rgba(255, 248, 226, .12) !important;
    box-shadow: none !important;
  }

  .site-mobile-menu-button span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: #fff8e8;
    transition: transform .16s ease, opacity .16s ease;
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
  }

  .site-mobile-menu-button[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  /* Menu mobile commun : panneau clair et textes foncés.
     Toutes les propriétés sont définies ici afin de neutraliser les anciennes
     versions du menu encore présentes dans certaines feuilles de page. */
  .app-header > .site-mobile-menu:not([hidden]) {
    position: absolute !important;
    z-index: 1000 !important;
    top: calc(100% + 7px) !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 9px !important;
    border: 2px solid var(--wood, #7c3f19) !important;
    border-radius: 12px !important;
    background: #fff8e2 !important;
    box-shadow: 0 13px 30px rgba(59, 29, 12, .28) !important;
  }

  .app-header > .site-mobile-menu[hidden] {
    display: none !important;
  }

  .site-mobile-menu a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 8px 9px;
    border: 1px solid #d8b77a !important;
    border-radius: 8px;
    background: #fffaf0 !important;
    color: #3d1e0f !important;
    font-size: .84rem;
    font-weight: 850;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
  }

  .site-mobile-menu a:hover,
  .site-mobile-menu a:focus-visible {
    border-color: #b9823f !important;
    background: #f6e8bf !important;
    color: #2e160b !important;
    outline: none;
  }

  .site-mobile-menu a.is-active {
    border-color: #166f38 !important;
    background: linear-gradient(180deg, #27a854, #17813f) !important;
    color: #fff !important;
    box-shadow: inset 0 -2px 0 rgba(24, 84, 31, .25);
  }

  .site-mobile-menu a.site-mobile-menu-cta {
    grid-column: 1 / -1;
    border-color: #91b879 !important;
    background: #e8f4dc !important;
    color: #245c2c !important;
  }

  .app-header > .scoreboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 9px;
  }

  .app-header > .scoreboard > div {
    padding: 5px 4px;
    border: 1px solid rgba(255, 248, 226, .72);
    border-radius: 7px;
    background: rgba(255, 248, 226, .9);
    color: #4b2816;
    text-align: center;
  }

  .app-header > .scoreboard span { font-size: .58rem; }
  .app-header > .scoreboard strong { font-size: .88rem; }
  .site-shell--home > .app-header > .scoreboard { display: none !important; }
}

@media (max-width: 390px) {
  .site-mobile-brand { font-size: .94rem; }
  .site-mobile-logo { width: 34px; height: 34px; }
  .site-mobile-header-controls { gap: 5px; }
  .site-header-language-mobile a { min-width: 29px; padding-inline: 4px; }
  .app-header > .site-mobile-menu:not([hidden]) { grid-template-columns: 1fr; }
}

@media print {
  .app-header { display: none !important; }
}

/* Accueil : neutralisation centralisée des anciennes règles très spécifiques.
   Le gabarit visuel est conservé, mais il repose désormais sur le bandeau commun. */
@media (min-width: 701px) {
  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header.is-unified-desktop {
    display: grid !important;
    grid-template-columns: 86px minmax(0, 1fr) auto !important;
    grid-template-rows: minmax(38px, auto) 38px !important;
    grid-template-areas:
      "logo title utility"
      "logo navigation navigation" !important;
    align-items: center !important;
    min-height: 104px !important;
    padding: 9px 16px 10px !important;
    column-gap: 13px !important;
    row-gap: 2px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .site-desktop-brand {
    display: contents !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-logo {
    grid-area: logo !important;
    width: 82px !important;
    height: 82px !important;
    max-width: 82px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .brand-text {
    grid-area: title !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    text-align: left !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header h1 {
    font-size: clamp(1.72rem, 2.45vw, 2.12rem) !important;
    white-space: nowrap !important;
    text-align: left !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .subtitle,
  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .credits {
    display: none !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-actions {
    grid-area: navigation !important;
    display: flex !important;
    width: 100% !important;
    margin: 0 !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 9px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-link {
    min-height: 35px !important;
    padding: 7px 12px !important;
    font-size: .88rem !important;
    white-space: nowrap !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .site-header-desktop-language {
    grid-area: utility !important;
    display: flex !important;
  }
}

@media (min-width: 701px) and (max-width: 940px) {
  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header.is-unified-desktop {
    grid-template-columns: 72px minmax(0, 1fr) auto !important;
    grid-template-rows: 34px 36px !important;
    min-height: 90px !important;
    padding: 8px 12px 9px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-logo {
    width: 69px !important;
    height: 69px !important;
    max-width: 69px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header h1 {
    font-size: 1.48rem !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-actions {
    gap: 6px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-link {
    padding: 6px 8px !important;
    font-size: .79rem !important;
  }
}

@media (max-width: 700px) {
  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header.is-unified-desktop {
    display: block !important;
    min-height: 0 !important;
    padding: 9px 10px !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .site-mobile-header-row {
    display: flex !important;
  }

  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .site-desktop-brand,
  body:has(#welcome:not(.hidden)) .site-shell--home > .topbar.app-header .header-actions {
    display: none !important;
  }
}

/* Priorité de migration : les anciennes feuilles de certaines pages classe
   comportaient encore des règles !important. Ces sélecteurs, tous regroupés
   ici, garantissent que le composant commun reste l'unique source de vérité. */
@media (min-width: 701px) {
  .site-shell > .topbar.app-header.is-unified-desktop {
    width: 100% !important;
    max-width: none !important;
    margin: 0 0 var(--site-section-gap, 18px) !important;
  }

  .site-shell--home > .topbar.app-header.is-unified-desktop {
    margin-bottom: 0 !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop > .site-desktop-brand {
    display: contents !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop .header-logo {
    grid-area: logo !important;
    width: 82px !important;
    height: 82px !important;
    max-width: 82px !important;
    margin: 0 !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop .brand-text {
    grid-area: title !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 12px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop h1 {
    margin: 0 !important;
    font-size: clamp(1.72rem, 2.45vw, 2.12rem) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop .subtitle {
    display: block !important;
    flex: 1 1 auto !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 520px !important;
    margin: 0 !important;
    font-size: .69rem !important;
    line-height: 1.15 !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop > .header-actions {
    grid-area: navigation !important;
    display: flex !important;
    width: 100% !important;
    margin: 0 !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
  }

  .site-shell.join-page-compact > .topbar.app-header.join-topbar.is-unified-desktop {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (min-width: 701px) and (max-width: 940px) {
  .site-shell > .topbar.app-header.is-unified-desktop .header-logo {
    width: 69px !important;
    height: 69px !important;
    max-width: 69px !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop .brand-text {
    gap: 8px !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop h1 {
    font-size: 1.48rem !important;
  }

  .site-shell > .topbar.app-header.is-unified-desktop .subtitle {
    max-width: 300px !important;
    font-size: .59rem !important;
  }
}
