/* Dialog frame stays inside the visible screen; only its content scrolls. */
#modal {
  --modal-gutter: 12px;
  position: fixed;
  inset: auto 0 auto;
  top: calc(var(--modal-viewport-top, 0px) + var(--modal-viewport-height, 100dvh) * .5);
  transform: translateY(-50%);
  width: min(840px, calc(100vw - var(--modal-gutter) * 2));
  max-width: calc(100vw - var(--modal-gutter) * 2);
  height: auto;
  max-height: calc(var(--modal-viewport-height, 100dvh) - var(--modal-gutter) * 2);
  margin: 0 auto;
  padding: 0;
  border: 0;
  overflow: hidden;
}
#modal[open] { display: flex; flex-direction: column; }
#modal:not([open]) { display: none; }
#modal:has(.enquiryPopup), #modal:has(.designViewer) { width: min(1040px, calc(100vw - var(--modal-gutter) * 2)); }
#modal:has(.launchPopup) { width: min(740px, calc(100vw - var(--modal-gutter) * 2)); }
#modalBody {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-height: calc(var(--modal-viewport-height, 100dvh) - var(--modal-gutter) * 2);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scroll-padding: 52px 16px 24px;
}
#modal > .close {
  position: absolute;
  top: 8px;
  right: 8px;
  float: none;
  margin: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  line-height: 1;
  font-size: 28px;
  background: #f8f1e2;
  color: #153b2a;
  border: 1px solid #a98a53;
  box-shadow: 0 2px 12px #0002;
  z-index: 10;
}
#modalBody > *, #modal .modalText, #modal .formPanel,
#modal .popupEditorial, #modal .designVisual { min-width: 0; }
#modal p, #modal h2, #modal h3, #modal label { overflow-wrap: anywhere; }
#modal .enquiryPopup { grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); min-height: 0; }
#modal .popupEditorial { min-height: 0; }
#modal .popupForm { padding: 54px 30px 28px; margin: 0; }
#modal .popupForm .successPanel { padding: 20px 0; }
#modal .field input, #modal .field textarea { min-width: 0; max-width: 100%; }
#modal .submitButton, #modal .launchPopupActions .button { min-height: 46px; }
#modal .launchPopupBanner { height: auto; max-height: calc(var(--modal-viewport-height, 100dvh) * .44); object-fit: contain; background: #0c271f; }
#modal .launchPopupCopy { padding: 24px 30px 28px; }
#modal .launchPopupCopy h2 { font-size: clamp(27px, 4vw, 38px); }
#modal .launchPopupActions { flex-wrap: wrap; gap: 18px 26px; }
#modal .continueExploring { min-height: 44px; display: inline-flex; align-items: center; }
#modal .designViewer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
#modal .designVisual img { min-height: 0; height: 100%; max-height: 680px; object-fit: contain; }
#modal .modalText { padding-top: 54px; }
@media (max-width: 760px) {
  #modal { --modal-gutter: 8px; }
  #modal .enquiryPopup, #modal .designViewer { grid-template-columns: minmax(0, 1fr); }
  #modal .popupEditorial { height: 148px; min-height: 148px; }
  #modal .popupLogo { width: 76px; height: 65px; top: 18px; left: 18px; }
  #modal .popupEditorialCopy { left: 111px; right: 24px; bottom: 20px; }
  #modal .popupEditorialCopy > span { font-size: 7px; letter-spacing: 1px; }
  #modal .popupEditorialCopy h3 { font-size: clamp(23px, 5.3vw, 31px); margin: 8px 0; }
  #modal .popupEditorialCopy p { font-size: 10px; line-height: 1.5; }
  #modal .popupEditorialCopy i { display: none; }
  #modal .popupForm { padding: 26px 22px 24px; }
  #modal .field input, #modal .field textarea { font-size: 16px; line-height: 1.45; padding: 11px 12px; }
  #modal .field label { font-size: 12px; }
  #modal .field { margin-bottom: 17px; }
  #modal .field textarea { min-height: 110px; }
  #modal .popupForm .consent { font-size: 11px; }
  #modal .consent input { width: 18px; height: 18px; }
  #modal .privacyNote, #modal .field small { font-size: 10px; }
  #modal .launchPopupCopy { padding: 23px 22px 25px; }
  #modal .launchPopupActions { flex-direction: column; gap: 11px; }
  #modal .launchPopupActions .button { width: 100%; justify-content: space-between; }
  #modal .launchPopupCopy > p:not(.eyebrow) { font-size: 12px; line-height: 1.65; margin: 14px auto 18px; }
  #modal .designVisual img { width: 100%; height: min(52dvh, 440px); max-height: none; }
  #modal .designViewer .modalText { padding: 28px 22px; }
  #modal .result { gap: 12px; }
  #modal .result h3 { font-size: 21px; }
}
@media (max-width: 360px) {
  #modal .popupEditorialCopy { left: 104px; right: 15px; }
  #modal .popupEditorialCopy h3 { font-size: 23px; }
  #modal .popupEditorialCopy > span { display: none; }
  #modal .popupForm, #modal .launchPopupCopy { padding-left: 18px; padding-right: 18px; }
  #modal .popupForm h2 { font-size: 29px; }
}
/* Landscape phones and the visible area above an on-screen keyboard. */
#modal.compactViewport .enquiryPopup { grid-template-columns: minmax(0, 1fr); }
#modal.compactViewport .popupEditorial { display: none; }
#modal.compactViewport .popupForm { padding: 52px 24px 24px; }
#modal.compactViewport .launchPopupBanner { max-height: calc(var(--modal-viewport-height, 100dvh) * .32); }
#modal.compactViewport .launchPopupCopy { padding: 16px 22px 20px; }
#modal.compactViewport .launchPopupCopy h2 { font-size: 28px; }
#modal.compactViewport .launchPopupCopy > p:not(.eyebrow) { margin: 10px auto 14px; }
@media (max-height: 560px) {
  #modal .enquiryPopup { grid-template-columns: minmax(0, 1fr); }
  #modal .popupEditorial { display: none; }
  #modal .popupForm { padding-top: 52px; }
  #modal .launchPopupCopy { padding: 16px 20px 20px; }
  #modal .launchPopupBanner { max-height: 32dvh; }
}
