/* core/cards.css

   Petits éléments réutilisés partout : étiquettes, puces, cartes, barres.

   Chargé par index.html, dans l'ordre de css/README.md. Ne pas changer cet
   ordre sans relire la section « Ordre de chargement ». */

.tag {
  display: inline-block;
  font-size: var(--fs-1);
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  border: none;
  color: var(--muted);
}

.tag.ok { color: var(--green); background: var(--green-tint); }

.tag.warn { color: var(--primary); background: var(--primary-tint); }

.tag.bad { color: var(--red); background: var(--red-tint); }

/* ---------- indicateurs chiffrés (tableau de bord) ---------- */

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 22px; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.stat-card .lbl { font-size: var(--fs-1); color: var(--muted); margin-bottom: 8px; }

.stat-card .val { font-size: var(--fs-7); font-weight: 700; }

.stat-card .val.green { color: var(--green); }

/* ---------- liste de rangées avec avatar (à corriger, mes classes...) ---------- */

.row-list { margin: 0; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-top: 1px solid var(--border);
}

.row:first-child { border-top: none; }

.row-main { flex: 1; min-width: 0; }

.row-title { font-size: var(--fs-3); font-weight: 600; margin-bottom: 2px; }

.row-sub { font-size: var(--fs-2); color: var(--muted); }

.row-cta {
  font-size: var(--fs-2);
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

:root:not([data-theme="light"]) .row-cta { color: var(--primary-strong); }

/* ---------- cartes d'exercice, vue élève ---------- */

.card-list { display: grid; gap: 14px; }

.ex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

/* ---------- grille de cartes : catalogues d'activités ---------- */

.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-4); margin-top: var(--s-5); }

.item-card {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
}

.item-card .list-title { font-size: var(--fs-3); font-weight: 600; margin: 0 0 6px; }

.item-card .list-meta { font-size: var(--fs-1); color: var(--muted); margin: 0 0 10px; }

.item-card .list-desc { font-size: var(--fs-2); color: var(--muted); line-height: 1.55; margin: 0 0 16px; flex: 1; }

.item-card .btn { align-self: flex-start; }

/* ---------- bouton d'écoute, avec sa vitesse ---------- */
/* Affiche la vitesse courante (1x, 0.8x) : un clic lit le texte et passe au
   cran suivant. Se pose au fil du texte, d'où l'alignement vertical. */

.speak-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: var(--s-2);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface-2);
  color: var(--muted);
  font: inherit;
  font-size: var(--fs-1);
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
  cursor: pointer;
  vertical-align: middle;
  white-space: nowrap;
}

.speak-btn:hover { color: var(--text); border-color: var(--border-strong); }

.speak-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

@media (max-width: 820px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }

.ex-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.ex-title { margin: 0; font-size: var(--fs-5); font-weight: 600; line-height: 1.35; }

.ex-meta { margin: 0 0 14px; font-size: var(--fs-2); color: var(--muted); }

.ex-facts {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: var(--fs-2);
  color: var(--muted);
}

.ex-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.ex-actions .btn { flex: 0 0 auto; }

@media (max-width: 640px) {
  .ex-actions .btn { width: auto; flex: 0 0 auto; }
}

/* ---------- barre de niveau ---------- */

.bar {
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin: 4px 0 14px;
}

.bar-fill { height: 100%; background: var(--primary); }

.pill {
  font-size: var(--fs-1);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  white-space: nowrap;
}

.pill-done { border-color: var(--green); color: var(--green); }

/* ---------- cartes génériques ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.card-title { font-size: var(--fs-4); font-weight: 600; margin: 0 0 4px; }

.card-meta { font-size: var(--fs-2); color: var(--muted); margin: 0 0 12px; }

.kind {
  font-size: var(--fs-1);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 2px 7px;
  white-space: nowrap;
}
