/* ═══════════════════════════════════════════════════════════════
   revisionstmg.fr — couche « expérience élève » (oct. 2026)
   Choix de la classe, rubriques en onglets, progression, fiches, impression.
   Chargé par l'accueil (application) et par toutes les pages fiches.
═══════════════════════════════════════════════════════════════ */

:root{ --ux-green:#1e5c1e; --ux-green-2:#2d6a2d; --ux-mint:#86efac; --ux-ink:#14240f; }

/* ---------- Barre haute : choix de la classe ---------- */
.lv-switch{ display:flex; align-items:center; flex-shrink:0; margin:7px 6px; padding:3px; gap:2px;
  border-radius:999px; background:rgba(255,255,255,.08); border:1px solid rgba(255,255,255,.14); }
.lv-switch button{ border:0; background:none; color:rgba(255,255,255,.62); font:700 12px/1 'Outfit',sans-serif;
  letter-spacing:.03em; padding:7px 11px; border-radius:999px; cursor:pointer; white-space:nowrap; }
.lv-switch button:hover{ color:#fff; }
.lv-switch button[aria-pressed="true"]{ background:var(--ux-mint); color:var(--ux-ink); }
.lv-switch button:focus-visible{ outline:2px solid var(--ux-mint); outline-offset:2px; }
.matiere-btn.lv-hide{ display:none !important; }
.matiere-switcher .matiere-group-sep{ display:none !important; }
@media (max-width:1440px){ .matiere-switcher .matiere-btn{ padding:13px 10px; letter-spacing:.02em; } }
@media (max-width:1300px){ .matiere-switcher .matiere-btn{ font-size:12px; padding:13px 8px; } }
.matiere-divider{ display:none !important; }

/* ---------- Accueil : « Tu es en… » ---------- */
.lv-block{ margin:0 0 30px; }
.lv-resume{ display:flex; align-items:center; gap:14px; padding:14px 18px; margin:0 0 22px; border-radius:16px;
  background:var(--card,#fff); border:1px solid var(--border,#dfe5d8); text-decoration:none; color:var(--text,#1a1a1a);
  box-shadow:0 2px 6px rgba(0,0,0,.04); }
.lv-resume:hover{ border-color:var(--ux-green-2); }
.lv-resume-ico{ flex:none; width:40px; height:40px; border-radius:12px; display:grid; place-items:center;
  background:var(--ux-green); color:#fff; font-size:18px; }
.lv-resume small{ display:block; font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--muted,#6b7280); }
.lv-resume b{ font-size:16px; }
.lv-resume .lv-go{ margin-left:auto; font-weight:800; color:var(--ux-green-2); white-space:nowrap; }
.lv-choice{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.lv-door{ text-align:left; border:2px solid var(--border,#dfe5d8); background:var(--card,#fff); border-radius:18px;
  padding:18px 20px; cursor:pointer; font-family:'Outfit',sans-serif; color:var(--text,#1a1a1a);
  transition:border-color .15s ease, box-shadow .15s ease, transform .15s ease; }
.lv-door:hover{ border-color:var(--ux-green-2); transform:translateY(-1px); }
.lv-door b{ display:block; font-size:21px; font-weight:800; margin-bottom:4px; }
.lv-door span{ display:block; font-size:13.5px; color:var(--muted,#6b7280); line-height:1.45; }
.lv-door[aria-pressed="true"]{ border-color:var(--ux-green-2); background:linear-gradient(180deg,rgba(45,106,45,.08),rgba(45,106,45,.02));
  box-shadow:0 0 0 3px rgba(45,106,45,.15); }
.lv-door[aria-pressed="true"] b::after{ content:" ✓"; color:var(--ux-green-2); }
.lv-door:focus-visible{ outline:3px solid var(--ux-mint); outline-offset:3px; }
.lv-opt{ margin-top:14px; display:flex; flex-wrap:wrap; align-items:center; gap:8px 10px; }
.lv-opt > span{ font-size:14px; font-weight:700; color:var(--text,#1a1a1a); margin-right:4px; }
.lv-chip{ border:1.5px solid var(--border,#dfe5d8); background:var(--card,#fff); color:var(--text,#1a1a1a); border-radius:999px;
  padding:8px 14px; font:600 14px/1 'Outfit',sans-serif; cursor:pointer; }
.lv-chip[aria-pressed="true"]{ background:var(--ux-green); border-color:var(--ux-green); color:#fff; }
.lv-chip:focus-visible{ outline:3px solid var(--ux-mint); outline-offset:2px; }
.lv-others{ margin:6px 0 26px; }
.lv-others > summary{ cursor:pointer; font-weight:700; color:var(--muted,#6b7280); padding:8px 0; list-style:none; }
.lv-others > summary::-webkit-details-marker{ display:none; }
.lv-others > summary::before{ content:"▸ "; }
.lv-others[open] > summary::before{ content:"▾ "; }
.lv-others .accueil-cards{ margin-top:10px; opacity:.92; }
@media (max-width:560px){ .lv-choice{ grid-template-columns:1fr; } .lv-door b{ font-size:19px; } }

/* progression sur les cartes matière */
.lv-prog{ margin-top:10px; }
.lv-prog-bar{ height:6px; border-radius:99px; background:rgba(0,0,0,.08); overflow:hidden; }
.lv-prog-bar i{ display:block; height:100%; background:var(--ux-green-2); border-radius:99px; }
.lv-prog small{ display:block; font-size:11.5px; margin-top:4px; opacity:.8; font-weight:600; }

/* ---------- Rubriques en onglets (remplace la liste déroulante) ---------- */
.volet-bar.has-tabs{ padding:8px 16px; }
.volet-bar.has-tabs::before{ display:none !important; }
.volet-bar.has-tabs .select-wrapper{ position:absolute !important; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
.rub-tabs{ display:flex; gap:6px; overflow-x:auto; scrollbar-width:none; max-width:920px; margin:0 auto; width:100%; padding:2px; }
.rub-tabs::-webkit-scrollbar{ display:none; }
.rub-tab{ flex:none; border:1.5px solid var(--border,#dfe5d8); background:var(--card,#fff); color:var(--text-2,#3b4a36);
  border-radius:999px; padding:8px 14px; font:600 13.5px/1.1 'Outfit',sans-serif; cursor:pointer; white-space:nowrap; }
.rub-tab:hover{ border-color:var(--accent2,#2d6a2d); color:var(--text,#1a1a1a); }
.rub-tab[aria-selected="true"]{ background:var(--accent,#1e5c1e); border-color:var(--accent,#1e5c1e); color:#fff; }
.rub-tab:focus-visible{ outline:3px solid var(--ux-mint); outline-offset:2px; }
#droit-wrapper .rub-tab[aria-selected="true"]{ background:#3730a3; border-color:#3730a3; }

/* onglets de thèmes : dégradé sur les bords pour signaler le défilement */
@media (max-width:900px){
  .themes-nav-inner{ -webkit-mask-image:linear-gradient(90deg,transparent 0,#000 14px,#000 calc(100% - 28px),transparent 100%);
    mask-image:linear-gradient(90deg,transparent 0,#000 14px,#000 calc(100% - 28px),transparent 100%); }
}

/* ---------- Boutons flottants allégés ---------- */
#fab-search{ display:none !important; }
@media (max-width:760px){ #fab-dark{ display:none !important; } }
.drawer-dark{ display:flex; align-items:center; gap:10px; width:calc(100% - 28px); margin:10px 14px 18px; padding:11px 12px;
  border:1px solid var(--border,#dfe5d8); border-radius:12px; background:none; color:var(--text,#1a1a1a);
  font:600 14px/1 'Outfit',sans-serif; cursor:pointer; }
.drawer-lv{ padding:14px 14px 6px; }
.drawer-lv .lv-switch{ margin:6px 0 0; background:var(--accent-pale,#eef5ea); border-color:var(--border,#dfe5d8); width:max-content; }
.drawer-lv .lv-switch button{ color:var(--text-2,#3b4a36); font-size:13px; padding:8px 14px; }
.drawer-lv .lv-switch button[aria-pressed="true"]{ background:var(--ux-green); color:#fff; }

/* ---------- Actions de fiche (application et pages fiches) ---------- */
.fx-bar{ display:flex; flex-wrap:wrap; gap:8px; margin:-6px 0 22px; }
.fx-btn{ display:inline-flex; align-items:center; gap:7px; min-height:40px; padding:8px 14px; border-radius:999px;
  border:1.5px solid var(--border,#d8e0d2); background:var(--card,#fff); color:var(--text,#1a1a1a);
  font:600 14px/1 'Outfit',sans-serif; text-decoration:none; cursor:pointer; }
.fx-btn:hover{ border-color:var(--ux-green-2); }
.fx-btn:focus-visible{ outline:3px solid var(--ux-mint); outline-offset:2px; }
.fx-done[aria-pressed="true"]{ background:var(--ux-green); border-color:var(--ux-green); color:#fff; }
.fx-done .fx-box{ width:16px; height:16px; border-radius:4px; border:2px solid currentColor; display:inline-grid; place-items:center; font-size:11px; line-height:1; }
.fx-done[aria-pressed="true"] .fx-box::after{ content:"✓"; }
.fx-bar[hidden], .fx-done[hidden]{ display:none !important; }
.theme-section .fx-bar{ margin:0 0 18px; }

/* précédent / suivant */
.fx-pn{ display:grid; grid-template-columns:1fr 1fr; gap:12px; margin:30px 0 8px; }
.fx-pn a{ display:block; padding:14px 16px; border-radius:14px; border:1px solid var(--border,#d8e0d2); background:var(--card,#fff);
  text-decoration:none; color:var(--text,#1a1a1a); }
.fx-pn a:hover{ border-color:var(--ux-green-2); }
.fx-pn small{ display:block; font-size:12px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--muted,#6b7280); margin-bottom:3px; }
.fx-pn b{ font-size:15.5px; }
.fx-pn .fx-next{ text-align:right; grid-column:2; }
@media (max-width:560px){ .fx-pn{ grid-template-columns:1fr; } .fx-pn .fx-next{ grid-column:auto; } }

/* listes et cartes : fiches maîtrisées */
.fx-list li.is-current > a{ font-weight:800; color:var(--text,#1a1a1a); text-decoration:none; }
.fx-list li.is-current > a::after{ content:" · tu es ici"; font-weight:500; color:var(--muted,#6b7280); font-size:13px; }
.is-done-mark::before{ content:"✓"; display:inline-grid; place-items:center; width:18px; height:18px; margin-right:6px; border-radius:50%;
  background:var(--ux-green-2); color:#fff; font-size:11px; font-weight:800; vertical-align:1px; }
.st-card.is-done{ border-color:rgba(45,106,45,.45); background:rgba(45,106,45,.05); }
.fx-hubprog{ margin:0 0 26px; padding:14px 16px; border-radius:14px; border:1px solid var(--border,#d8e0d2); background:var(--card,#fff); }
.fx-hubprog b{ font-size:15px; }
.fx-hubprog .lv-prog-bar{ margin-top:8px; height:8px; }

/* surlignage d'une matière dans le quiz (/#quiz-droit) */
.quiz-subj.ux-flash{ box-shadow:0 0 0 3px var(--ux-mint); transition:box-shadow .3s ease; }

/* en-tête imprimé (invisible à l'écran) */
.fx-print-head{ display:none; }

/* ═════════════ IMPRESSION / PDF ═════════════ */
@media print{
  @page{ size:A4; margin:13mm 12mm 15mm; }
  html, body{ background:#fff !important; }
  *{ -webkit-print-color-adjust:exact; print-color-adjust:exact; }
  *, *::before, *::after{ box-shadow:none !important; text-shadow:none !important; filter:none !important; backdrop-filter:none !important; }
  .theme-title-block::before, .theme-title-block::after, header::before, header::after{ display:none !important; }
  .st-top, .st-crumb, .fx-bar, .fx-pn, .st-box, .st-foot, footer, .fab-stack, .lead-cta, .search-overlay,
  .chevron, .mobile-topbar, .matiere-switcher, .drawer, .drawer-overlay{ display:none !important; }
  main{ max-width:none !important; padding:0 !important; margin:0 !important; }
  .fx-print-head{ display:flex !important; justify-content:space-between; align-items:baseline; gap:12px;
    font:600 10pt 'Outfit',sans-serif; color:#3b4a36; border-bottom:2px solid #1e5c1e; padding-bottom:5px; margin-bottom:10px; }
  .fx-print-head b{ color:#1e5c1e; font-weight:800; }
  .st-h1{ font-size:19pt !important; margin:0 0 10px !important; }
  .soustheme{ box-shadow:none !important; border:1px solid #d9dfd4 !important; break-inside:auto; margin-bottom:10px !important; }
  .soustheme-header{ cursor:default; padding:8px 12px !important; break-after:avoid; }
  .soustheme-body{ display:block !important; padding:0 12px 10px !important; }
  .def-item, .key-point, tr, svg, figure, .formule-box, .bloc-label{ break-inside:avoid; }
  .bloc-label{ break-after:avoid; }
  h2, h3, h4, .bloc-label, .theme-title-block{ break-after:avoid; }
  .theme-title-block{ padding:12px 14px !important; margin-bottom:12px !important; }
  a{ color:inherit !important; text-decoration:none !important; }
  .themes-nav, .volet-bar{ display:none !important; }
}

/* barre haute : la recherche passe en loupe quand la place manque */
@media (max-width:1720px){
  .matiere-switcher .nav-search-trigger .nst-txt, .matiere-switcher .nav-search-trigger .nst-kbd{ display:none; }
  .matiere-switcher .nav-search-trigger{ padding:7px 9px; }
}

/* tablettes : barre compacte + tiroir (comme sur téléphone) */
@media (min-width:761px) and (max-width:1120px){
  .mobile-topbar{ display:flex !important; }
  .matiere-switcher{ display:none !important; }
  .themes-nav{ top:60px !important; }
}

/* accueil sur téléphone : en-tête resserré pour voir « Tu es en… » sans défiler longtemps */
@media (max-width:760px){
  .accueil-hero{ padding:26px 18px 24px !important; }
  .accueil-logo, .accueil-hero-badge, .accueil-stats{ display:none !important; }
  .accueil-wip{ font-size:11.5px !important; margin:14px 0 0 !important; }
}
.lv-block .accueil-section-title{ margin-top:0; }

/* ---------- Accessibilité ---------- */
.skip-link{ position:absolute; left:8px; top:-60px; z-index:1000; background:#0d1a0a; color:#fff; padding:10px 16px; border-radius:10px; font-weight:800; text-decoration:none; }
.skip-link:focus{ top:8px; outline:3px solid var(--ux-mint); outline-offset:2px; }
.matiere-btn{ color:rgba(255,255,255,.68); }
.quiz-choice.correct::after{ content:"✓ Bonne réponse"; margin-left:auto; padding-left:10px; font-size:12.5px; font-weight:800; color:#15803d; white-space:nowrap; }
.quiz-choice.wrong::after{ content:"✗ Mauvaise réponse"; margin-left:auto; padding-left:10px; font-size:12.5px; font-weight:800; color:#b91c1c; white-space:nowrap; }
html[data-theme="dark"] .quiz-choice.correct::after{ color:#4ade80; } html[data-theme="dark"] .quiz-choice.wrong::after{ color:#f08c80; }

/* Contrastes (thème clair et sombre) */
.bloc-exemple .bloc-label{ color:#8a5408; }
.foot-legal a{ color:#566049; }
html[data-theme="dark"] .bloc-exemple .bloc-label{ color:#e3ad42; }
html[data-theme="dark"] .foot-legal a{ color:#b7c4a9; }
html[data-theme="dark"] .lead-cta-btn{ color:#0e130c; }
html[data-theme="dark"] .lecon-droit-term .cours-block-label, html[data-theme="dark"] .lecon-droit-term .cours-content strong,
html[data-theme="dark"] .erreur-bad .label, html[data-theme="dark"] .droit [data-color="d2"] .matiere-header h2,
html[data-theme="dark"] .droit [data-color="d2"] .soustheme-id{ color:#f08c80; }
html[data-theme="dark"] .st-card .st-acc, html[data-theme="dark"] .st-card .st-lvl{ color:#7fdc92; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* ── Contrastes et focus (audit WCAG, octobre 2026) ── */
:root{ --ux-focus:#1e5c1e; }
html[data-theme="dark"]{ --ux-focus:#86efac; }
.lv-door:focus-visible,.lv-chip:focus-visible,.rub-tab:focus-visible,.fx-btn:focus-visible,.lead-cta-btn:focus-visible,
.lv-switch button:focus-visible,.skip-link:focus{ outline-color:var(--ux-focus)!important; }
footer .foot-legal a,.foot-legal a{ color:#566049; opacity:1; }
html[data-theme="dark"] footer .foot-legal a,html[data-theme="dark"] .foot-legal a{ color:#b7c4a9; }
.search-foot,.drawer-group-label{ color:#637055!important; }
html[data-theme="dark"] .search-foot,html[data-theme="dark"] .drawer-group-label{ color:#a3b394!important; }
html[data-theme="dark"] .lead-cta-btn{ color:#0d1a0a!important; }
html[data-theme="dark"] .lv-resume .lv-go{ color:#7fdc92; }
html[data-theme="dark"] details a:not([class]),html[data-theme="dark"] .faq a:not([class]){ color:#8fd6a0; }
/* Classes de contenu restées en couleurs claires en mode sombre */
html[data-theme="dark"] .def-alpha-term{ color:#86efac!important; }
html[data-theme="dark"] .soustheme-id,html[data-theme="dark"] .timeline-when,html[data-theme="dark"] .calcul-name{ color:#b9d7a8!important; }
html[data-theme="dark"] .pts-badge,html[data-theme="dark"] .verbe-tag,html[data-theme="dark"] .auteur-courant,html[data-theme="dark"] .calcul-formule,
html[data-theme="dark"] [class*="idee-pill"]{ background:#263022!important; color:#e9efe3!important; border-color:#3a4a34!important; }
/* Quiz : réflexion à 320 px */
@media (max-width:400px){
  .quiz-choice{ flex-wrap:wrap; }
  .quiz-choice.correct::after,.quiz-choice.wrong::after{ flex-basis:100%; margin-left:39px; padding-left:0; white-space:normal; }
}
/* Cibles tactiles */
@media (max-width:760px){
  #drawer-close,#drawer-open,#mtb-search,.drawer-dark,.quiz-level-btn,.quiz-next,.fx-btn,.st-cta,.rub-tab{ min-height:44px; min-width:44px; }
  nav.st-allfiches a,a.fx-t{ display:inline-flex; align-items:center; min-height:32px; }
  details > summary{ padding-top:10px; padding-bottom:10px; }
}
/* Mouvement réduit */
@media (prefers-reduced-motion:reduce){
  html{ scroll-behavior:auto!important; }
  *,*::before,*::after{ animation-duration:.001ms!important; animation-iteration-count:1!important; transition-duration:.001ms!important; }
}
.pts-badge{ color:#0b5566!important; }
html[data-theme="dark"] .pts-badge{ color:#9fe3f2!important; }
