/* Quote Builder v3 — all selectors .qb- prefixed; reuses styles.css tokens.
 * Vertical scale (8px base): --qb-1 8 / --qb-2 16 / --qb-3 24 / --qb-4 32 / --qb-5 40 / --qb-6 48.
 * The step column, grids and review form span the full .wrap width, the same as the header and footer.
 * Only running text is capped (62ch).
 * --qb-hdr is the sticky site header height. builder.js measures it and keeps it current;
 * the values below are fallbacks measured at 1280/360px.
 */
:root { --qb-hdr: 166px; }
@media (max-width: 560px) { :root { --qb-hdr: 112px; } }

.qb-page {
  --qb-1: 8px; --qb-2: 16px; --qb-3: 24px; --qb-4: 32px; --qb-5: 40px; --qb-6: 48px;
  --qb-line: #c9c3b4; --qb-line-soft: #e2ddd2; --qb-line-nav: #d9d4c8; --qb-line-input: #8a8578;
}
.qb-page main { background: var(--paper); }

/* Hero — uses .wrap so the left edge lines up with the header/footer */
.qb-hero { background: var(--charcoal); color: var(--white); padding: var(--qb-6) 0 var(--qb-5); }
.qb-kicker { color: var(--green-light); font-size: 12px; line-height: 1.4; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 var(--qb-1); }
.qb-hero h1 { font-size: clamp(28px, 5vw, 42px); margin: 0 0 var(--qb-2); font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.qb-lede { color: #d8dcd6; font-size: 16px; line-height: 1.6; max-width: 620px; margin: 0; }

/* Main column: full .wrap width */
.qb-main { padding: var(--qb-2) 0 88px; }
.qb-steps-col { max-width: none; scroll-margin-top: var(--qb-hdr); }

/* Top navigation: Back + rail in one sticky block directly under the sticky header */
.qb-sticky { position: sticky; top: var(--qb-hdr); z-index: 10; display: flex; align-items: center; gap: var(--qb-1);
  background: var(--paper); border-bottom: 1px solid var(--qb-line-nav); padding: var(--qb-1) 0; }
.qb-sticky .qb-back[hidden] { display: none; }
.qb-sticky .qb-back { flex: 0 0 auto; }
.qb-rail {
  position: static; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 4px;
  background: var(--paper); padding: 0;
}
.qb-rail-chip {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: var(--qb-1);
  min-height: 44px; min-width: 44px;
  padding: 4px 12px; border-radius: 22px;
  font-size: 13px; line-height: 1.2; color: var(--bodygrey);
  background: transparent; border: 1px solid transparent;
}
.qb-rail-chip.qb-active { background: var(--green); color: var(--white); font-weight: 600; }
.qb-rail-chip.qb-done { color: var(--green); }
.qb-rail-chip.qb-clickable { cursor: pointer; border-color: var(--qb-line-input); }
.qb-rail-chip.qb-clickable:hover { border-color: var(--green); }
.qb-rail-chip:focus-visible, .qb-chip:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.qb-rail-dot {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--qb-line); color: var(--charcoal); font-size: 12px; font-weight: 600;
}
.qb-rail-chip.qb-active .qb-rail-dot { background: var(--white); color: var(--green); }
.qb-rail-chip.qb-done .qb-rail-dot { background: var(--green); color: var(--white); }
.qb-rail-sep { flex: 1; height: 1px; background: var(--qb-line); min-width: var(--qb-1); }

/* Selection chips */
.qb-chips { display: flex; flex-wrap: wrap; gap: var(--qb-1); padding: var(--qb-2) 0 0; }
.qb-chips[hidden] { display: none; }
.qb-chip {
  display: inline-flex; align-items: center; gap: var(--qb-1);
  min-height: 44px;
  background: var(--white); border: 1px solid var(--qb-line-input); border-radius: 22px;
  padding: 4px 16px; font-size: 14px; cursor: pointer;
  transition: border-color .12s;
}
.qb-chip:hover { border-color: var(--green); }
.qb-chip-k { color: var(--bodygrey); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.qb-chip-v { font-weight: 600; color: var(--charcoal); }

/* Steps: padding 40/48, h2 -> content 24. The only .qb-note is rendered inside the
 * options grid (no add-ons), so it spans the grid instead of using an h2 + note offset. */
.qb-step { padding: var(--qb-5) 0 var(--qb-6); border-bottom: 1px solid var(--qb-line-soft); }
.qb-step:last-of-type { border-bottom: none; padding-bottom: var(--qb-5); }
.qb-step h2 { font-size: 22px; margin: 0 0 var(--qb-3); color: var(--charcoal); letter-spacing: -0.01em; line-height: 1.3; }
.qb-note { color: var(--bodygrey); font-size: 15px; line-height: 1.55; margin: 0 0 var(--qb-3); max-width: 62ch; }
.qb-grid > .qb-note { grid-column: 1 / -1; margin: 0; }

/* Option buttons — tactile press */
.qb-grid { display: grid; gap: var(--qb-2); margin: 0; }
.qb-grid-type { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.qb-grid-kva { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
.qb-grid-vol { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.qb-grid-opt { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

/* Border uses --qb-line-input (3.7:1 on white) — --qb-line was 1.8:1, below the 3:1 non-text minimum */
.qb-opt {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px;
  min-height: 56px; padding: var(--qb-2);
  background: var(--white); color: var(--charcoal);
  border: 1px solid var(--qb-line-input); border-radius: 4px;
  font-family: 'IBM Plex Sans', sans-serif; font-size: 16px; font-weight: 500;
  line-height: 1.35;
  text-align: left; cursor: pointer;
  transition: border-color .12s, background .12s, transform .1s, box-shadow .1s;
}
.qb-opt:hover { border-color: var(--green); box-shadow: 0 2px 6px rgba(45,90,63,.12); }
.qb-opt:not(.qb-sel):active { background: #eef3ef; }
.qb-opt:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.qb-opt.qb-press { transform: scale(.97); box-shadow: none; }
.qb-opt.qb-pop { animation: qb-pop .22s ease-out; }
@keyframes qb-pop { 0% { transform: scale(.97); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
.qb-opt.qb-sel { background: var(--green); border-color: var(--green); color: var(--white); }
.qb-opt.qb-sel::after {
  content: '\2713';
  position: absolute; top: var(--qb-1); right: var(--qb-1);
  font-size: 12px; line-height: 1; color: var(--white); opacity: .9;
}
.qb-opt-main { font-size: 16px; font-weight: 500; color: inherit; }
.qb-optsub { font-size: 13px; line-height: 1.35; color: var(--bodygrey); font-weight: 400; }
.qb-opt.qb-sel .qb-optsub { color: #e4ece6; }

/* Buttons */
.qb-btn { font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  min-height: 44px; padding: 8px var(--qb-2); border-radius: 4px; cursor: pointer; transition: background .12s, color .12s, transform .1s; }
.qb-btn-ghost { background: transparent; color: var(--green); border: 1px solid var(--green); }
.qb-btn-ghost:hover { background: var(--green); color: var(--white); }
.qb-btn-ghost:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Free-spec "other" entry */
.qb-other-row { display: flex; gap: var(--qb-2); margin-top: var(--qb-2); align-items: center; }
.qb-other-row .qb-input { flex: 1; }
.qb-input {
  width: 100%; min-width: 0; min-height: 48px;
  padding: 12px var(--qb-2); font-size: 16px; font-family: 'IBM Plex Sans', sans-serif; line-height: 1.4;
  border: 1px solid var(--qb-line-input); border-radius: 4px;
  background: var(--white); color: var(--charcoal);
}
.qb-input:focus { border-color: var(--green); outline: 2px solid var(--green); outline-offset: 1px; }
.qb-input::placeholder { color: #6b6f66; opacity: 1; }
.qb-input[aria-invalid="true"] { border-color: #a33a2a; border-width: 2px; }
.qb-err { border-color: #a33a2a; }

/* ---------- STEP 5: review layout (blocks 40 apart; 64 around Options + Send the quote to) ---------- */
/* NOTE: no .qb-group { margin:0 } here — it has the same specificity as the
 * sibling-spacing rules below and, coming later in the file, it zeroed their
 * margins. Block margins on .qb-group children are intentional. */
.qb-review > * + * { margin-top: var(--qb-5); }                  /* 40px between all blocks */
.qb-review > .qb-spec-card + .qb-group,                          /* above "Options (optional)" */
.qb-review > .qb-group + .qb-fields,                             /* options boxes -> qty/need-by/dest */
.qb-review > .qb-fields + .qb-group { margin-top: var(--qb-5); } /* above "Send the quote to" */
.qb-review > .qb-actions { margin-top: var(--qb-5); }
.qb-review > .qb-fineprint { margin-top: var(--qb-2); }
.qb-label {
  display: block;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.4; letter-spacing: .1em;
  text-transform: uppercase; color: var(--bodygrey); margin: 0 0 var(--qb-2);
}
.qb-spec-card { background: var(--charcoal); color: var(--white); border-radius: 4px; padding: var(--qb-4); margin: 0; }
.qb-spec-title { color: var(--green-light); font-size: 12px; line-height: 1.4; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 var(--qb-2); font-family: 'IBM Plex Mono', monospace; }
.qb-spec-row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--qb-2); padding: 12px 0; border-bottom: 1px solid rgba(127,174,144,.22); font-size: 16px; line-height: 1.4; }
.qb-spec-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.qb-spec-k { color: var(--green-light); flex: 0 0 auto; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.qb-spec-v { text-align: right; font-weight: 500; overflow-wrap: anywhere; font-family: 'IBM Plex Mono', monospace; font-size: 15px; }

.qb-match-note { margin-top: var(--qb-2); padding-top: var(--qb-2); border-top: 1px solid rgba(127,174,144,.22); font-size: 15px; line-height: 1.5; }
.qb-match-yes { color: var(--green-light); font-weight: 500; }
.qb-match-no { color: #d4b06a; font-weight: 500; }
.qb-switch { display: block; width: fit-content; margin: var(--qb-2) 0 0; font-size: 12px; padding: 8px var(--qb-2); }
.qb-spec-card .qb-btn-ghost { color: var(--green-light); border-color: var(--green-light); }
.qb-spec-card .qb-btn-ghost:hover { background: var(--green-light); color: var(--charcoal); }
.qb-match-urls { margin-top: var(--qb-1); }
.qb-match-urls a { display: block; padding: 12px 0; min-height: 44px; font-size: 14px; line-height: 1.4; color: #b4cdbb; overflow-wrap: anywhere; }

/* Compact pickers: label left, options right, rows divided */
.qb-fields { background: var(--white); border: 1px solid var(--qb-line); border-radius: 4px; }
.qb-field-row { display: grid; grid-template-columns: 160px 1fr; gap: var(--qb-3); align-items: center; padding: var(--qb-2) var(--qb-3); }
.qb-field-row + .qb-field-row { border-top: 1px solid var(--qb-line-soft); }
.qb-field-row .qb-label { margin: 0; }
.qb-seg { display: flex; flex-wrap: wrap; gap: var(--qb-1); }
.qb-seg .qb-opt { min-height: 48px; padding: 8px var(--qb-2); font-size: 15px; align-items: center; }
.qb-seg .qb-opt.qb-sel::after { display: none; }

/* Touch: undo sticky hover with explicit resting values ('inherit' resolved to charcoal) */
@media (hover: none) {
  .qb-opt:hover { border-color: var(--qb-line-input); box-shadow: none; }
  .qb-opt.qb-sel:hover { border-color: var(--green); }
  .qb-chip:hover, .qb-rail-chip.qb-clickable:hover { border-color: var(--qb-line-input); }
  .qb-btn-ghost:hover { background: transparent; color: var(--green); }
  .qb-spec-card .qb-btn-ghost:hover { background: transparent; color: var(--green-light); }
  .qb-submit:hover { background: var(--green); }
}

/* Contact */
.qb-contact { display: grid; grid-template-columns: 1fr 1fr; gap: var(--qb-2); }
.qb-contact .qb-note-in { grid-column: 1 / -1; }

/* Actions */
.qb-actions { display: flex; gap: var(--qb-2); align-items: stretch; margin-top: var(--qb-4); }
.qb-actions .qb-submit { flex: 1; }
.qb-submit {
  background: var(--green); color: var(--white);
  font-family: 'IBM Plex Mono', monospace; text-transform: uppercase; text-align: center;
  font-size: 14px; font-weight: 600; letter-spacing: .08em; line-height: 1.35;
  min-height: 56px; padding: var(--qb-2) var(--qb-3); border: none; border-radius: 4px; cursor: pointer;
  transition: background .12s, transform .1s;
}
.qb-submit:hover { background: #244a35; }
.qb-submit:active { background: #1d3d2b; }
.qb-submit:focus-visible { outline: 2px solid var(--charcoal); outline-offset: 2px; }
.qb-submit:disabled { opacity: .6; cursor: wait; }
.qb-fineprint { font-size: 14px; line-height: 1.6; color: var(--bodygrey); margin: var(--qb-2) 0 0; max-width: 62ch; }

.qb-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.qb-nojs { background: var(--white); border: 1px solid var(--qb-line); border-radius: 4px; padding: var(--qb-3); color: var(--bodygrey); margin-top: var(--qb-3); }
.qb-nojs p { margin: 0 0 var(--qb-1); line-height: 1.55; }
.qb-nojs p:last-child { margin-bottom: 0; }

/* Toast */
.qb-toast {
  position: fixed; top: var(--qb-2); left: 50%; transform: translateX(-50%) translateY(-100%);
  background: var(--charcoal); color: var(--white);
  padding: 12px var(--qb-3); border-radius: 24px; font-size: 14px; line-height: 1.4;
  opacity: 0; pointer-events: none; z-index: 100;
  transition: opacity .18s, transform .18s;
}
.qb-toast.qb-toast-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .qb-opt, .qb-btn, .qb-chip, .qb-submit, .qb-toast { transition: none; }
  .qb-opt.qb-pop { animation: none; }
  .qb-opt.qb-press { transform: none; }
}

/* Mobile: same 8px scale, one step tighter; targets stay >= 44px.
 * Rail budget at 360px: content 320 (styles.css .wrap pads 20px at <=600px)
 * = Back ~70 + gap 4 + 5 chips x 44 + 4 seps x >=4 = 310. Below 360 the rail scrolls. */
@media (max-width: 560px) {
  .qb-hero { padding: var(--qb-5) 0 var(--qb-4); }
  .qb-main { padding-top: var(--qb-1); padding-bottom: 80px; }
  .qb-sticky { padding: 4px 0; gap: 4px; }
  .qb-sticky .qb-back { font-size: 12px; letter-spacing: .04em; padding: 0 10px; }
  .qb-rail { gap: 0; }
  .qb-rail-chip { min-width: 44px; padding: 4px; }
  .qb-rail-chip .qb-rail-label { display: none; }
  .qb-rail-sep { min-width: 4px; }

  .qb-step { padding: var(--qb-4) 0 var(--qb-5); }
  .qb-step h2 { font-size: 21px; margin-bottom: var(--qb-2); }
  .qb-note { margin-bottom: var(--qb-2); }

  .qb-grid { gap: 12px; }
  .qb-grid-type { grid-template-columns: 1fr; }
  .qb-grid-kva { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .qb-grid-vol, .qb-grid-opt { grid-template-columns: 1fr 1fr; }
  .qb-opt { min-height: 56px; padding: 12px var(--qb-2); }

  .qb-other-row { flex-direction: column; align-items: stretch; gap: var(--qb-1); }
  .qb-review > * + * { margin-top: var(--qb-4); }
  .qb-review > .qb-spec-card + .qb-group,
  .qb-review > .qb-group + .qb-fields,
  .qb-review > .qb-fields + .qb-group { margin-top: var(--qb-6); }
  .qb-spec-card { padding: var(--qb-3) var(--qb-2); }
  .qb-field-row { grid-template-columns: 1fr; gap: 12px; padding: var(--qb-2); }
  .qb-contact { grid-template-columns: 1fr; gap: 12px; }
  .qb-actions { flex-direction: column-reverse; }
}
@media (max-width: 359px) {
  .qb-rail { overflow-x: auto; scrollbar-width: none; }
  .qb-rail::-webkit-scrollbar { display: none; }
}

/* Static SEO content below the builder */
.qb-seo { padding: var(--qb-6) 0 0; border-top: 1px solid var(--qb-line-soft); max-width: 70ch; }
.qb-seo h2 { font-size: 18px; margin: var(--qb-4) 0 var(--qb-2); color: var(--charcoal); }
.qb-seo h2:first-child { margin-top: 0; }
.qb-seo p { font-size: 15px; line-height: 1.65; color: var(--bodygrey); margin: 0 0 var(--qb-3); }
