:root {
  --modal-bg: #0b0d11;
  --modal-surface: #11141a;
  --modal-line: #292e37;
  --modal-muted: #9299a5;
  --modal-blue: #173d72;
}

.media-modal {
  width: min(1240px, calc(100vw - 36px));
  height: min(900px, calc(100dvh - 36px));
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--modal-line);
  border-radius: 14px;
  color: #fff;
  background: var(--modal-bg);
  box-shadow: 0 32px 100px rgba(0, 0, 0, .56);
}

.media-modal[open] {
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr) 74px;
}

.media-modal::backdrop {
  background: rgba(5, 7, 10, .88);
  backdrop-filter: blur(8px);
}

.modal-toolbar {
  min-width: 0;
  padding: 0 22px 0 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--modal-line);
  background: var(--modal-surface);
}

.modal-status {
  min-width: 0;
  display: flex;
  gap: 12px;
  align-items: center;
  color: var(--modal-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.modal-status span + span {
  padding-left: 12px;
  border-left: 1px solid #3a404a;
  color: #fff;
}

.modal-close {
  min-height: 40px;
  padding: 0 6px 0 15px;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  border: 1px solid #3a404a;
  border-radius: 999px;
  color: #d9dce1;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}

.modal-close i {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #262b33;
  font-size: 12px;
}

.modal-close:hover,
.modal-close:focus-visible {
  border-color: #6b7380;
  color: #fff;
  background: #20242b;
  outline: none;
}

.modal-content {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--modal-bg);
}

.modal-content--video {
  padding: 24px clamp(28px, 5vw, 74px);
  display: grid;
  grid-template-columns: minmax(270px, 430px) minmax(300px, 430px);
  gap: clamp(34px, 6vw, 84px);
  align-items: center;
  justify-content: center;
}

.modal-video-stage {
  position: relative;
  height: 100%;
  max-height: 100%;
  aspect-ratio: 9 / 16;
  justify-self: center;
  overflow: hidden;
  border-radius: 9px;
  background: #050608;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .34);
}

.modal-video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #050608;
  opacity: 0;
  transition: opacity .25s ease;
}

.modal-video-stage.is-loaded .modal-video { opacity: 1; }

.modal-content--image {
  padding: clamp(16px, 2.6vw, 34px);
  display: grid;
  place-items: center;
}

.modal-image-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  opacity: 0;
  transition: opacity .25s ease;
}

.modal-image-stage.is-loaded .modal-image { opacity: 1; }

.modal-media-loader {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  color: var(--modal-muted);
  background: var(--modal-bg);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  transition: opacity .2s ease, visibility .2s ease;
}

.is-loaded > .modal-media-loader {
  opacity: 0;
  visibility: hidden;
}

.modal-caption {
  max-width: 430px;
  padding: 0;
  align-self: center;
}

.modal-caption > p {
  margin: 0 0 18px;
  color: #788393;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.modal-caption h2 {
  margin: 0;
  font: 500 clamp(28px, 3.4vw, 48px)/1.08 var(--display);
  letter-spacing: -.05em;
}

.modal-caption > div {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--modal-line);
  color: #aeb4be;
  font-size: 15px;
  line-height: 1.65;
}

.modal-navigation {
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 10px 18px;
  display: flex;
  flex-flow: row nowrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--modal-line);
  background: var(--modal-surface);
}

.modal-navigation button {
  min-width: 154px;
  min-height: 48px;
  padding: 0 20px;
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  border: 1px solid #343a44;
  border-radius: 7px;
  color: #fff;
  background: #1b1f26;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}

.modal-navigation .modal-next {
  border-color: var(--modal-blue);
  background: var(--modal-blue);
}

.modal-navigation button:hover,
.modal-navigation button:focus-visible {
  border-color: #fff;
  color: #111318;
  background: #fff;
  outline: none;
  transform: translateY(-1px);
}

@media (max-width: 820px) {
  .media-modal {
    width: 100%;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .media-modal[open] { grid-template-rows: 60px minmax(0, 1fr) 68px; }
  .modal-toolbar { padding: 0 14px 0 18px; }
  .modal-close { min-height: 38px; }

  .modal-content--video {
    padding: 14px 0 30px;
    display: block;
    overflow-y: auto;
  }

  .modal-video-stage {
    width: min(calc(100% - 28px), 390px);
    height: auto;
    aspect-ratio: 9 / 16;
    margin: 0 auto;
  }

  .modal-caption {
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 22px 4px;
  }

  .modal-content--image { padding: 12px; }
  .modal-navigation { padding: 8px; flex-flow: row nowrap; justify-content: stretch; }
  .modal-navigation button { min-width: 0; width: auto; min-height: 50px; flex: 1 1 0; }
}

@media (max-width: 480px) {
  .modal-status { gap: 8px; font-size: 9px; }
  .modal-status span + span { padding-left: 8px; }
  .modal-close { padding-left: 10px; }
  .modal-close span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .modal-video-stage { width: min(calc(100% - 20px), 350px); }
  .modal-caption h2 { font-size: clamp(26px, 8.5vw, 36px); }
  .modal-caption > div { font-size: 14px; }
  .modal-content--image { padding: 8px; }
  .modal-navigation { gap: 7px; padding: 7px; }
  .modal-navigation button { min-height: 50px; padding: 0 10px; font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-video,
  .modal-image,
  .modal-media-loader,
  .modal-close,
  .modal-navigation button { transition: none; }
}
