/* =====================================================================
 * SRC Stair Builder: site-matched stylesheet
 *
 * Mirrors safetyrailcompany.com (WordPress theme "safetyrailco"), sampled
 * 2026-11-25:
 *   Headings  Anton 400, sentence case
 *   Body/UI   Montserrat (nav/buttons 600-700, uppercase)
 *   Colors    charcoal #23201F, safety yellow #FFF200, black top bar,
 *             white content sections
 *   Shapes    square corners on buttons/inputs; the site's signature
 *             cut-corner panel (one rounded top-right corner)
 *   Buttons   15px / 700 / uppercase, 3px border, no radius
 * ===================================================================== */

:root {
  /* Brand */
  --src-yellow: #fff200;
  --src-charcoal: #23201f;
  --src-black: #000;
  --src-white: #fff;

  /* Neutrals */
  --ink: #23201f;
  --muted: #5c5856;
  --line: #d9d7d5;
  --line-soft: #ecebea;
  --surface: #fff;
  --surface-alt: #f5f4f2;

  /* Status */
  --error-bg: #fdecea;
  --error-fg: #8a1c12;
  --note-bg: #fffbcc;
  --note-fg: #4d4700;

  /* Type */
  --font-display: "Anton", "Impact", "Arial Narrow Bold", sans-serif;
  --font-body: "Montserrat", "Segoe UI", Helvetica, Arial, sans-serif;

  /* Layout */
  --site-max: 1380px;
  --gutter: 20px;
  --corner: 40px;          /* signature cut corner on panels */

  /* Legacy aliases (used by older rules / app.js styling hooks) */
  --src-dark: var(--src-charcoal);
  --src-gray: var(--muted);
  --card: var(--surface);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/1.6 var(--font-body);
}

a { color: inherit; }
img { max-width: 100%; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: .2px;
  margin: 0;
}

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

/* ---------------------------------------------------------------------
 * Buttons: same as the site's .cta and "Contact Us" buttons
 * ------------------------------------------------------------------- */
.btn,
button.primary,
.csv-btn {
  display: inline-block;
  font: 700 15px/1 var(--font-body);
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: .2px;
  padding: 15px 18px;
  border: 3px solid var(--src-charcoal);
  border-radius: 0;
  cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn-yellow { background: var(--src-yellow); border-color: var(--src-yellow); color: var(--src-charcoal); }
.btn-yellow:hover { background: var(--src-white); border-color: var(--src-white); }
.btn-white { background: var(--src-white); border-color: var(--src-white); color: var(--src-charcoal); }
.btn-white:hover { background: var(--src-yellow); border-color: var(--src-yellow); }
.btn-outline-light { background: transparent; border-color: var(--src-white); color: var(--src-white); }
.btn-outline-light:hover { background: var(--src-white); color: var(--src-charcoal); }

/* "Request a Quote" style: charcoal fill */
button.primary { background: var(--src-charcoal); color: var(--src-white); }
button.primary:hover { background: var(--src-yellow); color: var(--src-charcoal); }

/* "Download Spec Sheet" style: white fill, charcoal outline */
.csv-btn {
  background: var(--src-white);
  color: var(--src-charcoal);
  padding: 10px 14px;
  font-size: 13px;
}
.csv-btn:hover { background: var(--src-charcoal); color: var(--src-white); }

.btn:focus-visible,
button.primary:focus-visible,
.csv-btn:focus-visible {
  outline: 3px solid var(--src-yellow);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Page chrome. Same look as the main site (colors, type, buttons) but
 * deliberately NOT a copy of its menu or footer: those change over time
 * and this sub-site would fall out of date. Only stable things here:
 * logo, phone, and links back to the main site.
 * ------------------------------------------------------------------- */
.site-header {
  background: var(--src-charcoal);
  border-top: 6px solid var(--src-yellow);
  padding: 18px 0;
}
.site-header .site-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.site-logo { display: block; flex: none; line-height: 0; }
.site-logo img { height: 44px; width: auto; }

.header-actions { display: flex; align-items: center; gap: 22px; }
.header-phone {
  color: var(--src-white);
  font: 600 16px/1.2 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
}
.header-phone span {
  color: var(--src-yellow);
  text-transform: uppercase;
  font-size: 13px;
  letter-spacing: .4px;
  margin-right: 4px;
}
.header-phone:hover { text-decoration: underline; }
.header-home { padding: 11px 14px; font-size: 14px; }

@media (max-width: 640px) {
  .site-logo img { height: 34px; }
  .header-phone span { display: none; }
  .header-home { display: none; }
  .header-phone { color: var(--src-yellow); }
}

.hero {
  background: var(--src-charcoal);
  background-image: linear-gradient(135deg, #3a3634 0%, var(--src-charcoal) 60%);
  color: var(--src-white);
  text-align: center;
  padding: 44px 0 52px;
  border-top: 1px solid #3d3937;
}
.hero h1 {
  font-size: clamp(40px, 6vw, 63px);
  color: var(--src-white);
}
.yellow-tag {
  display: inline-block;
  margin: 18px 0 0;
  background: var(--src-yellow);
  color: var(--src-charcoal);
  font: 400 clamp(15px, 2vw, 19px)/1.4 var(--font-body);
  text-transform: uppercase;
  padding: 4px 8px;
}

.cta-band {
  background: var(--src-charcoal);
  color: var(--src-white);
  text-align: center;
  padding: 56px 0;
}
.cta-band h2 { font-size: clamp(30px, 4vw, 46px); }
.cta-band p { margin: 12px 0 26px; font-size: 17px; color: #dedad7; }
.cta-row { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }

.site-footer {
  background: #1a1817;
  color: var(--src-yellow);
  padding: 28px 0 0;
}
.footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 24px;
}
.footer-row .site-logo img { height: 36px; }
.footer-home {
  color: var(--src-yellow);
  font: 600 15px/1.2 var(--font-body);
  text-transform: uppercase;
  text-decoration: none;
}
.footer-home::after { content: "\00a0\2192"; }
.footer-home:hover { color: var(--src-white); }
.footer-legal {
  border-top: 1px solid #3d3937;
  padding-top: 14px;
  padding-bottom: 14px;
  font-size: 12px;
  text-transform: uppercase;
  color: #bdb9b6;
}


/* ---------------------------------------------------------------------
 * Page sections: the tool reads as a normal page, top to bottom.
 *   1. Measure (white)      intro + diagram | form
 *   2. Your stair (light)   big 3D view | title, specs, quote, parts
 *   3. Size matrix          sales mode only
 * No boxed panels: full-width bands, like the rest of the site.
 * ------------------------------------------------------------------- */
.section { padding: 64px 0; }
.section-alt { background: var(--surface-alt); }
.section h2 { font-size: clamp(32px, 4vw, 44px); }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  font: 700 13px/1 var(--font-body);
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.step-num {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--src-yellow);
  color: var(--src-charcoal);
  font: 400 16px/1 var(--font-display);
}
.lead { margin: 14px 0 24px; font-size: 17px; font-weight: 500; max-width: 560px; }

/* Step 1 */
.step-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}
.step-form { padding-top: 6px; }

.measure-help { margin: 0; max-width: 520px; }
.measure-help svg { display: block; width: 100%; height: auto; }
.measure-help .m-label { font: 700 12px var(--font-body); fill: var(--src-charcoal); letter-spacing: .4px; }
.measure-help figcaption { margin-top: 10px; font-size: 14px; line-height: 1.55; color: var(--muted); }
.measure-help figcaption strong { color: var(--ink); }

@media (max-width: 900px) {
  .section { padding: 44px 0; }
  .step-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }

/* Labels: small uppercase like the site's nav type */
label.field { display: block; }
label.field > span.label-text,
.field > .label-text,
fieldset.toggle > legend {
  display: block;
  font: 700 13px/1.3 var(--font-body);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 8px;
  padding: 0;
  color: var(--ink);
}
.ftin { display: flex; gap: 10px; }
.ftin .input-row { flex: 1; }
.input-row { position: relative; display: block; }

.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--muted); }

/* Inputs: square, charcoal outline on focus, yellow focus glow */
input[type="number"],
.input-row input[type="text"] {
  width: 100%;
  padding: 13px 44px 13px 12px;
  font: 500 17px/1.2 var(--font-body);
  color: var(--ink);
  border: 2px solid var(--line);
  border-radius: 0;
  background: #fff;
}
input[type="number"]:focus,
.input-row input[type="text"]:focus {
  outline: none;
  border-color: var(--src-charcoal);
  box-shadow: 0 0 0 3px rgba(255, 242, 0, .6);
}
.unit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

/* Height stepper */
.stepper input { padding-right: 72px; }
.stepper .unit { right: 40px; }
.stepper .spin {
  position: absolute;
  right: 6px;
  top: 6px;
  bottom: 6px;
  width: 28px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.stepper .spin button {
  flex: 1;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 0;
  cursor: pointer;
  font-size: 8px;
  line-height: 1;
  color: var(--muted);
  padding: 0;
}
.stepper .spin button:hover { background: var(--src-yellow); color: var(--src-charcoal); }
.stepper .spin button:active { transform: translateY(1px); }

/* Segmented toggles (finish / mounting) */
fieldset.toggle { border: 0; padding: 0; margin: 0; min-width: 0; }
.segmented { display: flex; border: 2px solid var(--src-charcoal); width: 100%; }
.segmented label { flex: 1; text-align: center; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  padding: 12px 4px;
  font: 700 13px/1.2 var(--font-body);
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--src-charcoal);
  background: #fff;
  border-right: 2px solid var(--src-charcoal);
}
.segmented label:last-child span { border-right: 0; }
.segmented label:hover span { background: var(--surface-alt); }
.segmented input:checked + span { background: var(--src-yellow); }
.segmented input:focus-visible + span { box-shadow: inset 0 0 0 3px var(--src-charcoal); }

/* Sales mode: "Download CSV" name prompt */
.csv-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 28px;
  border: 0;
  border-top: 6px solid var(--src-yellow);
  border-radius: 0 var(--corner) 0 0;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35);
}
.csv-dialog::backdrop { background: rgba(35, 32, 31, .6); }
.csv-dialog h2 { font-size: 30px; margin-bottom: 18px; }
.csv-dialog .input-row input { padding-right: 12px; }
.csv-error { margin: 6px 0 0; font-size: 13px; font-weight: 600; color: var(--error-fg); }
.dialog-actions { display: flex; align-items: center; gap: 12px 18px; margin-top: 22px; }

/* Required-field invalid state */
.input-row input.invalid,
input.invalid { border-color: #d33b30; box-shadow: 0 0 0 3px rgba(211, 59, 48, .22); }
.input-row input.invalid:focus,
input.invalid:focus { border-color: #d33b30; box-shadow: 0 0 0 3px rgba(211, 59, 48, .35); }

/* Form actions: primary + Start over */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 28px; }
.actions button.primary { padding: 18px 28px; font-size: 16px; }
.btn-reset {
  background: none;
  border: 0;
  padding: 12px 4px;
  font: 700 14px/1 var(--font-body);
  text-transform: uppercase;
  color: var(--src-charcoal);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.btn-reset:hover { color: var(--muted); }

/* ---- Step 2: product-page layout ---- */
.product {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}
#your-stair.is-custom .product { grid-template-columns: minmax(0, 1fr); }
.product-media { position: sticky; top: 20px; }
@media (max-width: 900px) {
  .product { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .product-media { position: static; }
}

.canvas-frame { position: relative; }
#viewer-canvas {
  height: clamp(320px, 42vw, 560px);
  overflow: hidden;
  background: #fff;
  border-radius: 0 var(--corner) 0 0; /* the site's cut corner */
  touch-action: none;                 /* let OrbitControls own touch gestures */
}
#viewer-canvas canvas { display: block; max-width: 100%; }
.canvas-hint {
  position: absolute;
  left: 12px;
  bottom: 12px;
  padding: 6px 10px;
  background: rgba(35, 32, 31, .8);
  color: #fff;
  font: 600 11px/1 var(--font-body);
  text-transform: uppercase;
  letter-spacing: .4px;
  pointer-events: none;
}
.viewer-caption { margin: 10px 2px 0; font-size: 12px; color: var(--muted); }
#pdf-frame {
  display: block;
  width: 100%;
  height: clamp(320px, 42vw, 560px);
  border: 1px solid var(--line);
  background: #fff;
}
#pane-pdf .msg.note { margin-top: 0; }

/* 3D / PDF tabs (match the segmented toggles) */
.viewer-tabs { display: flex; border: 2px solid var(--src-charcoal); margin-bottom: 12px; }
.viewer-tab {
  flex: 1;
  padding: 10px 8px;
  background: #fff;
  border: 0;
  border-right: 2px solid var(--src-charcoal);
  font: 700 13px/1.2 var(--font-body);
  text-transform: uppercase;
  color: var(--src-charcoal);
  cursor: pointer;
}
.viewer-tab:last-child { border-right: 0; }
.viewer-tab:hover { background: var(--surface-alt); }
.viewer-tab.active { background: var(--src-yellow); }
.viewer-tab:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--src-charcoal); }

.product-title { font-size: clamp(34px, 4vw, 48px); }
.product-sub {
  margin: 8px 0 0;
  font: 600 15px/1.4 var(--font-body);
  text-transform: uppercase;
  letter-spacing: .3px;
}

.specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
}
.specs > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.specs > div:nth-child(odd) { padding-right: 16px; }
.specs dt { font: 600 12px/1.2 var(--font-body); text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.specs dd { margin: 4px 0 0; font: 400 24px/1.1 var(--font-display); }

.rounding { margin: 14px 0 0; font-size: 14px; color: var(--muted); }

.buy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 26px; }
.btn-lg { padding: 18px 30px; font-size: 16px; }
.btn-yellow.btn-lg { border-color: var(--src-yellow); }
.btn-yellow.btn-lg:hover { background: var(--src-charcoal); border-color: var(--src-charcoal); color: var(--src-yellow); }
.quote-sub { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.phone-link { font-weight: 700; color: var(--src-charcoal); text-decoration: none; }
.phone-link:hover { text-decoration: underline; }

.bom-section { margin-top: 36px; }
.bom-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.bom-head h3 { font-size: 26px; }
.bom-wrap { overflow-x: auto; }
table.bom { width: 100%; border-collapse: collapse; }
table.bom th, table.bom td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  vertical-align: top;
}
table.bom th:first-child, table.bom td:first-child { padding-left: 0; }
table.bom thead th {
  font: 700 12px/1.2 var(--font-body);
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  border-bottom: 2px solid var(--src-charcoal);
}
table.bom .pn { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; width: 1%; }
table.bom .qty { text-align: center; width: 48px; }

.edit-link {
  display: inline-block;
  margin-top: 24px;
  font: 700 14px/1 var(--font-body);
  text-transform: uppercase;
  color: var(--src-charcoal);
  text-underline-offset: 4px;
}
.edit-link::before { content: "\2191\00a0"; }
.edit-link:hover { color: var(--muted); }

.msg {
  padding: 12px 14px;
  font-size: 14px;
  margin-top: 14px;
  border-left: 5px solid currentColor;
}
.msg.error { background: var(--error-bg); color: var(--error-fg); }
.msg.error ul { margin: 8px 0 0; padding-left: 20px; }
.msg.note { background: var(--note-bg); color: var(--note-fg); border-left-color: var(--src-charcoal); }
#form-msg .msg { margin-top: 20px; }

/* Out-of-range: custom stair */
.custom-box { max-width: 760px; }
.custom-box h2 { margin-bottom: 12px; }
.custom-box p { margin: 0 0 10px; font-size: 17px; font-weight: 500; }
.custom-box .eyebrow { font-size: 13px; font-weight: 700; }
.cta-row-left { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 20px; }

/* More buttons */
.btn-charcoal { background: var(--src-charcoal); border-color: var(--src-charcoal); color: var(--src-white); }
.btn-charcoal:hover { background: var(--src-yellow); border-color: var(--src-yellow); color: var(--src-charcoal); }
.btn-outline { background: var(--src-white); border-color: var(--src-charcoal); color: var(--src-charcoal); }
.btn-outline:hover { background: var(--src-charcoal); color: var(--src-white); }

/* ---- Size matrix (sales mode) ---- */
#matrix-panel { border-top: 1px solid var(--line); }
.matrix-sub { margin: 8px 0 16px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border: 1px solid rgba(0, 0, 0, .2); flex: none; }

/* Band colors (sampled from the spec sheet) */
.band-yellow { background: #f4e08c; }
.band-lightgray { background: #dcdcdc; }
.band-darkgray { background: #b4b6b8; }

#matrix-wrap { overflow-x: auto; }
table#matrix { border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
table#matrix th, table#matrix td { border: 1px solid #fff; text-align: center; padding: 6px 8px; }
table#matrix thead th, table#matrix .row-head { background: var(--src-charcoal); color: var(--src-white); font-weight: 700; }
table#matrix .corner { background: #3d3937; }
table#matrix td.cell { color: #3a3a30; }
table#matrix.has-selection td.cell { opacity: .3; filter: grayscale(.55); }
table#matrix.has-selection tr.active-row td.cell,
table#matrix.has-selection td.cell.active-col { opacity: 1; filter: none; }
table#matrix td.cell.active-cell {
  opacity: 1;
  filter: none;
  font-weight: 800;
  color: #000;
  box-shadow: inset 0 0 0 3px var(--src-charcoal);
}
table#matrix th.active-head { background: var(--src-yellow); color: var(--src-charcoal); }
.matrix-caption { margin: 10px 0 0; font-size: 12px; color: var(--muted); }

.disclaimer {
  margin: 0;
  padding: 20px 0 28px;
  font-size: 12px;
  color: var(--muted);
}

/* Internal tools (project name, CSV, size matrix) only in sales mode (?sales) */
html:not(.sales-mode) .internal-only { display: none !important; }

/* Respect the hidden attribute even where a rule sets display */
[hidden] { display: none !important; }

/* Touch devices (tablet at the booth): 44px+ tap targets */
@media (pointer: coarse) {
  .segmented span, .viewer-tab { padding-top: 15px; padding-bottom: 15px; }
  .stepper input { padding-right: 96px; }
  .stepper .unit { right: 64px; }
  .stepper .spin { width: 52px; flex-direction: row; top: 4px; bottom: 4px; right: 4px; }
  .stepper .spin button { font-size: 12px; }
  input[type="number"], .input-row input[type="text"] { padding-top: 14px; padding-bottom: 14px; }
  .btn-reset { padding: 14px 6px; }
}
