/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:       #1e3a5f;
  --brand-mid:   #2d5282;
  --brand-light: #ebf0f8;
  --brand-accent:#3b7dd8;
  --ink:         #1a1a1a;
  --ink-2:       #444;
  --ink-3:       #6b7280;
  --rule:        #d1d5db;
  --surface:     #ffffff;
  --bg:          #f4f5f7;
  --success:     #166534;
  --success-bg:  #dcfce7;
  --warn:        #92400e;
  --warn-bg:     #fef3c7;
  --danger:      #991b1b;
  --danger-bg:   #fee2e2;
  --radius:      8px;
  --radius-lg:   12px;
  --shadow:      0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ───────────────────────────────────────────────────────────── */
h1 { font-size: 2rem;   font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.25rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1rem;   font-weight: 600; }
p  { color: var(--ink-2); }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.site-wrap  { max-width: 720px; margin: 0 auto; padding: 0 1rem; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--brand);
  color: #fff;
  padding: 0;
}
.header-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
  line-height: 1;
}
.wordmark span { color: #7eb8f7; }
.wordmark-sub {
  font-size: .7rem;
  color: rgba(255,255,255,.5);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-top: 2px;
}
.header-tag {
  font-size: .75rem;
  color: rgba(255,255,255,.55);
  text-align: right;
  line-height: 1.5;
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */
.hero {
  background: var(--brand);
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: 2rem;
}
.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem 0;
}
.hero h1 { color: #fff; margin-bottom: .5rem; }
.hero p  { color: rgba(255,255,255,.7); max-width: 540px; font-size: .95rem; }

/* ── Main content ─────────────────────────────────────────────────────────── */
.main { padding: 1.5rem 0 4rem; }

/* ── Step cards ───────────────────────────────────────────────────────────── */
.step {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.step.hidden { display: none; }

.step-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--brand-accent);
  margin-bottom: .25rem;
}
.step h2 {
  margin-bottom: 1rem;
  color: var(--ink);
}
.step-hint {
  font-size: .8rem;
  color: var(--ink-3);
  margin-bottom: 1rem;
  margin-top: -.5rem;
}

/* ── Choice buttons ───────────────────────────────────────────────────────── */
.choices { display: flex; flex-direction: column; gap: .5rem; }
.choices.two-col { flex-direction: row; }
.choices.two-col .choice { flex: 1; }

.choice {
  display: block;
  width: 100%;
  text-align: left;
  padding: .875rem 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .12s, background .12s;
  font-family: inherit;
}
.choice:hover { border-color: var(--brand-accent); background: var(--brand-light); }
.choice.active { border-color: var(--brand); background: var(--brand-light); }

.choice-title {
  display: block;
  font-size: .95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.choice-sub {
  display: block;
  font-size: .8rem;
  color: var(--ink-3);
  margin-top: .2rem;
  line-height: 1.4;
}
.choice.active .choice-sub { color: var(--brand-mid); }

.choice-badge {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--brand-light);
  color: var(--brand);
  margin-left: .5rem;
  vertical-align: middle;
}

/* ── Toggle (inches / mm, stock / custom) ─────────────────────────────────── */
.toggle-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.toggle-btn {
  padding: .45rem 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, background .12s, color .12s;
  color: var(--ink-3);
}
.toggle-btn:hover { border-color: var(--brand-accent); color: var(--ink); }
.toggle-btn.active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}

/* ── Text inputs ──────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--ink-2);
  margin-bottom: .4rem;
}
.text-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  background: var(--surface);
  transition: border-color .12s;
  outline: none;
}
.text-input:focus { border-color: var(--brand-accent); }

.input-hint {
  font-size: .75rem;
  color: var(--ink-3);
  margin-top: .3rem;
}

/* ── Quick picks ──────────────────────────────────────────────────────────── */
.quick-picks { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.quick-pick {
  padding: .3rem .65rem;
  border: 1px solid var(--rule);
  border-radius: 5px;
  font-size: .8rem;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  color: var(--ink-2);
  transition: border-color .1s, background .1s;
}
.quick-pick:hover { border-color: var(--brand-accent); background: var(--brand-light); }
.quick-pick.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); font-weight: 600; }

/* ── Drawer construction radios ───────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .75rem 1rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .12s;
}
.radio-option:has(input:checked) { border-color: var(--brand); background: var(--brand-light); }
.radio-option input { margin-top: 3px; accent-color: var(--brand); }
.radio-option-text { font-size: .9rem; font-weight: 500; color: var(--ink); }
.radio-option-sub  { font-size: .78rem; color: var(--ink-3); }

/* ── Finish swatches ──────────────────────────────────────────────────────── */
.finish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .5rem; }
.finish-btn {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .65rem .85rem;
  border: 2px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: border-color .12s, background .12s;
}
.finish-btn:hover  { border-color: var(--brand-accent); background: var(--brand-light); }
.finish-btn.active { border-color: var(--brand); background: var(--brand-light); }
.finish-swatch {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.12);
  flex-shrink: 0;
}
.finish-name  { display: block; font-size: .82rem; font-weight: 600; color: var(--ink); }
.finish-code  { display: block; font-size: .72rem; color: var(--ink-3); }

/* Swatch colors */
.swatch-14A   { background: #d4d4d4; }
.swatch-US19  { background: #b0b8c1; }
.swatch-26D   { background: #9ca3af; }
.swatch-US26D { background: #9ca3af; }
.swatch-10B   { background: #6b3d2e; }
.swatch-US10B { background: #6b3d2e; }
.swatch-US4   { background: #d4a017; }
.swatch-US3   { background: #d4a017; }

/* ── KA number chips ──────────────────────────────────────────────────────── */
.ka-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .75rem; }
.ka-chip {
  padding: .3rem .7rem;
  border: 2px solid var(--rule);
  border-radius: 5px;
  font-size: .82rem;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-2);
  transition: border-color .1s, background .1s;
}
.ka-chip:hover  { border-color: var(--brand-accent); background: var(--brand-light); }
.ka-chip.active { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

/* ── Primary button ───────────────────────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: .95rem;
  padding: .8rem 1.75rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  margin-top: 1.25rem;
  width: 100%;
  justify-content: center;
  transition: background .12s;
}
.btn-primary:hover { background: var(--brand-mid); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; }

/* ── Notice boxes ─────────────────────────────────────────────────────────── */
.notice {
  padding: .75rem 1rem;
  border-radius: var(--radius);
  font-size: .85rem;
  margin-top: .75rem;
  line-height: 1.5;
}
.notice.warn   { background: var(--warn-bg);    color: var(--warn);    border: 1px solid #fcd34d; }
.notice.danger { background: var(--danger-bg);  color: var(--danger);  border: 1px solid #fca5a5; }
.notice.info   { background: var(--brand-light);color: var(--brand);   border: 1px solid #bfdbfe; }

/* ── Result card ──────────────────────────────────────────────────────────── */
.result-card {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.result-eyebrow {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: rgba(255,255,255,.5);
  margin-bottom: 1rem;
}
.result-part-number {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
  font-family: 'Courier New', monospace;
  line-height: 1.1;
  margin-bottom: .35rem;
}
.result-part-meta {
  font-size: .8rem;
  color: rgba(255,255,255,.55);
  margin-bottom: 1.25rem;
}
.result-divider {
  border: none;
  border-top: 1px solid rgba(255,255,255,.12);
  margin: 1rem 0;
}
.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.result-field-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.45);
  margin-bottom: .15rem;
}
.result-field-value {
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
}
.result-sku-error {
  background: rgba(239,68,68,.2);
  border: 1px solid rgba(239,68,68,.4);
  border-radius: var(--radius);
  padding: .65rem .85rem;
  font-size: .85rem;
  color: #fca5a5;
  margin-top: .75rem;
}

/* ── Action buttons ───────────────────────────────────────────────────────── */
.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
  margin-bottom: 1rem;
}
.btn-copy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .8rem 1rem;
  border-radius: var(--radius);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all .12s;
  border: 2px solid transparent;
}
.btn-copy.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn-copy.primary:hover { background: var(--brand-mid); border-color: var(--brand-mid); }
.btn-copy.ghost {
  background: var(--surface);
  color: var(--ink-2);
  border-color: var(--rule);
}
.btn-copy.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-copy.copied { background: var(--success-bg); color: var(--success); border-color: #86efac; }

/* ── Submittal box ────────────────────────────────────────────────────────── */
.submittal-box {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.submittal-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
  margin-bottom: .5rem;
}
.submittal-text {
  font-size: .88rem;
  font-family: 'Courier New', monospace;
  color: var(--ink);
  line-height: 1.6;
  user-select: all;
  cursor: text;
}
.submittal-hint {
  font-size: .72rem;
  color: var(--ink-3);
  margin-top: .5rem;
}

/* ── Spacers table ────────────────────────────────────────────────────────── */
.spacers-row {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: .5rem;
}
.spacer-chip {
  text-align: center;
  padding: .4rem .6rem;
  background: rgba(255,255,255,.08);
  border-radius: 5px;
  font-size: .75rem;
}
.spacer-chip-part { font-family: monospace; color: #fff; display: block; }
.spacer-chip-size { color: rgba(255,255,255,.5); display: block; font-size: .68rem; }

/* ── Reset link ───────────────────────────────────────────────────────────── */
.reset-wrap { text-align: center; margin-top: .5rem; }
.reset-link {
  font-size: .85rem;
  color: var(--ink-3);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: .25rem;
}
.reset-link:hover { color: var(--ink); }

/* ── About section ────────────────────────────────────────────────────────── */
.about {
  border-top: 1px solid var(--rule);
  padding: 2.5rem 0 0;
  margin-top: 1rem;
}
.about h2 { color: var(--ink); margin-bottom: 1rem; }
.about p { font-size: .9rem; color: var(--ink-3); margin-bottom: .75rem; line-height: 1.7; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--brand);
  color: rgba(255,255,255,.4);
  font-size: .75rem;
  padding: 1.5rem 0;
  margin-top: 3rem;
}
.footer-inner {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ── Error text ───────────────────────────────────────────────────────────── */
.error-text { color: var(--danger); font-size: .85rem; margin-top: .5rem; font-weight: 500; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 540px) {
  h1 { font-size: 1.6rem; }
  .result-part-number { font-size: 1.8rem; }
  .result-grid { grid-template-columns: 1fr; }
  .action-row { grid-template-columns: 1fr; }
  .choices.two-col { flex-direction: column; }
  .finish-grid { grid-template-columns: 1fr 1fr; }
}
