/* S'more's Outdoors — shared accessibility layer, linked last in every page's <head>.
 *
 * Each page keeps its own inline styles; this file only adds what every page
 * needs to meet WCAG 2.2 AA (plus the 44x44px target size the site aims for):
 * a visible focus ring, a skip link, 44px touch targets on controls, reflow
 * at narrow widths / 200%+ zoom, and reduced motion. See /accessibility.html.
 */

/* The [hidden] attribute must win over component display rules (e.g. a
   `display:grid` row), or "hidden" rows stay visible and announced. */
[hidden] { display: none !important; }

/* ---------- focus ---------- */
/* --ink is the page's text color: dark in light mode, light in dark mode, so
   the ring contrasts with the page background in both. */
:focus-visible {
  outline: 3px solid var(--ink, #1c2318) !important;
  outline-offset: 2px !important;
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: absolute; left: 8px; top: 8px; z-index: 1000;
  transform: translateY(-200%);
  background: var(--card, #fffdf8); color: var(--ink, #1c2318);
  border: 2px solid var(--ink, #1c2318); border-radius: 8px;
  padding: 10px 16px; font: 700 15px/1.2 system-ui, sans-serif; text-decoration: none;
}
.skip-link:focus { transform: none; }
main:focus { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 44x44px targets ---------- */
button, select, summary,
input[type="text"], input[type="email"], input[type="number"], input[type="search"],
input[type="tel"], input[type="url"], input[type="date"], input[type="month"] {
  min-height: 44px;
}
button { min-width: 44px; }
.tools-menu-btn, .help-btn, .pdf-btn, .pdfbtn { min-height: 44px; }
.help-btn { width: 44px !important; height: 44px !important; }
/* The 44px boxes above are taller than some pages' own button styles expected,
   which left the text sitting top-left (the build page's "?" and "All tools").
   Center the contents on every page, whatever that page's own CSS says. */
.tools-menu-btn, .help-btn { display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px; box-sizing: border-box; }
.help-btn { padding: 0 !important; }
.units-toggle button { min-height: 44px; min-width: 48px; }
.tools-menu-list a { display: flex !important; align-items: center; min-height: 44px; }
.tools-menu-list, .help-pop-panel { max-height: 75vh; overflow-y: auto; }
footer a, .flinks a, .nav-back, .nav-brand { display: inline-flex; align-items: center; min-height: 44px; }
.wordmark { min-height: 44px; }
input[type="checkbox"], input[type="radio"] { min-width: 20px; min-height: 20px; }
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) { min-height: 44px; }
details > summary { display: flex; align-items: center; }
details > summary::-webkit-details-marker { margin-right: 6px; }

/* ---------- reflow (320px wide = 400% zoom on a 1280px screen) ---------- */
.nav-actions, .top-row, .brandbar-inner, .nav-inner { flex-wrap: wrap; }
.nav-actions { justify-content: flex-end; }
img, svg, video, canvas { max-width: 100%; }
pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
table { max-width: 100%; }
td, th, a { overflow-wrap: anywhere; }
@media (max-width: 480px) {
  .tools-menu-list, .help-pop-panel { position: fixed !important; left: 8px !important; right: 8px !important;
    top: auto !important; min-width: 0 !important; max-width: none !important; margin-top: 8px; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .tool-card:hover, .featured:hover, a:hover, button:hover { transform: none !important; }
}

/* ---------- page components that need bigger targets ---------- */
.skip-link { min-height: 44px; display: inline-flex; align-items: center; }
footer a, .flinks a { min-width: 44px; justify-content: center; }
.pg-btn { min-width: 44px !important; min-height: 44px !important; }
/* standalone links: campground result links, parts-list items, official-site links, table cells */
.links > a, .pn > a, .pp > a, p.off > a, td > a:only-child, small > a:only-child {
  display: inline-flex; align-items: center; min-height: 44px;
}
@media (max-width: 480px) {
  .tools-menu-list, .help-pop-panel { width: auto !important; }
}

/* fieldsets default to min-width:min-content, which stops long selects from shrinking */
fieldset { min-width: 0; }
select { max-width: 100%; }
.pager-nav { flex-wrap: wrap; }
input[type="range"] { min-height: 44px; }

/* checkbox rows whose <label for> sits beside the box: the label is the big tap target */
.checkrow { min-height: 44px; align-items: center; }
.checkrow input[type="checkbox"], .checkrow input[type="radio"] { width: 24px; height: 24px; }
.top-row > a:not(.wordmark), p > b:only-child > a:only-child { display: inline-flex; align-items: center; min-height: 44px; }
.checkrow > label { min-height: 44px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
