/* ─────────────────────────────────────────────────────────────
   Sección "Mis mejores videos" + logo de marca
   Carrusel tipo coverflow. La posición de cada tarjeta la pone js/videos.js;
   curvas y duraciones siguen .claude/skills/animate/SKILL.md
   ───────────────────────────────────────────────────────────── */

/* Logo en cabecera y pie */
.brand-logo {
  height: 28px;
  width: auto;
}

.videos {
  position: relative;
  overflow: clip;
  --card-w: clamp(220px, 68vw, 360px);
  padding-block: 2.5rem clamp(5rem, 9vw, 7rem);
}

.videos__head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.videos__lead {
  margin-top: 1.25rem;
  max-width: 36rem;
  font-size: 1.125rem;
  line-height: 1.6;
}

/* ── Sin JavaScript: fila con scroll horizontal ── */
.videos__carousel {
  margin-top: 3.5rem;
}
.videos__stage {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0 1.25rem 1rem;
  list-style: none;
}
.video-card {
  flex: 0 0 var(--card-w);
  width: var(--card-w);
}
.video-card__media {
  position: relative;
  display: block;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 1.25rem;
  border: 1px solid var(--line);
  background: #0d0907;
}
.video-card__media img,
.video-card__media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.video-card__caption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.videos__controls {
  display: none;
}

/* ── Con JavaScript: coverflow ── */
.videos--js .videos__carousel {
  position: relative;
  overflow: hidden;
  max-width: 112rem;
  margin-inline: 0.75rem;
  padding-block: 2rem 1.5rem;
  border-radius: 1.5rem;
  /* sin fondo propio: se ve el color de la sección */
}
@media (min-width: 40rem) {
  .videos--js .videos__carousel {
    margin-inline: clamp(1.25rem, 4vw, 4.5rem);
    padding-block: 3.5rem 2.5rem;
    border-radius: 2rem;
  }
}
@media (min-width: 121rem) {
  .videos--js .videos__carousel {
    margin-inline: auto;
  }
}
.videos--js .videos__stage {
  position: relative;
  display: block;
  overflow: visible;
  padding: 0;
  height: calc(var(--card-w) * 16 / 9);
  touch-action: pan-y;
}
.videos--js .video-card {
  position: absolute;
  top: 0;
  left: 50%;
  margin-left: calc(var(--card-w) / -2);
  transition:
    transform 400ms var(--ease-in-out),
    opacity 400ms var(--ease-in-out);
}
.videos--js .video-card__caption {
  display: none;
}
.videos--js .video-card__media {
  cursor: pointer;
  box-shadow: 0 30px 60px -30px rgb(10 10 10 / 0.45);
}
.videos--js .video-card[data-active] .video-card__media {
  border-color: color-mix(in srgb, var(--fg) 30%, transparent);
}

/* Datos sobre la tarjeta (los crea js/videos.js) */
.videos--js .video-card__media::after {
  /* velo inferior para que el título se lea sobre cualquier fotograma */
  content: "";
  position: absolute;
  inset: 45% 0 0;
  z-index: 1;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.78));
  pointer-events: none;
}
.video-card__views,
.video-card__info,
.video-card__play {
  position: absolute;
  z-index: 2;
  color: #fff;
  pointer-events: none;
}
.video-card__views {
  top: 0.75rem;
  right: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 6px rgb(0 0 0 / 0.7);
}
.video-card__views svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}
.video-card__info {
  inset: auto 0.875rem 0.875rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  text-align: left;
}
.video-card__info strong {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
}
.video-card__chip {
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  background: rgb(255 255 255 / 0.16);
  font-size: 0.6875rem;
  font-weight: 500;
}
/* Icono de reproducir: solo si el video del centro está en pausa */
.video-card__play {
  top: 50%;
  left: 50%;
  display: none;
  width: 4rem;
  height: 4rem;
  transform: translate(-50%, -50%);
}
.video-card[data-paused] .video-card__play {
  display: block;
}
.video-card__play svg {
  width: 100%;
  height: 100%;
  fill: #fff;
  filter: drop-shadow(0 2px 10px rgb(0 0 0 / 0.6));
}

.videos--js .videos__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.videos__nav,
.videos__sound {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 9999px;
  border: 1px solid var(--line);
  color: var(--fg);
  cursor: pointer;
  transition:
    transform 160ms var(--ease-out),
    border-color 150ms ease,
    color 150ms ease;
}
.videos__nav {
  width: 44px;
}
.videos__nav svg {
  width: 18px;
  height: 18px;
}
.videos__sound {
  min-width: 10.5rem;
  padding: 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
}
.videos__nav:active,
.videos__sound:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .videos__nav:hover,
  .videos__sound:hover {
    border-color: #ff8c00;
  }
}

/* ── Título y métricas del video activo ── */
.videos__panel {
  margin-top: 2.5rem;
  text-align: center;
}
.videos:not(.videos--js) .videos__panel {
  display: none;
}
.videos__title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}
/* Cambio de video: título y fecha funden (con un desenfoque breve que tapa el cruce) */
.videos__title,
.videos__meta {
  transition:
    opacity 160ms var(--ease-out),
    filter 160ms var(--ease-out);
}
.videos__panel[data-swapping] .videos__title,
.videos__panel[data-swapping] .videos__meta {
  opacity: 0;
  filter: blur(3px);
}
.videos__metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 1rem;
  max-width: 44rem;
  margin: 1.75rem auto 0;
}
@media (min-width: 40rem) {
  .videos__metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
/* Escritorio: columnas anchas y con aire, para que una cifra de seis dígitos no toque a la siguiente */
@media (min-width: 64rem) {
  .videos__metrics {
    max-width: 66rem;
    column-gap: 3.5rem;
  }
}
.videos__metrics div {
  display: flex;
  flex-direction: column-reverse; /* la cifra arriba, la etiqueta debajo */
}
.videos__metrics dd {
  font-size: clamp(1.9rem, 3.4vw, 2.75rem);
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--fg);
}
.videos__metrics div:first-child dd {
  background-image: var(--cm-gradient-strong);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.videos__metrics dt {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.videos__meta {
  margin-top: 1.5rem;
  font-size: 0.9375rem;
}
.videos__link {
  color: var(--fg);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .videos__link:hover {
    color: var(--cm-red);
  }
}
.videos__note {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.8125rem;
}

/* Movimiento reducido: las tarjetas cambian de lugar sin desplazarse, solo funden */
@media (prefers-reduced-motion: reduce) {
  .videos--js .video-card {
    transition: opacity 200ms ease;
  }
  .videos__title,
  .videos__meta {
    transition: none;
  }
  .videos__nav,
  .videos__sound {
    transition:
      border-color 150ms ease,
      color 150ms ease;
  }
  .videos__nav:active,
  .videos__sound:active {
    transform: none;
  }
}
