/*
 * HAWK-EYE mobile form + software keyboard hardening.
 * Touch/mobile only; desktop/fine-pointer presentation is intentionally unchanged.
 */
@media (max-width: 767px), (hover: none) and (pointer: coarse) {
  html {
    scroll-padding-top: calc(4.25rem + var(--bbo-safe-top));
    scroll-padding-bottom: calc(8rem + var(--bbo-safe-bottom));
  }

  input,
  textarea,
  select,
  button[type="submit"] {
    scroll-margin-top: calc(4.25rem + var(--bbo-safe-top));
    scroll-margin-bottom: calc(8rem + var(--bbo-safe-bottom));
  }

  input,
  textarea,
  select,
  .input {
    min-width: 0;
    max-width: 100%;
  }

  input[type="number"] {
    font-variant-numeric: tabular-nums;
  }

  /*
   * When the software keyboard is in play, the fixed app nav only competes for
   * scarce vertical space. Chrome/WebView resizes the visual viewport (Step 2),
   * so let the focused field own that bottom edge until focus leaves it.
   */
  body:has(
    input:focus:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="file"]),
    textarea:focus,
    [contenteditable="true"]:focus
  ) nav[aria-label="Primary navigation"] {
    display: none !important;
  }

  /* Keep focused controls visually clear of sticky app chrome after browser auto-scroll. */
  input:focus,
  textarea:focus,
  select:focus,
  [contenteditable="true"]:focus {
    scroll-margin-top: calc(4.25rem + var(--bbo-safe-top));
    scroll-margin-bottom: calc(8rem + var(--bbo-safe-bottom));
  }
}
