:root {
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --page: #ffffff;
  --tile: #f5f5f7;
  --line: #d2d2d7;
  --link: #0066cc;
  --accent: #0071e3;
  --rest: #e8e8ed;
  --radius: 28px;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; }
/* live numbers change every frame; Safari anchors scroll to them and walks the page down */
html { -webkit-text-size-adjust: 100%; overflow-anchor: none; }
body {
  margin: 0;
  overflow-anchor: none;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1024px; margin: 0 auto; padding: 0 22px; }

/* ---------- sticky sub-nav with filters ---------- */
.subnav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, .08);
}
.subnav .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.subnav .name { font-size: 21px; font-weight: 600; letter-spacing: .011em; white-space: nowrap; }
.filters { display: flex; align-items: center; gap: 8px; }
.pick select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 13px; font-weight: 500; letter-spacing: -.01em; color: var(--ink);
  background: rgba(0, 0, 0, .06) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%231d1d1f' stroke-width='1.4' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  border: 0; border-radius: 980px;
  padding: 6px 28px 6px 13px;
  cursor: pointer;
}
.pick select:hover { background-color: rgba(0, 0, 0, .09); }
.seg { display: inline-flex; padding: 2px; border-radius: 980px; background: rgba(0, 0, 0, .06); }
.seg button {
  appearance: none; border: 0; cursor: pointer; font: inherit;
  font-size: 13px; font-weight: 500; letter-spacing: -.01em;
  color: var(--ink); background: transparent;
  padding: 5px 12px; border-radius: 980px;
  transition: background-color .2s, box-shadow .2s;
}
.seg button[aria-checked="true"] { background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .14); }
.seg button:active { transform: scale(.97); }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 88px 0 72px; }
.hero h1 { margin: 0; font-family: var(--display); font-size: clamp(48px, 8vw, 80px); font-weight: 600; line-height: 1.05; letter-spacing: -0.015em; }
.hero .lede { margin: 10px 0 0; font-size: clamp(21px, 2.6vw, 28px); color: var(--ink-2); letter-spacing: .004em; line-height: 1.2; }
.big-wrap { container-type: inline-size; margin: 56px auto 0; max-width: 980px; }
.big {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.03em; line-height: 1;
  font-size: min(128px, calc(100cqi / var(--len, 10)));
  white-space: nowrap;
}
.big-unit { margin-top: 14px; font-size: 21px; font-weight: 600; }
.big-rate { margin-top: 6px; color: var(--ink-2); }
.big-rate b { color: var(--ink); font-weight: 600; }
.hero-units { margin-top: 22px; }

/* ---------- sections ---------- */
section.block { padding: 56px 0; }
.block h2 { margin: 0 0 28px; font-family: var(--display); font-size: clamp(32px, 5vw, 48px); font-weight: 600; line-height: 1.08; letter-spacing: -0.003em; }
.panel { background: var(--tile); border-radius: var(--radius); padding: 36px 36px 32px; }
.panel + .panel { margin-top: 20px; }

/* ---------- tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.tile {
  background: var(--tile); border-radius: var(--radius);
  padding: 32px 30px 28px; min-height: 220px;
  display: flex; flex-direction: column; justify-content: space-between;
  grid-column: span 2; overflow: hidden;
}
.tile.w3 { grid-column: span 3; }
.tile.w4 { grid-column: span 4; }
.tile.dark { background: #000; color: #f5f5f7; }
.k { font-size: 17px; font-weight: 600; color: var(--ink-2); line-height: 1.24; }
.tile.dark .k { color: #a1a1a6; }
.v {
  font-family: var(--display); font-size: clamp(36px, 5vw, 52px);
  font-weight: 700; line-height: 1.02; letter-spacing: -0.025em; white-space: nowrap;
}
.tile .v { margin-top: 24px; }
.tile.w4 .v, .tile.w3 .v { font-size: clamp(36px, 6vw, 60px); }
.v small { font-size: .42em; font-weight: 600; letter-spacing: -0.01em; margin-left: .2em; }
.s { margin-top: 6px; font-size: 16px; color: var(--ink-2); line-height: 1.35; }
.tile.dark .s { color: #a1a1a6; }
.grad { background: linear-gradient(90deg, #ff9f0a 0%, #ff375f 55%, #af52de 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- right now ---------- */
.now { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.now .cell { background: #fff; padding: 26px 24px 22px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; }
.v, .now .num, .row .amt { contain: layout style; }
.now .num { font-family: var(--display); font-size: clamp(28px, 3.6vw, 40px); font-weight: 700; letter-spacing: -0.025em; line-height: 1; white-space: nowrap; }
.now .num small { font-size: .45em; font-weight: 600; margin-left: .15em; }
.now .what { margin-top: 10px; font-size: 16px; color: var(--ink-2); line-height: 1.3; }
.now .what b { color: var(--ink); font-weight: 600; }
.now .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; transform: translateY(-2px); }

/* ---------- receipt ---------- */
.receipt { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; align-items: baseline;
  column-gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line);
}
.row .name { font-size: 19px; font-weight: 600; line-height: 1.25; }
.row .scope { color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.row .amt { text-align: right; font-size: clamp(18px, 2.4vw, 24px); font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }
.row .per { text-align: right; color: var(--ink-2); font-size: 14px; margin-top: 2px; white-space: nowrap; }
.row.sub { padding: 12px 0 12px 28px; }
.row.sub .name { font-size: 16px; font-weight: 500; }
.row.sub .amt { font-size: 17px; color: var(--ink-2); }
.row.off .name, .row.off .amt { color: var(--ink-3); }
.row.total { border-bottom: 0; padding-top: 24px; }
.row.total .name { font-size: 24px; }
.row.total .amt { font-size: clamp(22px, 3.2vw, 32px); font-weight: 700; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; display: inline-block; }
.row .dot { transform: translateY(-1px); }
.row.off .dot { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 22px; border-radius: 22px; background: #e9e9eb; position: relative; cursor: pointer; vertical-align: middle; margin: 0 0 0 10px; transition: background-color .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(14px); }
.name-line { display: flex; align-items: center; }
.badge { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 980px; background: rgba(0, 0, 0, .06); font-size: 11px; font-weight: 600; color: var(--ink-2); letter-spacing: 0; vertical-align: 2px; }
.delta { font-weight: 600; }
.delta.up { color: #c4321b; }
.delta.down { color: #1d7d3b; }

/* ---------- a day ---------- */
.day-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.day-head .v small { margin-left: .15em; }
.day-head .of { color: var(--ink-2); font-size: 21px; font-weight: 600; margin-top: 6px; }
.bar { display: flex; height: 56px; margin: 28px 0 10px; border-radius: 14px; overflow: hidden; background: var(--rest); }
.bar i { display: block; height: 100%; border-right: 2px solid var(--tile); transition: width .35s ease; }
.ticks { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 12px; }
.legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px 40px; margin: 26px 0 0; padding: 0; list-style: none; }
.legend li { display: flex; align-items: baseline; gap: 10px; }
.legend .h { margin-left: auto; font-weight: 600; }
.legend.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 20px; font-size: 14px; color: var(--ink-2); }

/* ---------- charts ---------- */
.chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.chart-head .v { margin-top: 8px; }
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { font-size: 12px; fill: var(--ink-3); }
.chart .grid { stroke: rgba(0, 0, 0, .08); }
.chart .cursor { stroke: var(--ink); stroke-width: 1; }
.age-pick input { width: min(280px, 60vw); accent-color: var(--accent); }
.gens { display: grid; gap: 14px; }
.gen { display: grid; grid-template-columns: 120px minmax(0, 1fr) 72px; align-items: center; gap: 14px; }
.gen .gl { font-weight: 600; font-size: 15px; }
.gen .gl small { display: block; color: var(--ink-3); font-weight: 400; font-size: 12px; }
.gen .gb { display: flex; height: 26px; border-radius: 8px; overflow: hidden; background: var(--rest); }
.gen .gb i { display: block; height: 100%; transition: width .35s ease; }
.gen .gh { text-align: right; font-weight: 600; }
.gen.none .gb { background: repeating-linear-gradient(-45deg, var(--rest) 0 6px, transparent 6px 12px); }
.gen.none .gh { color: var(--ink-3); font-weight: 500; }

/* ---------- footnotes / methodology ---------- */
footer { background: var(--tile); margin-top: 48px; padding: 40px 0 56px; color: var(--ink-2); font-size: 12px; line-height: 1.5; letter-spacing: -0.01em; }
details.method > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
details.method > summary::-webkit-details-marker { display: none; }
details.method > summary::after { content: "+"; font-weight: 400; font-size: 18px; line-height: 1; color: var(--ink-2); }
details.method[open] > summary::after { content: "\2212"; }
.method-body { max-width: 760px; margin-top: 14px; }
.method-body h3 { margin: 22px 0 6px; font-size: 13px; color: var(--ink); font-weight: 600; letter-spacing: -0.01em; }
.method-body p { margin: 0 0 8px; }
.method-body ul { margin: 0 0 8px; padding-left: 1.2em; }
.method-body li { margin-bottom: 4px; }
.method-body .est { color: #b25000; }
.byline { margin-top: 28px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .now { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 833px) {
  .tile, .tile.w3, .tile.w4 { grid-column: span 3; }
  .tile { min-height: 190px; padding: 26px 22px; }
}
@media (max-width: 720px) {
  .subnav .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .subnav .name { font-size: 19px; }
  .filters { width: 100%; }
  .pick { flex: 1 1 0; min-width: 0; }
  .pick select { width: 100%; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hero { padding: 48px 0 40px; }
  .big-wrap { margin-top: 32px; }
  .tiles { gap: 12px; }
  .tile, .tile.w3, .tile.w4 { grid-column: span 6; min-height: 0; }
  .tile .v { margin-top: 16px; }
  .panel { padding: 26px 18px; border-radius: 22px; }
  .bar { height: 44px; }
  .seg button { padding: 5px 9px; }
  .pick select { padding-left: 11px; padding-right: 24px; background-position: right 9px center; }
  .row .name { font-size: 17px; }
  /* the number gets its own line so labels are not squeezed into three-line wraps */
  .row { grid-template-columns: 14px minmax(0, 1fr); row-gap: 6px; padding: 16px 0; }
  .row > div:last-child { grid-column: 2; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; }
  .row .amt, .row .per { text-align: left; margin-top: 0; }
  .row .amt { font-size: 21px; }
  .row.sub { padding-left: 24px; }
  .row.total .amt { font-size: 26px; }
  .now .cell { padding: 20px 16px; min-height: 120px; }
  .gen { grid-template-columns: 92px minmax(0, 1fr) 58px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
