/* Réussir l'épreuve PSE Bac Pro — habillage visuel v2 (mapse.fr)
   Se charge APRÈS epreuve.css : ne change aucun texte, seulement l'apparence.
   Couleurs alignées sur l'accueil du site : bleus = « Apprendre » (interface),
   partie 1 = bleu-vert (thématiques A/B), partie 2 = orange (thématique C).
   Retour arrière : retirer le lien vers ce fichier (et epreuve-v2.js). */

:root {
  --ui: #1e3a8a;          /* bleu marine de « Cours Bac Pro » */
  --ui-vif: #2563eb;
  --ui-clair: #eaf0fd;
  --p1: #0f766e;  --p1-clair: #e6f4f2;
  --p2: #c2410c;  --p2-clair: #fff3e8;
  --ombre-douce: 0 1px 2px rgba(21, 33, 58, .06), 0 8px 24px -10px rgba(21, 33, 58, .18);
  --ombre-forte: 0 2px 4px rgba(21, 33, 58, .06), 0 18px 40px -14px rgba(21, 33, 58, .30);
}

/* ---------- Barre de progression de lecture (créée par epreuve-v2.js) ---------- */
.v2-progres { position: fixed; top: 0; left: 0; right: 0; height: 4px; z-index: 50; background: transparent; pointer-events: none; }
.v2-progres > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--p1), var(--ui-vif), var(--p2)); border-radius: 0 4px 4px 0; transition: width .1s linear; }

/* La barre d'accessibilité (Écouter, A−, A+, Dys) est fixée en haut : on se place juste en dessous */
body.pse-acces-on .v2-progres { top: var(--pse-bar, 52px); }
body.pse-acces-on .pastilles { top: var(--pse-bar, 52px); }

/* ---------- Navigation ---------- */
.nav a:hover, .nav a:focus-visible { background: var(--ui-clair); border-color: var(--ui); }

/* ---------- En-tête : même famille de bleus, plus compact sur téléphone ---------- */
.tete {
  position: relative; overflow: hidden;
  background:
    radial-gradient(600px 300px at 90% 120%, rgba(15, 118, 110, .55), transparent 70%),
    radial-gradient(500px 260px at 0% -20%, rgba(37, 99, 235, .55), transparent 70%),
    linear-gradient(135deg, #0b1b4d, #1e3a8a);
}
.tete::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border-radius: 50%;
  border: 40px solid rgba(255, 255, 255, .05);
}
.tete .sur {
  display: inline-block; padding: 4px 12px; border-radius: 999px; opacity: 1;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
}

/* ---------- Sommaire en pastilles : il reste en haut pendant la lecture ---------- */
.pastilles {
  position: sticky; top: 0; z-index: 20; margin: 0 -16px; padding: 10px 16px;
  background: rgba(245, 246, 250, .9);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent; transition: border-color .2s, box-shadow .2s;
}
.pastilles.colle { border-bottom-color: var(--trait); box-shadow: 0 6px 16px -12px rgba(21, 33, 58, .4); }
.pastilles a { transition: background .15s, color .15s, border-color .15s; }
.pastilles a:hover, .pastilles a:focus-visible { border-color: var(--ui); color: var(--ui); }
.pastilles a.actif { background: var(--ui); border-color: var(--ui); color: #fff; }

/* ---------- Sections ---------- */
section.bloc { box-shadow: var(--ombre-douce); border: 1px solid rgba(21, 33, 58, .05); scroll-margin-top: 76px; position: relative; overflow: hidden; }
section.bloc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: linear-gradient(180deg, var(--ui-vif), var(--ui)); opacity: .9; }
section.bloc > h2 .num { color: var(--ui-vif); }
section.bloc.exos::before { background: linear-gradient(180deg, #16a34a, #15803d); }   /* vert = « s'entraîner » */
section.bloc.ressources::before { background: #94a3b8; }

/* ---------- Accueil de l'espace : les étapes deviennent un chemin ---------- */
.etapes { position: relative; grid-template-columns: 1fr !important; gap: 12px; padding-left: 34px; }
.etapes::before {
  content: ""; position: absolute; left: 13px; top: 20px; bottom: 20px; width: 4px; border-radius: 4px;
  background: linear-gradient(180deg, var(--ui-vif), var(--p1) 60%, var(--trait));
}
.etape { position: relative; min-height: 0; padding: 16px 18px; box-shadow: var(--ombre-douce); border: 1px solid rgba(21, 33, 58, .06); }
.etape .n {
  position: absolute; left: -34px; top: 14px; width: 30px; height: 30px; border-radius: 50%;
  font-size: .8rem; background: var(--ui); box-shadow: 0 0 0 4px var(--fond); white-space: nowrap;
}
.etape.ecriture .n { background: var(--ui); width: auto; min-width: 30px; padding: 0 8px; left: -42px; border-radius: 999px; font-size: .72rem; }
.etape.suivi .n { background: var(--p1); }
/* Étapes ouvertes : grandes, nettes, avec un vrai bouton */
a.etape { padding: 20px 22px; border: 2px solid transparent; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, var(--ui-vif), var(--p1)) border-box; box-shadow: var(--ombre-forte); }
a.etape .n { width: 36px; height: 36px; left: -37px; top: 18px; font-size: .95rem; background: linear-gradient(135deg, var(--ui-vif), var(--ui)); box-shadow: 0 0 0 4px var(--fond), 0 0 0 7px rgba(37, 99, 235, .25); }
a.etape h3 { font-size: 1.25rem; color: var(--ui); }
a.etape:hover, a.etape:focus-visible { transform: translateY(-3px); }
a.etape .entrer {
  align-self: flex-start; margin-top: 10px; padding: 9px 18px; border-radius: 999px;
  background: linear-gradient(135deg, var(--ui-vif), var(--ui)); color: #fff; font-size: .95rem;
  box-shadow: 0 8px 18px -10px var(--ui);
}
a.etape .entrer::after { content: " →"; }
/* Étapes en préparation : discrètes, compactes */
.etape[aria-disabled="true"] { opacity: 1; background: rgba(255, 255, 255, .55); border: 1.5px dashed #cdd3df; box-shadow: none; padding: 12px 16px; }
.etape[aria-disabled="true"] h3 { font-size: 1rem; color: #64748b; margin-top: 0; }
.etape[aria-disabled="true"] p { font-size: .88rem; color: #7c8597; }
.etape[aria-disabled="true"] .n { background: #b6bfce; }
.etape .bientot { align-self: flex-start; margin-top: 6px; padding: 2px 10px; border-radius: 999px; background: #eef1f6; font-size: .75rem; }
@media (min-width: 900px) {
  /* Sur ordinateur (accueil des 5 étapes seulement), les cartes « en préparation » se mettent deux par ligne */
  main > .etapes:first-child { grid-template-columns: 1fr 1fr !important; padding-left: 0; }
  main > .etapes:first-child::before { display: none; }
  main > .etapes:first-child .etape .n { position: static; box-shadow: none; }
  main > .etapes:first-child .etape { flex-direction: row; flex-wrap: wrap; align-items: center; column-gap: 14px; }
  main > .etapes:first-child .etape h3 { margin: 0; flex: 1; }
  main > .etapes:first-child .etape p { flex-basis: 100%; }
  main > .etapes:first-child .etape .bientot { margin-top: 0; }
  main > .etapes:first-child a.etape { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "n t e" "n p e"; align-items: center; column-gap: 18px; }
  main > .etapes:first-child a.etape .n { grid-area: n; width: 54px; height: 54px; font-size: 1.3rem; border-radius: 16px; }
  main > .etapes:first-child a.etape h3 { grid-area: t; align-self: end; }
  main > .etapes:first-child a.etape p { grid-area: p; align-self: start; }
  main > .etapes:first-child a.etape .entrer { grid-area: e; margin: 0; }
}

/* ---------- Étape 4 : liste des savoir-faire ---------- */
.titre-partie { border-left: 0; padding: 6px 14px; border-radius: 999px; display: inline-block; background: var(--p2-clair); color: var(--p2); font-size: 1rem; }
.titre-partie.p1 { background: var(--p1-clair); color: var(--p1); }
.titre-partie.p2 ~ .etapes a.etape { background: linear-gradient(#fff, #fff) padding-box, linear-gradient(135deg, #f59e0b, var(--p2)) border-box; }
.titre-partie.p2 ~ .etapes a.etape .n { background: linear-gradient(135deg, #f59e0b, var(--p2)); box-shadow: 0 0 0 4px var(--fond), 0 0 0 7px rgba(194, 65, 12, .2); }
.titre-partie.p2 ~ .etapes a.etape h3 { color: #9a3412; }
.titre-partie.p2 ~ .etapes a.etape .entrer { background: linear-gradient(135deg, #f59e0b, var(--p2)); box-shadow: 0 8px 18px -10px var(--p2); }
/* Une liste de fiches n'est pas un chemin : grille de cartes, sans trait */
.titre-partie ~ .etapes { padding-left: 0; }
.titre-partie ~ .etapes::before { display: none; }
.titre-partie ~ .etapes .etape .n { position: static; box-shadow: none; }
@media (min-width: 640px) { .titre-partie ~ .etapes { grid-template-columns: 1fr 1fr !important; } }
@media (min-width: 1000px) { .titre-partie ~ .etapes { grid-template-columns: repeat(3, 1fr) !important; } }

/* ---------- Fiches savoir-faire ---------- */
ul.consignes li { background: var(--p2-clair); border-left: 4px solid var(--p2); border-radius: 0 12px 12px 0; font-style: italic; }
figure.schema { background: #fff; border: 1px solid var(--trait); border-radius: 16px; padding: 12px; box-shadow: var(--ombre-douce); }
dl.retenir > div { border-left-color: var(--ui-vif); background: linear-gradient(90deg, var(--ui-clair), #fff 60%); }
dl.retenir dt { color: var(--ui); }
ol.echelle b { color: var(--ui-vif); }
.exemple { border-left-color: var(--ui-vif); background: #f7f9ff; }
.rep { position: relative; padding-left: 44px; }
.rep::before { position: absolute; left: 12px; top: 11px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; }
.rep.i::before { content: "✗"; background: var(--ko); }
.rep.m::before { content: "✓"; background: var(--ok); }
table.matrice th { background: #f1f4fa; }
table.matrice { border-radius: 12px; overflow: hidden; }

/* ---------- Exercices : gros boutons faciles à toucher, retour visuel ---------- */
section.exos .exo { border-top: 0; margin: 14px 0; padding: 16px; border-radius: 16px; background: #f6fbf7; border: 1px solid #d5ecdb; }
section.exos .jxe-b { min-height: 44px; padding: 10px 18px; border-radius: 999px; border-color: #15803d; background: #15803d; transition: transform .1s, box-shadow .15s; }
section.exos .jxe-b.second { background: #fff; color: #15803d; }
section.exos .jxe-b:hover:not(:disabled) { box-shadow: 0 6px 14px -8px #15803d; transform: translateY(-1px); }
section.exos .jxe-b:active:not(:disabled) { transform: translateY(1px); }
section.exos .jxe-cats { gap: 6px; flex-wrap: wrap; }
section.exos .jxe-cats button { min-height: 40px; padding: 8px 14px; border-radius: 999px; border-color: #cbd5e1; font-weight: 700; transition: background .15s, color .15s; }
section.exos .jxe-cats button.choisi { background: var(--ui); border-color: var(--ui); }
section.exos .jxe-bulle { border-radius: 14px; padding: 12px; flex-wrap: wrap; }
section.exos .jxe-bulle.juste { border-color: #16a34a; background: #f0fdf4; }
section.exos .jxe-bulle.faux { border-color: #dc2626; background: #fef2f2; }
section.exos .jxe-choix label { display: block; padding: 10px 12px; border: 1.5px solid #e2e8f0; border-radius: 12px; background: #fff; }
section.exos .jxe-choix label:hover { border-color: #94a3b8; }
section.exos .jxe-bilan.oui { color: #15803d; }
section.exos textarea { width: 100%; border-radius: 12px; border: 1.5px solid #cbd5e1; padding: 10px; font: inherit; }
@media (prefers-reduced-motion: no-preference) {
  section.exos .jxe-bulle.juste, section.exos .jxe-bulle.faux { animation: v2-pop .35s ease; }
}
@keyframes v2-pop { 0% { transform: scale(.98); } 60% { transform: scale(1.015); } 100% { transform: none; } }

/* ---------- Bas de page : précédent / suivant ---------- */
.suite a { background: linear-gradient(135deg, var(--ui-vif), var(--ui)); box-shadow: 0 8px 18px -10px var(--ui); }
.suite a.second { box-shadow: var(--ombre-douce); }
.ressources a { box-shadow: var(--ombre-douce); }
.ressources a:hover, .ressources a:focus-visible { border-color: var(--ui); }

/* ---------- Téléphone ---------- */
@media (max-width: 700px) {
  .tete { padding: 18px 0 20px; }
  .tete h1 { font-size: 1.55rem; margin-bottom: 6px; }
  .tete p { font-size: .95rem; }
  .tete .sur { font-size: .68rem; letter-spacing: .08em; }
  section.bloc { padding: 20px 16px 20px 20px; border-radius: 16px; }
  /* Précédent / suivant toujours à portée de pouce */
  .suite {
    position: sticky; bottom: 0; z-index: 15; margin: 18px -16px 0; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(245, 246, 250, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border-top: 1px solid var(--trait); flex-wrap: nowrap;
  }
  .suite a { flex: 1; text-align: center; padding: 10px 12px; font-size: .9rem; }
}

@media (prefers-reduced-motion: no-preference) {
  section.bloc, .etape { animation: v2-monte .45s cubic-bezier(.2, .7, .2, 1) both; }
  .etape:nth-child(2) { animation-delay: .05s; } .etape:nth-child(3) { animation-delay: .1s; }
  .etape:nth-child(4) { animation-delay: .15s; } .etape:nth-child(5) { animation-delay: .2s; }
  .etape:nth-child(6) { animation-delay: .25s; } .etape:nth-child(7) { animation-delay: .3s; }
  .etape:nth-child(8) { animation-delay: .35s; }
}
@keyframes v2-monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

@media print {
  .v2-progres, .pastilles { display: none !important; }
  section.bloc::before { display: none; }
  .suite { position: static; }
}
