/* GCMD Library — touch and narrow-screen conventions
 *
 * Three conventions live here: field text size (P17-01), tap height
 * (P17-04) and the scroll-row cue (P17-02). Every rule is touch-only
 * except the opt-in [data-scroll-row] cue.
 *
 * Two kinds of rule live here, and nothing else:
 *   1. rules keyed on [data-scroll-row] — a row that scrolls sideways
 *      shows that there is more to the side. These apply at ANY pointer
 *      type, because a narrow desktop window clips the row too. A row
 *      opts in with the attribute; static/js/scroll-row.js sets
 *      data-clipped. Without the script nothing is faded.
 *   2. rules inside @media (pointer: coarse) — sizes for a thumb. With
 *      a mouse nothing here changes.
 */

/* P17-02 — the clipped edge fades. A mask, so no background colour has
   to be known (the rows sit on grey, white and paper surfaces). No
   arrows, no added buttons. */
[data-scroll-row][data-clipped="end"] {
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, black calc(100% - 40px), transparent);
}
[data-scroll-row][data-clipped="start"] {
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px);
  mask-image: linear-gradient(to right, transparent, black 40px);
}
[data-scroll-row][data-clipped="both"] {
  -webkit-mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, transparent, black 40px, black calc(100% - 40px), transparent);
}

/* P17-04 — rows a thumb can hit. The fallback value is required: --rr-tap
   is defined under the Reading Room theme, not on :root. Buttons (.btn)
   are not listed here; they take their height in components/buttons.css. */
@media (pointer: coarse) {
  .segment-control button,
  .segment-control a,
  .space-tabs a,
  .space-tabs .space-tab,
  .sort-select,
  .res-sort,
  .res-search {
    min-height: var(--rr-tap, 44px);
  }
}

/* P17-01 — a field never makes iOS Safari zoom the page. Safari zooms in
   on any field whose text is under 16px and leaves the page zoomed. The
   !important is deliberate and the only one in this file: the rules it must
   beat are class-qualified and spread over many sheets and inline <style>
   blocks. Because it would also beat a LARGER size, the two fields that are
   larger today (the homepage ask bars and the six-digit sign-in code,
   #otp_code, 1.2rem inline) are excluded by name. Inline-editable text
   ([contenteditable]) is left out on purpose: here it is only headings and
   body copy at 16px or more, and forcing 16px would shrink the Space name
   while its owner edits it. pointer: coarse,
   not a width, so an iPad in landscape is covered and a narrow desktop
   window is not changed. Pinch zoom is untouched (no viewport tag limits it).
   No space between ")" and ":not(": a space there would be a descendant
   combinator and the rule would hit the wrong elements (the minifier hides that in
   the bundle, but collection and item pages link this file unminified). */
@media (pointer: coarse) {
  :is(input:not([type="checkbox"],[type="radio"],[type="range"],[type="file"],[type="color"],[type="submit"],[type="button"],[type="reset"],[type="image"],[type="hidden"]),
      select, textarea):not(.askbar .search-input):not(.home-hero .search-input):not(#otp_code) {
    font-size: 16px !important;
  }
}
