/* TenTopic Housing — the real brand, sampled from assets/brand/ and mirrored from
   data/scripts/brand.py so the site and the graphics read as one system.
   FALLING #F95439 coral · RISING #1D4E89 deep blue · ground #FBFBFA · ink #100F0F
   Type: Montserrat, with Roboto Mono on every number and label.
   Editorial for home and /methodology; /rankings is the one dense instrument. */

@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&family=Roboto+Mono:wght@400;500&display=swap");

:root {
  --ground: #FBFBFA;
  --surface: #FFFFFF;
  --ink: #100F0F;
  --muted: #6E6C69;
  --rule: #E4E3E1;
  --rule-soft: #EFEEEC;
  --fall: #F95439;          /* falling — the brand accent */
  --fall-tint: #FBF0ED;
  --rise: #1D4E89;          /* rising */
  --rise-tint: #E8EEF6;
  --sans: Montserrat, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --mono: "Roboto Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --wrap: 1180px;
  --dots: radial-gradient(circle, #EDEBE8 1.4px, transparent 1.4px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 17px/1.62 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; font-weight: 800; line-height: 1.08; letter-spacing: -0.025em; }
img { max-width: 100%; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 32px; }
.muted { color: var(--muted); }
.fall { color: var(--fall); }
.rise { color: var(--rise); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* the small uppercase label that sits above things */
.kicker {
  font-family: var(--mono);
  font-size: 12px; font-weight: 500;
  letter-spacing: .17em; text-transform: uppercase; color: var(--muted);
}
.kicker b { color: var(--fall); font-weight: 500; }

/* a link that reads as a next step */
.go { font-weight: 600; text-decoration: none; border-bottom: 2px solid var(--fall); padding-bottom: 2px; }
.go:hover { color: var(--fall); }
.go.rise { border-bottom-color: var(--rise); }
.go.rise:hover { color: var(--rise); }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 251, 250, .93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
/* min-height, not height: the nav wraps to a second line on narrow screens and a
   fixed height clipped it (the Rankings link vanished at 390px). */
.bar { display: flex; align-items: center; gap: 26px; min-height: 68px; flex-wrap: wrap; padding: 12px 0; }
.mark { display: flex; align-items: center; gap: 11px; text-decoration: none; white-space: nowrap; }
.mark img { height: 27px; width: auto; display: block; }
.mark .wordmark { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.mark .div { width: 1px; height: 17px; background: var(--rule); }
.mark .vertical {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: .22em; text-transform: uppercase; color: var(--fall);
}
nav { margin-left: auto; display: flex; gap: 26px; flex-wrap: wrap; }
nav a {
  color: var(--muted); text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 3px 0; border-bottom: 2px solid transparent;
}
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--fall); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: 92px 0 0;
  background-image: var(--dots); background-size: 34px 34px;
  border-bottom: 1px solid var(--rule);
}
/* the oversized house mark, exactly as the brand banner uses it */
/* sized and placed to clear the stat strip — on the shorter /rankings hero a taller
   mark landed behind the last stat value and read as a stray pink rectangle */
.hero::after {
  content: ""; position: absolute; right: -120px; top: 8px;
  width: 440px; height: 405px; opacity: .05; pointer-events: none;
  background: url("/brand/mark.png") no-repeat center / contain;
}
.hero .wrap { position: relative; z-index: 1; }
.hero .rule-top { width: 46px; height: 3px; background: var(--fall); margin-bottom: 22px; }
.hero h1 { font-size: clamp(42px, 7vw, 82px); letter-spacing: -0.038em; line-height: 1.0; }
.hero .tagline { font-size: clamp(18px, 2.3vw, 23px); font-weight: 600; margin: 22px 0 0; }
.hero .tagline em { font-style: normal; color: var(--fall); }
.lede { color: var(--muted); font-size: 18.5px; max-width: 60ch; margin: 22px 0 0; }
.hero-pad { padding-bottom: 76px; }
/* when the hero ends in the stat strip, the strip's own hairline is the closing rule —
   otherwise you get a line, 76px of air, then a second line */
.hero.with-stats { padding-bottom: 0; }
.hero.with-stats .stat { border-bottom: 0; padding-bottom: 38px; }

/* ---------- stat strip: hairlines, not boxes ---------- */
.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin: 64px 0 0; border-top: 1px solid var(--rule);
}
.stat { padding: 24px 26px 30px 0; border-bottom: 1px solid var(--rule); }
.stat + .stat { border-left: 1px solid var(--rule); padding-left: 26px; }
.stat .k {
  font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
}
/* Montserrat, not the mono: Roboto Mono ships 400/500 only, so a 40px headline number
   in it gets synthesised and lands thin next to the 800-weight display type */
.stat .v {
  font-family: var(--sans); font-variant-numeric: tabular-nums;
  font-size: 40px; font-weight: 800; letter-spacing: -0.035em; margin-top: 10px; line-height: 1;
}
.stat .n { color: var(--muted); font-size: 13.5px; margin-top: 8px; line-height: 1.4; }

/* ---------- sections ---------- */
section { padding: 84px 0; border-bottom: 1px solid var(--rule); }
section h2 { font-size: clamp(28px, 3.6vw, 42px); letter-spacing: -0.032em; }
section .sub { color: var(--muted); margin-top: 14px; max-width: 64ch; font-size: 17px; }
.section-head { max-width: 62ch; }
.section-head .kicker { display: block; margin-bottom: 14px; }

/* ---------- numbered editorial grid (no cards) ---------- */
.grid2 {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 0; margin-top: 52px; border-top: 1px solid var(--rule);
}
.item { padding: 30px 34px 34px 0; border-bottom: 1px solid var(--rule); }
.item .no {
  font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--fall);
  letter-spacing: .12em; display: block; margin-bottom: 12px;
}
.item h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.item p { color: var(--muted); margin: 10px 0 0; font-size: 16px; }
@media (min-width: 741px) {
  .grid2 .item:nth-child(even) { padding-left: 34px; border-left: 1px solid var(--rule); }
}

/* ---------- ranking table: the one dense instrument ---------- */
/* Scrolls in both axes so the sticky header has a real scroll container. Without an
   explicit max-height the header renders 68px down and hides row 1. */
.tablewrap {
  overflow: auto; max-height: 74vh; margin-top: 30px;
  border: 1px solid var(--rule); background: var(--surface);
  overscroll-behavior: contain;
}
/* the instrument is allowed to break the text measure — at 1180px the last column
   ("days to pending") was clipped against the container edge */
@media (min-width: 1400px) {
  .tablewrap.bleed { margin-left: -90px; margin-right: -90px; }
}
table { border-collapse: collapse; width: 100%; min-width: 900px; font-size: 15px; }
th, td { padding: 12px 14px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
thead th {
  background: var(--surface); color: var(--muted);
  font-family: var(--mono); font-weight: 500; font-size: 11px;
  letter-spacing: .13em; text-transform: uppercase; cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--ink); position: sticky; top: 0; z-index: 5;
  padding-top: 16px; padding-bottom: 12px;
}
thead th:hover { color: var(--ink); }
thead th .arrow { opacity: .5; font-size: 9px; margin-left: 5px; }
tbody td { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 14px; }
tbody tr { border-bottom: 1px solid var(--rule-soft); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: var(--ground); }
tbody tr.top10 { background: #FEFAF9; }
tbody tr.top10 td:first-child { color: var(--fall); font-weight: 500; }
tbody tr.top10:hover { background: var(--fall-tint); }
.metro { font-family: var(--sans); font-weight: 600; font-size: 15px; }
.metro small { color: var(--muted); font-weight: 400; margin-left: 7px; font-family: var(--mono); font-size: 12px; }

/* in-cell magnitude bar — a rule under the number, not a block behind it. A full-height
   tint sat exactly under the digits and read as a highlighted cell, not as a length. */
.bar-cell { position: relative; }
.bar-cell i {
  position: absolute; right: 14px; bottom: 7px;
  height: 3px; opacity: .55; display: block;
}
.bar-cell span { position: relative; }

/* ---------- controls ---------- */
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 30px; }
input[type="search"], input[type="email"] {
  background: var(--surface); border: 1px solid var(--rule); color: var(--ink);
  padding: 11px 15px; font: inherit; font-size: 15px; min-width: 250px;
}
input:focus-visible, button:focus-visible, .chipbtn:focus-visible, a:focus-visible, th:focus-visible {
  outline: 2px solid var(--fall); outline-offset: 2px;
}
input::placeholder { color: var(--muted); }
.chipbtn {
  background: transparent; border: 1px solid var(--rule); color: var(--muted);
  padding: 10px 18px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.chipbtn:hover { color: var(--ink); border-color: var(--muted); }
.chipbtn[aria-pressed="true"] { background: var(--fall); border-color: var(--fall); color: #fff; font-weight: 600; }
.count { color: var(--muted); font-family: var(--mono); font-size: 12.5px; margin-left: auto; }

/* ---------- signup band ---------- */
.signup { background: var(--surface); border: 1px solid var(--rule); padding: 46px 48px; }
.signup h3 { font-size: 27px; }
.signup p { color: var(--muted); margin: 12px 0 24px; max-width: 54ch; }
.signup .fineprint { font-size: 13.5px; margin: 18px 0 0; }

/* ---------- video ---------- */
.video { aspect-ratio: 16 / 9; width: 100%; border: 1px solid var(--rule); overflow: hidden; background: var(--surface); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video .placeholder {
  height: 100%; display: grid; place-items: center; text-align: center; padding: 24px;
  background-image: var(--dots); background-size: 34px 34px;
}
/* until a video ID exists, don't hold open 660px of empty 16:9. The min-height goes on
   the placeholder, not the box — height:100% of an auto-height parent collapses, which
   left the text pinned to the top of a 300px void. */
.video.empty { aspect-ratio: auto; }
.video.empty .placeholder { min-height: 280px; }

/* ---------- prose (methodology) ---------- */
/* the page markup is <div class="wrap prose">: without this the 68ch measure collapses
   the wrap itself and margin:0 auto centres the body copy while the hero stays
   left-aligned. Keep the grid, constrain the children. */
.prose { max-width: 68ch; font-size: 17.5px; }
.wrap.prose { max-width: var(--wrap); }
.wrap.prose > * { max-width: 68ch; }
.prose h2 {
  margin: 62px 0 16px; font-size: 29px; letter-spacing: -0.028em;
  padding-top: 26px; border-top: 1px solid var(--rule);
}
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h3 { margin: 36px 0 10px; font-size: 20px; font-weight: 700; }
.prose p, .prose li { color: #2E2C2A; }
.prose p { margin: 14px 0; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 9px 0; }
.prose code {
  background: var(--surface); border: 1px solid var(--rule);
  padding: 3px 8px; font-size: 14.5px; font-family: var(--mono);
}
.prose table { min-width: 0; font-size: 15.5px; margin-top: 18px; }
.prose table th, .prose table td { text-align: left; font-family: var(--sans); white-space: normal; }
.prose table thead th {
  position: static; background: transparent; cursor: default;
  border-bottom: 1px solid var(--ink);
}
.prose table tbody td { font-family: var(--sans); font-size: 15.5px; }
.prose a { color: var(--rise); }
.callout {
  border-left: 3px solid var(--fall); background: var(--fall-tint);
  padding: 22px 26px; margin: 30px 0;
}
.callout.rise { border-left-color: var(--rise); background: var(--rise-tint); }
.callout p { margin: 0; font-size: 16.5px; }
.callout p + p { margin-top: 12px; }

/* ---------- misc ---------- */
.mapimg { width: 100%; border: 1px solid var(--rule); display: block; margin-top: 30px; background: var(--surface); }
.pill {
  display: inline-block; font-family: var(--mono); font-size: 11px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .15em; color: var(--muted);
  border: 1px solid var(--rule); padding: 6px 14px;
}
footer { padding: 56px 0 72px; color: var(--muted); font-size: 14.5px; }
footer a { color: var(--muted); }
footer a:hover { color: var(--ink); }
footer .links { display: flex; gap: 20px; flex-wrap: wrap; }
footer .links a { text-decoration: none; font-weight: 500; }
footer .attrib { margin-top: 16px; max-width: 72ch; font-family: var(--mono); font-size: 12px; line-height: 1.7; }
footer .foot-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
footer .foot-mark img { height: 22px; }
footer .foot-mark span { font-weight: 800; font-size: 15px; color: var(--ink); letter-spacing: -0.02em; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 12px; background: var(--fall); color: #fff; padding: 9px 16px; z-index: 50; }

@media (max-width: 740px) {
  body { font-size: 16.5px; }
  .wrap { padding: 0 22px; }
  .hero { padding-top: 60px; }
  .hero-pad { padding-bottom: 52px; }
  .hero::after { width: 300px; height: 280px; right: -80px; top: 20px; }
  section { padding: 56px 0; }
  .stats { margin-top: 44px; }
  .stat, .stat + .stat { padding: 20px 0 24px; border-left: 0; }
  .item, .grid2 .item:nth-child(even) { padding: 26px 0 28px; border-left: 0; }
  .signup { padding: 30px 24px; }
  /* nav sits on its own line under the wordmark rather than squeezing */
  .bar { gap: 10px 18px; }
  nav { margin-left: 0; width: 100%; gap: 20px; }
  .controls input[type="search"] { flex: 1 1 100%; min-width: 0; }
  .count { margin-left: 0; }
  .prose h2 { margin-top: 46px; }
}
