/* OpenShelterAZ styles. Colors are tokens so light and dark stay in sync. */

@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("/assets/fonts/atkinson-next.woff2?v=1") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "Lexend";
  src: url("/assets/fonts/lexend.woff2?v=1") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #FBF8F4; --surf: #FFFFFF; --s2: #F1EBE3; --border: #E2D9CE; --input-bd: #8A949F;
  --text: #1F2A37; --heading: #1B2532; --muted: #56606C; --navy: #3D4C5F; --on-navy: #FFFFFF;
  --accent: #A35F3C; --accent-fill: #A35F3C; --on-accent: #FFFFFF; --link: #2A5E99;
  --strip: #2B3746; --strip-text: #FFFFFF; --exit: #B42318;
  --alert-bg: #E8F1FB; --alert-bd: #BFD5EE; --alert-text: #163A63;
  --badge-bg: #FCEBDD; --badge-text: #7A3E1C; --ok: #1E6B45; --closed: #8A2B1E;
  --c-cool: #2F6FB3; --c-water: #0E7C7B; --c-warm: #C2410C; --c-shelter: #3D4C5F; --c-safety: #7A4FB0; --c-pets: #A35F3C;
  --t-cool: #E6EFF9; --t-water: #E0F2F1; --t-warm: #FCE9DF; --t-shelter: #E9EDF2; --t-safety: #F0E9F8; --t-pets: #F7E8DF;
  --shadow: 0 1px 2px rgba(31, 42, 55, 0.06);
  --logo-a: #3D4C5F; --logo-b: #A35F3C;
  --focus: #1F64C8;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11161D; --surf: #19212B; --s2: #243040; --border: #2E3A48; --input-bd: #5B6878;
    --text: #E9EDF2; --heading: #F4F6F9; --muted: #A9B4C1; --navy: #B9C7D8; --on-navy: #11161D;
    --accent: #E0966F; --accent-fill: #E0966F; --on-accent: #1B1410; --link: #9DC3F0;
    --strip: #0A0E13; --strip-text: #F4F6F9; --exit: #C8372B;
    --alert-bg: #1C2A3D; --alert-bd: #2F4866; --alert-text: #CFE2FA;
    --badge-bg: #3A2A1C; --badge-text: #F6C9A6; --ok: #6FCF97; --closed: #FF9A8C;
    --c-cool: #7FB2EA; --c-water: #5CC8C7; --c-warm: #F4935E; --c-shelter: #B9C7D8; --c-safety: #B99AE6; --c-pets: #E0966F;
    --t-cool: #1B2B40; --t-water: #14302F; --t-warm: #3A2418; --t-shelter: #243040; --t-safety: #2C2240; --t-pets: #3A2A1C;
    --shadow: none; --logo-a: #DCE3EC; --logo-b: #E0966F; --focus: #8AB8FF;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11161D; --surf: #19212B; --s2: #243040; --border: #2E3A48; --input-bd: #5B6878;
  --text: #E9EDF2; --heading: #F4F6F9; --muted: #A9B4C1; --navy: #B9C7D8; --on-navy: #11161D;
  --accent: #E0966F; --accent-fill: #E0966F; --on-accent: #1B1410; --link: #9DC3F0;
  --strip: #0A0E13; --strip-text: #F4F6F9; --exit: #C8372B;
  --alert-bg: #1C2A3D; --alert-bd: #2F4866; --alert-text: #CFE2FA;
  --badge-bg: #3A2A1C; --badge-text: #F6C9A6; --ok: #6FCF97; --closed: #FF9A8C;
  --c-cool: #7FB2EA; --c-water: #5CC8C7; --c-warm: #F4935E; --c-shelter: #B9C7D8; --c-safety: #B99AE6; --c-pets: #E0966F;
  --t-cool: #1B2B40; --t-water: #14302F; --t-warm: #3A2418; --t-shelter: #243040; --t-safety: #2C2240; --t-pets: #3A2A1C;
  --shadow: none; --logo-a: #DCE3EC; --logo-b: #E0966F; --focus: #8AB8FF;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem; line-height: 1.5;
}
h1, h2, h3 { font-family: Lexend, system-ui, sans-serif; font-weight: 600; color: var(--heading); line-height: 1.2; }
a { color: var(--link); text-underline-offset: 0.15em; }
img, svg { max-width: 100%; }
.ico { flex: 0 0 auto; vertical-align: middle; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.wrap { max-width: 1360px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
@media (min-width: 700px) { .wrap { padding-left: 24px; padding-right: 24px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.small { font-size: 0.875rem; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }

.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; background: var(--surf); color: var(--text); border-radius: 8px; font-weight: 700; }
.skip:focus { top: 12px; }

/* Safety strip */
.strip { background: var(--strip); color: var(--strip-text); font-size: 0.9375rem; }
.strip a { color: var(--strip-text); font-weight: 700; }
.strip-in { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 22px; padding-top: 6px; padding-bottom: 6px; }
.strip-item { margin: 0; }
.strip-strong { font-weight: 700; }
.strip-exit { margin: 0 0 0 auto; display: flex; align-items: center; gap: 10px; }
.exit-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; background: var(--exit); color: #FFFFFF !important; text-decoration: none; font-weight: 700; }
.exit-hint { font-size: 0.8125rem; opacity: 0.9; }
@media (max-width: 699px) {
  .strip-item:nth-child(3) { display: none; }
  .exit-hint { display: none; }
}

/* Header */
.site-header { background: var(--surf); border-bottom: 1px solid var(--border); }
.header-in { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--logo-a); }
.logo-house { stroke: var(--logo-a); }
.logo-heart { fill: var(--logo-b); }
.wordmark { font-family: Lexend, system-ui, sans-serif; font-weight: 600; font-size: 1.5rem; letter-spacing: -0.01em; color: var(--logo-a); }
.wm-accent { color: var(--accent); }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--s2); }
.nav a[aria-current="page"] { background: var(--s2); font-weight: 700; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.lang-link { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border: 1.5px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 700; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--border); border-radius: 999px; background: transparent; color: var(--text); cursor: pointer; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: inline; }
:root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .i-sun { display: inline; }
  :root[data-theme="auto"] .i-moon { display: none; }
}
.lang-short { display: none; }
@media (max-width: 699px) {
  .header-in { column-gap: 10px; padding-top: 8px; padding-bottom: 8px; }
  .wordmark { font-size: 1.2rem; }
  .brand .logo-mark { width: 36px; height: 34px; }
  .site-header nav { order: 3; width: 100%; }
  .nav { justify-content: space-between; }
  .nav a { padding: 0 10px; }
  .lang-full { display: none; }
  .lang-short { display: inline; }
  .lang-link { padding: 0 12px; }
  /* On phones, "What do you need?" comes before the search box */
  .finder { display: flex; flex-direction: column; }
  .finder > h1, .finder > .intro, .finder > noscript { order: 0; }
  .need-h { order: 1; margin-top: 18px; }
  .pills { order: 2; }
  .search { order: 3; }
  .near-note { order: 4; }
}

/* Weather alert */
.alert { background: var(--alert-bg); border-bottom: 1px solid var(--alert-bd); color: var(--alert-text); }
.alert-in { display: flex; gap: 12px; align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.alert a { color: var(--alert-text); font-weight: 700; }
.alert-list { list-style: none; margin: 0; padding: 0; }
.alert-meta { margin: 4px 0 0; font-size: 0.9375rem; }

/* Finder */
.finder { padding-top: 32px; padding-bottom: 12px; }
.finder h1 { font-size: clamp(1.6rem, 1.1rem + 2vw, 2.5rem); margin: 0; max-width: 840px; letter-spacing: -0.015em; }
.intro { margin: 10px 0 0; color: var(--muted); max-width: 760px; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--s2); }
.search { margin-top: 22px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-grow { flex: 1 1 280px; max-width: 460px; }
.field label { font-weight: 700; font-size: 0.9375rem; }
input[type="text"], input[type="search"], input[type="email"], select, textarea {
  min-height: 50px; padding: 0 14px; border: 1.5px solid var(--input-bd); border-radius: 12px;
  background: var(--surf); color: var(--text); font: inherit;
}
textarea { padding: 12px 14px; min-height: 160px; resize: vertical; }
.near-note { margin: 8px 0 0; }
.need-h { font-family: inherit; font-size: 1rem; font-weight: 700; margin: 24px 0 10px; }
.pills { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pill {
  min-height: 46px; padding: 0 16px 0 12px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; border: 1.5px solid var(--border); background: var(--surf); color: var(--text);
  font: inherit; font-weight: 700; cursor: pointer;
}
.pill:hover { border-color: var(--navy); }
.pill[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.pill-ico { display: inline-flex; }
.pill-ico-cool { color: var(--c-cool); } .pill-ico-water { color: var(--c-water); } .pill-ico-warm { color: var(--c-warm); }
.pill-ico-shelter { color: var(--c-shelter); } .pill-ico-safety { color: var(--c-safety); } .pill-ico-pets { color: var(--c-pets); }
.pill[aria-pressed="true"] .pill-ico { color: var(--on-navy); }
.pill-sep { width: 1px; height: 32px; background: var(--border); margin: 0 4px; }
.pill-toggle[aria-pressed="true"] { background: var(--badge-bg); color: var(--badge-text); border-color: var(--accent); }
.switch { width: 38px; height: 22px; border-radius: 999px; background: var(--input-bd); display: inline-flex; align-items: center; padding: 2px; }
.switch span { width: 18px; height: 18px; border-radius: 999px; background: #FFFFFF; transition: transform 0.15s; }
.pill-toggle[aria-pressed="true"] .switch { background: var(--accent-fill); }
.pill-toggle[aria-pressed="true"] .switch span { transform: translateX(16px); }
@media (max-width: 699px) {
  .pills { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 6px; margin-right: -16px; padding-right: 16px; scrollbar-width: thin; }
  .pill { flex: 0 0 auto; white-space: nowrap; }
}

/* Buttons */
.btn {
  min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 10px; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border: 1.5px solid transparent; line-height: 1.2;
}
.btn-primary { background: var(--accent-fill); color: var(--on-accent); }
.btn-secondary, .btn-outline { border-color: var(--navy); color: var(--navy); background: transparent; }
.btn-link { background: transparent; color: var(--link); text-decoration: underline; padding: 0 8px; }
.btn-note { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 700; }

/* Results */
.results { display: flex; flex-wrap: wrap; gap: 24px; padding-top: 8px; padding-bottom: 40px; align-items: flex-start; }
.list-col { flex: 1 1 440px; min-width: 0; max-width: 620px; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 10px; }
.count { margin: 0; font-weight: 700; }
.list-head .small { margin: 0; }
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.card article { background: var(--surf); border: 1px solid var(--border); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card.is-selected article { border: 2px solid var(--accent); }
.card-top { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: flex-start; }
.tile { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; }
.tile-cool { background: var(--t-cool); color: var(--c-cool); } .tile-water { background: var(--t-water); color: var(--c-water); }
.tile-warm { background: var(--t-warm); color: var(--c-warm); } .tile-shelter { background: var(--t-shelter); color: var(--c-shelter); }
.tile-safety { background: var(--t-safety); color: var(--c-safety); } .tile-pets { background: var(--t-pets); color: var(--c-pets); }
.card-title { flex: 1 1 200px; min-width: 0; }
.card h3 { margin: 0; font-size: 1.2rem; }
.org { margin: 2px 0 0; font-size: 0.9375rem; color: var(--muted); }
.card-status { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
.card-status:empty { display: none; }
.status-now, .dist, .badge { font-size: 0.8125rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge { background: var(--badge-bg); color: var(--badge-text); }
.dist { background: var(--s2); color: var(--text); }
.status-now.is-open { background: var(--t-water); color: var(--ok); }
.status-now.is-closed { background: var(--s2); color: var(--closed); }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { font-size: 0.875rem; font-weight: 600; padding: 3px 10px; border-radius: 8px; background: var(--s2); }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts .ico { color: var(--muted); margin-top: 2px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.src { margin: 0; padding-top: 8px; border-top: 1px solid var(--border); font-size: 0.84rem; color: var(--muted); }
.empty { padding: 20px; border: 1.5px dashed var(--border); border-radius: 16px; color: var(--muted); }
.hotline-panel { margin-bottom: 14px; }
.hotlines { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hotline { background: var(--surf); border: 1px solid var(--border); border-left-width: 1px; border-radius: 14px; padding: 14px 16px; }
.hotline h3 { margin: 0 0 4px; font-size: 1.05rem; }
.hotline-meta { margin: 0 0 8px; color: var(--muted); font-size: 0.9375rem; }

/* Map */
.map-col { flex: 999 1 480px; min-width: 0; position: sticky; top: 12px; }
.map-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.map-head h2 { margin: 0; font-size: 1rem; font-family: inherit; font-weight: 700; }
.map-head p { margin: 0; }
.map { height: calc(100vh - 170px); min-height: 420px; max-height: 820px; border-radius: 18px; overflow: hidden; border: 1px solid var(--border); background: var(--s2); }
.map-msg { padding: 24px; color: var(--muted); }
.map-toggle { display: none; }
@media (max-width: 999px) {
  .map-col { position: static; flex-basis: 100%; order: -1; display: none; }
  .map-col.is-open { display: block; }
  .map { height: 60vh; min-height: 320px; }
  .map-toggle { display: inline-flex; }
}
.map-wrap { position: relative; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 10px; font-size: 0.875rem; font-weight: 600; }
.map-legend-h { margin: 0; font-weight: 700; }
.map-legend ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.map-legend li { display: inline-flex; align-items: center; gap: 6px; }
.lpin { flex: none; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.35)); }
.map-col:fullscreen { background: var(--bg); padding: 12px; }
.map-col:fullscreen .map { height: calc(100vh - 70px); max-height: none; }
.map-reset { display: flex; align-items: center; justify-content: center; color: #1F2A37; }

/* Map popups follow the site theme */
.maplibregl-popup { z-index: 3; }
.maplibregl-popup-content {
  font-family: inherit; background: var(--surf); color: var(--text); border-radius: 14px;
  padding: 14px 16px 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22); border: 1px solid var(--border);
}
.maplibregl-popup-anchor-bottom .maplibregl-popup-tip, .maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip { border-top-color: var(--surf); }
.maplibregl-popup-anchor-top .maplibregl-popup-tip, .maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.maplibregl-popup-anchor-top-right .maplibregl-popup-tip { border-bottom-color: var(--surf); }
.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--surf); }
.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--surf); }
.maplibregl-popup-close-button {
  width: 36px; height: 36px; top: 4px; right: 4px; font-size: 24px; line-height: 1; color: var(--muted);
  border-radius: 999px; background: transparent;
}
.maplibregl-popup-close-button:hover { background: var(--s2); color: var(--text); }
.pop { display: flex; flex-direction: column; gap: 4px; padding-right: 22px; font-size: 0.9rem; line-height: 1.4; }
.pop p { margin: 0; }
.pop-kind { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pop-kind-cool { color: var(--c-cool); } .pop-kind-water { color: var(--c-water); } .pop-kind-warm { color: var(--c-warm); }
.pop-kind-shelter { color: var(--c-shelter); } .pop-kind-safety { color: var(--c-safety); } .pop-kind-pets { color: var(--c-pets); }
.pop-name { font-family: Lexend, system-ui, sans-serif; font-weight: 600; font-size: 1.05rem; color: var(--heading); }
.pop-org { color: var(--muted); }
.pop-status { align-self: flex-start; font-size: 0.75rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin: 2px 0; }
.pop-status.is-open { background: var(--t-water); color: var(--ok); }
.pop-status.is-closed { background: var(--s2); color: var(--closed); }
.pop-fact { color: var(--text); }
.pop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 8px; }
.pop-btn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 9px; border: 1.5px solid var(--navy); color: var(--navy); font-weight: 700; text-decoration: none; }
.pop-btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.pop-link { font: inherit; font-weight: 700; color: var(--link); background: none; border: 0; padding: 8px 0; text-decoration: underline; cursor: pointer; }

/* Back to top */
.to-top {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; min-height: 48px; padding: 0 16px 0 12px;
  display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; border: 0;
  background: var(--navy); color: var(--on-navy); font: inherit; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
@media (max-width: 699px) { .to-top span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .to-top { padding: 0; width: 48px; justify-content: center; } }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surf); margin-top: 24px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 24px 56px; padding-top: 32px; padding-bottom: 36px; }
.footer-col { flex: 1 1 360px; min-width: 0; }
.footer-col h2 { font-size: 1.2rem; margin: 0 0 10px; }
.footer-col p { color: var(--muted); }
.credits { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; font-weight: 700; }

/* Simple pages */
.prose { max-width: 820px; padding-top: 32px; padding-bottom: 40px; }
.prose h1 { font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.25rem); margin: 0 0 12px; }
.prose h2 { font-size: 1.35rem; margin: 32px 0 8px; }
.prose li { margin-bottom: 6px; }
.lead { font-size: 1.15rem; }
.help-now { background: var(--surf); border: 1px solid var(--border); border-radius: 16px; padding: 4px 20px 20px; margin: 20px 0 8px; }
.contact-form { display: flex; flex-direction: column; gap: 16px; max-width: 640px; }
.contact-form .field input, .contact-form .field select, .contact-form .field textarea { width: 100%; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .strip, .site-header nav, .header-tools, .search, .pills, .map-col, .actions, .near-note, .need-h { display: none !important; }
  .card article { box-shadow: none; break-inside: avoid; }
}
