/*
 * Entree dans les cours (refonte v2, maquettes `cours/Classes*`,
 * `cours/Matieres*`, `cours/Chapitres*`) : `/cours/` (choix de la classe),
 * pages de classe et pages de matiere. Jetons de `tokens.css` seulement ;
 * composants du kit dans `components.css` (`.class-grid`, `.filiere`,
 * `.class-block`, `.feature`, `.tile-icon`, `.matiere-card`). Couleur d'une
 * matiere par `data-subject` (`--subject-color`, relief `--subject-edge`).
 * Mobile d'abord, puis ordinateur a 960 px.
 */

/* --- Commun aux trois pages -------------------------------------------------- */

/* Le pied de page suit le contenu, comme dans les maquettes. */
[data-page^="cours-"] .site-frame > .course-page {
  flex-grow: 0;
  gap: 0;
  padding-block: 10px 0;
}

/* Coche et etoile a cote d'un texte, dessinees sans image (« Gratuit »,
   « On retient ta classe », legende des chapitres). */
.tick {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--success);
}

.tick::before {
  content: '';
  width: 6px;
  height: 3px;
  margin-top: -2px;
  border-bottom: 2px solid var(--on-accent);
  border-left: 2px solid var(--on-accent);
  transform: rotate(-45deg);
}

.star-mark::before {
  content: '★';
  color: var(--flame);
  font-size: 0.9375rem;
  line-height: 1;
}

.course-entry,
.course-class {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  width: 100%;
}

.entry-section,
.subject-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.subject-group { gap: var(--sp-3); }

.entry-section__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
  line-height: 1.05;
}

/* « Tu prepares un examen ? » : deux cartes-liens */
.entry-exams {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-exams > li { display: flex; }

.entry-exam {
  display: flex;
  flex: 1;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 14px;
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.entry-exam:hover .entry-exam__title { text-decoration: underline; }

.entry-exam__icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.entry-exam[data-tone="francais"] {
  --tile-icon-bg: var(--class-tle-generale);
  --tile-icon-edge: var(--class-tle-generale-edge);
}

.entry-exam[data-tone="sujets"] { --tile-icon-bg: var(--soft); }

.entry-exam__copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.entry-exam__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  line-height: 1.15;
}

.entry-exam__text {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
  line-height: 1.35;
}

/* --- /cours/ : choix de la classe -------------------------------------------- */

.entry-hero {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.entry-hero__badge {
  align-self: flex-start;
  gap: 6px;
  min-height: 28px;
  padding: 0 var(--sp-3);
  border: 0;
  font-weight: 900;
  font-size: var(--fs-tiny);
}

.entry-hero__badge .site-icon {
  width: 14px;
  height: 14px;
}

.entry-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.5rem;
  line-height: 1;
}

.entry-hero__lead {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9375rem;
  line-height: 1.25;
}

/* « On retient ta classe » */
.entry-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.8125rem;
}

/* « Dans chaque classe » : quatre encarts aux couleurs des etapes */
.entry-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.entry-features .feature {
  min-width: 0;
  --tile-icon-bg: var(--step);
  --tile-icon-edge: var(--step-edge);
}

.entry-features .tile-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.feature__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* --- Page de classe ---------------------------------------------------------- */

.class-head {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.class-head__row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.class-head__short {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 3rem;
  line-height: 0.9;
}

.class-head__short[data-class="seconde"] { color: var(--class-2de); }
.class-head__short[data-class="premiere"] { color: var(--class-1re-generale); }
.class-head__short[data-class="terminale"] { color: var(--class-tle-generale); }

.class-head__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.class-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.625rem;
  line-height: 1;
}

.class-head__meta {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-small);
  line-height: 1.35;
}

/* Pastilles pour changer de classe : la classe ouverte a sa couleur */
.class-switch {
  display: flex;
  gap: 6px;
  margin-right: calc(-1 * var(--content-gutter));
  overflow-x: auto;
  scrollbar-width: none;
}

.class-switch__pill {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  box-sizing: border-box;
  height: 38px;
  padding: 0 14px;
  border: 2px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-small);
  text-decoration: none;
}

.class-switch__pill:hover { color: var(--text); }

.class-switch__pill[aria-current="page"] {
  border: 0;
  background: var(--filiere-bg);
  box-shadow: 0 3px 0 var(--filiere-edge);
  color: var(--on-accent);
}

/* Cartes des matieres : deux colonnes sur mobile, cinq sur ordinateur */
.subject-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.subject-grid > li { display: flex; }

.subject-grid .matiere-card { flex: 1; }

/* « Reprendre la ou tu t'es arrete » : rempli par le navigateur */
.resume-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 2px solid var(--warm-border);
  border-radius: var(--r-xl);
  background: var(--warm-bg);
}

.resume-card[hidden] { display: none; }

.resume-card__title {
  margin: 0;
  color: var(--warm-strong);
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.resume-card__chapter {
  margin: 0;
  color: var(--warm-text);
  font-weight: 800;
}

/* « Garde ta progression » : visiteur seulement (`data-guest`) */
.keep-banner {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px;
  border-radius: var(--r-lg);
  background: var(--sel-bg);
}

.keep-banner[hidden] { display: none; }

.keep-banner__text {
  flex: 1;
  margin: 0;
  color: var(--sel-text);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
}

.keep-banner__cta {
  --button-edge-size: var(--relief-xl);
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 var(--sp-3);
  font-size: 0.9375rem;
}

/* --- Page de matiere --------------------------------------------------------- */

/* Mobile : le fil d'Ariane en pastilles remplace l'en-tete du site. */
@media (max-width: 959.98px) {
  [data-page="cours-matiere"] .site-top { display: none; }
  [data-page="cours-matiere"] .site-frame > .course-page { padding-top: 14px; }
}

/* Fil d'Ariane en pastilles (`.breadcrumb--chips`) : components.css. */

/* Pastilles des matieres : la matiere ouverte en violet */
.subject-chips {
  display: flex;
  gap: 6px;
  margin-right: calc(-1 * var(--content-gutter));
  overflow-x: auto;
  scrollbar-width: none;
}

.subject-chip {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  height: 36px;
  padding: 0 11px;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
  font-size: var(--fs-small);
  white-space: nowrap;
  text-decoration: none;
}

.subject-chip:hover { color: var(--text); }

.subject-chip[aria-current="page"] {
  background: var(--sel-bg);
  color: var(--sel-text);
}

/* En-tete a la couleur de la matiere : barre des chapitres termines, grand bouton or */
.subject-hero {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: 18px;
  border-radius: 30px;
  background: var(--subject-color, var(--violet));
  box-shadow: var(--relief-hi-band), 0 var(--edge-lg) 0 var(--subject-edge, var(--violet-edge));
  color: var(--on-accent);
}

.subject-hero__head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.subject-hero__icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: var(--r-md);
  background: var(--glyph-bg);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
}

.subject-hero__icon--icon::before {
  content: '';
  width: 32px;
  height: 32px;
  background: var(--on-accent);
  mask: var(--subject-icon) center / contain no-repeat;
}

.subject-hero__copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.subject-hero__kicker {
  margin: 0;
  font-weight: 900;
  font-size: var(--fs-tiny);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.subject-hero__short { text-transform: none; }

.subject-hero__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.875rem;
  line-height: 1;
}

.subject-hero__meta {
  margin: 0;
  font-weight: 800;
  font-size: var(--fs-small);
  line-height: 1.35;
}

.subject-hero__progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.subject-hero__bar {
  flex: 1;
  background: var(--count-bg);
}

.subject-hero__bar .progress__bar { background: var(--flame); }

.subject-hero__count {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.subject-hero__cta {
  --button-edge-size: var(--relief-xl);
  min-height: 60px;
  text-transform: uppercase;
}

/* Chapitres par domaine */
.chapter-groups {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.chapter-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  min-width: 0;
}

.chapter-group__title {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter-list {
  display: grid;
  gap: var(--sp-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Ligne d'un chapitre : le lien du titre couvre toute la ligne */
.chapter-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px var(--sp-3);
  border-radius: 20px;
  background: var(--surface);
}

.chapter-card[data-state="doing"] { border: 2px solid var(--flame); }

.chapter-card__badge {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--soft);
}

.chapter-card__count {
  display: none;
  color: var(--on-flame);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
}

.chapter-card[data-state="doing"] .chapter-card__badge {
  background: var(--flame);
  box-shadow: 0 var(--edge-sm) 0 var(--flame-edge);
}

.chapter-card[data-state="done"] .chapter-card__badge {
  background: var(--success);
  box-shadow: 0 var(--edge-sm) 0 var(--success-dark);
}

.chapter-card[data-state="doing"] .chapter-card__count { display: block; }

.chapter-card:not([data-state="todo"]) .chapter-card__badge .site-icon { display: none; }

.chapter-card[data-state="done"] .chapter-card__badge::before {
  content: '';
  width: 26px;
  height: 26px;
  background: var(--on-accent);
  mask: url('/icones/interface/valider.svg?v=720fe4c2e8') center / contain no-repeat;
}

.chapter-card__copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.chapter-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-body);
  line-height: 1.15;
}

.chapter-card__title a {
  color: var(--text);
  text-decoration: none;
}

.chapter-card__title a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.chapter-card__title a:hover { text-decoration: underline; }

.chapter-card__meta {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-tiny);
  line-height: 1.35;
}

/* La description reste dans la page (robots, lecteurs d'ecran), sans etre affichee. */
.chapter-card__text {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Etat : « En cours » en pastille, les autres pour les lecteurs d'ecran seulement */
.chapter-card__state {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.chapter-card[data-state="doing"] .chapter-card__state {
  position: static;
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  width: auto;
  height: 26px;
  padding: 0 11px;
  overflow: visible;
  border-radius: var(--r-pill);
  background: var(--warm-bg);
  color: var(--flame-text);
  font-weight: 900;
  font-size: 0.6875rem;
  text-transform: uppercase;
  clip-path: none;
}

.chapter-card__star {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
}

.chapter-card__star[hidden] { display: none; }

/* Legende des etats */
.chapter-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-1) var(--sp-3);
  margin: 0;
  padding: 0;
  color: var(--muted);
  font-weight: 800;
  font-size: var(--fs-tiny);
  list-style: none;
}

.chapter-legend li {
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Encart « Bac de francais » (francais de premiere) */
.aside-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--sp-2);
  padding: var(--sp-4);
  border: 2px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.aside-card__title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
}

.aside-card__icon {
  --tile-icon-bg: var(--class-tle-generale);
  --tile-icon-edge: var(--class-tle-generale-edge);
  width: 36px;
  height: 36px;
}

.aside-card__text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.aside-card__links {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Ordinateur ------------------------------------------------------------- */

@media (min-width: 960px) {
  [data-page^="cours-"] .site-frame > .course-page { padding-block: var(--sp-4) var(--space-6); }

  .course-entry,
  .course-class { gap: var(--sp-6); }

  .entry-hero {
    align-items: center;
    text-align: center;
  }

  .entry-hero__badge { align-self: center; }

  .entry-hero__title { font-size: 4rem; }

  .entry-hero__lead { font-size: 1.125rem; }

  .entry-features {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--sp-3);
  }

  .entry-features .feature__title { font-size: 1.0625rem; }

  .class-head__short { font-size: 4rem; }

  .class-head__title { font-size: 2.125rem; }

  .class-switch {
    flex-wrap: wrap;
    margin-right: 0;
    overflow: visible;
  }

  .subject-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  .resume-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .breadcrumb--chips { display: none; }

  .subject-chips {
    flex-wrap: wrap;
    margin-right: 0;
  }

  .subject-hero { padding: 26px; }

  .subject-hero__title { font-size: 2.5rem; }

  .chapter-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-6) 22px;
    align-items: start;
  }

  .chapter-groups--single { display: flex; }

  .chapter-groups--single .chapter-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--sp-2) 22px;
  }
}
