/* =====================================================================
   La Course aux nombres — Zone Moyen-Orient
   Charte reprise des sujets (can-design.sty, version couleur) :
   canAccent #1F3B73 · canVif #E8590C · canCarte #EDF1F8 · Fira Sans
   ===================================================================== */

@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Italic.otf") format("opentype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Medium.otf") format("opentype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-SemiBold.otf") format("opentype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-Bold.otf") format("opentype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("../fonts/FiraSans-ExtraBold.otf") format("opentype"); font-weight: 800; font-display: swap; }

:root {
  --accent: #1F3B73;
  --accent-2: #2C4F94;
  --vif: #E8590C;
  --carte: #EDF1F8;
  --trait: #C7CFDD;
  --texte: #1C2333;
  --discret: #5B6478;
  --fond: #FFFFFF;
  --ok: #2B8A3E;
  --erreur: #C92A2A;
  --rayon: 10px;
  --largeur: 1080px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Fira Sans", system-ui, sans-serif;
  color: var(--texte);
  background: var(--fond);
  line-height: 1.55;
  font-size: 17px;
}
img { max-width: 100%; }
a { color: var(--accent); }
a:hover { color: var(--vif); }
:focus-visible { outline: 3px solid var(--vif); outline-offset: 2px; }

.conteneur { max-width: var(--largeur); margin: 0 auto; padding: 0 24px; }

/* ---------- Damier (bande d'arrivée des sujets) ---------- */
.damier {
  height: 22px;
  background-color: transparent;
  background-image:
    conic-gradient(var(--accent) 25%, transparent 0 50%, var(--accent) 0 75%, transparent 0);
  background-size: 11px 11px;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.15) 20%, #000 75%);
          mask-image: linear-gradient(90deg, transparent 0%, rgba(0,0,0,.15) 20%, #000 75%);
}

/* ---------- En-tête et navigation ---------- */
.entete { border-bottom: 1px solid var(--trait); background: #fff; position: sticky; top: 0; z-index: 10; }
.entete .conteneur { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.logo { display: flex; flex-direction: column; text-decoration: none; color: var(--accent); line-height: 1.1; }
.logo strong { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; }
.logo span { font-size: .82rem; color: var(--discret); font-weight: 500; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  text-decoration: none; color: var(--accent); font-weight: 600;
  padding: 8px 14px; border-radius: 8px;
}
.nav a:hover { background: var(--carte); color: var(--accent); }
.nav a[aria-current="page"] { background: var(--accent); color: #fff; }
.nav a.cta { border: 2px solid var(--vif); color: var(--vif); }
.nav a.cta:hover { background: var(--vif); color: #fff; }
.nav a.cta[aria-current="page"] { background: var(--vif); color: #fff; }

/* ---------- Bandeau titre (style page de garde) ---------- */
.bandeau { padding: 48px 0 40px; }
.bandeau .conteneur { display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: end; }
.bandeau h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; color: var(--accent); margin: 0; line-height: 1.05; letter-spacing: -0.02em; }
.bandeau .devise { font-style: italic; color: var(--discret); font-weight: 600; font-size: 1.15rem; margin: 10px 0 0; }
.bandeau .intro { max-width: 640px; margin: 22px 0 0; font-size: 1.1rem; }
.etiquette {
  background: var(--accent); color: #fff; border-radius: var(--rayon);
  padding: 14px 22px; text-align: center; line-height: 1.2; min-width: 200px;
}
.etiquette small { display: block; font-size: .8rem; font-weight: 600; opacity: .9; }
.etiquette strong { display: block; font-size: 1.45rem; font-weight: 700; margin-top: 4px; }

/* ---------- Sections ---------- */
section { padding: 40px 0; }
section.alt { background: var(--carte); }
h2 { color: var(--accent); font-size: 1.75rem; font-weight: 700; margin: 0 0 8px; }
h3 { color: var(--accent); font-size: 1.2rem; font-weight: 700; margin: 0 0 6px; }
.chapeau { color: var(--discret); margin: 0 0 28px; max-width: 720px; }

/* ---------- Tuiles (30 questions / 20 minutes / sans calculatrice) ---------- */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tuile {
  background: var(--carte); border-radius: var(--rayon); padding: 16px 18px;
  display: flex; align-items: center; gap: 14px; font-weight: 700; color: var(--accent);
}
section.alt .tuile { background: #fff; }
.tuile svg { flex: none; width: 30px; height: 30px; fill: var(--accent); }
.tuile small { display: block; font-weight: 500; color: var(--discret); font-size: .85rem; }

/* ---------- Étapes numérotées (pastilles des questions) ---------- */
.etapes { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.etapes li {
  display: grid; grid-template-columns: 40px 200px 1fr; gap: 16px; align-items: center;
  background: var(--carte); border-radius: var(--rayon); padding: 12px 16px;
}
section.alt .etapes li { background: #fff; }
.pastille {
  width: 34px; height: 34px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.etapes .titre { font-weight: 700; color: var(--accent); }

/* ---------- Piste (calendrier) ---------- */
.piste { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 12px; }
.piste::before {
  content: ""; position: absolute; left: 8%; right: 8%; top: 22px; height: 3px; background: var(--accent);
}
.jalon { position: relative; text-align: center; }
.jalon .point {
  width: 46px; height: 46px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 1.1rem;
  background: #fff; color: var(--accent); border: 3px solid var(--accent); position: relative; z-index: 1;
}
.jalon.final .point { background: var(--vif); border-color: var(--vif); color: #fff; }
.jalon .quand { display: inline-block; font-weight: 700; color: var(--vif); text-transform: uppercase; font-size: .85rem; letter-spacing: .04em; }
.jalon h3 { margin: 4px 0 8px; }
.jalon .carte { text-align: left; }

/* ---------- Cartes ---------- */
.carte { background: #fff; border: 1.5px solid var(--accent); border-radius: var(--rayon); padding: 20px 22px; }
.carte.plein { background: var(--carte); border-color: transparent; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.grille-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.carte p:last-child, .carte ul:last-child { margin-bottom: 0; }
.carte ul { padding-left: 20px; }

/* ---------- Sujets ---------- */
.cycle { margin-bottom: 36px; }
.cycle-titre { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.cycle-titre p { margin: 0; color: var(--discret); }
.niveau { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.niveau header { background: var(--accent); color: #fff; padding: 12px 18px; display: flex; justify-content: space-between; align-items: center; }
.niveau header strong { font-size: 1.3rem; }
.niveau header small { font-size: .82rem; opacity: .9; text-align: right; }
.niveau .corps { padding: 14px 18px 18px; display: grid; gap: 14px; }
.serie h4 { margin: 0 0 8px; color: var(--accent); font-size: 1rem; }
.liens { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: .92rem;
  text-decoration: none; border: 1.5px solid var(--accent); color: var(--accent); background: #fff;
  cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--accent); color: #fff; }
.btn.corrige { border-color: var(--vif); color: var(--vif); }
.btn.corrige:hover { background: var(--vif); color: #fff; }
.btn.principal { background: var(--vif); border-color: var(--vif); color: #fff; font-size: 1.05rem; padding: 12px 22px; }
.btn.principal:hover { background: #c94a06; border-color: #c94a06; }
.btn svg { width: 16px; height: 16px; fill: currentColor; }

.telechargement { display: flex; gap: 16px; align-items: flex-start; }
.telechargement .icone { flex: none; width: 48px; height: 48px; border-radius: 10px; background: var(--accent); display: grid; place-items: center; }
.telechargement .icone svg { width: 26px; height: 26px; fill: #fff; }
.telechargement p { margin: 4px 0 12px; color: var(--discret); }

.encart { border-left: 5px solid var(--vif); background: #FFF4EC; padding: 14px 18px; border-radius: 0 var(--rayon) var(--rayon) 0; }
.encart strong { color: var(--vif); }

/* ---------- Formulaire ---------- */
form { display: grid; gap: 22px; }
fieldset { border: 1.5px solid var(--accent); border-radius: var(--rayon); padding: 18px 22px 22px; margin: 0; }
legend { font-weight: 700; color: var(--accent); padding: 0 8px; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
.champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 18px; }
label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
label .facultatif { font-weight: 400; color: var(--discret); font-size: .85rem; }
input[type=text], input[type=email], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: inherit;
  border: 1.5px solid var(--trait); border-radius: 8px; background: #fff;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(31,59,115,.15); }
textarea { min-height: 96px; resize: vertical; }
.aide { font-size: .85rem; color: var(--discret); margin-top: 4px; }

table.niveaux { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
table.niveaux th { text-align: left; font-size: .85rem; color: var(--discret); font-weight: 600; padding: 0 8px; }
table.niveaux td { background: var(--carte); padding: 8px; }
table.niveaux td:first-child { border-radius: 8px 0 0 8px; }
table.niveaux td:last-child { border-radius: 0 8px 8px 0; }
table.niveaux input[type=number] { max-width: 120px; padding: 7px 10px; }
table.niveaux input:disabled { opacity: .45; }
.case { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--accent); cursor: pointer; margin: 0; }
.case input { width: 20px; height: 20px; accent-color: var(--accent); }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }
.radios label { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0; cursor: pointer; }
.radios input { accent-color: var(--accent); width: 18px; height: 18px; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.message { padding: 16px 18px; border-radius: var(--rayon); font-weight: 500; }
.message.ok { background: #EBFBEE; border: 1.5px solid var(--ok); color: #1b5e2a; }
.message.erreur { background: #FFF5F5; border: 1.5px solid var(--erreur); color: var(--erreur); }
.envoi { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

/* ---------- Pied de page (style pied des sujets) ---------- */
.pied { border-top: 1px solid var(--trait); margin-top: 40px; padding: 18px 0 28px; font-size: .9rem; color: var(--discret); }
.pied .conteneur { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pied .fil { flex: 1; min-width: 160px; height: 2px; background: var(--texte); position: relative; margin: 0 12px; }
.pied .fil::after { content: ""; position: absolute; right: -6px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--vif); }
.pied strong { color: var(--accent); }

/* ---------- Adaptation mobile ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  .bandeau .conteneur { grid-template-columns: 1fr; }
  .etiquette { justify-self: start; }
  .etapes li { grid-template-columns: 40px 1fr; }
  .etapes li > span:last-child { grid-column: 2; }
  .piste { grid-template-columns: 1fr; }
  .piste::before { left: 22px; right: auto; top: 0; bottom: 0; width: 3px; height: auto; }
  .jalon { text-align: left; display: grid; grid-template-columns: 46px 1fr; gap: 14px; }
  .jalon .point { margin: 0; }
  .pied .fil { display: none; }
}

@media print {
  .entete, .pied, .nav { display: none; }
}

/* ---------- Équipe de finale ---------- */
.equipe { margin-top: 36px; background: #fff; border-radius: var(--rayon); padding: 22px 24px; border: 1.5px solid var(--vif); }
.equipe > p { margin: 0 0 16px; color: var(--discret); }
.maillots { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.maillots li { background: var(--carte); border-radius: var(--rayon); padding: 12px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.maillots .niv { width: 44px; height: 44px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.maillots span:not(.niv) { font-weight: 700; color: var(--accent); }
.maillots small { color: var(--vif); font-weight: 600; }
@media (max-width: 760px) { .maillots { grid-template-columns: repeat(3, 1fr); } }
