/* Météo du vol libre et de la randonnée en montagne — site compagnon
   Feuille de style partagée. Aucune dépendance externe. */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eaf1f9;
  --text: #1b2430;
  --muted: #55606e;
  --primary: #1f5f9c;
  --primary-ink: #ffffff;
  --accent: #d9731a;
  --ok: #257a46;
  --ok-bg: #e3f4e9;
  --ko: #b83a2e;
  --ko-bg: #fbe8e5;
  --warn: #8a6d00;
  --warn-bg: #fff6d6;
  --border: #d3dce7;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08);
  --radius: 12px;
  --maxw: 860px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f151d;
    --surface: #182130;
    --surface-2: #1f2a3a;
    --text: #e6ebf1;
    --muted: #a3afbe;
    --primary: #7cb8ee;
    --primary-ink: #0f151d;
    --accent: #f0a050;
    --ok: #6fd69a;
    --ok-bg: #163524;
    --ko: #ff8a7a;
    --ko-bg: #3d1d19;
    --warn: #ffd86b;
    --warn-bg: #3a3010;
    --border: #2c3a4c;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f151d;
  --surface: #182130;
  --surface-2: #1f2a3a;
  --text: #e6ebf1;
  --muted: #a3afbe;
  --primary: #7cb8ee;
  --primary-ink: #0f151d;
  --accent: #f0a050;
  --ok: #6fd69a;
  --ok-bg: #163524;
  --ko: #ff8a7a;
  --ko-bg: #3d1d19;
  --warn: #ffd86b;
  --warn-bg: #3a3010;
  --border: #2c3a4c;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

img, svg { max-width: 100%; height: auto; }

/* En-tête et navigation */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 1080px;  /* comme l'accueil : le logo reste à sa place d'une page à l'autre, et la navigation tient sur une ligne */
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
  font-size: 1.05rem;
}
.brand img { flex: none; width: 36px; height: 36px; }
.brand small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.8rem;
}
.site-nav { margin-left: auto; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--primary);
  font-weight: 600;
}
.site-nav a[aria-current="page"], .site-nav a:hover { background: var(--surface-2); }

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px 16px 40px;
}

h1 { font-size: 1.7rem; line-height: 1.2; margin: 0.4em 0 0.3em; }
h2 { font-size: 1.3rem; margin: 1.4em 0 0.5em; }
h3 { font-size: 1.1rem; margin: 1.2em 0 0.4em; }
p { margin: 0.6em 0; }
.lead { font-size: 1.1rem; color: var(--muted); }
.kicker { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.8rem; margin: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 16px 0;
}

/* Boutons */
.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: var(--primary-ink);
  cursor: pointer;
  text-decoration: none;
  min-height: 44px;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary {
  background: var(--surface);
  color: var(--primary);
}
.btn.danger { background: var(--ko); border-color: var(--ko); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* Grille des modules (accueil) */
.modules {
  list-style: none;
  padding: 0;
  margin: 12px 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.modules li a {
  display: block;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  height: 100%;
  box-shadow: var(--shadow);
}
.modules li a:hover { border-color: var(--primary); }
.modules .num { color: var(--accent); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; }
.modules .mtitle { display: block; font-weight: 600; margin: 2px 0 6px; }
.modules .mscore { font-size: 0.9rem; color: var(--muted); }

/* Deux usagers */
.duo { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.duo .card { margin: 0; }

/* Tableau de bord */
.progress-bar {
  height: 12px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar > span { display: block; height: 100%; background: var(--ok); width: 0; transition: width 0.4s; }
table.dash { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 0.95rem; }
table.dash th, table.dash td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
table.dash th { color: var(--muted); font-weight: 600; }
table.dash td.num { text-align: right; white-space: nowrap; }

/* Essentiel */
.essentiel {
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 12px 16px 12px 20px;
}
.essentiel ol { margin: 8px 0 0; padding-left: 20px; }
.essentiel li { margin: 6px 0; }

figure { margin: 16px 0; }
figure img { display: block; border-radius: 8px; border: 1px solid var(--border); background: #fff; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }

/* Quiz */
.quiz-progress { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.question { font-size: 1.1rem; font-weight: 600; margin: 0 0 12px; }
.choices { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.choice {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  min-height: 44px;
}
.choice:hover:not([disabled]) { border-color: var(--primary); background: var(--surface-2); }
.choice[disabled] { cursor: default; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.choice.is-wrong { border-color: var(--ko); background: var(--ko-bg); }
.choice .letter { display: inline-block; min-width: 1.6em; font-weight: 700; color: var(--primary); }

.num-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.num-form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
input[type="text"], input[type="number"], input[type="time"], input[type="search"], select {
  font: inherit;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
  max-width: 100%;
}
input[type="text"].short, input[type="number"].short { width: 9em; }

.feedback {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.feedback.ok { background: var(--ok-bg); border-color: var(--ok); }
.feedback.ko { background: var(--ko-bg); border-color: var(--ko); }
.feedback.warn { background: var(--warn-bg); border-color: var(--warn); }
.feedback strong.verdict { display: block; margin-bottom: 4px; }
.feedback:empty { display: none; }

.score-final { text-align: center; }
.score-final .big { font-size: 2.4rem; font-weight: 700; color: var(--primary); margin: 8px 0; }

/* Jeux */
.jeux-sommaire { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.jeux-sommaire a { display: inline-block; padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; background: var(--surface); font-size: 0.9rem; }
.jeu { scroll-margin-top: 16px; }
.jeu .enonce { font-size: 1.05rem; }
.jeu .score-jeu { color: var(--muted); font-size: 0.9rem; margin: 0 0 8px; }
.jeu .consigne { color: var(--muted); font-size: 0.95rem; }
fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px 12px; margin: 10px 0; min-width: 0; }
legend { font-weight: 600; padding: 0 4px; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; }
input[type="radio"] { width: 20px; height: 20px; accent-color: var(--primary); }

.rose {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 320px;
  margin: 12px auto;
}
.rose button {
  font: inherit;
  font-weight: 700;
  min-height: 60px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.rose button:hover:not([disabled]) { border-color: var(--primary); background: var(--surface-2); }
.rose button.is-correct { background: var(--ok-bg); border-color: var(--ok); }
.rose button.is-wrong { background: var(--ko-bg); border-color: var(--ko); }
.rose .center { display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 10px; }

.svg-box { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; margin: 10px 0; }
.svg-box svg { display: block; width: 100%; height: auto; }
.svg-box svg.clickable { cursor: crosshair; }

.deco-buttons { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.deco-buttons .btn { width: 100%; }
.btn.is-correct { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.is-wrong { background: var(--ko); border-color: var(--ko); color: #fff; }

.ordre { display: grid; gap: 12px; }
.ordre .pool, .ordre .seq { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; }
.ordre .seq { border: 1px dashed var(--border); border-radius: 10px; padding: 8px; }
.ordre .seq li { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.ordre .seq li .rank { font-weight: 700; color: var(--accent); margin-right: 4px; }
.ordre .pool .btn { background: var(--surface); color: var(--text); border-color: var(--border); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Glossaire */
.glossaire-liste { list-style: none; padding: 0; margin: 0; }
.glossaire-liste li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.glossaire-liste dt, .glossaire-liste .terme { font-weight: 700; }
.glossaire-liste .ref { color: var(--muted); font-size: 0.85rem; margin-left: 6px; }
.glossaire-liste mark { background: var(--warn-bg); color: inherit; padding: 0 2px; border-radius: 3px; }
.compteur { color: var(--muted); font-size: 0.9rem; }

/* Pied de page */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer .inner { max-width: var(--maxw); margin: 0 auto; padding: 16px; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  h1 { font-size: 1.45rem; }
  .site-nav { margin-left: 0; width: 100%; }
  .site-nav a { padding: 8px 8px; }
}

/* téléphone : un en-tête serré (sans le sous-titre), la navigation sur une ligne qui défile au doigt */
@media (max-width: 600px) {
  .site-header .inner { padding: 8px 16px 4px; gap: 4px 12px; }
  .brand small { display: none; }
  .brand img { width: 32px; height: 32px; }
  .site-nav { flex-wrap: nowrap; overflow-x: auto; width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px 4px; scrollbar-width: none; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex: none; white-space: nowrap; padding: 8px 9px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* page « Code du livre » (code.html) */
#code-form input { width: 19em; text-transform: uppercase; letter-spacing: .04em; }
#code-form input::placeholder { text-transform: none; letter-spacing: 0; }
.codes-liste code { font-weight: 700; letter-spacing: .03em; margin-right: .3em; }
#codes h3 { margin: 1.4em 0 .2em; font-size: 1rem; }

/* quiz : la leçon du livre après une erreur ; contenus des chapitres réservés */
.feedback .lecon, .feedback .invitation { margin-top: 8px; font-weight: 600; }
.glossaire-reserves .invitation { margin: 4px 0 12px; }
.jeu-verrou .invitation { margin: 0; }
