/* SA Towing Check. Colours follow psyphin.co.za (css/style.css there). */
:root {
  --bg: #020203;
  --surface: #111418;
  --surface-2: #181c21;
  --border: #262c33;
  --text: #e6ebef;
  --text-muted: #9aa4ae;
  --accent: #3fb6ff;
  --accent-strong: #1e8fff;

  /* traffic light */
  --pass: #4ade80;
  --warn: #fbbf24;
  --fail: #f87171;
  --info: #3fb6ff;
  --incomplete: #7b8590;

  /* legal vs manufacturer panels */
  --legal: #3fb6ff;
  --maker: #c084fc;

  /* the on-screen licence disc: pale paper and dark print, like the real one */
  --disc-paper: #f1efe6;
  --disc-ring: #b9c7b0;
  --disc-ink: #1d2320;
  --disc-faint: #6f7a72;

  --radius: 14px;
  --max-width: 1100px;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Rajdhani", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* elements with display rules below must still hide (modes, trailer fields) */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 10;
  background: var(--surface);
  padding: 8px 12px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--text-muted);
}

/* ------------------------------------------------------------ header / footer */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(2, 2, 3, 0.92);
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(6px);
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* back link pill: same design as fuel.psyphin.co.za's header link */
.back-link {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  padding: 8px 16px 8px 12px;
  border: 1px solid rgba(61, 155, 255, 0.45);
  border-radius: 999px;
  background: rgba(61, 155, 255, 0.08);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.back-link-arrow {
  color: var(--accent);
  font-size: 17px;
  transition: transform 0.15s ease;
}

.back-link-domain {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 13px;
}

.back-link:hover {
  background: rgba(61, 155, 255, 0.16);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(61, 155, 255, 0.25);
}

.back-link:hover .back-link-arrow {
  transform: translateX(-3px);
}

.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* phones: the pill, page links and shield share one row, so drop the domain,
   keep the pill on one line and shorten it to "← PsyPhin tools" */
@media (max-width: 480px) {
  .back-link-domain {
    display: none;
  }

  .back-link {
    flex-wrap: nowrap;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .back-link-more {
    display: none;
  }

  .back-link {
    padding: 7px 12px 7px 10px;
    gap: 8px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .back-link,
  .back-link-arrow {
    transition: none;
  }
}

.nav {
  display: flex;
  gap: 18px;
}

/* page links + PsyPhin shield (a copy of psyphin.co.za's brand-64.png), top right */
.header-end {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: block;
  flex: none;
  border-radius: 6px;
}

.brand img {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 6px;
}

.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 420px) {
  .site-header-inner {
    gap: 12px;
  }

  .header-end,
  .nav {
    gap: 12px;
  }

  .nav a {
    font-size: 1rem;
  }

  .brand img {
    width: 28px;
    height: 28px;
  }
}

@media (max-width: 350px) {
  .site-header-inner {
    padding-left: 12px;
    padding-right: 12px;
  }

  .site-header-inner,
  .header-end,
  .nav {
    gap: 8px;
  }

  .back-link {
    padding: 6px 10px 6px 8px;
    gap: 6px;
  }
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.nav a[aria-current="page"],
.nav a:hover {
  color: var(--accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 20px 0 32px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 4px 0;
}

/* ------------------------------------------------------------ intro */
.intro {
  padding: 28px 0 8px;
}

.intro h1 {
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--text);
}

.lede {
  max-width: 62ch;
  margin: 10px 0 6px;
  color: var(--text);
}

.privacy {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ------------------------------------------------------------ modes */
.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 760px;
}

/* phones: two rows of two */
@media (max-width: 560px) {
  .modes {
    grid-template-columns: 1fr 1fr;
  }
}

.mode-button small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.8;
}

.mode-button {
  font: inherit;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.15;
  min-height: 44px;
  padding: 6px 8px;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.mode-button:hover {
  color: var(--text);
}

.mode-button[aria-pressed="true"] {
  color: #0b0d10;
  background: var(--accent);
}

.mode-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-hint {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.jump-link {
  white-space: nowrap;
}

.results {
  scroll-margin-top: 64px; /* clear the sticky header */
}

@media (min-width: 900px) {
  .jump-link {
    display: none;
  }
}

/* ------------------------------------------------------------ layout */
.layout {
  display: grid;
  gap: 24px;
  margin-top: 20px;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(300px, 380px) 1fr;
    align-items: start;
  }
}

/* ------------------------------------------------------------ form */
.inputs fieldset {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  margin: 0 0 16px;
  padding: 14px 16px 6px;
  min-width: 0;
}

.inputs legend {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0 6px;
  color: var(--accent);
}

.field {
  margin-bottom: 14px;
}

.field > label,
.field > .label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="number"],
select {
  width: 100%;
  font: inherit;
  font-size: 1rem; /* 16px stops iOS zooming on focus */
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-height: 44px;
}

input[type="number"]:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.unit-input {
  display: flex;
  align-items: stretch;
}

.unit-input input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.unit-input span {
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 10px 10px 0;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.3;
  padding: 10px 12px;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-weight: 500;
}

.choice label small {
  display: block;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 400;
  margin-top: 2px;
}

.choice .choice-wide {
  grid-column: 1 / -1;
}

.field > .label small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.choice label:has(input:checked) {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice input {
  accent-color: var(--accent);
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
}

.help {
  margin-top: 8px;
  font-size: 0.875rem;
}

.help summary {
  cursor: pointer;
  color: var(--accent);
}

.help-body {
  margin-top: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
}

.help-body p {
  margin: 0 0 6px;
}

.help-body > ul {
  margin: 0 0 6px;
  padding-left: 1.2em;
}

.help-body li {
  margin-bottom: 3px;
}

.fieldset-hint {
  margin: 0 0 12px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 10px;
}

.field-row > .field > label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.field-row-hint {
  margin: -8px 0 14px;
}

.fieldset-details > summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--accent);
  margin-bottom: 8px;
}

.fieldset-details > summary small {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* if the heading wraps, "(optional)" goes with the last word, never alone */
.summary-tail {
  white-space: nowrap;
}

/* phones: keep "(optional)" on the heading's line */
@media (max-width: 420px) {
  .fieldset-details > summary {
    font-size: 1.05rem;
  }

  .fieldset-details > summary small {
    font-size: 0.75rem;
  }
}

.inputs fieldset:has(> .fieldset-details) {
  padding-top: 12px;
}

/* load list builder */
.load-list {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.load-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 6px 8px;
  align-items: end;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.load-row input[type="text"] {
  grid-column: 1 / -1;
}

.load-row input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-height: 44px;
}

.load-row input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.load-num span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.load-remove {
  min-width: 44px;
  min-height: 44px;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.load-remove:hover {
  color: var(--fail);
  border-color: var(--fail);
}

.load-add {
  display: flex;
  gap: 8px;
}

.load-add select {
  flex: 1;
  min-width: 0;
}

.load-total {
  margin: 10px 0 12px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.load-total strong {
  color: var(--text);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.button {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
}

.button--ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.button--ghost:hover {
  border-color: var(--accent);
}

.button--primary {
  background: var(--accent);
  color: #0b0d10;
  border: 1px solid var(--accent);
}

.button--primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ results */
.overall {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  margin-bottom: 16px;
  --tone: var(--incomplete);
  border-left: 5px solid var(--tone);
}

.overall--pass,
.overall--info {
  --tone: var(--pass);
}

.overall--warn {
  --tone: var(--warn);
}

.overall--fail {
  --tone: var(--fail);
}

.status-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tone);
  color: #0b0d10;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}

.panel {
  border: 1px solid var(--border);
  border-top: 4px solid var(--panel-color);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.panel--legal {
  --panel-color: var(--legal);
}

.panel--maker {
  --panel-color: var(--maker);
}

.panel h2 {
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-tag {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--panel-color);
  border: 1px solid var(--panel-color);
  border-radius: 999px;
  padding: 2px 8px;
}

.panel > p {
  margin: 10px 0 0;
}

.checks {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.check {
  --tone: var(--incomplete);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--tone);
  border-radius: 12px;
  padding: 12px 14px;
}

.check--pass { --tone: var(--pass); }
.check--warn { --tone: var(--warn); }
.check--fail { --tone: var(--fail); }
.check--info { --tone: var(--info); }

.check-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* the title wraps beside its icon (never leaving the icon alone); a long
   status label drops to its own line only when both won't fit */
.check-head h3 {
  font-size: 1.15rem;
  flex: 1 1 9rem;
  min-width: 0;
}

.status-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--tone);
  text-align: right;
}

.check-reason {
  margin: 8px 0 0;
}

.check-notes {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.check-notes li + li {
  margin-top: 2px;
}

/* a card's explanatory notes, folded away */
.more-detail {
  margin-top: 8px;
  font-size: 0.85rem;
}

.more-detail > summary {
  cursor: pointer;
  width: fit-content;
  color: var(--accent);
}

.more-detail > .check-notes {
  margin-top: 4px;
}

/* one outcome per vehicle type, when the type was left blank */
.variants {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.variant {
  --tone: var(--incomplete);
  padding: 8px 10px;
  border-left: 3px solid var(--tone);
  border-radius: 8px;
  background: var(--surface);
}

.variant--pass { --tone: var(--pass); }
.variant--warn { --tone: var(--warn); }
.variant--fail { --tone: var(--fail); }
.variant--info { --tone: var(--info); }

.variant-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
}

.variant-head .status-icon {
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
}

.variant-head strong {
  flex: 1 1 9rem;
  min-width: 0;
}

.variant-head .status-label {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tone);
}

.variant p {
  margin: 4px 0 0;
}

/* meter: fill carries the status; the track is a dim step of the same colour */
.meter {
  --tone: var(--incomplete);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.meter--pass { --tone: var(--pass); }
.meter--warn { --tone: var(--warn); }
.meter--fail { --tone: var(--fail); }
.meter--info { --tone: var(--info); }

.meter-track {
  flex: 1;
  height: 10px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--tone) 22%, var(--surface-2));
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--tone);
}

.meter-text {
  flex: none;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.panel-intro {
  font-size: 0.875rem;
}

.panel-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 0;
  font-weight: 600;
  --tone: var(--incomplete);
}

.panel-summary.overall--pass { --tone: var(--pass); }
.panel-summary.overall--warn { --tone: var(--warn); }
.panel-summary.overall--fail { --tone: var(--fail); }

/* heaviest trailer tile */
.limit-tile {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.limit-tile h2 {
  font-size: 1.3rem;
}

.limit-tile > p {
  margin: 8px 0 0;
}

.limit-figure {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3.2rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.limit-sub {
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.limit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.limit-table th,
.limit-table td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.limit-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.limit-table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.limit-table tr.is-binding td {
  font-weight: 600;
  background: var(--surface-2);
}

.limit-table tr.is-binding td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* phones: each limit becomes a two-line block (name, then figure / basis / type) */
@media (max-width: 560px) {
  .limit-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .limit-table tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    column-gap: 12px;
    align-items: baseline;
    padding: 8px;
    border-bottom: 1px solid var(--border);
  }

  .limit-table td {
    padding: 0;
    border: 0;
  }

  .limit-table td:first-child {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .limit-table tr.is-binding {
    background: var(--surface-2);
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .limit-table tr.is-binding td,
  .limit-table tr.is-binding td:first-child {
    background: none;
    box-shadow: none;
  }

  .limit-table .num {
    text-align: left;
  }
}

/* ------------------------------------------------------------ What can I tow? */
.tow-cards {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.tow-card,
.tow-speed {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 5px solid var(--legal);
  border-radius: 12px;
  padding: 12px 14px;
}

.tow-card h3,
.tow-speed h3 {
  font-size: 1.15rem;
}

.tow-figure {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tow-figure--none {
  font-size: 1.6rem;
}

.tow-figure-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tow-lines {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  font-size: 0.875rem;
}

.tow-lines li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: baseline;
  padding: 5px 0;
  border-top: 1px solid var(--border);
}

.tow-lines li.is-binding {
  font-weight: 600;
}

.tow-line-kg {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tow-sentence {
  margin: 8px 0 0;
}

.tow-speed {
  margin-top: 12px;
}

.tow-speed ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.tow-speed-group {
  margin: 10px 0 0;
  font-weight: 600;
}

/* ------------------------------------------------------------ motor car vs goods vehicle */
.panel--compare {
  --panel-color: var(--legal);
}

.compare-summary {
  --tone: var(--info);
}

.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.compare-table th,
.compare-table td {
  text-align: left;
  vertical-align: top;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

.compare-table thead th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-table tbody th {
  font-weight: 600;
  width: 28%;
}

.compare-table tr.is-different {
  background: var(--surface-2);
}

.compare-table tr.is-different th {
  box-shadow: inset 3px 0 0 var(--accent);
}

.diff-tag {
  display: block;
  margin-top: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.compare-cell {
  --tone: var(--incomplete);
}

.compare-cell--pass { --tone: var(--pass); }
.compare-cell--warn { --tone: var(--warn); }
.compare-cell--fail { --tone: var(--fail); }
.compare-cell--info { --tone: var(--info); }

.compare-cell {
  display: table-cell;
}

.compare-cell .status-icon {
  width: 20px;
  height: 20px;
  font-size: 0.75rem;
  margin-right: 8px;
  vertical-align: -4px;
}

@media (max-width: 560px) {
  .compare-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .compare-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 10px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
  }

  .compare-table th,
  .compare-table td {
    padding: 0;
    border: 0;
  }

  .compare-table tbody th {
    grid-column: 1 / -1;
    width: auto;
    margin-bottom: 6px;
  }

  .compare-table tr.is-different {
    box-shadow: inset 3px 0 0 var(--accent);
  }

  .compare-table tr.is-different th {
    box-shadow: none;
  }

  .compare-table .diff-tag {
    display: inline;
    margin: 0 0 0 8px;
  }

  .compare-cell {
    display: block;
  }

  .compare-cell::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }
}

.kind {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
}

.kind--legal {
  color: var(--legal);
  border: 1px solid var(--legal);
}

.kind--manufacturer {
  color: var(--maker);
  border: 1px solid var(--maker);
}

/* compact citations on the checker: plain rule names linking to the sources page */
.rule-links {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.rule-links-label {
  margin-right: 6px;
}

.rule-links ul {
  display: inline;
  list-style: none;
  margin: 0;
  padding: 0;
}

.rule-links li {
  display: inline;
}

.rule-links li + li::before {
  content: "\00B7";
  margin: 0 6px;
  color: var(--text-muted);
}

.rule-links a {
  font-weight: 600;
}

.rule-ref {
  font-weight: 400;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 1px 7px;
  border-radius: 999px;
  white-space: nowrap;
  vertical-align: 1px;
}

.badge--unverified {
  color: var(--warn);
  border: 1px dashed var(--warn);
}

.badge--verified {
  color: var(--pass);
  border: 1px solid var(--pass);
}

.disclaimer {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.disclaimer strong {
  color: var(--text);
}

.disclaimer {
  scroll-margin-top: 72px; /* clear the sticky header when jumped to */
}

.disclaimer h2 {
  font-size: 1.05rem;
  color: var(--text);
  margin: 0 0 6px;
}

.disclaimer p {
  margin: 0;
}

.disclaimer p + p {
  margin-top: 6px;
}

/* "Legal disclaimer" link, top of the page */
.disclaimer-link {
  margin: 0 0 6px;
  font-size: 0.85rem;
}

.disclaimer-link a {
  color: var(--text-muted);
}

.disclaimer-link a:hover {
  color: var(--accent);
}

.explainer {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 12px;
}

.explainer summary {
  cursor: pointer;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.explainer ol {
  padding-left: 20px;
}

.explainer ol > li + li {
  margin-top: 10px;
}

.example {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 10px 12px;
}

/* ------------------------------------------------------------ sources page */
.source-group {
  margin-top: 28px;
}

.source-group > h2 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}

.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.source-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.source-item h3 {
  font-size: 1.15rem;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.source-item p {
  margin: 6px 0 0;
}

.source-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.source-meta a {
  overflow-wrap: anywhere;
}

.source-item {
  scroll-margin-top: 70px;
}

.source-item:target,
.source-item:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.source-group {
  scroll-margin-top: 70px;
}

.sources-summary {
  width: 100%;
  margin-top: 20px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.sources-summary th,
.sources-summary td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

.sources-summary thead th {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sources-summary .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.open-questions {
  padding-left: 22px;
}

.open-questions li + li {
  margin-top: 8px;
}

.oq-rules {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ------------------------------------------------------------ simple check */
/* the licence disc: fill in the two numbers where they sit on the real disc */
.disc {
  position: relative;
  width: min(100%, 290px);
  aspect-ratio: 1;
  margin: 4px auto 6px;
  padding: 14%;
  border-radius: 50%;
  border: 6px solid var(--disc-ring);
  background:
    repeating-radial-gradient(circle at 50% 50%, transparent 0 9px, rgba(120, 150, 110, 0.07) 9px 10px),
    var(--disc-paper);
  color: var(--disc-ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}

.disc-caption {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* the fields you don't need, shown faint so people recognise the disc */
.disc-skip {
  font-size: 0.7rem;
  color: var(--disc-faint);
}

.disc-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}

.disc-field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 4px 4px;
  border: 2px solid var(--accent-strong);
  border-radius: 8px;
  background: #fff;
}

.disc-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.disc-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 2px 0;
  background: transparent;
  color: var(--disc-ink);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  -moz-appearance: textfield;
}

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

.disc-field input::placeholder {
  color: #9aa49e;
  font-weight: 400;
  font-size: 0.8rem;
}

.disc-field input:focus {
  outline: none;
}

.disc-field:focus-within {
  box-shadow: 0 0 0 3px rgba(63, 182, 255, 0.45);
}

.disc-unit {
  font-size: 0.7rem;
  color: var(--disc-faint);
}

.field > label small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* the key figures, before the cards */
.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.figure {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.figure-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.figure-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1.1;
}

.figure-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

#simple-body > .overall {
  margin-top: 4px;
}

#simple-body > .checks {
  margin-top: 14px;
}

/* pointer to the advanced check */
.advanced-note {
  --tone: var(--info);
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-left: 5px solid var(--tone);
  border-radius: 12px;
  background: var(--surface-2);
}

.advanced-note--flag {
  --tone: var(--warn);
}

.advanced-note h3 {
  font-size: 1.1rem;
}

.advanced-note ul {
  margin: 8px 0 12px;
  padding-left: 18px;
}

.advanced-note li + li {
  margin-top: 6px;
}

.advanced-note p {
  margin: 8px 0 12px;
}

/* ------------------------------------------------------------ print */
/* ------------------------------------------------------------ rig diagram */
.rig-figure {
  margin: 12px 0 0;
}

.rig-svg {
  display: block;
  width: 100%;
  height: auto;
}

.rig-ground {
  stroke: var(--border);
  stroke-width: 2;
}

.rig-body {
  fill: var(--surface-2);
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linejoin: round;
}

.rig-wheel circle {
  fill: var(--bg);
  stroke: var(--text-muted);
  stroke-width: 3;
}

.rig-wheel .rig-hub {
  fill: var(--surface-2);
  stroke-width: 2;
}

.rig-bar {
  stroke: var(--text-muted);
  stroke-width: 6;
  stroke-linecap: round;
}

.rig-ball {
  fill: var(--text-muted);
}

.rig-arrow {
  stroke: var(--text-muted);
  stroke-width: 3;
  fill: var(--text-muted);
}

.rig-arrowhead {
  stroke-width: 0;
}

.rig-arrow.st-pass { stroke: var(--pass); fill: var(--pass); }
.rig-arrow.st-warn { stroke: var(--warn); fill: var(--warn); }
.rig-arrow.st-fail { stroke: var(--fail); fill: var(--fail); }

.rig-status.st-pass { fill: var(--pass); }
.rig-status.st-warn { fill: var(--warn); }
.rig-status.st-fail { fill: var(--fail); }

.rig-value {
  fill: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 30px;
}

.rig-sub {
  fill: var(--text-muted);
  font-family: var(--font-body);
  font-size: 21px;
}

.rig-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.rig-table th,
.rig-table td {
  text-align: left;
  vertical-align: top;
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
}

.rig-table thead th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.rig-cell {
  --tone: var(--incomplete);
  white-space: nowrap;
}

.rig-cell--pass { --tone: var(--pass); }
.rig-cell--warn { --tone: var(--warn); }
.rig-cell--fail { --tone: var(--fail); }
.rig-cell--info { --tone: var(--info); }

.rig-cell .status-icon {
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  margin-right: 6px;
  vertical-align: -3px;
}

@media (max-width: 560px) {
  .rig-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .rig-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    column-gap: 10px;
    padding: 8px;
    border-bottom: 1px solid var(--border);
  }

  .rig-table th,
  .rig-table td {
    padding: 0;
    border: 0;
  }

  .rig-table tbody th {
    grid-column: 1;
  }

  .rig-table .rig-cell {
    grid-column: 2;
    grid-row: 1;
    text-align: right;
  }

  .rig-table td:nth-child(2),
  .rig-table td:nth-child(3) {
    grid-column: 1 / -1;
    color: var(--text-muted);
    font-size: 0.8rem;
  }

  .rig-table td.is-empty {
    display: none;
  }
}

/* ------------------------------------------------------------ print */
.results-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

/* one column: the form's Print summary button sits just above, so don't repeat it */
@media (max-width: 899px) {
  .results-actions {
    display: none;
  }
}

.print-only {
  display: none;
}

@media print {
  :root {
    --bg: #fff;
    --surface: #fff;
    --surface-2: #f4f5f6;
    --border: #bbb;
    --text: #000;
    --text-muted: #444;
    --accent: #0645ad;
    --legal: #0645ad;
    --maker: #6b21a8;
    --pass: #15803d;
    --warn: #b45309;
    --fail: #b91c1c;
    --info: #1d4ed8;
    --incomplete: #6b7280;
  }

  @page {
    margin: 14mm;
  }

  body {
    font-size: 10.5pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .site-header,
  .modes,
  .mode-hint,
  .inputs,
  .results-actions,
  .explainers,
  .help,
  .more-detail,
  .skip-link {
    display: none !important;
  }

  .intro .lede,
  .intro .privacy {
    display: none;
  }

  .intro {
    padding-top: 0;
  }

  .layout {
    display: block;
    margin-top: 0;
  }

  .print-only {
    display: block;
    margin-bottom: 14px;
  }

  .check-notes.print-only {
    margin-bottom: 0;
  }

  .status-icon {
    color: #fff;
  }

  .panel,
  .limit-tile,
  .overall,
  .disclaimer {
    border-color: var(--border);
  }

  .check,
  .tow-card,
  .tow-speed,
  .limit-tile,
  .rig-figure,
  .print-table,
  tr {
    break-inside: avoid;
  }

  .panel h2,
  .limit-tile h2 {
    break-after: avoid;
  }

  a {
    color: var(--text);
  }

  .site-footer {
    margin-top: 16px;
  }
}

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 10px;
}

.print-table caption {
  text-align: left;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  padding-bottom: 4px;
}

.print-table th,
.print-table td {
  text-align: left;
  vertical-align: top;
  padding: 5px 8px;
  border: 1px solid var(--border);
}

.print-table tbody th {
  width: 34%;
  font-weight: 600;
}

.write-in-table .write-in {
  width: 30%;
  height: 2.2em;
}

.print-meta {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
