/* Lot Q3, the phone (Q3 measures: tests/e2e/q3_shots.py, test: tests/e2e/q3_phone.py). Loaded last of desk/.
   A phone held upright: every key and row a finger presses has a hit area of 44 x 44 px or more (the drawn box may be
   smaller), no text under 11 px but the chart's axis, nothing under the notch or the home bar, the ticket's sheet
   above an on-screen keyboard (--kb: the keyboard's height, shell.js) with its key always in view, the chart's lines
   held by a finger. A phone on its side (the computer's form, under 500 px of height, a touch screen): the chart first
   over the whole first screen, the top bar and the ticket stay while the left column scrolls, the ticket's key in view,
   the same finger sizes. */

/* ---- the top bar: under the notch's height, keys a finger wide, nothing pushed out by a price's tag ---- */
.term[data-form="phone"] .tbar { gap: 4px; min-height: calc(52px + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0 max(8px, env(safe-area-inset-left, 0px)); }
.term[data-form="phone"] .tbar-end { gap: 4px; }
/* the brand's mark is a picture on a phone, not a key (it only reloaded this screen): the market and its price get the room */
.term[data-form="phone"] .brandmark { pointer-events: none; }
.term[data-form="phone"] .menu-btn { min-width: 44px; justify-content: center; }
/* when nothing else fits (a long market name), the market's key gives way (its name ends in an ellipsis): the menus stay whole */
.term[data-form="phone"] .mkt-btn { flex: 0 1 auto; min-width: 0; }
.term[data-form="phone"] .mkt-sym { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.term[data-form="phone"] .quote { flex: 0 1 auto; min-width: 0; }
/* the price's tag (no data, stale) takes the change's line while it shows: the change of a price that is not live says
   nothing new; its words may wrap on two lines, never wider than the price */
.term[data-form="phone"] .quote:has(.px-badge:not([hidden])) .quote-ch { display: none; }
.term[data-form="phone"] .px-badge { max-width: 11ch; padding: 1px 5px; font-size: 11px; line-height: 1.15; white-space: normal; text-align: center; }

/* ---- texts a phone reads: 11 px at least (the chart's axis figures are drawn in its canvas) ---- */
.term[data-form="phone"] :is(.ptab, .lg-ok, .lg-code, .ctool-n, .mk-row .sym small, .tk-sum dd small),
.term[data-form="phone"] .g-scale, .term[data-form="phone"] .g-scale span b { font-size: 11px; }

/* ---- the chart's lines held by a finger: a tag 32 px tall (lines.js keeps 44 px between two), its hit area 44 px, its
   cancel key 44 px wide; the tag's corners are its first and last parts' own ---- */
.term[data-form="phone"] .ln-tag { height: 32px; overflow: visible; font-size: 12px; }
.term[data-form="phone"] .ln-tag::before, .term[data-form="phone"] .ln-tag > button::before { content: ""; position: absolute; inset: -6px 0; }
.term[data-form="phone"] .ln-tag > :first-child { border-start-start-radius: inherit; border-end-start-radius: inherit; }
.term[data-form="phone"] .ln-tag > :last-child { border-start-end-radius: inherit; border-end-end-radius: inherit; }
.term[data-form="phone"] .ln-tag > button { position: relative; min-width: 44px; justify-content: center; }

/* ---- the ticket's sheet: over the keyboard, under the notch; only its fields scroll, the key never leaves ---- */
.term[data-form="phone"] .ticketp { bottom: var(--kb, 0px); max-height: calc(100% - var(--kb, 0px) - env(safe-area-inset-top, 0px)); }
.term[data-form="phone"][data-kb] .ticketp { padding-bottom: 10px; }       /* the keyboard covers the home bar */
.term[data-form="phone"] .tk-live > :not(.tk-body), .term[data-form="phone"] .ticketp > .tk-msg { flex-shrink: 0; }
.term[data-form="phone"] .tk-body { overscroll-behavior: contain; }

/* ---- a phone on its side ---- */
@media (max-height: 499px) and (max-width: 1279px) and (pointer: coarse) {
  /* the page scrolls (fit.css): the top bar and the ticket stay, the left column goes by under the top bar; the ticket
     scrolls on its own (its fields, then the check) and its key stays at its foot */
  .term[data-form="desk"]:not([data-focus="1"]) { --bar-h: 52px; overflow: clip; padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px); }
  body:not([data-visitor="true"]) .term[data-form="desk"]:not([data-focus="1"]) { height: auto; }
  .term[data-form="desk"]:not([data-focus="1"]) > .tbar { position: sticky; top: 0; z-index: 40; height: var(--bar-h); }
  body:not([data-visitor="true"]) .term[data-form="desk"]:not([data-focus="1"]) .tgrid {
    --land-h: calc(100dvh - var(--bar-h));
    grid-template-rows: var(--land-h) auto 300px var(--bot, 236px); grid-template-areas: "chart ticket" "acct ticket" "book ticket" "bottom ticket"; }
  body:not([data-visitor="true"]) .term[data-form="desk"]:not([data-focus="1"]) .ticketp {
    position: sticky; top: var(--bar-h); align-self: start; height: var(--land-h); overflow-y: auto; overscroll-behavior: contain;
    padding-bottom: 0; scrollbar-width: none; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-body { flex: none; overflow: visible; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-go { position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 2;
    box-shadow: 0 0 0 8px var(--surface), inset 0 1px 0 var(--key-shine), 0 1px 0 var(--key-edge); }
  .term[data-form="desk"]:not([data-focus="1"]) .ticketp > .tk-msg { margin-bottom: 8px; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-what { display: none !important; }
  /* a finger's sizes */
  .term[data-form="desk"] :is(.key, .seg-b, .chip, .field, .tab, .menu-btn, .app-back, .brandmark, .ct-open, .tk-lev, .th-sort) { min-height: 44px; }
  .term[data-form="desk"] :is(.key-ico, .menu-btn, .seg-b, .tk-lev, .app-back, .brandmark, .pal-btn) { min-width: 44px; }
  .term[data-form="desk"] .brandmark { justify-content: center; }
  .term[data-form="desk"] :is(.lg-ok, .lg-code, .ctool-n, .tk-sum dd small, .px-badge) { font-size: 11px; }
  .term[data-form="desk"] .term-lang .sp-lang-btn { width: 44px; height: 44px; }
  .term[data-form="desk"] .field input { height: 42px; font-size: 16px; }
  .term[data-form="desk"] .tk-sides .key, .term[data-form="desk"] .ticketp .seg-b, .term[data-form="desk"] .chips .chip,
  .term[data-form="desk"] .chip.tk-tog { min-height: 44px; }
  .term[data-form="desk"] .ticketp .field { min-height: 44px; }
  .term[data-form="desk"] .tk-go { min-height: 48px; }
  .term[data-form="desk"] .seg:not(.seg-flat) { padding-block: 0; }      /* its keys 44 px inside it: the chart focus's strip stays one 44 px row */
  /* the chart's lines as on a phone held upright */
  .term[data-form="desk"] .ln-tag { height: 32px; overflow: visible; font-size: 12px; }
  .term[data-form="desk"] .ln-tag::before, .term[data-form="desk"] .ln-tag > button::before { content: ""; position: absolute; inset: -6px 0; }
  .term[data-form="desk"] .ln-tag > :first-child { border-start-start-radius: inherit; border-end-start-radius: inherit; }
  .term[data-form="desk"] .ln-tag > :last-child { border-start-end-radius: inherit; border-end-end-radius: inherit; }
  .term[data-form="desk"] .ln-tag > button { position: relative; min-width: 44px; justify-content: center; }
}

/* ---- a phone on its side, Q4: only the fields scroll. The leverage over them, the exposure, the check's verdict (its
   first line, the words it already says), the summary and the key under them are on the first screen together (the
   founder's rule, as Q2 on a computer). A keyboard open leaves under 300 px: the column scrolls whole as before (Q3),
   so the focused field keeps its place ---- */
@media (max-height: 499px) and (min-height: 300px) and (max-width: 1279px) and (pointer: coarse) {
  body:not([data-visitor="true"]) .term[data-form="desk"]:not([data-focus="1"]) .ticketp { overflow: hidden; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .term[data-form="desk"]:not([data-focus="1"]) .ticketp > :not(.tk-body), .term[data-form="desk"]:not([data-focus="1"]) .tk-live > :not(.tk-body) { flex-shrink: 0; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-check > :not(.tk-ic):not(.key) { display: none !important; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-go { position: static; box-shadow: inset 0 1px 0 var(--key-shine), 0 1px 0 var(--key-edge); }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-msg:empty { display: none; }
}

/* ---- the bottom panel's tabs: each a finger wide, even a short word ("Rules" at 360 px) ---- */
.term[data-form="phone"] #botTabs .tab { min-width: 44px; justify-content: center; }

/* ---- the markets' list: the family's word under the market's name (on its line it ran into the price at 360 px) ---- */
.term[data-form="phone"] .mk-row .sym { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; row-gap: 1px; line-height: 1.2; }
.term[data-form="phone"] .mk-row .sym .mlogo { grid-row: span 2; }
.term[data-form="phone"] .mk-row .sym small { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Q4: the ticket's fields' column stops on whole rows: a key is never cut in half at its top, on a phone's sheet
   (also with the keyboard open) and on its side; every row of the form is a stop, a focused field brought into view
   settles on the row it starts. On its side the column ends with a little room, so that its last rows can come up to
   its top whole too. (With a keyboard open on its side, the whole column scrolls and Q3 keeps the focused field in
   view: no stops there.) ---- */
.term[data-form="phone"] .tk-body { scroll-snap-type: y mandatory; }
@media (max-height: 499px) and (min-height: 300px) and (max-width: 1279px) and (pointer: coarse) {
  .term[data-form="desk"]:not([data-focus="1"]) .tk-body { scroll-snap-type: y mandatory; }
  .term[data-form="desk"]:not([data-focus="1"]) .tk-body::after { content: ""; flex: none; height: 48px; }
}
.term .tk-body > *, .term .tk-body .tk-group > *, .term .tk-body .tk-two > * { scroll-snap-align: start; }
