/* App Academy 976 (programme interne : Kwezi App Lab) — feuille de style autonome, sans framework, mobile-first, légère.
   Vocabulaire de classes (feynman-block, module-list, checklist, track-card...) aligné
   sur celui déjà employé dans bailweb976/nour976/merchia (voir docs/00-audit-mazava.md) pour
   rester cohérent avec la méthode pédagogique commune — règles et valeurs réécrites ici. */

:root {
  --bg: #f7f7fb;
  --fg: #14151f;
  --brand: #7c3aed;
  --brand-dark: #5b21b6;
  --brand-light: #efe6fd;
  --accent: #059669;
  --accent-dark: #047857;
  --card: #ffffff;
  --border: #e2e1ee;
  --muted: #5c5e70;
  --ok: #15803d;
  --warn: #b45309;
  --radius: 0.9rem;
  --maxw: 1120px;
  --mayotte: #0f766e;
  --mayotte-light: #dff5f2;
  --metropole: #be185d;
  --metropole-light: #fde3ee;
  /* boutons pleins : couleurs fixes, indépendantes du thème, vérifiées >= 4.5:1 avec du texte blanc */
  --brand-btn: #5b21b6;
  --brand-btn-hover: #431a89;
  --accent-btn: #047857;
  --accent-btn-hover: #036049;
  --mayotte-btn: #0b5f58;
  --mayotte-btn-hover: #084a45;
  --metropole-btn: #9d174d;
  --metropole-btn-hover: #7d1140;
  --ok-btn: #15803d;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0c14;
    --fg: #f1f0fa;
    --brand: #a884ff;
    --brand-dark: #8b63e8;
    --brand-light: #221a3a;
    --accent: #34d399;
    --accent-dark: #10b981;
    --card: #17141f;
    --border: #2c2740;
    --muted: #aba9c4;
    --ok: #4ade80;
    --warn: #fbbf24;
    --mayotte: #2dd4c4;
    --mayotte-light: #0e2b28;
    --metropole: #f472b6;
    --metropole-light: #2c1526;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  line-height: 1.55;
  font-size: 17px;
}

img, svg { max-width: 100%; height: auto; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.1rem; }

/* ---------- header / nav ---------- */
header.site { position: sticky; top: 0; z-index: 50; background: var(--card); border-bottom: 1px solid var(--border); }
header.site .bar { display: flex; align-items: center; justify-content: space-between; padding: 0.7rem 0; }
.brand-logo { font-weight: 800; font-size: 1.1rem; color: var(--fg); text-decoration: none; display: flex; align-items: center; gap: 0.35rem; }
.brand-logo .dot { color: var(--accent); }

nav.main { display: none; gap: 1rem; align-items: center; }
nav.main a { color: var(--fg); text-decoration: none; font-size: 0.92rem; font-weight: 600; }
nav.main a.active, nav.main a:hover { color: var(--brand); }

#navToggle { border: 1px solid var(--border); background: var(--card); border-radius: 0.6rem; min-width: 44px; min-height: 44px; font-size: 1.2rem; }
#mobileNav { display: none; flex-direction: column; gap: 0.1rem; padding: 0.5rem 0 1rem; border-top: 1px solid var(--border); }
#mobileNav.open { display: flex; }
#mobileNav a { padding: 0.7rem 0.2rem; text-decoration: none; color: var(--fg); font-weight: 600; border-bottom: 1px solid var(--border); min-height: 44px; display: flex; align-items: center; }

@media (min-width: 860px) {
  nav.main { display: flex; }
  #navToggle { display: none; }
  #mobileNav { display: none !important; }
}

/* ---------- hero / sections ---------- */
main { display: block; }
section { padding: 2.4rem 0; }
section.tight { padding: 1.5rem 0; }

.hero { background: linear-gradient(160deg, var(--brand-light), var(--bg) 70%); padding: 2.4rem 0 2.8rem; }
.hero.mayotte { background: linear-gradient(160deg, var(--mayotte-light), var(--bg) 70%); }
.hero.metropole { background: linear-gradient(160deg, var(--metropole-light), var(--bg) 70%); }

.eyebrow { display: inline-block; background: var(--brand-light); color: var(--brand-dark); font-weight: 700; font-size: 0.8rem; padding: 0.3rem 0.7rem; border-radius: 999px; margin-bottom: 0.9rem; }
.eyebrow.mayotte { background: var(--mayotte-light); color: var(--mayotte); }
.eyebrow.metropole { background: var(--metropole-light); color: var(--metropole); }

h1 { font-size: 1.9rem; line-height: 1.18; margin: 0 0 0.9rem; letter-spacing: -0.01em; }
h2 { font-size: 1.45rem; margin: 0 0 0.8rem; letter-spacing: -0.01em; }
h3 { font-size: 1.12rem; margin: 1.3rem 0 0.5rem; }
p.lead { font-size: 1.06rem; color: var(--muted); margin: 0 0 1.3rem; }

@media (min-width: 700px) {
  h1 { font-size: 2.5rem; }
  h2 { font-size: 1.85rem; }
  body { font-size: 18px; }
}

.cta-row { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.2rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 46px; padding: 0.7rem 1.2rem; border-radius: 0.7rem; font-weight: 700; text-decoration: none; border: 2px solid transparent; cursor: pointer; font-size: 0.97rem; }
.btn-primary { background: var(--brand-btn); color: #fff; }
.btn-primary:hover { background: var(--brand-btn-hover); color: #fff; }
.btn-accent { background: var(--accent-btn); color: #fff; }
.btn-accent:hover { background: var(--accent-btn-hover); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-mayotte { background: var(--mayotte-btn); color: #fff; }
.btn-mayotte:hover { background: var(--mayotte-btn-hover); color: #fff; }
.btn-metropole { background: var(--metropole-btn); color: #fff; }
.btn-metropole:hover { background: var(--metropole-btn-hover); color: #fff; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: 1fr 1fr; } }
@media (min-width: 860px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.2rem; }
.card h3 { margin-top: 0; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card .num { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--brand-light); color: var(--brand-dark); font-weight: 800; margin-bottom: 0.6rem; }

/* ---------- track picker (accueil) ---------- */
.track-card { display: block; text-decoration: none; color: var(--fg); background: var(--card); border: 2px solid var(--border); border-radius: var(--radius); padding: 1.6rem; transition: border-color 0.15s, transform 0.15s; }
.track-card:hover { transform: translateY(-2px); }
.track-card.mayotte:hover { border-color: var(--mayotte); }
.track-card.metropole:hover { border-color: var(--metropole); }
.track-card .track-emoji { font-size: 2.1rem; display: block; margin-bottom: 0.7rem; }
.track-card h2 { margin-bottom: 0.4rem; }
.track-card .track-tag { display: inline-block; font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.2rem 0.6rem; border-radius: 999px; margin-bottom: 0.8rem; }
.track-card.mayotte .track-tag { background: var(--mayotte-light); color: var(--mayotte); }
.track-card.metropole .track-tag { background: var(--metropole-light); color: var(--metropole); }

.badge { display: inline-block; font-size: 0.76rem; font-weight: 700; padding: 0.15rem 0.55rem; border-radius: 999px; background: var(--brand-light); color: var(--brand-dark); }
.badge.accent { background: #d1fae5; color: var(--accent-dark); }
.badge.mayotte { background: var(--mayotte-light); color: var(--mayotte); }
.badge.metropole { background: var(--metropole-light); color: var(--metropole); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); font-size: 0.93rem; }
thead th { background: var(--brand-light); color: var(--brand-dark); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }

/* ---------- blocs Feynman ---------- */
.feynman-block { border: 1px solid var(--border); border-left: 4px solid var(--brand); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; background: var(--card); }
.feynman-block.analogie { border-left-color: var(--accent); }
.feynman-block.erreur { border-left-color: #d64545; }
.feynman-block.action { border-left-color: var(--ok); }
.feynman-block h4 { margin: 0 0 0.5rem; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

details.correction { border: 1px dashed var(--border); border-radius: 0.6rem; padding: 0.7rem 0.9rem; margin: 0.7rem 0; background: var(--brand-light); }
details.correction summary { cursor: pointer; font-weight: 700; color: var(--brand-dark); min-height: 30px; }

.recap-q { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.recap-q:last-child { border-bottom: none; }
.recap-q input[type="checkbox"] { min-width: 22px; min-height: 22px; margin-top: 0.15rem; }

.revise-tag { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.85rem; font-weight: 700; color: var(--warn); background: rgba(180,83,9,0.12); padding: 0.35rem 0.7rem; border-radius: 0.6rem; }

/* ---------- module nav / progression ---------- */
.module-progress { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: var(--muted); margin-bottom: 1rem; }
.progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-bar > span { display: block; width: 0; height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.3s; }

.module-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.module-list a { display: flex; align-items: center; gap: 0.8rem; padding: 0.9rem 1rem; border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--fg); background: var(--card); }
.module-list a:hover { border-color: var(--brand); }
.module-list .mchk { min-width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 800; color: var(--muted); flex-shrink: 0; }
.module-list a[data-done="true"] .mchk { background: var(--ok-btn); border-color: var(--ok-btn); color: #fff; }
.module-list .mtitle { flex: 1; }
.module-list .mtitle small { display: block; color: var(--muted); font-weight: 400; }

.pager { display: flex; justify-content: space-between; gap: 0.8rem; margin: 2rem 0 0; flex-wrap: wrap; }

/* ---------- checklists (plan / planning) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.6rem 0.2rem; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: none; }
.checklist input[type="checkbox"] { min-width: 22px; min-height: 22px; margin-top: 0.1rem; }
.checklist label.done { text-decoration: line-through; color: var(--muted); }

/* ---------- calculatrices ---------- */
.calc-field { margin-bottom: 0.9rem; }
.calc-field label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 0.3rem; }
.calc-field input, .calc-field select { width: 100%; padding: 0.6rem 0.7rem; border: 1px solid var(--border); border-radius: 0.6rem; font-size: 1rem; background: var(--card); color: var(--fg); min-height: 44px; }
.calc-result { background: var(--brand-light); border-radius: var(--radius); padding: 1rem; font-size: 1.05rem; margin-top: 1rem; }
.calc-result .big { font-size: 1.65rem; font-weight: 800; color: var(--brand-dark); }

/* ---------- footer ---------- */
footer.site { border-top: 1px solid var(--border); padding: 2.2rem 0; margin-top: 2rem; color: var(--muted); font-size: 0.9rem; }
footer.site a { color: var(--muted); }
.link-reset { background: none; border: none; padding: 0; margin: 0; color: var(--muted); text-decoration: underline; font: inherit; font-size: 0.9rem; cursor: pointer; }
.link-reset:hover { color: var(--brand); }
footer.site .cols { display: grid; gap: 1.4rem; grid-template-columns: 1fr; margin-bottom: 1.4rem; }
@media (min-width: 700px) { footer.site .cols { grid-template-columns: 2fr 1fr 1fr; } }
footer.site .foot-label { color: var(--fg); font-size: 0.95rem; font-weight: 700; margin: 0 0 0.6rem; }
footer.site ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }

/* ---------- utilitaires ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-6 { margin-top: 0.6rem; }
.mt-8 { margin-top: 0.8rem; }
.mt-12 { margin-top: 1.2rem; }
.mt-14 { margin-top: 1.4rem; }
.mt-16 { margin-top: 1.6rem; }
.small { font-size: 0.87rem; }
.disclaimer { background: var(--brand-light); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.9rem 1.1rem; font-size: 0.88rem; color: var(--muted); margin: 1.2rem 0; }
.toc { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.toc a { text-decoration: none; }

.prose { max-width: 78ch; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0.7rem 0; }
.prose li { margin: 0.3rem 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose blockquote { border-left: 4px solid var(--accent); margin: 1rem 0; padding: 0.6rem 1rem; background: var(--brand-light); border-radius: 0 0.6rem 0.6rem 0; color: var(--muted); }
.prose table { min-width: 640px; }
.prose h2 { margin-top: 2.2rem; padding-top: 0.6rem; border-top: 1px solid var(--border); }
.prose h2:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.prose h3 { margin-top: 1.4rem; }
.prose strong { color: var(--fg); }
.prose code { background: var(--brand-light); color: var(--brand-dark); padding: 0.1rem 0.35rem; border-radius: 0.35rem; font-size: 0.9em; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 0.3rem;
}
.btn:focus-visible { outline-offset: 3px; }

@media print {
  header.site, footer.site, #navToggle, #mobileNav, .btn, button, .cta-row, .pager { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.75em; color: #444; }
  .wrap { max-width: 100%; padding: 0; }
  .feynman-block, .card, .table-wrap { border: 1px solid #999; break-inside: avoid; background: #fff; }
  details.correction { border: 1px solid #999; }
  .progress-bar, .revise-tag, .badge { display: none; }
  table { min-width: 0; }
}
