/*
 * Accueil de courbette.be, sous le premier écran : la section des vidéos (index.html), lancées par
 * clips.js. Les couleurs et les mesures (--band, --hill, --dusk, --gold…) viennent de site.css,
 * chargé avant.
 */

/*
 * Les vidéos, sous le premier écran : la colline s'assombrit en un damier de nuit, où deux
 * téléphones, posés comme deux cases du plateau, montrent la bande-annonce (1) puis les
 * nouveautés (2), que Courbette relie d'un saut ; enfin la bannière, le lien vers Google Play.
 * L'un sous l'autre sur un téléphone, côte à côte sur un écran large ; chaque téléphone tient
 * dans la hauteur de l'écran (--phone).
 */
.landing .videos {
  position: relative;
  isolation: isolate;
  overflow: hidden; /* le halo des téléphones ne déborde pas de l'écran */
  overflow: clip;
  margin-top: -1px; /* recouvre la couture, au demi-pixel près, avec le bas du décor */
  padding: 0 16px clamp(56px, 10vh, 110px);
  background: linear-gradient(180deg, var(--hill) 0, #262f57 360px, var(--dusk) 100%);
}

.landing .videos::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: conic-gradient(rgba(253, 248, 239, 0.04) 25%, transparent 0 50%, rgba(253, 248, 239, 0.04) 0 75%, transparent 0);
  background-position: 50% 0;
  background-size: 96px 96px;
  -webkit-mask-image: linear-gradient(180deg, transparent var(--band), #000 360px);
  mask-image: linear-gradient(180deg, transparent var(--band), #000 360px);
  pointer-events: none;
}

.landing .videos h2 {
  display: flex;
  justify-content: center;
  margin: 0;
  font: 700 clamp(1.1rem, 3.4vw, 1.45rem) / 1.1 var(--font-display);
  letter-spacing: 0.01em;
}

.landing .videos h2 a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: calc(var(--band) + env(safe-area-inset-bottom));
  padding: 0 12px env(safe-area-inset-bottom);
  color: var(--cream);
  text-decoration: none;
}

.landing .videos h2 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 5px;
}

.landing .cue {
  flex: none;
  width: 1.1em;
  height: 1.1em;
  fill: none;
  stroke: var(--gold);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: cue-bounce 1.8s ease-in-out infinite;
}

@keyframes cue-bounce {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 4px;
  }
}

.landing .reel {
  --phone: clamp(200px, min(76vw, calc((100svh - 230px) * 0.5625)), 300px);
  display: grid;
  justify-items: center;
  max-width: 980px;
  margin: clamp(18px, 3.5vh, 40px) auto 0;
}

.landing .clip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: calc(var(--phone) + 96px);
  text-align: center;
}

/* Un halo d'aube derrière chaque téléphone. */
.landing .clip::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(var(--phone) * -0.12);
  left: 50%;
  width: calc(var(--phone) * 1.5);
  aspect-ratio: 1;
  translate: -50% 0;
  background: radial-gradient(closest-side, rgba(255, 210, 122, 0.22), rgba(228, 139, 124, 0.09) 55%, transparent);
  pointer-events: none;
}

/* Le téléphone, un peu penché, qui se redresse quand on s'en approche ou qu'il joue. */
.landing .phone {
  position: relative;
  width: var(--phone);
  padding: calc(var(--phone) * 0.034);
  border-radius: calc(var(--phone) * 0.15);
  background: linear-gradient(155deg, #4a5480 0%, #1a2032 38%, #0b0f1c 100%);
  box-shadow:
    inset 0 0 0 1.5px rgba(253, 248, 239, 0.16),
    0 2px 0 1px rgba(5, 8, 20, 0.6),
    0 26px 50px rgba(5, 8, 22, 0.55);
  rotate: var(--tilt, 0deg);
  transition: rotate 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), scale 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.landing .clip--1 {
  --tilt: -3deg;
  --tile-top: hsl(218 58% 45%);
  --tile-side: hsl(218 58% 31%);
}

.landing .clip--2 {
  --tilt: 3deg;
  --tile-top: hsl(238 58% 45%);
  --tile-side: hsl(238 58% 31%);
}

.landing .clip:hover .phone,
.landing .clip:focus-within .phone,
.landing .clip.is-playing .phone {
  rotate: 0deg;
  scale: 1.02;
}

.landing .phone video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 9 / 16;
  border-radius: calc(var(--phone) * 0.118);
  background: var(--night);
  object-fit: cover;
}

/* Le numéro de l'étape, une case du plateau du jeu, en relief, au coin du téléphone. */
.landing .tile {
  position: absolute;
  z-index: 2;
  top: -16px;
  left: -16px;
  display: grid;
  place-items: center;
  width: 48px;
  height: 44px;
  border-radius: 11px;
  background: var(--tile-top);
  box-shadow: 0 6px 0 var(--tile-side), 0 12px 20px rgba(5, 8, 22, 0.45);
  color: #eef3fa;
  font: 800 1.35rem / 1 var(--font-ui);
  rotate: -6deg;
  pointer-events: none;
}

/* Le bouton qui lance la vidéo : doré, en relief, sous le visage de Courbette sur l'affiche. */
.landing .clip__play {
  position: absolute;
  z-index: 2;
  top: 64%;
  left: 50%;
  display: grid;
  place-items: center;
  width: clamp(60px, calc(var(--phone) * 0.26), 78px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fff1c4 0%, var(--gold) 38%, var(--gold-deep) 100%);
  color: var(--night);
  box-shadow: 0 5px 0 var(--gold-side), 0 14px 28px rgba(10, 16, 40, 0.5);
  translate: -50% -50%;
  cursor: pointer;
  transition: scale 0.2s ease, translate 0.15s ease, box-shadow 0.15s ease;
}

.landing .clip__play[hidden] {
  display: none;
}

.landing .clip__play svg {
  width: 42%;
  height: 42%;
  margin-left: 8%;
  fill: currentColor;
}

.landing .clip__play::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  animation: play-ring 2.2s ease-out infinite;
}

@keyframes play-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 210, 122, 0.65);
  }
  70%,
  100% {
    box-shadow: 0 0 0 18px rgba(255, 210, 122, 0);
  }
}

.landing .clip__play:hover {
  scale: 1.07;
}

.landing .clip__play:active {
  translate: -50% calc(-50% + 3px);
  box-shadow: 0 2px 0 var(--gold-side), 0 8px 18px rgba(10, 16, 40, 0.45);
}

.landing .clip__play:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 4px;
}

/* La vidéo précédente vient de finir : le bouton de la suivante bondit, deux fois. */
.landing .clip.is-next .clip__play {
  animation: play-hop 0.8s cubic-bezier(0.3, 1.6, 0.5, 1) 2;
}

@keyframes play-hop {
  0%,
  100% {
    translate: -50% -50%;
  }
  40% {
    translate: -50% calc(-50% - 16px);
  }
}

.landing .clip__kind {
  margin: 24px 0 0;
  color: var(--gold);
  font: 750 0.76rem / 1.3 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landing .clip h3 {
  margin: 6px 0 0;
  font: 700 clamp(1.3rem, 4.6vw, 1.6rem) / 1.15 var(--font-display);
  text-wrap: balance;
}

.landing .clip__text {
  max-width: 30em;
  margin: 8px 0 0;
  color: rgba(253, 248, 239, 0.84);
  font-size: 0.98rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.landing .clip__text a {
  color: var(--gold);
  text-underline-offset: 3px;
  white-space: nowrap;
}

/* Le saut d'une étape à l'autre : l'arc pointillé du décor, Courbette à son sommet. */
.landing .leap {
  display: block;
  width: 128px;
  height: auto;
  margin: 20px 0 8px;
  overflow: visible;
}

.landing .leap__knight {
  animation: knight-bob 2.4s ease-in-out infinite;
}

@keyframes knight-bob {
  0%,
  100% {
    translate: 0 0;
  }
  50% {
    translate: 0 -5px;
  }
}

/* La bannière à atteindre : le but du jeu, et le lien vers Google Play. */
.landing .your-move {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.landing .banner {
  width: 76px;
  height: auto;
  overflow: visible;
}

.landing .banner__flag {
  transform-box: fill-box;
  transform-origin: 0 50%; /* le bord du drapeau, contre le mât */
  animation: flag-wave 2.6s ease-in-out infinite;
}

@keyframes flag-wave {
  0%,
  100% {
    transform: skewY(0deg);
  }
  50% {
    transform: skewY(-7deg);
  }
}

.landing .your-move__title {
  margin: 12px 0 20px;
  font: 700 clamp(2rem, 7vw, 2.8rem) / 1 var(--font-display);
  text-shadow: 0 3px 0 rgba(5, 8, 20, 0.45);
}

/* Écran large : les deux téléphones côte à côte, le saut entre eux, la bannière dessous. */
@media (min-width: 760px) {
  .landing .reel {
    --phone: clamp(210px, min(30vw, calc((100svh - 300px) * 0.5625)), 300px);
    grid-template-columns: auto auto auto;
    justify-content: center;
    align-items: start;
    column-gap: clamp(4px, 1.5vw, 20px);
  }

  .landing .clip {
    max-width: calc(var(--phone) + 48px);
  }

  .landing .leap {
    width: clamp(110px, 13vw, 170px);
    margin: calc(var(--phone) * 0.62) 0 0;
  }

  .landing .leap--to-banner {
    display: none;
  }

  .landing .your-move {
    grid-column: 1 / -1;
    margin-top: clamp(40px, 7vh, 72px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .landing .cue,
  .landing .clip__play::after,
  .landing .clip.is-next .clip__play,
  .landing .leap__knight,
  .landing .banner__flag {
    animation: none;
  }
  .landing .phone,
  .landing .clip__play {
    transition: none;
  }
}
