/* ==========================================================================
   Mirador Living | The Retirement Care Gap | research page styles
   Story-first version: photo hero, key findings, a full-width map, and a
   calm rankings explorer. Palette and components mirror miradorliving.com.
   Type: Merriweather (brand serif) + Inter (body).
   ========================================================================== */

:root {
  /* Mirador brand scale (from their site) */
  --brand-800: #174237;
  --brand-700: #2c5a4d;
  --brand-600: #4b7161;
  --brand-500: #6a8978;
  --brand-400: #8aa091;
  --brand-200: #c9d2c8;
  --brand-100: #e8ede6;
  --brand-tint: #f3f6f1;

  /* Neutrals */
  --paper: #fafaf9;
  --paper-2: #f3f4f3;
  --line: #e4e5e4;
  --line-soft: #efefee;
  --ink: #272827;
  --ink-2: #3f4040;
  --muted: #717272;
  --muted-2: #9fa09f;
  --accent: #b88a5d;

  --font-display: 'Merriweather', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --font-wordmark: 'Merriweather Wordmark', Georgia, serif;

  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 66, 55, .06), 0 1px 3px rgba(23, 66, 55, .05);
  --shadow-md: 0 4px 14px rgba(23, 66, 55, .10);
  --wrap: 1120px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font: 400 16.5px/1.62 var(--font-body);
  color: var(--ink-2);
  background: #fff;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-700); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 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;
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--brand-700); color: #fff; padding: 10px 16px;
  border-radius: var(--radius); font-size: 14px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--brand-700); outline-offset: 2px; }
.band-dark :focus-visible, .hero :focus-visible { outline-color: var(--brand-200); }

#findings, #explore, #rankings, #methodology { scroll-margin-top: 16px; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; min-height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 9px; text-decoration: none;
  flex: 0 0 auto;
}
.brand img { width: 34px; height: 34px; }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name b {
  font: 700 22px/1 var(--font-wordmark);
  color: #191a19; letter-spacing: -.02em;
}
.brand-name span {
  font: 700 10px/1 var(--font-body);
  letter-spacing: .22em; text-transform: uppercase; color: var(--muted);
  margin-top: 3px;
}
.site-nav { display: flex; align-items: center; gap: 20px; }
.site-nav a.nav-link {
  font: 500 14.5px/1 var(--font-body); color: var(--ink-2);
  text-decoration: none; padding: 8px 0;
}
.site-nav a.nav-link:hover { color: var(--brand-700); }
.btn {
  display: inline-block; border: 0; cursor: pointer; text-decoration: none;
  background: var(--brand-600); color: #fff;
  font: 600 15px/1 var(--font-body);
  padding: 12px 22px; border-radius: var(--radius);
  transition: background .15s ease;
}
.btn:hover { background: var(--brand-700); }
.btn.btn-light { background: #fff; color: var(--brand-800); }
.btn.btn-light:hover { background: var(--brand-100); }
.btn.btn-ghost {
  background: transparent; color: var(--brand-700);
  border: 1.5px solid var(--brand-200);
}
.btn.btn-ghost:hover { border-color: var(--brand-500); background: var(--brand-tint); }
.btn.btn-mini { padding: 9px 14px; font-size: 14px; }
.btn.btn-lg { padding: 15px 28px; font-size: 16px; }

/* --------------------------------------------------------------------------
   Hero with photograph
   -------------------------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  background: var(--brand-800); color: #fff;
}
.hero-media { position: absolute; inset: 0; }
.hero-media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 52%;
}
.hero-media::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(18, 52, 43, .88) 0%, rgba(18, 52, 43, .70) 38%, rgba(18, 52, 43, .30) 66%, rgba(18, 52, 43, .06) 94%),
    linear-gradient(0deg, rgba(18, 52, 43, .42), rgba(18, 52, 43, 0) 46%);
}
.hero-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; justify-content: center;
  min-height: clamp(500px, 66vh, 640px);
  padding-top: clamp(72px, 10vh, 120px);
  padding-bottom: clamp(72px, 10vh, 120px);
}
.hero h1 {
  font: 700 clamp(34px, 4.6vw, 56px)/1.1 var(--font-display);
  letter-spacing: -.01em; margin: 0 0 14px; color: #fff;
}
.hero .sub {
  font: 500 clamp(17.5px, 1.9vw, 21px)/1.45 var(--font-body);
  color: #dce7dd; max-width: 40ch; margin: 0 0 14px;
}
.hero .intro {
  font: 400 16.5px/1.55 var(--font-body); color: #c7d6ca;
  max-width: 58ch; margin: 0 0 28px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; }

/* --------------------------------------------------------------------------
   Bands and section scaffolding
   -------------------------------------------------------------------------- */

.band { padding: 56px 0; }
.band-paper { background: var(--paper); }
.band-tint { background: var(--brand-tint); }
.band-white { background: #fff; }
.band-dark {
  background: linear-gradient(140deg, var(--brand-800) 0%, var(--brand-700) 74%);
  color: #eef3ee;
}

.section-head { max-width: 780px; margin-bottom: 30px; }
.section-head h2 {
  font: 700 clamp(25px, 3vw, 33px)/1.25 var(--font-display);
  color: var(--ink); letter-spacing: -.01em; margin: 0 0 10px;
}
.section-head p { font-size: 16.5px; color: var(--ink-2); margin: 0; }

/* --------------------------------------------------------------------------
   Key findings cards
   -------------------------------------------------------------------------- */

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 26px 24px 24px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.card .card-kicker {
  font: 600 11.5px/1 var(--font-body); letter-spacing: .15em; text-transform: uppercase;
  color: var(--brand-600); margin-bottom: 12px;
}
.card .card-stat {
  font: 700 27px/1.15 var(--font-display); color: var(--ink);
  letter-spacing: -.01em; margin: 0 0 12px;
  font-variant-numeric: tabular-nums lining-nums;
}
.card .card-stat small { font-size: 17px; color: var(--muted); font-weight: 500; }
.card p { font-size: 15.5px; line-height: 1.62; margin: 0; }
.card .card-link {
  margin-top: auto; font: 600 14.5px/1 var(--font-body); color: var(--brand-700);
  text-decoration: none; border-bottom: 1.5px solid var(--brand-200);
  padding-bottom: 3px; align-self: flex-start;
}
.card .card-link:hover { border-color: var(--brand-600); }

/* --------------------------------------------------------------------------
   Explorer (controls, caption, map, detail, table)
   -------------------------------------------------------------------------- */

.controls {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin: 6px 0 14px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font: 600 12px/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted);
}
.field .control {
  font: 500 15px/1.2 var(--font-body); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 11px 12px; min-height: 44px;
}
.field input.control { min-width: 230px; }
.field input.control::placeholder { color: var(--muted-2); }
.field select.control { min-width: 290px; cursor: pointer; }
.control:focus { border-color: var(--brand-500); outline: 2px solid transparent; }

.caption {
  display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline;
  font-size: 14px; color: var(--muted); border-left: 3px solid var(--brand-200);
  padding: 2px 0 2px 12px; margin: 0 0 20px;
}
.caption strong { color: var(--ink-2); font-weight: 600; }

/* Full-width map */
.map-frame { margin: 0 0 8px; }
.map-wrap { position: relative; }
.map-wrap svg { width: 100%; height: auto; display: block; }
.state-path { stroke: #fff; stroke-width: .7; cursor: pointer; transition: fill .15s ease; }
.state-path:hover { stroke: var(--accent); stroke-width: 1.4; }
.state-path.selected { stroke: var(--brand-800); stroke-width: 1.8; }
.state-path:focus { outline: none; }
.state-path:focus-visible { stroke: var(--accent); stroke-width: 2; }
.map-tip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 10px 12px; max-width: 260px;
  font-size: 13.5px; color: var(--ink-2); transition: opacity .12s ease;
}
.map-tip.show { opacity: 1; }
.map-tip b { display: block; font-size: 14.5px; color: var(--ink); }
.map-tip .tip-line { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.map-tip .tip-rank { font: 600 12px/1.3 var(--font-body); color: var(--brand-700); margin-top: 3px; }
.map-tip .tip-grid { margin-top: 8px; border-top: 1px solid var(--line-soft); padding-top: 6px; }
.map-tip .tip-row { display: flex; justify-content: space-between; gap: 14px; font-size: 12px; color: var(--muted); padding: 2px 0; }
.map-tip .tip-row b { color: var(--ink-2); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.map-tip .tip-row.hi b { color: var(--brand-700); }
.map-tip .tip-foot { margin-top: 7px; font-size: 11px; color: var(--muted-2); }
.map-legend { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.map-legend .lbl { font-size: 12px; color: var(--muted); white-space: nowrap; }
.map-legend .grad {
  flex: 1 1 auto; height: 8px; border-radius: 99px;
  background: linear-gradient(90deg, #eef2ec, #c9d2c8 32%, #8aa091 60%, #4b7161 82%, #174237);
}
.map-note { font-size: 12.5px; color: var(--muted); margin: 8px 0 0; }

/* Detail card */
.detail {
  display: none; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  padding: 24px 26px 22px; margin: 22px 0;
}
.detail.open { display: block; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.detail-title { min-width: 240px; }
.detail-title h3 { font: 700 27px/1.1 var(--font-display); margin: 0 0 4px; color: var(--ink); }
.detail-title .rank-line { font: 600 13.5px/1 var(--font-body); color: var(--brand-600); letter-spacing: .02em; }
.detail-actions { display: flex; gap: 10px; align-items: center; }
.detail-close {
  background: transparent; border: 1.5px solid var(--line); border-radius: var(--radius);
  width: 40px; height: 40px; cursor: pointer; color: var(--muted); font-size: 17px;
  display: flex; align-items: center; justify-content: center;
}
.detail-close:hover { border-color: var(--brand-500); color: var(--brand-700); }
.detail-grid { display: grid; grid-template-columns: minmax(240px, 4fr) 8fr; gap: 26px; margin-top: 18px; }

.bars { margin-top: 4px; }
.bar-row { margin-bottom: 12px; }
.bar-row .bar-label {
  display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 5px;
  color: var(--ink-2); font-weight: 500;
}
.bar-row .bar-label b { font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-fill.pressure { background: var(--accent); }
.bar-fill.readiness { background: var(--brand-600); }
.gap-line {
  font: 700 30px/1 var(--font-display); color: var(--ink);
  margin: 2px 0 0; font-variant-numeric: tabular-nums lining-nums;
}
.gap-line small { font: 500 14px/1 var(--font-body); color: var(--muted); margin-left: 6px; }
.gap-explain { font-size: 13px; color: var(--muted); margin: 8px 0 0; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.tile {
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 12px 13px 11px;
}
.tile .t-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); line-height: 1.3; }
.tile .t-value {
  font: 700 19px/1.2 var(--font-display); color: var(--ink); margin: 6px 0 2px;
  font-variant-numeric: tabular-nums lining-nums;
}
.tile .t-value small { font-size: 12.5px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.tile .t-rank { font-size: 12.5px; color: var(--muted); }
.detail-finding { margin-top: 18px; font-size: 15px; color: var(--ink-2); }
.detail-note {
  margin-top: 12px; background: var(--paper); border-left: 3px solid var(--brand-200);
  padding: 10px 14px; font-size: 13.5px; color: var(--muted); border-radius: 0 var(--radius) var(--radius) 0;
}
.detail-help { margin-top: 14px; font-size: 13px; color: var(--muted); }

/* Ranking table */
.rankings { margin-top: 6px; }
.table-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.table-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  font-size: 14px; color: var(--muted);
}
.table-meta b { color: var(--ink-2); font-weight: 600; }
.table-scroll { max-height: 572px; overflow: auto; }
.rank-table { width: 100%; min-width: 900px; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.rank-table caption { text-align: left; }
.rank-table thead th {
  position: sticky; top: 0; z-index: 2; background: #fff;
  font: 600 12px/1.25 var(--font-body); letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); text-align: center; padding: 10px 10px;
  border-bottom: 1.5px solid var(--line); white-space: nowrap;
  vertical-align: middle;
}
.rank-table thead th small {
  display: block; font-size: 10.5px; font-weight: 500; letter-spacing: .01em;
  text-transform: none; color: var(--muted-2); margin-top: 3px; white-space: normal;
}
.rank-table thead th.sorted { color: var(--ink); }
.rank-table thead th.sorted small { color: var(--muted); }
.rank-table thead th.num, .rank-table td.num { text-align: center; }
.rank-table tbody td {
  padding: 10px 10px; border-bottom: 1px solid var(--line-soft); font-size: 14px; color: var(--ink-2);
  white-space: nowrap; text-align: center;
}
.rank-table tbody td.state-cell { text-align: left; }
.rank-table tbody td.sorted { background: var(--brand-tint); }
.rank-table tbody tr.selected { background: var(--brand-100); }
.rank-table tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--brand-700); }
.rank-table td .state-name { font-weight: 600; color: var(--ink); }
.rank-table td .v { font-weight: 600; color: var(--ink); }
.rank-table td .r { color: var(--muted); }
.no-results { padding: 26px 18px; font-size: 15px; color: var(--muted); }
.table-more { padding: 14px; text-align: center; border-top: 1px solid var(--line-soft); }

/* --------------------------------------------------------------------------
   Practical commentary (dark band)
   -------------------------------------------------------------------------- */

.commentary .section-head h2 { color: #fff; }
.commentary .section-head p { color: #cfdcd2; }
.checklist { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.checklist li {
  position: relative; padding: 0 0 14px 30px; font-size: 15.8px; color: #e3ebe4;
}
.checklist li::before {
  content: ''; position: absolute; left: 2px; top: 4px; width: 16px; height: 16px;
  border-radius: 50%; border: 1.5px solid var(--brand-400);
  background:
    radial-gradient(circle at 50% 50%, var(--brand-400) 0 3.5px, transparent 4px);
}

/* --------------------------------------------------------------------------
   Methodology
   -------------------------------------------------------------------------- */

.method-lede { max-width: 840px; font-size: 15.5px; margin: 0; }
.sources-block { margin-top: 34px; max-width: 1040px; }
.sources-block h3, .notes h3 {
  font: 600 15px/1.3 var(--font-body); letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 6px;
}
.sources-list { list-style: none; margin: 0; padding: 0; }
.sources-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.sources-list li b { color: var(--ink); font-weight: 600; }
.sources-list li span { color: var(--muted); font-size: 13px; }
.sources-list li a { color: var(--brand-700); text-decoration: none; border-bottom: 1px solid var(--brand-200); word-break: break-all; }
.sources-list li a:hover { border-color: var(--brand-600); }
details.notes {
  margin-top: 26px; border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: #fff; padding: 0 20px;
}
details.notes summary {
  cursor: pointer; padding: 16px 0; font: 600 15px/1.3 var(--font-body); color: var(--brand-700);
  list-style: none; display: flex; justify-content: space-between; align-items: center;
}
details.notes summary::after { content: '+'; font-size: 18px; color: var(--brand-600); }
details.notes[open] summary::after { content: '−'; }
details.notes summary::-webkit-details-marker { display: none; }
details.notes .notes-body { padding: 2px 0 20px; font-size: 14px; color: var(--ink-2); }
details.notes .notes-body p { margin: 0 0 10px; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  margin-top: 64px; width: 100%;
  border-top: 1px solid #e4e5e4;
  background: #052b22; color: #c9d2c8;
  padding: 16px 24px;
}
.footer-inner { max-width: 1072px; margin: 0 auto; display: flex; flex-direction: column; }
.footer-brand { margin-top: 32px; }
.footer-logo-row { display: flex; align-items: center; gap: 16px; }
.footer-mark { height: 40px; width: 40px; flex-shrink: 0; filter: brightness(0) invert(1); }
.footer-wordmark {
  font: 700 16px/28px var(--font-display); letter-spacing: -.025em; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.footer-tagline { font-size: 14px; line-height: 1.625; margin: 16px 0 0; }
.footer-social { margin: 32px 0 0 -8px; display: flex; color: #fff; }
.footer-social a { display: inline-flex; padding: 0 8px; color: inherit; }
.footer-social a:hover { color: rgba(255, 255, 255, .5); }
.footer-social .social-icon { width: 20px; height: 20px; display: block; }
.footer-col { margin-top: 32px; }
.footer-col h3 {
  margin: 0 0 16px; font-size: 14px; font-weight: 800; letter-spacing: .05em;
  text-transform: uppercase; color: #fff;
}
.footer-col ul { list-style: none; margin: -8px 0; padding: 0; font-size: 14px; }
.footer-col a { display: block; width: 100%; padding: 8px 0; color: inherit; text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-bottom {
  margin-top: 32px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 16px; border-top: 1px solid #4b7161; padding: 24px 0;
  font-size: 14px; color: #4b7161;
}
.footer-bottom-links { display: flex; gap: 16px; }
.footer-bottom a { color: inherit; text-decoration: none; }
.footer-bottom a:hover { text-decoration: underline; }
@media (min-width: 768px) {
  .footer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
  .footer-wordmark { font-size: 30px; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1020px) {
  .detail-grid { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 860px) {
  .hero-media img { object-position: 50% 44%; }
  .hero-media::after {
    background:
      linear-gradient(100deg, rgba(18, 52, 43, .90) 0%, rgba(18, 52, 43, .78) 48%, rgba(18, 52, 43, .55) 82%, rgba(18, 52, 43, .42) 100%),
      linear-gradient(0deg, rgba(18, 52, 43, .50), rgba(18, 52, 43, 0) 54%);
  }
  .cards { grid-template-columns: 1fr; }
  .site-nav a.nav-link { display: none; }
  .site-nav { gap: 0; }
  .field input.control { min-width: 0; width: 100%; }
  .field select.control { min-width: 0; width: 100%; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls .field, .controls .field .control { width: 100%; }
  .table-scroll { max-height: 430px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .band { padding: 46px 0; }
  .detail { padding: 20px 18px 18px; }
}

@media (max-width: 480px) {
  .tiles { grid-template-columns: 1fr; }
  .detail-title h3 { font-size: 23px; }
}
