/* ============================================================================
   Shared touch policy — loaded by EVERY document the player can reach.

   This file exists because the rule below used to live in `mobile.css`, and
   `mobile.css` is loaded by `index.html` alone. Moon Foundry, the storybook
   viewer and the landing page each ship their own document, so on those screens
   double-tap-to-zoom was never suppressed — reported as "almost all screens
   break if I randomly zoom by double tapping or whatever".

   Anything here must be true of every screen without exception. Screen-specific
   touch rules belong with that screen's stylesheet, not in this file.
   `tests/unit/styles/touchPolicyParity.test.js` keeps every document linked.
   ========================================================================== */

@media (any-pointer: coarse), (max-width: 1024px) {

  /* NO ZOOM, BY ANY GESTURE. Product decision, 2026-07-29, stated in exactly
     those terms: "i wanted zoom blocked everywhere regardless of triggering
     gesture". It replaces the earlier `manipulation` policy, which blocked
     double-tap but deliberately kept two-finger pinch.

     `pan-x pan-y` is the value that says it: scrolling still works everywhere
     (collection grids, foundry lists, the storybook), while BOTH zoom gestures
     — double-tap and pinch — are gone. `none` would also kill scrolling, and
     `manipulation` is precisely `pan-x pan-y pinch-zoom`, the thing being
     removed.

     This must sit on the ROOT. An earlier attempt listed card surfaces, which
     fixed double-tap on cards and nowhere else — the report came straight back
     as "double tapping still zooms". touch-action composes by RESTRICTION down
     the ancestor chain, so a descendant cannot re-enable what the root removed,
     and the root therefore covers surfaces nobody thought to enumerate.

     CSS alone is not enough on iOS: Safari treats pinch as a system gesture and
     raises its own `gesturestart`/`gesturechange` events, which no touch-action
     value suppresses. `public/scripts/zoom-policy.js` cancels those, and is
     linked by every document for the same reason this file is.

     Reading a card closely is served IN-APP, not by the browser (2026-09-19,
     "allow zooming on cards, just for purpose of enlarging text/assets,
     without reordering elements"; refined 2026-09-20 after the browser's own
     pinch, gated to cards, froze magnified, moved things and left a black
     band under the screen on an iPhone): the same script scales the ENLARGED
     card — the tap-to-inspect popup — under a pinch with a transform, and
     springs it back when a finger lifts. Nothing else on the page is touched
     and the viewport never changes, so this root value stays exactly what the
     2026-07-29 decision made it. Rest-size cards are not magnifiable. */
  html,
  body {
    touch-action: pan-x pan-y;
  }

  /* iOS re-scales text on rotate unless this is pinned. That inflation is a
     second, quieter way a screen that fit its page box stops fitting it: every
     measured layout is suddenly laid out around larger glyphs. */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Rubber-band scrolling detaches fixed chrome from the content it belongs to
     for the length of the bounce — the "block swimming" in the report — and on
     a page that already fits there is nothing to scroll to anyway. Surfaces
     that own a real scroll re-enable their own axis locally. */
  body {
    overscroll-behavior: none;
  }

  /* Safari auto-zooms focused fields whose computed type is below 16px. That
     is independent of pinch/double-tap policy, and one late compact rule is
     enough to magnify the whole game and strand pointer state. This shared,
     deliberately-important floor covers every player document and dynamic
     prompt/search field, including touch-capable hybrids whose primary pointer
     happens to be a mouse. Non-text input types are excluded. */
  input:not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]):not([type="image"]):not([type="hidden"]),
  textarea,
  select,
  [contenteditable="true"],
  [contenteditable="plaintext-only"] {
    font-size: 16px !important;
    -webkit-user-select: text !important;
    user-select: text !important;
  }
}
