/* ============================================================
   📚 MES SUJETS FAITS (24/10/2026) — sujets-faits.html et en/sujets-faits.html
   ------------------------------------------------------------
   D'après la maquette acceptée par Alex : tools/maquettes/mes-sujets-faits.html
   (captures dans tools/captures/sujets-faits/). Même monde que la Prépa et
   que « Mon compte » : les jetons de css/styles.css, rien de recopié.
   Téléphone (moins de 960 px) : la liste, puis le sujet en plein écran avec
   « ‹ Mes sujets faits ». Ordinateur : deux colonnes.
   Tailles d'écran en em (le zoom du visiteur compte) : 60em = 960 px,
   47.9375em = 767 px (la barre d'onglets du bas du site), 45em = 720 px.
   ============================================================ */

.msf { padding: var(--sp-6) 0 var(--sp-7); }
.msf ::selection { background: var(--blush); color: var(--red-ink); }
.msf-lecteur { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- En-tête : titre, résumé, TCF Canada | IELTS ---------- */
.msf-tete { display: grid; gap: 6px 24px; grid-template-columns: minmax(0, 1fr); }
.msf-tete h1 {
  font-family: Sora, sans-serif; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); letter-spacing: var(--tracking-title);
  color: var(--navy-dark); margin: 0; text-wrap: balance;
}
.msf-resume { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.55; max-width: 62ch; min-height: 1.55em; }
.msf-resume b { color: var(--ink); font-weight: 600; }

.msf-plateformes {
  display: inline-grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 0 0 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-pill); width: 100%; max-width: 340px;
  order: -1; /* téléphone : les deux onglets en tête, au-dessus du titre */
}
.msf-plateformes a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); font: 600 .875rem Sora, sans-serif; color: var(--muted); text-decoration: none; white-space: nowrap;
  transition: background-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.msf-plateformes a:hover { color: var(--navy-dark); }
.msf-plateformes a[aria-current="page"] { background: var(--white); color: var(--navy-dark); box-shadow: var(--shadow-sm); }
.msf-plateformes a[aria-current="page"]::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.msf-plateformes a:focus-visible { outline: none; box-shadow: var(--ring); }
@media (min-width: 45em) {
  .msf-tete { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .msf-tete h1 { grid-column: 1; grid-row: 1; }
  .msf-resume { grid-column: 1; grid-row: 2; }
  .msf-plateformes { grid-column: 2; grid-row: 1 / span 2; margin: 4px 0 0; width: auto; }
}

/* ---------- Filtres par épreuve ---------- */
.msf-filtres { display: flex; gap: 8px; margin: 20px 0 18px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 4px; }
.msf-filtres::-webkit-scrollbar { display: none; }
@media (max-width: 44.9375em) {
  .msf-filtres { margin-right: -20px; padding-right: 20px; mask-image: linear-gradient(90deg, var(--ink) calc(100% - 40px), transparent); }
}
.msf-filtres button {
  flex: none; min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: var(--r-pill);
  background: var(--white); font: 600 .875rem Sora, sans-serif; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.msf-filtres button:hover { color: var(--navy-dark); border-color: var(--line-strong); }
.msf-filtres button span { font: 600 .75rem Inter, sans-serif; font-variant-numeric: tabular-nums; color: var(--muted); }
.msf-filtres button[aria-pressed="true"] { background: var(--navy-dark); border-color: var(--navy-dark); color: #fff; }
.msf-filtres button[aria-pressed="true"] span { color: rgba(255, 255, 255, .72); }
.msf-filtres button:focus-visible, .msf-ligne:focus-visible, .msf-retour:focus-visible,
.msf-detail summary:focus-visible { outline: none; box-shadow: var(--ring); }

/* ---------- Les deux colonnes ---------- */
.msf-corps { display: grid; gap: 24px; align-items: start; }
@media (min-width: 60em) { .msf-corps { grid-template-columns: 400px minmax(0, 1fr); } }
.msf-corps.vide { grid-template-columns: minmax(0, 1fr); }

/* ---------- La liste ---------- */
.msf-groupe { margin: 0 0 18px; }
.msf-groupe h2 { font: 600 .75rem Inter, sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px 4px; }
.msf-liste { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.msf-liste li { margin: 0; }
.msf-liste li + li { border-top: 1px solid var(--line); }
.msf-ligne {
  width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 12px 14px; min-height: 64px; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit;
  transition: background-color .15s ease;
}
.msf-ligne:hover { background: var(--bg); }
.msf-ligne[aria-current="true"] { background: var(--blush); }
.msf-ico { width: 40px; height: 40px; border-radius: var(--r); display: grid; place-items: center; background: var(--bg); color: var(--navy-dark); }
.msf-ligne[aria-current="true"] .msf-ico { background: var(--white); color: var(--red-dark); }
.msf-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.msf-txt { min-width: 0; }
.msf-txt b { display: block; font: 600 .9375rem/1.3 Sora, sans-serif; color: var(--navy-dark); text-wrap: balance; }
.msf-txt small { display: block; margin-top: 3px; font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; }
.msf-txt small em { font-style: normal; color: var(--red-ink); font-weight: 600; }

.msf-etat { justify-self: end; display: grid; justify-items: end; gap: 3px; font-variant-numeric: tabular-nums; }
.msf-etat b { font: 700 .9375rem Sora, sans-serif; color: var(--navy-dark); white-space: nowrap; }
.msf-etat b small { font: 600 .75rem Inter, sans-serif; color: var(--muted); }
.msf-puce { display: inline-block; padding: 2px 8px; border-radius: var(--r-pill); font: 600 .75rem/1.5 Inter, sans-serif; white-space: nowrap; }
.msf-puce.ok { background: var(--teal-light); color: var(--teal-ink); }
.msf-puce.bas { background: var(--blush); color: var(--red-ink); }
.msf-puce.attente { background: var(--amber-light); color: var(--amber-ink); }
.msf-puce.gris { background: var(--line); color: var(--muted); }

/* Liste vide, Speaking, erreur, chargement */
.msf-vide {
  display: grid; justify-items: start; gap: 10px; padding: 24px; background: var(--white); border: 1px solid var(--line);
  border-radius: var(--r); max-width: 640px;
}
.msf-vide .msf-ico { background: var(--blush); color: var(--red-dark); }
.msf-vide h2 { font: 700 1.125rem/1.3 Sora, sans-serif; color: var(--navy-dark); margin: 4px 0 0; text-wrap: balance; }
.msf-vide p { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.6; max-width: 56ch; }
.msf-vide .btn { margin-top: 6px; }
.msf-porte { margin: 8px auto 0; justify-items: center; text-align: center; padding: 32px 24px; }
.msf-porte .msf-ico { width: 56px; height: 56px; border-radius: 50%; }
.msf-porte .msf-ico svg { width: 26px; height: 26px; }
.msf-porte p { margin: 0 auto; }
.msf-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }

.msf-attente { display: grid; gap: 10px; }
.msf-attente span, .msf-squelette {
  display: block; border-radius: var(--r); background: linear-gradient(90deg, var(--line) 0 40%, var(--bg) 50%, var(--line) 60% 100%);
  background-size: 300% 100%; animation: msf-reflet 1.4s ease-in-out infinite;
}
.msf-attente span { height: 64px; }
.msf-attente span:first-child { height: 44px; width: min(100%, 520px); border-radius: var(--r-pill); }
.msf-squelette { height: 14px; margin: 10px 0; border-radius: var(--r-sm); }
@keyframes msf-reflet { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ---------- Le sujet rouvert ---------- */
.msf-detail { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; min-width: 0; scroll-margin-top: 90px; }
.msf-detail:empty { display: none; }
.msf-detail:focus { outline: none; }
.msf-detail.entre > * { animation: msf-entree .32s cubic-bezier(.16, 1, .3, 1) both; }
@keyframes msf-entree { from { opacity: .001; transform: translateY(6px); } }
.msf-retour {
  display: none; align-items: center; gap: 6px; min-height: 44px; margin: -6px 0 6px -6px; padding: 0 6px; border: 0; background: none;
  font: 600 .875rem Sora, sans-serif; color: var(--red-dark); cursor: pointer; border-radius: var(--r-sm);
}
.msf-retour svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.msf-detail h2 { font: 700 1.375rem/1.25 Sora, sans-serif; letter-spacing: var(--tracking-title); color: var(--navy-dark); margin: 0 0 6px; text-wrap: balance; }
.msf-meta { margin: 0; font-size: var(--fs-sm); color: var(--muted); line-height: 1.5; }
.msf-meta .msf-puce { margin-left: 4px; vertical-align: 1px; }

.msf-note {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 20px 0 0; padding: 16px 18px; border-radius: var(--r);
  background: var(--bg); border: 1px solid var(--line);
}
.msf-note strong { font: 700 2rem/1 Sora, sans-serif; letter-spacing: var(--tracking-title); color: var(--navy-dark); font-variant-numeric: tabular-nums; white-space: nowrap; }
.msf-note strong small { font-size: 1rem; color: var(--muted); font-weight: 600; }
.msf-note p { flex: 1 1 260px; margin: 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink); }
.msf-note-taches { flex: 1 1 100%; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; }
.msf-note-taches b { color: var(--ink); }

.msf-acorriger {
  margin: 20px 0 0; padding: 16px 18px; border-radius: var(--r); background: var(--amber-light); color: var(--amber-ink);
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
}
.msf-acorriger p { flex: 1 1 280px; margin: 0; font-size: var(--fs-sm); line-height: 1.6; }
.msf-acorriger p b { font-weight: 700; }
.msf-acorriger a:not(.btn) { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msf-acorriger .btn { margin: 0; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.msf-acorriger .btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.msf-acorriger .btn[disabled] { opacity: .6; cursor: progress; box-shadow: none; }
.msf-acorriger.erreur { background: var(--blush); color: var(--red-ink); }
.msf-acorriger .btn-outline { background: var(--white); }
/* L'attente de la correction (une trentaine de secondes) : une barre qui avance */
.msf-barre-attente { flex: 1 1 100%; height: 4px; border-radius: var(--r-pill); background: color-mix(in oklab, currentColor 18%, transparent); overflow: hidden; }
.msf-barre-attente::after {
  content: ""; display: block; width: 40%; height: 100%; border-radius: inherit; background: currentColor;
  animation: msf-avance 1.6s cubic-bezier(.65, 0, .35, 1) infinite;
}
@keyframes msf-avance { from { transform: translateX(-100%); } to { transform: translateX(250%); } }

.msf-perdu {
  margin: 20px 0 0; padding: 14px 16px; border-radius: var(--r); background: var(--bg); border: 1px dashed var(--line-strong);
  font-size: var(--fs-sm); line-height: 1.6; color: var(--muted);
}
.msf-perdu b { color: var(--ink); }
.msf-garde { margin: 20px 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--muted); max-width: 68ch; }

.msf-tache { margin: 28px 0 0; }
.msf-tache h3 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; font: 700 1rem Sora, sans-serif; color: var(--navy-dark); margin: 0 0 10px; }
.msf-tache h3 span { font: 600 .8125rem Inter, sans-serif; color: var(--muted); font-variant-numeric: tabular-nums; }
.msf-consigne { margin: 0 0 12px; font-size: var(--fs-sm); line-height: 1.6; color: var(--muted); white-space: pre-line; max-width: 68ch; }
.msf-consigne b { color: var(--ink); font-weight: 600; }
details.msf-consigne { white-space: normal; }
details.msf-consigne summary { cursor: pointer; padding-block: 11px; font-weight: 600; color: var(--ink); border-radius: var(--r-sm); width: fit-content; }
details.msf-consigne summary::marker { color: var(--red-dark); }
details.msf-consigne p { margin: 8px 0 0; white-space: pre-line; }
.msf-copie {
  margin: 0; padding: 16px 18px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line);
  font-size: .9375rem; line-height: 1.7; color: var(--ink); white-space: pre-line; max-width: 68ch; overflow-wrap: anywhere;
}
.msf-copie mark { background: var(--blush); color: var(--red-ink); border-radius: 3px; padding: 0 2px; }
.msf-appr { margin: 10px 0 0; font-size: var(--fs-sm); line-height: 1.6; color: var(--ink); max-width: 68ch; }
.msf-appr b { color: var(--teal-ink); }

.msf-detail h4 { display: flex; align-items: center; gap: 10px; font: 700 1rem Sora, sans-serif; color: var(--navy-dark); margin: 32px 0 12px; }
.msf-detail h4 svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--red-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.msf-fautes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.msf-fautes li { padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.6; overflow-wrap: anywhere; }
.msf-fautes s { color: var(--red-ink); text-decoration-thickness: 1.5px; }
.msf-fautes ins { text-decoration: none; color: var(--teal-ink); font-weight: 600; }
.msf-fautes small { display: block; color: var(--muted); font-size: var(--fs-xs); margin-top: 2px; }
.msf-conseils { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--fs-sm); line-height: 1.6; max-width: 68ch; }

/* IELTS : les quatre critères officiels */
.msf-criteres { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
@media (min-width: 45em) { .msf-criteres { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.msf-criteres li { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.55; }
.msf-criteres li > span { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font: 600 .875rem/1.35 Sora, sans-serif; color: var(--navy-dark); }
.msf-criteres li > span b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.msf-criteres p { margin: 6px 0 0; color: var(--muted); }

/* Questions de compréhension rouvertes */
.msf-q { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; }
.msf-q li {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); font-size: var(--fs-sm); line-height: 1.5; overflow-wrap: anywhere;
}
.msf-q li > span {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 .75rem Sora, sans-serif;
  background: var(--teal-light); color: var(--teal-ink); font-variant-numeric: tabular-nums;
}
.msf-q li.ko > span { background: var(--blush); color: var(--red-ink); }
.msf-q li.neutre > span { background: var(--bg); color: var(--navy-dark); border: 1px solid var(--line); }
.msf-q small { display: block; color: var(--muted); }
.msf-q small b { color: var(--ink); }
.msf-q-titre { color: var(--ink); }

/* ---------- Téléphone : la liste, puis le sujet en plein écran ---------- */
@media (max-width: 59.9375em) {
  .msf { padding-top: 20px; }
  .msf-detail { display: none; padding: 0; border: 0; background: none; }
  .msf.vue-detail .msf-tete, .msf.vue-detail .msf-filtres, .msf.vue-detail .msf-col-liste { display: none; }
  .msf.vue-detail .msf-detail { display: block; }
  .msf.vue-detail .msf-retour { display: inline-flex; }
  .msf-note strong { font-size: 1.75rem; }
}
@media (max-width: 47.9375em) {
  .msf.vue-detail.a-barre { padding-bottom: 180px; }
  /* Le bloc collé ne recouvre jamais le pied de page (adresse du cabinet). */
  body:has(.msf.vue-detail.a-barre) footer { padding-bottom: 180px; }
  .msf-acorriger.collant {
    position: fixed; left: 0; right: 0; bottom: 0; margin: 0; z-index: 100; border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 14px 20px calc(14px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -8px 24px rgba(23, 19, 20, .12);
  }
  body.bb:not(.bb-sans-onglets) .msf-acorriger.collant { bottom: var(--bb-bas, 0px); padding-bottom: calc(14px + var(--bb-bosse, 0px)); }
  .msf-acorriger.collant .btn { flex: 1 1 100%; min-height: 48px; }
}
@media (max-width: 23.75em) {
  .msf-ligne { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 12px; }
  .msf-ico { width: 36px; height: 36px; }
}

/* ---------- Nuit ---------- */
:root[data-theme="nuit"] .msf-puce.ok { background: #143326; color: #8FE0B4; }
:root[data-theme="nuit"] .msf-puce.attente { background: #3A2E10; color: #F0D48A; }
:root[data-theme="nuit"] .msf-acorriger { background: #2E2510; color: #F0D48A; }
:root[data-theme="nuit"] .msf-acorriger.erreur { background: #3A1C24; color: #FF9C94; }
:root[data-theme="nuit"] .msf-filtres button[aria-pressed="true"] { background: #25314D; color: #EAEFF7; border-color: #3A4A6E; }
:root[data-theme="nuit"] .msf-acorriger.collant { box-shadow: 0 -8px 24px rgba(0, 0, 0, .45); }

@media (prefers-reduced-motion: reduce) {
  .msf-detail.entre > *, .msf-attente span, .msf-squelette { animation: none; }
  .msf-barre-attente::after { animation-duration: 3.2s; }
  .msf-plateformes a, .msf-filtres button, .msf-ligne { transition: none; }
}
