/* =====================================================================
   DJERBA CYCLISME — feuille de style commune (page d'accueil et pages de parcours)
   Sans Bootstrap, sans bibliothèque : un seul fichier, une seule police (Archivo, hébergée ici).
   Couleurs tirées du logo et du fond : indigo du logo, bleu des portes de Djerba, rouge du maillot.
   ===================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --chaux: #ffffff;
  --brume: #eef4f9;
  --trait: #cddbe7;
  --indigo: #0b3c61;
  --porte: #1b6fcb;
  --ciel: #8cc3f5;
  --maillot: #d91a1f;
  --maillot-fonce: #b4141a;
  --texte: #17324a;
  --discret: #4a6275;
  --sur-indigo: #c3dbf0;
  --cote: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  font: 400 1.0625rem/1.6 "Archivo", system-ui, -apple-system, "Segoe UI", Tahoma, Arial, sans-serif;
  color: var(--texte);
  background: var(--chaux);
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--porte); }
a:hover { color: var(--indigo); }
:focus-visible { outline: 3px solid var(--maillot); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icone { width: 1.5rem; height: 1.5rem; flex: none; }
.icone-trait { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icone-plein { fill: currentColor; }

.wrap { width: min(var(--cote), 100% - 2.5rem); margin-inline: auto; }
.wrap-etroit { width: min(820px, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Titres : Archivo en largeur maximale, gras ---------- */
h1, h2, h3, .chiffre {
  font-stretch: 125%;
  font-weight: 850;
  line-height: 1.04;
  letter-spacing: -.01em;
  color: var(--indigo);
  text-wrap: balance;
}
h2 { font-size: clamp(1.85rem, 1.2rem + 2.6vw, 2.9rem); margin: 0 0 .7rem; }
h3 { font-size: clamp(1.4rem, 1.05rem + 1.4vw, 2rem); margin: 0 0 .5rem; }
.intro { max-width: 40rem; margin: 0 0 2rem; color: var(--discret); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .8rem 1.25rem;
  font: inherit; font-weight: 700; line-height: 1.2; text-decoration: none;
  border: 2px solid transparent; cursor: pointer;
}
.btn-rouge { background: var(--maillot); color: #fff; }
.btn-rouge:hover { background: var(--maillot-fonce); color: #fff; }
.btn-ligne { border-color: currentColor; color: var(--indigo); background: transparent; }
.btn-ligne:hover { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.sur-indigo .btn-ligne, .tour-neuf .btn-ligne { color: #fff; }
.sur-indigo .btn-ligne:hover, .tour-neuf .btn-ligne:hover { background: #fff; border-color: #fff; color: var(--indigo); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }

/* ---------- En-tête collant ---------- */
.bandeau { position: sticky; top: 0; z-index: 30; background: #fff; border-bottom: 1px solid var(--trait); }
.bandeau .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.marque { display: flex; align-items: center; gap: .7rem; color: var(--indigo); text-decoration: none; font-stretch: 125%; font-weight: 850; letter-spacing: -.005em; }
.marque img { width: 2.75rem; height: 2.75rem; }
.menu { display: flex; gap: .15rem; }
.menu a { padding: .55rem .8rem; color: var(--indigo); font-weight: 600; text-decoration: none; white-space: nowrap; }
.menu a:hover { color: var(--maillot); }
.menu a[aria-current="page"] { color: var(--maillot); }
@media (max-width: 560px) {
  .marque span { display: none; }
  .menu a { padding: .55rem .6rem; }
}
@media (max-width: 480px) { .menu .long { display: none; } }

/* ---------- Page d'accueil : en-tête illustré ---------- */
.hero-img img { width: 100%; height: clamp(320px, 50vw, 600px); object-fit: cover; object-position: 64% 62%; }
.hero-corps {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem); align-items: end;
  margin-top: -6rem; padding-bottom: clamp(3rem, 6vw, 5rem);
}
.hero-titre { background: #fff; padding: clamp(1.5rem, 3vw, 2.6rem); }
.hero-titre h1 { margin: 0 0 .6rem; font-size: clamp(2.3rem, 1.3rem + 4.6vw, 4.5rem); line-height: .98; }
.slogan { margin: 0; font-size: 1.3rem; font-weight: 650; color: var(--texte); }
.ar { margin: .2rem 0 1.1rem; font-size: 1.2rem; color: var(--discret); }
.chapeau { max-width: 34rem; margin: 0 0 1.6rem; }

/* La porte bleue de Djerba : le compte à rebours du prochain tour */
.porte {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center;
  min-height: 25rem; margin-top: -5rem; padding: 6rem 1.6rem 2rem;
  background: var(--porte); color: #fff; text-decoration: none;
  border-radius: 999px 999px 0 0;
}
.porte:hover { background: #165fb0; color: #fff; }
.porte::before {
  content: ""; position: absolute; inset: .8rem; pointer-events: none;
  border: 2px solid rgba(255, 255, 255, .55); border-radius: 999px 999px 0 0;
}
.porte-etat { font-weight: 650; }
.porte-num { display: block; margin: .15rem 0 .1rem; font-stretch: 125%; font-weight: 900; font-size: clamp(4.5rem, 3rem + 5vw, 7rem); line-height: .95; color: #fff; }
.porte-num.long { font-size: clamp(2.4rem, 2rem + 2vw, 3.4rem); line-height: 1.1; padding: .8rem 0 1rem; }
.porte-unite { font-weight: 650; font-size: 1.1rem; }
.porte-detail { margin: 1rem 0 1.2rem; color: #e3f0fc; font-size: .98rem; line-height: 1.45; }
.porte-lien { display: inline-block; padding: .55rem 1.1rem; background: #fff; color: var(--indigo); font-weight: 700; }
@media (max-width: 880px) {
  .hero-corps { display: block; margin-top: -3rem; }
  .porte { margin: 1.5rem auto 0; width: min(100%, 22rem); min-height: 23rem; padding-top: 5rem; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(3rem, 6vw, 5.5rem) 0; }
.section-brume { background: var(--brume); }
.section-indigo { background: var(--indigo); color: #fff; }
.section-trait { border-top: 1px solid var(--trait); }

/* ---------- Cartes de parcours ---------- */
.tour {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  padding: clamp(1.4rem, 4vw, 3rem); margin-top: 1.5rem;
}
.tour-neuf { background: var(--indigo); color: #fff; }
.tour-neuf h3 { color: #fff; }
.tour-ancien { background: #fff; border: 1px solid var(--trait); }
.etat { display: inline-block; padding: .25rem .75rem; background: var(--maillot); color: #fff; font-weight: 700; font-size: .95rem; }
.tour-ancien .etat { background: var(--brume); color: var(--indigo); }
.tour h3 { margin: .9rem 0 .4rem; font-size: clamp(1.6rem, 1.1rem + 2.2vw, 2.5rem); }
.dates { margin: 0 0 1.4rem; font-weight: 500; }
.tour-neuf .dates { color: var(--sur-indigo); }
.chiffres { display: flex; flex-wrap: wrap; gap: 1rem clamp(1.2rem, 3vw, 2.4rem); margin: 0 0 1.6rem; padding: 0; list-style: none; }
.chiffre { display: block; font-size: clamp(2rem, 1.3rem + 2.8vw, 3.3rem); line-height: 1; }
.tour-neuf .chiffre { color: #fff; }
.chiffre small { display: block; margin-top: .4rem; font-stretch: 100%; font-weight: 500; font-size: .95rem; letter-spacing: 0; color: var(--discret); }
.tour-neuf .chiffre small { color: var(--sur-indigo); }

.etapes { list-style: none; margin: 0; padding: 0; align-self: start; }
.etapes li {
  display: grid; grid-template-columns: 1.7rem minmax(0, 1fr) auto; column-gap: .75rem; row-gap: .35rem; align-items: baseline;
  padding: .7rem 0 .8rem; border-top: 1px solid var(--trait);
}
.etapes li:last-child { border-bottom: 1px solid var(--trait); }
.tour-neuf .etapes li { border-color: rgba(255, 255, 255, .2); }
.etapes .n { font-stretch: 125%; font-weight: 850; color: var(--porte); }
.tour-neuf .etapes .n { color: var(--ciel); }
.etapes .km { font-weight: 700; font-variant-numeric: tabular-nums; }
.etapes li::after { content: ""; grid-column: 2 / 4; height: 4px; width: var(--l); background: var(--porte); }
.tour-neuf .etapes li::after { background: var(--ciel); }
.tour-liens { display: flex; flex-wrap: wrap; gap: .75rem; }
.tour-ancien .btn-rouge { background: var(--indigo); }
.tour-ancien .btn-rouge:hover { background: var(--porte); }
@media (max-width: 860px) { .tour { grid-template-columns: 1fr; } }

/* ---------- Carrousel ---------- */
.car { position: relative; background: var(--indigo); }
.car-piste { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.car-piste::-webkit-scrollbar { display: none; }
.car-vue { position: relative; flex: 0 0 100%; margin: 0; scroll-snap-align: center; }
.car-vue img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 65%; }
.car-vue figcaption { position: absolute; left: 0; bottom: 0; padding: .55rem 1rem; background: var(--indigo); color: #fff; font-weight: 600; }
.car-ctrl { position: absolute; right: 0; bottom: 0; display: flex; }
.car-ctrl button { display: grid; place-items: center; width: 3.2rem; height: 3.2rem; padding: 0; border: 0; background: #fff; color: var(--indigo); cursor: pointer; }
.car-ctrl button + button { border-left: 1px solid var(--trait); }
.car-ctrl button:hover { background: var(--maillot); color: #fff; }
.car-ctrl .icone { width: 1.4rem; height: 1.4rem; }
@media (max-width: 600px) { .car-vue img { aspect-ratio: 4 / 3; } }

/* ---------- Galerie et visionneuse ---------- */
.galerie-titre { margin: clamp(2.5rem, 5vw, 4rem) 0 1.2rem; }
.galerie { columns: 3 160px; column-gap: .75rem; }
.vignette { display: block; width: 100%; margin: 0 0 .75rem; padding: 0; border: 0; background: var(--brume); break-inside: avoid; cursor: zoom-in; }
.vignette img { width: 100%; }

dialog.vis { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #072034; color: #fff; }
dialog.vis[open] { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
dialog.vis::backdrop { background: #072034; }
.vis-image { position: relative; min-height: 0; }
.vis-image img { position: absolute; top: 3.5rem; left: 1rem; width: calc(100% - 2rem); height: calc(100% - 3.5rem); max-width: none; object-fit: contain; }
.vis-pied { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.2rem 1.1rem; font-weight: 600; }
.vis button { display: grid; place-items: center; width: 3rem; height: 3rem; padding: 0; border: 0; background: #fff; color: var(--indigo); cursor: pointer; }
.vis button:hover { background: var(--maillot); color: #fff; }
.vis-fermer { position: absolute; top: 0; right: 0; }
.vis-nav { display: flex; gap: 1px; }

/* ---------- Liens et contact ---------- */
.contact-grille { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: start; }
.liens { list-style: none; margin: 0; padding: 0; }
.liens li { border-top: 1px solid var(--trait); }
.liens li:last-child { border-bottom: 1px solid var(--trait); }
.lien { display: grid; grid-template-columns: 2.8rem minmax(0, 1fr); gap: 1rem; align-items: center; padding: .8rem 0; color: var(--indigo); text-decoration: none; }
.lien .pastille { display: grid; place-items: center; width: 2.8rem; height: 2.8rem; background: var(--indigo); color: #fff; }
.lien:hover .pastille { background: var(--maillot); }
.lien b { display: block; font-weight: 700; line-height: 1.25; }
.lien span.sous { display: block; font-size: .95rem; color: var(--discret); }
.lien:hover b { color: var(--maillot); }
.coordonnees { margin: 0; font-style: normal; }
.coordonnees p { margin: 0 0 1rem; }
.coordonnees strong { display: block; font-weight: 700; color: var(--indigo); }
.logo-club { width: min(15rem, 70%); height: auto; margin: 0 0 1.5rem; }
@media (max-width: 860px) { .contact-grille { grid-template-columns: 1fr; } }

/* ---------- Pied de page ---------- */
.pied { padding: 2rem 0 2.4rem; background: var(--indigo); color: var(--sur-indigo); font-size: .95rem; }
.pied .wrap { display: flex; flex-wrap: wrap; gap: .5rem 2rem; justify-content: space-between; }
.pied a { color: #fff; }
.pied p { margin: 0; }

/* =====================================================================
   PAGES DE PARCOURS (oct25, oct26)
   ===================================================================== */
.tete-page { padding: clamp(2.5rem, 6vw, 4.5rem) 0 clamp(2rem, 4vw, 3rem); background: var(--indigo); color: #fff; }
.tete-page h1 { margin: .9rem 0 .5rem; color: #fff; font-size: clamp(2rem, 1.2rem + 4vw, 3.8rem); }
.tete-page .dates { margin: 0 0 1.6rem; color: var(--sur-indigo); font-size: 1.15rem; }
.tete-page .chiffres { margin-bottom: 0; }
.tete-page .chiffre { color: #fff; }
.tete-page .chiffre small { color: var(--sur-indigo); }
.fil { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.8rem; }

.bloc { padding: clamp(2.2rem, 5vw, 3.6rem) 0; }
.bloc + .bloc { border-top: 1px solid var(--trait); }
.bloc h2 { font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.2rem); }
.jours + .transport { margin-top: 1.8rem; }
.transport { margin: 0 0 1.2rem; padding: 1rem 1.2rem; background: var(--brume); border-left: 6px solid var(--maillot); }
.transport b { display: block; color: var(--indigo); }
.transport p { margin: .3rem 0 0; }

.jours { list-style: none; margin: 1.5rem 0 0; padding: 0; counter-reset: jour; }
.jour { position: relative; padding: 0 0 2rem 3.4rem; }
.jour::before {
  counter-increment: jour; content: counter(jour);
  position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 2.3rem; height: 2.3rem;
  background: var(--indigo); color: #fff; font-stretch: 125%; font-weight: 850;
}
.jour::after { content: ""; position: absolute; left: 1.1rem; top: 2.5rem; bottom: .2rem; width: 2px; background: var(--trait); }
.jour:last-child { padding-bottom: 0; }
.jour:last-child::after { display: none; }
.jour-date { margin: 0; font-weight: 650; color: var(--discret); }
.jour h3 { margin: .15rem 0 .6rem; font-size: clamp(1.3rem, 1rem + 1.2vw, 1.8rem); }
.jour-heure { margin: -.2rem 0 .6rem; color: var(--discret); }
.mesures { display: flex; flex-wrap: wrap; gap: .4rem 1.6rem; margin: 0 0 .8rem; padding: 0; list-style: none; font-weight: 700; font-variant-numeric: tabular-nums; }
.mesures small { font-weight: 500; color: var(--discret); }
.barre { height: 6px; margin: 0 0 1rem; background: var(--brume); }
.barre i { display: block; height: 100%; width: var(--l); background: var(--porte); }
.jour-liens { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 .8rem; padding: 0; list-style: none; }
.jour-liens a { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .85rem; border: 1px solid var(--trait); color: var(--indigo); font-weight: 650; text-decoration: none; background: #fff; }
.jour-liens a:hover { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.jour-liens a.garmin { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.jour-liens a.garmin:hover { background: var(--maillot); border-color: var(--maillot); }
.jour-liens .icone { width: 1.1rem; height: 1.1rem; }
.meteo { margin: 0; padding: 0; list-style: none; font-size: .95rem; color: var(--discret); }
.total { margin: 1.2rem 0 0; padding: 1.1rem 1.3rem; background: var(--brume); font-weight: 700; color: var(--indigo); }
.total small { display: block; margin-top: .3rem; font-weight: 500; color: var(--discret); }

.participants { columns: 2 280px; column-gap: 2rem; margin: 1rem 0; padding: 0; list-style: none; }
.participants li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; break-inside: avoid; padding: .55rem 0; border-top: 1px solid var(--trait); }
.participants .ar-nom { font-size: 1.05rem; color: var(--discret); }
.chauffeur { margin: 1rem 0 0; color: var(--discret); }
.suite { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1.2rem; }
.suite a { display: block; padding: 1.1rem 1.3rem; border: 1px solid var(--trait); text-decoration: none; color: var(--indigo); font-weight: 700; }
.suite a small { display: block; margin-top: .2rem; font-weight: 500; color: var(--discret); }
.suite a:hover { background: var(--brume); }

@media print {
  .bandeau, .car-ctrl, .pied { display: none; }
}

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