/* Tablet and touch layer, loaded after every other stylesheet on the projects, 1486 workspace and account pages.
   Everything here applies only to a coarse primary pointer (iPad, Android tablets, phones), so desktop is unchanged.
   It holds the cross-page rules no single page owns: field size, touch minimums the desktop density rules undo on
   landscape tablets, native select rendering, tap behaviour, keyboard-only hints and the soft keyboard. Page-specific
   sizes stay with each page. See docs/collaboration/tablet-audit-2026-10-22.md (T-01 … T-09). */
@media (pointer: coarse) {
  /* T-01: iPad Safari zooms the whole page when a field under 16px takes focus. No field is larger than 16px. */
  :root .bsa-cloud :is(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color], [type=hidden]), select, textarea) {
    font-size: 16px;
  }
  /* T-04: single-line fields and selects reach 44px. Inline editors on photo cards keep the card's own sizing. */
  :root .bsa-cloud :is(input:not([type=checkbox], [type=radio], [type=range], [type=file], [type=color], [type=hidden]), select:not([multiple], [size])):not(.bcp-card *) {
    box-sizing: border-box;
    min-height: 44px;
  }
  /* T-03: WebKit ignores the height of a natively drawn select (22–29px). Draw the arrow ourselves so every engine
     honours the 44px above. The status pill on project cards already draws its own arrow. */
  :root .bsa-cloud select:not([multiple], [size], .bpj-status-select) {
    -webkit-appearance: none;
    appearance: none;
    padding-right: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%235f6673' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
  }
  /* On a dark ground (the video bar, the dark camera, the camera's shooting dialogs) the arrow is light: about 10:1
     on #111b25 instead of 2:1, so the control still reads as a menu. */
  :root .bsa-cloud :is(.bcp-video-bar, .bcp-camera-pane.is-dark, .bcp-shoot, .bcp-shot-sheet) select:not([multiple], [size]) {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23c3cedb' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
  /* The playback speed is a compact pill beside the seek bar: its arrow sits inside the pill's own padding, so it is no
     wider than with the native arrow. */
  :root .bsa-cloud .bcp-video-bar select.bcp-video-speed {
    padding-right: 16px;
    background-position: right 4px center;
    background-size: 10px 10px;
  }
  /* T-02: at 1080px and wider a landscape tablet gets the desktop layout, whose density rules come after the touch
     rules and shrink these back to 26–38px. */
  :root .bsa-cloud .bcp-insight,
  :root .bsa-cloud .bpj-quick-link {
    min-height: 44px;
  }
  :root .bsa-cloud .bpj-quick-link {
    display: inline-flex;
    align-items: center;
  }
  /* Slide Over and one-third Split View (about 375px) use the phone header: the icon-only 搜索与指令 and the logo link. */
  :root .bsa-cloud .bcp-ask { min-width: 44px; }
  :root .bsa-cloud .bcp-brand { min-height: 44px; }
  /* T-08: no double-tap zoom or tap delay on controls. The photo markup layer (none) and the 3D canvas (pan-y) keep theirs. */
  :root :is(a, button, input, select, textarea, summary, label, [role=button], [role=tab]):not(svg *) {
    touch-action: manipulation;
  }
  /* T-07: key caps mean nothing without a keyboard. bsa-tablet.mjs marks the page once a hardware keyboard is used. */
  :root:not(.bsa-hw-keyboard) :is(.bcp-kbd, .bcp-kbd-inline, .bcp-key) {
    display: none;
  }
  /* T-06: while the soft keyboard is up, the AI panel and any open dialog fit the visible area above it.
     bsa-tablet.mjs keeps --bsa-vv-top and --bsa-vv-height in step with window.visualViewport. */
  :root.bsa-keyboard-open .bai-panel {
    top: var(--bsa-vv-top, 0px);
    bottom: auto;
    height: var(--bsa-vv-height, 100%);
  }
  /* The camera's shooting dialogs follow the keyboard themselves (--bcp-vv-*), so they are left alone here. */
  :root.bsa-keyboard-open dialog[open]:not(.bcp-shoot, .bcp-shot-sheet) {
    margin-top: calc(var(--bsa-vv-top, 0px) + 8px);
    margin-bottom: auto;
    max-height: calc(var(--bsa-vv-height, 100dvh) - 16px);
  }
  :root.bsa-keyboard-open dialog.bcp-dialog[open]:not(.bcp-shoot, .bcp-shot-sheet) {
    height: calc(var(--bsa-vv-height, 100dvh) - 16px);
  }
  /* Long-pressing a photo opens the iPad image menu (save, copy, share), which fights dragging a tray photo onto a
     check and one-finger panning in the reader. Buttons, links and the reader's own download link keep their menus. */
  :root .bsa-cloud :is([draggable=true], [draggable=true] img, .bcp-photo-wrap, .bcp-photo-wrap img) {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
  /* Scrolling to the end of a dialog must not scroll the page behind it. */
  :root .bsa-cloud dialog[open] {
    overscroll-behavior: contain;
  }
}
/* The sticky navigation column is one viewport tall; use the dynamic viewport so Safari's toolbars never cut its end off. */
@supports (height: 100dvh) {
  @media (pointer: coarse) and (min-width: 1080px) {
    :root .bsa-cloud .bcp-shell-nav { height: 100dvh; }
  }
}
