/* Fiche de leçon recto verso : le contenu des deux faces (views/lesson-front.js,
 * views/lesson-back.js). Cadre, retournement, pied et thèmes : CSS/course-path-flip.css, chargée
 * juste avant. */

/* ——— Recto (views/lesson-front.js) ——— */
/* L'image prend la place que la fiche lui donne : celle laissée par un verso plus haut (pas de
   vide au recto), ou ce qui reste dans une popup à l'étroit. Conteneur : son ▷, son étiquette et
   son titre rapetissent quand elle devient un bandeau, quelle qu'en soit la raison (popup basse,
   paliers de la fiche à côté du chemin). */
.cpath-poster {
  position: relative;
  flex: 1 1 300px;
  min-height: 110px;
  container: cpath-poster / size;
  border-radius: 20px;
  overflow: hidden;
  background: #e7f3f5 center / cover no-repeat;
}
/* Étiquettes en haut de l'image, du côté opposé à la croix de la popup : « Leçon n », et
   « Mission du jour » quand il y en a une à lancer ici. */
.cpath-poster__tags {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  max-width: calc(100% - 70px);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cpath-poster__tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 2px 8px rgb(0 0 0 / 22%);
}
/* ——— Mission du jour : ce qui la distingue des autres états (11/11/2026) ———
   Le rose de la leçon à faire sur le chemin, à quatre endroits : l'étiquette sur l'image, le halo
   du ▷, l'étoile de la ligne d'état, et le bouton plein. Les autres états ont un bouton en contour
   et rien de rose. */
.cpath-poster__tag--mission {
  background: linear-gradient(135deg, #b5165a, #d6337a);
  color: #fff;
}
.cpath-poster__tag--mission svg {
  width: 12px;
  height: 12px;
}
.cpath-flip.is-mission .cpath-poster__play {
  box-shadow:
    0 8px 24px rgb(0 0 0 / 30%),
    0 0 0 8px rgb(214 51 122 / 60%);
}
.cpath-fstatus.is-mission svg {
  color: #d6337a;
}
.cpath-poster__play {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: 76px;
  height: 76px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #fff;
  color: #81479e;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow:
    0 8px 24px rgb(0 0 0 / 30%),
    0 0 0 8px rgb(255 255 255 / 30%);
  transition: transform 0.15s ease-out;
}
.cpath-poster__play:hover,
.cpath-poster__play:focus-visible {
  color: #81479e;
  transform: translate(-50%, -50%) scale(1.06);
}
.cpath-poster__play svg {
  width: 34px;
  height: 34px;
}
/* Mêmes états que le bouton (views/lesson-cta.js) : plan en cours de relecture, leçon déjà
   ouverte dans le player. */
.cpath-poster__play.is-off,
.cpath-poster__play.is-wait {
  opacity: 0.45;
  pointer-events: none;
}
.cpath-poster__over {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 48px 14px 14px;
  padding-inline-start: 16px;
  background: linear-gradient(rgb(0 0 0 / 0%), rgb(0 0 0 / 70%));
  color: #fff;
}
.cpath-poster__title {
  margin: 0 0 8px;
  padding: 0;
  font: inherit;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  text-align: start;
  overflow-wrap: anywhere;
}
/* Bouton qui retourne la fiche, en haut à droite (à gauche en RTL) ; au verso, le bouton de retour
   au recto est exactement au même point (Christophe, 11/11/2026). Tous deux sont posés sur la
   face, pas dans l'image ni dans l'en-tête : même point quelle que soit la face. Dans la popup,
   ce coin est à la croix : ils se rangent à côté d'elle, à sa hauteur. */
.cpath-flipb,
.cpath-backb {
  position: absolute;
  top: 22px;
  inset-inline-end: 22px;
  z-index: 1;
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.cpath-overlay .cpath-flipb,
.cpath-overlay .cpath-backb {
  inset-inline-end: 58px;
}
.cpath-overlay .cpath-poster__tags {
  max-width: calc(100% - 110px);
}
.cpath-flipb {
  border: none;
  background: rgb(255 255 255 / 95%);
  color: #81479e;
  box-shadow: 0 2px 8px rgb(0 0 0 / 30%);
}
.cpath-flipb svg,
.cpath-backb svg {
  width: 20px;
  height: 20px;
}
.cpath-poster__play:focus-visible,
.cpath-flipb:focus-visible,
.cpath-backb:focus-visible,
.cpath-fstatus__why:focus-visible {
  outline: 3px solid #f25aa6;
  outline-offset: 2px;
}
.cpath-poster__prog {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}
.cpath-poster__prog .cpath-viz__bar {
  flex: 1;
}
/* La ligne d'état : une seule ligne, coupée si elle est trop longue (le verso dit tout). */
.cpath-fstatus {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 22px;
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  color: #374151;
}
.cpath-fstatus svg {
  flex: none;
  width: 16px;
  height: 16px;
}
.cpath-fstatus__txt {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cpath-fstatus__side {
  flex: none;
  font-weight: 600;
  color: #6b7280;
}
.cpath-fstatus__side::before {
  content: "·";
  margin-inline-end: 6px;
}
.cpath-fstatus.is-done {
  color: #2f7a4f;
}
.cpath-fstatus__why {
  flex: none;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  color: #81479e;
  text-decoration: underline;
  cursor: pointer;
}
/* Un seul bouton, sur toute la largeur. */
.cpath-face .cpath-cta {
  margin-top: 0;
}
.cpath-face .cpath-btn {
  flex: 1 1 100%;
  box-sizing: border-box;
  min-height: 50px;
  justify-content: center;
  font-size: 16px;
}
/* Tout bouton qui ne lance pas une mission du jour : en contour (views/lesson-cta.js). */
.cpath-face .cpath-btn--quiet,
.cpath-face .cpath-btn--quiet:hover,
.cpath-face .cpath-btn--quiet:focus-visible {
  background: #fff;
  color: #81479e;
  box-shadow: inset 0 0 0 2px #81479e;
}
.cpath-face .cpath-btn--quiet:hover,
.cpath-face .cpath-btn--quiet:focus-visible {
  background: #f7f1fb;
}

/* ——— Verso (views/lesson-back.js) ——— */
/* En-tête : sa hauteur centre le rappel de la leçon sur le bouton de retour, dont il laisse la
   place (et celle de la croix dans la popup). */
.cpath-bhead {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding-inline-end: 48px;
}
.cpath-overlay .cpath-bhead {
  padding-inline-end: 84px;
}
.cpath-backb {
  border: 1px solid #e5e7eb;
  background: #f5f7fb;
  color: #81479e;
}
html[dir="rtl"] .cpath-backb svg {
  transform: scaleX(-1);
}
.cpath-bhead__img {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e7f3f5 center / cover no-repeat;
}
.cpath-bhead__txt {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: start;
}
.cpath-bhead__txt strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  color: #1f2937;
}
.cpath-bhead__txt span {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
}
/* Repères chiffrés (views/lesson-est.js). */
.cpath-figs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.cpath-fig {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 12px;
  background: #f6f4fa;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
  color: #374151;
  text-align: start;
}
.cpath-fig:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}
.cpath-fig svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: #81479e;
}
/* La journée sur cette leçon. */
.cpath-bday {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: start;
}
.cpath-bday__title {
  margin: 0;
  padding: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: #1f2937;
}
/* « ⋯ +n » : la suite d'une liste abrégée (views/lesson-today.js). */
.cpath-mission--more .cpath-mission__num {
  visibility: hidden;
}
.cpath-bday .cpath-empty {
  margin: 0;
}
.cpath-bday .cpath-planned > p:last-of-type {
  margin-bottom: 4px;
}
.cpath-bday__note {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f1f8f3;
  font-size: 13px;
  line-height: 1.3;
  color: #374151;
}
/* La fiche a une hauteur fixe, souvent plus que ce verso n'en demande : ses blocs se répartissent
   sur la hauteur (rappel en haut, menus en bas) au lieu de laisser un seul grand vide. */
.cpath-face--back {
  justify-content: space-between;
}

/* ——— Image en bandeau ——— */
@container cpath-poster (max-height: 170px) {
  .cpath-poster__play {
    top: 34%;
    width: 52px;
    height: 52px;
    box-shadow:
      0 6px 18px rgb(0 0 0 / 30%),
      0 0 0 6px rgb(255 255 255 / 30%);
  }
  .cpath-poster__play svg {
    width: 26px;
    height: 26px;
  }
  .cpath-poster__tags {
    top: 8px;
    inset-inline-start: 8px;
  }
  .cpath-poster__tag {
    padding: 3px 10px;
    font-size: 12px;
  }
  .cpath-poster__over {
    padding: 18px 10px 10px;
    padding-inline-start: 12px;
  }
  .cpath-poster__title {
    margin-bottom: 6px;
    font-size: 20px;
  }
}
