/*
 * Phone standard (D-3060, founder 15 Nov 2026, after his iPhone test on live).
 *
 * The shared causes of the phone faults, fixed once for every page, in one place. Loaded by the four layouts
 * (master, marketing, journey, employer-shell) after the page's own styles, and by the profile edit page, which has
 * no layout (Resume/start_fresh, D-3067). It changes sizes and spacing only:
 * NO COLOUR is set anywhere in this file (founder, 16 Nov 2026: "Do not change any color without my approval").
 *
 * The candidate and employer stylesheets are generated from the approved design frames (tools/design/build_css.py,
 * build_employer_css.py), so their phone rules live here and not in those files, the same way a11y-standard.css
 * carries the tap-target sizes.
 */

/* ---- 1. No text box under 16px on a phone ----
   An iPhone zooms the whole page in when a text box smaller than 16px is tapped, and leaves it zoomed: the page then
   runs off the right edge and buttons look cut. Measured on staging on 15 Nov 2026: 92 signed-out pages, 29 candidate
   screens and 22 employer screens carried a text box of 13 to 15px. Zoom itself is never switched off: people who
   need it keep it. */
@media (max-width: 767.98px) {
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]):not([type="hidden"]),
  /* D-3067 (D-1940: the old two lines are kept): html body select,
     html body textarea { font-size: 16px !important; }
     Measured on staging on 16 Nov 2026, after the standard was merged: Contact's message box and the pop-up's list
     and message box were still 14px, because a page rule with a class and !important outweighed these two plain
     lines. They now carry the same weight as the input line above; the :not() parts match every list box and big
     text box and only add that weight. */
  html body select:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]):not([type="hidden"]),
  html body textarea:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="submit"]):not([type="button"]):not([type="image"]):not([type="color"]):not([type="hidden"]) { font-size: 16px !important; }
  /* the hint inside a box keeps its smaller size, so a hint that fitted before still fits */
  html body input::placeholder, html body textarea::placeholder { font-size: 14px; }
}

/* ---- 2. A bar fixed to the bottom keeps the iPhone home-bar room ----
   The candidate and employer shells ask for the whole screen (viewport-fit=cover), but their bottom bars kept no room
   for the home bar, so "Workspace" and "More" sat under the corners of the screen. The bar grows by the safe area and
   pads its buttons up by the same amount; the room the pages and the help button keep above it (--jzj-tab-h) grows
   with it. On a screen with no home bar the safe area is 0 and nothing changes. */
@media (max-width: 1023.98px) {
  html body .jz-shell { --jzj-tab-h: calc(64px + env(safe-area-inset-bottom, 0px)); }
  html body .jz-v2 .m-nav,
  html body .jz-v2 .m-nav5 {
    box-sizing: border-box;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }
}

/* ---- 3. What is brought into view lands above a bar fixed to the bottom ----
   A field that takes focus, or a section jumped to, is scrolled only as far as the bottom edge of the screen, which
   is under the bar. The page keeps that much room free whenever it scrolls something into view. */
@media (max-width: 1023.98px) {
  /* D-3067 (D-1940: the old line is kept): html:has(.m-nav, .m-nav5, .jp-mobile-bar, .sfbar) { scroll-padding-bottom: 96px; }
     Measured on staging on 16 Nov 2026: 96px cleared the 64px bar but not the round help button that sits above it
     on the candidate and employer screens (its top is 120px up), so a link brought into view landed under that
     button; and on an iPhone the bar is taller by the home-bar area, which 96px did not count. */
  html:has(.jp-mobile-bar, .sfbar) { scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
  html:has(.m-nav, .m-nav5) { scroll-padding-bottom: calc(128px + env(safe-area-inset-bottom, 0px)); }
  html:has(.jzj-qc) { scroll-padding-bottom: 230px; }
}

/* ---- 4. A bar fixed to the bottom sits above the cookie notice while the notice shows ----
   The notice is docked at the foot of the screen and publishes its height as --jzcn-h (layouts/inc/cookie-notice). On a
   first visit it lay over the five questions' Continue and Skip, and over the candidate and employer bottom bars. */
html.jzcn-on :is(.jzj-qc, .jz-v2 .m-nav, .jz-v2 .m-nav5, .sfbar, .jp-mobile-bar) { bottom: var(--jzcn-h, 0px); }

/* ---- 5. Nothing sticks out past the edge of a small phone (D-3064, founder 16 Nov 2026: "fix the 320 px cuts now") ----
   Measured on staging at 320px wide. Two rows were wider than the screen; everything else flagged at that size was a
   mistake in the checker (the landing pages' main button and the Sign up row are whole).
   (a) Search and category pages: the row of page buttons was 334px in a 296px space, so "1" and the next arrow were cut
       on any screen under 334px. Under 340px the buttons are 36px wide (were 38px) with 10px at each side (was 12px) and
       2px between them (was 6px), so the row fits on one line; it may wrap if a page number is ever too long. Their
       height, colours and words are unchanged.
   (b) Personal website page: the row of two choices ("Answer a few questions", "Upload a resume") never shrank, so
       under 376px it ran past its card and at 320px past the screen. It now keeps to its card and the words wrap inside
       each choice. At 376px and wider nothing changes. */
@media (max-width: 339.98px) {
  html body .jz-search-pagination .pager { gap: 2px; row-gap: 6px; flex-wrap: wrap; }
  html body .jz-search-pagination .pager-number,
  html body .jz-search-pagination .pager-prev,
  html body .jz-search-pagination .pager-next { min-width: 36px; padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 479.98px) {
  html body .pwl-page .pwl-s29 { max-width: 100%; }
  html body .pwl-page .pwl-s29 .pwl-way { min-width: 0; white-space: normal; }
}
