/* =========================================================
   Become Lancer page
   Technician interest modal — responsive layout
   ========================================================= */

/*
 * Prevent the page behind the modal from scrolling.
 */
body.modal-open {
  overflow: hidden;
}

/*
 * The overlay itself owns the viewport.
 * It can scroll as a fallback on very short screens.
 */
#technicianInterestModal {
  box-sizing: border-box;
  align-items: center;
  justify-content: center;

  width: 100%;
  height: 100%;

  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/*
 * Keep this modal smaller than the shared homepage modal.
 * The content scrolls inside the modal instead of extending
 * outside the viewport.
 */
#technicianInterestModal .modal-lead-capture {
  position: relative;

  width: min(100%, 560px);
  height: auto;

  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);

  margin: auto;
  padding: 26px 26px 24px;

  box-sizing: border-box;

  overflow-x: hidden;
  overflow-y: auto;

  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;

  border-radius: 28px;
}

/*
 * Leave enough room for the close button.
 */
#technicianInterestModal .modal-lead-capture > div {
  width: 100%;
  min-width: 0;
}

#technicianInterestModal #technicianInterestFormView {
  padding-top: 4px;
}

/*
 * Smaller modal heading.
 * The global h3 size is too large for a long form.
 */
#technicianInterestModal h3 {
  max-width: 460px;

  margin-top: 8px;
  margin-bottom: 12px;

  padding-left: 38px;
  padding-right: 38px;

  font-size: clamp(1.65rem, 4vw, 2.15rem);
  line-height: 1.08;
}

/*
 * Keep introductory text compact.
 */
#technicianInterestModal .modal-copy {
  max-width: 470px;
  margin-bottom: 10px;

  font-size: 0.96rem;
  line-height: 1.55;
}

/*
 * Give the form breathing room without making it excessively tall.
 */
#technicianInterestModal .form-grid {
  gap: 14px;
  margin-top: 20px;
}

/*
 * Prevent every field and label from forcing extra width.
 */
#technicianInterestModal .form-grid,
#technicianInterestModal .form-grid > *,
#technicianInterestModal fieldset,
#technicianInterestModal label,
#technicianInterestModal input,
#technicianInterestModal select,
#technicianInterestModal textarea,
#technicianInterestModal button {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

/*
 * Slightly reduce input height for this longer form.
 */
#technicianInterestModal .input {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;

  font-size: 16px;
  line-height: 1.3;
}

/*
 * Textarea should remain useful without taking over the screen.
 */
#technicianInterestModal textarea.input {
  min-height: 92px;
  max-height: 170px;
  resize: vertical;
}

/*
 * Compact the radio and consent choices.
 */
#technicianInterestModal .lead-fieldset {
  padding: 0;
  margin: 0;
}

#technicianInterestModal .interest-grid {
  gap: 9px;
}

#technicianInterestModal .interest-chip {
  min-height: 44px;
  padding: 10px 12px;

  align-items: flex-start;

  font-size: 0.94rem;
  line-height: 1.4;
}

#technicianInterestModal .interest-chip input {
  flex: 0 0 auto;
  margin-top: 2px;
}

/*
 * Keep the close button visible while scrolling.
 */
#technicianInterestModal .close-button {
  position: sticky;
  top: 0;

  float: right;

  width: 38px;
  height: 38px;

  margin: -8px -8px 0 8px;

  z-index: 20;

  flex-shrink: 0;
}

/*
 * Clear the floated close button so the content does not
 * incorrectly wrap around the entire form.
 */
#technicianInterestModal .modal-lead-capture::after {
  content: "";
  display: table;
  clear: both;
}

/*
 * Short laptop windows and landscape tablets.
 */
@media (max-height: 760px) and (min-width: 641px) {
  #technicianInterestModal {
    align-items: flex-start;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #technicianInterestModal .modal-lead-capture {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);

    padding: 20px 22px 18px;
    border-radius: 24px;
  }

  #technicianInterestModal h3 {
    margin-top: 4px;
    margin-bottom: 9px;

    font-size: 1.72rem;
  }

  #technicianInterestModal .modal-copy {
    margin-bottom: 7px;

    font-size: 0.91rem;
    line-height: 1.45;
  }

  #technicianInterestModal .form-grid {
    gap: 10px;
    margin-top: 14px;
  }

  #technicianInterestModal .input {
    min-height: 42px;
    padding: 9px 11px;
  }

  #technicianInterestModal textarea.input {
    min-height: 76px;
  }

  #technicianInterestModal .interest-chip {
    min-height: 40px;
    padding: 8px 10px;
  }
}

/*
 * Phones and narrow windows.
 */
@media (max-width: 640px) {
  #technicianInterestModal {
    align-items: flex-start;

    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left));
  }

  #technicianInterestModal .modal-lead-capture {
    width: 100%;

    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);

    margin: auto;
    padding: 18px 14px 16px;

    border-radius: 22px;
  }

  #technicianInterestModal h3 {
    max-width: 100%;

    margin-top: 4px;
    margin-bottom: 10px;

    padding-left: 30px;
    padding-right: 30px;

    font-size: clamp(1.45rem, 7vw, 1.8rem);
  }

  #technicianInterestModal .mini-label {
    padding-left: 34px;
    padding-right: 34px;
  }

  #technicianInterestModal .modal-copy {
    max-width: 100%;

    margin-bottom: 8px;

    font-size: 0.91rem;
    line-height: 1.48;
  }

  /*
   * The global form grid may be two columns.
   * Force this long modal to one column on phones.
   */
  #technicianInterestModal .form-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);

    gap: 11px;
    margin-top: 16px;
  }

  #technicianInterestModal .form-grid > *,
  #technicianInterestModal .form-grid > .full {
    grid-column: 1 / -1;
  }

  #technicianInterestModal .input {
    min-height: 44px;
    padding: 10px 11px;
  }

  #technicianInterestModal textarea.input {
    min-height: 82px;
    max-height: 140px;
  }

  #technicianInterestModal .interest-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  #technicianInterestModal .interest-chip {
    width: 100%;
    min-height: 42px;
    padding: 9px 10px;

    font-size: 0.91rem;
  }

  #technicianInterestModal .close-button {
    width: 36px;
    height: 36px;

    margin-top: -6px;
    margin-right: -4px;
  }

  #technicianInterestModal #technicianSubmitBtn,
  #technicianInterestModal #technicianDoneBtn {
    width: 100%;
    min-height: 46px;
  }
}

/*
 * Very narrow phones.
 */
@media (max-width: 380px) {
  #technicianInterestModal .modal-lead-capture {
    padding-left: 11px;
    padding-right: 11px;
    border-radius: 18px;
  }

  #technicianInterestModal h3 {
    font-size: 1.38rem;
  }

  #technicianInterestModal .modal-copy,
  #technicianInterestModal label,
  #technicianInterestModal .interest-chip {
    font-size: 0.88rem;
  }
}

/*
 * Very short mobile screens, including landscape mode.
 */
@media (max-height: 520px) {
  #technicianInterestModal {
    align-items: flex-start;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  #technicianInterestModal .modal-lead-capture {
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);

    padding-top: 14px;
    padding-bottom: 14px;

    border-radius: 18px;
  }

  #technicianInterestModal h3 {
    font-size: 1.42rem;
  }

  #technicianInterestModal .modal-copy {
    font-size: 0.86rem;
    line-height: 1.4;
  }
}

/*
 * Accessibility: remove unnecessary animation for users who
 * prefer reduced motion.
 */
@media (prefers-reduced-motion: reduce) {
  #technicianInterestModal,
  #technicianInterestModal .modal-lead-capture {
    scroll-behavior: auto;
  }
}