/* Rhode Island Incentive Checker. Phone first. Fonts, scripts and images are same-origin only. Design rules: DESIGN.md. */
@font-face { font-family: Roboto; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/roboto-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Roboto; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/roboto-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Roboto; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/roboto-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: Jost; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/jost-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Jost; font-weight: 600; font-style: normal; font-display: swap; src: url(fonts/jost-latin-600-normal.woff2) format("woff2"); }

:root {
  /* the studio (stage) */
  --studio-top: #EEF0F3;
  --studio-bottom: #E2E5E9;
  --studio-glow: #F7F8FA;
  --studio-ink: #1B252F;
  --studio-secondary: #485464;
  --studio-stroke: #596574;
  /* the sheet */
  --sheet: #fbfbfa;
  --field: #ffffff;
  --ink: #16191d;            /* text and the selected ring, 17:1 on the sheet */
  --ink-2: #2f353b;          /* secondary text, 12:1 */
  --muted: #5a636c;          /* help text, 5.9:1 */
  --hair: #e3e6e9;           /* 1px hairlines between things */
  --edge: #858f98;           /* control borders, 3.2:1 (WCAG 1.4.11) */
  --wash: #f1f3f4;           /* quiet fills: follow-ups, the secondary button */
  --accent: #2b6ca5;         /* RTP blue, deepened for white text (5.5:1): primary button, focus, links */
  --accent-press: #235a8a;
  --action: #bbd531;         /* RTP lime Action Color (PRODUCT.md): the primary button only */
  --action-press: #a8c01f;
  --action-ink: #1b252f;
  --blue: #4995d1;           /* RTP blue: status dots and the progress bar only */
  --err: #b42318;            /* 6.4:1 */
  --display: Jost, "Futura PT", Futura, "Century Gothic", sans-serif;
  --ui: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --stage-h: clamp(280px, 45svh, 440px);
  --stage-sticky: min(380px, 44svh);
  font-family: var(--ui);
  color: var(--ink);
  accent-color: var(--ink);
  caret-color: var(--accent);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink); background: #fff; }
body.app { background: var(--sheet); min-height: 100svh; overflow-x: clip; }
[hidden] { display: none !important; }
::selection { background: #cfe2f3; color: var(--ink); }
[tabindex="-1"]:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
p { margin: 8px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Stage: the house in a configurator studio (decoration only; aria-hidden) */
.stage { position: relative; z-index: 2; height: var(--stage-h); overflow: hidden; background: var(--studio-bottom); transition: height .5s var(--ease-out); }
/* Steps 1-3 (services, home, household): the house stays pinned while the questions scroll under it, so each pick, and
   an existing heat pump on step 2, plays in view. Step 4 (contact, with the keyboard up) lets it scroll away. */
body[data-view="1"] .stage, body[data-view="2"] .stage, body[data-view="3"] .stage { position: sticky; top: 0; --stage-h: var(--stage-sticky); }
/* A short screen (a phone on its side) cannot spare a sticky stage: it scrolls away with the page. */
@media (max-width: 959px) and (max-height: 600px) { body[data-view="1"] .stage, body[data-view="2"] .stage, body[data-view="3"] .stage { position: relative; } }
/* Keyboard focus never lands under the sticky stage (form.js also scrolls a focused control clear of it). */
@media (max-width: 959px) and (min-height: 601px) { html:has(body:is([data-view="1"], [data-view="2"], [data-view="3"])) { scroll-padding-top: calc(var(--stage-sticky) + 16px); } }
body[data-view="4"] .stage { --stage-h: clamp(260px, 38svh, 340px); }
body[data-view="results"] .stage { --stage-h: clamp(280px, 42svh, 400px); }
/* A phone on its side: the stage keeps to about 38svh so the first question stays fully on screen (the 280px floor above would fill the screen). */
@media (max-width: 959px) and (max-height: 600px) {
  .stage, body[data-view="1"] .stage, body[data-view="2"] .stage, body[data-view="3"] .stage, body[data-view="4"] .stage,
  body[data-view="results"] .stage { --stage-h: clamp(140px, 38svh, 280px); }
  /* Every step, as on phone steps 1 and 4: the house stays clear of the caption and the sheet's rounded edge. */
  body .stage-artwork { top: 8px; bottom: 36px; }
}
body.app .sky { position: absolute; inset: 0; background: radial-gradient(70% 55% at 50% 56%, var(--studio-glow), rgba(247, 248, 250, 0)), linear-gradient(var(--studio-top), var(--studio-bottom)); }
.stage::after { /* the sheet's rounded top edge stays put while the stage is sticky */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 17px; z-index: 3; background: var(--sheet); border-radius: 16px 16px 0 0;
}
.stage-artwork { position: absolute; inset: 0; container-type: size; --vertical-position: .5; --zoom: 1; }
/* A phone held upright: the house is as wide as the screen, so a taller stage alone only adds sky. The box grows 15%
   past the stage's sides instead (only lawn and the lot's edges are cropped) so each upgrade reads while it goes on. */
@media (max-width: 959px) and (min-height: 601px) and (orientation: portrait) { .stage-artwork { --zoom: 1.15; } }
/* The ground: the render's lawn carried under the lot out to the stage edges and under the caption and the sheet, so
   the house stands on land instead of floating in the studio. It hazes in behind the frame from about the lot's middle
   and is full lawn by the frame's bottom feather. */
.stage-ground {
  --lawn: #839667;
  position: absolute; left: 0; right: 0; bottom: -64px; top: 55%;
  background: linear-gradient(rgba(131, 150, 103, 0), var(--lawn) 45%);
}
.stage-frame {
  position: absolute;
  left: 50%;
  /* Browsers without container query units (iOS 15): full stage height, width from the ratio, never wider than the stage.
     If the stage is narrower than 16:10 the box squeezes and object-fit: contain keeps the house whole. */
  top: 0; height: 100%; width: auto; max-width: 100%;
  aspect-ratio: 16 / 10;
  transform: translateX(-50%);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6% 94%, transparent), linear-gradient(transparent, #000 6% 94%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 6% 94%, transparent), linear-gradient(transparent, #000 6% 94%, transparent);
  mask-composite: intersect;
}
@supports (width: 1cqw) {
  .stage-frame, .stage-ground { --frame-h: calc(min(100cqw * var(--zoom), 160cqh) * .625); }
  .stage-frame { top: max(0px, (100cqh - var(--frame-h)) * var(--vertical-position)); height: auto; width: min(100cqw * var(--zoom), 160cqh); max-width: none; }
  .stage-ground {
    top: calc(max(0px, (100cqh - var(--frame-h)) * var(--vertical-position)) + var(--frame-h) * .4);
    background: linear-gradient(rgba(131, 150, 103, 0), var(--lawn) calc(var(--frame-h) * .45));
  }
}
/* When the frame spans the stage's width the lawn runs off both sides: only the sky and the bottom edge fade. */
@container (max-aspect-ratio: 16 / 10) {
  .stage-frame {
    -webkit-mask-image: linear-gradient(transparent, #000 6% 94%, transparent);
    mask-image: linear-gradient(transparent, #000 6% 94%, transparent);
  }
}
.stage-poster, .stage-layers, .stage-video { position: absolute; inset: 0; display: block; }
.stage-frame img, .stage-frame video {
  position: absolute; inset: 0; display: block;
  width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%;
}
@media (max-width: 959.98px) {
  body[data-view="1"] .stage-artwork, body[data-view="2"] .stage-artwork, body[data-view="3"] .stage-artwork,
  body[data-view="4"] .stage-artwork { top: 8px; bottom: 36px; --vertical-position: .42; }
}
.stage-caption {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; padding: 22px 20px 25px; text-align: center;
  font: 400 .8125rem/1.35 var(--ui); letter-spacing: .01em; color: var(--studio-ink);
}
/* The caption is a light label on the lawn (a band of studio grey there would lift the house off the ground again). */
.stage-caption:not(:empty) { left: 50%; right: auto; bottom: 25px; width: max-content; max-width: calc(100% - 40px); padding: 3px 12px; transform: translateX(-50%); background: var(--studio-glow); border-radius: 14px; }
.stage-caption:empty { display: none; }

/* The label sits outside the artwork mask. Light rims keep the leader legible over the render. */
.callouts { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.callout {
  position: absolute; left: 0; top: 0; opacity: 0; padding: 3px 6px; border-radius: 4px;
  text-align: center; white-space: nowrap; color: var(--studio-ink); background: var(--studio-glow);
}
.callout-name { display: block; font: 500 .875rem/1.2 var(--display); letter-spacing: .015em; }
.callout-state { display: block; margin-top: 2px; font: 400 .6875rem/1.2 var(--ui); letter-spacing: .04em; color: var(--studio-secondary); }
.callout-state[hidden] { display: none; }
.callout-line {
  position: absolute; left: 0; top: -.5px; width: 1px; height: 1px; opacity: 0;
  background: var(--studio-stroke); box-shadow: 0 0 0 1px var(--studio-glow); transform-origin: 0 50%;
}
.callout-dot {
  position: absolute; left: -3px; top: -3px; width: 6px; height: 6px; opacity: 0; border-radius: 50%;
  background: var(--studio-stroke); box-shadow: 0 0 0 1px var(--studio-glow);
}

/* ---------- Header (over the studio) */
.site-header {
  position: absolute; top: 0; left: 0; right: 0; z-index: 4;
  display: flex; align-items: center; gap: 10px; color: #fff;
  padding: calc(12px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 8px calc(16px + env(safe-area-inset-left));
}
.brand-mark { width: 36px; height: 36px; flex: none; border-radius: 50%; }
.site-title { font: 500 .9375rem/1.15 var(--display); letter-spacing: .02em; text-wrap: balance; }
.ribbon { margin-left: auto; flex: none; color: rgba(255, 255, 255, .86); font: 500 .6875rem/1 var(--ui); letter-spacing: .06em; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .36); border-radius: 999px; }

body.app .site-header { color: var(--studio-ink); background: var(--studio-top); }
body.app .ribbon { color: var(--studio-ink); border-color: var(--studio-stroke); }

/* The phone header sits above the artwork. */
@media screen and (max-width: 959px) {
  body.app { display: flex; flex-direction: column; }
  body.app > * { flex: none; }
  body.app .site-header { position: relative; order: -1; background: var(--studio-top); padding-bottom: 10px; }
}

/* ---------- Sheet: the survey */
main { max-width: 720px; margin: 0 auto; padding: 18px calc(20px + env(safe-area-inset-right)) 56px calc(20px + env(safe-area-inset-left)); }
.sheet { position: relative; z-index: 1; max-width: none; margin: 0; background: var(--sheet); padding: 8px calc(20px + env(safe-area-inset-right)) calc(44px + env(safe-area-inset-bottom)) calc(20px + env(safe-area-inset-left)); min-height: calc(100svh - var(--stage-h)); }
.sheet-head { display: flex; align-items: center; gap: 16px; padding: 4px 0 18px; }
.progress-label { margin: 0; font: 500 .8125rem/1 var(--ui); letter-spacing: .02em; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.progress { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.progress span { height: 2px; border-radius: 1px; background: var(--hair); transition: background .4s var(--ease-out); }
.progress[aria-valuenow="1"] span:nth-child(-n+1),
.progress[aria-valuenow="2"] span:nth-child(-n+2),
.progress[aria-valuenow="3"] span:nth-child(-n+3),
.progress[aria-valuenow="4"] span { background: var(--ink); }

/* Step 1 introduction: three headline variants share one grid cell, so the active one (a class from assets/variants.js,
   A without it) takes the same height whichever it is; inactive ones are visibility: hidden, out of the accessibility
   tree. Steps 2-4 show only the compact progress header. */
.intro { display: grid; padding: 6px 0 14px; }
.intro-variant { grid-area: 1 / 1; visibility: hidden; }
html:not(.variant-b):not(.variant-c) .intro-variant[data-variant="a"],
html.variant-b .intro-variant[data-variant="b"],
html.variant-c .intro-variant[data-variant="c"] { visibility: visible; }
.intro h1 { margin: 0 0 8px; }
.intro-sub { margin: 0; color: var(--ink-2); max-width: 46ch; }
.intro-trust { grid-area: 2 / 1; margin: 12px 0 0; font: 500 .8125rem/1.3 var(--ui); letter-spacing: .02em; color: var(--muted); }
/* A phone on its side: the subline runs the full width and the spacing tightens, so the first question still shows under the intro. */
@media (max-width: 959px) and (max-height: 600px) {
  .intro { padding: 0 0 8px; }
  .intro h1 { margin-bottom: 4px; }
  .intro-sub { max-width: none; }
  .intro-trust { margin-top: 6px; }
}
body[data-view]:not([data-view="1"]) .intro { display: none; }

h1 { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 2rem; line-height: 1.08; letter-spacing: -.015em; margin: 0 0 14px; text-wrap: balance; }
h2 { font-family: var(--display); font-weight: 600; color: var(--ink); font-size: 1.1875rem; line-height: 1.2; letter-spacing: -.005em; margin: 28px 0 6px; }
h3 { font: 500 1rem/1.35 var(--ui); color: var(--ink); margin: 0 0 8px; text-wrap: pretty; }
.lead { color: var(--ink-2); margin: -6px 0 6px; max-width: 60ch; }
a { color: var(--accent); font-weight: 500; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-press); }

/* The panel holds the active step: one column on a phone, two for short fields on a wide sheet. */
.panel { background: none; border: 0; padding: 0; }
.panel > section { display: grid; grid-template-columns: 1fr; gap: 20px 12px; align-content: start; }
.panel > section > * { grid-column: 1 / -1; min-width: 0; margin: 0; }
.panel > section > h1 { margin-bottom: 0; }
.panel > section > .lead { margin: -10px 0 0; }

/* Fields */
.field { min-width: 0; margin: 0; padding: 0; border: 0; }
label, legend { display: block; padding: 0; font-weight: 500; font-size: .9375rem; line-height: 1.3; color: var(--ink); margin: 0 0 8px; }
.help { font-size: .875rem; line-height: 1.45; color: var(--muted); margin: -4px 0 10px; max-width: 62ch; }
input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%; min-height: 48px; font: 400 1rem/1.2 var(--ui); color: var(--ink);
  background-color: var(--field); border: 1px solid var(--edge); border-radius: 10px; padding: 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
select {
  appearance: none; -webkit-appearance: none; padding-right: 42px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 21px) 52%, calc(100% - 16px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
select:hover, input:not([type="checkbox"]):not([type="radio"]):hover { border-color: var(--ink); }
select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--ink); }
[aria-invalid="true"] { border-color: var(--err) !important; box-shadow: inset 0 0 0 1px var(--err); }
.error { color: var(--err); font-weight: 500; margin: 8px 0 0; font-size: .9375rem; }
.error:empty { display: none; }
#form-error { margin: 16px 0 0; }

/* Choices (radio and checkbox tiles): hairline at rest, a thin dark ring when chosen */
.choices { display: grid; gap: 8px; }
.choices.cols-1 { grid-template-columns: 1fr; }
.choices.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choices.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice { display: flex; align-items: center; gap: 10px; min-height: 48px; margin: 0; padding: 10px 14px; font-weight: 400; font-size: 1rem; line-height: 1.25; color: var(--ink); background: var(--field); border: 1px solid var(--edge); border-radius: 10px; cursor: pointer; transition: border-color .15s, box-shadow .2s var(--ease-out); }
.choice input { width: 18px; height: 18px; margin: 0; flex: none; }
.choice:hover { border-color: var(--ink); }
.choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }
.cols-3 .choice { padding: 10px; gap: 8px; }
.consent-choice { align-items: flex-start; font-size: .9375rem; line-height: 1.45; }
.consent-choice input { margin-top: 2px; }
.notice { font-size: .875rem; color: var(--muted); margin: 0; }
.town-line, .utility-summary p { margin: 0; color: var(--ink-2); font-weight: 500; font-size: .9375rem; }
.utility-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0 14px; margin: -6px 0; }
.followup { grid-column: 1 / -1; background: var(--wash); border-radius: 12px; padding: 16px 16px 4px; display: grid; gap: 14px; }
.followup .field { margin: 0 0 12px; }

/* Buttons: pills. Primary is RTP blue with white text; every label is Title Case. */
.btn, button.link { font: inherit; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: 500 1rem/1 var(--ui); letter-spacing: .01em; min-height: 52px; padding: 0 26px; border-radius: 999px; border: 1px solid transparent; text-decoration: none; text-align: center; cursor: pointer; transition: background .15s, transform .12s var(--ease-out); }
.btn-primary { background: var(--action); color: var(--action-ink); }
.btn-primary:hover { background: var(--action-press); color: var(--action-ink); }
.btn-primary:active { transform: translateY(1px); }
.btn-secondary { background: var(--wash); color: var(--ink); }
.btn-secondary:hover { background: #e6e9eb; color: var(--ink); }
.btn-secondary:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:disabled:active { transform: none; }
button.link, .link { font: 500 .9375rem/1.2 var(--ui); color: var(--accent); background: none; border: 0; padding: 12px 0; min-height: 44px; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; }
button.link:hover { color: var(--accent-press); }
.actions { display: flex; gap: 10px; margin: 32px 0 0; flex-wrap: wrap; }
.actions .btn-primary { flex: 1 1 180px; }
.actions .btn-secondary { flex: 0 1 auto; }

/* ---------- Step 1: service options (checkbox and name) */
.projects-field > legend, .field[data-field="projects"] > legend { margin-bottom: 12px; }
.choices.projects { grid-template-columns: 1fr; gap: 8px; }
.project-choice { display: block; position: relative; min-height: 64px; padding: 14px 16px 14px 50px; border-radius: 12px; transition: border-color .2s, box-shadow .25s var(--ease-out), transform .18s var(--ease-out); }
.project-choice:active { transform: scale(.99); }
.project-choice input, [data-field="notSureProjects"] input {
  appearance: none; -webkit-appearance: none; position: relative; width: 20px; height: 20px; margin: 0;
  background: #fff; border: 1px solid var(--edge); border-radius: 6px; transition: background .15s, border-color .15s;
}
.project-choice input { position: absolute; left: 16px; top: 16px; }
.project-choice input::after, [data-field="notSureProjects"] input::after {
  content: ""; position: absolute; left: 6px; top: 2px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(42deg) scale(0); transform-origin: 60% 60%; transition: transform .18s var(--ease-out);
}
.project-choice input:checked, [data-field="notSureProjects"] input:checked { background: var(--ink); border-color: var(--ink); }
.project-choice input:checked::after, [data-field="notSureProjects"] input:checked::after { transform: rotate(42deg) scale(1); }
.choice-body { display: block; min-width: 0; }
.choice-name { display: block; margin: 0; padding-top: 1px; font-weight: 500; font-size: 1rem; line-height: 1.25; cursor: pointer; }
/* The name's label stretches over the whole tile, so a click anywhere on it toggles the checkbox. */
.choice-name::after { content: ""; position: absolute; inset: 0; border-radius: 11px; }
/* Step 4 teaser: program names and statuses from the preview, never an amount. */
.teaser { background: var(--wash); border-radius: 12px; padding: 14px 16px 10px; }
.teaser-title { margin: 0 0 4px; font-size: 1.0625rem; }
.teaser-list { list-style: none; margin: 0; padding: 0; }
.teaser-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--hair); font-size: .9375rem; line-height: 1.35; }
.teaser-row:first-child { border-top: 0; }
.program-name { overflow-wrap: break-word; min-width: 0; }
/* Status: a small dot and quiet text. Blue dot = likely eligible; open ring = may qualify; grey = not open or no fit. */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 500 .75rem/1.3 var(--ui); letter-spacing: .01em; white-space: nowrap; color: var(--ink-2); background: none; border: 0; padding: 0; vertical-align: middle; }
.badge::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--edge); }
.badge-likely::before, .state-likely_eligible .badge:first-child::before { background: var(--blue); box-shadow: none; }
.state-unavailable .badge:first-child::before, .state-does_not_apply .badge:first-child::before, .state-no_incentive_found .badge:first-child::before { background: #c3c9ce; box-shadow: none; }
.badge-muted { color: var(--muted); }
[data-field="notSureProjects"] { margin-top: 2px; }
[data-field="notSureProjects"] .choice { min-height: 52px; gap: 14px; padding-left: 16px; background: var(--wash); border-color: transparent; font-weight: 500; }
[data-field="notSureProjects"] .choice:hover { border-color: var(--edge); }
[data-field="notSureProjects"] .choice:has(input:checked) { background: var(--field); border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }

/* ---------- Results */
.result-meta { margin: 0 0 14px; font-size: .875rem; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.meta-line { margin: 0; }
.superseded { background: #fff6d6; color: var(--ink); padding: 12px 14px; border-radius: 10px; margin: 14px 0; }
.hero { padding: 14px 0 24px; margin: 0; border-bottom: 1px solid var(--hair); }
body.app .sheet:has(#result:not([hidden])) .sheet-head { display: none; }
.hero h1 { font-size: 1.375rem; font-weight: 500; margin: 0; }
.hero-amount { font-family: var(--display); font-weight: 600; font-size: clamp(2.9rem, 13.2vw, 4.2rem); line-height: 1.02; letter-spacing: -.025em; color: var(--ink); margin: 8px 0 10px; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.hero-sub { margin: 6px 0; color: var(--ink-2); max-width: 42ch; }
.hero-annual { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--hair); font-weight: 500; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.pending-list { margin: 6px 0 0; padding-left: 20px; }
.notes { margin: 20px 0 0; padding: 0 0 0 20px; color: var(--ink-2); }
.notes li { margin: 0 0 6px; max-width: 60ch; }
.notes li::marker { color: var(--blue); }
.project-group h2 { margin: 32px 0 0; padding-bottom: 10px; border-bottom: 1px solid var(--ink); }
.card { background: var(--field); border: 1px solid var(--hair); border-radius: 12px; padding: 16px 18px; margin: 12px 0; break-inside: avoid; }
.badges { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 10px; }
.card-amount { font-family: var(--display); font-weight: 600; font-size: 1.75rem; line-height: 1.1; letter-spacing: -.01em; color: var(--ink); margin: 4px 0 8px; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0; font-size: .9375rem; }
.facts dt { font-weight: 500; color: var(--muted); }
.facts dd { margin: 0; }
.condition, .reason { font-size: .9375rem; margin: 8px 0; }
.card-foot { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: center; margin: 8px 0 0; font-size: .875rem; color: var(--muted); }
.card-foot a { overflow-wrap: anywhere; display: inline-flex; align-items: center; min-height: 44px; padding: 4px 0; } /* 44 px tap target */
.disclaimer { background: var(--field); border: 1px solid var(--hair); border-radius: 12px; padding: 4px 18px 14px; margin: 28px 0 8px; break-inside: avoid; }
.disclaimer h2 { margin-top: 14px; }
.assistance { margin-block: 2rem; }
.agency-list li { margin-block: .5rem; }
.other-programs { background: var(--field); border: 1px solid var(--hair); border-radius: 12px; padding: 0 18px; margin: 16px 0; }
.other-programs summary { cursor: pointer; font-weight: 500; color: var(--ink); padding: 14px 0; min-height: 44px; }
.other-list { list-style: none; margin: 0; padding: 0 0 8px; }
.other-list li { display: flex; flex-direction: column; gap: 2px; padding: 10px 0; border-top: 1px solid var(--hair); font-size: .9375rem; }
.other-name { font-weight: 500; }
.other-reason { color: var(--muted); }
.version-line { font-size: .875rem; color: var(--muted); }
#state-loading { color: var(--muted); }

/* Consultation CTA under the total (docs/SPEC-CRO-V1.md A1). */
.consult { margin: 20px 0 4px; padding: 16px 18px; background: var(--field); border: 1px solid var(--hair); border-radius: 12px; }
.consult-lead { margin: 0 0 12px; color: var(--ink-2); max-width: 48ch; }
.consult-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.consult-actions .btn-primary { flex: 1 1 220px; }
.consult-actions .btn-secondary { flex: 1 1 180px; }
.consult .error { margin-top: 10px; }
.consult-done h2 { margin: 0 0 6px; }
.consult-done p { margin: 0; color: var(--ink-2); }
/* The phone bar: shown by results.js (IntersectionObserver) only after the inline CTA has passed above the viewport. */
.consult-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; flex-wrap: wrap; gap: 8px;
  padding: 10px calc(16px + env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  background: var(--sheet); border-top: 1px solid var(--hair);
}
.consult-bar .btn { flex: 1 1 auto; min-height: 48px; padding: 0 18px; font-size: .9375rem; }
.consult-bar .error { flex-basis: 100%; margin: 0; }
@media screen and (max-width: 959.98px) { body.app.has-consult-bar { padding-bottom: var(--consult-bar-h, 0px); } }
@media (min-width: 960px) { .consult-bar { display: none !important; } }

/* Program and agency disclosures: the card header (name, status, amount) stays visible; details open on demand. */
.card-details, .agency-details, .row-details { margin: 4px 0 0; }
/* list-item keeps the native disclosure triangle; 12 + 20 + 12 px makes a 44 px target. */
.card-details > summary, .agency-details > summary, .row-details > summary {
  display: list-item; min-height: 44px; padding: 12px 0; cursor: pointer; font: 500 .9375rem/20px var(--ui); color: var(--accent);
}
.agency-details { background: var(--field); border: 1px solid var(--hair); border-radius: 12px; padding: 0 18px; margin: 16px 0; }
.agency-details > summary { color: var(--ink); }
.agency-list { padding-left: 20px; }
.agency-list a { display: inline-flex; align-items: center; min-height: 44px; overflow-wrap: anywhere; }
.other-status { color: var(--muted); font-size: .8125rem; }
#action-status { color: var(--muted); font-size: .9375rem; min-height: 1.5em; }

/* ---------- Print view on screen: black on white, no stage */
.print-view { background: #fff; color: #000; }
.print-view .site-header { position: static; background: #fff; color: #000; border-bottom: 2px solid #000; padding: 12px 16px; }
.print-view h1, .print-view h2, .print-view h3, .print-view .card-amount, .print-view .facts dt, .print-view a, .print-view .hero-amount { color: #000; }
.print-view .hero { border: 2px solid #000; padding: 12px 16px; margin: 14px 0; }
.print-view .hero h1, .print-view .hero-sub, .print-view .hero-annual, .print-view .result-meta { color: #000; }
.print-view .hero-annual { border-top-color: #000; }
.print-view .project-group h2 { border-bottom-color: #000; }
.print-view .card, .print-view .disclaimer { border-color: #000; border-radius: 0; }
.print-view .badge { color: #000; }
.print-view .badge::before { background: #fff; box-shadow: inset 0 0 0 1.5px #000; }
.print-view .badge-likely::before, .print-view .state-likely_eligible .badge:first-child::before { background: #000; }
.print-view .ribbon { color: #000; border-color: #000; }
.print-view .notes, .print-view .card-foot, .print-view .other-reason, .print-view .version-line { color: #000; }
.print-view .card-details > summary { display: none; }
.print-view .agency-details { border-color: #000; border-radius: 0; }
.print-view .agency-details > summary { color: #000; }

@page { size: Letter; margin: 0.5in; }
@media print {
  body, body.app, .print-view { background: #fff; color: #000; font-size: 11pt; min-height: 0; }
  .stage { display: none !important; }
  .site-header { position: static; background: #fff; color: #000; padding: 0 0 8px; border-bottom: 2px solid #000; }
  .ribbon { color: #000; border-color: #000; }
  main, .sheet { max-width: none; width: auto; margin: 0; padding: 12px 0 0; min-height: 0; background: #fff; box-shadow: none; border-radius: 0; }
  .no-print, .actions, #action-status, .other-programs, .consult, .consult-bar { display: none !important; }
  body.app.has-consult-bar { padding-bottom: 0 !important; }
  /* Disclosures print flat: results.js opens them before printing (and /print renders them open). */
  .card-details > summary { display: none; }
  .agency-details { border: 0; padding: 0; margin: 12px 0; }
  .agency-details > summary { display: block; min-height: 0; font-weight: 700; color: #000; list-style: none; }
  .agency-details > summary::-webkit-details-marker { display: none; }
  .hero { background: #fff; color: #000; border: 2px solid #000; border-radius: 0; padding: 12px; margin: 0 0 12px; }
  .hero h1, .hero-amount, .hero-sub, .hero-annual, .result-meta { color: #000; }
  .hero-annual { border-top-color: #000; }
  /* Printing mid count-up prints the final figure, never the moving one. */
  .hero-amount > [aria-hidden="true"], .hero-annual > [aria-hidden="true"] { display: none !important; }
  .hero-amount > .sr-only, .hero-annual > .sr-only { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; }
  h1, h2, h3, .card-amount, .facts dt, a { color: #000; }
  h2, h3 { break-after: avoid; }
  .card, .disclaimer, .hero { break-inside: avoid; border: 1px solid #000; border-radius: 0; box-shadow: none; }
  .project-group h2 { border-bottom-color: #000; }
  .badge { color: #000; }
  .badge::before { box-shadow: inset 0 0 0 1.5px #000; }
  .badge-likely::before, .state-likely_eligible .badge:first-child::before { background: #000; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .notes, .card-foot, .version-line { color: #000; }
}

/* ---------- Wider phones and tablets */
@media (min-width: 560px) {
  .choices.projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main { padding-top: 28px; }
  .print-view main { padding-top: 24px; }
}

/* ---------- Desktop: full-bleed studio, the sheet as a right column like a car configurator */
@media (min-width: 960px) {
  body.app { --sheet-w: 460px; background: var(--studio-top); }
  body.app .stage, body.app[data-view="1"] .stage, body.app[data-view="2"] .stage, body.app[data-view="3"] .stage,
  body.app[data-view="4"] .stage, body.app[data-view="results"] .stage { position: fixed; inset: 0; height: auto; z-index: 0; }
  body.app .stage-artwork { right: var(--sheet-w); }
  .stage::after, body[data-view="results"] .stage::after { content: none; }
  .stage-caption:not(:empty) { left: 40px; right: auto; bottom: 36px; padding: 6px 10px; transform: none; background: var(--studio-glow); text-align: left; font-size: .875rem; max-width: min(56ch, calc(100% - var(--sheet-w) - 80px)); border-radius: 4px; }
  body.app .site-header { position: fixed; right: auto; padding: 28px 40px; gap: 14px; }
  body.app .site-header .brand-mark { width: 40px; height: 40px; }
  body.app .site-title { font-size: 1.0625rem; }
  body.app .ribbon { margin-left: 8px; }

  .sheet { width: var(--sheet-w); margin: 0 0 0 auto; min-height: 100vh; padding: 40px 40px 48px; border-left: 1px solid rgba(255, 255, 255, .08); }
  .sheet-head { padding: 0 0 28px; }
  h1 { font-size: 2.375rem; margin-bottom: 18px; }
  .panel > section { grid-template-columns: 1fr 1fr; }
  .panel > section > .field:not(fieldset) { grid-column: auto; }
  /* IDs kept out of the rule above: inside :is() they would outrank the full-width rule for every field. */
  .panel > section > :is(#household-size-extra, #income-field) { grid-column: auto; }
  /* Long and conditional pieces take the full row so a pair never leaves a hole. */
  .panel > section > .field:is([data-field="town"], [data-field="yearBuilt"], [data-field="weatherization"], [data-field="turnstileToken"], [data-field="notSureProjects"], .consent) { grid-column: 1 / -1; }
  /* the options list reads top to bottom in the column, like a configurator */
  .choices.projects { grid-template-columns: 1fr; }
  .actions { margin-top: 36px; }

  .hero { padding-top: 0; }
  .hero h1 { font-size: 1.5rem; margin: 0; }
  .hero-amount { font-size: 4.5rem; margin: 8px 0 12px; }
}
@media (min-width: 1500px) { body.app { --sheet-w: 500px; } .sheet { padding-inline: 48px; } }

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