/* ==========================================================
   Composants : cartes, filtres, pages de détail
   (complète style.css, dont il reprend les variables)
   ========================================================== */

/* ---------- Bouton « Réserver » de l’en-tête ---------- */

.header-book {
  position: absolute;
  right: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.6rem 1.1rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.3s var(--ease);
}

.header-book:hover {
  background: var(--color-primary-dark);
  color: var(--color-on-primary);
}

@media (min-width: 64em) {
  .header-book {
    right: 2rem;
  }
}

/* ---------- Grilles de cartes ---------- */

.card-grid {
  display: grid;
  gap: 2.5rem 1.75rem;
}

.card-grid--styles,
.card-grid--events {
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
}

/* Page des cours : plus d'air entre deux rangées de cartes */
.card-grid--styles {
  row-gap: 5rem;
}

/* Sections de cartes des listes (Trouver mon cours, Événements, pages par type) : plus larges,
   cartes sur 84rem comme « Ne manquez pas » de l'accueil (home-v7.css) ; les sections suivantes
   gardent .wrap */
.wrap--cards {
  max-width: calc(84rem + 2 * clamp(1.25rem, 4vw, 2.5rem));
}

/* Grand écran : cartes et leur texte agrandis de 20 % (comme un zoom à 120 %), le texte hors
   des cartes garde sa taille. Reste 2 cartes par ligne (cours), 3 (événements). */
@media (min-width: 75em) {
  .wrap--cards .card-grid--styles,
  .wrap--cards .card-grid--events,
  .wrap--cards .event-grid {
    zoom: 1.2;
  }
}

.card-grid--simple {
  grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr));
}

/* Rangée qui défile horizontalement (accueil) */
.card-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(13.5rem, 1fr);
  gap: 1.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 1rem;
  scrollbar-width: thin;
}

.card-row > .card {
  scroll-snap-align: start;
}

@media (min-width: 64em) {
  .card-row {
    grid-auto-columns: calc((100% - 3 * 1.5rem) / 4);
  }
}

/* ---------- Carte (base) ---------- */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  background: var(--color-line);
  margin-bottom: 1.1rem;
}

.card--event .card__media {
  aspect-ratio: 1 / 1;
}

.card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1.2s var(--ease);
}

.card:hover .card__media img {
  transform: scale(1.05);
}

/* Zoom propre à une photo de cours sur les cartes ('card_zoom', data/styles.php) */
.card__media img.has-card-zoom {
  transform: scale(var(--card-zoom));
}

.card:hover .card__media img.has-card-zoom {
  transform: scale(calc(var(--card-zoom) * 1.05));
}

/* Carte de cours avec illustration (liste des cours, version 2) : cadre carré, sans fond,
   image agrandie mais jamais coupée (elle déborde un peu dans l'espace entre les cartes) */
.card--art .card__media {
  aspect-ratio: 1 / 1;
  background: transparent;
  overflow: visible;
  margin-bottom: 1.8rem;
}

.card--art .card__media img {
  object-fit: contain;
  transform: scale(1.14);
}

.card--art:hover .card__media img {
  transform: scale(1.18);
}

.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Pousse le lien ou le pied de carte en bas : toutes les cartes d’une rangée s’alignent */
.card__spacer {
  flex: 1 1 auto;
  min-height: 1rem;
}

.card__title {
  font-size: 1.65rem;
  margin: 0 0 0.35rem;
}

.card__link {
  color: var(--color-ink);
  text-decoration: none;
}

/* Toute la carte est cliquable grâce au lien du titre */
.card__link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.card__link:focus-visible {
  outline: none;
}

.card:focus-within {
  outline: 2px solid var(--color-accent);
  outline-offset: 6px;
}

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

.card__cta {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* Flèche « → » sur toutes les cartes (cours, événements v1 à 4, offres) */
.card__cta::after {
  content: "→";
  display: inline-block;
  /* plus grande, et remontée au milieu des majuscules */
  font-size: 1.4em;
  line-height: 1;
  position: relative;
  top: -0.08em;
}

@media (prefers-reduced-motion: no-preference) {
  .card__cta::after {
    transition: transform 0.35s var(--ease);
  }

  .card:hover .card__cta::after {
    transform: translateX(0.25rem);
  }
}

/* Étiquettes de niveau */

.tags {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tags li {
  font-size: 0.8rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-surface);
}

.tags .tags__alt {
  border-color: transparent;
  background: var(--color-tint);
}

.section--tint .tags .tags__alt {
  background: var(--color-bg);
}

/* Intensité : trois points */

.intensity {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.intensity__dots {
  display: inline-flex;
  gap: 3px;
}

.intensity__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1px solid var(--color-accent);
}

.intensity[data-level="1"] .intensity__dots span:nth-child(-n+1),
.intensity[data-level="2"] .intensity__dots span:nth-child(-n+2),
.intensity[data-level="3"] .intensity__dots span:nth-child(-n+3) {
  background: var(--color-accent);
}

/* ---------- Carte d’événement ---------- */

.badge {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.3rem 0.7rem;
  background: rgba(250, 248, 245, 0.94);
  color: var(--color-ink);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.badge--live {
  left: auto;
  right: 0.75rem;
  background: var(--color-primary);
  color: var(--color-on-primary);
}

/* Date des cartes d'événements : en gras (600, la graisse la plus forte de Josefin Sans
   chargée partout) pour bien ressortir */
.card__date {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: 0 0 0.45rem;
}

.card__teacher {
  margin: 0;
  color: var(--color-muted);
}

.card__place {
  margin: 0.2rem 0 0;
  font-size: 0.92rem;
  color: var(--color-ink);
}

.card__place::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: var(--color-accent);
  vertical-align: middle;
}

/* Description courte : 3 lignes, dépliable */
.card__summary {
  margin-top: 0.9rem;
  color: var(--color-muted);
  font-size: 0.97rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__summary p {
  margin: 0;
}

.card__summary.is-expanded {
  display: block;
  -webkit-line-clamp: unset;
}

.card__more {
  position: relative;
  z-index: 2;
  align-self: flex-start;
  background: none;
  border: 0;
  padding: 0.35rem 0;
  font: inherit;
  font-size: 0.85rem;
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.card__footer {
  padding-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-top: 1px solid var(--color-line);
}

.card__price {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 500;
}

/* ---------- Filtres ---------- */

.filters {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-line);
  margin-bottom: 2rem;
}

.filters__group {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.filters__group legend,
.filters__label {
  display: block;
  margin-bottom: 0.6rem;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.filters__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1.5rem 2.5rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  position: relative;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  font-size: 0.9rem;
  background: var(--color-bg);
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

.chip:hover > span {
  border-color: var(--color-primary);
}

.chip input:checked + span {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-on-primary);
}

.chip input:focus-visible + span {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.chip.is-disabled {
  cursor: default;
}

.chip.is-disabled > span {
  opacity: 0.45;
}

.chip.is-disabled:hover > span {
  border-color: var(--color-line);
}

.chip__count {
  font-size: 0.78rem;
  opacity: 0.7;
}

.select {
  appearance: none;
  min-width: 13rem;
  padding: 0.55rem 2.5rem 0.55rem 1rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='7' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236b635b' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 1rem center;
  font: inherit;
  font-size: 0.9rem;
  color: var(--color-ink);
  cursor: pointer;
}

.js .filters__submit {
  display: none;
}

.results-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  margin-bottom: 2rem;
}

.results-bar p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* Filtres choisis, chacun avec une croix pour le retirer (render_results_bar()) */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.results-bar--center .active-filters {
  justify-content: center;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.55rem 0.3rem 0.8rem;
  border: 1px solid var(--color-line);
  border-radius: 999px;
  background: var(--color-bg);
  color: var(--color-ink);
  font-size: 0.8rem;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.2s, background-color 0.2s;
}

/* Croix dessinée en SVG : traits fins, centrée exactement */
.active-filter__x {
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 1.3;
  stroke-linecap: round;
  transition: stroke 0.2s;
}

/* Au survol : bordure et croix du même bleu que le texte (a:hover) */
.active-filter:hover,
.active-filter:focus-visible {
  border-color: var(--color-accent);
}

.active-filter:hover .active-filter__x,
.active-filter:focus-visible .active-filter__x {
  stroke: var(--color-accent);
}

.active-filters__clear {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.active-filters__clear:hover {
  color: var(--color-ink);
}

.empty-state {
  max-width: var(--measure);
  padding: 3rem 0;
}

/* À partir de 650 px : bloc, texte et boutons centrés */
@media (min-width: 40.625em) {
  .empty-state {
    margin-inline: auto;
    text-align: center;
  }

  .empty-state .actions {
    justify-content: center;
  }
}

.empty-state p {
  color: var(--color-muted);
}

/* ---------- Pages de détail (cours, événement) ---------- */

.detail-hero {
  display: grid;
  background: var(--color-tint);
}

.detail-hero__media {
  position: relative;
  min-height: 45vh;
  overflow: hidden;
}

.detail-hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: breathe var(--breath) ease-in-out infinite alternate;
}

.detail-hero__text {
  padding: clamp(2.5rem, 6vw, 5rem) clamp(1.25rem, 5vw, 4.5rem);
  align-self: center;
}

.detail-hero__back {
  margin-bottom: 1.5rem;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-hero__back a {
  color: var(--color-muted);
  text-decoration: none;
}

.detail-hero__back a::before {
  content: "← ";
}

.detail-hero__back a:hover {
  color: var(--color-primary);
}

.detail-hero__type {
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

/* Étiquette cliquable (cours spéciaux) : même aspect, soulignée au survol */
.detail-hero__type a {
  color: inherit;
  text-decoration: none;
}

.detail-hero__type a:hover,
.detail-hero__type a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.detail-hero h1 {
  margin-bottom: 0.3em;
}

/* Sous-titre d'un événement ('subtitle'), sous le titre et plus petit */
.detail-hero__subtitle {
  display: block;
  margin-top: 0.35em;
  font-size: 0.55em;
  line-height: 1.25;
}

.detail-hero__teacher {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-style: italic;
  margin-bottom: 1.25rem;
}

.detail-hero .lead {
  margin-bottom: 1.5rem;
}

.detail-hero__booking {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 1.75rem;
}

.detail-hero__price {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.detail-hero__price strong {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 500;
  color: var(--color-ink);
  margin-left: 0.25rem;
}

@media (min-width: 56em) {
  .detail-hero {
    grid-template-columns: 1fr 1fr;
    min-height: min(calc(100vh - 7.5rem), 46rem);
  }

  .detail-hero__media {
    min-height: 0;
  }
}

/* Informations clés */

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 1rem 1.5rem;
  margin: 0 0 1rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--color-line);
  border-bottom: 1px solid var(--color-line);
}

.facts dt {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 0.2rem;
}

.facts dd {
  margin: 0;
}

.facts .intensity {
  margin: 0;
}

/* Corps : texte et encadré de réservation */

.detail-body {
  display: grid;
  /* Colonne bornée à l'écran : un élément large (photos…) ne pousse plus le texte hors champ */
  grid-template-columns: minmax(0, 1fr);
  gap: 3rem 5rem;
  align-items: start;
}

@media (min-width: 56em) {
  .detail-body {
    grid-template-columns: minmax(0, 1fr) 22rem;
  }

  .detail-aside {
    position: sticky;
    top: 9rem;
  }
}

.detail-aside {
  background: var(--color-tint);
  padding: 2rem;
}

.detail-aside__title {
  font-size: 1.7rem;
}

.detail-aside .button {
  width: 100%;
  text-align: center;
  margin-top: 0.5rem;
}

.detail-aside__note {
  margin: 1rem 0 0;
  font-size: 0.9rem;
  color: var(--color-muted);
}

.check-list {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.check-list li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.6rem;
  border-bottom: 1px solid var(--color-line);
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.05rem;
  width: 0.7rem;
  height: 1px;
  background: var(--color-accent);
}

.price-options {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.price-options li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-line);
}

.price-options strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 500;
  white-space: nowrap;
}

.price-options .is-expired {
  color: var(--color-muted);
}

.price-options .is-expired strong {
  text-decoration: line-through;
  font-size: 1.1rem;
}

/* ---------- Tableau comparatif ---------- */

.table-scroll {
  overflow-x: auto;
}

.compare {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
  background: var(--color-surface);
}

.compare th,
.compare td {
  text-align: left;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--color-line);
  vertical-align: middle;
}

.compare thead th {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted);
}

.compare tbody th {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 500;
}

.compare tbody th a {
  color: var(--color-ink);
  text-decoration: none;
}

.compare tbody th a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.compare .intensity {
  margin: 0;
}

/* ---------- Bandeau d’appel à l’action ---------- */

.cta-band {
  background: var(--color-primary);
  color: var(--color-on-primary);
  padding: clamp(3rem, 7vw, 4.5rem) 0;
}

.cta-band h2 {
  color: var(--color-on-primary);
}

.cta-band p {
  color: rgba(255, 255, 255, 0.82);
  max-width: 32rem;
  margin: 0;
}

.cta-band__inner {
  display: grid;
  gap: 1.5rem 3rem;
  align-items: center;
}

.cta-band .actions {
  margin-top: 0;
}

@media (min-width: 52em) {
  .cta-band__inner {
    grid-template-columns: 1fr auto;
  }
}
