/* Challenge mobilité CCCLA — feuille de style unique, pensée mobile d'abord.
   Aucune bibliothèque externe : rien à télécharger, tout fonctionne hors ligne. */

:root {
  --vert: #1f7a5a;
  --vert-clair: #e7f4ee;
  --vert-fonce: #14523c;
  --ambre: #b06a00;
  --ambre-clair: #fdf3e0;
  --rouge: #b3261e;
  --rouge-clair: #fdecea;
  --bleu: #1d5c8f;
  --bleu-clair: #e8f1f8;
  --encre: #1a2b28;
  --encre-douce: #5c6b68;
  --bord: #dde5e2;
  --fond: #f5f8f7;
  --carte: #ffffff;
  --ombre: 0 1px 2px rgba(20, 40, 35, .06), 0 4px 14px rgba(20, 40, 35, .05);
  --rayon: 14px;
  --large: 1080px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--encre);
  background: var(--fond);
}

/* ------------------------------------------------------------------ mise en page */
.bandeau {
  background: var(--vert);
  color: #fff;
  padding: .7rem 1rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .12);
}

.bandeau-interne {
  max-width: var(--large);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}

.bandeau a { color: #fff; text-decoration: none; }
.bandeau .marque { font-weight: 700; font-size: 1.05rem; letter-spacing: -.01em; }
.bandeau .marque span { opacity: .85; font-weight: 400; }
.bandeau nav { margin-left: auto; display: flex; gap: .25rem; flex-wrap: wrap; }

.bandeau nav a {
  padding: .4rem .7rem;
  border-radius: 999px;
  font-size: .92rem;
  white-space: nowrap;
}
.bandeau nav a:hover { background: rgba(255, 255, 255, .16); }
.bandeau nav a.actif { background: rgba(255, 255, 255, .22); font-weight: 600; }

main { max-width: var(--large); margin: 0 auto; padding: 1rem 1rem 4rem; }

.pied {
  max-width: var(--large);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  color: var(--encre-douce);
  font-size: .85rem;
  border-top: 1px solid var(--bord);
}

/* ------------------------------------------------------------------ titres */
h1 { font-size: 1.5rem; margin: .2rem 0 .3rem; letter-spacing: -.02em; }
h2 { font-size: 1.18rem; margin: 1.6rem 0 .6rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; }
p { margin: .5rem 0; }
.chapeau { color: var(--encre-douce); margin: 0 0 1rem; }
.petit { font-size: .85rem; color: var(--encre-douce); }
.gras { font-weight: 600; }
.centre { text-align: center; }

/* ------------------------------------------------------------------ cartes */
.carte {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 1rem;
  box-shadow: var(--ombre);
  margin-bottom: 1rem;
}
.carte > :first-child { margin-top: 0; }
.carte > :last-child { margin-bottom: 0; }
.carte-plate { box-shadow: none; }
.carte-verte { background: var(--vert-clair); border-color: #c9e6d8; }
.carte-ambre { background: var(--ambre-clair); border-color: #f0dcb4; }

.grille { display: grid; gap: 1rem; }
@media (min-width: 720px) {
  .grille-2 { grid-template-columns: 1fr 1fr; }
  .grille-3 { grid-template-columns: repeat(3, 1fr); }
  .grille-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ------------------------------------------------------------------ formulaires */
label { display: block; font-weight: 600; margin: .9rem 0 .3rem; font-size: .95rem; }
.aide { font-weight: 400; color: var(--encre-douce); font-size: .85rem; margin-top: .1rem; }

input[type="text"], input[type="email"], input[type="number"], input[type="date"],
input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  padding: .7rem .8rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--encre);
  background: #fff;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(31, 122, 90, .25);
  border-color: var(--vert);
}
textarea { min-height: 5rem; resize: vertical; }

.bouton, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 48px;
  padding: .7rem 1.2rem;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--vert);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}
.bouton:hover, button:hover { background: var(--vert-fonce); }
.bouton-large { width: 100%; }
.bouton-secondaire {
  background: #fff;
  color: var(--vert-fonce);
  border: 1.5px solid var(--bord);
}
.bouton-secondaire:hover { background: var(--vert-clair); }
.bouton-danger { background: var(--rouge); }
.bouton-danger:hover { background: #8c1c16; }
.bouton-petit { min-height: 36px; padding: .35rem .7rem; font-size: .88rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.1rem; }
.actions-fin { justify-content: flex-end; }

/* ------------------------------------------------------------------ choix en gros boutons */
.choix { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.choix-1 { grid-template-columns: 1fr; }
@media (min-width: 620px) { .choix-4 { grid-template-columns: repeat(4, 1fr); } }

.choix input { position: absolute; opacity: 0; width: 0; height: 0; }

.choix label {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  min-height: 92px;
  padding: .8rem .5rem;
  text-align: center;
  background: #fff;
  border: 2px solid var(--bord);
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: .95rem;
  transition: background .12s, border-color .12s;
}
.choix label:hover { background: var(--vert-clair); }
.choix label .emoji { font-size: 1.6rem; line-height: 1; }
.choix label .detail { font-weight: 400; font-size: .78rem; color: var(--encre-douce); }
.choix input:checked + label {
  background: var(--vert-clair);
  border-color: var(--vert);
  box-shadow: inset 0 0 0 1px var(--vert);
}
.choix input:focus-visible + label { outline: 3px solid rgba(31, 122, 90, .35); }
.choix label.compact { min-height: 56px; flex-direction: row; }

/* cases à cocher en ligne */
.cases { display: flex; flex-wrap: wrap; gap: .5rem; }
.cases label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem .8rem;
  min-height: 44px;
  border: 2px solid var(--bord);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  font-weight: 500;
}
.cases input { accent-color: var(--vert); width: 1.1rem; height: 1.1rem; }
.cases label:has(input:checked) { background: var(--vert-clair); border-color: var(--vert); }

/* ------------------------------------------------------------------ messages */
.message {
  padding: .8rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  border: 1px solid;
  display: flex;
  gap: .6rem;
  align-items: flex-start;
}
.message-succes { background: var(--vert-clair); border-color: #b5ddc9; color: var(--vert-fonce); }
.message-erreur { background: var(--rouge-clair); border-color: #f3c4c0; color: #7f1d17; }
.message-info { background: var(--bleu-clair); border-color: #c3dcef; color: #14456b; }
.message-attention { background: var(--ambre-clair); border-color: #f0dcb4; color: #7a4a00; }

/* ------------------------------------------------------------------ étiquettes */
.etiquette {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .12rem .55rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
  background: var(--bord);
  color: var(--encre);
  white-space: nowrap;
}
.etiquette-verte { background: var(--vert-clair); color: var(--vert-fonce); }
.etiquette-ambre { background: var(--ambre-clair); color: var(--ambre); }
.etiquette-rouge { background: var(--rouge-clair); color: var(--rouge); }
.etiquette-bleue { background: var(--bleu-clair); color: var(--bleu); }
.etiquette-neutre { background: #eef2f1; color: var(--encre-douce); }

/* ------------------------------------------------------------------ score */
.score-grand { font-size: 2.6rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; }
.score-grand small { font-size: .9rem; font-weight: 500; color: var(--encre-douce); }
.jauge { height: 10px; background: #e7ece9; border-radius: 999px; overflow: hidden; margin: .5rem 0; }
.jauge > span { display: block; height: 100%; background: var(--vert); border-radius: 999px; }
.jauge-ambre > span { background: var(--ambre); }
.jauge-rouge > span { background: var(--rouge); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 12px;
  padding: .8rem;
}
.stat .valeur { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .libelle { font-size: .82rem; color: var(--encre-douce); }

/* ------------------------------------------------------------------ semaine */
.semaine { display: grid; gap: .6rem; }
@media (min-width: 760px) { .semaine { grid-template-columns: repeat(7, 1fr); } }

.jour {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .8rem;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-left: 4px solid var(--bord);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}
@media (min-width: 760px) {
  .jour { flex-direction: column; text-align: center; gap: .3rem; border-left-width: 1px; border-top: 4px solid var(--bord); }
}
.jour:hover { border-color: var(--vert); background: var(--vert-clair); }
.jour .date { font-weight: 700; font-size: .9rem; text-transform: capitalize; }
.jour .emoji { font-size: 1.5rem; }
.jour .info { font-size: .8rem; color: var(--encre-douce); }
.jour .pts { font-weight: 700; margin-left: auto; }
@media (min-width: 760px) { .jour .pts { margin-left: 0; } }
.jour-fait { border-left-color: var(--vert); }
.jour-neutre { border-left-color: #b9c4c1; background: #fbfcfc; }
.jour-vide { border-left-color: var(--ambre); }
.jour-futur { opacity: .55; }
@media (min-width: 760px) {
  .jour-fait { border-top-color: var(--vert); }
  .jour-neutre { border-top-color: #b9c4c1; }
  .jour-vide { border-top-color: var(--ambre); }
}

/* ------------------------------------------------------------------ tableaux */
.tableau-defilant { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; background: var(--carte); }
th, td { padding: .55rem .6rem; text-align: left; border-bottom: 1px solid var(--bord); }
th { background: #eef3f1; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--encre-douce); white-space: nowrap; }
tbody tr:hover { background: #fafcfb; }
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; }
.rang { font-weight: 700; color: var(--encre-douce); width: 2.5rem; }
.rang-1 { color: #a67c00; }
.podium-1 { background: #fffbeb; }
.podium-2 { background: #f7f8f8; }
.podium-3 { background: #fdf6f0; }

/* ------------------------------------------------------------------ étapes d'inscription */
.etapes { display: flex; gap: .35rem; margin-bottom: 1.2rem; }
.etapes span {
  flex: 1;
  height: 6px;
  background: var(--bord);
  border-radius: 999px;
}
.etapes span.faite { background: var(--vert); }
.etapes span.courante { background: var(--vert); opacity: .55; }

/* ------------------------------------------------------------------ recherche commune */
.recherche { position: relative; }
.resultats {
  list-style: none;
  margin: .3rem 0 0;
  padding: 0;
  border: 1.5px solid var(--bord);
  border-radius: 10px;
  background: #fff;
  max-height: 16rem;
  overflow-y: auto;
  box-shadow: var(--ombre);
}
.resultats:empty { display: none; }
.resultats li { border-bottom: 1px solid #f0f3f2; }
.resultats li:last-child { border-bottom: none; }
.resultats button {
  width: 100%;
  min-height: 44px;
  background: none;
  color: var(--encre);
  border: none;
  border-radius: 0;
  text-align: left;
  font-weight: 500;
  justify-content: flex-start;
  padding: .6rem .8rem;
}
.resultats button:hover { background: var(--vert-clair); }
.resultats .cccla { color: var(--vert); font-size: .78rem; font-weight: 600; }
.choisi {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem .8rem;
  background: var(--vert-clair);
  border: 1.5px solid var(--vert);
  border-radius: 10px;
  font-weight: 600;
}
.choisi .bouton { margin-left: auto; }

/* ------------------------------------------------------------------ concours photo */
.galerie {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  margin: 1rem 0;
}

.photo-carte {
  position: relative;
  margin: 0;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--ombre);
  display: flex;
  flex-direction: column;
}
.photo-carte img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #eef3f1;
}
.photo-carte figcaption,
.photo-carte .photo-legende {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .6rem .75rem .7rem;
  font-size: .92rem;
}
.photo-carte figcaption p { margin: 0; }
.photo-podium { border-color: var(--vert); box-shadow: 0 0 0 2px var(--vert-clair), var(--ombre); }

/* carte cliquable pendant le vote */
.photo-votable { cursor: pointer; border-width: 2px; transition: border-color .12s, background .12s; }
.photo-votable input { position: absolute; opacity: 0; width: 0; height: 0; }
.photo-votable:hover { border-color: var(--vert); }
.photo-votable .photo-choix {
  font-size: .82rem;
  font-weight: 600;
  color: var(--vert);
}
.photo-votable .photo-choix::before { content: "○ "; }
.photo-votable:has(input:checked) { border-color: var(--vert); background: var(--vert-clair); }
.photo-votable:has(input:checked) .photo-choix::before { content: "● "; }
.photo-votable:has(input:checked) .photo-choix::after { content: " — sélectionnée"; }
.photo-votable:has(input:focus-visible) { outline: 3px solid rgba(31, 122, 90, .35); }
.photo-votable.photo-bloquee { opacity: .5; }
.photo-votable.photo-bloquee:hover { border-color: var(--bord); }

.barre-vote {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .8rem 1rem;
  margin-top: 1rem;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: 12px;
  box-shadow: 0 -2px 14px rgba(20, 40, 35, .1);
}
.barre-vote button:disabled { background: #b9c4c1; cursor: not-allowed; }

.photo-mienne { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.photo-mienne img {
  width: 220px;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
}
.podium-photo { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center; }
.podium-photo img {
  width: 280px;
  max-width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
}

/* étapes du concours, côté organisateur */
.phases { display: grid; gap: .7rem; }
@media (min-width: 800px) { .phases { grid-template-columns: repeat(4, 1fr); } }
.phase {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: .8rem;
  border: 1px solid var(--bord);
  border-top: 3px solid var(--bord);
  border-radius: 10px;
  background: #fbfcfc;
}
.phase-passee { border-top-color: #b9c4c1; opacity: .75; }
.phase-actuelle { border-top-color: var(--vert); background: var(--vert-clair); }
.phase form { margin-top: auto; }

/* ------------------------------------------------------------------ divers */
.liste-nue { list-style: none; padding: 0; margin: 0; }
.liste-nue > li { padding: .5rem 0; border-bottom: 1px solid var(--bord); }
.liste-nue > li:last-child { border-bottom: none; }
.entre { display: flex; align-items: center; gap: .6rem; justify-content: space-between; flex-wrap: wrap; }
.ligne { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
code, .code {
  font-family: "Cascadia Mono", Consolas, "SF Mono", monospace;
  background: #eef3f1;
  padding: .1rem .4rem;
  border-radius: 6px;
  font-size: .92em;
}
.code-grand {
  display: inline-block;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: .12em;
  background: #fff;
  border: 2px dashed var(--vert);
  border-radius: 10px;
  padding: .5rem 1rem;
  color: var(--vert-fonce);
}
details { border: 1px solid var(--bord); border-radius: 10px; padding: .6rem .8rem; background: #fff; margin: .6rem 0; }
details summary { cursor: pointer; font-weight: 600; }
details[open] summary { margin-bottom: .5rem; }
hr { border: none; border-top: 1px solid var(--bord); margin: 1.2rem 0; }
.masque { display: none !important; }

@media print {
  .bandeau, .actions, .pied { display: none; }
  body { background: #fff; }
}
