/* L'épreuve de PSE au CAP — habillage visuel v2 (mapse.fr)
   Se charge APRÈS epreuve-cap.css : ne change aucun texte, seulement l'apparence.
   Pour revenir à l'ancien style, il suffit de retirer le lien vers ce fichier. */

:root {
  --theme: var(--bleu);
  --theme-clair: var(--bleu-clair);
  --theme-moyen: #c9c6f2;
  --ombre: 0 1px 2px rgba(21, 33, 58, .06), 0 12px 32px -8px rgba(21, 33, 58, .16);
}

/* Une couleur par partie de l'épreuve, choisie d'après la page ouverte */
body:has(.etapes a[aria-current][href="se1-sst.html"]) { --theme: var(--vert); --theme-clair: var(--vert-clair); --theme-moyen: #b9dcc9; }
body:has(.etapes a[aria-current][href="thematiques.html"]),
body:has(.etapes a[aria-current][href="convocation.html"]) { --theme: #5b3fb8; --theme-clair: #f0ecfb; --theme-moyen: #d6cdf3; }

/* Fond : lumière douce aux couleurs de la page */
html { background: var(--fond); }
body {
  background:
    radial-gradient(1100px 520px at 12% -10%, var(--theme-clair), transparent 60%),
    radial-gradient(900px 480px at 100% 110%, var(--accent-clair), transparent 60%),
    var(--fond);
}

/* Bandeau translucide */
.nav {
  background: rgba(255, 255, 255, .78);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.nav a { background: var(--papier); }
.nav a:hover, .nav a:focus-visible { background: var(--theme-clair); border-color: var(--theme); }

/* Sommaire : une frise de progression reliant les 6 étapes */
.etapes { position: relative; gap: clamp(10px, 3vw, 26px); padding-top: 18px; }
.etapes a { position: relative; z-index: 1; min-width: 38px; height: 38px; font-size: .9rem; box-shadow: 0 1px 2px rgba(21,33,58,.06); }
.etapes::before {
  content: ""; position: absolute; z-index: 0; top: calc(18px + 19px); left: 50%;
  width: min(380px, 70%); height: 3px; transform: translate(-50%, -50%);
  background: linear-gradient(90deg, var(--theme-moyen), var(--trait)); border-radius: 3px;
}
.etapes a:has(~ a[aria-current]) { background: var(--theme-clair); border-color: var(--theme-moyen); color: var(--theme); }
.etapes a[aria-current="page"] {
  background: var(--theme); border-color: var(--theme); color: #fff;
  box-shadow: 0 0 0 5px var(--theme-clair), 0 6px 14px -4px var(--theme);
  transform: scale(1.08);
}
.etapes a:hover, .etapes a:focus-visible { border-color: var(--theme); }

/* La carte de contenu */
.page {
  position: relative; overflow: hidden;
  border: 1px solid rgba(21, 33, 58, .07); border-radius: 22px;
  box-shadow: var(--ombre);
}
.page::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--theme), var(--accent));
}
.sur {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--theme-clair); color: var(--theme); letter-spacing: .08em;
}
h1 { letter-spacing: -.01em; margin-top: 10px; }
h1::after {
  content: ""; display: block; width: 64px; height: 4px; margin-top: 12px; border-radius: 4px;
  background: linear-gradient(90deg, var(--theme), var(--accent));
}
.page strong { color: var(--theme); }
.page li::before { background: var(--theme); border-radius: 50%; }

/* Encadré de règle : discret, avec une pastille « i » */
.regle {
  position: relative; padding: 14px 18px 14px 54px; border: 1px solid var(--trait);
  border-left: 0; background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(21,33,58,.05);
}
.regle::before {
  content: "i"; position: absolute; left: 16px; top: 14px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-style: italic; font-family: Georgia, serif;
  background: var(--accent-clair); color: var(--accent); border: 1px solid #f1d3a6;
}
.regle strong { color: var(--encre); }

/* Compétences : cartes numérotées reliées par un fil */
.page ol.chaine { gap: 16px; position: relative; }
.page li.comp {
  background: #fff; border: 1px solid var(--theme-moyen); border-top: 4px solid var(--theme);
  border-radius: 14px; padding: 14px 14px 16px; gap: 10px;
  box-shadow: 0 1px 2px rgba(21,33,58,.05);
  transition: transform .2s ease, box-shadow .2s ease;
}
.page li.comp:hover { transform: translateY(-3px); box-shadow: var(--ombre); }
.page li.comp:not(:last-child)::after {
  content: ""; right: -8px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--theme) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M6 4l4 4-4 4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/12px no-repeat;
  box-shadow: 0 0 0 4px #fff; z-index: 1;
}
.code {
  font-size: 1.05rem; padding: 3px 11px; border-radius: 10px;
  background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 70%, #4f8cff));
  box-shadow: 0 4px 10px -4px var(--theme);
}

/* C6, compétence transversale : un bandeau qui « porte » toutes les autres */
.transversale {
  position: relative; margin-top: 22px; border: 0; border-radius: 16px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent-clair), #fff 70%);
  box-shadow: inset 0 0 0 2px #f1d3a6;
}

.page .transversale strong { color: var(--accent); }
.transversale .code { background: linear-gradient(135deg, var(--accent), #e07b2a); box-shadow: 0 4px 10px -4px var(--accent); }

/* Thématiques */
.thema { border-radius: 16px; box-shadow: 0 1px 2px rgba(21,33,58,.05); transition: transform .2s ease, box-shadow .2s ease; }
.thema:hover { transform: translateY(-3px); box-shadow: var(--ombre); }
.thema.obligatoire { border-color: var(--theme); background: linear-gradient(180deg, var(--theme-clair), #fff); }
.thema .lettre { color: var(--theme); font-size: 1.5rem; }
.thema .etiquette { background: var(--theme); }

/* Boutons précédent / suivant */
.pager a, .pager span.vide { box-shadow: 0 1px 2px rgba(21,33,58,.06); transition: transform .15s ease, box-shadow .15s ease; }
.pager a:hover, .pager a:focus-visible { transform: translateY(-1px); box-shadow: 0 0 0 3px var(--theme-clair), var(--ombre); }
.pager a.suivant {
  background: linear-gradient(135deg, var(--theme), color-mix(in srgb, var(--theme) 70%, #4f8cff));
  border-color: transparent; box-shadow: 0 8px 18px -8px var(--theme);
}

/* Apparition douce, élément par élément */
@media (prefers-reduced-motion: no-preference) {
  .page { animation: v2-monte .5s cubic-bezier(.2,.7,.2,1) both; }
  .page li, .thema, .transversale, .regle, .visuel { animation: v2-monte .5s cubic-bezier(.2,.7,.2,1) both; }
  .page li:nth-child(1), .thema:nth-child(1) { animation-delay: .10s; }
  .page li:nth-child(2), .thema:nth-child(2) { animation-delay: .17s; }
  .page li:nth-child(3), .thema:nth-child(3) { animation-delay: .24s; }
  .page li:nth-child(4), .thema:nth-child(4) { animation-delay: .31s; }
  .page li:nth-child(5) { animation-delay: .38s; }
  .transversale, .visuel { animation-delay: .42s; }
  .regle { animation-delay: .5s; }
}
@keyframes v2-monte { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Téléphone */
@media (max-width: 760px) {
  .etapes { gap: 8px; }
  .etapes::before { width: 78%; }
  .page { border-radius: 18px; }
  .page li.comp { border-top-width: 1px; border-left: 4px solid var(--theme); }
  .page li.comp:not(:last-child)::after { right: auto; left: 50%; bottom: -8px; transform: translate(-50%, 50%) rotate(90deg); }
}

@media print {
  body { background: #fff; }
  .page::before, h1::after { display: none; }
}
