/* Savoira — Formations v2 (page fusionnée : parcours / compétences / langages).
   Charge après accueil-v2.css (tokens, nav, footer, boutons, chips, cartes). */

/* ---------- Hero (variante 2 colonnes : texte + stats) ---------- */
.fm-hero { padding: 96px 0 0; }
.fm-hero-inner { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: end; }
.fm-hero .h1 { margin-top: 24px; max-width: 16ch; }
.fm-sub { margin-top: 20px; color: var(--muted); max-width: 52ch; }

.fm-stats { display: flex; padding-bottom: 8px; }
.fm-stat { padding: 0 28px; }
.fm-stat + .fm-stat { border-left: 1px solid var(--line); }
.fm-stat:last-child { padding-right: 0; }
.fm-stat .v { font-size: 22px; line-height: 28px; font-weight: 600; }
.fm-stat .l { margin-top: 4px; color: var(--muted); }

/* ---------- Sélecteur de vue ---------- */
.fm-tabs-wrap { text-align: center; margin-top: 64px; }
.fm-tabs {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--white); border: 1px solid var(--line); border-radius: 12px;
}
.fm-tab {
  height: 40px; padding: 0 18px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted);
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
}
.fm-tab:hover { color: var(--ink); }
.fm-tab.on { background: var(--pine); color: var(--cream); }
.fm-tabdesc { margin-top: 16px; color: var(--muted); }

/* ---------- Barre d'outils ---------- */
.fm-toolbar { display: flex; align-items: center; gap: 20px; margin-top: 40px; }
.fm-search { position: relative; flex: 1; max-width: 420px; }
.fm-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.fm-search input {
  width: 100%; height: 44px; padding: 0 16px 0 42px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--ink);
  font-family: var(--sans); font-size: 15px;
}
.fm-search input::placeholder { color: var(--muted); }
.fm-search input:focus { outline: none; border-color: var(--pine); }
.fm-count { margin-left: auto; color: var(--muted); white-space: nowrap; }
.fm-sort select {
  height: 44px; padding: 0 36px 0 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--white); color: var(--ink);
  font-family: var(--sans); font-size: 15px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2371807A' d='M0 0h10L5 6z'/></svg>");
  background-repeat: no-repeat; background-position: right 14px center;
  cursor: pointer;
}
.fm-sort select:focus { outline: none; border-color: var(--pine); }

/* ---------- Barre de filtres ---------- */
.fm-filterbar { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.fm-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.fm-filterwrap { position: relative; margin-left: auto; }
.fm-filterbtn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 16px; border-radius: 999px;
  background: var(--white); color: var(--ink);
  border: 1px solid var(--line);
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap;
  transition: border-color .18s ease;
}
.fm-filterbtn:hover { border-color: var(--ink); }
.fm-filterbtn.active { border-color: var(--pine); color: var(--pine); }

.fm-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  width: 320px;
  background: var(--white); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 20px;
}
.fm-panel[hidden] { display: none; }
.fm-prow { margin-bottom: 18px; }
.fm-prow:last-of-type { margin-bottom: 0; }
.fm-plabel { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); margin-bottom: 8px; }
.fm-plabel .val { font-family: var(--mono); font-size: 12px; color: var(--ink); }
.fm-levels { display: flex; gap: 6px; flex-wrap: wrap; }
.fm-level {
  height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--white); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--sans); font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.fm-level.on { background: var(--pine); border-color: var(--pine); color: var(--cream); }
.fm-range { width: 100%; accent-color: var(--pine); }
.fm-panel-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
button.link-tertiary { border: 0; background: transparent; cursor: pointer; }

/* ---------- Grille ---------- */
.fm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 32px; }
.fm-section { padding-bottom: 112px; }

@media (prefers-reduced-motion: no-preference) {
  .fm-grid.entering .fcard {
    animation: fmEnter .4s ease-out both;
    animation-delay: calc(var(--i, 0) * 40ms);
  }
  @keyframes fmEnter {
    from { opacity: 0; filter: blur(8px); transform: translateY(12px); }
    to { opacity: 1; filter: blur(0); transform: none; }
  }
}

/* ---------- Cartes ---------- */
.fcard { display: flex; flex-direction: column; padding: 24px; transition: transform .18s ease, box-shadow .18s ease; }
.fcard:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.fc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip-amber { background: #FBEEDC; color: #7A4F10; }
.fcard .h3 { margin-top: 16px; }
.fc-desc { margin-top: 8px; color: var(--muted); }
/* Pas d'ellipse sur ce champ : si un texte dépasse deux lignes, on corrige le
   texte, pas le CSS (corrections v1.1 §2). */
.fc-courses {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 14px; padding: 6px 0; border: 0; background: transparent;
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); cursor: pointer;
}
.fc-courses:hover { color: var(--pine); }
.fc-courses svg { transition: transform .18s ease; }
.fc-courses[aria-expanded="true"] svg { transform: rotate(180deg); }
/* Bloc « cours inclus » : replié par défaut, dépliage animé 200 ms */
.fc-courses-wrap {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .2s ease, margin-top .2s ease;
}
.fc-courses-wrap.open { grid-template-rows: 1fr; margin-top: 8px; }
.fc-courses-wrap > .fc-courses-list { overflow: hidden; min-height: 0; }
.fc-courses-list {
  list-style: none;
  padding: 0 14px;
  background: var(--cream); border: 1px solid transparent; border-radius: 10px;
  display: flex; flex-direction: column; gap: 6px;
  transition: padding .2s ease, border-color .2s ease;
}
.fc-courses-wrap.open .fc-courses-list { padding: 12px 14px; border-color: var(--line); }
.fc-courses-list li { font-size: 13px; line-height: 18px; color: var(--muted); display: flex; gap: 8px; }
.fc-courses-list .n { font-family: var(--mono); font-size: 11px; color: var(--pine); }
.fc-objective {
  margin-top: 14px;
  font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 500;
  letter-spacing: .08em; text-transform: uppercase;
}
.fc-objective .lbl { color: var(--muted); }
.fc-objective .val { color: var(--pine); }
.fc-meta { margin-top: 12px; color: var(--muted); }
.fcard .cc-divider { margin-top: auto; }
.fc-footer { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-top: 16px; }
.fc-once { margin-top: 2px; color: var(--muted); }

/* ---------- État vide ---------- */
.fm-empty { text-align: center; padding: 72px 0; }
.fm-empty p { color: var(--muted); }
.fm-empty .btn { margin-top: 20px; }
.fm-empty[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .fm-grid { grid-template-columns: repeat(2, 1fr); }
  .fm-hero-inner { grid-template-columns: 1fr; align-items: start; }
  .fm-stats { padding-bottom: 0; }
  .fm-stat:first-child { padding-left: 0; }
}

@media (max-width: 768px) {
  .fm-hero { padding-top: 64px; }
  .fm-section { padding-bottom: 64px; }
  .fm-tabs-wrap { margin-top: 48px; }
  .fm-toolbar { flex-wrap: wrap; gap: 12px; }
  .fm-search { max-width: none; flex: 1 1 100%; }
  .fm-count { margin-left: 0; }
  .fm-sort { margin-left: auto; }
  /* chips en défilement horizontal */
  .fm-filterbar { gap: 12px; }
  .fm-chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .fm-chips::-webkit-scrollbar { display: none; }
  .fm-chips .filter-pill { flex: none; }
  /* panneau filtres plein écran */
  .fm-panel {
    position: fixed; inset: 64px 0 0 0; width: auto;
    border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    overflow-y: auto; padding: 24px;
    box-shadow: none;
  }
}

@media (max-width: 640px) {
  .fm-grid { grid-template-columns: 1fr; }
  .fm-stats { flex-wrap: wrap; }
  .fm-stat { padding: 0 16px; }
}
