/* Tráiler promocional en la ficha del libro (ver trailer.js) */

/* ---------- Fondo en movimiento de la cabecera ---------- */
.hero-trailer {
  position: absolute;
  inset: 0;
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  pointer-events: none;
  animation: trailer-entra 1.2s ease both;
}
@keyframes trailer-entra { from { opacity: 0; } to { opacity: 1; } }
/* con tráiler, la portada difuminada se retira y el velo deja ver más la imagen arriba */
.hero.con-trailer::before { display: none; }
.hero.con-trailer::after {
  background:
    linear-gradient(90deg, rgba(6, 10, 20, .55) 0%, rgba(6, 10, 20, .25) 38%, rgba(6, 10, 20, .62) 62%, rgba(6, 10, 20, .7) 100%),
    linear-gradient(180deg, rgba(6, 10, 20, .35) 0%, rgba(6, 10, 20, .5) 55%, var(--bg) 100%);
}
.hero.con-trailer .wm-top { opacity: .18; }

/* ---------- Botón «Ver tráiler» ---------- */
.trailer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 20px;
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 14px;
  background: rgba(10, 14, 24, .55);
  backdrop-filter: blur(8px);
  color: #fff;
  font: 700 1.05rem/1 "Montserrat", sans-serif;
  letter-spacing: .02em;
  cursor: pointer;
  transition: background .2s, transform .2s;
}
.trailer-btn:hover { background: rgba(10, 14, 24, .75); transform: translateY(-2px); }
.trailer-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.trailer-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e50914;
  box-shadow: 0 0 0 0 rgba(229, 9, 20, .6);
  animation: trailer-pulso 2.2s ease-out infinite;
}
.trailer-play svg { width: 18px; height: 18px; margin-left: 2px; color: #fff; }
@keyframes trailer-pulso {
  0% { box-shadow: 0 0 0 0 rgba(229, 9, 20, .55); }
  70% { box-shadow: 0 0 0 14px rgba(229, 9, 20, 0); }
  100% { box-shadow: 0 0 0 0 rgba(229, 9, 20, 0); }
}

/* ---------- Ventana de cine ---------- */
.trailer-dialog {
  width: min(1200px, 94vw);
  max-width: none;
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
.trailer-dialog::backdrop { background: rgba(0, 0, 0, .88); backdrop-filter: blur(6px); }
.trailer-dialog[open] { animation: trailer-abre .35s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes trailer-abre { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.trailer-marco { position: relative; }
.trailer-video {
  display: block;
  width: 100%;
  max-height: 84vh;
  border-radius: 14px;
  background: #000;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.trailer-titulo {
  margin: 14px 4px 0;
  color: rgba(255, 255, 255, .85);
  font: 600 1rem/1.3 "Montserrat", sans-serif;
  text-align: center;
}
.trailer-cerrar {
  position: absolute;
  top: -18px;
  right: -18px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .4);
}
.trailer-cerrar svg { width: 20px; height: 20px; }
@media (max-width: 640px) {
  .trailer-cerrar { top: -54px; right: 0; }
  .hero.con-trailer::after {
    background: linear-gradient(180deg, rgba(6, 10, 20, .45) 0%, rgba(6, 10, 20, .62) 50%, var(--bg) 100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-trailer, .trailer-dialog[open] { animation: none; }
  .trailer-play { animation: none; }
}
