/* Accueil : éventail de vraies captures, dock des jeux, vitrine de chaque jeu, promesses (en plus de style.css).
   Tout le mouvement est natif ou au chargement : la galerie défile au doigt avec l'inertie du système, sans script. */

/* En-tête du bandeau : texte, puis éventail coupé par le bas du bandeau. */
.hero-texte { position: relative; z-index: 1; }
.hero-accueil h1 { font-size: clamp(2.875rem, 13vw, 5rem); margin-bottom: 0.875rem; }

.hero-accueil .eventail { --largeur: 9.5rem; --ecart: 5.75rem; height: 12.5rem; margin-top: 1.5rem; }
.eventail img:nth-child(n + 4) { display: none; }

/* Dock : les jeux d'un coup d'œil, à cheval sur le bas du bandeau, pour sauter à celui qui plaît. */
.dock {
  position: relative;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: -2.25rem;
  padding: 0 1rem;
}
.dock a {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1 1 0;
  min-width: 2.75rem;
  max-width: 3.75rem;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform var(--duree-ressort) var(--ressort);
}
.dock img, .tuile {
  display: block;
  width: 100%;
  height: auto;
  border: 3px solid var(--line);
  border-radius: 24%;
  box-shadow: 0 4px 0 var(--line);
  transition: transform var(--duree-ressort) var(--ressort), box-shadow var(--duree-ressort) var(--ressort);
}
.dock a:active, .jeu-tete > a:active { opacity: 1; }
.dock a:active img, a:active > .tuile {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--line);
  transition-duration: var(--duree-appui);
  transition-timing-function: ease-out;
}
/* Le nom ne tient pas sous une tuile de 60 px : il reste lu par les lecteurs d'écran, et s'affiche à partir de 48 rem. */
.dock span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Liste des jeux. */
.jeux { padding: 2.25rem 1rem 0; max-width: 72rem; margin: 0 auto; }
.jeux > h2 { margin: 0 0 0.5rem; }
.jeux > p { margin: 0 0 1.5rem; color: var(--muted); max-width: 42em; }

.games { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.75rem; }

.jeu {
  scroll-margin-top: 1rem;
  overflow: clip;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--rayon-carte);
  box-shadow: 0 6px 0 var(--line);
}

.jeu-fiche { padding: 1rem 1rem 0.75rem; }
.jeu-tete { display: flex; align-items: center; gap: 0.875rem; margin-bottom: 0.625rem; }
.jeu-tete > a { flex: 0 0 4.5rem; display: block; }
.jeu h3 { margin: 0; font-size: 1.625rem; }
.jeu h3 a { display: inline-flex; align-items: center; min-height: 2.75rem; color: inherit; text-decoration: none; font-weight: 400; }

.pitch { margin: 0 0 0.875rem; }

.jeu a.button { display: block; }

.mention { display: flex; flex-wrap: wrap; align-items: center; column-gap: 0.75rem; margin: 0.75rem 0 0; color: var(--muted); font-size: 0.9375rem; line-height: 1.35; }
.mention a { display: inline-flex; align-items: center; min-height: 2.75rem; color: var(--muted); }

/* Vitrine : comme les captures d'une fiche Google Play. On voit le début de la suivante, le doigt comprend tout de suite ;
   défilement natif, donc inertie, butée souple et reprise en plein vol sans une ligne de script. */
.vitrine {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--choco) transparent;
  border-top: 3px solid var(--line);
  background:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(255, 255, 255, 0.14) 0deg 11.25deg, transparent 11.25deg 22.5deg),
    var(--jeu);
}
.vitrine:focus-visible { outline-color: var(--choco); outline-offset: -3px; }
.vitrine > * {
  flex: 0 0 10.25rem;
  width: 10.25rem;
  height: auto;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  scroll-snap-align: start;
  border: 3px solid var(--choco);
  border-radius: 1rem;
  background: var(--choco);
}

/* Extrait vidéo : gros bouton de lecture à la marque, posé par accueil.js. Toute la vidéo reste touchable. */
.extrait { position: relative; overflow: hidden; }
.extrait video { display: block; width: 100%; height: 100%; object-fit: cover; }
.lecture-extrait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.lecture-extrait:focus-visible { outline: 3px solid var(--jaune); outline-offset: -6px; border-radius: 0.75rem; }
.lecture-extrait::before {
  content: "";
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  border: 3px solid var(--choco);
  border-radius: 50%;
  background: var(--tomate) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z' fill='%23fff'/%3E%3C/svg%3E") center / 62% no-repeat;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 4px 0 var(--choco);
  transition: transform var(--duree-ressort) var(--ressort), opacity 120ms ease-out, box-shadow var(--duree-ressort) var(--ressort);
}
.lecture-extrait:active::before {
  transform: translateY(3px);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 1px 0 var(--choco);
  transition-duration: var(--duree-appui);
  transition-timing-function: ease-out;
}
.attente .lecture-extrait::before { opacity: 0.6; }
.en-lecture .lecture-extrait::before { opacity: 0; transform: scale(0.7); }

/* Promesses : trois vérités tirées des fiches Play. */
.promesses {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
  max-width: 72rem;
  margin: 2.5rem auto 0;
  padding: 0 1rem;
  list-style: none;
}
.promesses li {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 0.875rem;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--rayon-carte);
  box-shadow: 0 5px 0 var(--line);
}
.promesses svg { display: block; width: 4rem; height: 4rem; }
.promesses h2 { margin: 0 0 0.125rem; font-size: 1.3125rem; }
.promesses p { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.45; }

/* Contact. */
.contact { max-width: 72rem; margin: 2rem auto 0; padding: 0 1rem; }
.contact-cadre { scroll-margin-top: 1rem; }
.contact-cadre p { margin: 0; }
.contact-cadre a { display: inline-flex; align-items: center; min-height: 2.75rem; overflow-wrap: anywhere; }

/* Apparitions au chargement : un seul rebond, jamais en boucle, et rien n'attend la fin pour répondre. */
@media (prefers-reduced-motion: no-preference) {
  .eventail img:nth-child(4) { animation-delay: 120ms; }
  .eventail img:nth-child(5) { animation-delay: 160ms; }
  .dock a { animation: bonjour var(--duree-ressort) var(--ressort) both; animation-delay: calc(120ms + var(--rang, 0) * 40ms); }
  .dock a:nth-child(2) { --rang: 1; }
  .dock a:nth-child(3) { --rang: 2; }
  .dock a:nth-child(4) { --rang: 3; }
  .dock a:nth-child(5) { --rang: 4; }
  .dock a:nth-child(n + 6) { --rang: 5; }
  .jeu:target { animation: repere 500ms var(--ressort); }
  .attente .lecture-extrait::before { animation: attente 900ms ease-in-out infinite alternate; }
}

@keyframes bonjour { from { transform: scale(0.6); opacity: 0; } }
@keyframes repere { 40% { transform: scale(1.012); } }
@keyframes attente { to { transform: scale(0.88); } }

@media (hover: hover) and (pointer: fine) {
  .dock a:hover { transform: translateY(-4px); }
  a:hover > .tuile { transform: rotate(-4deg) scale(1.05); }
}

@media (min-width: 40rem) {
  .vitrine { overflow: visible; display: grid; grid-template-columns: repeat(4, 1fr); }
  .vitrine > * { width: 100%; }
  .promesses { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .promesses li { grid-template-columns: minmax(0, 1fr); align-items: start; align-content: start; }
  .hero-accueil .eventail { --largeur: 13rem; --ecart: 8.5rem; height: 17rem; }
  .dock { gap: 1rem; margin-top: -2.75rem; }
  .dock a { max-width: 5.5rem; }
}

@media (min-width: 48rem) {
  .dock span { position: static; width: auto; height: auto; overflow: visible; clip-path: none; white-space: normal; margin-top: 0.5rem; font-weight: 600; }
}

/* Grand écran : texte à gauche, jeux en éventail à droite ; chaque carte alterne fiche et vitrine. */
@media (min-width: 60rem) {
  .hero-accueil { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); column-gap: 2rem; align-items: center; min-height: 34rem; }
  .hero-accueil .hero-texte { padding: 1.5rem 0 3.5rem; }
  .hero-accueil .eventail { --largeur: 14rem; --ecart: 8rem; height: 100%; min-height: 30rem; margin-top: 0; }
  .hero-accueil .eventail img { top: 2.5rem; }
  .eventail img:nth-child(1), .eventail img:nth-child(3) { z-index: 2; }
  .eventail img:nth-child(2) { z-index: 3; }
  .jeu { display: grid; grid-template-columns: minmax(19rem, 2fr) 3fr; }
  .games > li:nth-child(even) .jeu { grid-template-columns: 3fr minmax(19rem, 2fr); }
  .jeu-fiche { display: flex; flex-direction: column; justify-content: center; padding: 1.5rem; }
  .jeu h3 { font-size: 2rem; }
  .jeu-tete > a { flex-basis: 5.5rem; }
  .vitrine { align-content: center; padding: 1.25rem; border-top: 0; border-left: 3px solid var(--line); }
  .games > li:nth-child(even) .vitrine { order: -1; border-left: 0; border-right: 3px solid var(--line); }
}

/* Mouvement réduit : les tuiles et le bouton de lecture ne bougent plus, ils s'éclaircissent à l'appui. */
@media (prefers-reduced-motion: reduce) {
  .dock a, .dock img, .tuile, .lecture-extrait::before { transition: opacity 120ms ease-out; }
  .dock a:hover, a:hover > .tuile { transform: none; }
  .dock a:active img, a:active > .tuile, .lecture-extrait:active::before { transform: none; opacity: 0.8; }
  .dock a:active img, a:active > .tuile { box-shadow: 0 4px 0 var(--line); }
  .lecture-extrait:active::before { box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.3), 0 4px 0 var(--choco); }
  .en-lecture .lecture-extrait::before { transform: none; }
}

/* Très grand écran : la place pour les cinq jeux, sans toucher le texte. */
@media (min-width: 80rem) {
  .hero-accueil .eventail { --largeur: 13.5rem; }
  .eventail img:nth-child(n + 4) { display: block; }
  .eventail img:nth-child(4) { --x: -13.5rem; --y: 4.25rem; --r: -15deg; z-index: 1; }
  .eventail img:nth-child(5) { --x: 13.5rem; --y: 4.25rem; --r: 15deg; z-index: 1; }
}
