html.trailer-modal-open {
  overflow: hidden;
}

.trailer-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(0.75rem, 3vw, 1.5rem);
  background: rgba(4, 10, 14, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.trailer-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.trailer-modal__dialog {
  position: relative;
  width: min(100%, 24rem);
  max-height: min(92vh, 42rem);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.trailer-modal__close {
  position: absolute;
  top: -0.15rem;
  right: -0.15rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  background: rgba(8, 16, 22, 0.72);
  color: #ffffff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.trailer-modal__close:hover {
  background: rgba(12, 24, 32, 0.88);
  border-color: rgba(255, 255, 255, 0.42);
}

.trailer-modal__close:focus-visible {
  outline: 2px solid #b8ddf5;
  outline-offset: 3px;
}

.trailer-modal__frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 9 / 16;
  border-radius: 18px;
  background: #000;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.42),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.trailer-modal__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 1.25rem;
  background:
    linear-gradient(180deg, rgba(8, 18, 24, 0.42), rgba(4, 10, 14, 0.72)),
    rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.trailer-modal.is-loading .trailer-modal__loading {
  opacity: 1;
  visibility: visible;
}

.trailer-modal__loading-hint {
  margin: 0;
  font-family: Futura, "Futura PT", "Avenir Next", "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(0.82rem, 3.4vw, 0.95rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.trailer-modal__loading-bar {
  width: min(100%, 12rem);
  height: 0.42rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.trailer-modal__loading-bar-fill {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4fd6cf, #ffd56d, #ff8f78);
  transition: width 0.16s ease;
}

.trailer-modal__loading-spinner {
  width: 2.15rem;
  height: 2.15rem;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: #ff8f78;
  border-radius: 50%;
  animation: trailer-modal-spin 0.9s linear infinite;
}

@keyframes trailer-modal-spin {
  to {
    transform: rotate(360deg);
  }
}

.trailer-modal__video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.trailer-modal__caption {
  margin: 0;
  text-align: center;
  font-family: Futura, "Futura PT", "Avenir Next", "Trebuchet MS", Arial, sans-serif;
  font-size: clamp(0.92rem, 3.8vw, 1.05rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
}

@media (prefers-reduced-motion: reduce) {
  .trailer-modal__loading-spinner {
    animation: none;
  }
}

@media (min-width: 769px) {
  .trailer-modal__dialog {
    width: min(100%, 22rem);
  }
}
