/* ============================================================================
   Microform Precision — bend deduction calculator
   Every class is namespaced .bd-* so nothing here can collide with the
   existing mform theme styles.
   ========================================================================== */
/* ===================== bend deduction calculator =====================
   Every class is namespaced .bd-* so nothing here can collide with the
   existing mform theme styles. */

.bd-wrap { max-width: 1170px; margin: 0 auto; padding: 0 15px; }

.bd-head { padding: 44px 0 0; }
.bd-crumb {
  margin: 0 0 14px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: #8a8a8c; font-family: "Montserrat", Helvetica, Arial, sans-serif; font-weight: 600;
}
.bd-crumb a { color: inherit; text-decoration: none; }
.bd-crumb a:hover { color: #ee2e24; }
.bd-head h1 {
  margin: 0 0 12px; font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: clamp(27px, 3.6vw, 38px); line-height: 1.1; font-weight: 700;
  letter-spacing: -.015em; color: #1c1b1f; text-wrap: balance;
}
.bd-lede { margin: 0; max-width: 62ch; font-size: 16px; line-height: 1.6; color: #55545a; }

/* ---- the tool ---------------------------------------------------------- */
.bd-tool {
  margin: 30px 0 0; display: grid; grid-template-columns: 1.15fr 1fr;
  gap: 0; border-top: 2px solid #1c1b1f;
}
.bd-inputs { padding: 26px 34px 28px 0; border-right: 1px solid #e8e6e2; min-width: 0; }
.bd-readout { padding: 26px 0 28px 34px; min-width: 0; }

.bd-field { margin: 0 0 22px; }
.bd-field:last-child { margin-bottom: 0; }
.bd-field > label, .bd-legend {
  display: block; margin: 0 0 8px;
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #8a8a8c;
}
fieldset.bd-field { border: 0; padding: 0; margin: 0 0 22px; }

/* segmented control: one visible row of real radio buttons */
.bd-seg { display: flex; flex-wrap: wrap; gap: 0; border: 1px solid #cfcdc9; }
.bd-seg input { position: absolute; opacity: 0; pointer-events: none; }
.bd-seg label {
  flex: 1 1 0; min-width: 0; padding: 9px 6px; text-align: center; cursor: pointer;
  border-left: 1px solid #e2e0dc; background: #fff;
  font-family: "Montserrat", Helvetica, Arial, sans-serif; font-size: 13px; font-weight: 600;
  color: #55545a; line-height: 1.25; transition: background-color .15s, color .15s;
}
.bd-seg label:first-of-type { border-left: 0; }
.bd-seg label small {
  display: block; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 10.5px; font-weight: 400; color: #9a989c; margin-top: 2px;
}
.bd-seg label:hover { background: #faf9f7; }
.bd-seg input:checked + label { background: #1c1b1f; color: #fff; }
.bd-seg input:checked + label small { color: #a9a7a3; }
.bd-seg input:focus-visible + label { outline: 2px solid #ee2e24; outline-offset: -2px; }

.bd-select {
  width: 100%; padding: 10px 12px; border: 1px solid #cfcdc9; border-radius: 0;
  background: #fff; font: 15px/1.3 "Open Sans", Helvetica, Arial, sans-serif; color: #1c1b1f;
  font-variant-numeric: tabular-nums;
}
.bd-select:focus-visible { outline: 2px solid #ee2e24; outline-offset: -1px; }

.bd-anglerow { display: flex; align-items: center; gap: 14px; }
.bd-anglerow input[type=number] {
  width: 92px; padding: 10px 10px; border: 1px solid #cfcdc9; border-radius: 0;
  font: 600 17px/1.2 "IBM Plex Mono", ui-monospace, Menlo, monospace; color: #1c1b1f;
  font-variant-numeric: tabular-nums;
}
.bd-anglerow input[type=range] { flex: 1; min-width: 0; accent-color: #ee2e24; }
.bd-hint { margin: 7px 0 0; font-size: 12.5px; color: #8a8a8c; }
.bd-hem {
  margin: 10px 0 0; padding: 10px 12px; background: #fbf7ef; border-left: 2px solid #d7a53f;
  font-size: 12.5px; line-height: 1.5; color: #6b5a3a;
}
.bd-hem a { color: #a8701a; }
.bd-hem[hidden] { display: none; }

/* ---- the answer -------------------------------------------------------- */
.bd-answer label {
  display: block; margin: 0 0 4px;
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #8a8a8c;
}
.bd-big {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.bd-big output {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: clamp(38px, 6vw, 54px); font-weight: 500; line-height: 1;
  letter-spacing: -.02em; color: #1c1b1f; font-variant-numeric: tabular-nums;
}
.bd-unit { font-size: 15px; color: #8a8a8c; }
/* where this particular number came from — an engineer should not have to guess */
.bd-badge {
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 10.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 8px; border: 1px solid currentColor; white-space: nowrap;
}
.bd-badge[data-src="measured"]   { color: #4a7a44; }
.bd-badge[data-src="calculated"] { color: #55545a; }
.bd-badge[data-src="server"]     { color: #4a7a44; }
.bd-badge[data-src="estimated"]  { color: #9a6b22; }
.bd-badge:empty { display: none; }
.bd-copy {
  margin-left: auto; padding: 7px 13px; border: 1px solid #cfcdc9; background: #fff;
  font-family: "Montserrat", Helvetica, Arial, sans-serif; font-size: 12px; font-weight: 600;
  color: #3a3a3c; cursor: pointer; transition: border-color .15s, color .15s;
}
.bd-copy:hover { border-color: #ee2e24; color: #ee2e24; }
.bd-copy:focus-visible { outline: 2px solid #ee2e24; outline-offset: 2px; }

.bd-flat {
  margin: 20px 0 0; padding: 14px 16px; background: #f7f6f4; border-left: 2px solid #ee2e24;
  font-size: 14px; line-height: 1.55; color: #3a3a3c;
}
.bd-flat b { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-weight: 500; }

.bd-second { margin: 22px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.bd-second div { border-top: 1px solid #e8e6e2; padding-top: 10px; }
.bd-second dt {
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #8a8a8c; margin: 0 0 3px;
}
.bd-second dd {
  margin: 0; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 19px; color: #1c1b1f; font-variant-numeric: tabular-nums;
}

.bd-state { margin: 16px 0 0; font-size: 12.5px; min-height: 19px; }
.bd-state[data-mode="live"] { color: #6f8f6a; }
.bd-state[data-mode="estimate"] { color: #9a6b22; }
.bd-state[data-mode="working"] { color: #8a8a8c; }

/* ---- the table trace, for whoever maintains the CSV -------------------- */
/* The trace panel is only printed for a maintainer, never for a visitor — the
   dashed border and the note in the summary are the reminder of that. */
.bd-trace { margin: 26px 0 0; border: 1px dashed #d8d5d0; background: #fcfbfa; }
.bd-trace__only {
  margin-left: 10px; font-size: 10px; font-weight: 500; letter-spacing: .04em;
  text-transform: none; color: #a8a6a2;
}
.bd-trace > summary {
  padding: 11px 14px; cursor: pointer; list-style: none;
  font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: #8a8a8c;
}
.bd-trace > summary::-webkit-details-marker { display: none; }
.bd-trace > summary::before { content: "+"; margin-right: 7px; }
.bd-trace[open] > summary::before { content: "\2212 "; }
.bd-trace > summary:hover { color: #ee2e24; }
.bd-trace__body { padding: 0 14px 14px; }
.bd-trace__file { margin: 0 0 10px; font-size: 13px; color: #55545a; }
.bd-trace__row {
  margin: 0; padding: 10px 12px; background: #fff; border: 1px solid #ecebe7;
  overflow-x: auto; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-size: 12.5px; line-height: 1.6; color: #1c1b1f; white-space: pre-wrap;
}
.bd-bad {
  margin: 10px 0 0; padding: 10px 12px; background: #fdf3f2; border-left: 2px solid #ee2e24;
  font-size: 12.5px; line-height: 1.6; color: #7a2b24;
}
.bd-bad b { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; }

/* ---- the drawing ------------------------------------------------------- */
.bd-draw { margin: 34px 0 0; border-top: 1px solid #e8e6e2; padding-top: 26px; }
.bd-draw h2, .bd-prose h2 {
  margin: 0 0 4px; font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 19px; font-weight: 600; letter-spacing: -.01em; color: #1c1b1f;
}
.bd-draw .bd-sub, .bd-prose .bd-sub { margin: 0 0 18px; font-size: 14px; color: #8a8a8c; }
.bd-stage { background: #fcfbfa; border: 1px solid #ecebe7; padding: 16px;
             max-width: 860px; display: grid; place-items: center; }
/* the drawing fills the width it is given, and a tall section is capped by
   height rather than being allowed to run down the page */
.bd-stage svg { display: block; width: 100%; height: auto;
                max-height: clamp(230px, 30vw, 360px); }

.bd-key { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 14px; padding: 0;
          list-style: none; font-size: 13px; color: #55545a; }
.bd-key li { display: flex; align-items: center; gap: 8px; }
.bd-key i { width: 22px; height: 0; border-top: 2px solid var(--c); flex: none; }
.bd-key i.dash { border-top-style: dashed; }
.bd-strip { margin: 18px 0 0; }
.bd-strip svg { display: block; width: 100%; height: auto; max-width: 760px; }

/* ---- the explanation --------------------------------------------------- */
.bd-prose { margin: 40px 0 0; border-top: 1px solid #e8e6e2; padding-top: 26px; }
.bd-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.bd-cols h3 {
  margin: 0 0 7px; font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 15px; font-weight: 600; color: #1c1b1f;
}
.bd-cols p { margin: 0 0 11px; font-size: 14px; line-height: 1.6; color: #55545a; }
.bd-cols p:last-child { margin-bottom: 0; }
.bd-cols .num {
  font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums; color: #1c1b1f; font-weight: 500;
}
.bd-swatch {
  display: inline-block; width: 22px; height: 3px; vertical-align: middle;
  margin-right: 6px; position: relative; top: -2px;
}

/* ---- foot -------------------------------------------------------------- */
.bd-cta {
  margin: 44px 0 0; border-top: 1px solid #e8e6e2; padding: 26px 0 60px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.bd-cta p { margin: 0; font-size: 15px; color: #55545a; max-width: 46ch; }
.bd-btn {
  display: inline-block; padding: 12px 22px; background: #ee2e24; border: 1px solid #ee2e24;
  color: #fff; text-decoration: none; font-family: "Montserrat", Helvetica, Arial, sans-serif;
  font-size: 13.5px; font-weight: 700; line-height: 1; margin-left: auto;
}
.bd-btn:hover, .bd-btn:focus { background: #cf281f; border-color: #cf281f; color: #fff; }

@media (max-width: 860px) {
  .bd-tool { grid-template-columns: 1fr; }
  .bd-inputs { padding: 24px 0 24px; border-right: 0; border-bottom: 1px solid #e8e6e2; }
  .bd-readout { padding: 24px 0 0; }
  .bd-cols { grid-template-columns: 1fr; gap: 22px; }
  .bd-btn { margin-left: 0; }
}
@media (max-width: 560px) {
  .bd-seg { flex-wrap: wrap; }
  .bd-seg label { flex: 1 0 33.333%; border-top: 1px solid #e2e0dc; }
  .bd-second { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .bd-seg label, .bd-copy { transition: none; }
}
