/* ===========================================================================
   SRR Gutter Estimator
   Design matched to specialistroofing.com and the Specialist Roofing logo.

   Palette and type sampled from the live site:
     blue   rgb(0,63,190)    #003FBE   (logo mark, headings, hero)
     orange rgb(255,107,39)  #FF6B27   (logo underbar, every call to action)
     navy   rgb(7,29,71)     #071D47   (footer, dark bands)
     hover  rgb(32,76,229)   #204CE5

   The live site sets headings in Nexa Slab 900 uppercase and UI text in Nexa.
   Both are licensed Fontfabric faces that cannot be served from a free CDN, so
   this uses Roboto Slab 900 and Montserrat as the closest free equivalents.
   If SRR holds a Nexa webfont licence, swap the two --font-* tokens and the
   <link> in index.html and nothing else changes.

   Mobile first. Most roofing leads arrive on a phone.
   =========================================================================== */

:root {
  --blue: #003FBE;
  --blue-bright: #204CE5;
  --blue-deep: #071D47;
  --orange: #FF6B27;
  --orange-dark: #E85A18;
  --sky: #63B8F2;

  --ink: #10141c;
  --ink-soft: #4d5665;
  --ink-faint: #8b94a3;
  --line: #dde2ea;
  --line-strong: #c3ccd9;
  --bg: #f4f6fa;
  --surface: #ffffff;

  --warn-bg: #fff4e5;
  --warn-line: var(--orange);
  --err-bg: #fdecea;
  --err-line: #cf3520;
  --ok-bg: #e7f4ec;
  --ok-ink: #1a6b36;

  --font-head: "Roboto Slab", Georgia, serif;
  --font-body: Montserrat, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius: 3px;          /* the live site's buttons are 3px, not pills */
  --radius-card: 6px;
  --gutter: 16px;
  --shadow: 0 1px 3px rgba(7, 29, 71, .08), 0 8px 24px rgba(7, 29, 71, .06);
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, .h-slab {
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.02;
  letter-spacing: -0.005em;
  margin: 0;
}

a { color: var(--blue); }

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

/* ---------- top bar ---------- */
.topbar {
  background: var(--orange);
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 11px var(--gutter);
}
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

/* ---------- header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
}
.logo { display: block; height: 38px; width: auto; }

/* ---------- progress bar, riding along in the sticky header ---------- */
.progress { border-top: 1px solid var(--line); }
.progress[hidden] { display: none; }
.site-header .progress__inner {
  /* Not the header's logo/phone flex row. */
  display: block;
  min-height: 0;
  padding-top: 8px;
  padding-bottom: 8px;
}
.progress__track {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress__fill {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  transition: width 0.4s ease;
}
.progress__steps {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.progress__step button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 2px 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-faint);
  cursor: pointer;
  line-height: 1.15;
}
.progress__dot {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  font-size: 0.66rem;
}
.progress__step.is-done button { color: var(--blue); }
.progress__step.is-done .progress__dot {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.progress__step.is-current button { color: var(--blue-deep); }
.progress__step.is-current .progress__dot {
  border-color: var(--orange); color: var(--orange-dark);
}
/* On a phone only the step you are on keeps its words. */
@media (max-width: 479px) {
  .progress__step:not(.is-current) .progress__label { display: none; }
}

.header-phone {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--blue);
  text-decoration: none;
  white-space: nowrap;
}
.header-phone:hover { color: var(--blue-bright); }

/* ---------- hero ---------- */
.hero {
  background: var(--blue);
  color: #fff;
  padding: 34px 0 30px;
}
.hero h1 { font-size: 1.75rem; }
.hero p {
  margin: 12px 0 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: #cfe0ff;
  max-width: 44ch;
}
.hero .rule {
  width: 62px; height: 5px; background: var(--orange);
  margin: 0 0 16px; border: 0;
}

/* ---------- main ---------- */
main { padding: 22px 0 10px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  padding: 18px var(--gutter);
  margin: 0 0 18px;
}
.card > h2 {
  font-size: 1.1rem;
  color: var(--blue-deep);
  margin-bottom: 2px;
}
.card__step {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 0.7rem;
  color: #fff;
  background: var(--orange);
  padding: 2px 9px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  letter-spacing: 0.06em;
}
.hint { margin: 0 0 14px; font-size: 0.85rem; color: var(--ink-soft); }

/* ---------- form ---------- */
.field { margin: 0 0 16px; }
.field:last-child { margin-bottom: 0; }

.field > label,
.fieldset > legend {
  display: block;
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
  margin: 0 0 6px;
  padding: 0;
}
.field .sub { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-soft); font-size: 0.8rem; }

input[type="number"], input[type="text"], input[type="tel"], input[type="email"], select {
  width: 100%;
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 11px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23003FBE' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}
input:focus, select:focus, button:focus-visible {
  outline: 3px solid rgba(0, 63, 190, .3);
  outline-offset: 1px;
  border-color: var(--blue);
}

.fieldset { border: 0; margin: 0 0 16px; padding: 0; }

/* segmented choice buttons (stories, roof type, material) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { flex: 1 1 auto; min-width: 84px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: block;
  text-align: center;
  padding: 10px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--surface);
  transition: background .12s, border-color .12s, color .12s;
}
.choice input:checked + span {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.choice input:focus-visible + span { outline: 3px solid rgba(0,63,190,.3); outline-offset: 1px; }
.choice span:hover { border-color: var(--blue); }

.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.switch .switch__text { font-size: 0.95rem; }

.two-up { display: grid; grid-template-columns: 1fr; gap: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 14px 22px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background .12s;
}
.btn--primary { background: var(--orange); color: #fff; }
.btn--primary:hover { background: var(--orange-dark); }
.btn--secondary { background: var(--blue); color: #fff; }
.btn--secondary:hover { background: var(--blue-bright); }
.btn--block { display: block; width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- result ---------- */
.result { background: var(--blue-deep); color: #fff; border: 0; }
.result h2 { color: #fff; }
.result__label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #9fb4dd;
  margin: 0;
}
.result__total {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 3rem;
  line-height: 1;
  margin: 4px 0 2px;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.result__band { margin: 0; color: #9fb4dd; font-size: 0.92rem; font-weight: 600; }
.result__note {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,.16);
  font-size: 0.82rem;
  color: #b9c8e6;
}
.result__flag {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 8px;
  border-radius: var(--radius);
  margin-bottom: 8px;
}

/* quantities read-out */
.qty-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 4px;
}
.qty-grid div { background: var(--surface); padding: 10px 12px; }
.qty-grid dt {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--ink-soft); margin: 0;
}
.qty-grid dd {
  margin: 2px 0 0; font-family: var(--font-head); font-weight: 900;
  font-size: 1.15rem; color: var(--blue-deep); font-variant-numeric: tabular-nums;
}

/* ---------- address lookup row ---------- */
.input-row { display: flex; gap: 8px; }
.input-row input { flex: 1 1 auto; min-width: 0; }
.btn--inline { flex: 0 0 auto; padding: 11px 18px; font-size: 0.9rem; }

.btn--ghost {
  background: transparent;
  color: var(--blue);
  border: 1.5px solid var(--line-strong);
}
.btn--ghost:hover { border-color: var(--blue); background: #f2f5fb; }

.linkish {
  background: none; border: 0; padding: 0;
  color: var(--blue); font: inherit; text-decoration: underline; cursor: pointer;
}

/* ---------- address OR linear feet, side by side ---------- */
.start-split { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0 0 18px; }
.start-split__head {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
}
.start-split__col .field:last-child { margin-bottom: 0; }
/* Stacked on a phone: a horizontal rule with "or" on it. */
.start-split__or {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  color: var(--ink-faint);
  font-weight: 800;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.start-split__or::before, .start-split__or::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}
@media (min-width: 720px) {
  .start-split { grid-template-columns: 1fr auto 1fr; gap: 0 22px; }
  /* Side by side: the same rule, turned vertical. */
  .start-split__or { flex-direction: column; margin: 0; }
  .start-split__or::before, .start-split__or::after { width: 1px; height: auto; }
}

/* ---------- address block ---------- */
.addr-grid {
  display: grid;
  grid-template-columns: 1fr 72px 96px;   /* city | state | zip */
  gap: 0 10px;
}
.addr-grid .field { margin-bottom: 16px; }

/* ---------- the measurement, inline under the address ---------- */
.measure {
  margin: 0 0 18px;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.measure__title {
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.98rem;
  color: var(--blue-deep);
  margin: 0 0 4px;
  line-height: 1.1;
}

/* ---------- map ---------- */
.map-wrap { position: relative; }
.map {
  height: 260px;
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: #e8edf5;
  z-index: 0;                 /* keep Leaflet panes under the sticky header */
}
.map-badge {
  /* Leaflet puts its zoom control at top-left, so keep out of its way. */
  position: absolute;
  top: 8px; right: 8px;
  z-index: 500;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: var(--radius);
  color: #fff;
}
.map-badge--ok { background: #1a6b36; }
.map-badge--check { background: var(--orange); }

/* Tracing: taller so a roof fills it, crosshair so a tap reads as "place". */
.map--trace { height: 320px; cursor: crosshair; }
.map--trace.leaflet-container { cursor: crosshair; }
.trace-corner {
  background: #fff;
  border: 3px solid var(--orange);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  cursor: move;
}
.trace-readout { margin: 10px 0; }

/* Leaflet's own attribution must stay legible - it is a licence condition. */
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-attribution { font-size: 10px !important; }

/* ---------- the measurement chain ---------- */
.chain {
  margin: 14px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.chain__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
}
.chain__row:last-child { border-bottom: 0; }
.chain__label { color: var(--ink-soft); font-weight: 600; min-width: 0; }
.chain__value {
  font-weight: 700;
  color: var(--blue-deep);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;   /* keep "200 ft" and its reset link on one line */
}
.chain__row--total { background: #f2f5fb; }
.chain__row--total .chain__label { color: var(--blue-deep); }
.chain__row--total .chain__value {
  font-family: var(--font-head); font-weight: 900; font-size: 1.15rem;
}

/* ---------- editable chain extras ---------- */
.chain__value .chain__input {
  /* Scoped to beat input[type="number"]{width:100%}, which is the same
     specificity as a bare .chain__input and was silently winning - the
     trailing "ft" got pushed out of the row. */
  width: 64px;
  flex: 0 0 auto;
  padding: 4px 7px;
  font-size: 0.92rem;
  font-weight: 700;
  text-align: right;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font-variant-numeric: tabular-nums;
}
.chain__value .linkish { font-size: 0.78rem; font-weight: 600; margin-left: 6px; }
.tag {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--orange);
  color: #fff;
  padding: 1px 6px;
  border-radius: var(--radius);
  margin-left: 6px;
  vertical-align: 1px;
}

/* ---------- per-wall toggles ---------- */
.sides {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 16px;
  background: #fbfcfe;
}
.sides--muted { opacity: 0.6; }
.sides__head {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.sides__head .linkish { text-transform: none; letter-spacing: 0; font-weight: 600; }
.side {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 0.9rem;
}
.side:last-child { border-bottom: 0; }
.side input { width: 18px; height: 18px; accent-color: var(--blue); flex: none; }
.side__name { flex: 1 1 auto; font-weight: 600; }
.side__len { font-weight: 700; color: var(--blue-deep); font-variant-numeric: tabular-nums; }
.side.is-off .side__name,
.side.is-off .side__len { color: var(--ink-faint); text-decoration: line-through; }

.fieldset.is-muted { opacity: 0.55; }

/* ---------- square footage fallback ---------- */
.fallback {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 14px;
  margin: 14px 0 0;
  background: #fbfcfe;
}
.fallback__head {
  margin: 0 0 10px;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
}

/* ---------- optional contact details, above the download ---------- */
.contact {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 14px 2px;
  margin: 0 0 16px;
  background: #fbfcfe;
}
.contact__head {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue-deep);
}
.contact__head .sub {
  font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--ink-soft);
}
.field__error { margin: 6px 0 0; font-size: 0.82rem; font-weight: 600; color: var(--err-line); }
.field input[aria-invalid="true"] { border-color: var(--err-line); }
.warranty-status { margin: 0 0 12px; font-size: 0.85rem; font-weight: 700; color: var(--ok-ink); }
.warranty-status:empty { display: none; }
/* Honeypot: off screen rather than display:none, which some bots skip. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- gutter color: a button, and a panel of swatches ---------- */
.color-pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  font: inherit;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.color-pick:hover { border-color: var(--blue); background: #f7f9fd; }
.color-pick__chip {
  flex: none;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.18);
}
/* Before a pick: a strip of the card's colors, so it reads as "colors". */
.color-pick__chip--any {
  background: linear-gradient(90deg,
    #E8E2D2 0 20%, #C4AA8F 20% 40%, #7D7C77 40% 60%, #473E37 60% 80%, #38493F 80%);
}
.color-pick__text { flex: 1; font-weight: 700; }
.color-pick.has-color .color-pick__text { color: var(--blue-deep); }
.color-pick__action {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--blue);
}

.color-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 18px;
  border: 0;
  border-radius: var(--radius-card);
  box-shadow: 0 20px 60px rgba(7, 29, 71, 0.35);
}
.color-dialog::backdrop { background: rgba(7, 29, 71, 0.55); }
.color-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.color-dialog__head h3 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 1rem;
  color: var(--blue-deep);
}
.color-dialog__close {
  width: 34px; height: 34px;
  border: 0;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
}
.color-dialog__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0;
}

/* Exactly four across, so the twenty colors make five even rows. */
/* minmax(0, 1fr), not 1fr: a long name must not widen its own column. */
.colors { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.color {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px;
  background: none;
  border: 2px solid transparent;
  border-radius: var(--radius-card);
  font: inherit;
  cursor: pointer;
}
.color:hover { border-color: var(--line-strong); }
.color[aria-pressed="true"] { border-color: var(--blue); background: #f2f5fb; }
.color__chip {
  display: block;
  height: 44px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.18);
}
.color__name {
  /* Two lines reserved for every name, so short and long names line up. */
  min-height: 2.3em;
  font-size: 0.74rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink-soft);
  text-align: center;
}
.color[aria-pressed="true"] .color__name { color: var(--blue-deep); }
@media (max-width: 479px) {
  /* Phone: same four columns, less padding, so every name fits on two lines. */
  .color-dialog { padding: 14px 12px; }
  .colors { gap: 4px; }
  .color { padding: 3px; }
  .color__chip { height: 38px; }
  .color__name { font-size: 0.66rem; }
}

/* ---------- gutter profile picker ---------- */
.profiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.profile input { position: absolute; opacity: 0; pointer-events: none; }
.profile__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px 12px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--blue-deep);
  background: var(--surface);
  height: 100%;
  transition: background .12s, border-color .12s, color .12s;
}
.profile__svg { width: 58px; height: 42px; display: block; }
/* Photo tiles: the picture fills the top of the tile at a fixed 3:2, and the
   drawn outline (styles with no photo) gets the same box so tiles line up. */
.profile__box.has-photo, .profile__box:has(.profile__drawing) { padding-top: 6px; }
.profile__photo, .profile__drawing {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  height: auto;
  border-radius: 2px;
  margin-bottom: 6px;
}
.profile__photo { object-fit: cover; background: var(--line); }
.profile__drawing {
  display: grid;
  place-items: center;
  background: #f2f5fb;
}
.profile input:checked + .profile__box .profile__drawing { background: rgba(255,255,255,0.12); }

.profile__name { font-weight: 700; font-size: 0.8rem; text-align: center; line-height: 1.2; }
.profile__hint {
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  color: var(--ink-soft);
  line-height: 1.25;
}
.profile input:checked + .profile__box {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.profile input:checked + .profile__box .profile__hint { color: #cfe0ff; }
.profile input:focus-visible + .profile__box {
  outline: 3px solid rgba(0,63,190,.3); outline-offset: 1px;
}
.profile__box:hover { border-color: var(--blue); }

/* ---------- roof picker: one compact row of four ---------- */
.roofs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.roof input { position: absolute; opacity: 0; pointer-events: none; }
.roof__box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 5px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--blue-deep);
  background: var(--surface);
  transition: background .12s, border-color .12s, color .12s;
}
.roof__svg { width: 30px; height: 22px; display: block; }
.roof__label { font-weight: 700; font-size: 0.74rem; }
.roof input:checked + .roof__box {
  background: var(--blue); border-color: var(--blue); color: #fff;
}
.roof input:focus-visible + .roof__box {
  outline: 3px solid rgba(0,63,190,.3); outline-offset: 1px;
}
.roof__box:hover { border-color: var(--blue); }

/* ---------- line item table ---------- */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 calc(var(--gutter) * -1);
  padding: 0 var(--gutter);
}

table.lines {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 0.85rem;
}
table.lines th {
  text-align: left;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding: 0 10px 7px 0;
  border-bottom: 2px solid var(--blue);
  white-space: nowrap;
}
table.lines td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.lines .num { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.lines th.num { text-align: right; }
table.lines .code {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-soft);
}
table.lines .strong { font-weight: 700; }

table.lines tfoot td {
  border-bottom: 0;
  padding-top: 10px;
  font-weight: 700;
  color: var(--ink-soft);
}
table.lines tfoot tr.grand td {
  border-top: 2px solid var(--blue);
  padding-top: 10px;
  font-family: var(--font-head);
  font-weight: 900;
  font-size: 1.25rem;
  color: var(--blue-deep);
}

table.lines--plain { min-width: 0; font-size: 0.82rem; }
table.lines--plain td { border-bottom: 1px solid rgba(0,0,0,.07); padding: 5px 10px 5px 0; }

/* ---------- assumptions ---------- */
.assumptions {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  font-size: 0.86rem;
}
.assumptions dt {
  font-weight: 700;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 0 0;
}
.assumptions dd {
  margin: 0;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--blue-deep);
}

/* ---------- action row ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 200px; }

/* ---------- notices ---------- */
.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 14px;
  font-size: 0.86rem;
  border-left: 4px solid;
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.notice--error { background: var(--err-bg); border-color: var(--err-line); }
.notice--ok { background: var(--ok-bg); border-color: var(--ok-ink); }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice li { margin: 2px 0; }
.notice strong { display: block; margin-bottom: 2px; }

.disclaimer {
  font-size: 0.83rem;
  color: var(--ink-soft);
  border-left: 4px solid var(--orange);
  padding: 2px 0 2px 12px;
  margin: 0 0 18px;
}

/* ---------- footer ---------- */
.site-footer {
  background: var(--blue-deep);
  color: #a9b8d4;
  padding: 26px 0 34px;
  font-size: 0.82rem;
  margin-top: 26px;
}
.site-footer a { color: #fff; }
.site-footer p { margin: 0 0 8px; }
.site-footer .footer-brand {
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  color: #fff;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
.source-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.1);
  color: #cdd9ee;
}
.source-tag--live { background: rgba(255,255,255,.18); color: #fff; }

.loading { color: var(--ink-faint); font-size: 0.9rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- wider screens ---------- */
@media (min-width: 420px) {
  .chain__value .chain__input { width: 76px; }
}

@media (min-width: 620px) {
  .hero { padding: 48px 0 42px; }
  .table-scroll { margin: 0; padding: 0; }
  .map { height: 340px; }
  /* One row of five photo tiles keeps the section short. */
  .profiles { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .assumptions { grid-template-columns: 1fr 1.4fr; column-gap: 18px; }
  .assumptions dt { padding: 9px 0; border-bottom: 1px solid var(--line); }
  .assumptions dd { padding: 9px 0; }
  .hero h1 { font-size: 2.5rem; }
  .card { padding: 22px 24px; }
  .logo { height: 44px; }
  .two-up { grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .result__total { font-size: 3.75rem; }
  .qty-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- progress rail, down the left on wide screens ---------- */
.rail { display: none; }
@media (min-width: 1240px) {
  /* Room beside the 900px column: show the rail, retire the header bar. */
  .rail:not([hidden]) {
    display: block;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: calc(50% - 450px - 196px);
    width: 172px;
    z-index: 30;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow);
    padding: 16px 14px 14px;
  }
  .progress { display: none; }
}
.rail__head {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.82rem;
  color: var(--blue-deep);
}
.rail__msg { margin: 2px 0 12px; font-size: 0.8rem; font-weight: 700; color: var(--orange-dark); }
.rail__track { position: relative; }
.rail__bar {
  /* The line runs from the first dot's centre to the last one's (the dots
     are 22px, so 11px in from each end, and 9px in to sit under the centre). */
  position: absolute;
  left: 9px;
  top: 11px;
  bottom: 11px;
  width: 4px;
  border-radius: 2px;
  background: var(--line);
}
.rail__fill {
  width: 100%;
  background: var(--orange);
  border-radius: 2px;
  transition: height 0.4s ease;
}
.rail__steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  position: relative;   /* above the line */
}
.rail__step button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-faint);
  text-align: left;
  cursor: pointer;
}
.rail__dot {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--line-strong);
  font-size: 0.7rem;
}
.rail__step.is-done button { color: var(--blue); }
.rail__step.is-done .rail__dot { background: var(--blue); border-color: var(--blue); color: #fff; }
.rail__step.is-current button { color: var(--blue-deep); }
.rail__step.is-current .rail__dot { border-color: var(--orange); color: var(--orange-dark); }
