.mediaModal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: none;
  z-index: 9999;
}

.mediaModal.is-open{ display: grid; place-items: center; }

.mediaModal__dialog{
  width: min(980px, 92vw);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  position: relative;
}


.mediaModal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 35, .55);
}

.mediaModal__panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(920px, calc(100% - 28px));
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(14, 28, 55, .25);
}

.mediaModal__close{
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 5;           /* IMPORTANT */
  border: 0;
  background: rgba(255,255,255,.9);
  width: 42px;
  height: 42px;
  border-radius: 999px;
  cursor: pointer;
}
.mediaModal__content{
  background: #0f2b45;
  display: grid;
  place-items: center;
  max-height: 62vh;
}

.mediaModal__content img{
  width: 100%;
  height: auto;
  display: block;
}

.mediaModal__content video{
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #0f2b45;
}

.mediaModal__caption{
  padding: 16px 18px 18px;
}

.mediaModal__title{
  margin: 0;
  font-weight: 900;
  color: #0b1a33;
}

.mediaModal__meta{
  margin: 6px 0 0;
  color: #6a7e9f;
  font-weight: 700;
  font-size: .9rem;
}

/* open animation */
.mediaModal.is-open .mediaModal__panel{
  animation: modalIn .28s cubic-bezier(.16, 1, .3, 1);
}

@keyframes modalIn{
  from{ transform: translate(-50%, -50%) scale(.98); opacity: 0; }
  to  { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce){
  .mediaModal.is-open .mediaModal__panel{ animation: none; }
}
