/* Tutos de la roadmap : une page par étape, missions cochables, blocs de code copiables, projet à valider. */
body { font-size: 1.0625rem; line-height: 1.65; padding-block: 0 64px; overflow-x: hidden; }
.wrap { max-width: 46rem; margin-inline: auto; }
a { text-decoration-thickness: 1.5px; }
a:hover { color: var(--sand); }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
li::marker { color: var(--terra); }
code {
  font: 500 .9em ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--ink-deep); border: 1px solid var(--line); padding: 1px 5px; color: var(--sand);
  overflow-wrap: anywhere; /* les longues adresses en ligne passent à la ligne au lieu de déborder */
}
kbd {
  font: 700 .82em var(--f-body); background: var(--sand); color: var(--outline);
  border: 2px solid var(--outline); box-shadow: 2px 2px 0 var(--outline); padding: 0 6px;
}

/* BARRE DE PROGRESSION */
.progress {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  margin-inline: -16px; padding: 10px 16px;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--outline);
}
.progress .wrap { display: flex; align-items: center; gap: 14px; }
.progress .brand { font-size: 1.15rem; white-space: nowrap; }
.progress .back { font-size: .9rem; font-weight: 700; color: var(--sand); text-decoration: none; white-space: nowrap; }
.progress .back:hover { color: var(--terra); }
.bar { flex: 1; height: 12px; border: 2px solid var(--outline); background: var(--ink-deep); min-width: 60px; }
.bar i { display: block; height: 100%; width: 0; background: var(--terra); transition: width .5s var(--bounce); }
.count { font-size: .85rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.count b { color: var(--terra-soft); }

/* HERO */
.hero { padding-block: 48px 20px; display: grid; gap: 20px; }
.eyebrow { font-size: .95rem; font-weight: 600; color: var(--terra-soft); }
h1 {
  font-size: clamp(3rem, 11vw, 5.2rem); line-height: .95; margin: 0;
  -webkit-text-stroke: 2px var(--outline); paint-order: stroke fill;
  text-shadow: 5px 5px 0 var(--outline); text-wrap: balance;
}
h1 .line { display: block; animation: rise .7s var(--bounce) both; }
h1 .line:nth-child(2) { animation-delay: .1s; }
h1 .block {
  display: inline-block; background: var(--terra); color: var(--sand);
  padding: 0 .12em; border: 3px solid var(--outline); box-shadow: 6px 6px 0 var(--outline);
  transform: rotate(-2deg); animation: slam .8s var(--bounce) .3s both;
}
.lead { font-size: 1.15rem; }
.lead strong { color: var(--terra-soft); }
.meta { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-size: .88rem; font-weight: 600; color: var(--sand);
  border: 2px solid var(--outline); background: var(--ink-raise); padding: 6px 11px; box-shadow: 3px 3px 0 var(--outline);
}
.chip b { color: var(--terra-soft); }

/* OBJECTIFS + SOMMAIRE */
.goals {
  background: var(--ink-deep); border: 3px solid var(--outline); box-shadow: 6px 6px 0 var(--outline);
  padding: 20px 22px; display: grid; gap: 12px;
}
.goals h2 { font-size: 1.5rem; margin: 0; text-shadow: none; -webkit-text-stroke: 0; }
.goals ul { list-style: none; padding: 0; }
.goals li { display: flex; gap: 10px; color: var(--sand); }
.goals li::before { content: "→"; color: var(--terra); font-weight: 700; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 6px; border-top: 2px solid var(--line); }
.toc a {
  font-size: .85rem; font-weight: 600; color: var(--sand-dim); text-decoration: none;
  border: 2px solid var(--line); padding: 4px 9px;
}
.toc a:hover { color: var(--sand); border-color: var(--terra); }
.toc a.done { color: var(--outline); background: var(--ok); border-color: var(--outline); }
.toc a.done::before { content: "✓ "; }

/* MISSIONS */
section { padding-block: 26px; scroll-margin-top: 70px; }
h2 {
  font-size: clamp(2rem, 6.5vw, 2.6rem); line-height: 1; margin: 0 0 18px; text-wrap: balance;
  -webkit-text-stroke: 1.5px var(--outline); paint-order: stroke fill; text-shadow: 3px 3px 0 var(--outline);
}
h2 .hl { color: var(--terra); }
.mission {
  position: relative; background: var(--ink-raise); border: 3px solid var(--outline); box-shadow: 6px 6px 0 var(--outline);
  padding: 26px 22px 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 18px; scroll-margin-top: 80px;
  transition: border-color .3s;
}
.mission.done { border-color: var(--ok); }
.mission .tag {
  position: absolute; top: -15px; left: 16px; font: 800 .95rem/1 var(--f-display); font-stretch: 75%;
  font-variation-settings: "wdth" 75; text-transform: uppercase; letter-spacing: .02em;
  background: var(--terra); color: var(--sand); border: 3px solid var(--outline); box-shadow: 3px 3px 0 var(--outline);
  padding: 5px 10px; transform: rotate(-2deg); transition: background .3s;
}
.mission.done .tag { background: var(--ok); color: var(--outline); }
.mission h3 {
  font-family: var(--f-display); font-weight: 800; font-stretch: 75%; font-variation-settings: "wdth" 75;
  text-transform: uppercase; font-size: 1.7rem; line-height: 1; margin: 0;
}
/* Missions repliables : le titre est un bouton, une seule mission ouverte à la fois (tuto.js) */
.mtoggle {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: flex; align-items: center; gap: 12px; font: inherit; text-transform: inherit; color: var(--sand);
}
.mtoggle:focus-visible { outline: 2px solid var(--terra); outline-offset: 4px; }
.mtitle { flex: 1; }
.mtoggle::after {
  content: ""; flex: none; width: 10px; height: 10px; margin-right: 4px;
  border: solid var(--sand-dim); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
}
.mission.open .mtoggle::after { transform: rotate(-135deg) translate(-2px, -2px); }
.mtoggle:hover .mtitle { color: var(--terra-soft); }
.mdur {
  flex: none; font: 700 .8rem var(--f-body); text-transform: none; letter-spacing: 0; color: var(--sand-dim);
  border: 2px solid var(--line); padding: 3px 8px;
}
.mission.done .mdur { color: var(--outline); background: var(--ok); border-color: var(--outline); }
.mbody { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.js .mission:not(.open) .mbody { display: none; }
.js .mission:not(.open) { padding-bottom: 20px; box-shadow: 4px 4px 0 var(--outline); }
.js .mission:not(.open):hover { box-shadow: 6px 6px 0 var(--outline); }
.mbody > p, .mission li { color: var(--sand-dim); }
.mission strong { color: var(--sand); }
.mbody h4 { margin: 4px 0 0; font-size: 1rem; color: var(--sand); }

/* Bloc de code avec bouton copier */
.code { min-width: 0; position: relative; border: 3px solid var(--outline); background: var(--ink-deep); }
.code .file {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 6px 8px 6px 12px; background: var(--ink); border-bottom: 2px solid var(--outline);
  font: 600 .8rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--sand-dim);
}
.copy {
  font: 700 .78rem var(--f-body); cursor: pointer; color: var(--sand); background: var(--ink-raise);
  border: 2px solid var(--outline); padding: 3px 9px;
}
.copy:hover { background: var(--terra); }
.copy.ok { background: var(--ok); color: var(--outline); }
pre { margin: 0; padding: 14px 16px; overflow-x: auto; }
pre code {
  background: none; border: 0; padding: 0; display: block; white-space: pre;
  font-size: .88rem; line-height: 1.6; color: var(--sand);
}
pre .t { color: var(--terra-soft); }   /* balise */
pre .a { color: var(--wip); }          /* attribut */
pre .s { color: var(--ok); }           /* valeur */
pre .c { color: #7D8DA0; font-style: italic; } /* commentaire */

/* Encadrés */
.box { border: 2px solid var(--outline); padding: 14px 16px; display: grid; gap: 8px; background: var(--ink-deep); }
.box .label { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.box p, .box li { color: var(--sand); font-size: .97rem; }
.box.todo { border-left: 6px solid var(--terra); }
.box.todo .label { color: var(--terra-soft); }
.box.warn { border-left: 6px solid var(--wip); }
.box.warn .label { color: var(--wip); }
.box.ai { border-left: 6px solid var(--ok); }
.box.ai .label { color: var(--ok); }
.prompt {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  background: var(--ink); border: 2px dashed var(--line); padding: 10px 12px; font-style: italic; color: var(--sand);
}
.prompt span { flex: 1; }
.prompt .copy { font-style: normal; flex: none; }

/* Résultat attendu : aperçu en mini-navigateur, sortie console ou terminal */
.result { border: 2px solid var(--outline); border-left: 6px solid var(--sand); background: var(--ink-deep); padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.result .label { font-size: .85rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--sand); }
.result .label::before { content: "◉ "; color: var(--terra); }
.result p, .result li { color: var(--sand); font-size: .97rem; }
.preview { margin: 0; width: 100%; min-width: 0; border: 3px solid var(--outline); box-shadow: 4px 4px 0 var(--outline); background: #fff; }
.preview .pbar { display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: #E9E4DC; border-bottom: 2px solid var(--outline); }
.preview .pbar i { width: 9px; height: 9px; border-radius: 50%; background: #C9C1B5; }
.preview .pbar span { margin-left: 8px; flex: 1; font: 600 .75rem/1.4 ui-monospace, "SF Mono", Menlo, monospace; color: #4A5560; background: #fff; border: 1px solid #C9C1B5; padding: 1px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview iframe { display: block; width: 100%; border: 0; background: #fff; }
.code.out { border-style: dashed; }
.code.out pre code { color: var(--sand-dim); }

/* Case "C'est fait" */
.check-btn {
  justify-self: start; font: 700 .92rem var(--f-body); cursor: pointer; color: var(--sand);
  background: var(--ink-deep); border: 2px solid var(--outline); padding: 9px 14px; box-shadow: 3px 3px 0 var(--outline);
  display: inline-flex; gap: 9px; align-items: center; transition: transform .12s, box-shadow .12s, background .2s;
}
.check-btn::before { content: ""; width: 14px; height: 14px; border: 2px solid var(--sand-dim); }
.check-btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--outline); }
.check-btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--outline); }
.mission.done .check-btn { background: var(--ok); color: var(--outline); }
.mission.done .check-btn::before {
  width: 6px; height: 12px; margin: -4px 4px 0; background: none;
  border: solid var(--outline); border-width: 0 3px 3px 0; transform: rotate(45deg);
  animation: pop .35s var(--bounce);
}
@keyframes pop { from { transform: rotate(45deg) scale(0); } }
.mission.done .tag::after { content: " ✓"; }

/* PROJET */
.project {
  background: var(--ink-deep); border: 3px solid var(--terra); box-shadow: 8px 8px 0 var(--outline);
  padding: 24px 22px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px;
}
.project h3 { font-family: var(--f-display); font-weight: 800; font-stretch: 75%; text-transform: uppercase; font-size: 1.8rem; line-height: 1; margin: 0; }
.project > p { color: var(--sand-dim); }
.criteria { list-style: none; padding: 0; display: grid; gap: 8px; }
.criteria label { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; cursor: pointer; color: var(--sand); }
.criteria input {
  appearance: none; width: 20px; height: 20px; margin: 3px 0 0; cursor: pointer;
  border: 2px solid var(--terra); background: var(--ink); display: grid; place-items: center;
}
.criteria input:checked { background: var(--ok); border-color: var(--outline); }
.criteria input:checked::after { content: ""; width: 5px; height: 10px; border: solid var(--outline); border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.criteria input:checked + span { color: var(--sand-dim); text-decoration: line-through; }

/* Ressources */
.res { list-style: none; padding: 0; display: grid; gap: 10px; }
.res li { background: var(--ink-raise); border: 2px solid var(--outline); padding: 12px 14px; color: var(--sand-dim); }
.res a { font-weight: 700; }

/* FIN D'ÉTAPE */
.finish {
  margin-top: 30px; background: var(--terra); border: 3px solid var(--outline); box-shadow: 8px 8px 0 var(--outline);
  padding: 26px 24px; display: grid; gap: 14px; transform: rotate(-.6deg);
}
.finish h2 { margin: 0; color: var(--sand); }
.finish p { color: var(--sand); font-weight: 500; }
.finish .row { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none; cursor: pointer;
  font: 700 1rem var(--f-body); color: var(--sand); background: var(--ink); padding: 13px 20px;
  border: 3px solid var(--outline); box-shadow: 5px 5px 0 var(--outline); transition: transform .15s, box-shadow .15s, background .2s;
}
.btn:hover { color: var(--sand); transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--outline); }
.btn.light { background: var(--sand); color: var(--outline); }
.btn.light:hover { color: var(--outline); }
.btn[aria-pressed="true"] { background: var(--ok); color: var(--outline); }

.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 50; }


@media (max-width: 560px) {
  .mission { padding: 24px 16px 18px; }
  .project, .goals { padding: 18px 16px; }
  pre { padding: 12px; }
  pre code { font-size: .8rem; }
  .progress .wrap { gap: 10px; }
  .progress .brand { font-size: 1rem; }
}
