/* Host and account pages on a phone (Event control, Advanced, the new-event wizard, and every signed-in page with
   the account top bar: My events, the reseller pages...): big enough to tap with a thumb and big enough to read
   (CLAUDE.md house rules: tap targets >= 44px, text >= 16px on phones). Never loaded by guest pages, so the guest
   camera's frozen default look never changes. Add-on panels (awards, challenges, prolink...)
   get the same sizes here without each one restyling itself. Improvement plan round 6. */
/* Keyboard focus, every size: a thick ring in the text color (--ink always contrasts with the page, whatever a
   reseller's brand colors are) on every link, button and folded-card title. Browsers' own rings differ and are faint
   on the dark buttons. More specific focus styles (tiles, tick boxes, the host tabs) still win. Plan item 21. */
:where(a, button, summary, [tabindex]):focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
@media (max-width: 760px), (pointer: coarse) {
  /* links and buttons that stand alone: the back link, the top bars, the section tabs */
  main a.back, .topnav nav a, .topnav nav .linklike, .host-nav a,
  main summary, main .btn, main .org-big-btn, main .org-advanced-link {
    min-height: 44px;
  }
  main a.back, .topnav nav a, .topnav nav .linklike, .host-nav a {
    display: inline-flex;
    align-items: center;
  }
  main summary { padding-block: 10px; box-sizing: border-box; }  /* keeps its open / closed arrow */
  /* tick boxes and switches: the whole label is the target */
  main label:has(> input[type="checkbox"]), main label:has(> input[type="radio"]) {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  main label.toggle { min-height: 44px; }
  /* typing fields and drop-downs, including the small ones inside add-on panels (16px also stops iOS zooming in) */
  main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="range"]), main select, main textarea {
    min-height: 44px;
    font-size: 16px;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  /* help text and side notes: readable at arm's length (badges and the small capital labels stay as they are) */
  main .hint, main small:not(.badge), main .muted, main .field > span, main .org-fold-status, main .step-label {
    font-size: 1rem;
  }
  main.wrap .hint, main.wrap small:not(.badge), main.wrap .org-big-btn small, main.wrap label span:not(.badge):not(.toggle-ui), .host-nav a { font-size: 1rem; }
  main.wrap li, main.wrap legend, main.wrap .coupon-box > summary, main.wrap .own-copies label, main.wrap .own-line, main.wrap .frames-preview .btn { font-size: 1rem; }
  main .btn, main .event-meta, main .event-meta span, main .muted { font-size: 1rem; }
  main .rc-actions .btn, main .rs-locked-note, main th, main td, main .plain-link, main .kicker,
  main .se-chip, main .rs-lock, main .lc-pill, main .badge { font-size: 1rem; }
  main .event-main { min-height: 44px; align-items: center; }
  main .rh-corner a { min-height: 44px; display: inline-flex; align-items: center; }
  main .rh-corner { display: flex; flex-wrap: wrap; gap: 4px 18px; }
  main .badge small, main .kicker small { font-size: inherit; }
  .hc-btn { min-height: 44px; }
  main .host-grid > *, main .org-cards > *, main .org-big > *, main .rh-grid > * { min-width: 0; }  /* bigger text never pushes a card past the screen */
}
/* Account top bar on a phone: 44px links in rows filled the whole first screen, so the logo gets its own line and the
   menu is one row you swipe sideways (account/_nav.html scrolls it to the page you are on). */
@media (max-width: 600px) {
  .topnav-account { flex-wrap: wrap; row-gap: 2px; }
  .topnav-account .logo { flex: 1 0 100%; min-height: 44px; display: flex; align-items: center; }
  .topnav-account nav {
    flex: 1 0 100%;
    flex-wrap: nowrap;
    gap: 20px;
    overflow-x: auto;
    contain: paint;  /* a sideways-scrolling box never widens the page on phones (docs/design/HOW-TO-FOLLOW.md) */
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding-inline-end: 28px;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .topnav-account nav::-webkit-scrollbar { display: none; }
  .topnav-account nav > * { flex: none; white-space: nowrap; min-width: 44px; justify-content: center; }
  /* The reseller bar has 7-8 links: swiped, the third read "M…" and testers never found Money or Help (7 Nov UX
     test). It wraps into short rows instead, so every link shows. */
  .topnav-reseller nav { flex-wrap: wrap; overflow-x: visible; column-gap: 18px; row-gap: 0; padding-inline-end: 0;
    -webkit-mask-image: none; mask-image: none; }
}

/* A surface behind the account menu: on the bare page colour, a phone's forced dark (Samsung) left the links at 1.1-1.9:1
   (docs/ux/crm-a1-phones.md). No site can turn forced dark off, so the menu gets its own surface (design rule). */
.topnav-account {
  background: var(--surface);
  border: var(--bw) solid var(--ink);
  border-radius: calc(10px * var(--radius-k));
  padding: 6px 12px;
}
/* Wide tables on the reseller Money page scroll inside their own box, the page itself stays put. */
.rm-scroll { overflow-x: auto; contain: paint; }
/* Accessibility pass, 9 Nov: the top bar wraps under big text instead of pushing the page sideways; red buttons reach 4.5:1 with white words. */
.topnav { flex-wrap: wrap; }
.btn-red, .alert:not(.ok) { background: color-mix(in srgb, var(--red) 97%, var(--ink)); }
main p a { overflow-wrap: anywhere; }
#help-chat { min-height: 44px; }
main .hc-btn span, main .stats span { font-size: 1rem; }

/* Big screens (12 Nov desktop sweep): fields and dropdowns stop at 520px, drawer toggles and other buttons keep their own width, hints stop at 72 characters. Phones untouched. */
@media (min-width: 900px) {
  main.wrap.wide :is(.box, .stack) .field :is(input, select):not([type="checkbox"], [type="radio"], [type="range"], [type="file"], [type="color"]) { max-width: 520px; }
  main.wrap.wide :is(p.hint, p.sub) { max-width: 72ch; }
  main.wrap.wide .box > .btn, main.wrap.wide .stack > .btn { align-self: flex-start; width: auto; min-width: 220px; }
}
