/* ============================================================
   BUS PRO — « Nos trajets à la une » (accueil) + aperçu administrateur
   Cartes typographiques (aucune photo de destination n'existe : jamais d'image trompeuse). Jetons bp-tokens.css
   uniquement (clair/sombre automatiques). Grille centrée à largeur de carte CONSTANTE : 1 colonne < 560 px,
   2 dès 560 px, 3 dès 900 px, 4 dès 1200 px. Animations : transform/opacity seulement, coupées en mouvement réduit.
   ============================================================ */

.bpfr-grid {
  --bpfr-cols: 1;
  --bpfr-gap: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--bpfr-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.bpfr-item {
  flex: 0 0 calc((100% - (var(--bpfr-cols) - 1) * var(--bpfr-gap)) / var(--bpfr-cols));
  min-width: 0;
  display: flex;
}

@media (min-width: 560px) { .bpfr-grid { --bpfr-cols: 2; } }
@media (min-width: 900px) { .bpfr-grid { --bpfr-cols: 3; } }
@media (min-width: 1200px) { .bpfr-grid { --bpfr-cols: 4; } }

.bpfr-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 1.35rem 1.35rem 1.25rem;
  background: var(--bp-surface, #fff);
  color: var(--bp-text, #0b0f18);
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: var(--bp-radius-card, 16px);
  box-shadow: var(--bp-elev-1, 0 2px 8px rgba(15, 23, 42, .06));
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

/* Filet de marque en tête de carte. */
.bpfr-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--bp-brand, #8E2157), var(--bp-brand-dark, #6b0f3d));
}

.bpfr-card:hover,
.bpfr-card:focus-within {
  transform: translateY(-4px);
  box-shadow: var(--bp-elev-3, 0 18px 44px rgba(15, 23, 42, .16));
  border-color: var(--bp-accent-text, #8E2157);
}

.bpfr-route {
  display: grid;
  gap: .35rem;
  justify-items: start;
}

.bpfr-city {
  display: grid;
  gap: .1rem;
  min-width: 0;
  max-width: 100%;
}

.bpfr-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bp-text-muted, #503744);
}

.bpfr-city strong {
  font-size: clamp(1.05rem, 1.2vw + .8rem, 1.3rem);
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Au moins un nom de ville long (> 14 caractères) : toutes les cartes réservent deux lignes pour rester identiques. */
.bpfr-grid--long .bpfr-city strong { min-height: 2.4em; }

/* Connecteur : ligne pointillée + puce de bus entre le départ et l'arrivée. */
.bpfr-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  color: var(--bp-accent-text, #8E2157);
  font-size: .8rem;
}
.bpfr-link::before,
.bpfr-link::after {
  content: "";
  flex: 1 1 auto;
  border-top: 2px dotted var(--bp-border, #dee2e6);
}
.bpfr-link i {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bp-accent-soft, #f8e9f1);
}

.bpfr-line {
  margin: .9rem 0 .75rem;
  font-size: .88rem;
  color: var(--bp-text-muted, #503744);
}

/* Trois lignes de faits réservées : toutes les cartes gardent la même hauteur, avec ou sans prix/horaire. */
.bpfr-facts {
  display: grid;
  align-content: start;
  gap: .45rem;
  min-height: 5.6rem;
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
  font-size: .86rem;
}
.bpfr-facts li {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  line-height: 1.35;
  color: var(--bp-text, #0b0f18);
}
.bpfr-facts i {
  flex: 0 0 1rem;
  margin-top: .15rem;
  text-align: center;
  color: var(--bp-accent-text, #8E2157);
}
.bpfr-facts li:nth-child(2) span { font-weight: 600; }
.bpfr-facts .bpfr-none { color: var(--bp-text-muted, #503744); }

.bpfr-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 46px;
  padding: .6rem 1.1rem;
  border: 2px solid var(--bp-brand, #8E2157);
  border-radius: var(--bp-radius-pill, 50rem);
  background: var(--bp-brand, #8E2157);
  color: #fff;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.bpfr-cta i { transition: transform .2s ease; }
.bpfr-cta:hover { background: var(--bp-brand-dark, #6b0f3d); border-color: var(--bp-brand-dark, #6b0f3d); color: #fff; }
.bpfr-cta:hover i { transform: translateX(3px); }
.bpfr-cta:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 3px; }
.bpfr-cta[aria-disabled="true"] { cursor: default; }

/* Trajet sans départ réservable : même gabarit, bouton secondaire (jamais de fausse disponibilité). */
.bpfr-card.is-unscheduled .bpfr-cta {
  background: transparent;
  color: var(--bp-accent-text, #8E2157);
}
.bpfr-card.is-unscheduled .bpfr-cta:hover { background: var(--bp-brand, #8E2157); color: #fff; }

:root[data-theme="dark"] .bpfr-card.is-unscheduled .bpfr-cta { border-color: var(--bp-accent-text, #ee9cc3); }
:root[data-theme="dark"] .bpfr-card.is-unscheduled .bpfr-cta:hover { border-color: var(--bp-brand, #8E2157); }

@media (prefers-reduced-motion: reduce) {
  .bpfr-card, .bpfr-cta, .bpfr-cta i { transition: none; }
  .bpfr-card:hover, .bpfr-card:focus-within, .bpfr-cta:hover i { transform: none; }
}

/* Aperçu dans l'administration : largeur de carte fixe, jamais cliquable. */
.bpfr-preview-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 280px)); }
.bpfr-preview-grid .bpfr-card:hover { transform: none; }

/* ---------- Carrousel des prochains départs (js/bp-featured-carousel.js) ----------
   Cartes à largeur CONSTANTE (même design que les cartes de trajet), défilement horizontal natif (balayage, molette, clavier) + défilement automatique
   de droite à gauche géré par le script (lent, pausable, jamais en mouvement réduit). Sans JavaScript : la piste reste un défilement horizontal normal.
   Écran étroit : une carte entière + un aperçu de la suivante ; flèches dès 768 px. Si toutes les cartes tiennent, elles sont centrées (classe .is-static). */
.bpfr-carousel { position: relative; --bpfr-card-w: 420px; }
@media (max-width: 575.98px) { .bpfr-carousel { --bpfr-card-w: min(calc(100vw - 3.5rem), 420px); } }

.bpfr-viewport {
  overflow-x: auto;
  overflow-y: hidden;
  padding: .9rem .25rem 1.4rem;            /* place pour l'élévation et l'ombre des cartes */
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
.bpfr-viewport::-webkit-scrollbar { display: none; }
.bpfr-viewport:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 2px; border-radius: 12px; }
.bpfr-carousel.is-auto .bpfr-viewport { scroll-snap-type: none; }   /* le défilement automatique ne doit pas être « aimanté » */

.bpfr-carousel .bpfr-grid { flex-wrap: nowrap; justify-content: flex-start; width: max-content; min-width: 100%; }
.bpfr-carousel.is-static .bpfr-grid { justify-content: center; width: auto; }
.bpfr-carousel .bpfr-item { flex: 0 0 var(--bpfr-card-w); scroll-snap-align: start; }

@media (min-width: 768px) {
  .bpfr-carousel:not(.is-static) .bpfr-viewport {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%);
  }
}

.bpfr-arrow {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: 50%;
  background: var(--bp-surface, #fff);
  color: var(--bp-accent-text, #8E2157);
  box-shadow: var(--bp-elev-2, 0 6px 18px rgba(15, 23, 42, .12));
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, opacity .2s ease;
}
.bpfr-arrow[hidden] { display: none; }
.bpfr-arrow.is-prev { left: -.75rem; }
.bpfr-arrow.is-next { right: -.75rem; }
.bpfr-arrow:hover { background: var(--bp-accent-soft, #f8e9f1); border-color: var(--bp-accent-text, #8E2157); }
.bpfr-arrow:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 3px; }
.bpfr-arrow:disabled { opacity: .4; cursor: default; }
@media (max-width: 767.98px) { .bpfr-arrow { display: none !important; } }   /* le balayage tactile suffit sur téléphone */


/* Carte de DÉPART — présentation horizontale compacte (environ 130 px de haut au lieu de 330 px) :
   en-tête (compagnie à gauche, date et heure à droite), itinéraire sur une seule ligne « départ — bus — arrivée »,
   pied (classes avec prix à gauche, bouton « Voir les départs » à droite). Les libellés « Départ / Arrivée » restent
   pour les lecteurs d'écran. Les noms de ville longs passent sur deux lignes au plus, sans jamais déformer la carte. */
.bpfr-card.is-departure { padding: .7rem .9rem .75rem; gap: .5rem; }
.bpfr-card.is-departure::before { height: 3px; }
.bpfr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .75rem; min-width: 0; }
.bpfr-company {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-size: .88rem;
  font-weight: 700;
  color: var(--bp-accent-text, #8E2157);
}
.bpfr-company i { flex: 0 0 auto; }
.bpfr-company span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bpfr-logo { flex: 0 0 auto; width: 26px; height: 26px; object-fit: contain; border-radius: 6px; background: #fff; border: 1px solid var(--bp-border, #dee2e6); }
.bpfr-when { display: flex; flex-wrap: wrap; gap: .1rem .75rem; margin: 0; padding: 0; list-style: none; font-size: .8rem; color: var(--bp-text-muted, #503744); }
.bpfr-when li { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
.bpfr-when li:nth-child(2) { font-weight: 700; color: var(--bp-text, #0b0f18); }
.bpfr-when i { color: var(--bp-accent-text, #8E2157); }

.bpfr-card.is-departure .bpfr-route { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: .6rem; justify-items: stretch; margin: 0; }
.bpfr-card.is-departure .bpfr-label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.bpfr-card.is-departure .bpfr-city strong { font-size: clamp(.9rem, .3vw + .8rem, 1rem); line-height: 1.2; letter-spacing: 0; }
.bpfr-card.is-departure .bpfr-city.is-to { text-align: right; }
.bpfr-card.is-departure .bpfr-link { width: auto; min-width: 3.2rem; }
.bpfr-card.is-departure .bpfr-link::before,
.bpfr-card.is-departure .bpfr-link::after { flex: 0 0 .6rem; }
.bpfr-card.is-departure .bpfr-link i { width: 26px; height: 26px; font-size: .72rem; }

.bpfr-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .75rem; margin-top: auto; }
.bpfr-card.is-departure .bpfr-facts { display: flex; flex-wrap: wrap; gap: .35rem; min-height: 0; margin: 0; flex: 1 1 11rem; min-width: 0; }
.bpfr-card.is-departure .bpfr-facts li { align-items: center; gap: .35rem; padding: .2rem .6rem; max-width: 100%; overflow-wrap: anywhere; border-radius: 999px; background: var(--bp-accent-soft, #f8e9f1); font-size: .8rem; font-weight: 600; line-height: 1.3; }
.bpfr-card.is-departure .bpfr-facts i { flex: 0 0 auto; margin: 0; font-size: .7rem; }
.bpfr-card.is-departure .bpfr-cta { margin-top: 0; flex: 0 0 auto; min-height: 40px; padding: .35rem .85rem; font-size: .84rem; gap: .4rem; }

/* Mobile : le bouton passe sous les classes et occupe la largeur de la carte. */
@media (max-width: 420px) {
  .bpfr-card.is-departure .bpfr-cta { flex: 1 1 100%; }
}


.bpfr-empty {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--bp-surface, #fff);
  border: 1px dashed var(--bp-border, #dee2e6);
  border-radius: var(--bp-radius-card, 16px);
  color: var(--bp-text, #0b0f18);
}
.bpfr-empty > i { font-size: 2rem; color: var(--bp-accent-text, #8E2157); margin-bottom: .6rem; }
.bpfr-empty h3 { margin: 0 0 .4rem; font-size: 1.15rem; font-weight: 700; }
.bpfr-empty p { margin: 0 0 1.1rem; color: var(--bp-text-muted, #503744); }
.bpfr-cta--inline { display: inline-flex; margin-top: 0; padding-left: 1.5rem; padding-right: 1.5rem; }
.bpfr-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin: 1.25rem 0 0; padding: 0; list-style: none; }
.bpfr-chips a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: .35rem .9rem;
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: 999px;
  color: var(--bp-accent-text, #8E2157);
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
}
.bpfr-chips a:hover { background: var(--bp-accent-soft, #f8e9f1); border-color: var(--bp-accent-text, #8E2157); }
.bpfr-chips a:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 2px; }

.bpfr-controls { display: flex; justify-content: center; margin: .25rem 0 0; }
.bpfr-controls:has(.bpfr-toggle[hidden]) { display: none; }
.bpfr-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--bp-border, #dee2e6);
  border-radius: 50%;
  background: var(--bp-surface, #fff);
  color: var(--bp-accent-text, #8E2157);
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease;
}
.bpfr-toggle[hidden] { display: none; }
.bpfr-toggle:hover { background: var(--bp-accent-soft, #f8e9f1); border-color: var(--bp-accent-text, #8E2157); }
.bpfr-toggle:focus-visible { outline: 3px solid var(--bp-focus, #1a73e8); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  .bpfr-viewport { scroll-behavior: auto; }
  .bpfr-arrow, .bpfr-toggle { transition: none; }
}
