/**
 * @file
 * Shared video dialog: white card with a title bar, player and footer; fades
 * in and out.
 *
 * <dialog> does not transition on its own -- showModal() shows it immediately.
 * The fade is driven by the .is-open class the JS adds a frame after opening
 * and removes before close(), so both directions animate without relying on
 * @starting-style / transition-behavior support.
 */

.rn-modal {
  width: min(960px, 94vw);
  max-width: none;
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;

  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition: opacity 200ms ease, transform 200ms ease;
}

.rn-modal.is-open {
  opacity: 1;
  transform: none;
}

.rn-modal::backdrop {
  background: rgba(15, 18, 22, 0.55);
  opacity: 0;
  transition: opacity 200ms ease;
}

.rn-modal.is-open::backdrop {
  opacity: 1;
}

/* Card ------------------------------------------------------------------ */

.rn-modal__box {
  position: relative;
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  max-height: 92vh;
  overflow-y: auto;
}

.rn-modal__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 20px 24px;
}

/*
 * Poppins is loaded at 300, 400, 500 and 600 (html.html.twig); anything
 * heavier would be synthesized into faux bold.
 */
.rn-modal__title {
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  font-family: Poppins, sans-serif;
  font-size: 18px;
  line-height: 20px;
  font-weight: 600;
  color: #1a1a1a;
  word-break: break-word;
}

.rn-modal__close {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: url(../../assets/images/modal-close.svg) center / 24px 24px no-repeat;
  cursor: pointer;
  opacity: 1;
  transition: opacity 150ms ease;
}

.rn-modal__close:hover,
.rn-modal__close:focus-visible {
  opacity: 0.6;
}

/* Player ---------------------------------------------------------------- */

.rn-modal__stage {
  position: relative;
  flex: 0 0 auto;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

.rn-modal__stage iframe,
.rn-modal__stage .plyr {
  width: 100%;
  height: 100%;
  border: 0;
}

/* Poster is dimmed slightly until playback starts. */
.rn-modal__stage .plyr__poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.1);
}

/* Footer ---------------------------------------------------------------- */

.rn-modal__footer {
  display: flex;
  justify-content: flex-end;
  padding: 20px 24px;
}

.rn-modal__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 8px 32px;
  border: 1px solid #cfcfcf;
  border-radius: 0;
  background: #fff;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  line-height: 21px;
  font-weight: 400;
  color: #585858;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease;
}

.rn-modal__button:hover,
.rn-modal__button:focus-visible {
  border-color: #585858;
  color: #1a1a1a;
}

@media (max-width: 600px) {
  .rn-modal__header,
  .rn-modal__footer {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rn-modal,
  .rn-modal::backdrop {
    transition: none;
  }
}
