/*
 * mobile.css: phone and small-tablet fixes from the 2026-11-18 mobile audit
 * (/root/resourced.com.au-audit/mobile-2026-11-18/PLAN.md, findings MG-xx).
 *
 * HARD CONSTRAINT: the desktop site must render exactly as before.
 *  - The <link> that loads this file carries a media attribute, so desktop
 *    browsers never apply it.
 *  - Every rule below also sits inside one of the same two media queries, so
 *    it stays inert even if the file is loaded without the attribute.
 * Do not add a rule outside these blocks.
 *
 * !important is used on purpose: this file is an override layer on top of
 * styles.css, legacy.css, per-page <style> blocks (some in <body>) and inline
 * style="" attributes.
 */

@media (max-width: 880px) {

  /* ── MG-01 Mobile menu overlay ───────────────────────────────────────
     styles.css only slides the overlay off-screen. Pages without legacy.css
     (all articles) left it visible: the closed menu's lower links bled over
     the page, and the open menu couldn't scroll to its last links. */
  .nav-overlay {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    visibility: hidden !important;
    padding-bottom: max(28px, env(safe-area-inset-bottom)) !important;
    transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s, visibility 0s linear .35s !important;
  }
  .nav-overlay.open {
    visibility: visible !important;
    transition: transform .35s cubic-bezier(.2,.8,.2,1), opacity .3s, visibility 0s !important;
  }
  /* The consent banner (z-index 99999) would sit on top of an open menu. */
  body:has(.nav-overlay.open) #rs-consent { display: none !important; }

  /* ── MG-05 / MG-07 Lighter sticky nav, reserved space while shared.js
     injects it, and room for focused/anchored elements to clear it ── */
  .site-nav {
    height: 64px !important;
    margin: 10px 12px 0 !important;
    padding: 8px 16px !important;
    top: 10px !important;
  }
  .site-nav .brand img { height: 40px !important; }
  #nav-slot { min-height: 74px; }
  html { scroll-padding-top: 86px; }
  /* Sticky filter bars that took 36–40% of a portrait phone screen. */
  .ins-index, .search-bar-section { position: static !important; }

  /* ── MG-02 iOS Safari zooms on focus below 16px ── */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]):not([type=submit]):not([type=button]):not([type=reset]):not([type=image]):not([type=color]),
  select,
  textarea { font-size: 16px !important; }

  /* ── MG-03 / MG-11 Grid and flex tracks sized by their widest child
     overflowed narrow phones (contact CV form, .sc-* tools, equity,
     team-benchmark). minmax(0,1fr) and min-width:0 let them shrink. ── */
  .bf-fields > *, .sc-tool > *, .sc-form, .sc-field,
  .eq-wrap > *, .eq-form, .eq-group, .eq-f, .eq-f > *,
  .tb-report > *, .tb-card { min-width: 0 !important; }
  .sc-tool, .eq-wrap, .tb-report { grid-template-columns: minmax(0, 1fr) !important; }
  select { max-width: 100% !important; }
  .tb-card { padding: 22px 18px !important; overflow-wrap: anywhere; }
  .cand-file input[type=file] { max-width: 100% !important; min-width: 0 !important; }
  .tb-people .top { flex-wrap: wrap !important; }
  .tb-people .nums { white-space: normal !important; }
  /* Safety net: no sideways page scroll on phones; pinch-zoom is unaffected.
     A non-visible overflow on <html> stops styles.css's body{overflow-x:hidden}
     propagating to the viewport, which turned <body> into a scroll container
     and broke the sticky nav. `clip` on <body> too keeps it a plain box, so
     position:sticky sticks to the viewport again (MG-17, 2026-11-18). */
  html { overflow-x: clip; }
  body { overflow-x: clip !important; }
  .btn-brief { max-width: 100% !important; white-space: normal !important; }
  .btn-brief .bb-label { min-width: 0 !important; }

  /* ── MG-04 Bottom bars: compact consent row, article CTA never stacked
     on top of it, 44px controls ── */
  html body #rs-consent {
    padding: 10px 14px !important;
    gap: 10px 12px !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
  }
  html body #rs-consent > span:first-child { flex: 1 1 auto; min-width: 0; }
  html body #rs-consent .rs-c-btns { gap: 8px !important; }
  html body #rs-consent button { min-height: 44px !important; padding: 8px 14px !important; font-size: 14px !important; }
  html body #rs-consent a { text-decoration: underline !important; text-underline-offset: .18em; }
  body:has(#rs-consent) #rs-artcta { display: none !important; }
  html body #rs-artcta .in { padding: 8px 8px 8px 14px !important; gap: 10px !important; flex-wrap: nowrap !important; }
  html body #rs-artcta p { min-width: 0 !important; font-size: 13px !important; }
  html body #rs-artcta a.cta { padding: 12px 14px !important; font-size: 13px !important; min-height: 44px; display: inline-flex; align-items: center; }
  html body #rs-artcta button.x { min-width: 44px !important; min-height: 44px !important; padding: 0 !important; }

  /* ── MG-09 Links distinguishable without colour; low-contrast hero line ── */
  p a:not([class]), li > p a:not([class]), td a:not([class]), .contact-call a {
    text-decoration: underline !important;
    text-underline-offset: .18em;
  }
  .hm-cand { color: rgba(244,239,230,.75) !important; }
  .hm-cand a { color: #B8DAC8 !important; text-decoration: underline !important; text-underline-offset: .18em; }

  /* ── MG-10 Scroll regions get a visible focus ring (mobile.js makes them
     focusable) ── */
  .table-scroll:focus-visible, .pc-scroll:focus-visible, .sc-table-wrap:focus-visible, .band-wrap:focus-visible {
    outline: 2px solid #B8DAC8; outline-offset: 2px;
  }

  /* ── MG-12 Number-stepper buttons were 25×20–23 (under the 24px AA
     floor). Phones get the numeric keypad from type=number anyway. ── */
  .ns-btns { display: none !important; }

  /* ── MG-13 / MG-14 Touch targets ── */
  .promo-strip .promo-cta { display: inline-block !important; padding: 12px 6px !important; margin: -12px 0 !important; }
  .ins-pill, .bf-chip, .job-apply, #reyouLaunch {
    min-height: 44px !important;
    display: inline-flex !important; align-items: center; justify-content: center;
  }

  /* /salary-index band bars are focusable tooltips: 7px tall, 3px apart
     (2.5.8). Taller bars with 25px between centres pass the spacing test. */
  .si-tracks { gap: 11px !important; }
  .si-track, .si-seg { height: 14px !important; }

  /* Hit areas grown with a pseudo-element, so nothing moves visually:
     calculator "On this page" links (17px tall, crowded) and the footer phone
     link (103x16). */
  .pc-toc a, .site-footer a[href^="tel:"] { position: relative; }
  .pc-toc a::after, .site-footer a[href^="tel:"]::after {
    content: ""; position: absolute; left: 0; right: 0; top: 50%;
    height: 32px; transform: translateY(-50%);
  }
  /* .pc-toc rows are ~25px apart (8px row gap): 24px fills the gap, no overlap. */
  .pc-toc a::after { height: 24px; }

  /* ── MG-16 Smallest form labels ── */
  .bf-fields label { font-size: 12px !important; }
}

@media (max-width: 640px) {
  /* MG-03: the contact CV form collapses to one column here. */
  .cand .bf-fields { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ── MG-05 Landscape phones: sticky chrome covered 29–100% of a ~340px-tall
   screen. Touch-only, so a short desktop window never matches. ── */
@media (pointer: coarse) and (max-height: 500px) {
  .site-nav, body > nav, .ins-index, .search-bar-section {
    position: relative !important;
    top: auto !important;
  }
  html { scroll-padding-top: 0; }
  .nav-overlay { overflow-y: auto !important; overscroll-behavior: contain; }
  .nav-overlay-links { margin-top: 20px !important; gap: 8px !important; }
  .nav-overlay-links a { font-size: 24px !important; }
}

@media (max-width: 880px) and (max-height: 700px) {
  /* MG-01: fit more of the menu on short phones (iPhone SE 568px). */
  .nav-overlay-links { margin-top: 28px !important; gap: 10px !important; }
  .nav-overlay-links a { font-size: 26px !important; }
}
