/*
 * Façade YouTube (partials/youtube_facade.html + static/js/youtube-facade.js).
 * Couleurs : tokens de static/css/tokens.css. Seuls transform et opacity sont animés.
 */
.yt-facade {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface);
  isolation: isolate;
}
.yt-facade__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms cubic-bezier(0.16, 1, 0.3, 1);
}
/* Léger voile pour que le bouton reste lisible sur toutes les miniatures */
.yt-facade::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at center, rgba(2, 6, 23, 0.35), transparent 60%);
}

.yt-facade__play {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--text-strong);
}
/* Pastille ronde : matériau translucide, l'accent apparaît au survol (opacité) */
.yt-facade__play::before,
.yt-facade__play::after {
  content: "";
  grid-area: 1 / 1;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
}
.yt-facade__play::before {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 10px 30px rgba(2, 6, 23, 0.45);
}
.yt-facade__play::after {
  background: var(--accent);
  opacity: 0;
}
.yt-facade__play svg {
  grid-area: 1 / 1;
  z-index: 1;
  width: 30px;
  height: 30px;
  margin-left: 4px; /* centre optique du triangle */
  fill: currentColor;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.yt-facade:hover .yt-facade__img { transform: scale(1.03); }
.yt-facade__play:hover::after,
.yt-facade__play:focus-visible::after { opacity: 1; }
.yt-facade__play:hover,
.yt-facade__play:focus-visible { color: var(--accent-ink); }
.yt-facade__play:hover::before,
.yt-facade__play:hover::after,
.yt-facade__play:hover svg { transform: scale(1.06); }
.yt-facade__play:active::before,
.yt-facade__play:active::after,
.yt-facade__play:active svg { transform: scale(0.97); }

.yt-facade__play:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.yt-facade__fallback {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  padding: 0.75rem 1rem;
  background: var(--glass);
  color: var(--accent-text);
  font-weight: 600;
}

/* Lecteur injecté au clic */
.yt-facade iframe {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt-facade.is-playing::after,
.yt-facade.is-playing .yt-facade__play { display: none; }

/* Survol à la souris (frontend/motion/hover.js) : la pastille ▶ est attirée vers le pointeur
   (variables --px/--py sur le bouton) et un reflet suit le pointeur sur l'image. */
.yt-facade__play::before,
.yt-facade__play::after,
.yt-facade__play svg { translate: calc(var(--px, 0) * 1px) calc(var(--py, 0) * 1px); }
.lm-sheen {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 70%;
  aspect-ratio: 1;
  margin: -35% 0 0 -35%; /* centré sur le pointeur (les marges en % suivent la largeur) */
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--sur-accent) 30%, transparent), transparent);
  mix-blend-mode: overlay;
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-transparency: reduce) { .lm-sheen { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .yt-facade__img,
  .yt-facade__play::before,
  .yt-facade__play::after,
  .yt-facade__play svg { transition: opacity 200ms ease; }
  .yt-facade:hover .yt-facade__img,
  .yt-facade__play:hover::before,
  .yt-facade__play:hover::after,
  .yt-facade__play:hover svg,
  .yt-facade__play:active::before,
  .yt-facade__play:active::after,
  .yt-facade__play:active svg { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .yt-facade__play::before {
    background: var(--surface2);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}
