/* The New York City ledger
   Aesthetic: a continuous-form municipal printout. Near-white stock with faint
   greenbar bands, tractor-feed rails down both margins, everything monospace,
   double-rule dividers, stamp-red accents. Dark mode is the same report on a
   terminal. Chart surfaces and series colours are the validated data-viz
   palette and are deliberately left alone. */

:root {
  color-scheme: light;
  --paper:      #f7f6f0;
  --band:       #edf0e6;          /* greenbar stripe across the page */
  --paper-2:    #eeede4;
  --hole:       #ffffff;
  --hole-ring:  rgba(20,20,18,0.25);
  --rule-ink:   rgba(20,20,18,0.22);
  --bar:        #e7eddf;          /* greenbar stripe inside tables */
  --surface-1:  #fcfcfb;          /* validated chart surface */
  --ink:        #16150f;
  --ink-2:      #4e4c40;
  --muted:      #85826f;
  --grid:       #e1e0d9;
  --axis:       #c3c2b7;
  --accent:     #b3271e;          /* stamp red */

  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --s5: #e87ba4; --s6: #008300; --s7: #4a3aa7; --s8: #e34948;

  --mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --paper:      #0f110e;
    --band:       #131712;
    --paper-2:    #171a15;
    --hole:       #060705;
    --hole-ring:  rgba(236,240,225,0.22);
    --rule-ink:   rgba(236,240,225,0.24);
    --bar:        #17200f;
    --surface-1:  #1a1a19;
    --ink:        #eceadf;
    --ink-2:      #bcb9a6;
    --muted:      #8a8878;
    --grid:       #2c2c2a;
    --axis:       #383835;
    --accent:     #ef6a55;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
    --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper:      #0f110e;
  --band:       #131712;
  --paper-2:    #171a15;
  --hole:       #060705;
  --hole-ring:  rgba(236,240,225,0.22);
  --rule-ink:   rgba(236,240,225,0.24);
  --bar:        #17200f;
  --surface-1:  #1a1a19;
  --ink:        #eceadf;
  --ink-2:      #bcb9a6;
  --muted:      #8a8878;
  --grid:       #2c2c2a;
  --axis:       #383835;
  --accent:     #ef6a55;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500;
  --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15.5px;
  line-height: 1.7;
  background-color: var(--paper);
  /* full-page greenbar: two lines of stock, two of band */
  background-image: repeating-linear-gradient(
    to bottom, transparent 0 52px, var(--band) 52px 104px);
}

/* tractor-feed rails */
body::before, body::after {
  content: ""; position: fixed; top: 0; bottom: 0; width: 30px; z-index: 40;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 15px 14px, var(--hole) 4.5px, transparent 5.5px),
    radial-gradient(circle at 15px 14px, var(--hole-ring) 5.5px, transparent 6.5px);
  background-size: 30px 28px;
  pointer-events: none;
}
body::before { left: 0; border-right: 1px dashed var(--rule-ink); }
body::after  { right: 0; border-left: 1px dashed var(--rule-ink); }
@media (max-width: 1239px) { body::before, body::after { display: none; } }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 26px; }

/* ---------- report header ---------- */
.masthead { padding: 44px 0 0; }
.masthead .wrap { position: relative; }
.eyebrow {
  margin: 0 0 18px;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before { content: "* * * "; color: var(--muted); }
.eyebrow::after  { content: " * * *"; color: var(--muted); }
.masthead h1 {
  margin: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}
.standfirst {
  margin: 16px 0 0;
  max-width: 58em;
  color: var(--ink-2);
}
/* stamp chip */
.masthead .wrap::before {
  content: "FORM NYC-30 \00b7 REV. AUG 2026";
  position: absolute; right: 26px; top: -6px;
  font-size: 10px; letter-spacing: 0.14em; color: var(--accent);
  border: 1.5px solid var(--accent); padding: 4px 9px;
  transform: rotate(2deg);
  opacity: 0.85;
}
@media (max-width: 720px) { .masthead .wrap::before { display: none; } }
.masthead .wrap::after {
  content: ""; display: block; margin-top: 26px; height: 8px;
  border-top: 4px double var(--ink);
  border-bottom: 2px solid var(--ink);
}

/* ---------- controls ---------- */
.controls {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper);
  border-bottom: 1px solid var(--ink);
  padding: 10px 0;
}
.controls-inner { display: flex; flex-wrap: wrap; gap: 10px 26px; align-items: center; }
.toggle-group { display: flex; align-items: center; gap: 10px; }
.toggle-label {
  font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--muted);
}
.seg { display: inline-flex; border: 1px solid var(--ink); background: var(--paper); }
.seg-btn {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px;
  color: var(--ink-2); padding: 6px 12px; white-space: nowrap;
  border-right: 1px solid var(--rule-ink);
}
.seg-btn:last-child { border-right: 0; }
.seg-btn:hover { background: var(--paper-2); color: var(--ink); }
.seg-btn.is-on { background: var(--ink); color: var(--paper); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.controls-note { margin: 0 0 0 auto; font-size: 11px; color: var(--muted); }

/* ---------- headline figures ---------- */
.stats {
  display: grid; margin: 40px 0 4px;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  border: 2px solid var(--ink);
  background: var(--surface-1);
}
.stat { padding: 16px 18px 18px; border-right: 1px dashed var(--rule-ink); }
.stat:last-child { border-right: 0; }
.stat-label {
  font-size: 9.5px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 10px;
}
.stat-value {
  font-size: clamp(1.45rem, 3.4vw, 2rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1; margin: 0;
  font-variant-numeric: tabular-nums;
}
.stat-sub { margin: 8px 0 0; font-size: 12px; color: var(--ink-2); }

/* ---------- sections ---------- */
.block { margin: 58px 0; counter-increment: sec; }
.block h2 {
  margin: 0 0 12px; font-weight: 700;
  font-size: clamp(0.9rem, 2vw, 1.05rem); letter-spacing: 0.13em;
  text-transform: uppercase;
  padding-bottom: 10px; border-bottom: 2px solid var(--ink);
  display: flex; align-items: baseline; gap: 12px;
}
.block h2::before {
  content: ">> " counter(sec, decimal-leading-zero);
  color: var(--accent); font-size: 0.9em; letter-spacing: 0;
  white-space: pre;
}
main { counter-reset: sec; }
.dek { margin: 0 0 20px; max-width: 56em; color: var(--ink-2); }
.note {
  margin: 14px 0 0; font-size: 12px; color: var(--muted); max-width: 62em;
  line-height: 1.65;
}
.note a, .foot a { color: inherit; text-decoration: underline; }
.note a:hover, .foot a:hover { color: var(--accent); }

/* chart plate */
.chart-card {
  margin: 0; background: var(--surface-1);
  border: 1px solid var(--ink);
  padding: 16px 18px 14px;
}
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 14px; margin-bottom: 12px; padding-bottom: 10px;
  border-bottom: 1px solid var(--ink);
}
.chart-title {
  font-size: 12px; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.table-btn {
  appearance: none; background: transparent; border: 1px solid var(--rule-ink);
  font: inherit; font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--ink-2); padding: 4px 10px; cursor: pointer;
}
.table-btn:hover { background: var(--paper-2); color: var(--ink); }
.table-btn.is-on { background: var(--ink); color: var(--surface-1); }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }

.legend {
  display: flex; flex-wrap: wrap; gap: 7px 16px; margin-top: 14px;
  padding-top: 11px; border-top: 1px solid var(--grid);
  align-items: center;
}
.legend-item {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px; color: var(--ink-2);
  border: 0; background: none; font-family: inherit;
}
button.legend-item {
  cursor: pointer; padding: 2px 7px 2px 3px; margin: -2px 0;
}
button.legend-item:hover { background: var(--paper-2); color: var(--ink); }
button.legend-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button.legend-item[aria-pressed="true"] { background: var(--ink); color: var(--surface-1); }
.legend-item.is-off { opacity: 0.4; }
.swatch { width: 10px; height: 10px; flex: none; box-shadow: 0 0 0 1px var(--rule-ink) inset; }
.legend-clear {
  font-family: inherit; font-size: 10.5px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--surface-1); background: var(--accent);
  border: 0; cursor: pointer; padding: 3px 10px;
}
.legend-clear:hover { filter: brightness(1.12); }
.hint { margin: 9px 0 0; font-size: 10.5px; color: var(--muted); }

/* ---------- chart controls & growth tool ---------- */
.chart-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 18px; }

.growth-card { padding-bottom: 20px; }
.growth-row { display: flex; flex-wrap: wrap; gap: 14px 22px; }
.growth-field { display: flex; flex-direction: column; gap: 6px; }
.sel {
  appearance: none; font: inherit; font-size: 12.5px;
  color: var(--ink); background: var(--surface-1);
  border: 1px solid var(--ink); border-radius: 0;
  padding: 7px 30px 7px 10px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 49%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 51%);
  background-position: right 16px center, right 11px center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sel:disabled { opacity: 0.45; cursor: default; }
.growth-result {
  margin-top: 18px; padding-top: 16px;
  border-top: 4px double var(--ink);
}
.g-big {
  margin: 0; font-size: clamp(2.2rem, 6vw, 3.6rem); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.g-line { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.g-basis { margin: 10px 0 0; font-size: 10.5px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--muted); }
.g-note { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- greenbar tables ---------- */
.tablewrap { margin-top: 16px; overflow-x: auto; }
table { border-collapse: collapse; font-size: 12px; min-width: 100%; }
th, td { padding: 5px 11px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child {
  text-align: left; position: sticky; left: 0; background: inherit;
}
thead th {
  font-size: 9.5px; letter-spacing: 0.11em;
  text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--ink); background: var(--surface-1);
}
tbody tr { background: var(--surface-1); }
tbody tr:nth-child(even) { background: var(--bar); }
td { font-variant-numeric: tabular-nums; }
td:last-child, th:last-child { border-left: 1px solid var(--rule-ink); font-weight: 700; }

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface-1); color: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 var(--rule-ink);
  padding: 10px 12px; font-size: 11.5px;
  min-width: 205px; max-width: 300px;
}
.tt-head {
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); padding-bottom: 7px; margin-bottom: 7px;
  border-bottom: 1px solid var(--ink);
  display: flex; justify-content: space-between; gap: 12px;
}
.tt-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tt-row .swatch { width: 8px; height: 8px; }
.tt-name { flex: 1; color: var(--ink-2); }
.tt-val { font-variant-numeric: tabular-nums; font-weight: 700; }
.tt-total { border-top: 1px solid var(--ink); margin-top: 7px; padding-top: 7px; }
.tt-note {
  margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--grid);
  font-size: 10px; line-height: 1.5; color: var(--muted); white-space: normal;
}

/* ---------- chart chrome ---------- */
.ax-line { stroke: var(--axis); stroke-width: 1; }
.ax-grid { stroke: var(--grid); stroke-width: 1; }
.ax-text { fill: var(--muted); font-size: 10.5px; font-family: var(--mono); }
.ax-text.tab { font-variant-numeric: tabular-nums; }
.mark-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  paint-order: stroke; stroke: var(--surface-1); stroke-width: 3px;
}
/* opacity is driven by the attribute, so it is not set here: a CSS
   declaration would override it and pin the crosshair permanently visible. */
.crosshair { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; }

/* ---------- method ---------- */
.method { max-width: 62em; }
.method p { margin: 0 0 16px; }
.method a { color: inherit; text-decoration: underline; }
.method a:hover { color: var(--accent); }
.method h3 {
  margin: 30px 0 12px; font-size: 11.5px;
  letter-spacing: 0.13em; text-transform: uppercase; font-weight: 700;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule-ink);
}
.checks { margin: 0 0 16px; padding-left: 0; list-style: none; }
.checks li { margin-bottom: 12px; padding-left: 20px; position: relative; }
.checks li::before {
  content: ">"; position: absolute; left: 0; top: 0;
  color: var(--accent); font-weight: 700;
}
.downloads { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.downloads a {
  font-size: 11.5px; color: var(--ink);
  text-decoration: none; border: 1px solid var(--ink); padding: 5px 11px;
}
.downloads a:hover { background: var(--ink); color: var(--paper); }
.aicaution {
  margin-top: 24px; font-size: 11px; line-height: 1.6;
  color: var(--muted); border-left: 2px solid var(--accent);
  padding-left: 12px; max-width: 58em;
}

.foot {
  border-top: 4px double var(--ink);
  margin-top: 58px; padding: 24px 0 46px;
}
.foot p { margin: 0 0 8px; font-size: 11px; line-height: 1.7; color: var(--muted); max-width: 80em; }
.foot p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .controls-inner { gap: 9px 0; }
  .toggle-group { width: 100%; flex-wrap: wrap; gap: 5px; }
  .toggle-label { width: 100%; }
  .seg { width: 100%; }
  .seg-btn { flex: 1 1 0; text-align: center; padding: 7px 6px; font-size: 11px; }
  .controls-note { margin-left: 0; width: 100%; }
  /* minmax(215px, 1fr) auto-fit still seats two columns at phone widths,
     which widens the page canvas and drags every sibling into overflow. */
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px dashed var(--rule-ink); }
  .masthead h1 { font-size: clamp(1.25rem, 6.4vw, 3.4rem); }
  .chart-card { padding: 12px 12px 10px; }
  .growth-field { width: 100%; }
  .sel { width: 100%; }
}
