.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: var(--gutter); }
.modal__overlay { position: absolute; inset: 0; background: rgba(28, 28, 28, 0.6); }

.modal__dialog {
  position: relative;
  display: flex;
  gap: calc(20 * var(--wm));
  width: calc(1130 * var(--wm));
  max-height: 100%;
  padding-left: calc(30 * var(--wm));
  border-radius: var(--radius-l);
  background: var(--color-white);
  overflow: hidden;
}
.modal__close {
  position: absolute;
  top: calc(16 * var(--wm));
  right: calc(16 * var(--wm));
  z-index: 2;
  width: calc(46 * var(--wm));
  height: calc(46 * var(--wm));
  border-radius: 50%;
  background: var(--color-white);
}
.modal__close::before, .modal__close::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(18 * var(--wm));
  height: 2px;
  background: var(--color-text);
  transform: translate(-50%, -50%) rotate(45deg);
}
.modal__close::after { transform: translate(-50%, -50%) rotate(-45deg); }

.modal__content { display: flex; flex-direction: column; gap: calc(20 * var(--wm)); width: calc(525 * var(--wm)); padding: calc(30 * var(--wm)) 0; overflow-y: auto; }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: calc(20 * var(--wm)); }
.modal__meta { display: flex; flex-direction: column; gap: calc(6 * var(--wm)); }
.modal__text { display: flex; flex-direction: column; gap: calc(19 * var(--wm)); }
.modal__btn { align-self: flex-start; margin-top: auto; padding-top: calc(18 * var(--wm)); padding-bottom: calc(18 * var(--wm)); }
.modal__img { width: calc(555 * var(--wm)); height: calc(640 * var(--wm)); object-fit: cover; flex: none; }

@media (max-width: 767px) {
  .modal { padding: calc(10 * var(--wm)); }
  .modal__dialog { flex-direction: column-reverse; width: 100%; padding: 0; overflow-y: auto; }
  .modal__img { width: 100%; height: calc(240 * var(--wm)); }
  .modal__content { width: 100%; padding: calc(16 * var(--wm)); overflow: visible; }
  .modal__head { align-items: flex-start; }
  .modal__btn { align-self: stretch; }
}

@media (min-width: 768px) {
  .modal {
    --wm: min(calc(100vw / 1440), calc((100svh - 40px) / 640));
    --container: calc(1360 * var(--wm));
    --gutter: calc(40 * var(--wm));
    --fs-h2: calc(40 * var(--wm));
    --fs-card: calc(22 * var(--wm));
    --fs-body: calc(16 * var(--wm));
    --lh-body: calc(19 * var(--wm));
    --fs-small: calc(14 * var(--wm));
    --lh-small: calc(17 * var(--wm));
    --radius-s: calc(12 * var(--wm));
    --radius-l: calc(25 * var(--wm));
  }
}

@media (min-width: 768px) {
  .modal__dialog { height: calc(640 * var(--wm)); }
  .modal__content { gap: calc(16 * var(--wm)); padding: calc(30 * var(--wm)) 0; overflow: hidden; }
  .modal__head .h2 { font-size: calc(32 * var(--wm)); }
  .modal__meta, .modal__route { font-size: var(--fs-small); line-height: var(--lh-small); }
  .modal__text { gap: calc(10 * var(--wm)); font-size: var(--fs-small); line-height: var(--lh-small); }
  .modal__img { height: 100%; }
}

.video-modal { position: relative; width: min(calc(1100 * var(--wm)), calc((100svh - 80px) * 16 / 9)); aspect-ratio: 16 / 9; border-radius: var(--radius-l); background: #000; overflow: hidden; }
.video-modal__frame, .video-modal__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.modal--video .modal__close { z-index: 3; }

@media (max-width: 767px) {
  .video-modal { width: 100%; border-radius: var(--radius-s); }
}
