/* Touch and small-screen pass (layout only). Every rule sits in a touch or small-screen query, so a mouse at 1280, 1440 and 1920 is untouched.
   Copied into 10-reskin/css, 04-onboarding/nuf-v3/css and 04-onboarding/settings-v1/css. Loaded last. DS-GAP: responsive (no DS touch tokens yet). */

/* ---- Fields stay at 16px on touch so iOS never zooms on focus (readonly fields keep their size) ---- */
@media (pointer: coarse) {
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=button]):not([readonly]),
  textarea:not([readonly]), select, .rs-rte__body[contenteditable=true] { font-size: 16px; }
}

/* ---- Hover-only controls show at rest on touch ---- */
@media (hover: none) {
  .dash-tag__x { width: 14px; opacity: 1; margin-right: -3px; }
  .dash-addicon { opacity: 1; }
  .rs-rowact { opacity: 1 !important; }
  /* the shortcode thumbnail label becomes a bar along the bottom so the preview stays visible */
  .rs-sc__over { opacity: 1; }
  .rs-sc__over-x { inset: auto 0 0 0; height: 36px; }
}

/* ---- Touch targets that sit in rules tied to max-width: also on large touch screens ---- */
@media (pointer: coarse) {
  .rs-rowact .lnk-wp, .rs-wp-links a { min-height: 44px; }
  .ds-pager .pg, .nc button { min-width: 44px; min-height: 44px; }
  .p-wp-toggle { min-width: 44px; min-height: 44px; }
}

/* ---- Phones: Settings cards stack (heading, then link and chip, then the toggle) ---- */
@media (max-width: 480px) {
  .set-sec__head:has(.set-lnk) { flex-wrap: wrap; row-gap: 12px; }
  .set-sec__lead { flex: 1 1 0; min-width: 0; }
  .set-sec__head:has(.set-lnk) > .set-sec__lead { flex: 1 1 100%; }
  .set-sec__txt { flex: 1 1 0; min-width: 0; }
  .set-sec__title { flex-wrap: wrap; row-gap: 4px; }
  .set-sec__desc { overflow-wrap: anywhere; }
  .set-sec__aside:has(.set-lnk) { flex: 1 1 100%; justify-content: space-between; align-self: stretch; flex-wrap: wrap; gap: 8px 20px; }
  /* Edit testimonial: avatar above the fields, one column */
  .rs-editgrid .rs-form, .rs-formcard > .rs-form, .rs-form { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .rs-editgrid .rs-form > *, .rs-form > * { min-width: 0; }
}
@media (max-width: 599px) {
  /* the phone bulk bar is tall (three rows): the list scrolls clear of it */
  .proto .wb-card:has(.rs-bulk.is-on), .proto .dash-body:has(.rs-bulk.is-on) { padding-bottom: calc(196px + env(safe-area-inset-bottom)); }
  .rs-ed__side, .rs-fields { min-width: 0; }
}

/* ---- Short screens (iPad landscape): the filter panel scrolls inside the window; NUF steps scroll with room for the pill ---- */
.rs-fpanel { overscroll-behavior: contain; }
@media (min-width: 1024px) and (max-height: 780px) {
  /* the step column is absolutely placed, so the page itself grows: the CTAs clear the explorer pill and the home indicator */
  .proto main.nuf-content:not(.dash) { min-height: calc(860px + env(safe-area-inset-bottom)); }
  body.proto.nuf { overflow-y: auto; }
}
@media (max-width: 1023px) {
  .proto .p-flow .nuf-left { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* Switches keep their drawn size (the 44px minimum would turn them into discs); the hit area is a transparent border, the track is clipped to the padding box and the layout box is pulled back with a negative margin (the DS uses ::before and ::after for the check and the knob) */
@media (max-width: 1024px), (pointer: coarse) {
  .tog { box-sizing: border-box; width: calc(var(--tw) + 24px); height: calc(var(--th) + 24px); border: 12px solid transparent; background-clip: padding-box !important; margin: -12px; }
}

/* NUF welcome on a short touch screen (iPad landscape): the column sits at the top so both CTAs clear the explorer pill at first load */
@media (pointer: coarse) and (max-height: 860px) and (min-width: 1024px) {
  .proto .p-flow .nuf-left.nuf-welcome { top: 72px; }
}
