/* F6: shared mobile-web fixes. Linked by every hand-authored template (32 pages: calculators,
   root pages, blog, account, property tracker, contact) AND by every generated market page via
   gen-pages.mjs's shared head template — sitewide coverage, verified by
   scripts/test-mobile-contract.mjs. (Generated city pages have no text inputs, so for them the
   operative rules are the nav tap targets and text-size-adjust.)

   Scoped to coarse-pointer (touch) devices only — desktop rendering is untouched.

   Rule 1 — iOS Safari zoom-on-focus guard: focusing any text-entry control whose computed
   font-size is below 16px makes iOS Safari zoom the whole page in, leaving the user zoomed and
   off-center after every field — the single biggest "the page jumped and now I'm lost" driver
   on the calculator forms (14/15.5px), the markets tool (13px), and the property tracker
   (down to 11.5px). A 16px floor at the moment of interaction removes the zoom trigger without
   changing any page's visual design for mouse/trackpad users. !important is deliberate: it
   must win over ~20 pages' own inline component styles without editing each cascade.

   Rule 2 — text-size-adjust: stops iOS/Android from auto-inflating text after orientation
   changes (layout was designed at 1:1; auto-inflation is what breaks it, not helps it). */

@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Rule 3 — navigation tap targets: the wrap-style header nav renders 13-14px links with
     4px vertical padding (~16-22px tall) — under WCAG 2.2 AA's 24px target-size minimum and
     genuinely fiddly to tap. Vertical padding only, so the wrapped rows just space out
     slightly; horizontal rhythm and desktop hover styling are untouched. (account.html /
     property-tracker.html's collapsed hamburger menu already uses 13px-padded full-width
     rows and is unaffected.) */
  .navlinks a {
    padding-top: 8px;
    padding-bottom: 8px;
    display: inline-block;
  }
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* The market templates inline their generated component CSS after this file.
   The element-qualified root intentionally has higher specificity than those
   plain :root blocks, allowing one current palette across static city pages and
   Function-rendered ZIP pages without regenerating thousands of data pages. */
html:root {
  --blue-soft: #2a5fd0;
  --amber: #a84f0e;
  --muted-dim: #667085;
  --rule: rgba(20, 30, 50, .12);
  --good: #0b7a4c;
  --bad: #b23a2e;
  --on-chrome-soft: #afc3cf;
  --brand-cyan: #59c8f5;
}

/* C1: shared product-chrome finish. Every public template already loads this
   stylesheet, so these rules align the existing shells without introducing a
   second navigation component or rewriting generated pages. */
.skiplink {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  background: #2a5fd0;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}
.skiplink:focus { left: 0; }

.topbar .nav,
.topband .navrow {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding: 16px 24px;
  gap: 20px;
}
.topbar .brand img,
.topband .brand img { height: 46px; width: auto; }
.topbar .navlinks,
.topband .navlinks { gap: 22px; row-gap: 8px; }
.topbar .navlinks a,
.topband .navlinks a { line-height: 1.35; }

.sitefoot .foot,
.sitefoot .footrow {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding: 24px;
  gap: 12px 24px;
  align-items: center;
}
.sitefoot a { overflow-wrap: anywhere; }

/* Text links must remain recognizable without color alone. Controls, cards,
   navigation, and button-shaped links retain their component treatment. */
main p a:not(.btn):not(.pill):not(.tcard):not(.zw-btn),
main li a:not(.btn):not(.pill):not(.tcard):not(.zw-btn),
nav.crumbs a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}

/* Older calculator templates used a dark blue kicker on the navy header and
   very faint field hints on white. These shared overrides keep the established
   palette while meeting the readable hierarchy used by newer pages. */
.topband .kicker { color: #8fd4f2; }
body .ctrl .hint,
body .chips .chiphint,
label .hint { color: #667085; }
body .inputline .aff,
body .derived,
body #marketForm .help,
body .metric-k .moe { color: #667085; opacity: 1; }
body .gAp,
body .gA,
body .gBp,
body .gB,
body .gCp,
body .gC,
body .pill.on { color: #fff; }

@media (max-width: 700px) {
  .topbar .nav,
  .topband .navrow { padding: 14px 18px; }
  .topbar .brand img,
  .topband .brand img { height: 42px; }

  /* No-JS fallback: keep every destination visible. nav.js adds site-nav-ready
     only after the drawer has been fully constructed. */
  html:not(.site-nav-ready) :is(.topbar, .topband) :is(.nav, .navrow) { flex-wrap: wrap; align-items: center; }
  html:not(.site-nav-ready) :is(.topbar, .topband) :is(.nav, .navrow) .navlinks {
    order: 4; flex: 1 0 100%; width: 100%; flex-wrap: wrap; gap: 0 20px;
  }
  html:not(.site-nav-ready) :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a {
    display: inline-flex; align-items: center; min-height: 44px;
  }

  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) {
    flex-wrap: nowrap !important;
    align-items: center !important;
  }
  html.site-nav-ready :is(.topbar, .topband) .navtoggle,
  html.site-nav-ready :is(.topbar, .topband) .nav-toggle,
  html.site-nav-ready :is(.topbar, .topband) .nav__toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    order: 3;
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    margin-left: auto;
    padding: 0 !important;
    border: 1px solid rgba(159, 208, 236, .34) !important;
    border-radius: 10px !important;
    background: rgba(255, 255, 255, .05) !important;
    color: #fff !important;
    cursor: pointer;
  }
  html.site-nav-ready :is(.topbar, .topband) .nav-cta { display: none !important; }
  .nav-menu-icon { display: grid; gap: 4px; width: 19px; }
  .nav-menu-icon i { display: block; height: 2px; border-radius: 2px; background: currentColor; }
  .sr-only {
    position: absolute !important; width: 1px !important; height: 1px !important;
    padding: 0 !important; margin: -1px !important; overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
  }
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks {
    position: fixed !important;
    z-index: 1002 !important;
    inset: 0 0 0 auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 4px !important;
    width: min(88vw, 360px) !important;
    max-width: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    margin: 0 !important;
    padding: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) 18px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    background: #0c2a38 !important;
    border-left: 1px solid rgba(159, 208, 236, .22);
    box-shadow: -18px 0 48px rgba(0, 0, 0, .32);
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .2s ease, visibility 0s linear .2s;
  }
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow).nav-menu-open .navlinks {
    transform: translateX(0);
    visibility: visible;
    transition: transform .22s ease;
  }
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a {
    display: flex !important;
    align-items: center !important;
    width: 100%;
    min-height: 48px !important;
    padding: 10px 12px !important;
    border-radius: 8px;
    color: #eaf1f6 !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
  }
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a:hover,
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a:focus-visible,
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a[aria-current="page"],
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks a.active {
    background: rgba(89, 200, 245, .12) !important;
    color: #fff !important;
  }
  .nav-menu-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: flex-end;
    gap: 8px;
    min-width: 76px;
    min-height: 44px;
    margin: 0 0 10px;
    padding: 8px 10px;
    border: 1px solid rgba(159, 208, 236, .28);
    border-radius: 9px;
    background: transparent;
    color: #eaf1f6;
    font: inherit;
    cursor: pointer;
  }
  .nav-menu-close span[aria-hidden] { font-size: 25px; line-height: .8; font-weight: 300; }
  .nav-menu-backdrop {
    position: fixed;
    z-index: 1001;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: rgba(5, 18, 27, .66);
    cursor: default;
  }
  .nav-menu-backdrop[hidden] { display: none !important; }
  html.site-menu-lock { overflow: hidden; }

  .sitefoot .foot,
  .sitefoot .footrow {
    padding: 22px 18px;
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (min-width: 701px) {
  :is(.topbar, .topband) .navtoggle,
  :is(.topbar, .topband) .nav-toggle,
  :is(.topbar, .topband) .nav__toggle,
  .nav-menu-close,
  .nav-menu-backdrop { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  html.site-nav-ready :is(.topbar, .topband) :is(.nav, .navrow) .navlinks { transition: none !important; }
}
