/* Rooftop Index — see web/DESIGN.md for the reasoning behind every value here.

   Two chromatic tokens, two meanings, no exceptions:
     --lcd    = a recorded installation
     --copper = no recorded installation
   If you find yourself reaching for either one as decoration, stop: it drains
   the only signal on the page. */

:root {
  --paper: #eaebe5;
  --card: #f4f5f0;
  --ink: #171b18;
  --ink-soft: #4a524b;
  --lcd: #7e9470;
  --lcd-deep: #566c49;
  --copper: #9a5a32;
  --rule: #c3c5b9;

  --measure: 68ch;
  --gap: 1.5rem;

  /* 1.25 scale */
  --t-13: 0.8125rem;
  --t-16: 1rem;
  --t-20: 1.25rem;
  --t-25: 1.5625rem;
  --t-31: 1.9375rem;
  --t-39: 2.4375rem;
  --t-49: 3.0625rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Archivo, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: var(--t-16);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: 1.25rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
}

.masthead a { color: inherit; text-decoration: none; }

.masthead__name {
  font-size: var(--t-20);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
}

.masthead__note {
  font-size: var(--t-13);
  color: var(--ink-soft);
  margin: 0;
  max-width: 40ch;
}

/* ---------- the record: the one bold element ---------- */

.record { padding: 3rem 0 2.5rem; border-bottom: 1px solid var(--rule); }

.record__scope {
  font-size: var(--t-13);
  color: var(--ink-soft);
  margin: 0 0 0.5rem;
}

.record__scope a { color: inherit; }

.record__head {
  font-size: var(--t-39);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin: 0 0 1.75rem;
  max-width: 22ch;
}

/* The district strip: one segment per installer, lit where there is a recorded
   installation. The number and the picture of the number, at once. */
.strip {
  display: flex;
  gap: 1px;
  height: 3.25rem;
  margin: 0 0 0.75rem;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.strip__seg { flex: 1 1 0; min-width: 0; }
.strip__seg--on { background: var(--lcd); }
.strip__seg--off { background: var(--copper); }

.strip__legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 2rem;
  font-size: var(--t-16);
  margin: 0;
  padding: 0;
  list-style: none;
}

.strip__legend b { font-weight: 700; }

.strip__legend li::before {
  content: '';
  display: inline-block;
  width: 0.75rem;
  height: 0.75rem;
  margin-right: 0.5rem;
  vertical-align: baseline;
}

.strip__legend li.on::before { background: var(--lcd); }
.strip__legend li.off::before { background: var(--copper); }

/* The sentence built to be quoted. Kept typographically distinct so a reader
   scanning for "what does this page actually claim" lands on it. */
.claim {
  font-size: var(--t-20);
  line-height: 1.45;
  font-weight: 400;
  max-width: 52ch;
  margin: 1.5rem 0 0;
  color: var(--ink-soft);
}
.claim strong { color: var(--ink); font-weight: 600; }

.asof {
  font-size: var(--t-13);
  color: var(--ink-soft);
  margin: 0;
}

/* ---------- prose ---------- */

.prose { max-width: var(--measure); }
.prose h2 {
  font-size: var(--t-25);
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 2.5rem 0 0.5rem;
}
.prose h3 { font-size: var(--t-20); font-weight: 600; margin: 1.75rem 0 0.25rem; }
.prose p { margin: 0 0 1rem; }
.prose a { color: var(--lcd-deep); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.prose ul { padding-left: 1.1rem; margin: 0 0 1rem; }
.prose li { margin-bottom: 0.4rem; }

section { padding: 2.5rem 0; border-bottom: 1px solid var(--rule); }

/* ---------- the register table ---------- */

.register { margin: 0; }

.register__title {
  font-size: var(--t-20);
  font-weight: 600;
  margin: 0 0 0.25rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.register__title span { font-weight: 400; color: var(--ink-soft); font-size: var(--t-16); }

.register__note {
  font-size: var(--t-13);
  color: var(--ink-soft);
  max-width: var(--measure);
  margin: 0 0 1.25rem;
}

table { width: 100%; border-collapse: collapse; line-height: 1.35; }

caption { text-align: left; font-size: var(--t-13); color: var(--ink-soft); padding-bottom: 0.5rem; }

th, td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: baseline;
}

th {
  font-size: var(--t-13);
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom-width: 2px;
}

td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.rank, th.rank { text-align: right; color: var(--ink-soft); font-size: var(--t-13); width: 3rem; }

tbody tr:nth-child(odd) { background: color-mix(in srgb, var(--card) 55%, transparent); }

td a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 3px; }
td a:hover { text-decoration-color: var(--lcd-deep); }

/* A withheld row keeps its rank and its numbers. It is not hidden, not moved,
   not styled as an error. */
.withheld { color: var(--ink-soft); font-style: italic; }
.withheld a { color: var(--ink-soft); }

/* Per-row install bar — the strip's vocabulary, at row scale. */
.bar {
  display: block;
  height: 3px;
  margin-top: 0.35rem;
  background: var(--lcd);
  min-width: 2px;
}
.bar--none { background: var(--copper); width: 8px; }

/* ---------- district cards on the state hub ---------- */

.districts { list-style: none; padding: 0; margin: 0; }
.districts li { border-bottom: 1px solid var(--rule); padding: 0.9rem 0; }
.districts a { font-size: var(--t-20); font-weight: 600; color: var(--ink); text-decoration: none; }
.districts a:hover { text-decoration: underline; text-decoration-color: var(--lcd-deep); }
.districts p { margin: 0.15rem 0 0; font-size: var(--t-13); color: var(--ink-soft); }

/* ---------- footer ---------- */

.foot {
  padding: 2rem 0 3rem;
  font-size: var(--t-13);
  color: var(--ink-soft);
  max-width: var(--measure);
}
.foot p { margin: 0 0 0.6rem; }
.foot a { color: var(--lcd-deep); }
.foot nav { margin-bottom: 1rem; }
.foot nav a { margin-right: 1rem; }

/* ---------- floor ---------- */

a:focus-visible, :focus-visible {
  outline: 2px solid var(--lcd-deep);
  outline-offset: 2px;
}

@media (max-width: 40rem) {
  /* The register heading and its count sit side by side on a wide screen and
     stack on a narrow one — flexed side by side at 390px, "The register" wraps
     mid-phrase against the count. */
  .register__title { display: block; }
  .register__title span { display: block; margin-top: 0.15rem; }
}

@media (max-width: 34rem) {
  .record__head { font-size: var(--t-31); }
  .claim { font-size: var(--t-16); }
  .strip { height: 2.25rem; }
  th.hide-s, td.hide-s { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
