/* =====================================================================
   BLOCS MÉDIAS — v2.11.0
   ---------------------------------------------------------------------
   1. Bannière d'accueil — mode « Carrousel d'images » (.hero--carousel)
   2. Page À propos — section vidéo (.bgfi-video-section)
   Chargé uniquement sur l'accueil et la page À propos, après
   client-revisions.css. Les modes Vidéo / Image de la bannière ne sont
   pas concernés (aucune règle ne vise .hero sans .hero--carousel).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. CARROUSEL DE LA BANNIÈRE
   --------------------------------------------------------------------- */

body.is-front .hero.hero--carousel {
  --hcar-interval: 6000ms;
  --hcar-fade: 1.2s;
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: left;
  overflow: hidden;
  color: #fff;
  background: var(--navy);
  isolation: isolate;
}

/* --- Images (fondu enchaîné + léger zoom lent) --- */
.hero--carousel .hcar-track {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero--carousel .hcar-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--hcar-fade) ease, visibility 0s linear var(--hcar-fade);
  overflow: hidden;
}

.hero--carousel .hcar-slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity var(--hcar-fade) ease, visibility 0s;
  z-index: 1;
}

.hero--carousel .hcar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
  transform: scale(1.02);
  transform-origin: 60% 50%;
  will-change: transform;
}

.hero--carousel .hcar-slide.is-active .hcar-img {
  animation: hcar-kenburns calc(var(--hcar-interval) + 2000ms) linear forwards;
}

@keyframes hcar-kenburns {
  from { transform: scale(1.02); }
  to   { transform: scale(1.12); }
}

/* --- Voile de lisibilité : sombre à gauche et en bas, image libre à droite --- */
.hero--carousel .hcar-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(4, 28, 52, .72) 0%, rgba(4, 28, 52, .38) 42%, rgba(4, 28, 52, 0) 72%),
    linear-gradient(0deg, rgba(4, 28, 52, .55) 0%, rgba(4, 28, 52, 0) 45%),
    linear-gradient(180deg, rgba(4, 28, 52, .35) 0%, rgba(4, 28, 52, 0) 22%);
}

/* --- Colonne de texte --- */
.hero--carousel .hcar-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 48px clamp(56px, 11vh, 120px);
}

/* Les légendes sont empilées dans la même cellule : la hauteur du bloc
   est celle de la plus longue, rien ne « saute » au changement. */
.hero--carousel .hcar-captions {
  display: grid;
  max-width: 720px;
}

.hero--carousel .hcar-caption {
  grid-area: 1 / 1;
  align-self: end;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s;
}

.hero--carousel .hcar-caption.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity .5s ease .35s, visibility 0s;
}

.hero--carousel .hcar-caption > * {
  transform: translateY(18px);
  opacity: 0;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1), opacity .8s ease;
}

.hero--carousel .hcar-caption.is-active > * {
  transform: none;
  opacity: 1;
}

.hero--carousel .hcar-caption.is-active > :nth-child(1) { transition-delay: .35s; }
.hero--carousel .hcar-caption.is-active > :nth-child(2) { transition-delay: .5s; }
.hero--carousel .hcar-caption.is-active > :nth-child(3) { transition-delay: .65s; }

/* Sur-titre : capitales espacées précédées d'un filet. */
body.is-front .hero--carousel .hcar-eyebrow {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 0 18px;
  font-family: var(--body);
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}

body.is-front .hero--carousel .hcar-eyebrow::before {
  content: "";
  flex: 0 0 40px;
  height: 2px;
  background: var(--sage-light, #c8cbb8);
}

/* Titre : surcharge les règles .hero h1 (nowrap / taille) de client-revisions. */
body.is-front .hero.hero--carousel .hcar-title {
  margin: 0 0 18px;
  font-family: var(--display);
  font-size: clamp(2rem, 3.6vw, 3.3rem) !important;
  font-weight: 500 !important;
  line-height: 1.14 !important;
  letter-spacing: 0 !important;
  white-space: normal !important;
  color: #fff !important;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .35) !important;
}

body.is-front .hero--carousel .hcar-text {
  margin: 0;
  max-width: 560px;
  font-family: var(--body);
  font-size: clamp(1rem, 1.25vw, 1.12rem);
  line-height: 1.65;
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 10px rgba(0, 0, 0, .35);
}

/* --- Boutons (communs aux diapositives) --- */
body.is-front .hero--carousel .hcar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 32px;
}

body.is-front .hero--carousel .hcar-actions .btn {
  padding: 12px 30px !important;
}

/* --- Contrôles : flèches, points, compteur, pause --- */
.hero--carousel .hcar-controls {
  position: absolute;
  right: 48px;
  bottom: clamp(56px, 11vh, 120px);
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero--carousel .hcar-controls button {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  font: inherit;
}

.hero--carousel .hcar-arrow,
.hero--carousel .hcar-pause {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .55) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  transition: background var(--t), border-color var(--t), color var(--t);
}

.hero--carousel .hcar-pause {
  width: 34px;
  height: 34px;
  font-size: .72rem;
  border-color: rgba(255, 255, 255, .35) !important;
}

.hero--carousel .hcar-arrow:hover,
.hero--carousel .hcar-arrow:focus-visible,
.hero--carousel .hcar-pause:hover,
.hero--carousel .hcar-pause:focus-visible {
  background: #fff;
  border-color: #fff !important;
  color: var(--navy);
}

.hero--carousel .hcar-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Point = zone cliquable de 28 px, pastille visible de 12 px. */
.hero--carousel .hcar-dot {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.hero--carousel .hcar-dot span {
  position: relative;
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, .8);
  transition: transform var(--t), background var(--t);
}

.hero--carousel .hcar-dot:hover span {
  background: rgba(255, 255, 255, .4);
}

.hero--carousel .hcar-dot.is-active span {
  background: #fff;
  transform: scale(1.15);
}

/* Barre de progression fine en bas de la bannière. */
.hero--carousel .hcar-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: 3px;
  background: rgba(255, 255, 255, .18);
  pointer-events: none;
}

.hero--carousel .hcar-progress span {
  display: block;
  height: 100%;
  background: var(--sage-light, #c8cbb8);
  transform: scaleX(0);
  transform-origin: left center;
  animation: hcar-progress var(--hcar-interval) linear forwards;
}

.hero--carousel.is-paused .hcar-progress span,
.hero--carousel.is-paused .hcar-slide.is-active .hcar-img {
  animation-play-state: paused;
}

@keyframes hcar-progress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.hero--carousel .hcar-counter {
  min-width: 58px;
  font-family: var(--body);
  font-size: .8rem;
  letter-spacing: .14em;
  color: rgba(255, 255, 255, .75);
  font-variant-numeric: tabular-nums;
}

.hero--carousel .hcar-counter b {
  color: #fff;
  font-weight: 600;
}

.hero--carousel button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* --- Tablette --- */
@media (max-width: 1024px) {
  .hero--carousel .hcar-inner {
    padding: 0 32px 150px;
  }
  .hero--carousel .hcar-controls {
    left: 32px;
    right: auto;
    bottom: 56px;
  }
}

/* --- Mobile --- */
@media (max-width: 768px) {
  .hero--carousel .hcar-shade {
    background:
      linear-gradient(0deg, rgba(4, 28, 52, .85) 0%, rgba(4, 28, 52, .55) 45%, rgba(4, 28, 52, .1) 75%),
      linear-gradient(180deg, rgba(4, 28, 52, .45) 0%, rgba(4, 28, 52, 0) 25%);
  }
  .hero--carousel .hcar-inner {
    padding: 0 20px 112px;
  }
  .hero--carousel .hcar-img {
    object-position: 65% center;
  }
  body.is-front .hero--carousel .hcar-eyebrow {
    font-size: .68rem;
    letter-spacing: .24em;
    margin-bottom: 14px;
  }
  body.is-front .hero--carousel .hcar-eyebrow::before {
    flex-basis: 28px;
  }
  body.is-front .hero.hero--carousel .hcar-title {
    font-size: clamp(1.6rem, 7vw, 2.1rem) !important;
    margin-bottom: 12px;
  }
  body.is-front .hero--carousel .hcar-text {
    font-size: .95rem;
  }
  body.is-front .hero--carousel .hcar-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    margin-top: 24px;
    max-width: 380px;
  }
  body.is-front .hero--carousel .hcar-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 22px !important;
    font-size: .88rem;
  }
  .hero--carousel .hcar-controls {
    left: 20px;
    right: 20px;
    bottom: 36px;
    gap: 10px;
  }
  .hero--carousel .hcar-arrow {
    display: none;
  }
  .hero--carousel .hcar-counter {
    margin-left: auto;
  }
}

/* --- Mouvement réduit : pas de zoom ni de glissement, simple fondu --- */
@media (prefers-reduced-motion: reduce) {
  .hero--carousel .hcar-slide.is-active .hcar-img {
    animation: none;
    transform: none;
  }
  .hero--carousel .hcar-caption > * {
    transform: none;
    transition: opacity .3s ease;
  }
  .hero--carousel .hcar-progress {
    display: none;
  }
}

/* ---------------------------------------------------------------------
   2. PAGE À PROPOS — SECTION VIDÉO
   --------------------------------------------------------------------- */

.bgfi-video-section .bgfi-video-head {
  max-width: 780px;
  margin: 0 auto 44px;
  text-align: center;
}

.bgfi-video-section .bgfi-video-head h2 {
  margin: 0;
}

.bgfi-video-section .bgfi-video-head::after {
  content: "";
  display: block;
  width: 56px;
  height: 3px;
  margin: 20px auto 0;
  border-radius: 3px;
  background: var(--sage);
}

.bgfi-video-section .bgfi-video-lead {
  margin: 20px auto 0;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-2);
}

.bgfi-video {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: var(--navy);
  box-shadow: var(--shadow-lg);
}

.bgfi-video__el,
.bgfi-video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
  object-fit: contain;
}

/* Couverture cliquable : visible seulement une fois le JS chargé (sans JS,
   le lecteur natif reste utilisable ; pour YouTube/Vimeo, le lien ouvre
   la vidéo dans un nouvel onglet). */
.bgfi-video__cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--navy);
  cursor: pointer;
  color: #fff;
}

.bgfi-video[data-type="file"]:not(.is-enhanced) .bgfi-video__cover,
.bgfi-video.is-playing .bgfi-video__cover {
  display: none;
}

.bgfi-video__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}

.bgfi-video__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(4, 28, 52, .45), rgba(4, 28, 52, .1));
  transition: background var(--t);
}

.bgfi-video__play {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 88px;
  height: 88px;
  margin: -44px 0 0 -44px;
  border-radius: 50%;
  background: #fff;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  transition: transform var(--t), background var(--t), color var(--t);
}

.bgfi-video__play i {
  margin-left: 5px; /* centrage optique du triangle */
}

/* Halo pulsé discret. */
.bgfi-video__play::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .6);
  animation: bgfi-video-pulse 2.4s ease-out infinite;
}

@keyframes bgfi-video-pulse {
  0%   { transform: scale(.85); opacity: 1; }
  100% { transform: scale(1.35); opacity: 0; }
}

.bgfi-video__cover:hover .bgfi-video__poster,
.bgfi-video__cover:focus-visible .bgfi-video__poster {
  transform: scale(1.04);
}

.bgfi-video__cover:hover .bgfi-video__play,
.bgfi-video__cover:focus-visible .bgfi-video__play {
  transform: scale(1.08);
  background: var(--sage);
  color: #fff;
}

.bgfi-video__cover:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: -3px;
}

@media (max-width: 768px) {
  .bgfi-video-section .bgfi-video-head {
    margin-bottom: 32px;
  }
  .bgfi-video {
    border-radius: 12px;
  }
  .bgfi-video__play {
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bgfi-video__play::before { animation: none; opacity: 0; }
  .bgfi-video__poster { transition: none; }
}
