/* AXLE CHECKER: the layout cards (Tractor / Connection / Flatbed ...). Linked after builder.css and fixes.css. Tokens only: no colour literals.

   ┌─ THE INLINE ROW RULE (owner, 2026-11-21: a hard rule, keep it when editing) ──────────────────────────────────────────────────────┐
   │ In every layout card the WEIGHT row and the DISTANCE row are each ONE line, whatever the card width, the screen width or the axle   │
   │ count. Never wrap them onto a second row (no flex-wrap, no auto-fit/auto-fill grid, no staggered "--row" offsets), never truncate a  │
   │ number. A crowded row gets SMALLER cells: app.mjs adjustControls() sets --axc-w / --gap-w (the on-screen width each box may have,    │
   │ from the room between neighbouring axles) and the font size below is derived from that width. Each weight box stays centred under   │
   │ its own axle; the distances sit on a row of their own under the wheels, so they never overlap the wheels or the weight row.          │
   └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ */

/* ── The two rows: single line, no wrapping, cells shrink (min-width: 0), input fills its cell. ───────────────────────────────────── */
.axc #axle-units .axc-weights { display: block; white-space: nowrap; flex-wrap: nowrap; overflow: visible; }
.axc #axle-units .axc-weight { flex-wrap: nowrap; white-space: nowrap; min-width: 0; }
.axc #editor #axle-units .axc-weight input[data-k] { width: 100%; min-width: 0; box-sizing: border-box; padding: 0; text-overflow: clip; font-size: clamp(8px, calc((var(--axc-fw, var(--axc-w, 64px)) - 6px) / 3.8), 12px); }
.axc #axle-units .axc-weight small { white-space: nowrap; }
/* The unit label shows under every weight, narrow cells included (owner, 2026-11-22). */
.axc #axle-units .axc-gap { white-space: nowrap; min-width: 0; bottom: 4px; }
.axc #editor #axle-units .axc-gap input[data-k] { width: 100%; min-width: 0; box-sizing: border-box; padding: 0; text-overflow: clip; font-size: clamp(8px, calc((var(--axc-fg, var(--gap-w, 72px)) - 6px) / 3.8), 13px); }
.axc #editor #axle-units .axc-gap.is-live input[data-k] { font-size: clamp(8px, calc((var(--gap-w, 72px) - 6px) / 3.8), 15px); }
/* The distances get their own row under the wheels (the drawing's wheels end at 200px): the picture is that tall plus the label row. */
.axc.axc:not(.axs) #axle-units .axle-art { height: calc(204px + 32px * var(--axc-inv, 1)); }

/* ── Phone: full width, first screen ends where the third card begins, the card header is a column. ──────────────────────────────── */
@media (max-width: 767px) {
  .axc #editor #axle-units .axc-weight input[data-k] { font-size: clamp(8px, calc((var(--axc-fw, var(--axc-w, 64px)) - 6px) / 3.8), 16px); }
  .axc #editor #axle-units .axc-gap input[data-k] { font-size: clamp(8px, calc((var(--axc-fg, var(--gap-w, 72px)) - 6px) / 3.8), 16px); }
  .axc #editor #axle-units .axc-gap.is-live input[data-k] { font-size: clamp(8px, calc((var(--gap-w, 72px) - 6px) / 3.8), 18px); }
  /* No gutter: the cards run edge to edge, left and right. */
  .axc.axc #axc-fit:not(.is-zoomed) { padding: 0; scroll-padding: 0; }
  .axc .axc-zoombar:empty { display: none; }

  /* Card header: title top left; the zoom magnifier under it (inside the first card); the right column is the count, then + , then - . All real
     sizes: the strip is scaled by k, so every offset is multiplied by --axc-inv (1 / k) to land at the same on-screen size. */
  .axc #axle-units { --axc-hdr: 120px; }
  .axc.axc #axle-units .axle-unit > header,
  .axc.axc #axle-units .coupling-heading { height: calc(var(--axc-hdr) * var(--axc-inv, 1)); min-height: 0; }
  .axc.axc #axle-units .axle-unit > header { position: relative; display: block; padding: 0; }
  .axc.axc #axle-units .axle-unit > header h3 { position: absolute; top: calc(8px * var(--axc-inv, 1)); left: calc(8px * var(--axc-inv, 1)); margin: 0; transform: scale(var(--axc-inv, 1)); transform-origin: 0 0; white-space: nowrap; }
  .axc.axc #axle-units .axle-count { position: absolute; top: calc(8px * var(--axc-inv, 1)); right: calc(8px * var(--axc-inv, 1)); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin: 0; transform: scale(var(--axc-inv, 1)); transform-origin: 100% 0; white-space: nowrap; }
  .axc.axc #axle-units .axle-count > span { order: 0; }
  .axc.axc #axle-units .axle-count button { position: relative; order: 3; width: 36px; height: 36px; min-width: 36px; margin: 0; padding: 0; transform: none; }
  .axc.axc #axle-units .axle-count button[data-d="1"] { order: 1; }
  .axc.axc #axle-units .axle-count button[data-d="-1"] { order: 2; }
  .axc.axc #axle-units .axle-count button::after { content: ""; position: absolute; inset: -4px; }
  .axc.axc #axle-units .axle-unit > header .axc-zoombtn { position: absolute; top: calc(40px * var(--axc-inv, 1)); left: calc(8px * var(--axc-inv, 1)); margin: 0; transform: scale(var(--axc-inv, 1)); transform-origin: 0 0; }
}
