/* The home page. Phone first: the lead, then one surface sheet holding the Spread,
   the ranking and the side column, then the How to read a range card and the
   trust strip. From 1080px the ranking and the side column sit side by side.
   Everything here is page layout; marks come from components.css and charts.css. */

.home { padding-bottom: var(--s8); }

/* ------------------------------------------------------------ lead */

.home-lead { padding-block: var(--s5) var(--s5); }
.home-lead__kicker { margin-bottom: var(--s3); }
.home-lead__title { max-width: 19ch; }
.home-lead__dek {
  margin-top: var(--s3);
  font-size: 17px;
  line-height: 26px;
}
.home-stamp {
  display: flex;
  flex-wrap: wrap;
  margin-top: var(--s3);
  font-size: var(--t-small);
  line-height: var(--lh-small);
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.home-stamp__item { white-space: nowrap; }
/* The separator ends a line rather than starting one when the stamp wraps. */
.home-stamp__item:not(:last-child)::after { content: "·"; margin: 0 8px; color: var(--ink-3); }
.home-stamp time { color: var(--ink-2); font-weight: 560; }
/* Who holds each office, as of the ledger's day, and the turnover note. */
.home-asof {
  margin-top: var(--s3);
  font-size: var(--t-small);
  line-height: var(--lh-small);
  color: var(--ink-3);
  max-width: 60ch;
}
.home-asof time { color: var(--ink-2); font-weight: 560; white-space: nowrap; }

@media (min-width: 900px) {
  .home-lead {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    grid-template-areas: "kicker kicker" "title side";
    column-gap: var(--s7);
    align-items: end;
    padding-block: var(--s6) var(--s6);
  }
  .home-lead__kicker { grid-area: kicker; }
  .home-lead__title { grid-area: title; max-width: 22ch; }
  .home-lead__side { grid-area: side; padding-bottom: 6px; }
  .home-lead__dek { margin-top: 0; }
}

/* ------------------------------------------------------------ the sheet */

/* One surface for every chart: marks ring with --surface, so they sit on it.
   Full bleed on a phone, so charts get the whole width. */
.home-sheet {
  --ring: var(--surface);
  margin-inline: calc(-1 * var(--gutter));
  padding-inline: var(--gutter);
  background: var(--surface);
  border-block: 1px solid var(--hairline);
}
@media (min-width: 768px) {
  .home-sheet {
    margin-inline: 0;
    padding-inline: var(--s6);
    border: 1px solid var(--hairline);
    border-radius: var(--r-card);
  }
}

.home-sec { padding-block: 20px var(--s5); min-width: 0; }
@media (min-width: 768px) { .home-sec { padding-block: var(--s5) var(--s6); } }
.home-sheet > .home-sec + .home-sec,
.home-sheet > .home-side,
.home-sheet > .home-side + .home-sec,
.home-side > .home-sec + .home-sec { border-top: 1px solid var(--hairline); }
.home-h { margin-bottom: var(--s3); }

.home-chart { min-width: 0; }
.home-chart .chart__sentence,
.home-chart [data-chart-fallback] > .chart__sentence { max-width: 62ch; }
[data-chart-fallback] > .chart__sentence { margin-bottom: var(--s3); }
[data-chart-fallback] > .note { margin-top: 6px; }
[data-chart-fallback] > .legend { margin-top: var(--s3); }

.home-more { margin-top: var(--s1); font-size: var(--t-small); line-height: var(--lh-small); }
/* The fairness line sits above the Grew and Fell lists; the left-out note above Most and Least. */
.home-fair { margin-top: 0; margin-bottom: var(--s2); max-width: 70ch; }
.home-leftout { margin-top: 0; margin-bottom: var(--s2); max-width: 70ch; }
.home-more__link {
  display: inline-block;
  padding-block: 12px;
  font-weight: 600;
  color: var(--ink);
  text-decoration-color: var(--axis);
  text-underline-offset: 4px;
}
.home-more__link:hover { text-decoration-color: currentColor; }
/* An inline block, so the link's underline stops before the arrow. */
.home-more__arrow { display: inline-block; margin-left: 6px; }

/* Each chart's Chart and Table switch sits on its heading's line, so the plot
   starts higher on a phone. Below 360px (a small phone, or 200 percent zoom) it
   stays in the flow under the sentence. */
@media (min-width: 360px) {
  .home-sec--chart { position: relative; }
  .home-sec--chart .chart { position: static; }
  .home-sec--chart > .home-h,
  .home-sec--chart > .home-rank__head > .home-h { padding-right: 132px; text-wrap: balance; }
  .home-sec--chart .chart__controls {
    position: absolute;
    top: calc(20px + var(--lh-h2) / 2 - 22px);
    right: 0;
    margin: 0;
  }
}
.home-sec--chart .chart__body { margin-top: var(--s3); }
/* Two reference labels sit above the background strips; give them room. */
.home-bg .chart__body { margin-top: var(--s5); }
@media (min-width: 768px) { .home-sec--chart .chart__controls { top: calc(var(--s5) + var(--lh-h2) / 2 - 20px); } }
@media (max-width: 359px) {
  .home-seg { display: grid; grid-template-columns: 1fr 1fr; }
}

/* The Spread's notes run on as one short paragraph under its legend. */
.home-spread .chart__foot, .home-bg .chart__foot { display: block; font-size: var(--t-micro); line-height: var(--lh-micro); }
.home-spread .chart__foot > .legend, .home-bg .chart__foot > .legend { margin-bottom: 8px; }
.home-spread .chart__foot > .note, .home-bg .chart__foot > .note { display: inline; }
.home-spread .chart__foot > .note + .note::before, .home-bg .chart__foot > .note + .note::before { content: " "; }
.home-spread .chart__foot > .tray { margin-top: var(--s3); }

@media (min-width: 1080px) {
  .home-sheet {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
  }
  .home-spread { grid-column: 1 / -1; }
  .home-rank { grid-column: 1; padding-right: var(--s6); border-top: 1px solid var(--hairline); }
  .home-rank .chart__controls { right: var(--s6); }
  .home-side { grid-column: 2; padding-left: var(--s6); border-left: 1px solid var(--hairline); }
  .home-sheet > .home-latest { grid-column: 1 / -1; }
  .home-latest__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: var(--s6); }
  .home-sheet > .home-sec + .home-sec { border-top: 1px solid var(--hairline); }
}

/* ------------------------------------------------------------ server-rendered medians */

/* The no-script Spread and the background teaser: one median range per row. */
.home-medians { list-style: none; margin: 0; padding: 0; }
.home-medians__row { padding-block: 8px 10px; border-top: 1px solid var(--hairline); }
.home-medians__row:first-child { border-top: 0; }
.home-medians__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 6px;
}
.home-medians__name { font-family: var(--serif); font-size: 16px; line-height: 20px; font-weight: 560; color: var(--ink); }
.home-medians__n { font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.home-medians__note { font-size: var(--t-micro); line-height: var(--lh-micro); color: var(--ink-3); }
.home-medians__val {
  margin-left: auto;
  font-size: var(--t-small);
  line-height: var(--lh-small);
  font-weight: 600;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.home-medians + .axis { margin-top: 2px; }

/* ------------------------------------------------------------ the ranking */

.home-rank__head { display: grid; gap: var(--s3); margin-bottom: var(--s4); }
.home-rank__head .home-h { margin-bottom: 0; }
.home-rank__control { margin: 0; padding: 0; border: 0; min-width: 0; }

/* Four equal options across the phone; their natural width on wider screens. */
.home-seg { display: flex; width: 100%; }
.home-seg .seg__opt { flex: 1 1 0; min-width: 0; }
.home-seg .seg__opt > span { justify-content: center; width: 100%; padding: 0 6px; min-height: var(--touch); }
@media (min-width: 560px) {
  .home-seg { display: inline-flex; width: auto; }
  .home-seg .seg__opt { flex: none; }
  .home-seg .seg__opt > span { padding: 0 16px; }
}

/* No script: the four lists are all in the page and the checked option shows one. */
.home-list { display: none; }
.home-rank:has(#rank-most:checked) .home-list[data-mode="most"],
.home-rank:has(#rank-least:checked) .home-list[data-mode="least"],
.home-rank:has(#rank-grew:checked) .home-list[data-mode="grew"],
.home-rank:has(#rank-fell:checked) .home-list[data-mode="fell"] { display: block; }
@supports not selector(:has(*)) {
  .home-list[data-mode="most"] { display: block; }
}
.home-list > .note { margin-bottom: var(--s2); }
.home-list__axis {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 6px 0 0 calc(var(--pl-rank) + var(--pl-gap));
  background: var(--surface);
}
.home-list__legend { margin-top: var(--s3); }
.home-list .ladder__list .pl__bar { margin-top: 4px; }

/* The starting figure as a thin outline above a Grew or Fell bar. */
.home-then-bar { position: relative; padding-top: 8px; }
.home-then {
  position: absolute;
  top: 2px;
  display: block;
  height: 4px;
  border: 1px solid var(--range-edge);
  border-radius: 2px;
}
.home-then--open {
  border-right: 0;
  border-radius: 2px 0 0 2px;
  -webkit-mask-image: linear-gradient(to left, transparent, #000 24px);
  mask-image: linear-gradient(to left, transparent, #000 24px);
}

/* The link under the list follows the control: the explorer, sorted the same way. */
.home-more--least, .home-more--grew, .home-more--fell { display: none; }
.home-rank:has(#rank-least:checked) .home-more--most,
.home-rank:has(#rank-grew:checked) .home-more--most,
.home-rank:has(#rank-fell:checked) .home-more--most { display: none; }
.home-rank:has(#rank-least:checked) .home-more--least,
.home-rank:has(#rank-grew:checked) .home-more--grew,
.home-rank:has(#rank-fell:checked) .home-more--fell { display: block; }

/* ------------------------------------------------------------ find */

.home-search, .home-mine { display: grid; gap: 6px; }
.home-mine { margin-top: var(--s4); }
.home-mine__form { display: grid; gap: 6px; }
.home-search__row { display: flex; gap: 8px; }
.home-search__row > .input, .home-search__row > .select { flex: 1 1 auto; min-width: 0; }
.home-search__row > .btn { flex: none; }
.home-search__input::-webkit-search-cancel-button { display: none; }

/* With the script the picker is a select; without it, a list of state links. */
html:not(.js) .home-mine__form { display: none; }
html.js .home-mine__all { display: none; }
.home-mine__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.home-mine__summary::-webkit-details-marker { display: none; }
.home-mine__summary::after {
  content: "";
  width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--motion) var(--ease);
}
.home-mine__all[open] > .home-mine__summary::after { transform: rotate(-135deg) translateY(-1px); }
.home-mine__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0 16px;
  padding: 0 0 var(--s3);
}
.home-mine__list a { display: inline-flex; align-items: center; min-height: 36px; font-size: var(--t-small); }

/* ------------------------------------------------------------ tally */

.home-tally__shown { margin-top: var(--s3); }

/* ------------------------------------------------------------ latest */

.home-latest__date {
  margin: 0 0 4px;
  font-family: var(--sans);
  font-size: var(--t-micro);
  line-height: var(--lh-micro);
  letter-spacing: var(--track-micro);
  text-transform: uppercase;
  font-weight: 650;
  color: var(--ink-3);
}
.home-latest__list + .home-latest__date { margin-top: var(--s4); }
.home-latest__list { list-style: none; margin: 0; padding: 0; }
.home-latest__item { padding-block: 10px 8px; border-top: 1px solid var(--hairline); }
.home-latest__top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.home-latest__name {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 22px;
  font-weight: 560;
  color: var(--ink);
}
.home-latest__name a { text-decoration: none; }
.home-latest__name a:hover { text-decoration: underline; text-decoration-color: var(--axis); }
.home-latest__value {
  flex: none;
  font-size: var(--t-small);
  line-height: var(--lh-small);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.home-latest__none { font-weight: 450; font-style: italic; color: var(--ink-3); }
.home-latest__what, .home-latest__text {
  margin-top: 2px;
  font-size: var(--t-small);
  line-height: var(--lh-small);
  color: var(--ink-2);
}
.home-latest__item .receipt { margin-top: 0; }

/* ------------------------------------------------------------ how to read a range */

.home-how {
  --ring: var(--surface);
  margin-top: var(--s6);
  padding: var(--s5) var(--s4);
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-card);
}
@media (min-width: 768px) { .home-how { padding: var(--s6); } }
.home-how__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.home-how__head .home-h { margin-bottom: 0; }
.home-how__steps {
  list-style: none;
  display: grid;
  gap: var(--s4);
  margin: var(--s5) 0 0;
  padding: 0;
  counter-reset: none;
}
.home-how__steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.home-how__steps p { max-width: 46ch; color: var(--ink-2); }
.home-how__n {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--axis);
  border-radius: 50%;
  font-size: var(--t-micro);
  line-height: 1;
  font-weight: 650;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transform: translateY(-1px);
}
@media (min-width: 900px) {
  .home-how__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
}
.home-how__examples { display: grid; gap: var(--s5); margin-top: var(--s6); }
@media (min-width: 900px) { .home-how__examples { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s7); } }
.home-how__ex { margin: 0; min-width: 0; }
.home-how__exlabel { font-family: var(--serif); font-size: 17px; line-height: 25px; color: var(--ink); max-width: 40ch; }
.home-how__exlabel .eyebrow { display: block; margin-bottom: 4px; }
.home-how__exlabel strong { font-weight: 620; white-space: nowrap; }
.home-how__plot { position: relative; margin-top: var(--s3); padding-top: 8px; }
.home-how__zone { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--range) 16%, transparent); }
.home-how__plot .axis__zone { display: none; }
.home-how__plot .rb { margin-bottom: 4px; }
.home-how__verdicts {
  list-style: none;
  display: grid;
  gap: var(--s3);
  margin: var(--s6) 0 0;
  padding: var(--s4) 0 0;
  border-top: 1px solid var(--hairline);
}
.home-how__verdicts li { display: grid; gap: 2px; align-content: start; justify-items: start; font-size: var(--t-small); line-height: var(--lh-small); }
.home-how__vtext { color: var(--ink-2); }
@media (min-width: 900px) {
  .home-how__verdicts { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); }
}
/* Once dismissed, the card keeps only its heading and the button that brings it back. */
.home-how.is-collapsed { padding-block: var(--s3); }
.home-how.is-collapsed > :not(.home-how__head) { display: none; }
.home-how.is-collapsed .home-h { font-size: var(--t-body); line-height: var(--lh-body); }

/* ------------------------------------------------------------ trust strip */

.home-trust { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px solid var(--axis); }
.home-trust__list { list-style: none; display: grid; gap: var(--s5); margin: 0; padding: 0; }
@media (min-width: 768px) { .home-trust__list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); } }
.home-trust__h { margin-bottom: 4px; }
.home-trust__item p { font-size: var(--t-small); line-height: var(--lh-small); color: var(--ink-2); max-width: 44ch; }
.home-trust__item p + p { margin-top: 2px; }
