/* =====================================================
   MH Theme — Global modal system
   Phase 58: one clean modal surface + animation contract.
   ===================================================== */

.mht-modal[hidden] {
  display: none !important;
}

.mht-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 34px);
  background: rgba(4, 2, 8, .72);
  -webkit-backdrop-filter: blur(10px) saturate(145%);
  backdrop-filter: blur(10px) saturate(145%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(.22, 1, .36, 1);
}

.mht-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.mht-modal.is-closing {
  opacity: 0;
  pointer-events: none;
}

.mht-modal__dialog,
#footer-modal .mht-modal__dialog {
  position: relative;
  width: min(760px, calc(100vw - 40px));
  max-height: calc(100svh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: clamp(24px, 3vw, 34px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.035) 34%, rgba(0,0,0,.18)),
    rgba(20,16,24,.88);
  -webkit-backdrop-filter: blur(24px) saturate(170%);
  backdrop-filter: blur(24px) saturate(170%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.24),
    inset 0 -1px 0 rgba(0,0,0,.32),
    0 30px 90px rgba(0,0,0,.46);
  transform: translate3d(0, 14px, 0) scale(.985);
  opacity: 0;
  transition:
    transform 260ms cubic-bezier(.22, 1, .36, 1),
    opacity 220ms cubic-bezier(.22, 1, .36, 1);
  will-change: transform, opacity;
}

#footer-modal .mht-modal__dialog {
  width: min(620px, calc(100vw - 40px));
}

.mht-modal .mht-modal__dialog:has(.mht-modal__list) {
  width: min(840px, calc(100vw - 40px));
}

.mht-modal.is-open .mht-modal__dialog,
#footer-modal.is-open .mht-modal__dialog {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.mht-modal.is-closing .mht-modal__dialog,
#footer-modal.is-closing .mht-modal__dialog {
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(.992);
}

.mht-modal__dialog::before,
#footer-modal .mht-modal__dialog::before {
  content: none !important;
}

.mht-modal__body {
  padding: clamp(26px, 4vw, 48px);
}

.mht-modal__close {
  position: absolute;
  top: clamp(12px, 2vw, 18px) !important;
  right: clamp(12px, 2vw, 18px) !important;
  z-index: 8;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.22),
    0 12px 30px rgba(0,0,0,.24);
  cursor: pointer;
  line-height: 1;
  transform: translateZ(0);
  transition:
    background-color 180ms cubic-bezier(.22, 1, .36, 1),
    transform 180ms cubic-bezier(.22, 1, .36, 1),
    opacity 180ms cubic-bezier(.22, 1, .36, 1);
}

.mht-modal__close:hover,
.mht-modal__close:focus-visible {
  background: rgba(183,140,255,.26);
  transform: scale(1.04);
  outline: none;
}

.mht-modal__close:active {
  transform: scale(.96);
}

.mht-modal__title,
.mht-modal__desc,
.mht-modal__list li,
.mht-modal__investment,
.mht-modal__note {
  color: rgba(255,255,255,.88);
}

.mht-modal__title {
  color: #fff;
  padding-right: 54px;
}

.mht-modal__title em {
  color: #C5A6D3;
}

.mht-modal__list li::before,
.mht-modal__investment .mht-modal-dot {
  color: #B78CFF;
}

.mht-modal__investment {
  border-top-color: rgba(255,255,255,.12);
}

.mht-modal__field {
  border-color: rgba(255,255,255,.16);
  background: rgba(255,255,255,.055);
  color: #fff;
}

.mht-modal__field::placeholder {
  color: rgba(255,255,255,.46);
}

@media (max-width: 640px) {
  .mht-modal {
    padding: 14px;
    align-items: center;
  }

  .mht-modal__dialog,
  #footer-modal .mht-modal__dialog,
  .mht-modal .mht-modal__dialog:has(.mht-modal__list) {
    width: min(100%, calc(100vw - 28px));
    max-height: calc(100svh - 28px);
    border-radius: 26px;
  }

  .mht-modal__body {
    padding: 30px 22px 24px;
  }

  .mht-modal__title {
    padding-right: 44px;
  }

  .mht-modal__close {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mht-modal,
  .mht-modal__dialog,
  #footer-modal .mht-modal__dialog,
  .mht-modal__close {
    transition: none !important;
  }

  .mht-modal__dialog,
  #footer-modal .mht-modal__dialog,
  .mht-modal.is-open .mht-modal__dialog,
  #footer-modal.is-open .mht-modal__dialog,
  .mht-modal.is-closing .mht-modal__dialog,
  #footer-modal.is-closing .mht-modal__dialog {
    transform: none !important;
  }
}
