/* ============================================================
   TALENTUM — talent-gallery.css (Step 4.4)
   Section Galerie — double carrousel CSS animation, 9/16 items.
   ============================================================ */

/* ============================
   Token vitesse carrousel
   ============================ */

:root {
  --gallery-speed: 45px;  /* pixels/seconde — ajustable sans toucher au JS */
}

/* ============================
   Layout section
   ============================ */

#talent-gallery {
  padding-top: var(--space-md); /* Step 7.11 (retouche) — compactage drastique */
  padding-bottom: var(--space-md);
  overflow: hidden; /* clipping des bandes débordantes */
}

.talent-gallery__inner {
  max-width: 100%;
}

/* ============================
   Header centré (aligné sur les autres sections)
   ============================ */

.talent-gallery__header {
  max-width: 1400px; /* Step 7.11 (retouche) — même largeur que le bloc images */
  margin: 0 auto var(--space-lg);
  padding: 0 clamp(1rem, 4vw, 4rem);
  text-align: center; /* Step 7.11 (retouche) — titre recentré au-dessus des cards */
}

/* ============================
   Eyebrow
   ============================ */

.talent-gallery__eyebrow {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: calc(var(--text-eyebrow) * 1.2);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--color-accent-gold);
  margin: 0;
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease-cinematic), transform 0.9s var(--ease-cinematic);
  transition-delay: 0.2s;
}

.talent-gallery__inner.is-revealed .talent-gallery__eyebrow {
  opacity: 1;
  transform: translateY(0);
}

/* ============================
   Rangs
   ============================ */

.talent-gallery__rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-md); /* Step 7.11 — rangs rapprochés (2xl → md) */
  /* Step 7.11 — marges gauche/droite : la galerie ne touche plus les bords */
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 4rem);
}

.talent-gallery__row {
  opacity: 0;
  transition: opacity 0.6s var(--ease-cinematic);
  overflow: hidden; /* Step 7.11 — chaque rang clippe sa bande dans la zone à marges */
}

.talent-gallery__inner.is-revealed .talent-gallery__row:nth-child(1) {
  opacity: 1;
  transition-delay: 0.4s;
}

.talent-gallery__inner.is-revealed .talent-gallery__row:nth-child(2) {
  opacity: 1;
  transition-delay: 0.6s;
}

/* ============================
   Bande défilante
   ============================ */

.talent-gallery__band {
  display: flex;
  gap: var(--space-sm);
  width: max-content;
  will-change: transform;
}

/* Rang gauche : animation définie dynamiquement via JS (durée = distance / vitesse) */
.talent-gallery__band--left {
  animation: gallery-scroll-left var(--gallery-duration-left, 8s) linear infinite;
}

.talent-gallery__band--right {
  animation: gallery-scroll-right var(--gallery-duration-right, 8s) linear infinite;
}

/* Pause hover — uniquement desktop (pointer fine) */
@media (hover: hover) and (pointer: fine) {
  .talent-gallery__row:hover .talent-gallery__band {
    animation-play-state: paused;
  }
}

/* ============================
   Keyframes
   ============================ */

@keyframes gallery-scroll-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); } /* 50% car les items sont dupliqués */
}

@keyframes gallery-scroll-right {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

/* ============================
   Item
   ============================ */

.talent-gallery__item {
  flex-shrink: 0;
  width: clamp(120px, 14vw, 190px); /* Step 7.11 — cards plus petites */
  aspect-ratio: 9 / 16;
  overflow: hidden;
  position: relative;
}

/* Type placeholder */
.talent-gallery__item--placeholder {
  background: var(--color-bg-secondary);
  border: 1px solid rgba(201, 169, 97, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.talent-gallery__item-label {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--text-small);
  color: var(--color-text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

/* Type image (futur) */
.talent-gallery__item--image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Type affiche (Step 8.4) — letterbox : l'affiche entière visible dans le cadre 9/16 */
.talent-gallery__item--poster {
  background: var(--color-bg-secondary);
}

.talent-gallery__item--poster img {
  object-fit: contain;
}

/* Type video (futur) */
.talent-gallery__item--video video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ============================
   Touch mobile — pas d'interaction
   ============================ */

@media (hover: none) {
  .talent-gallery__band {
    pointer-events: none;
  }
}

/* ============================
   Responsive mobile
   ============================ */

@media (max-width: 767px) {
  :root {
    --gallery-speed: 35px; /* légèrement plus lent sur mobile */
  }

  .talent-gallery__item {
    width: clamp(140px, 40vw, 200px);
  }
}

/* ============================
   Reduced motion — grille statique
   ============================ */

@media (prefers-reduced-motion: reduce) {
  #talent-gallery {
    overflow: visible;
  }

  .talent-gallery__band {
    animation: none;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
    width: 100%;
    padding: 0 clamp(1rem, 4vw, 4rem);
  }

  /* Masquer les doublons — seuls les 6 premiers items affichés */
  .talent-gallery__band > .talent-gallery__item:nth-child(n+7) {
    display: none;
  }

  .talent-gallery__eyebrow,
  .talent-gallery__row {
    transition: opacity 0.3s ease;
    transform: none;
  }
}
