/* ==========================================================================
   KarelCar design system: monochrome, Geist, hairline borders.
   Class names used by public/js widgets are kept: .stats .stat .label .value
   .table-wrap .depr-table .bar-col .bar .muted .popup-cta .sr-only .btn
   ========================================================================== */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
}

:root {
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --bg-hover: #f2f2f2;
  --fg: #0a0a0a;
  --muted: #666666;
  --faint: #8f8f8f;
  --border: #eaeaea;
  --border-strong: #d4d4d4;
  --accent: #0a0a0a;
  --accent-fg: #ffffff;
  --success: #0a7d33; --success-bg: #e9f8ee;
  --warning: #a35200; --warning-bg: #fff4e5;
  --error: #c4141b;   --error-bg: #fdecec;
  --ring: rgba(10, 10, 10, .14);
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px -4px rgba(0,0,0,.06);
  --grid-line: rgba(0,0,0,.06);
  --radius: 8px;
  --radius-sm: 6px;
  --max: 1120px;
  --gutter: 24px;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --bg-subtle: #111111;
    --bg-hover: #1a1a1a;
    --fg: #ededed;
    --muted: #a1a1a1;
    --faint: #737373;
    --border: #262626;
    --border-strong: #3a3a3a;
    --accent: #ededed;
    --accent-fg: #0a0a0a;
    --success: #4ade80; --success-bg: rgba(74,222,128,.1);
    --warning: #fbbf24; --warning-bg: rgba(251,191,36,.1);
    --error: #f87171;   --error-bg: rgba(248,113,113,.1);
    --ring: rgba(237,237,237,.22);
    --shadow: 0 1px 2px rgba(0,0,0,.5), 0 4px 16px -4px rgba(0,0,0,.6);
    --grid-line: rgba(255,255,255,.06);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font: 15px/1.6 var(--sans); color: var(--fg); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; transition: color .15s, opacity .15s; }
p a, .prose a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
p a:hover, .prose a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--fg); color: var(--bg); }
img, svg { display: block; max-width: 100%; }

h1, h2, h3 { color: var(--fg); font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.08; letter-spacing: -0.045em; margin: 0 0 .4em; }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.6rem); line-height: 1.2; letter-spacing: -0.03em; margin: 0 0 .6em; }
h3 { font-size: 1rem; line-height: 1.35; letter-spacing: -0.01em; margin: 0 0 .3em; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-inline: var(--gutter); }
.lead { font-size: clamp(1.02rem, 1.6vw, 1.15rem); color: var(--muted); max-width: 64ch; line-height: 1.6; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.mono, code, kbd { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.eyebrow { font: 500 .75rem/1 var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 12px; }

code {
  font-size: .8em; padding: 2px 6px; border-radius: 4px;
  background: var(--bg-subtle); border: 1px solid var(--border);
}
kbd {
  font-size: .72rem; padding: 1px 6px; border-radius: 4px; color: var(--muted);
  border: 1px solid var(--border); background: var(--bg); box-shadow: inset 0 -1px 0 var(--border);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.02em; font-size: 1rem; }
.logo img { width: 56px; height: 56px; border-radius: var(--radius-sm); flex: none; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--muted); font-size: .875rem; padding: 6px 10px; border-radius: var(--radius-sm); }
.site-nav a:hover { color: var(--fg); background: var(--bg-hover); }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { padding-top: 28px; }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .85rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumbs a:hover { color: var(--fg); }
.breadcrumbs [aria-current] { color: var(--fg); }

/* ---------- Page sections ---------- */
.page { padding-block: 24px 96px; }
.page-header { padding-block: 24px 40px; border-bottom: 1px solid var(--border); margin-bottom: 48px; }
.page-header .lead { margin-bottom: 0; }
.section { margin-top: 64px; }
.section:first-child { margin-top: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h2 { margin: 0; }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(48px, 7vw, 80px) clamp(40px, 6vw, 64px); text-align: center; isolation: isolate; overflow: hidden; border-bottom: 1px solid var(--border); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px; background-position: center top;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 0%, #000 40%, transparent 100%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1; left: 50%; top: -30%; width: 900px; max-width: 140%; aspect-ratio: 2;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, color-mix(in srgb, var(--fg) 7%, transparent), transparent);
  pointer-events: none;
}
.hero h1 { font-size: clamp(2.4rem, 7vw, 4.25rem); letter-spacing: -0.055em; max-width: 16ch; margin-inline: auto; }
.hero .lead { margin-inline: auto; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px;
  padding: 4px 12px 4px 6px; border: 1px solid var(--border); border-radius: 999px;
  font-size: .8rem; color: var(--muted); background: var(--bg);
}
.hero-badge .dot { width: 18px; height: 18px; border-radius: 999px; display: grid; place-items: center; background: var(--fg); color: var(--bg); font-size: .65rem; }

/* ---------- Search ---------- */
.search { position: relative; max-width: 520px; margin: 32px auto 0; }
.search svg { position: absolute; left: 14px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search kbd { position: absolute; right: 12px; top: 50%; translate: 0 -50%; }
.input, .search input {
  width: 100%; height: 44px; font: inherit; font-size: .95rem; color: var(--fg);
  padding: 0 14px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); transition: border-color .15s, box-shadow .15s;
}
.search input { padding-inline: 40px 48px; box-shadow: var(--shadow); }
.input:hover, .search input:hover { border-color: var(--border-strong); }
.input:focus, .search input:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px var(--ring); }
.search input::-webkit-search-cancel-button { display: none; }

/* ---------- Buttons ---------- */
.btn, .cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  font: inherit; font-size: .9rem; font-weight: 500; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
  text-decoration: none; transition: opacity .15s, background .15s, border-color .15s;
}
.btn:hover, .cta:hover { opacity: .86; }
.btn-secondary, .btn[data-action="locate"] { background: var(--bg); color: var(--fg); border-color: var(--border); }
.btn-secondary:hover, .btn[data-action="locate"]:hover { opacity: 1; background: var(--bg-hover); border-color: var(--border-strong); }
.btn-block { width: 100%; }
.btn svg, .cta svg { width: 16px; height: 16px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: .75rem; font-weight: 500; white-space: nowrap;
  background: var(--bg-hover); color: var(--muted); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: transparent; }
.badge-error   { background: var(--error-bg);   color: var(--error);   border-color: transparent; }
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }

/* ---------- Cards / grid ---------- */
.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; letter-spacing: -0.015em; }
.card-title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* stretched link */
.card .arrow { color: var(--faint); transition: transform .15s, color .15s; }
.card:hover .arrow { transform: translateX(3px); color: var(--fg); }
.card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: .85rem; }
.card .chips { position: relative; z-index: 1; } /* year chips stay clickable above the stretched link */
.empty { padding: 48px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: var(--radius); }

/* ---------- Lists ---------- */
.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.rows li + li { border-top: 1px solid var(--border); }
.rows a { display: flex; align-items: center; gap: 16px; padding: 14px 20px; transition: background .15s; }
.rows a:hover { background: var(--bg-subtle); }
.rows .year { font-family: var(--mono); font-size: .85rem; color: var(--muted); min-width: 3.5em; }
.rows .arrow { margin-left: auto; color: var(--faint); }
.rows-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.rows-2 li + li { border-top: 0; }
.rows-2 li { border-bottom: 1px solid var(--border); }
@media (min-width: 720px) { .rows-2 li:nth-child(odd) { border-right: 1px solid var(--border); } }

/* ---------- Chips / pills ---------- */
.chips, .pills { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.chips a, .pills a {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px;
  font: 500 .8rem var(--mono); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  text-decoration: none; transition: color .15s, border-color .15s, background .15s;
}
.chips a:hover, .pills a:hover { color: var(--fg); border-color: var(--border-strong); background: var(--bg-hover); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0 0 24px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
/* inner hairlines: each cell draws top/left borders shifted by -1px; the outer ones are clipped by the container */
.stat { margin: -1px 0 0 -1px; border-left: 1px solid var(--border); border-top: 1px solid var(--border); background: var(--bg); padding: 16px 20px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stat .label { color: var(--muted); font: 500 .72rem/1.2 var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.stat .value { font-family: var(--mono); font-size: clamp(1.15rem, 2.2vw, 1.5rem); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* ---------- Tables ---------- */
.table-wrap { position: relative; /* contains absolutely positioned .sr-only cells so they can't widen the page */ overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: .9rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody tr:last-child > * { border-bottom: 0; }
thead th { background: var(--bg-subtle); font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
tbody th { font-weight: 500; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--bg-subtle); }
td.num, th.num { text-align: right; font-family: var(--mono); }
.row-link { position: relative; }
.row-link a.stretch::after { content: ""; position: absolute; inset: 0; }
.row-link td:first-child { font-family: var(--mono); font-weight: 600; }

/* ---------- Model-year layout ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 48px; }
@media (min-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; }
  /* The aside comes first in the DOM so phones get the summary up top; on desktop it sits on the right. */
  .main-col { grid-column: 1; grid-row: 1; }
  .aside { grid-column: 2; grid-row: 1; position: sticky; top: 88px; }
}
.aside { display: flex; flex-direction: column; gap: 16px; }
.aside .stats { grid-template-columns: 1fr; margin: 0; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--bg); }
.panel-title { font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 10px; }
.toc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.toc a { display: block; padding: 6px 10px; margin-inline: -10px; border-radius: var(--radius-sm); font-size: .875rem; color: var(--muted); }
.toc a:hover { color: var(--fg); background: var(--bg-hover); }

/* ---------- Issues ---------- */
.issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; counter-reset: issue; }
.issues li { counter-increment: issue; position: relative; padding: 20px 20px 20px 64px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.issues li::before {
  content: counter(issue, decimal-leading-zero); position: absolute; left: 20px; top: 20px;
  font: 500 .8rem/1.6 var(--mono); color: var(--faint);
}
.issues p { color: var(--muted); margin: 0; }
.issues p + p { margin-top: 10px; }
.codes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* ---------- Specs ---------- */
.specs { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.specs dt, .specs dd { padding: 12px 16px; margin: 0; border-bottom: 1px solid var(--border); }
.specs dt { color: var(--muted); font-size: .875rem; background: var(--bg-subtle); border-right: 1px solid var(--border); }
.specs dt:nth-last-of-type(1), .specs dd:last-of-type { border-bottom: 0; }

/* ---------- Depreciation calculator ---------- */
.depr { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.depr-head { padding: 24px 24px 0; }
.depr-head h2 { margin-bottom: .3em; }
.depr-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; padding: 20px 24px 24px; margin: 0; border-bottom: 1px solid var(--border); }
.depr-form label { display: flex; flex-direction: column; gap: 8px; font-size: .8rem; font-weight: 500; color: var(--muted); }
.depr-form input[type="number"] {
  height: 40px; font: 500 .95rem var(--mono); color: var(--fg); padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  transition: border-color .15s, box-shadow .15s; -moz-appearance: textfield;
}
.depr-form input[type="number"]:hover { border-color: var(--border-strong); }
.depr-form input[type="number"]:focus { outline: none; border-color: var(--fg); box-shadow: 0 0 0 3px var(--ring); }
.depr-form input[type="range"] { accent-color: var(--fg); margin: 12px 0 0; height: 16px; }
.depr-form output { font-family: var(--mono); font-weight: 600; color: var(--fg); }
.depr-results { padding: 24px; background: var(--bg-subtle); }
.depr-results .stats { margin-bottom: 16px; }
.depr-results .table-wrap { background: var(--bg); }
.depr-foot { padding: 12px 24px; margin: 0; border-top: 1px solid var(--border); }
.depr-table td:nth-child(n+2), .depr-table th:nth-child(n+2) { text-align: right; }
.depr-table td { font-family: var(--mono); font-size: .85rem; }
.bar-col { width: 30%; min-width: 96px; }
.bar { display: block; height: 6px; width: var(--w, 0%); margin-left: auto; background: var(--fg); border-radius: 999px; transition: width .25s ease; }

/* ---------- Dealer map ---------- */
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 12px; }
.map-canvas { height: clamp(320px, 55vh, 480px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); z-index: 0; overflow: hidden; }
.nearest { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; counter-reset: near; }
.nearest li { counter-increment: near; padding: 12px 16px 12px 48px; position: relative; font-size: .9rem; }
.nearest li::before { content: counter(near); position: absolute; left: 16px; font: .8rem/1.6 var(--mono); color: var(--faint); }
.nearest li + li { border-top: 1px solid var(--border); }
.nearest a { font-weight: 500; }
.popup-cta { display: inline-block; margin-top: 8px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.leaflet-container { font-family: var(--sans) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { border-radius: var(--radius) !important; box-shadow: var(--shadow) !important; }

/* ---------- Error page ---------- */
.error-page { text-align: center; padding-block: clamp(80px, 16vw, 160px); }
.error-code { font: 600 clamp(4rem, 14vw, 8rem)/1 var(--mono); letter-spacing: -0.06em; margin: 0 0 16px; color: var(--fg); }
.error-page .lead { margin-inline: auto; }
.error-page .actions { display: flex; gap: 8px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-subtle); padding-block: 48px 32px; font-size: .875rem; color: var(--muted); }
.footer-grid { display: grid; gap: 32px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.footer-grid h3 { font-size: .8rem; font-weight: 500; color: var(--fg); margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-grid a:hover { color: var(--fg); }
.footer-grid p { max-width: 44ch; }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: .8rem; }

/* ---------- Responsive ---------- */

/* ---- Vehicle photos ------------------------------------------------------------------------ */
.vimg { margin: 0; flex: none; }
.vimg img, .vimg-placeholder {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-subtle);
}
.vimg-placeholder { display: grid; place-items: center; color: var(--faint); }
.vimg-placeholder svg { width: 40%; max-width: 96px; }
.vimg figcaption { margin-top: 6px; }
.vimg-thumb { width: 64px; }
.vimg-thumb .vimg-placeholder svg { width: 70%; }
.vimg-card { margin: -4px -4px 4px; }
.vimg-hero { width: 100%; max-width: 360px; }
.page-header-media { display: grid; gap: 24px; align-items: center; }
@media (min-width: 720px) { .page-header-media { grid-template-columns: minmax(0, 1fr) 320px; } .page-header-media .vimg-hero { order: 2; } }
.year-cell { display: inline-flex; align-items: center; gap: 12px; }

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .site-nav a.hide-sm { display: none; }
  .section { margin-top: 48px; }
  .page-header { padding-block: 16px 28px; margin-bottom: 32px; }
  .issues li { padding: 16px 16px 16px 52px; }
  .issues li::before { left: 16px; top: 16px; }
  .depr-head, .depr-form, .depr-results { padding-inline: 16px; }
  .depr-foot { padding-inline: 16px; }
  .rows a { padding: 12px 16px; }
  .rows-2 { grid-template-columns: 1fr; }
  th, td { padding: 10px 8px; }
  th:first-child, td:first-child { padding-left: 12px; }
  th:last-child, td:last-child { padding-right: 12px; }
  thead th { white-space: normal; }
  /* Fit year tables on phones: smaller thumbnail, drop the decorative arrow / bar columns. */
  .year-cell .vimg-thumb { width: 44px; }
  .row-link td:last-child, table:has(.row-link) th:last-child { display: none; }
  .depr-table .bar-col { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

.footer-blurb { margin-top: 12px; }
.sr-only:focus { position: fixed; top: 12px; left: 12px; width: auto; height: auto; clip: auto; z-index: 100; padding: 8px 12px; background: var(--fg); color: var(--bg); border-radius: var(--radius-sm); }
.note { margin-top: 12px; }
.main-col > .section:first-child { margin-top: 0; }
.stat .value .badge { font-size: .85rem; height: 26px; padding: 0 10px; }

/* ---------- VIN decoder ---------- */
.vin-form { display: flex; gap: 8px; max-width: 560px; margin-top: 24px; }
.vin-form .input { flex: 1; min-width: 0; text-transform: uppercase; letter-spacing: .04em; }
.vin-form .input::placeholder { text-transform: none; letter-spacing: 0; }
.vin-form .btn { height: 44px; }
.vin-form-hero { margin: 32px auto 0; }
.vin-form-hero .input { box-shadow: var(--shadow); }
.hero-or { margin: 20px 0 0; }
.search-makes { margin: 0 0 16px; }
.vin-help { margin: 12px 0 0; max-width: 72ch; }
.vin-stat { font-size: 1rem; letter-spacing: -0.01em; }
.vin-explainer .card h3 { margin: 0; }
.vin-explainer .card p { margin: 0; font-size: .9rem; }
.form-error { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--error-bg); color: var(--error); font-size: .9rem; max-width: 560px; }
@media (max-width: 480px) { .vin-form { flex-direction: column; } .vin-form .btn { width: 100%; } }

/* ---------- Recalls / complaints / safety ---------- */
.recalls { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.recalls li { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
.recalls p { color: var(--muted); margin: 0 0 8px; }
.recalls p:last-child { margin-bottom: 0; }
.recalls strong { color: var(--fg); font-weight: 500; }
.recall-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.subhead { margin: 32px 0 12px; }
.complaint-table th[scope="row"] { white-space: normal; }
.complaint-table .bar-col { width: 35%; }
.bar-left { margin-left: 0; }
.stars { color: var(--warning); letter-spacing: .08em; font-family: var(--sans); }

/* ---------- Prose pages (about, legal, contact) ---------- */
.prose { max-width: 72ch; }
.prose h2 { margin-top: 2em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin-top: 1.5em; }
.prose p, .prose li { color: var(--muted); }
.prose strong { color: var(--fg); font-weight: 500; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose li + li { margin-top: .4em; }
.small-prose p { font-size: .9rem; }
.legal-updated { margin: 16px 0 0; }
.callout { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-subtle); margin-bottom: 2em; }
.callout p:last-child { margin-bottom: 0; }
.callout-success { border-color: transparent; background: var(--success-bg); }
.callout-success h2 { color: var(--success); font-size: 1.15rem; }

/* ---------- Contact form ---------- */
.contact-layout { display: grid; gap: 40px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .contact-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 64px; align-items: start; } }
.contact-form { display: flex; flex-direction: column; gap: 18px; max-width: 560px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .85rem; font-weight: 500; }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; line-height: 1.5; }
select.input { appearance: auto; }
.input[aria-invalid="true"] { border-color: var(--error); }
.field-error { margin: 0; color: var(--error); font-size: .82rem; }
.contact-form .btn { align-self: flex-start; }
.contact-aside p { margin: 0 0 14px; overflow-wrap: anywhere; }
.contact-aside p:last-child { margin-bottom: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Recall details ---------- */
.recall-details summary { cursor: pointer; font-size: .85rem; color: var(--muted); }
.recall-details summary:hover { color: var(--fg); }
.recall-details p { margin: 8px 0 0; font-size: .9rem; }

/* ---------- Touch and small screens: keep last, these override the feature rules above ---------- */
@media (hover: none) { .search kbd { display: none; } }
@media (max-width: 959px) {
  .aside .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .aside .stat:has(.vin-stat) { grid-column: 1 / -1; }
  .toc { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .toc a { margin-inline: 0; padding: 4px 10px; border: 1px solid var(--border); font-size: .82rem; }
}
@media (max-width: 640px) {
  .complaint-table .bar-col { display: none; }
  /* iOS zooms the page when a focused input is under 16px. */
  .input, .search input, .depr-form input[type="number"] { font-size: 16px; }
}
