/* Gravité : bibliothèque d'exercices (.ex-…) et carte des muscles (.bm-…). */

/* ───────── Couleurs de catégorie ───────── */

.ex-cat-pousser { --cat: var(--accent); --cat-soft: var(--accent-soft); }
.ex-cat-tirer { --cat: #5aa9ff; --cat-soft: rgba(90, 169, 255, 0.14); }
.ex-cat-jambes { --cat: var(--ok); --cat-soft: var(--ok-soft); }
.ex-cat-gainage { --cat: var(--warn); --cat-soft: var(--warn-soft); }
.ex-cat-cardio { --cat: #b48cff; --cat-soft: rgba(180, 140, 255, 0.15); }

.ex-pastille {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: var(--cat, var(--muted));
  background: var(--cat-soft, var(--surface-2));
}

.badge.ex-badge-cat { color: var(--cat, var(--muted)); background: var(--cat-soft, var(--surface-3)); }
.badge.ex-badge-time { background: var(--surface-2); color: var(--text); }

/* ───────── Liste : recherche et filtres ───────── */

.ex-search { margin-bottom: 12px; }
.ex-search-input {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 48px;
}
.ex-search-input::-webkit-search-cancel-button,
.ex-search-input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.ex-search-input::placeholder { color: var(--faint); }

.ex-clear {
  position: absolute;
  top: 50%;
  right: 2px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.ex-clear[hidden] { display: none; }
.search .ex-clear .icon { position: static; transform: none; color: inherit; }
.ex-clear:active { background: var(--surface-3); }

.ex-filters { display: flex; flex-direction: column; gap: 6px; }
.ex-chips .chip { min-height: 44px; padding: 0 15px; }
@media (hover: hover) {
  .ex-chips .chip:not(.active):hover { color: var(--text); border-color: var(--faint); }
}

/* ───────── Liste : résultats ───────── */

.ex-results { margin-top: 4px; }

.ex-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 12px;
}
.ex-reset {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
.ex-result-head + .ex-group { margin-top: 8px; }
.ex-result-head + .ex-flat { margin-top: 4px; }
.ex-flat { margin-top: 16px; }

.ex-group .section-title { align-items: center; }
.ex-group-count { font-weight: 650; color: var(--faint); letter-spacing: 0; font-variant-numeric: tabular-nums; }

.ex-row { min-height: 68px; }
.ex-row-name { line-height: 1.25; }
.ex-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 5px;
}
.ex-row-muscles {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 13px;
  color: var(--muted);
}
.ex-row .badge { padding: 2px 8px; font-size: 11px; }

@media (hover: hover) {
  a.ex-row:hover, a.ex-var:hover, a.ex-prog:hover { background: var(--surface-2); }
}

.ex-empty { padding-top: 48px; }
.ex-empty-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 4px; }

/* ───────── Fiche ───────── */

.ex-head { margin: 8px 0 16px; }
.ex-title { font-size: 30px; font-weight: 780; letter-spacing: -0.02em; line-height: 1.12; overflow-wrap: anywhere; }
.ex-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

.ex-map-card { padding: 18px 12px 16px; }
.ex-map-card .bm-list { margin-top: 16px; padding: 14px 4px 0; border-top: 1px solid var(--line); }

.ex-steps,
.ex-errors { list-style: none; margin: 0; padding: 4px 16px; }
.ex-steps li,
.ex-errors li { display: flex; align-items: flex-start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.ex-steps li:last-child,
.ex-errors li:last-child { border-bottom: 0; }

.ex-step-n {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}
.ex-step-t { padding-top: 2px; }

.ex-err-ic {
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.ex-var-ic,
.ex-prog-ic {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface-2);
}
.ex-var-easier .ex-var-ic { color: var(--ok); }
.ex-var-harder .ex-var-ic { color: var(--accent); }
.ex-var-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.ex-prog-ic { color: var(--accent); }

/* Records */

.ex-rec-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ex-rec-stat { min-width: 0; padding: 10px; border-radius: var(--radius-sm); background: var(--surface-2); }
.ex-rec-val {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.ex-rec-val.accent { color: var(--accent); }
.ex-rec-lab { margin-top: 2px; font-size: 12px; line-height: 1.25; color: var(--muted); }
.ex-rec-last { margin-top: 12px; font-size: 13px; color: var(--muted); }

.ex-chart { margin-top: 16px; }
.ex-chart-cap { margin-bottom: 4px; font-size: 12px; font-weight: 650; color: var(--muted); }
.ex-chart-svg {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  aspect-ratio: 320 / 132;
  margin: 0 auto;
  overflow: visible;
}
.ex-chart-svg text { fill: var(--faint); font-family: var(--font); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.ex-chart-guide { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.ex-chart-area { fill: var(--accent-soft); stroke: none; }
.ex-chart-line { fill: none; stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.ex-chart-dot { fill: var(--surface); stroke: var(--accent); stroke-width: 1.8; }
.ex-chart-best { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }

.ex-norec { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.ex-norec .icon { color: var(--warn); }

/* Bouton d'entraînement */

.ex-cta-wrap { margin-top: 28px; }
.ex-cta .icon { margin-left: -4px; }
.ex-cta-sub { margin-top: 8px; text-align: center; font-size: 13px; color: var(--muted); }

.ex-notfound { padding-top: 64px; }

/* ───────── Carte des muscles ───────── */

.bm { width: 100%; }
.bm-figs { display: flex; justify-content: center; align-items: flex-start; gap: 28px; }
.bm-fig { flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 0; width: 112px; }
.bm-sm .bm-figs { gap: 14px; }
.bm-sm .bm-fig { width: 60px; }
.bm-lg .bm-figs { gap: 36px; }
.bm-lg .bm-fig { width: 144px; }
.bm-fig figcaption { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.bm-sm .bm-fig figcaption { font-size: 10px; }

.bm-svg { display: block; width: 100%; height: auto; aspect-ratio: 88 / 216; overflow: visible; }
.bm-outline { fill: #3a414c; stroke: #3a414c; stroke-width: 2.2; stroke-linejoin: round; }
.bm-body { fill: var(--surface-2); stroke: none; }
.bm-zones [data-m] { fill: var(--surface-3); stroke: var(--surface-2); stroke-width: 0.5; }
.bm-zones [data-m].bm-s { fill: rgba(255, 107, 74, 0.38); }
.bm-zones [data-m].bm-p { fill: var(--accent); }

.bm-legend { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.bm-key { display: inline-flex; align-items: center; gap: 6px; }
.bm-swatch { display: inline-block; flex: none; width: 12px; height: 12px; border-radius: 4px; background: var(--surface-3); }
.bm-swatch-p { background: var(--accent); }
.bm-swatch-s { background: rgba(255, 107, 74, 0.38); }

.bm-list { display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.4; color: var(--muted); }
.bm-line .bm-swatch { margin-right: 8px; vertical-align: -1px; }
.bm-line strong { font-weight: 650; color: var(--text); }

@media (max-width: 359px) {
  .bm-figs { gap: 18px; }
  .bm-fig { width: 100px; }
  .ex-title { font-size: 26px; }
  .ex-rec-val { font-size: 18px; }
}
