/* The visible area may shrink without resizing the CSS viewport. */
.w26-form-viewport #nbdq-form-popup,
.w26-form-viewport #nbdq-alert-popup {
  inset: var(--w26-form-top) 0 auto !important;
  height: var(--w26-form-height) !important;
}

.w26-form-viewport #nbdq-form-popup .main-popup,
.w26-form-viewport #nbdq-alert-popup .main-popup {
  margin-block: 8px !important;
  max-height: max(0px, calc(var(--w26-form-height) - 16px));
}

.w26-form-viewport #nbdq-form-popup .nbdq-popup-head,
.w26-form-viewport #nbdq-alert-popup .nbd-alert-head {
  padding-block: 10px;
}

/* Scroll the contact form independently of the close button. */
#way26-home .w26-contact-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
}

#way26-home .w26-contact-dialog .w26-dialog-header { flex: none; position: static; }
#way26-home .w26-contact-dialog .w26-dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

@media (max-width: 480px) {
  #way26-home .w26-contact-dialog[open] {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }
}

.w26-form-viewport #way26-home .w26-contact-dialog[open] {
  inset-block: calc(var(--w26-form-top) + 8px) calc(var(--w26-form-bottom) + 8px);
  max-height: max(0px, calc(var(--w26-form-height) - 16px));
}

.w26-form-viewport #way26-home .w26-contact-dialog .w26-dialog-header {
  padding-block: 8px;
}

/* In short landscape viewports give the fields room by scrolling the whole panel. */
.w26-form-viewport-short #nbdq-form-popup .main-popup,
.w26-form-viewport-short #nbdq-alert-popup .main-popup,
.w26-form-viewport-short #way26-home .w26-contact-dialog[open] {
  display: block;
  overflow-y: auto;
  overscroll-behavior-y: contain;
}

.w26-form-viewport-short #nbdq-form-popup .nbdq-popup-body,
.w26-form-viewport-short #nbdq-alert-popup .nbd-alert-body,
.w26-form-viewport-short #way26-home .w26-contact-dialog .w26-dialog-body {
  overflow: visible;
}

.w26-form-viewport-short #nbdq-form-popup .pp-quote-input textarea.input-text,
.w26-form-viewport-short #way26-home .w26-contact-dialog textarea {
  min-height: 56px;
  height: min(110px, max(56px, calc(var(--w26-form-height, 100dvh) - 40px)));
}

/* Safari zooms into small fields, which can hide the rest of the form. */
@media (max-width: 680px), (pointer: coarse) {
  #way26-home .w26-contact-dialog :is(input:not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=file]), textarea, select) {
    font-size: 16px;
  }
}
