/*
 * Refonte — hero de l'accueil (slides « Acceuil »), sur le modèle « Timed Cards Opening Slider » :
 * photo plein cadre assombrie à gauche, surtitre + grand titre + bouton, cartes des slides suivantes en bas à droite
 * (la rangée déborde du bord droit), flèches rondes, barre de temps et numéro de slide.
 * Couleurs existantes uniquement (vert, blanc, texte foncé) ; polices Manrope / Inter.
 */

.aj-hero {
  --aj-hero-interval: 7000ms;
  --aj-hero-ease: cubic-bezier(0.65, 0, 0.35, 1);
  --aj-hero-carte-l: 200px;
  --aj-hero-carte-h: 160px;

  position: relative;
  height: calc(100vh - var(--aj-header-height));
  height: calc(100svh - var(--aj-header-height));
  min-height: 600px;
  max-height: 900px;
  margin-top: var(--aj-header-height);
  overflow: hidden;
  isolation: isolate;
  background: var(--texte-fort);
  font-family: var(--font-interface);
  color: var(--blanc);
}

/* L'ancre « Découvrir » ne passe pas sous le header fixe */
#presentation { scroll-margin-top: var(--aj-header-height); }

/* ---------- Fonds ---------- */

.aj-hero__fonds,
.aj-hero__fond {
  position: absolute;
  inset: 0;
}

.aj-hero__fond {
  opacity: 0;
  transition: opacity 600ms ease;
}

.aj-hero__fond.is-active { opacity: 1; }

.aj-hero__flou {
  position: absolute;
  inset: -40px;
  background: center / cover no-repeat;
  filter: blur(28px) brightness(0.7);
  opacity: 0;
}

.aj-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Affiche ou bandeau : image entière, fond flou de la même image autour */
.aj-hero__fond.is-contain .aj-hero__flou { opacity: 1; }
.aj-hero__fond.is-contain .aj-hero__img { object-fit: contain; object-position: 72% center; }

/* Zoom lent sur le fond affiché */
.aj-hero__fond.is-active:not(.is-contain) .aj-hero__img { animation: aj-hero-zoom calc(var(--aj-hero-interval) + 2s) linear both; }

@keyframes aj-hero-zoom {
  from { transform: scale(1.08); }
  to { transform: scale(1); }
}

/* Voile : sombre à gauche pour le texte, et en bas pour les commandes */
.aj-hero__voile {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.45) 40%, rgba(0, 0, 0, 0.1) 70%, rgba(0, 0, 0, 0) 100%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 45%);
  pointer-events: none;
}

/* Copie de la carte qui s'agrandit jusqu'à couvrir le cadre */
.aj-hero__ouverture {
  position: absolute;
  z-index: 1;
  background: var(--rcf-encre) center / contain no-repeat; /* image entière, comme le fond qu'elle devient */
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transition: opacity 500ms ease;
  pointer-events: none;
}

.aj-hero__ouverture.is-fin { opacity: 0; }

/* ---------- Mise en page : texte à gauche, cartes à droite, commandes en dessous ---------- */

.aj-hero__inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-rows: 1fr auto;
  column-gap: var(--space-12);
  row-gap: var(--space-8);
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-16) var(--space-8) var(--space-12);
}

/* ---------- Texte ---------- */

.aj-hero__textes {
  position: relative;
  grid-row: 1 / 3;
  align-self: center;
  min-height: 300px;
}

.aj-hero__texte {
  position: absolute;
  inset: 50% 0 auto;
  transform: translateY(-50%);
  visibility: hidden;
}

.aj-hero__texte.is-active { visibility: visible; }

.aj-hero__trait {
  display: block;
  width: 40px;
  height: 3px;
  margin-bottom: var(--space-4);
  border-radius: 2px;
  background: var(--vert-action);
}

.aj-hero__surtitre {
  margin: 0 0 var(--space-3);
  font-size: var(--texte-lg);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.aj-hero__titre {
  margin: 0 0 var(--space-8);
  font-family: var(--font-titres);
  font-size: clamp(2.5rem, 4.6vw, 4.25rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--blanc);
  overflow-wrap: break-word;
}

/* Chaque ligne de texte remonte derrière un masque, l'une après l'autre */
.aj-hero__surtitre,
.aj-hero__titre { overflow: hidden; }

.aj-hero__surtitre > span,
.aj-hero__titre > span,
.aj-hero__trait,
.aj-hero__actions {
  display: block;
  transform: translateY(110%);
  opacity: 0;
}

.aj-hero__trait { transform: scaleX(0); transform-origin: left; }

.aj-hero__texte.is-active .aj-hero__trait { animation: aj-hero-trait 600ms var(--aj-hero-ease) 150ms forwards; }
.aj-hero__texte.is-active .aj-hero__surtitre > span { animation: aj-hero-monte 800ms var(--aj-hero-ease) 250ms forwards; }
.aj-hero__texte.is-active .aj-hero__titre > span { animation: aj-hero-monte 900ms var(--aj-hero-ease) 380ms forwards; }
.aj-hero__texte.is-active .aj-hero__actions { animation: aj-hero-monte 800ms var(--aj-hero-ease) 560ms forwards; }

@keyframes aj-hero-monte { to { transform: none; opacity: 1; } }
@keyframes aj-hero-trait { to { transform: scaleX(1); opacity: 1; } }

.aj-hero__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--button-height);
  padding: 0 var(--space-6);
  border: 1.5px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  font-size: var(--texte-sm);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--blanc);
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.aj-hero__btn:hover {
  background: var(--vert-action);
  border-color: var(--vert-action);
  color: var(--blanc);
}

.aj-hero__btn:focus-visible { outline: 2px solid var(--blanc); outline-offset: 3px; }

/* ---------- Cartes des slides suivantes (la rangée déborde à droite) ---------- */

.aj-hero__cartes {
  display: flex;
  align-self: end;
  gap: var(--space-5);
  margin-right: calc(-1 * (var(--space-8) + max(0px, (100vw - var(--container-max)) / 2)));
  overflow: hidden;
  padding: var(--space-3) 0 var(--space-3) var(--space-1);
}

.aj-hero__carte {
  position: relative;
  flex: 0 0 var(--aj-hero-carte-l);
  height: var(--aj-hero-carte-h);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--texte-fort);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  color: var(--blanc);
  text-align: left;
  cursor: pointer;
  transition: transform 300ms ease, box-shadow 300ms ease;
  animation: aj-hero-carte-entre 600ms ease both;
}

.aj-hero__carte.is-courante { display: none; }

@keyframes aj-hero-carte-entre { from { opacity: 0; transform: translateY(16px); } }

.aj-hero__carte:hover { transform: translateY(-6px); box-shadow: 0 22px 48px rgba(0, 0, 0, 0.45); }

.aj-hero__carte:focus-visible { outline: 2px solid var(--blanc); outline-offset: 3px; }

/* Photo entière (personnes visibles en entier), calée en haut, sur un fond flou de la même image */
.aj-hero__carte-flou {
  position: absolute;
  inset: -20px;
  background: center / cover no-repeat;
  filter: blur(16px) brightness(0.7);
}

.aj-hero__carte img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  transition: transform 600ms ease;
}

.aj-hero__carte:hover img { transform: scale(1.06); }

.aj-hero__carte::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.15) 60%, rgba(0, 0, 0, 0) 100%);
}

.aj-hero__carte-texte {
  position: absolute;
  inset: auto var(--space-4) var(--space-5);
  z-index: 1;
  display: block;
}

.aj-hero__carte-trait {
  display: block;
  width: 16px;
  height: 2px;
  margin-bottom: var(--space-2);
  background: var(--blanc);
}

.aj-hero__carte-surtitre {
  display: -webkit-box;
  margin-bottom: var(--space-1);
  overflow: hidden;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  font-size: var(--texte-xs);
  color: rgba(255, 255, 255, 0.8);
}

.aj-hero__carte-titre {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-family: var(--font-titres);
  font-size: var(--texte-md);
  font-weight: 800;
  line-height: 1.15;
  text-transform: uppercase;
}

/* Pendant l'ouverture, les cartes ne réagissent pas au survol */
.aj-hero.is-changing .aj-hero__carte { pointer-events: none; }

/* ---------- Commandes : flèches, barre de temps, numéro ---------- */

.aj-hero__controles {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.aj-hero__fleche {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: transparent;
  color: var(--blanc);
  font-size: 18px;
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition);
}

.aj-hero__fleche:hover { background: var(--vert-action); border-color: var(--vert-action); }
.aj-hero__fleche:focus-visible { outline: 2px solid var(--blanc); outline-offset: 3px; }

.aj-hero__temps {
  flex: 1;
  height: 2px;
  margin-left: var(--space-4);
  background: rgba(255, 255, 255, 0.25);
}

.aj-hero__temps-barre {
  display: block;
  height: 100%;
  background: var(--vert-action);
  transform: scaleX(0);
  transform-origin: left;
}

.aj-hero__temps-barre.is-running { animation: aj-hero-temps var(--aj-hero-interval) linear forwards; }
.aj-hero.is-paused .aj-hero__temps-barre { animation-play-state: paused; }

@keyframes aj-hero-temps { to { transform: scaleX(1); } }

.aj-hero__numero {
  margin: 0;
  min-width: 2.2ch;
  font-family: var(--font-titres);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--blanc);
}

/* ---------- Tablette ---------- */

@media (max-width: 1199.98px) {
  .aj-hero { --aj-hero-carte-l: 170px; --aj-hero-carte-h: 140px; }
  .aj-hero__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: var(--space-8); }
}

@media (max-width: 991.98px) {
  .aj-hero { height: auto; max-height: none; min-height: 0; }
  .aj-hero__inner {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    padding: var(--space-16) var(--space-6) var(--space-10);
  }
  .aj-hero__textes { grid-row: auto; min-height: 340px; }
  .aj-hero__cartes { margin-right: calc(-1 * var(--space-6)); }
  .aj-hero__voile { background: linear-gradient(0deg, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.45) 55%, rgba(0, 0, 0, 0.35) 100%); }
}

/* ---------- Mobile ---------- */

@media (max-width: 767.98px) {
  .aj-hero { --aj-hero-carte-l: 132px; --aj-hero-carte-h: 110px; }
  .aj-hero__inner { padding: var(--space-12) var(--space-4) var(--space-8); row-gap: var(--space-6); }
  .aj-hero__textes { min-height: 300px; }
  .aj-hero__titre { font-size: 2.125rem; }
  .aj-hero__surtitre { font-size: var(--texte-base); }
  .aj-hero__cartes { gap: var(--space-3); margin-right: calc(-1 * var(--space-4)); }
  .aj-hero__carte-texte { inset: auto var(--space-3) var(--space-3); }
  .aj-hero__carte-titre { font-size: var(--texte-xs); }
  .aj-hero__fleche { width: 44px; height: 44px; }
  .aj-hero__numero { font-size: 2rem; }
  .aj-hero__fond.is-contain .aj-hero__img { object-position: center; }
}

@media (prefers-reduced-motion: reduce) {
  .aj-hero__fond,
  .aj-hero__carte,
  .aj-hero__carte img { transition: none; }
  .aj-hero__fond.is-active .aj-hero__img,
  .aj-hero__carte { animation: none; }
  .aj-hero__texte.is-active .aj-hero__trait,
  .aj-hero__texte.is-active .aj-hero__surtitre > span,
  .aj-hero__texte.is-active .aj-hero__titre > span,
  .aj-hero__texte.is-active .aj-hero__actions { animation: none; transform: none; opacity: 1; }
}
