/* Building blocks used by the calculators and content pages. */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-3);
  box-shadow: var(--shadow-1);
}
.card--pad { padding: 16px; }
.card__title {
  font-size: 0.8125rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2);
}

/* ---- Input groups (native <details>, so they collapse without script) ---- */
.inputs { display: grid; gap: 10px; }
.group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-3); }
.group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; cursor: pointer; list-style: none;
  font-weight: 650; font-size: 0.9375rem;
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after {
  content: ""; width: 8px; height: 8px; flex: none; margin-right: 4px;
  border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.15s;
}
.group[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.group__body { display: grid; gap: 12px; padding: 2px 14px 14px; }
.group__hint { color: var(--text-2); font-size: 0.8125rem; }

.field { display: grid; gap: 4px; }
.field__label { display: flex; justify-content: space-between; gap: 8px; font-size: 0.875rem; font-weight: 550; color: var(--text); }
.field__unit { color: var(--text-3); font-weight: 450; }
.field__row { display: grid; grid-template-columns: minmax(0, 1fr); }
.field__msg { font-size: 0.8125rem; color: var(--text-2); }
.field__msg--error { color: var(--danger); }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.coord { display: grid; gap: 4px; border: 0; margin: 0; padding: 0; min-width: 0; }
.coord legend { padding: 0; font-size: 0.875rem; font-weight: 550; }
.coord__axes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.coord__axes--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.coord__axis { position: relative; }
.coord__axis span {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 0.8125rem; font-weight: 650; pointer-events: none;
}
.coord__axis input { padding-left: 24px; }
.coord .field__msg { grid-column: 1 / -1; }

.check { display: flex; align-items: center; gap: 8px; font-size: 0.9375rem; }

/* ---- Toolbar ---- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar__status { margin-right: auto; color: var(--text-2); font-size: 0.8125rem; }
.toolbar__status[data-state="pending"]::before { content: "● "; color: var(--warn); }
.toolbar__status[data-state="saved"]::before { content: "✓ "; color: var(--ok); }

/* ---- Results ---- */
.stats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat {
  display: grid; gap: 2px; align-content: start; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-3);
}
.stat__label { font-size: 0.8125rem; color: var(--text-2); font-weight: 550; }
.stat__value { font-size: 1.625rem; font-weight: 650; line-height: 1.15; letter-spacing: -0.01em; }
.stat__unit { margin-left: 3px; font-size: 0.9375rem; font-weight: 500; color: var(--text-3); }
.stat__note { font-size: 0.8125rem; color: var(--text-2); }
.stat[data-tone="danger"] { border-color: var(--danger); background: var(--danger-soft); }
.stat[data-tone="danger"] .stat__note { color: var(--danger); }
.stat[data-tone="warn"] { border-color: var(--warn); background: var(--warn-soft); }
.stat[data-tone="muted"] .stat__value { color: var(--text-3); }

.panel { display: grid; gap: 12px; padding: 16px; }
.panel__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel__title { font-size: 1rem; font-weight: 650; }
.panel__sub { color: var(--text-2); font-size: 0.875rem; }
.details { display: grid; gap: 16px; }

.notes { display: grid; gap: 6px; padding: 0; margin: 0; list-style: none; }
.note {
  padding: 8px 12px; border-radius: var(--radius-2); border-left: 3px solid var(--border-strong);
  background: var(--surface-2); font-size: 0.875rem; color: var(--text);
}
.note--warn { border-left-color: var(--warn); background: var(--warn-soft); }
.note--danger { border-left-color: var(--danger); background: var(--danger-soft); }
.note--info { border-left-color: var(--focus); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.table th, .table td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th { color: var(--text-2); font-weight: 600; font-size: 0.8125rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table td[data-tone="danger"] { color: var(--danger); font-weight: 650; }
.table td[data-tone="warn"] { color: var(--warn); font-weight: 650; }
.table td.muted { color: var(--text-3); }

/* ---- Segmented control + travel slider ---- */
.seg { display: inline-flex; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--radius-2); background: var(--surface-2); }
.seg button {
  min-height: 30px; padding: 4px 12px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); font-size: 0.875rem; font-weight: 550;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }
.travel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.travel label { font-size: 0.875rem; font-weight: 550; }
.travel input[type="range"] { flex: 1 1 160px; }
.travel output { min-width: 6.5em; font-size: 0.875rem; color: var(--text-2); }

/* ---- Diagram + charts (inline SVG, colored only through these classes) ---- */
.figure { display: grid; gap: 10px; }
.figure svg { width: 100%; height: auto; overflow: hidden; }
.figure__legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; margin: 0; list-style: none; font-size: 0.8125rem; color: var(--text-2); }
.figure__legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 3px; border-radius: 2px; background: currentColor; }
.ink-upper { color: var(--ink-upper); }
.ink-lower { color: var(--ink-lower); }
.ink-panhard { color: var(--ink-panhard); }
.ink-ic { color: var(--ink-ic); }
.ink-rc { color: var(--ink-rc); }
.ink-cg { color: var(--ink-cg); }

.dg-ground { stroke: var(--ink-ground); stroke-width: 1.5; stroke-dasharray: 6 5; fill: none; }
.dg-grid { stroke: var(--ink-grid); stroke-width: 1; fill: none; }
.dg-tire { stroke: var(--ink-tire); stroke-width: 2.5; fill: none; }
.dg-hub { fill: var(--ink-tire); }
.dg-axle { stroke: var(--ink-frame); stroke-width: 2; fill: var(--surface-3); }
.dg-frame { stroke: var(--ink-frame); stroke-width: 3; stroke-linecap: round; fill: none; }
.dg-link { stroke-width: 4; stroke-linecap: round; fill: none; }
.dg-link--upper { stroke: var(--ink-upper); }
.dg-link--lower { stroke: var(--ink-lower); }
.dg-link--panhard { stroke: var(--ink-panhard); }
.dg-link--twin { opacity: 0.55; }
.dg-joint { stroke-width: 2; fill: var(--surface); }
.dg-joint--upper { stroke: var(--ink-upper); }
.dg-joint--lower { stroke: var(--ink-lower); }
.dg-joint--panhard { stroke: var(--ink-panhard); }
.dg-extend { stroke-width: 1.25; stroke-dasharray: 4 4; fill: none; opacity: 0.8; }
.dg-extend--upper { stroke: var(--ink-upper); }
.dg-extend--lower { stroke: var(--ink-lower); }
.dg-ic { fill: var(--ink-ic); }
.dg-as-line { stroke: var(--ink-ic); stroke-width: 1.5; fill: none; }
.dg-as100 { stroke: var(--ink-cg); stroke-width: 1; stroke-dasharray: 2 4; fill: none; opacity: 0.6; }
.dg-cg { fill: var(--surface); stroke: var(--ink-cg); stroke-width: 2; }
.dg-cg-q { fill: var(--ink-cg); }
.dg-rc { fill: var(--ink-rc); }
.dg-roll-axis { stroke: var(--ink-rc); stroke-width: 1.5; stroke-dasharray: 8 4 2 4; fill: none; }
.dg-centerline { stroke: var(--ink-ground); stroke-width: 1; stroke-dasharray: 10 4 2 4; fill: none; }
.dg-label { fill: var(--text-2); font-size: 12px; font-family: var(--font); }
.dg-label--strong { fill: var(--text); font-weight: 650; }
.dg-ic-path { stroke: var(--ink-ic); stroke-width: 1.5; fill: none; opacity: 0.7; }

.chart-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.chart { display: grid; gap: 6px; }
.chart__title { font-size: 0.875rem; font-weight: 650; }
.chart__sub { font-size: 0.8125rem; color: var(--text-2); }
.ch-axis { stroke: var(--border-strong); stroke-width: 1; }
.ch-grid { stroke: var(--ink-grid); stroke-width: 1; }
.ch-zero { stroke: var(--text-3); stroke-width: 1; }
.ch-tick { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.ch-line { fill: none; stroke: var(--ink-series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--ink-series); stroke: var(--surface); stroke-width: 2; }
.ch-marker { stroke: var(--text-3); stroke-width: 1; }
.ch-gap { fill: var(--surface-3); }
.ch-hover { fill: none; stroke: none; }
.ch-readout { font-size: 0.8125rem; color: var(--text-2); min-height: 1.25em; }

/* ---- Home + content pages ---- */
.hero { display: grid; gap: 10px; margin-bottom: 24px; max-width: 70ch; }
.hero p { color: var(--text-2); font-size: 1.0625rem; }
.tool-cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tool-card {
  display: grid; gap: 6px; align-content: start; padding: 16px;
  color: inherit; text-decoration: none;
}
.tool-card:hover { border-color: var(--accent); }
.tool-card h2 { font-size: 1.0625rem; }
.tool-card p { color: var(--text-2); font-size: 0.9375rem; }
.tool-card__group { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-strong); }

.prose { display: grid; gap: 14px; max-width: 74ch; }
.prose h2 { margin-top: 18px; }
.prose h3 { margin-top: 6px; }
.prose ul, .prose ol { padding-left: 1.25em; display: grid; gap: 4px; }
.prose dl { display: grid; gap: 10px; }
.prose dt { font-weight: 650; }
.prose dd { margin: 0; color: var(--text-2); }
.prose .formula {
  padding: 10px 12px; border-radius: var(--radius-2); background: var(--surface-2); border: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.875rem; overflow-x: auto; white-space: pre;
}
.prose figure { display: grid; gap: 8px; }
.prose figcaption { color: var(--text-2); font-size: 0.875rem; }
.toc { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 0; list-style: none; font-size: 0.9375rem; }

.tool-loading { color: var(--text-2); }
