/* ── Modal overlay ────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Modal panel ─────────────────────────────────────────── */
.modal-panel {
  max-width: 720px;
  width: 90vw;
  max-height: 88vh;
  overflow-y: auto;
  background: rgba(21, 23, 61, 0.98);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  position: relative;
  transform: scale(0.95);
  opacity: 0;
  transition: transform 300ms ease, opacity 300ms ease;
}

.modal-overlay.active .modal-panel {
  transform: scale(1);
  opacity: 1;
}

/* ── Close button ────────────────────────────────────────── */
#modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #E8EAF0;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: 'Outfit', sans-serif;
  font-size: 0.85rem;
  transition: background 200ms ease, color 200ms ease;
}

#modal-close:hover {
  background: #ffffff;
  color: #070b34;
}

/* ── Backdrop image ──────────────────────────────────────── */
.modal-backdrop {
  width: 100%;
  height: 220px;
  background-size: cover;
  background-position: center top;
  border-radius: 1rem 1rem 0 0;
  position: relative;
}

.modal-backdrop::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 80px;
  background: linear-gradient(to bottom, transparent, rgba(21, 23, 61, 0.98));
}

/* ── Modal body ──────────────────────────────────────────── */
.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Title ───────────────────────────────────────────────── */
.modal-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 2rem;
  color: #E8EAF0;
  margin: 0;
}

/* ── Tagline ─────────────────────────────────────────────── */
.modal-tagline {
  font-size: 0.95rem;
  color: #c5a3ff;
  font-style: italic;
  margin: 0;
}

.modal-tagline:empty {
  display: none;
}

/* ── Meta row ────────────────────────────────────────────── */
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.modal-meta-item {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

/* ── Genres ───────────────────────────────────────────────── */
.modal-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.modal-genre-pill {
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.75rem;
  padding: 0.2rem 0.6rem;
  border-radius: 2rem;
  background: transparent;
}

/* ── Overview ────────────────────────────────────────────── */
.modal-overview {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.6;
  margin: 0;
}

/* ── People ──────────────────────────────────────────────── */
.modal-people {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ── Director ────────────────────────────────────────────── */
.modal-director {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

.modal-director-label {
  color: #c5a3ff;
}

/* ── Cast ────────────────────────────────────────────────── */
.modal-cast {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.modal-cast-member {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 72px;
  text-align: center;
}

.modal-cast-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.modal-cast-name {
  font-size: 0.7rem;
  color: #E8EAF0;
  line-height: 1.2;
}

.modal-cast-character {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.5);
}

/* ── Trailer ─────────────────────────────────────────────── */
.modal-trailer {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.modal-trailer:empty {
  display: none;
}

.modal-trailer iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0.5rem;
}

/* ── Reduced motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .modal-overlay {
    transition: none;
  }
  .modal-panel {
    transition: none;
    transform: none;
  }
  #modal-close {
    transition: none;
  }
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
  .modal-title {
    font-size: 1.5rem;
  }
  .modal-backdrop {
    height: 140px;
  }
}
