/* Disability Resource Finder — accessible, mobile-first styles (WCAG 2.2 AA target) */
:root {
  --text: #1a1a1a;
  --muted: #3d3d3d;
  --bg: #ffffff;
  --panel: #f3f6f9;
  --border: #5a6470;
  --primary: #155a99;
  --primary-hover: #0a4a85;
  --on-primary: #ffffff;
  --link: #155a99;
  --link-visited: #5a2d82;
  --focus: #ffbf47;
  --focus-ring: #1a1a1a;
  --alert-bg: #fff4e5;
  --alert-border: #8a4b00;
  --badge-federal: #e8eef7;
  --badge-state: #e9f5ec;
  --badge-local: #fdf1e3;
  --radius: 10px;
  --base: 1.25rem;
}
/* Dark mode is opt-in only (toggle button); light is always the default. */
html.dark-mode {
    --text: #f5f5f5;
    --muted: #d6d6d6;
    --bg: #121212;
    --panel: #1e252d;
    --border: #a9b4bf;
    --primary: #8cc4ff;
    --primary-hover: #b8dbff;
    --on-primary: #0a0a0a;
    --link: #9fd0ff;
    --link-visited: #d7b8ff;
    --focus: #ffbf47;
    --focus-ring: #ffffff;
    --alert-bg: #2b2111;
    --alert-border: #ffbf47;
    --badge-federal: #1f2d40;
    --badge-state: #1d3324;
    --badge-local: #3a2a17;
}
html.larger-text { --base: 1.5rem; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-wrap: break-word;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: var(--base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
.wrap { max-width: 72rem; margin: 0 auto; padding: 0 1rem; }
h1, h2, h3 { line-height: 1.25; margin: 1.5em 0 0.5em; }
h1 { font-size: 1.9em; margin-top: 0.8em; }
h2 { font-size: 1.45em; }
h3 { font-size: 1.15em; }
p { margin: 0 0 0.8em; max-width: 65ch; }
.lead { font-size: 1.05em; }

a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.15em; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration-thickness: 0.18em; }

/* Visible focus for everything (WCAG 2.4.7 / 2.4.11) */
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--focus-ring);
}
[tabindex="-1"]:focus { outline: none; box-shadow: none; }

.skip-link {
  position: absolute; left: 0.5rem; top: -100px;
  background: var(--bg); color: var(--link); padding: 0.75rem 1rem;
  border: 3px solid var(--text); z-index: 100; font-weight: 700;
}
.skip-link:focus { top: 0.5rem; }

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

/* Header */
.site-header { background: var(--bg); color: var(--primary); padding: 0.75rem 0; border-top: 6px solid var(--primary); border-bottom: 2px solid var(--border); }
.header-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.header-inner { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between; }
.site-title { font-size: 1.3em; font-weight: 800; margin: 0; }
.site-tagline { margin: 0; font-size: 0.9em; }
.site-header .btn-secondary[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.site-tagline { color: var(--text); }

/* Buttons — at least 48px tall targets */
.btn {
  font: inherit; font-weight: 700; cursor: pointer;
  min-height: 48px; padding: 0.5rem 1.1rem;
  border-radius: var(--radius); border: 3px solid var(--primary);
}
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--primary); }
.btn-secondary:hover { background: var(--panel); }

/* Emergency box */
.emergency {
  background: var(--alert-bg); border: 3px solid var(--alert-border);
  border-radius: var(--radius); padding: 0.75rem 1.25rem; margin: 1.5rem 0;
}
.emergency h2 { margin-top: 0.25em; font-size: 1.2em; }
.emergency-list { margin: 0; padding-left: 1.25rem; }
.emergency-list li { margin: 0.35em 0; }
.emergency a { font-weight: 800; }
.text911 { margin: 0.5em 0 0.25em; }
.text911 summary {
  cursor: pointer; font-weight: 800; display: inline-flex; align-items: center;
  min-height: 44px; padding: 0.25rem 0.25rem;
}
.text911 summary span { text-decoration: underline; }
.text911 summary::-webkit-details-marker { display: none; }
.text911 summary::before { content: "\25B8"; display: inline-block; margin-right: 0.4em; text-decoration: none; transition: transform 0.15s; }
.text911[open] summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .text911 summary::before { transition: none; } }
.text911 summary:focus-visible { outline: 3px solid var(--alert-border); outline-offset: 2px; }
.text911 ul { margin: 0.25em 0 0.5em; padding-left: 1.25rem; }
.text911 li { margin: 0.3em 0; }

/* Start here */
.start-grid { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.start-card {
  background: var(--panel); border: 2px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem;
}
.start-card h3 { margin-top: 0.25em; }
.big-phone a {
  display: inline-block; font-size: 1.2em; font-weight: 800;
  padding: 0.5rem 1rem; min-height: 48px; border-radius: var(--radius);
  background: var(--primary); color: var(--on-primary); text-decoration: none;
}
.big-phone a:visited { color: var(--on-primary); }
.big-phone a:hover { background: var(--primary-hover); text-decoration: underline; }

/* Search form */
.finder { margin-top: 1rem; }
.field label, legend { font-weight: 800; font-size: 1.1em; }
.hint { color: var(--muted); margin: 0.2em 0 0.5em; }
.search-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
input[type="search"] {
  font: inherit; flex: 1 1 10rem; min-width: 0; width: 100%; min-height: 52px; padding: 0.5rem 0.75rem;
  color: var(--text); background: var(--bg);
  border: 3px solid var(--border); border-radius: var(--radius);
}
fieldset.tiles { border: 0; padding: 0; margin: 1.5rem 0 1rem; min-width: 0; }
legend { padding: 0; margin-bottom: 0.5rem; }
.tile-grid { display: grid; gap: 0.6rem; grid-template-columns: minmax(0, 1fr); }
.tile { position: relative; }
.tile input {
  position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0;
}
.tile label {
  display: flex; align-items: center; gap: 0.6rem;
  min-height: 56px; padding: 0.6rem 0.9rem; cursor: pointer;
  border: 3px solid var(--border); border-radius: var(--radius);
  background: var(--bg); font-weight: 600;
}
.tile label::before {
  content: ""; flex: 0 0 auto; width: 1.1em; height: 1.1em;
  border: 3px solid currentColor; border-radius: 50%;
}
.tile label:hover { background: var(--panel); }
.tile input:checked + label {
  background: var(--primary); color: var(--on-primary); border-color: var(--primary);
}
.tile input:checked + label::before {
  background: radial-gradient(circle, currentColor 40%, transparent 45%);
}
.tile input:focus-visible + label {
  outline: 4px solid var(--focus); outline-offset: 2px; box-shadow: 0 0 0 7px var(--focus-ring);
}
.tile .count { margin-left: auto; font-weight: 400; font-size: 0.85em; }

/* Results */
.status { font-weight: 700; font-size: 1.05em; }
.group-heading { border-bottom: 3px solid var(--border); padding-bottom: 0.25em; }
.result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
.card {
  border: 2px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem; background: var(--bg); height: 100%;
  min-width: 0; overflow-wrap: anywhere;
}
.card h4 { font-size: 1.15em; margin: 0 0 0.4em; line-height: 1.3; }
.badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.6em; padding: 0; list-style: none; }
.badge {
  font-size: 0.8em; font-weight: 700; padding: 0.1em 0.6em;
  border-radius: 999px; border: 2px solid var(--border); background: var(--panel);
}
.badge-federal { background: var(--badge-federal); }
.badge-state { background: var(--badge-state); }
.badge-county, .badge-city { background: var(--badge-local); }
.badge-org { background: transparent; font-weight: 700; }
.card .label { font-weight: 700; }
.contact { list-style: none; padding: 0; margin: 0.5em 0; }
.contact li { margin: 0.45em 0; }
.contact a { display: inline-block; min-height: 32px; padding: 0.15em 0; font-weight: 700; }
.note { color: var(--muted); font-size: 0.9em; }
.source { color: var(--muted); font-size: 0.85em; margin-top: 0.75em; }
.no-results { background: var(--panel); border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }

/* Footer */
.site-footer { margin-top: 3rem; padding: 1.5rem 0; background: var(--panel); border-top: 3px solid var(--border); }

/* Larger screens */
@media (min-width: 40em) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .start-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 64em) {
  .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-grid-small { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .result-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .tile input:checked + label { outline: 3px solid CanvasText; }
  .badge { border: 1px solid CanvasText; }
}
@media print {
  .finder, .skip-link, #text-size, .start { display: none; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}

.prototype-tag {
  display: inline-block;
  margin-left: 0.35em;
  padding: 0.05em 0.45em;
  font-size: 0.62em;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: middle;
  border: 2px solid currentColor;
  border-radius: 0.3em;
}
.beta-line { font-style: italic; }

/* Page navigation (resource finder <-> Advocacy & Community) */
.page-nav { background: var(--panel); border-bottom: 2px solid var(--border); }
.page-nav ul { list-style: none; margin: 0; padding: 0.6rem 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.page-nav li { flex: 1 1 8em; display: flex; }
.page-nav li a { flex: 1; }
.page-nav a, .page-nav a:visited {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 52px; padding: 0.55rem 1rem; font-weight: 700; text-decoration: none;
  color: var(--primary); background: var(--bg); border: 3px solid var(--primary); border-radius: var(--radius);
}
.page-nav a:hover { background: var(--panel); text-decoration: underline; }
.page-nav a[aria-current="page"], .page-nav a[aria-current="page"]:visited { background: var(--primary); color: var(--on-primary); }
.page-nav a[aria-current="page"]::before { content: "\2713\00a0"; }
.page-link { font-weight: 700; }

/* Advocacy page */
.info-note {
  background: var(--panel); border: 3px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem 1.25rem; margin: 1.5rem 0;
}
.info-note h2 { margin-top: 0.25em; font-size: 1.2em; }
.info-note ul { margin: 0; padding-left: 1.25rem; }
.info-note li { margin: 0.35em 0; }
.search-row .btn-secondary { flex: 0 0 auto; }
.card .card-title { font-size: 1.15em; margin: 0 0 0.4em; line-height: 1.3; }
@media print { .page-nav { display: none; } }

/* Quick level buttons: County / State / Federal / All */
.quick-levels { margin: 0 0 1.25rem; padding: 0; border: 0; }
.quick-levels legend { font-weight: 700; font-size: 1.1em; margin-bottom: 0.4rem; padding: 0; }
.quick-level-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5em, 1fr)); gap: 0.6rem; }
.quick-level-row .btn { min-height: 56px; width: 100%; font-size: 1.1em; }
.quick-level-row .btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.quick-level-row .btn[aria-pressed="true"]::before { content: "\2713\00a0"; }
.quick-levels .legend-like { margin: 0 0 0.4rem; font-size: 1.1em; }

/* County picker (statewide, 2026-10-28) */
.place-picker { margin: 1.25rem 0; padding: 1rem 1.25rem; border: 2px solid var(--primary); border-radius: 10px; }
.place-picker h2 { margin-top: 0; }
.big-select { font: inherit; font-size: 1.15em; min-height: 56px; width: 100%; max-width: 28rem; padding: 0.5rem 0.75rem; border: 2px solid currentColor; border-radius: 8px; background: var(--bg); color: var(--text); }
.county-now { font-weight: 700; margin: 0.6rem 0 0.25rem; }
