/* CareMap shared design system.
   Light is the default: this is a public-records research tool, so the base
   surface follows document and map conventions. Dark mode is user-selected. */
:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --bg-2: #ffffff;
  --bg-3: #e9efed;
  --panel: rgba(255, 255, 255, 0.96);
  --panel-solid: #ffffff;
  --border: rgba(20, 48, 42, 0.15);
  --border-strong: rgba(20, 48, 42, 0.28);
  --text: #182622;
  --muted: #52645f;
  --muted-2: #75837f;
  --accent: #075f6b;
  --accent-strong: #064c56;
  --brand: #0f766e;
  --brand-deep: #0b5f59;
  --brand-soft: #e3f1ef;
  --control: rgba(20, 48, 42, 0.055);
  --control-hover: rgba(15, 118, 110, 0.10);
  --overlay: rgba(9, 19, 16, 0.48);
  --g-a: #16845f;
  --g-b: #669313;
  --g-c: #b27b00;
  --g-d: #c65f12;
  --g-f: #c43d3d;
  --g-u: #71807b;
  --radius: 5px;
  --icon-stroke: 2.25;
  --shadow: 0 14px 36px rgba(24, 38, 34, 0.14);
  --font: Verdana, Geneva, sans-serif;
  --font-display: "Trebuchet MS", "Avenir Next", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1312;
  --bg-2: #131b19;
  --bg-3: #1a2522;
  --panel: rgba(19, 27, 25, 0.96);
  --panel-solid: #131b19;
  --border: rgba(225, 240, 235, 0.12);
  --border-strong: rgba(225, 240, 235, 0.24);
  --text: #edf3f1;
  --muted: #a2b1ac;
  --muted-2: #71817c;
  --accent: #75cbd0;
  --accent-strong: #a0e0e3;
  --brand: #4fc3ae;
  --brand-deep: #178879;
  --brand-soft: #18312c;
  --control: rgba(255, 255, 255, 0.055);
  --control-hover: rgba(117, 203, 208, 0.12);
  --overlay: rgba(0, 0, 0, 0.66);
  --g-a: #4fc38f;
  --g-b: #a2c95a;
  --g-c: #e5bd4f;
  --g-d: #e9904c;
  --g-f: #e66c6c;
  --g-u: #71817c;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.44);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
body { font-size: 15px; line-height: 1.55; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 {
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: 0;
}
button, input, select, textarea { font: inherit; }
.lucide { stroke-width: var(--icon-stroke); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
  text-decoration: none;
}
.btn:hover {
  background: var(--control-hover);
  border-color: var(--accent);
  text-decoration: none;
}
.btn.primary {
  background: var(--brand-deep);
  border-color: var(--brand-deep);
  color: #fff;
}
.btn.primary:hover { background: var(--brand); border-color: var(--brand); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }

.map-scope-switch {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--control);
}
.map-scope-switch a {
  display: inline-flex;
  min-height: 27px;
  align-items: center;
  justify-content: center;
  padding: 4px 9px;
  border-radius: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.map-scope-switch a:hover {
  color: var(--text);
  text-decoration: none;
}
.map-scope-switch a.active {
  background: var(--bg-2);
  color: var(--brand-deep);
  box-shadow: 0 1px 2px rgba(20,48,42,.14);
}

.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  flex: none;
}
.grade.sm { width: 22px; height: 22px; border-radius: 3px; font-size: 12px; }
.grade.A { background: var(--g-a); }
.grade.B { background: var(--g-b); }
.grade.C { background: var(--g-c); }
.grade.D { background: var(--g-d); }
.grade.F { background: var(--g-f); }
.grade.Unrated { background: var(--g-u); font-size: 10px; }

.badge {
  display: inline-block;
  padding: 2px 7px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--control);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.badge.warn { color: var(--g-f); border-color: color-mix(in srgb, var(--g-f) 45%, transparent); background: color-mix(in srgb, var(--g-f) 9%, transparent); }
.badge.pro { color: var(--g-c); border-color: color-mix(in srgb, var(--g-c) 45%, transparent); background: color-mix(in srgb, var(--g-c) 9%, transparent); }

.container { width: min(100% - 40px, 1120px); margin-inline: auto; }

caremap-nav {
  display: block;
  min-height: 59px;
  position: sticky;
  top: 0;
  z-index: 50;
}
caremap-nav .nav { position: static; }
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  backdrop-filter: blur(14px);
}
.nav .inner { display: flex; align-items: baseline; gap: 18px; min-height: 58px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 21px;
  height: 18px;
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  color: var(--brand-deep);
  transform: skewY(-10deg);
  flex: none;
}
.brand .mark i {
  width: 5px;
  display: block;
  background: currentColor;
}
.brand .mark i:nth-child(2) {
  opacity: .55;
  transform: translateY(2px);
}
.nav .links { display: flex; align-items: baseline; gap: 19px; margin-left: auto; }
.nav .links .theme-toggle, .nav .links .btn { align-self: center; }
.nav .links a { color: var(--muted); font-size: 13px; font-weight: 700; }
.nav .links a:hover { color: var(--text); text-decoration: none; }
.nav .links a[aria-current="page"] { color: var(--text); }
.nav .links .btn.primary { color: #fff; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle svg { display: block; }
.theme-toggle:hover { background: var(--control-hover); color: var(--text); border-color: var(--border-strong); }

@media (max-width: 720px) {
  .container { width: min(100% - 28px, 1120px); }
  .nav .brand > span:last-child { display: none; }
  .nav .links { gap: 8px; }
  .nav .links a.hide-sm { display: none; }
  .nav .links .btn.primary { padding-inline: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

/* ---- Skeleton loading placeholders ------------------------------------
   Instant, layout-preserving stand-ins shown while data streams in. Kept
   in the shared sheet so every page (explore, global, drawers) matches. */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--control);
  border-radius: 4px;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg,
    transparent, color-mix(in srgb, var(--text) 9%, transparent), transparent);
  animation: sk-shimmer 1.25s ease-in-out infinite;
}
@keyframes sk-shimmer { 100% { transform: translateX(100%); } }

.sk-line { height: 12px; margin: 8px 0; }
.sk-line.sm { height: 9px; }
.sk-line.lg { height: 18px; }
.sk-line.w40 { width: 40%; }
.sk-line.w60 { width: 60%; }
.sk-line.w80 { width: 80%; }
.sk-block { border-radius: var(--radius); }
.sk-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px 0; }
.sk-stat { height: 56px; border-radius: var(--radius); }
.sk-badge { width: 60px; height: 24px; border-radius: 999px; }

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { animation: none; }
}
