/* ==========================================================================
   WheelPeek — fitment tools stylesheet. Loaded AFTER guides-v3.css, which
   provides the design tokens, header, footer, buttons, tables, FAQ, callouts,
   related cards and CTA band. This file adds only the calculator components for
   /tools/*. Immutable-cached, so it ships under a new filename whenever it
   changes.
   ========================================================================== */

/* ---------- tool hero (reuses .eyebrow/.dek from guides-v3) --------------- */
.tool-head { margin: 26px 0 30px; }
.tool-head h1 { font-size: clamp(2rem, 4.8vw, 2.9rem); line-height: 1.05; margin: 0 0 0.4em; }
.tool-head .dek { max-width: 52ch; }

/* ---------- calculator card ---------------------------------------------- */
.calc {
  background: var(--card); border: 1px solid var(--border-2);
  border-radius: var(--radius); padding: 24px; margin: 0 0 30px;
  box-shadow: var(--shadow-sm);
}
.calc-preset {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  padding: 0 0 20px; margin: 0 0 20px; border-bottom: 1px solid var(--border);
}
.calc-preset label { font-weight: 700; color: var(--text); font-size: 0.98rem; }
.calc-preset .hint { color: var(--muted-2); font-size: 0.86rem; }

.calc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.calc-col {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 18px 20px;
}
.calc-col h2, .calc-col h3 {
  font-size: 0.78rem; font-family: var(--mono); font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
  margin: 0 0 14px;
}
.calc-col.is-new h2, .calc-col.is-new h3 { color: var(--accent-2); }

/* ---------- form fields --------------------------------------------------- */
.field { margin: 0 0 12px; }
.field:last-child { margin-bottom: 0; }
.field > label {
  display: block; font-size: 0.82rem; color: var(--muted);
  margin: 0 0 5px; font-weight: 600; letter-spacing: 0.01em;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.calc input[type="text"],
.calc input[type="number"],
.calc select {
  width: 100%; box-sizing: border-box;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border-2); border-radius: 10px;
  padding: 11px 12px; font-family: var(--body); font-size: 1rem; line-height: 1.2;
  -moz-appearance: textfield;
}
.calc input::placeholder { color: var(--muted-2); }
.calc input:focus-visible, .calc select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent-line);
}
.calc select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239AA3AB' stroke-width='2.4' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 38px; cursor: pointer;
}
.calc-preset select { width: auto; min-width: 240px; max-width: 100%; }
.field .unit { color: var(--muted-2); font-size: 0.78rem; font-weight: 400; }
.msg { display: block; min-height: 1.1em; margin: 5px 0 0; color: #ff9a8c; font-size: 0.82rem; line-height: 1.4; }

/* ---------- results ------------------------------------------------------- */
.results { margin: 6px 0 0; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0 0 18px; }
.result-tile {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px 18px;
}
.result-tile .rt-label { font-family: var(--mono); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); margin: 0 0 6px; }
.result-tile .rt-fig { font-family: var(--display); font-weight: 700; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1; letter-spacing: -0.02em; color: var(--text); }
.result-tile.accent .rt-fig { color: var(--accent); }
.result-tile .rt-read { color: var(--muted); font-size: 0.9rem; line-height: 1.5; margin: 8px 0 0; }
.result-note { color: var(--muted-2); font-size: 0.86rem; line-height: 1.55; margin: 0 0 16px; }

.subgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0 0 18px; }
.subgrid .sg {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px;
}
.subgrid .sg-label { font-size: 0.78rem; color: var(--muted-2); margin: 0 0 4px; }
.subgrid .sg-val { font-family: var(--display); font-weight: 700; font-size: 1.2rem; color: var(--text); }

/* ---------- verdict ------------------------------------------------------- */
.verdict {
  border-radius: var(--radius-sm); padding: 14px 18px; margin: 0 0 18px;
  font-size: 0.98rem; line-height: 1.5; border: 1px solid var(--border-2);
  background: var(--card-2); color: var(--text);
}
.verdict-ok { background: var(--accent-dim); border-color: var(--accent-line); color: var(--text); }
.verdict-warn { background: rgba(255, 176, 92, 0.10); border-color: rgba(255, 176, 92, 0.34); color: #ffd9b0; }

/* ---------- diagram ------------------------------------------------------- */
.diagram {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px; margin: 0 0 18px;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
/* Fills wide layouts, but never shrinks below legibility: on a narrow screen
   the figure (not the page) scrolls sideways. */
.diagram svg { width: 100%; min-width: 560px; }
.diagram-cap { color: var(--muted-2); font-size: 0.82rem; line-height: 1.5; margin: 10px 0 0; text-align: center; }
@media (max-width: 600px) {
  .diagram-cap::before { content: "Scroll the drawing sideways if it is cut off. "; }
}

/* ---------- tire spec lists ---------------------------------------------- */
.spec-list { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 14px; font-size: 0.92rem; }
.spec-list dt { color: var(--muted-2); }
.spec-list dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.spec-list dd .muted { color: var(--muted-2); font-size: 0.85em; }

/* ---------- copy-link row ------------------------------------------------- */
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; margin: 4px 0 0; }
.copy-msg { color: var(--accent); font-size: 0.88rem; min-height: 1.1em; }

/* ---------- small disclaimer --------------------------------------------- */
.tool-disclaimer { color: var(--muted-2); font-size: 0.86rem; line-height: 1.55; margin: 18px 0 0; }

/* ---------- formulas <details> -------------------------------------------- */
.formulas { margin: 20px 0 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); overflow: hidden; }
.formulas > summary {
  list-style: none; cursor: pointer; padding: 14px 18px; font-family: var(--display);
  font-weight: 600; color: var(--text); display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.formulas > summary::-webkit-details-marker { display: none; }
.formulas > summary::after {
  content: ""; flex: none; width: 18px; height: 18px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300FFCC' stroke-width='2.4' stroke-linecap='round'%3E%3Cline x1='12' y1='5' x2='12' y2='19'/%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; transition: transform 0.22s ease;
}
.formulas[open] > summary::after { transform: rotate(135deg); }
.formulas .formulas-body { padding: 0 18px 18px; color: var(--muted); font-size: 0.92rem; line-height: 1.7; }
.formulas code { font-family: var(--mono); font-size: 0.88em; color: var(--accent-2); background: var(--accent-dim); padding: 1px 6px; border-radius: 6px; }
.formulas ul { margin: 0.4rem 0 0; }

/* ---------- tools hub grid tweaks (reuses .guide-grid/.guide-card) -------- */
.tools-hub .guide-grid { max-width: 760px; }

/* ---------- responsive ---------------------------------------------------- */
@media (max-width: 620px) {
  .calc-cols { grid-template-columns: 1fr; }
  .calc { padding: 18px; }
  .calc-preset select { min-width: 0; width: 100%; }
}

/* ---------- plain-language sentence under a diagram ---------------------- */
.diagram-say { color: var(--text); font-size: 1rem; line-height: 1.55; margin: 14px 0 0; text-align: center; font-weight: 500; }
.diagram-say strong { color: var(--accent); font-weight: 600; }
