/* CareCost Compass — site styles. No external dependencies. */
:root {
  --ink: #12232e;
  --ink-soft: #3d5866;
  --muted: #6b7f8a;
  --line: #e2e8ec;
  --line-strong: #cfdae1;
  --bg: #ffffff;
  --bg-soft: #f6f9fa;
  --bg-tint: #eef5f7;
  --brand: #0d6e79;
  --brand-dark: #08505a;
  --brand-soft: #e3f1f2;
  --accent: #b8562b;
  --accent-soft: #fdf0e9;
  --ok: #2f7d4f;
  --ok-soft: #e9f5ee;
  --warn: #8a6212;
  --warn-soft: #fdf6e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(18, 35, 46, .06), 0 6px 20px rgba(18, 35, 46, .06);
  --shadow-lg: 0 10px 40px rgba(18, 35, 46, .12);
  --wrap: 1120px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  font-size: 17px;
}

h1, h2, h3, h4 { line-height: 1.25; color: var(--ink); margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(1.85rem, 4.2vw, 2.7rem); }
h2 { font-size: clamp(1.4rem, 2.8vw, 1.9rem); }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1rem; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.2rem; }
li { margin: .35rem 0; }
small { font-size: .82rem; }

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

/* ---------- header ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .92);
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(8px);
}
.site-header .wrap { display: flex; align-items: center; gap: 18px; min-height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.06rem; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  background: linear-gradient(145deg, var(--brand) 0%, var(--brand-dark) 100%);
  color: #fff; display: grid; place-items: center; font-size: .95rem; font-weight: 800;
}
.nav { margin-left: auto; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--ink-soft); font-size: .93rem; font-weight: 500;
  padding: 7px 11px; border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--bg-tint); color: var(--brand-dark); text-decoration: none; }
.nav a.nav-cta { background: var(--brand); color: #fff; font-weight: 600; }
.nav a.nav-cta:hover { background: var(--brand-dark); }

/* ---------- hero ---------- */
.hero {
  background: linear-gradient(170deg, var(--bg-tint) 0%, #fff 78%);
  border-bottom: 1px solid var(--line);
  padding: 54px 0 46px;
}
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: 46px; align-items: center; }
.hero h1 { margin-bottom: .35em; }
.hero .lede { font-size: 1.1rem; color: var(--ink-soft); margin-bottom: 1.4em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.eyebrow {
  display: inline-block; font-size: .76rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--brand); background: var(--brand-soft);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-block; padding: 12px 22px; border-radius: var(--radius-sm);
  font-weight: 650; font-size: .97rem; border: 1px solid transparent; cursor: pointer;
  font-family: inherit; line-height: 1.3; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--brand-dark); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--bg-soft); }

/* ---------- sections ---------- */
section { padding: 46px 0; }
.section-alt { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 26px; }
.section-head p { color: var(--ink-soft); max-width: 62ch; margin-bottom: 0; }

/* ---------- cards + grid ---------- */
.grid { display: grid; gap: 18px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: .35em; }
.card p:last-child { margin-bottom: 0; }
.card-link { display: block; color: inherit; }
.card-link:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow-lg); }
.card .price { font-size: 1.65rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -.02em; display: block; line-height: 1.1; }
.card .price-sub { color: var(--muted); font-size: .86rem; }

/* ---------- stat strip ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.stat .v { font-size: 1.5rem; font-weight: 800; color: var(--brand-dark); letter-spacing: -.02em; }
.stat .k { font-size: .84rem; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); font-weight: 700; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-soft); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.trend-up { color: var(--accent); font-weight: 600; }

/* ---------- tags ---------- */
.tag {
  display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 5px; vertical-align: middle;
}
.tag-survey { background: var(--ok-soft); color: var(--ok); }
.tag-modeled { background: var(--warn-soft); color: var(--warn); }
.tag-neutral { background: var(--bg-tint); color: var(--ink-soft); }

.note {
  background: var(--brand-soft); border-left: 3px solid var(--brand);
  padding: 14px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .93rem; color: var(--ink-soft);
}
.note.warn { background: var(--warn-soft); border-left-color: var(--warn); }

/* ---------- calculator ---------- */
.calc { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 26px; align-items: start; }
.calc-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
.field select, .field input[type=number], .field input[type=range] { width: 100%; font-family: inherit; }
.field select, .field input[type=number] {
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 1rem; background: #fff; color: var(--ink);
}
.field input[type=range] { accent-color: var(--brand); margin-top: 4px; }
.field .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.range-val { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand-dark); min-width: 84px; text-align: right; }

.result-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.result-hero { background: linear-gradient(145deg, var(--brand) 0%, var(--brand-dark) 100%); color: #fff; padding: 24px; }
.result-hero .label { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.result-hero .big { font-size: clamp(2.1rem, 5vw, 2.9rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.result-hero .big-sub { opacity: .9; font-size: .95rem; }
.result-rows { padding: 6px 0; }
.result-row { display: flex; justify-content: space-between; gap: 14px; padding: 11px 24px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.result-row:last-child { border-bottom: none; }
.result-row .k { color: var(--ink-soft); }
.result-row .v { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.result-row .v.pos { color: var(--ok); }
.result-row .v.neg { color: var(--accent); }
.runway-bar { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 8px; }
.runway-bar > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .25s ease; }

/* ---------- state page ---------- */
.crumbs { font-size: .84rem; color: var(--muted); padding: 16px 0 0; }
.crumbs a { color: var(--muted); }
.page-head { padding: 22px 0 8px; }
.page-head .lede { color: var(--ink-soft); font-size: 1.06rem; max-width: 68ch; }
.rank-badge { display: inline-flex; align-items: center; gap: 8px; background: var(--bg-tint); color: var(--ink-soft); border-radius: 999px; padding: 5px 13px; font-size: .84rem; font-weight: 600; }

.state-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }
.state-chip {
  display: flex; justify-content: space-between; gap: 8px; align-items: baseline;
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 12px;
  background: #fff; font-size: .92rem; color: var(--ink);
}
.state-chip:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.state-chip .c { font-weight: 700; color: var(--brand-dark); font-variant-numeric: tabular-nums; }

/* ---------- directory (nursing homes) ---------- */
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; font-weight: 400; }
.tag-warn { background: var(--accent-soft); color: var(--accent); }

.stars { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.stars-5 { color: var(--ok); }
.stars-4 { color: var(--ok); }
.stars-3 { color: var(--ink-soft); }
.stars-2, .stars-1 { color: var(--accent); }

th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
th[data-sort]:hover { color: var(--brand); }
th[data-sort]::after { content: "\2195"; opacity: .35; margin-left: 6px; font-size: .9em; }
th[data-sort].asc::after { content: "\2191"; opacity: 1; }
th[data-sort].desc::after { content: "\2193"; opacity: 1; }

table.fac { font-size: .9rem; }
table.fac th, table.fac td { padding: 9px 12px; }
table.fac td:first-child { min-width: 190px; }

.dir-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 16px; }
.dir-controls input[type=search] {
  flex: 1 1 240px; padding: 10px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); font: inherit; font-size: .95rem; background: #fff;
}
.dir-controls select { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-size: .95rem; background: #fff; }
.dir-count { color: var(--muted); font-size: .88rem; }

.grid-4 .card h3, .grid-3 .card h3 { font-size: 1rem; }
.card-foot { display: block; margin-top: 10px; color: var(--brand-dark); font-size: .85rem; font-weight: 600; }

.fac-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 26px; align-items: start; }
@media (max-width: 900px) { .fac-head { grid-template-columns: 1fr; } }
.fac-addr { color: var(--ink-soft); font-size: .95rem; }
.rating-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 10px; }
.rating-grid .stat { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; background: #fff; }
.rating-grid .stat .v { font-size: 1.25rem; }
.rating-grid .stat .k { font-size: .72rem; }
.city-list { columns: 3 190px; column-gap: 20px; list-style: none; padding: 0; margin: 0; }
.city-list li { break-inside: avoid; margin: .25rem 0; font-size: .93rem; }
.city-list .n { color: var(--muted); font-size: .82rem; }

/* ---------- prose ---------- */
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.6em; }
.prose h3 { margin-top: 1.4em; }
.prose table { margin: 1.2em 0; }

.faq { border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); padding: 6px 0; }
.faq summary { cursor: pointer; font-weight: 650; padding: 12px 0; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "+"; color: var(--brand); font-weight: 800; margin-right: 10px; }
.faq details[open] summary::before { content: "\2212"; }
.faq details p { color: var(--ink-soft); }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #c3d2d9; padding: 40px 0 30px; margin-top: 0; font-size: .92rem; }
.site-footer a { color: #dfeaf0; }
.site-footer h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr 1fr 1fr; gap: 26px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li { margin: .3rem 0; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); margin-top: 28px; padding-top: 18px; color: #93a8b3; font-size: .85rem; }
.disclaimer { color: #93a8b3; font-size: .84rem; line-height: 1.55; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: #fff; padding: 8px 14px; border-radius: 6px; z-index: 100; }

@media (max-width: 940px) {
  .hero .wrap { grid-template-columns: 1fr; gap: 30px; }
  .grid-3, .grid-4, .stats { grid-template-columns: repeat(2, 1fr); }
  .calc { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  .grid-3, .grid-4, .grid-2, .stats { grid-template-columns: 1fr; }
  .nav a { padding: 6px 8px; font-size: .88rem; }
  .nav a.nav-cta { display: none; }
  section { padding: 34px 0; }
  .footer-grid { grid-template-columns: 1fr; }
}
