/* ==========================================================================
   product-tools-calc.css — Weldmesh & Barbed Wire weight calculators.
   Layout and structure (panels, grid, tabs, spec tables, live mesh
   preview) follow the reference spec-sheet file the client supplied,
   exactly. Colour and type now use the site's own established theme
   (Exo everywhere via --font-display/--font-body/--font-mono, deep
   blue + brand orange via the site's existing colour tokens) rather
   than the reference's own dark/Oswald/IBM-Plex palette, so this
   component reads as part of the same site instead of a separate one.
   Kept fully scoped under .calc-sheet so its custom properties and
   dark panel background can't leak into or collide with the rest of
   the page.
   ========================================================================== */


.calc-sheet {
  --cs-bg: var(--indigo-950);
  --cs-panel: var(--indigo-900);
  --cs-panel-raised: var(--indigo-700);
  --cs-line: rgba(10, 10, 10, 0.16);
  --cs-line-soft: rgba(10, 10, 10, 0.16);
  --cs-steel: #cbd5da;
  --cs-steel-dim: rgba(255, 255, 255, 0.55);
  --cs-text: #ffffff;
  --cs-zinc: #e5e9eb;
  --cs-safety: var(--ember-500);
  --cs-safety-dim: var(--ember-600);
  --cs-ok: var(--success-500);
  --cs-radius: 2px;

  /* background:
    radial-gradient(circle at 15% -10%, rgba(65, 100, 120, 0.25) 0%, transparent 45%),
    var(--cs-bg); */
  color: var(--cs-text);
  font-family: var(--font-body);
  padding: 32px 16px 40px;
  border-radius: var(--radius-lg);
}

.calc-sheet * {
  box-sizing: border-box;
}

.calc-sheet .cs-wrap {
  max-width: 1080px;
  margin: 0 auto;
}

/* header */
.calc-sheet header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  border-bottom: 1px solid var(--cs-line);
  padding-bottom: 20px;
  margin-bottom: 28px;
}

.calc-sheet .cs-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cs-safety);
  margin: 0 0 10px;
}

.calc-sheet h3.cs-h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: 0.01em;
  margin: 0;
  color: #000;
  text-transform: uppercase;
}

.calc-sheet h3.cs-h1 span {
  color: #000;
  font-weight: 500;
}

.calc-sheet .cs-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: #000;
  text-align: right;
  line-height: 1.6;
}

.calc-sheet .cs-meta b {
  color: #000;
  font-weight: 500;
}

/* layout */
.calc-sheet .cs-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 20px;
}

@media (max-width: 840px) {
  .calc-sheet .cs-grid {
    grid-template-columns: 1fr;
  }
}

.calc-sheet .cs-panel {
  /* background: var(--cs-panel); */
  background: #fff;
  border: 1px solid var(--cs-line);
  border-radius: var(--cs-radius);
}

.calc-sheet .cs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--cs-line);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #000;
}

.calc-sheet .cs-panel-head .cs-tag {
  color: var(--cs-safety);
  border: 1px solid var(--cs-safety-dim);
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10px;
}

/* spec table (inputs) */
.calc-sheet .cs-spec {
  width: 100%;
  border-collapse: collapse;
}

.calc-sheet .cs-spec tr {
  border-bottom: 1px solid var(--cs-line-soft);
}

.calc-sheet .cs-spec tr:last-child {
  border-bottom: none;
}

.calc-sheet .cs-spec td {
  padding: 12px 18px;
  vertical-align: middle;
}

.calc-sheet .cs-spec td.cs-label {
  width: 44%;
  font-size: 13.5px;
  color: #000;
}

.calc-sheet .cs-spec td.cs-label small {
  display: block;
  color: #000;
  font-size: 11px;
  margin-top: 2px;
  font-family: var(--font-mono);
}

.calc-sheet .cs-field-pair {
  display: flex;
  gap: 8px;
}

.calc-sheet .cs-field {
  position: relative;
  flex: 1;
}

.calc-sheet .cs-field input {
  width: 100%;
  background: #fff;
  border: 1px solid rgba(10, 10, 10, 0.16);
  border-radius: 2px;
  color: #000;
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 9px 34px 9px 10px;
  outline: none;
  transition: border-color 0.15s;
}

.calc-sheet .cs-field input::-webkit-outer-spin-button,
.calc-sheet .cs-field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-sheet .cs-field input:focus {
  border-color: var(--cs-safety);
}

.calc-sheet .cs-field input::placeholder {
  color: #4b5560;
}

.calc-sheet .cs-field select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--cs-line);
  border-radius: 2px;
  color: #000;
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 9px 10px;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--cs-steel-dim) 50%), linear-gradient(135deg, var(--cs-steel-dim) 50%, transparent 50%);
  background-position: calc(100% - 16px) center, calc(100% - 11px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.calc-sheet .cs-field select:focus {
  border-color: var(--cs-safety);
}

.calc-sheet .cs-field .cs-unit {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10.5px;
  /* color: var(--cs-steel-dim); */
  color: #000;
  font-family: var(--font-mono);
  pointer-events: none;
}

.calc-sheet .cs-actions {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  border-top: 1px solid var(--cs-line);
}

.calc-sheet .cs-actions button {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 11px 20px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid rgba(10, 10, 10, 0.16);
  background: transparent;
  color: #000;
  transition: all 0.15s;
}

.calc-sheet #calcBtn,
.calc-sheet #barbCalcBtn {
  background: var(--cs-safety);
  border-color: var(--cs-safety);
  color: #fff;
  font-weight: 600;
  flex: 1;
}

.calc-sheet #calcBtn:hover,
.calc-sheet #barbCalcBtn:hover {
  background: #f0973f;
}

.calc-sheet #clearBtn:hover,
.calc-sheet #barbResetBtn:hover {
  border-color: rgba(10, 10, 10, 0.16);
  color: #000;
}

.calc-sheet .cs-footnote {
  font-size: 11.5px;
  color: #000;
  padding: 14px 18px;
  border-top: 1px solid var(--cs-line-soft);
  line-height: 1.6;
  font-style: italic;
}

.calc-sheet .cs-right-col {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calc-sheet .cs-preview-body {
  padding: 18px;
}

.calc-sheet #meshSvg {
  width: 100%;
  height: auto;
  display: block;
}

.calc-sheet .cs-preview-caption {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #000;
  padding: 0 4px;
  margin-top: 10px;
}

.calc-sheet .cs-preview-caption b {
  color: var(--cs-zinc);
  font-weight: 500;
}

.calc-sheet .cs-results-body {
  padding: 4px 0;
}

.calc-sheet .cs-result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 13px 18px;
  border-bottom: 1px solid var(--cs-line-soft);
}

.calc-sheet .cs-result-row:last-child {
  border-bottom: none;
}

.calc-sheet .cs-result-row .cs-k {
  font-size: 12.5px;
  color: #000;
}

.calc-sheet .cs-result-row .cs-v {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--cs-text);
  font-weight: 500;
}

.calc-sheet .cs-result-row .cs-v small {
  font-size: 11px;
  color: var(--cs-steel-dim);
  font-weight: 400;
  margin-left: 4px;
}

.calc-sheet .cs-result-hero {
  background: #fff;
  margin: 14px;
  border-radius: 2px;
  border: 1px dashed rgba(10, 10, 10, 0.16);
  padding: 16px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-sheet .cs-result-hero .cs-k {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #000;
}

.calc-sheet .cs-result-hero .cs-v {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: #000;
}

.calc-sheet .cs-result-hero .cs-v small {
  font-size: 13px;
  color: #000;
  font-family: var(--font-mono);
  font-weight: 400;
}

.calc-sheet .cs-status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cs-line);
  margin-right: 6px;
}

.calc-sheet .cs-status-dot.live {
  background: var(--cs-ok);
  box-shadow: 0 0 6px var(--cs-ok);
}

.calc-sheet footer {
  text-align: center;
  margin-top: 32px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cs-steel-dim);
}

/* tabs */
.calc-sheet .cs-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.calc-sheet .cs-tab-btn {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 10px 16px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid rgba(10, 10, 10, 0.16);
  background: #fff;
  color: #000;
  transition: all 0.15s;
}

.calc-sheet .cs-tab-btn:hover {
  color: var(--cs-zinc);
}

.calc-sheet .cs-tab-btn.active {
  border-color: var(--cs-safety-dim);
  color: #fff;
  background: var(--cs-safety);
}

.calc-sheet .cs-tabpanel {
  display: none;
}

.calc-sheet .cs-tabpanel.active {
  display: block;
}

/* barbed wire specifics */
.calc-sheet .cs-mode-toggle {
  display: flex;
  gap: 8px;
  padding: 16px 18px 4px;
}

.calc-sheet .cs-mode-btn {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px;
  border-radius: 2px;
  cursor: pointer;
  border: 1px solid var(--cs-line);
  background: #fff;
  color: #000;
  transition: all 0.15s;
}

.calc-sheet .cs-mode-btn.active {
  border-color: var(--cs-safety);
  color: var(--cs-safety);
}

.calc-sheet .cs-readout {
  margin: 14px 18px 0;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid rgba(10, 10, 10, 0.16);
  border-radius: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.calc-sheet .cs-readout .cs-k {
  font-size: 11.5px;
  color: #000;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.calc-sheet .cs-readout .cs-v {
  font-family: var(--font-mono);
  font-size: 15px;
  color: #000;
}

.calc-sheet .cs-ref-table {
  width: 100%;
  border-collapse: collapse;
}

.calc-sheet .cs-ref-table th {
  text-align: left;
  padding: 10px 18px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cs-steel-dim);
  border-bottom: 1px solid var(--cs-line);
}

.calc-sheet .cs-ref-table td {
  padding: 10px 18px;
  font-size: 13px;
  color: rgba(10, 10, 10, 0.643);
  border-bottom: 1px solid var(--cs-line-soft);
  font-family: var(--font-mono);
}

.calc-sheet .cs-ref-table tr:last-child td {
  border-bottom: none;
}

.calc-sheet .cs-ref-table tr.selected td {
  color: var(--cs-safety);
  background: rgba(226, 135, 46, 0.06);
}