/* ============================================================================
 * MoveClerk — WebKit / iOS Safari surgical fixes (2026-10-10)
 * Study: goals/we-move-pro-crm-product/hidden_files/webkit-debugging-learnings.md
 *
 * This file loads LAST so its rules win ties. It deliberately uses
 * `!important` only for the 16px input floor (the Safari auto-zoom fix),
 * where losing to an older rule would leave a real iPhone bug in place.
 * No visual-design changes beyond what the fixes require.
 * ========================================================================== */

/* ---------- 1. 16px input floor -------------------------------------------
 * Safari auto-zooms on focus for any form control < 16px, and the zoom can
 * stay locked after the keyboard closes (checklist items 1–2). Every text
 * input, select, textarea, and editable control is floored at 16px.
 * Excludes: checkboxes, radios, ranges, color pickers, hidden/submit/button
 * inputs (not text entry — their size is a design choice, not a zoom risk).
 * ------------------------------------------------------------------------ */
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="image"]),
select,
textarea,
[contenteditable="true"] {
  font-size: 16px !important;
}

/* Prevent iOS's automatic text inflation from reflowing pages on rotate. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ---------- 2. Modal scroll-lock support ----------------------------------
 * `overflow: hidden` on body does NOT lock background scroll on iOS.
 * webkit-fixes.js pins the body with `position: fixed` at the negative
 * scroll offset while any modal/sheet/drawer is open (checklist item 5)
 * and restores the exact scroll position on close (item 6). These rules
 * kill rubber-band chaining into the page while locked.
 * ------------------------------------------------------------------------ */
html.wkf-locked,
html.wkf-locked body {
  overscroll-behavior: none;
}

/* ---------- 3. Safe-area gaps the base stylesheets missed -----------------
 * Fixed bars must clear the notch / Dynamic Island / home indicator
 * (checklist item 4). The tab bar, modal, toast, and assistant surfaces
 * already pad with env(safe-area-inset-*); these were the gaps.
 * ------------------------------------------------------------------------ */
/* Photo lightbox: bottom bar (label + Close) must clear the home indicator. */
.photo-lightbox {
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
/* Crew inventory full-screen takeover: header must clear the notch. */
#crew-inv .ci-head {
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-left: calc(14px + env(safe-area-inset-left));
  padding-right: calc(14px + env(safe-area-inset-right));
}
/* Marketing sticky nav: clear the notch/status bar in landscape. */
header.site {
  padding-top: env(safe-area-inset-top);
}

/* ---------- 4. Momentum scroll containers ---------------------------------
 * Nested scroll areas feel dead or trap scrolling on iOS without this
 * (checklist item 13).
 * ------------------------------------------------------------------------ */
.modal-card,
.assistant-messages,
.ci-body,
.sfd-wrap {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ---------- 5. Kill residual tap delay ------------------------------------
 * With a proper width=device-width viewport the 300ms delay is gone;
 * touch-action: manipulation removes any remainder on interactive elements.
 * ------------------------------------------------------------------------ */
a,
button,
input,
select,
textarea,
label,
summary,
[role="button"] {
  touch-action: manipulation;
}
