/* HealthcareFacilities.org - site styles
   Static, dependency-free. Mobile-first, dark-on-light, YMYL-friendly.
   One stylesheet for the whole directory. No external fonts, URLs, or images.
   Sections: 1 tokens | 2 base | 3 header/logo/nav | 4 main + type | 5 breadcrumbs
             6 cards | 7 tables | 8 lists | 9 CTA | 10 FAQ | 11 disclosures/partner
             12 guide intro | 13 footer | 14 motion | 15 small screens */

/* 1. Design tokens
   Bright "white" theme: pure-white surfaces, light hairline borders, and a
   calm medical-blue accent. Values are self-contained (no external palette). */
:root {
  --ink: #1a2733;
  --muted: #5b6b7a;
  --line: #e4ebf1;
  --line-strong: #c8d5e0;
  --bg: #ffffff;
  --bg-soft: #f6f9fc;
  --bg-warm: #f2f7fd;
  --brand: #1567d3;
  --brand-dark: #0b479e;
  --brand-soft: #e8f1fd;
  --warn: #8a4b08;
  --radius: 10px;
  --radius-sm: 8px;
  --pill: 999px;
  --shadow: 0 1px 2px rgba(16, 34, 48, 0.06);
  --shadow-md: 0 6px 18px rgba(16, 34, 48, 0.09);
  --header-bg: rgba(255, 255, 255, 0.94);
  --mint: #8fb8ff; /* accent on tinted surfaces */
  --wrap: 1080px;
}

/* 2. Base */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font: 16px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--brand-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: auto;
  transition: color 0.15s ease;
}
a:hover { color: var(--brand); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 3px; }

::selection { background: var(--brand-soft); color: var(--brand-dark); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand-dark);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-left: 20px; padding-right: 20px; }

/* 3. Header, logo lockup, nav */
.site-header {
  background: #fff;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(16, 34, 48, 0.035);
  position: sticky;
  top: 0;
  z-index: 20;
  -webkit-backdrop-filter: saturate(1.5) blur(8px);
  backdrop-filter: saturate(1.5) blur(8px);
}
.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  flex-wrap: wrap;
  padding-top: 12px;
  padding-bottom: 12px;
}

/* Logo lockup: wordmark image */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.22rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--brand-dark);
}
.logo-img {
  display: block;
  width: auto;
  height: 38px;
}
.logo-text { color: var(--brand-dark); }
.logo-accent { color: var(--brand); }

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
}
.site-header nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.95rem;
  padding: 5px 8px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.site-header nav a:hover { color: var(--brand-dark); border-bottom-color: var(--brand); }
.site-header nav a[aria-current="page"] { color: var(--brand-dark); border-bottom-color: var(--brand); font-weight: 600; }

/* 4. Main + typography */
main.wrap { padding-top: 28px; padding-bottom: 48px; }

h1, h2, h3 { color: var(--ink); text-wrap: balance; scroll-margin-top: 88px; }
h1 {
  font-size: clamp(1.6rem, 1.15rem + 1.8vw, 2.2rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
h2 {
  font-size: clamp(1.22rem, 1.02rem + 0.85vw, 1.5rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 36px 0 12px;
}
h3 { font-size: 1.08rem; line-height: 1.4; margin: 26px 0 8px; }
p { margin: 0 0 14px; text-wrap: pretty; }

.lede { font-size: 1.09rem; line-height: 1.6; color: var(--muted); max-width: 72ch; margin-bottom: 18px; }
.micro { font-size: 0.86rem; color: var(--muted); }
.crumbs-inline { font-size: 0.92rem; color: var(--muted); }

/* 5. Breadcrumbs */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 16px 0 0; padding: 0; font-size: 0.86rem; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 8px; color: var(--line-strong); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 3px; }

/* 6. Cards */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin: 20px 0 28px; }
.card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}
.card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-md); color: var(--ink); }
.card:focus-visible { border-color: var(--brand); }
.card-kicker { display: block; font-size: 0.74rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 6px; }
.card-title { display: block; font-weight: 700; line-height: 1.35; transition: color 0.16s ease; }
.card-meta { display: block; font-size: 0.88rem; color: var(--muted); margin-top: 5px; }
.card-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.card:hover .card-title { color: var(--brand-dark); }

.chip { display: inline-block; background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--pill); padding: 3px 10px; font-size: 0.79rem; color: var(--muted); white-space: nowrap; }

.hub-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.hub-card { border-top: 3px solid var(--brand); padding-top: 18px; }
.hub-card:hover { border-top-color: var(--brand-dark); }

/* 7. Tables (horizontal scroll on very small screens) */
.stat-table { width: 100%; border-collapse: collapse; margin: 18px 0 28px; background: #fff; }
.stat-table th, .stat-table td { text-align: left; vertical-align: top; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.stat-table th { font-weight: 600; color: var(--muted); width: 42%; }
.stat-table thead th { color: var(--ink); background: var(--bg-soft); border-bottom: 1px solid var(--line-strong); }
.stat-table tbody tr:last-child th, .stat-table tbody tr:last-child td { border-bottom: 0; }

/* 8. Lists */
.list { margin: 14px 0 22px; padding-left: 22px; }
.list li { margin-bottom: 7px; }
.list li::marker { color: var(--brand); }

/* 9. CTA buttons */
.cta {
  display: inline-block;
  background: var(--brand);
  color: #fff !important;
  text-decoration: none;
  padding: 11px 20px;
  border-radius: var(--pill);
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(16, 34, 48, 0.12);
  transition: background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.cta:hover { background: var(--brand-dark); box-shadow: var(--shadow-md); }
.cta:active { transform: translateY(1px); box-shadow: var(--shadow); }

/* 10. FAQ */
.faq { margin: 16px 0 28px; }
.faq details { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 10px; background: #fff; overflow: hidden; }
.faq summary { cursor: pointer; padding: 14px 18px; font-weight: 600; list-style-position: inside; }
.faq summary:hover { color: var(--brand-dark); }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq-a { padding: 12px 18px 14px; color: var(--ink); }
.faq-a p:last-child { margin-bottom: 0; }

/* 11. Disclosures + partner/affiliate blocks */
.compliance {
  margin-top: 44px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.compliance h2 { font-size: 1.08rem; letter-spacing: 0; margin: 0 0 10px; }
.compliance p { font-size: 0.92rem; color: #3d4c59; }
.compliance p:last-child { margin-bottom: 0; }

.partner-block { margin: 34px 0 12px; background: var(--bg-warm); border: 1px solid #d7e6fa; border-radius: var(--radius); padding: 20px 22px; }
.partner-block h2 { margin-top: 0; font-size: 1.14rem; }
.affiliate-note { margin-top: 10px; }

/* 12. Guide intro */
.guide-intro { margin: 6px 0 22px; border-left: 3px solid var(--brand); padding: 2px 0 2px 16px; }
.guide-intro p:last-child { margin-bottom: 0; }

/* 13. Footer (light) */
.site-footer { margin-top: 60px; background: var(--bg-soft); color: var(--muted); border-top: 1px solid var(--line); }
.site-footer .cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 28px 32px; padding-top: 44px; padding-bottom: 30px; }
.site-footer h2 { color: var(--ink); font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer a { color: var(--brand-dark); text-decoration: none; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.site-footer .legal { border-top: 1px solid var(--line); padding-top: 22px; padding-bottom: 34px; font-size: 0.84rem; color: var(--muted); }
.site-footer .legal a { color: var(--brand-dark); }
.site-footer .legal p:last-child { margin-bottom: 0; }
/* Brand focus ring on the light footer. */
.site-footer :focus-visible { outline-color: var(--brand); }

/* 14. Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* 15. Small screens */
@media (max-width: 640px) {
  .bar { padding-top: 10px; padding-bottom: 10px; gap: 8px 12px; }
  .logo { font-size: 1.12rem; gap: 8px; }
  .logo-img { height: 32px; }
  .site-header nav { width: 100%; gap: 0 14px; }
  .site-header nav a { padding: 7px 0; font-size: 0.92rem; }

  /* Let the table scroll sideways instead of squeezing columns. */
  .stat-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .stat-table th { width: auto; min-width: 9rem; }

  .cta { display: block; text-align: center; }
  .site-footer .cols { gap: 24px; padding-top: 36px; }
}

/* 16. Leaflet maps (vendored under /vendor/leaflet + /vendor/markercluster).
   Ported from subsidizedhousing.org and adapted to this palette. The .map-wrap
   z-index creates a stacking context so Leaflet panes (z-index 400-800) stay
   under the sticky header (z-index 20). */
.map-wrap { position: relative; z-index: 0; overflow: hidden; }
.leaflet-container { z-index: 0; }
/* The global img/svg reset above (max-width:100%) would shrink Leaflet tiles
   and marker icons, which the library sizes with inline width/height. */
.leaflet-container .leaflet-tile,
.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-shadow-icon,
.leaflet-container .leaflet-div-icon { max-width: none !important; }

/* Numbered marker pins drawn by /js/map.js: an inline-SVG teardrop with the
   number inside. Fill comes from the brand token; no image assets. */
.housing-marker-icon { background: none; border: 0; }
.housing-marker-pin {
  position: relative;
  display: block;
  width: 32px;
  height: 44px;
  line-height: 0;
  filter: drop-shadow(0 1px 2px rgba(16, 34, 48, 0.35));
}
.housing-marker-pin-shape { fill: var(--brand); stroke: #fff; stroke-width: 1.6; }
.housing-marker-num {
  position: absolute;
  top: 10px;
  left: 0;
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.housing-marker-num.is-wide { top: 11.5px; font-size: 9px; letter-spacing: -0.02em; }

/* Selected-pin glow (ported verbatim from source site.css). */
.leaflet-marker-icon.housing-marker-selected { filter: drop-shadow(0 0 2px var(--brand)); }

/* ---------------------------------------------------------------------------
   AdSense display units
   Ported from subsidizedhousing.org and adapted to this site's palette.
   The wrapper reserves no height until filled; empty/unfilled units collapse
   to a faint placeholder so layout stays stable (no CLS). The phone-only unit
   is hidden on desktop and the sidebar unit is hidden on mobile.
   --------------------------------------------------------------------------- */
body { overflow-x: clip; }

.ad-unit { position: relative; z-index: 1; margin: 24px 0; max-width: 100%; text-align: center; min-height: 0; }
.ad-unit-tag {
  display: block; width: max-content; max-width: 100%; margin: 0 auto 8px;
  background: var(--bg-soft); color: var(--muted);
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 10px; border-radius: var(--pill); line-height: 1.5;
}
.ad-unit .adsbygoogle { display: block; margin: 0 auto; }
.ad-unit--fixed .adsbygoogle { margin: 0 auto; }
.ad-unit .adsbygoogle:empty,
.ad-unit .adsbygoogle[data-ad-status="unfilled"] {
  background: var(--bg-soft); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
}
.ad-unit:not(.ad-unit--fixed) .adsbygoogle:empty,
.ad-unit:not(.ad-unit--fixed) .adsbygoogle[data-ad-status="unfilled"] { min-height: 120px; }

/* Phone-only unit: hidden on desktop, shown on small screens. */
.ad-unit--mobile { display: none; }

/* The pre-footer unit sits just above the disclaimer. */
.ad-unit--prefooter { margin-top: 32px; }

@media (max-width: 900px) {
  .ad-unit--sidebar { display: none; }
  .ad-unit--mobile { display: block; }
  /* Full-bleed only on phones so fixed-size units are never clipped by padding. */
  .ad-unit { width: 100vw; max-width: none; margin-left: calc(50% - 50vw); margin-right: 0; }
}

@media (max-width: 640px) {
  .ad-unit { margin: 20px 0; }
  .ad-unit:not(.ad-unit--fixed) .adsbygoogle:empty,
  .ad-unit:not(.ad-unit--fixed) .adsbygoogle[data-ad-status="unfilled"] { min-height: 100px; }
}
