/* =========================================================
   THE GOAT OF THE CÔTE — feuille de style
   Esthétique grande course : sombre, contrasté, condensé.
   Mobile-first.
   ========================================================= */

:root {
  --bg:        #ffffff;   /* vrai blanc */
  --bg-alt:    #f5f6f7;   /* alternance sections, gris très clair */
  --surface:   #ffffff;
  --ink:       #16181a;   /* encre presque noire */
  --muted:     #5f5d54;   /* texte secondaire, gris chaud */
  --line:      #d9d4c6;   /* filets / séparateurs */
  --accent:    #b23d47;   /* rouge profond (rgb 178,61,71) */
  --accent-2:  #54524c;   /* gris chaud foncé (accent secondaire neutre) */
  --danger:    #b23a2a;   /* DNF */
  --maxw:      1080px;
  --font-disp: 'Oswald', 'Arial Narrow', sans-serif;
  --font-text: 'Archivo Narrow', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-disp);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.05;
  margin: 0;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* Fond épuré : aucune texture décorative. */

/* ============================ HERO ============================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% -10%, #ffffff 0%, var(--bg) 60%);
}
.topnav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
.topnav .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}
.topnav .brand img {
  height: 44px;
  width: auto;
  display: block;
}
.topnav .brand-text {
  font-family: var(--font-disp);
  font-weight: 700;
  letter-spacing: 0.25em;
  font-size: 1.1rem;
  color: var(--ink);
}
.topnav .brand:hover { text-decoration: none; }
.topnav ul {
  display: none;
  list-style: none; margin: 0; padding: 0;
  gap: 1.5rem;
}
.topnav a {
  color: var(--muted);
  text-transform: uppercase;
  font-family: var(--font-disp);
  font-weight: 500;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
}
.topnav a:hover { color: var(--ink); text-decoration: none; }

.hero-inner {
  position: relative;
  z-index: 2;
  margin: auto;
  text-align: center;
  padding: 2rem 1.25rem 4rem;
  max-width: var(--maxw);
}
.hero-logo {
  display: block;
  width: clamp(120px, 20vw, 168px);
  height: auto;
  margin: 0 auto 1.6rem;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.72rem;
  color: var(--accent-2);
  margin: 0 0 1.2rem;
}
.hero-title {
  font-size: clamp(3.2rem, 16vw, 9rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0;
  color: var(--ink);
}
.hero-sub {
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  color: var(--muted);
  margin: 1rem 0 2.2rem;
  font-weight: 300;
}

.hero-facts {
  list-style: none; padding: 0; margin: 0 auto 2.4rem;
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 1px;
  border: 1px solid var(--line);
  max-width: 740px;
}
.hero-facts li {
  flex: 1 1 150px;
  min-width: 140px;
  padding: 0.9rem 0.6rem;
  display: flex; flex-direction: column; gap: 0.2rem;
  background: rgba(22,24,26,0.02);
}
.hero-facts strong {
  font-family: var(--font-disp);
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}
.hero-facts span { color: var(--muted); font-size: 0.85rem; }

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto 2.2rem;
  flex-wrap: wrap;
}
.cd-prefix {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  color: var(--accent);
}
.cd-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  background: rgba(22,24,26,0.02);
}
.cd-box strong {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.cd-box span {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.countdown.is-live { color: var(--accent-2); }
.countdown .cd-started {
  font-family: var(--font-disp);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 1.1rem;
  color: var(--accent);
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--font-disp);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 1.05rem;
  padding: 1rem 3rem;
  border: 0;
  transition: transform 0.15s ease, background 0.15s ease;
}
.cta:hover { background: #92323a; text-decoration: none; transform: translateY(-2px); }

.hero-note {
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}
.scroll-hint {
  position: absolute; bottom: 1rem; left: 0; right: 0;
  text-align: center; color: var(--muted);
  animation: bob 1.8s ease-in-out infinite;
  z-index: 2;
}
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(6px)} }

/* ============================ SECTIONS ============================ */
.section {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4.5rem 1.25rem;
}
.section-alt {
  position: relative;
  max-width: none;
  background: var(--bg-alt);
  padding-left: 0; padding-right: 0;
  overflow: hidden;
}
.section-alt > * {
  max-width: var(--maxw);
  margin-left: auto; margin-right: auto;
  padding-left: 1.25rem; padding-right: 1.25rem;
  position: relative;
}

.section-head {
  display: flex; align-items: baseline; gap: 1rem;
  border-bottom: 2px solid var(--line);
  padding-bottom: 1rem; margin-bottom: 2rem;
}
.section-num {
  font-family: var(--font-disp);
  color: var(--accent);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.1em;
}
.section-head h2 {
  font-size: clamp(1.7rem, 6vw, 2.8rem);
}
.lead {
  font-size: 1.15rem;
  color: #33312b;
  margin-top: 0;
  margin-bottom: 2.5rem;
}
/* Les chapeaux (.lead) occupent toute la largeur de leur section. */

/* ---------- Le mot de l'organisateur ---------- */
.mot-title {
  font-family: var(--font-disp);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(1.4rem, 5vw, 2rem);
  margin-bottom: 1.5rem;
}
.mot-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}
.mot-layout .cote-photo { margin: 0; }
@media (min-width: 720px) {
  .mot-layout { grid-template-columns: 1.15fr 0.85fr; }
  .mot-layout .cote-photo { position: sticky; top: 1.5rem; }
}
.mot-body { max-width: 60ch; }
.mot-body p { margin: 0 0 1.1rem; font-size: 1.12rem; }
.mot-sign {
  margin-top: 1.8rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Règlement ---------- */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.rule {
  background: var(--surface);
  padding: 1.6rem 1.4rem;
  position: relative;
}
.rule-no {
  font-family: var(--font-disp);
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 0.1em;
}
.rule h3 { font-size: 1.25rem; margin: 0.3rem 0 0.6rem; }
.rule p { margin: 0; color: var(--muted); }

/* ---------- Légende / timeline ---------- */
.legend-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 0 0 1.8rem 1.6rem;
  border-left: 2px solid var(--line);
}
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg);
}
.timeline .year {
  font-family: var(--font-disp);
  color: var(--accent-2);
  font-weight: 700; letter-spacing: 0.1em;
  font-size: 0.95rem;
}
.timeline h3 { font-size: 1.2rem; margin: 0.2rem 0 0.5rem; }
.timeline p { margin: 0; color: var(--muted); }

.legend-photo { margin: 0; }
@media (min-width: 720px) {
  .legend-photo { position: sticky; top: 1.5rem; align-self: start; }
}
.img-placeholder {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  aspect-ratio: 4 / 3;
  background:
    repeating-linear-gradient(45deg, #efebe1 0 10px, #e6e1d4 10px 20px);
  border: 1px dashed var(--line);
  color: var(--muted);
  font-family: var(--font-disp);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.95rem;
}
.img-placeholder.small { aspect-ratio: 1 / 1; }
.legend-photo figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.6rem; font-style: italic; }

/* ---------- Profil ---------- */
.profil-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px; background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 2rem;
}
.stat {
  background: var(--surface);
  padding: 1.2rem 1rem;
  text-align: center;
}
.stat-val {
  display: block;
  font-family: var(--font-disp);
  font-size: 1.9rem; font-weight: 700;
  color: var(--accent);
}
.stat-lbl { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }

.cote-photo { margin: 0 0 2rem; }
.cote-photo img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
}
.cote-photo figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.7rem; font-style: italic; }

.profil-figure { margin: 0 0 2rem; }
.profil-chart {
  background: linear-gradient(180deg, #ffffff 0%, #f5f6f7 100%);
  border: 1px solid var(--line);
  padding: 0.5rem;
  min-height: 200px;
}
.profil-chart svg { display: block; width: 100%; height: auto; }
.profil-figure figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.7rem; }
#gps-coords { color: var(--accent-2); font-family: var(--font-disp); letter-spacing: 0.05em; }

.map {
  height: 320px;
  border: 1px solid var(--line);
  margin-bottom: 2.5rem;
  background: var(--surface);
}
/* fond de carte Leaflet en thème clair */
.leaflet-container { background: #ece8dd; }

/* ---------- Citation d'ouverture (en haut de page) ---------- */
.creed {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 3.5rem 1.25rem;
  text-align: center;
}
.creed blockquote {
  margin: 0 auto;
  max-width: 18em;
  font-family: var(--font-disp);
  font-weight: 500;
  font-style: italic;
  letter-spacing: 0.01em;
  line-height: 1.3;
  font-size: clamp(1.35rem, 3.4vw, 2.1rem);
  color: var(--ink);
  text-wrap: balance;
}

/* ---------- Palmarès / champion ---------- */
.champion {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.8rem 1.5rem;
  margin-bottom: 2.5rem;
}
.champion-badge {
  display: flex; align-items: center; gap: 1rem;
  justify-content: flex-start;
}
.champion-emblem {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.champion-laurel { width: 132px; height: auto; display: block; }
/* Sur mobile, l'emblème couronne + chèvre rend mal : on le masque. */
@media (max-width: 719px) {
  .champion-emblem { display: none; }
}
.champion-badge .goat {
  position: absolute;
  top: 46%;            /* recentré sur l'intérieur de la couronne */
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.4rem; line-height: 1;
}
.champion-title {
  font-family: var(--font-disp);
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-2);
  font-size: 1.1rem;
}
.champion-body h3 { font-size: 1.8rem; }
.champion-nick {
  margin: 0.2rem 0 0;
  font-family: var(--font-disp);
  font-style: italic;
  letter-spacing: 0.04em;
  color: var(--accent-2);
}
.champion-sub { color: var(--muted); margin: 0.3rem 0 1rem; }
.palmares-label {
  font-family: var(--font-disp);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.95rem;
  color: var(--ink);
  margin: 1.2rem 0 0;
  padding-bottom: 0.4rem;
}
.palmares-label span {
  display: block;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-text);
  font-size: 0.85rem;
  color: var(--muted);
}
.palmares-foot { margin: 1rem 0 0; color: var(--muted); font-size: 0.95rem; }
.palmares-foot .dnf { font-weight: 700; }
.palmares { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.palmares li {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 0.6rem 0; border-top: 1px solid var(--line);
}
.dnf {
  color: var(--danger);
  font-family: var(--font-disp);
  font-weight: 700; letter-spacing: 0.08em;
  text-align: right;
}

.legends-grid {
  display: grid; grid-template-columns: 1fr; gap: 1.5rem;
  margin-bottom: 2.5rem;
}
.legend-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.4rem;
}
.legend-card .img-placeholder { margin-bottom: 1rem; }
.legend-photo-img {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  filter: sepia(0.35) contrast(1.05);
}
.legend-card h3 { font-size: 1.3rem; margin-bottom: 0.5rem; }
.legend-card p { color: var(--muted); margin: 0; }

.grail-note {
  text-align: center;
  font-size: 1.15rem;
  border: 1px solid var(--accent-2);
  padding: 1.5rem;
  background: rgba(22,24,26,0.03);
}
.grail-note .pun { display: block; margin-top: 0.6rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Météo ---------- */
.weather { min-height: 120px; }
.weather-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1.6rem;
}
.weather-icon { font-size: 3.4rem; line-height: 1; }
.weather-temp { font-family: var(--font-disp); font-size: 2.6rem; font-weight: 700; }
.weather-desc { color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.9rem; }
.weather-meta {
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap; gap: 1.2rem;
  border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 0.4rem;
}
.weather-meta div { font-size: 0.95rem; }
.weather-meta strong { font-family: var(--font-disp); color: var(--accent); }
.weather-day { color: var(--accent-2); font-family: var(--font-disp); letter-spacing: 0.05em; margin-bottom: 0.8rem; }

/* ---------- Inscription ---------- */
.quota-note {
  border-left: 3px solid var(--accent);
  background: rgba(178,61,71,0.06);
  padding: 0.9rem 1.2rem;
  /* marges gauche/droite laissées à `auto` (héritées de .section-alt > *) pour rester centré */
  margin-top: 0;
  margin-bottom: 2rem;
}
.quota-note strong { color: var(--accent); }

.pps-note {
  display: flex;
  align-items: center;
  gap: 1.4rem;
  background: rgba(178,61,71,0.06);
  border: 1px solid var(--accent);
  padding: 1.4rem 1.5rem;
  margin-bottom: 2rem;
}
.pps-note p { margin: 0; }
.badge-nopps {
  flex: 0 0 auto;
  width: 92px; height: 92px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  font-family: var(--font-disp);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.05;
  color: var(--accent);
  transform: rotate(-8deg);
  position: relative;
}
/* barre diagonale d'interdiction sur le badge */
.badge-nopps::after {
  content: "";
  position: absolute; left: 8%; right: 8%; top: 50%;
  height: 3px; background: var(--accent);
  transform: rotate(-32deg);
}
.badge-nopps span { font-size: 1.15rem; position: relative; }

.form-cta-wrap {
  /* On ne réécrit PAS les marges gauche/droite : elles restent à `auto`
     (héritées de .section-alt > *) pour que le bloc reste centré malgré max-width. */
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  text-align: center;
}
.form-cta-wrap .cta { display: inline-block; font-size: 1.1rem; }
.form-fallback { color: var(--muted); font-size: 0.95rem; text-align: center; }

/* ---------- États de chargement ---------- */
.loading { color: var(--muted); font-style: italic; padding: 1.5rem 0; }
.error-msg { color: var(--danger); }

/* ---------- Partager (QR code) ---------- */
.share-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.8rem;
  text-align: center;
}
.share-qr {
  width: 220px; height: 220px;
  border: 1px solid var(--line);
  padding: 12px;
  background: #fff;
  flex: 0 0 auto;
}
.share-text .lead { margin-bottom: 1rem; }
.share-url a {
  font-family: var(--font-disp);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  font-size: 1.2rem;
}
@media (min-width: 720px) {
  .share-layout { flex-direction: row; align-items: center; text-align: left; gap: 2.5rem; }
}

/* ============================ FOOTER ============================ */
.footer {
  border-top: 2px solid var(--line);
  background: var(--bg-alt);
  padding: 3rem 1.25rem;
}
.footer > * { max-width: var(--maxw); margin: 0 auto; }
.footer-logo {
  display: block;
  width: 84px; height: auto;
  margin: 0 auto 2rem;
  opacity: 0.85;
}
.footer-club {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 0 auto 2.5rem;
}
.footer-club-label {
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--muted);
  font-size: 0.72rem;
}
.club-logo {
  width: 150px; height: auto;
  filter: grayscale(1);
  opacity: 0.85;
  transition: filter 0.3s ease, opacity 0.3s ease;
}
.footer-club a:hover .club-logo,
.footer-club a:focus-visible .club-logo {
  filter: grayscale(0);
  opacity: 1;
}
.footer-club-link {
  font-family: var(--font-disp);
  text-transform: lowercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
}
.footer-badge { text-align: center; margin: 0 auto 2.5rem; }
.utmp-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.utmp-word {
  font-family: var(--font-disp);
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 0.9;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.utmp-word sup { font-size: 0.32em; vertical-align: super; }
.utmp-banner {
  margin-top: 0.35rem;
  font-family: var(--font-disp);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  font-size: 0.8rem;
  color: #fff;
  background: var(--ink);
  padding: 0.22rem 0.8rem 0.18rem 0.95rem;
}

.sponsors-label {
  display: block; text-align: center;
  text-transform: uppercase; letter-spacing: 0.3em;
  color: var(--muted); font-size: 0.75rem; margin-bottom: 1.2rem;
}
.sponsors ul {
  list-style: none; margin: 0 0 2.5rem; padding: 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem 2.2rem;
}
.sponsors li {
  font-family: var(--font-disp);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-size: 0.95rem;
  opacity: 0.7;
}
.footer-mentions { text-align: center; color: var(--muted); font-size: 0.9rem; }
.footer-mentions p { margin: 0.6rem auto; max-width: 70ch; }
.copyright { font-size: 0.82rem; opacity: 0.7; }

/* ============================ RESPONSIVE ============================ */
@media (min-width: 720px) {
  .topnav ul { display: flex; }
  .rules-grid { grid-template-columns: repeat(3, 1fr); }
  .legend-layout { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .profil-stats { grid-template-columns: repeat(4, 1fr); }
  .champion { grid-template-columns: 220px 1fr; align-items: center; }
  .champion-badge { flex-direction: column; text-align: center; }
  .legends-grid { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .scroll-hint { animation: none; }
}
