@import url("https://fonts.googleapis.com/css2?family=Geist:wght@100..900&family=Geist+Mono:wght@300..700&display=swap");

:root {
  --apriq-sans: "Geist", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --apriq-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --deep-blue: #0B1220; --teal: #0E7C79; --teal-dark: #149C97;
  --surface: #FFFFFF; --surface-raised: #F6F7F8;
  --ink: #0B1220; --ink-2: #556070; --rule: #DCDEE2;
  --series-1: #00968C; --series-2: #C4761A; --series-5: #2A6BC4;
  --good: #1F7A4D; --warning: #9A6B00; --serious: #B04A12;
  --seq-2: #BCDEDB; --seq-5: #1B8F86;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--surface); color: var(--ink);
  font-family: var(--apriq-sans); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
table, .metric, .tabular, .fig { font-variant-numeric: tabular-nums; }
.provenance, .source, .method, .confidence, .mono {
  font-family: var(--apriq-mono); font-size: .75rem; letter-spacing: .02em; color: var(--ink-2);
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
a { color: var(--teal); }

/* ---- header ---- */
header {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule);
}
header .wrap { display: flex; align-items: center; gap: 28px; height: 62px; }
.logo { font-weight: 620; letter-spacing: .10em; font-size: 1.02rem; text-decoration: none; color: var(--ink); }
.logo span { color: var(--teal); }
header nav { margin-left: auto; display: flex; gap: 22px; font-size: .875rem;
  min-width: 0; overflow-x: auto; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
header nav a { flex: none; }
header nav a { color: var(--ink-2); text-decoration: none; }
header nav a:hover { color: var(--teal); }

/* ---- hero ---- */
.hero { padding: 68px 0 40px; border-bottom: 1px solid var(--rule);
  background-image: radial-gradient(circle at center, var(--rule) 1.4px, transparent 1.5px);
  background-size: 22px 22px; }
.hero .inner { background: linear-gradient(90deg, #fff 68%, rgba(255,255,255,.55)); padding: 8px 0; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); line-height: 1.06; letter-spacing: -.028em;
  font-weight: 600; margin: 0 0 18px; max-width: 17ch; }
.hero h1 em { font-style: normal; color: var(--teal); }
.hero p.lede { font-size: 1.1rem; color: var(--ink-2); max-width: 60ch; margin: 0 0 30px; }
.stats { display: flex; flex-wrap: wrap; gap: 40px; margin-top: 34px; }
.stat .n { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; }
.stat .l { font-size: .78rem; color: var(--ink-2); text-transform: uppercase; letter-spacing: .08em; }

/* ---- sections ---- */
section { padding: 56px 0; border-bottom: 1px solid var(--rule); }
h2 { font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 8px; }
h2 + p.sub { color: var(--ink-2); margin: 0 0 28px; max-width: 68ch; }

/* ---- region comparison ---- */
.regions { display: grid; gap: 14px; max-width: 720px; }
.regionrow { display: grid; grid-template-columns: 160px 1fr 66px; align-items: center; gap: 14px; }
.regionrow .name { font-size: .9rem; }
.regionrow .bar { height: 26px; background: var(--surface-raised); border-radius: 3px; overflow: hidden; }
.regionrow .bar i { display: block; height: 100%; background: var(--seq-5); border-radius: 3px; }
.regionrow .val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.regionrow .n { color: var(--ink-2); font-size: .75rem; font-family: var(--apriq-mono); }

/* ---- controls ---- */
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.controls input[type=search], .controls select {
  font: inherit; font-size: .9rem; padding: 9px 12px; border: 1px solid var(--rule);
  border-radius: 6px; background: var(--surface); color: var(--ink);
}
.controls input[type=search] { min-width: 240px; }
.controls input:focus, .controls select:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.seg button { font: inherit; font-size: .85rem; padding: 9px 14px; border: 0; background: var(--surface);
  color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--deep-blue); color: #fff; }
.count { margin-left: auto; font-family: var(--apriq-mono); font-size: .75rem; color: var(--ink-2); }

/* ---- table ---- */
/* The header is sticky and 63px tall, so an in-page anchor that lands flush with the
   viewport top puts its own heading underneath it. Every jump clears the header instead. */
section[id], footer[id], div[id="top"] { scroll-margin-top: 78px; }

.tablewrap { border: 1px solid var(--rule); border-radius: 8px; overflow: auto; max-height: 620px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { position: sticky; top: 0; background: var(--surface-raised); text-align: left;
  font-weight: 550; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-2); padding: 11px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
thead th.s { cursor: pointer; user-select: none; }
thead th.s:hover { color: var(--teal); }
thead th[data-dir]::after { content: " ↓"; color: var(--teal); }
thead th[data-dir=asc]::after { content: " ↑"; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--rule); }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-raised); }
tbody tr[aria-selected=true] { background: #EAF5F4; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.yield { font-weight: 600; }
.pill { font-family: var(--apriq-mono); font-size: .68rem; padding: 2px 7px; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap; }
.c-high { color: var(--good); } .c-medium { color: var(--warning); } .c-low { color: var(--serious); }
.empty { padding: 40px; text-align: center; color: var(--ink-2); }

/* ---- provenance drawer ---- */
.drawer { position: fixed; top: 0; right: 0; height: 100dvh; width: min(430px, 100vw);
  background: var(--surface); border-left: 1px solid var(--rule); z-index: 60;
  transform: translateX(100%); transition: transform .22s ease; overflow-y: auto;
  box-shadow: -18px 0 44px rgba(11,18,32,.10); }
.drawer[open] { transform: none; }
.drawer .dhead { position: sticky; top: 0; background: var(--surface); padding: 20px 24px 14px;
  border-bottom: 1px solid var(--rule); }
.drawer h3 { margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; }
.drawer .dclose { position: absolute; top: 16px; right: 18px; border: 0; background: none;
  font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--ink-2); }
.drawer .body { padding: 20px 24px 60px; }
.headline { font-size: 2.4rem; font-weight: 600; letter-spacing: -.03em; }
.chain { list-style: none; margin: 18px 0 0; padding: 0; border-left: 2px solid var(--rule); }
.chain li { position: relative; padding: 0 0 20px 20px; }
.chain li::before { content: ""; position: absolute; left: -5px; top: 6px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--teal); }
.chain .k { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); }
.chain .v { font-size: .9rem; }
.chain .v.mono { font-size: .74rem; word-break: break-all; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: .88rem; }
dl.kv dt { color: var(--ink-2); } dl.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.note { background: var(--surface-raised); border-left: 3px solid var(--warning); padding: 12px 14px;
  font-size: .82rem; margin-top: 18px; border-radius: 0 4px 4px 0; }
.scrim { position: fixed; inset: 0; background: rgba(11,18,32,.34); z-index: 50; opacity: 0;
  pointer-events: none; transition: opacity .22s; }
.scrim[open] { opacity: 1; pointer-events: auto; }

/* ---- method / footer ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); gap: 18px; }
.card { border: 1px solid var(--rule); border-radius: 8px; padding: 20px; }
.card h4 { margin: 0 0 8px; font-size: .95rem; font-weight: 600; }
.card p { margin: 0; font-size: .87rem; color: var(--ink-2); }
footer { background: var(--deep-blue); color: #F2F4F6; padding: 46px 0 38px; }
footer a { color: var(--teal-dark); }
footer .attr { font-family: var(--apriq-mono); font-size: .74rem; color: #9AA4B2; line-height: 1.9; }
footer h4 { font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; color: #9AA4B2;
  margin: 0 0 10px; font-weight: 500; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 34px; }
@media (max-width: 720px) {
  header nav { gap: 13px; font-size: .8rem; }
  .regionrow { grid-template-columns: 110px 1fr 58px; }
  .stats { gap: 26px; }
  .controls input[type=search] { min-width: 100%; }
}

/* ---- change, trend, evidence ---- */
.up { color: var(--good); } .down { color: var(--serious); }
td .peryr { color: var(--ink-2); font-size: .7rem; margin-left: 2px; }
.spark { color: var(--seq-5); vertical-align: middle; }
.spark circle { fill: currentColor; }
.sparkcell { white-space: nowrap; }
.sparkcell .since { margin-left: 10px; }
thead th.qs { cursor: pointer; user-select: none; }
thead th.qs:hover { color: var(--teal); }
/* Sortable columns should look sortable before you hover them. */
thead th.s::after, thead th.qs::after { content: " \2195"; opacity: .35; }
thead th[data-dir]::after { content: " \2193"; color: var(--teal); opacity: 1; }
thead th[data-dir=asc]::after { content: " \2191"; color: var(--teal); opacity: 1; }

/* On a phone the yield and the rent change are the whole point; region, bonds and the
   evidence pill were pushing them off-screen behind a horizontal scroll nobody discovers. */
@media (max-width: 720px) {
  .hide-sm { display: none; }
  .tablewrap { max-height: 70vh; }
  .count { margin-left: 0; width: 100%; }
  /* Fit the four columns that matter inside the viewport. The yield is the number the
     product exists to deliver; it must not sit behind a horizontal scroll nobody finds. */
  table { font-size: .82rem; }
  tbody td, thead th { padding: 9px 8px; }
  thead th { white-space: normal; font-size: .64rem; letter-spacing: .04em; }
  thead th.s::after, thead th.qs::after { content: ""; }
  .pill { font-size: .62rem; padding: 2px 5px; }
  td .mono { font-size: .62rem; }
}
.matched { font-family: var(--apriq-mono); font-size: .68rem; color: var(--teal); margin-top: 2px; }

/* Tablets have room for the value column but not for the metadata. The evidence pill must
   never be the thing that falls off — it is what qualifies the number beside it. */
@media (max-width: 900px) { .hide-md { display: none; } }

/* iPhone SE and similar. One column narrower again so the growth figure stays on screen
   rather than sitting just past the right edge. */
@media (max-width: 400px) {
  .hide-xs { display: none; }
}

/* ---- what the median hides ---- */
.cols2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; }
.colhead { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-2); font-weight: 550; margin: 0 0 10px; }
@media (max-width: 860px) { .cols2 { grid-template-columns: minmax(0, 1fr); } }
.nowat { font-family: var(--apriq-mono); font-size: .68rem; color: var(--ink-2);
  margin-top: 3px; }
@media (max-width: 720px) {
  /* Both ends of the distribution must stay on screen: the comparison IS the section. */
  #quartiles .nowat { font-size: .62rem; }
  #quartiles td:first-child, #quartiles th:first-child { max-width: 128px; }
}
/* Below about 350px even the wrapped dollar line costs more width than the top-quarter
   column can spare. The comparison wins; the levels go. */
@media (max-width: 350px) {
  #quartiles .nowat { display: none; }
  #quartiles tbody td, #quartiles thead th { padding: 8px 4px; }
  #quartiles thead th { font-size: .6rem; letter-spacing: 0; }
}

/* ---- the rental pool ---- */
.poolchart { margin-top: 30px; border: 1px solid var(--rule); border-radius: 8px;
  padding: 16px 16px 8px; }
.poolchart svg { width: 100%; height: auto; display: block; }
.poolline { fill: none; stroke: var(--teal); stroke-width: 2; }
.poolarea { fill: var(--teal); opacity: .07; }
.poolgrid { stroke: var(--rule); stroke-width: 1; }
.poollabel { fill: var(--ink-2); font-size: 11px; font-family: var(--apriq-mono); }
.poolaxis { display: flex; justify-content: space-between; font-family: var(--apriq-mono);
  font-size: .68rem; color: var(--ink-2); margin-top: 6px; }
.note { font-size: .9rem; color: var(--ink-2); margin: 22px 0 0; max-width: 68ch;
  border-left: 2px solid var(--rule); padding-left: 14px; }

/* ---- coverage matrix ---- */
.cov { font-family: var(--apriq-mono); font-size: .72rem; letter-spacing: .02em;
  white-space: nowrap; }
.cov-published { color: var(--good); }
.cov-held { color: var(--warning); }
.cov-blocked { color: var(--ink-2); }
.cov-none { color: var(--ink-2); opacity: .65; }
#coverage td:first-child strong { font-weight: 550; }
#coverage .why { display: block; font-size: .68rem; color: var(--ink-2); margin-top: 2px; }

/* ---- long histories ---- */
#hist-tabs { gap: 8px; }
.histtab { font: inherit; font-size: .82rem; padding: 7px 14px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink-2); border-radius: 6px; cursor: pointer; }
.histtab[aria-selected="true"] { background: var(--deep-blue); color: #fff;
  border-color: var(--deep-blue); }
.histtab:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
thead th.hs { cursor: pointer; user-select: none; }
thead th.hs:hover { color: var(--teal); }
.basis { font-family: var(--apriq-mono); font-size: .68rem; color: var(--ink-2); }
.histpanel[hidden] { display: none; }
thead th.ss { cursor: pointer; user-select: none; }
thead th.ss:hover { color: var(--teal); }

/* ---- market lists on a state hub ---- */
.marketlist { list-style: none; padding: 0; margin: 0 0 34px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 22px; }
.marketlist li { display: flex; justify-content: space-between; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--rule); font-size: .9rem; }
.marketlist a { color: var(--ink); text-decoration: none; }
.marketlist a:hover { color: var(--teal); text-decoration: underline; }
.crumb { margin: 0 0 10px; }
.crumb a { color: var(--ink-2); }
.why { display: block; font-weight: 400; font-size: .72rem; color: var(--ink-2); margin-top: 2px; }

/* ---- the bar a claim has to clear ---- */
.criteria { margin: 0 0 8px; padding-left: 22px; max-width: 68ch; }
.criteria li { margin-bottom: 9px; color: var(--ink-2); font-size: .95rem; line-height: 1.55; }
.criteria li::marker { color: var(--teal); font-family: var(--apriq-mono); font-size: .8rem; }
