/* Main Street Navigator: owner pages, privacy pages, 404.
   Identity follows the brief (/b/...): cool off-white ground, awning green, window-light amber,
   Zilla Slab display, Public Sans body, IBM Plex Mono data. Signature: a main street whose
   upstairs windows light up. Every color is a token; dark values are set twice
   (prefers-color-scheme and [data-theme="dark"]). No inline styles anywhere (CSP). */

:root {
  --bg: #f5f6f2;
  --surface: #ffffff;
  --ink: #1d2729;
  --ink-soft: #4a5759;
  --rule: #d7ddd6;
  --field-line: #6b7779;
  --accent: #2e6a58;          /* awning green */
  --accent-strong: #22503f;
  --accent-ink: #ffffff;
  --lit: #c88a1a;             /* window light */
  --lit-soft: #f6e7c8;
  --focus: #8a5a00;
  --chip-doc: #dcebe4;
  --chip-doc-ink: #1f5444;
  --chip-rec: #eceae2;
  --chip-rec-ink: #55513f;
  --brick: #8c5a4a;
  --danger: #a3341f;
  --danger-soft: #f8e6e1;
  /* street elevation */
  --st-plaster: #ffffff;
  --st-stone: #e6e3d8;
  --st-brick: #8c5a4a;
  --st-glass: #2f3b3c;
  --st-door: #8c5a4a;
  --st-line: #1d2729;
  --st-cornice: #1d2729;

  --font-display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --font-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-data: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.15rem;
  --step-4: clamp(2.3rem, 5.4vw, 3.9rem);
  --radius: 6px;
  --gutter: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121819;
    --surface: #1a2224;
    --ink: #e3e9e5;
    --ink-soft: #a7b3b0;
    --rule: #2c3739;
    --field-line: #7f8c8a;
    --accent: #6db59b;
    --accent-strong: #8cc9b2;
    --accent-ink: #0d1716;
    --lit: #e3aa47;
    --lit-soft: #3a2f1a;
    --focus: #e3aa47;
    --chip-doc: #1f3a31;
    --chip-doc-ink: #a9dcc8;
    --chip-rec: #2d2b24;
    --chip-rec-ink: #d6cfb4;
    --brick: #c08a78;
    --danger: #f08a74;
    --danger-soft: #3a211c;
    --st-plaster: #1a2224;
    --st-stone: #232a27;
    --st-brick: #4f342c;
    --st-glass: #0b1011;
    --st-door: #6e4639;
    --st-line: #a7b3b0;
  --st-cornice: #56625f;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121819;
  --surface: #1a2224;
  --ink: #e3e9e5;
  --ink-soft: #a7b3b0;
  --rule: #2c3739;
  --field-line: #7f8c8a;
  --accent: #6db59b;
  --accent-strong: #8cc9b2;
  --accent-ink: #0d1716;
  --lit: #e3aa47;
  --lit-soft: #3a2f1a;
  --focus: #e3aa47;
  --chip-doc: #1f3a31;
  --chip-doc-ink: #a9dcc8;
  --chip-rec: #2d2b24;
  --chip-rec-ink: #d6cfb4;
  --brick: #c08a78;
  --danger: #f08a74;
  --danger-soft: #3a211c;
  --st-plaster: #1a2224;
  --st-stone: #232a27;
  --st-brick: #4f342c;
  --st-glass: #0b1011;
  --st-door: #6e4639;
  --st-line: #a7b3b0;
  --st-cornice: #56625f;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: break-word;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0; color: var(--ink); text-wrap: balance; font-variant-numeric: lining-nums; }
.lead, .uses, .ceiling { font-variant-numeric: lining-nums; }
h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.015em; line-height: 1.04; }
h2 { font-size: var(--step-3); font-weight: 600; }
h3 { font-size: var(--step-1); font-weight: 600; }
p, ul, ol, dl, figure { margin: 0; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}
.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
.vh {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.select-all { user-select: all; -webkit-user-select: all; font-family: var(--font-data); }

.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--radius);
}
.skip:focus { top: 12px; }

.wrap { max-width: 1080px; margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 28px; } }

/* ---------- header ---------- */
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); line-height: 1.1; }
.brand svg { width: 30px; height: 30px; flex: none; }
.lang-switch { font-weight: 600; padding: 8px 12px; border: 1.5px solid var(--field-line); border-radius: 999px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- hero ---------- */
.hero { display: grid; gap: 28px; padding-block: 28px 32px; }
.hero .text { display: flex; flex-direction: column; gap: 18px; min-width: 0; max-width: 46rem; }
.eyebrow { font-family: var(--font-data); font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.glow { background-image: linear-gradient(to top, var(--lit-soft) 0, var(--lit-soft) 0.34em, transparent 0.34em); padding-inline: 0.04em; }
.lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink); max-width: 40em; }
.sub { color: var(--ink-soft); max-width: 40em; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--radius);
  background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; line-height: 1.2;
}
.btn:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn[aria-disabled="true"]:hover { background: var(--accent); border-color: var(--accent); }
.btn-quiet { font-weight: 600; color: var(--accent); }

.placard { background: var(--surface); border: 2px solid var(--ink); border-radius: var(--radius); padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 12px; align-self: end; min-width: 0; }
.placard-title { font-family: var(--font-data); font-size: var(--step--1); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.placard-title::before { content: ""; width: 10px; height: 14px; background: var(--lit); border: 2px solid var(--ink); flex: none; }
.placard dl { display: flex; flex-direction: column; gap: 10px; }
.placard dl > div { display: flex; flex-direction: column; gap: 1px; padding-bottom: 10px; border-bottom: 1px dashed var(--rule); }
.placard dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.placard dt { font-family: var(--font-data); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.placard dd { margin: 0; font-weight: 700; line-height: 1.35; }
.placard .due dd { color: var(--brick); }

@media (min-width: 880px) {
  .hero { grid-template-columns: minmax(0, 1fr) 290px; gap: 48px; padding-block: 44px 36px; align-items: end; }
}

/* ---------- street elevation (signature) ---------- */
.street { margin: 0; }
.street svg { display: block; width: 100%; height: auto; min-height: 128px; }
.f-surface { fill: var(--st-plaster); stroke: var(--st-line); }
.f-stone { fill: var(--st-stone); stroke: var(--st-line); }
.f-brick { fill: var(--st-brick); stroke: var(--st-line); }
.f-door { fill: var(--st-door); stroke: var(--st-line); }
.f-ink { fill: var(--st-line); stroke: var(--st-line); }
.f-cornice { fill: var(--st-cornice); }
.f-dark { fill: var(--st-glass); stroke: var(--st-line); }
.f-lit { fill: var(--lit); stroke: var(--st-line); }
.f-accent { fill: var(--accent); }
.s-ink { stroke: var(--st-line); fill: none; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .street .lit { animation: light-up 0.9s ease-out both; }
  .street .l1 { animation-delay: 0.5s; }
  .street .l2 { animation-delay: 0.7s; }
  .street .l3 { animation-delay: 0.9s; }
  .street .l4 { animation-delay: 1.1s; }
  .street .l5 { animation-delay: 1.3s; }
  .street .l6 { animation-delay: 1.5s; }
  .street .l7 { animation-delay: 1.7s; }
  .street .l8 { animation-delay: 1.9s; }
  .street .l9 { animation-delay: 2.1s; }
  .street .l10 { animation-delay: 2.3s; }
  .street .l11 { animation-delay: 2.5s; }
  .street .l12 { animation-delay: 2.7s; }
  @keyframes light-up { from { opacity: 0; } to { opacity: 1; } }
}

/* ---------- sections ---------- */
.sec { display: grid; gap: 18px 44px; padding-block: 40px; border-top: 2px solid var(--ink); }
.street + .sec { border-top-width: 0; }
.sec-head { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec-body { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.prose { max-width: 66ch; }
.note { font-size: var(--step--1); color: var(--ink-soft); max-width: 66ch; }
@media (min-width: 880px) {
  .sec { grid-template-columns: 15.5rem minmax(0, 1fr); padding-block: 52px; }
  .sec-head { position: sticky; top: 20px; align-self: start; }
}

/* loan terms */
.uses { font-family: var(--font-display); font-size: var(--step-1); font-weight: 500; line-height: 1.45; max-width: 52ch; }
/* Four terms: one column, or two (2 x 2). Never three, which left a rule-colored hole in the grid. */
.terms { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(220px, calc(50% - 1px))), 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.terms > div { background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.terms dt { font-family: var(--font-data); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.terms dd { margin: 0; line-height: 1.45; }
.terms dd > span:not(.lead) { color: var(--ink-soft); }
.terms .lead { display: block; font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; line-height: 1.1; color: var(--ink); }
.example { border-left: 4px solid var(--lit); background: var(--surface); padding: 14px 18px; max-width: 66ch; }
.nw { white-space: nowrap; }

/* eligibility checklist: lit-window bullets */
.checklist { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0; max-width: 66ch; }
.checklist li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding-block: 12px; border-top: 1px solid var(--rule); }
.checklist li:last-child { border-bottom: 1px solid var(--rule); }
.checklist li::before { content: ""; width: 12px; height: 17px; margin-top: 4px; background: var(--lit); border: 2px solid var(--ink); }

/* tables */
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 20px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
.tbl caption { text-align: left; font-weight: 700; padding: 0 0 8px; caption-side: top; line-height: 1.35; }
.tbl caption .note { display: block; font-weight: 400; margin-top: 2px; }
.tbl th, .tbl td { padding: 9px 14px; border-bottom: 1px solid var(--rule); text-align: left; }
.tbl thead th { font-family: var(--font-data); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 500; }
.tbl tbody th { font-weight: 500; }
.tbl .num { text-align: right; font-family: var(--font-data); white-space: nowrap; }
.tbl tbody tr:last-child > * { border-bottom: 0; }

/* municipalities: window markers encode status */
.munis { display: flex; flex-direction: column; gap: 0; }
.muni-group { display: grid; gap: 8px; padding-block: 18px; border-top: 1px solid var(--rule); }
.muni-group:last-child { border-bottom: 1px solid var(--rule); }
.muni-group h3 { display: flex; align-items: center; gap: 12px; }
.muni-group h3::before { content: ""; flex: none; width: 14px; height: 20px; border: 2px solid var(--ink); background: var(--bg); }
.muni-group[data-status="eligible"] h3::before { background: var(--lit); }
.muni-group[data-status="resolution"] h3::before { background: linear-gradient(to top, var(--lit) 0 50%, var(--bg) 50% 100%); }
.muni-group[data-status="tight"] h3::before { background: linear-gradient(to top, var(--lit) 0 22%, var(--bg) 22% 100%); }
.muni-group[data-status="not_this_round"] h3::before { background: var(--st-glass); }
.muni-group[data-status="check"] h3::before { border-style: dashed; background: transparent; }
.muni-group p { color: var(--ink-soft); max-width: 66ch; }
.muni-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.muni-list li { padding: 3px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: var(--step--1); }

/* ---------- the check (form) ---------- */
.notice { border: 2px solid var(--lit); background: var(--lit-soft); color: var(--ink); padding: 14px 16px; border-radius: var(--radius); max-width: 66ch; }
.form-card { background: var(--surface); border: 1px solid var(--rule); border-top: 6px solid var(--accent); padding: 20px 16px 24px; border-radius: 0 0 var(--radius) var(--radius); min-width: 0; }
@media (min-width: 720px) { .form-card { padding: 28px 28px 32px; } }
.form-card form { display: flex; flex-direction: column; gap: 8px; }
.step { border: 0; margin: 0 0 20px; padding: 0; min-width: 0; }
.step > legend { display: flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 18px; font-family: var(--font-display); font-size: var(--step-2); font-weight: 600; line-height: 1.15; }
.step-num { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-family: var(--font-data); font-size: 1rem; font-weight: 500; }
.step + .step { margin-top: 16px; }

.q { border: 0; margin: 0 0 24px; padding: 0; min-width: 0; display: block; }
.q > legend, .q-label { display: block; padding: 0; margin-bottom: 6px; font-weight: 700; line-height: 1.4; }
.q .hint { display: block; color: var(--ink-soft); font-size: var(--step--1); margin: -2px 0 10px; max-width: 60ch; }
.q .err { margin: 0 0 10px; }

.ctl {
  display: block; width: 100%; min-height: 48px; padding: 11px 12px;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--field-line); border-radius: var(--radius);
}
textarea.ctl { min-height: 110px; resize: vertical; }
.ctl-short { max-width: 9rem; }
.ctl:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
.has-error .ctl { border-color: var(--danger); border-width: 2px; }

.opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.opts.narrow { grid-template-columns: repeat(auto-fill, minmax(min(100%, 130px), 1fr)); }
.opts.stack { grid-template-columns: minmax(0, 1fr); }
.opt {
  display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--field-line); border-radius: var(--radius); background: var(--surface);
  cursor: pointer; line-height: 1.4;
}
.opt > span { min-width: 0; overflow-wrap: break-word; }
.opt input { flex: none; width: 1.2rem; height: 1.2rem; margin: 0.1em 0 0; accent-color: var(--accent); cursor: pointer; }
.opt:hover { border-color: var(--accent); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--chip-doc); box-shadow: inset 0 0 0 1px var(--accent); }
.opt:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.opt input:focus-visible { outline: none; }
.has-error .opt { border-color: var(--danger); }

.q-rent { display: grid; gap: 16px; }
@media (min-width: 760px) { .q-rent { grid-template-columns: minmax(0, 1fr) 230px; align-items: start; } }
.q-rent .tbl { font-size: var(--step--1); }
.q-rent .tbl th, .q-rent .tbl td { padding: 6px 10px; }

.err { display: block; color: var(--danger); font-weight: 700; font-size: var(--step--1); }
.err:empty { display: none; }
.err-summary { border: 2px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; scroll-margin-top: 16px; }
.err-summary h3 { font-size: var(--step-1); margin-bottom: 8px; }
.err-summary ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.err-summary a { color: var(--danger); font-weight: 600; }

.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; padding-top: 6px; }
.form-status { font-weight: 600; color: var(--ink-soft); }
.form-status.is-error { color: var(--danger); }
.fine { font-size: var(--step--1); color: var(--ink-soft); }

/* ---------- result ---------- */
.result { scroll-margin-top: 16px; }
.result-card { margin-top: 24px; background: var(--bg); border: 2px solid var(--ink); border-left-width: 10px; border-radius: var(--radius); padding: 20px 18px 22px; display: flex; flex-direction: column; gap: 14px; }
@media (min-width: 720px) { .result-card { padding: 24px 26px 26px; } }
.result-card.tier-A, .result-card.tier-B { border-left-color: var(--accent); }
.result-card.tier-C { border-left-color: var(--lit); }
.result-card.tier-N { border-left-color: var(--ink-soft); }
.result-card.tier-X { border-left-color: var(--brick); }
.result-card h3 { font-size: var(--step-2); }
.result-card h4 { font-family: var(--font-data); font-size: var(--step--1); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-soft); }
.result-card ul, .result-card ol { padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; max-width: 64ch; }
.result-card .block { display: flex; flex-direction: column; gap: 6px; }
.result-card .ceiling { font-family: var(--font-display); font-size: var(--step-2); font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
.result-card .contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }

/* ---------- timeline ---------- */
/* Four dates: one column, or two (2 x 2); never three plus a stray fourth. */
.timeline { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(190px, calc(50% - 7px))), 1fr)); gap: 12px; }
.timeline li { background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--accent); padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.timeline .d { font-family: var(--font-data); font-size: var(--step--1); color: var(--accent); font-weight: 500; }
.timeline li.deadline { border-top-color: var(--brick); }
.timeline li.deadline .d { color: var(--brick); }
.timeline li.after { border-top-color: var(--rule); border-top-style: dashed; }
.timeline li.after .d { color: var(--ink-soft); }

/* ---------- about + footer ---------- */
.contact { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; align-items: baseline; }
.contact dt { font-family: var(--font-data); font-size: var(--step--1); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); }
.contact dd { margin: 0; min-width: 0; }
.disclaimer { border-left: 4px solid var(--ink); padding: 4px 0 4px 14px; max-width: 66ch; }

.site-foot { border-top: 2px solid var(--ink); margin-top: 8px; padding-block: 28px 48px; font-size: var(--step--1); color: var(--ink-soft); }
.site-foot .wrap { display: grid; gap: 22px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 8px 20px; font-weight: 600; font-size: var(--step-0); }
.site-foot h2 { font-family: var(--font-data); font-size: var(--step--1); font-weight: 500; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-soft); margin-bottom: 6px; }
.sources { padding-left: 1.1em; display: flex; flex-direction: column; gap: 4px; }
@media (min-width: 880px) { .site-foot .wrap { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .site-foot .full { grid-column: 1 / -1; } }

/* ---------- simple pages (privacy, 404) ---------- */
.page { padding-block: 32px 56px; display: flex; flex-direction: column; gap: 28px; max-width: 70ch; }
.page h1 { font-size: var(--step-3); }
.page h2 { font-size: var(--step-1); font-weight: 700; margin-bottom: 6px; }
.page section { display: flex; flex-direction: column; gap: 8px; }
.page ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.lost { display: grid; gap: 32px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); padding-block: 40px 64px; }
.lost section { display: flex; flex-direction: column; gap: 12px; }
.lost svg { width: 120px; height: auto; }

@media print {
  .site-head nav, .street, #check, .skip { display: none !important; }
  .sec { break-inside: avoid; }
  .sec-head { position: static; }
}

.lost h1, .lost h2 { font-size: var(--step-3); font-weight: 700; }
.page > header { display: flex; flex-direction: column; gap: 8px; }
