/* SpareRadar palette and the industrial-clean rule: flat colour fields, strong type, no
   gradients. Deliberately the same visual language as vin.spareradar.com, since the two
   tools cross-link and a visitor should recognise the second one immediately. */
:root {
  --ink: #0B1220;
  --ink-1: #0E1626;
  --ink-2: #131D30;
  --line: #1E2A3E;
  --line-soft: #172236;
  --grid: rgba(255,255,255,0.018);

  --red: #DC2626;
  --red-hi: #EF4444;
  --red-soft: #F87171;
  --red-wash: rgba(220,38,38,0.10);

  --white: #FFFFFF;
  --text: #E9EEF6;
  --text-dim: #9AA7BC;
  --text-faint: #64748B;

  /* Code structure: red marks the characters that carry meaning a lookup can act on
     (system letter, standardisation digit), neutral marks the positional index. */
  --seg-id: var(--red);
  --seg-mech: #5A6B84;

  --radius: 12px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background-color: var(--ink);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 46px 46px;
  background-position: center top;
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

a { color: inherit; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 22px 22px 72px; }

/* Header */
header.bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding-bottom: 18px; margin-bottom: 34px;
  border-bottom: 1px solid var(--line-soft);
}
.lockup { display: flex; align-items: center; gap: 11px; text-decoration: none; }
.lockup svg { width: 32px; height: 32px; flex: none; display: block; }
.wordmark {
  font-weight: 800; font-size: 21px; letter-spacing: -0.6px; color: var(--white);
  white-space: nowrap;
}
.wordmark i { font-style: normal; color: var(--red); }
.lockup:hover .wordmark i { color: var(--red-hi); }
.divider { width: 1px; height: 22px; background: var(--line); flex: none; }
.toolname {
  font-weight: 600; font-size: 13px; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
}
.toolname:hover { color: var(--text); }

/* Hero */
.hero { margin-bottom: 26px; }
h1 {
  font-weight: 800; font-size: clamp(30px, 5.6vw, 50px); letter-spacing: -1.3px;
  line-height: 1.06; color: var(--white); margin-bottom: 14px;
}
.lede { color: var(--text-dim); font-size: clamp(15px, 2.2vw, 17px); max-width: 640px; }

form.search { margin-top: 26px; max-width: 720px; }
.field {
  display: flex; align-items: stretch; gap: 8px;
  background: var(--ink-1); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 7px 7px 7px 16px;
  transition: border-color .16s, box-shadow .16s;
}
.field:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
input#code {
  flex: 1; min-width: 0; background: none; border: none; outline: none; color: var(--white);
  font-family: var(--font); font-weight: 700; font-size: clamp(17px, 3.4vw, 22px);
  letter-spacing: clamp(1px, 1.2vw, 5px); text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
input#code::placeholder {
  color: var(--text-faint); font-weight: 400; font-size: 15px;
  letter-spacing: 0.4px; text-transform: none;
}
button.go {
  flex: none; border: none; cursor: pointer; border-radius: 8px; padding: 0 24px;
  min-height: 46px;
  font-family: var(--font); font-weight: 700; font-size: 14px; letter-spacing: 0.3px;
  color: var(--white); background: var(--red);
  transition: background .14s, transform .1s;
}
button.go:hover { background: var(--red-hi); }
button.go:active { transform: translateY(1px); }
button.go:disabled { opacity: 0.6; cursor: wait; }

.meta-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 11px; flex-wrap: wrap; }
.counter { font-size: 12px; color: var(--text-faint); }
.counter b { color: var(--text-dim); font-weight: 600; }
.counter.warn b { color: var(--red-soft); }

/* Example chips */
.examples { display: flex; gap: 7px; margin-top: 13px; flex-wrap: wrap; align-items: center; }
.examples .lbl { font-size: 11.5px; color: var(--text-faint); margin-right: 2px; }
.chip {
  background: var(--ink-1); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 7px; padding: 5px 10px; cursor: pointer;
  font-family: var(--font); font-weight: 600; font-size: 12.5px; letter-spacing: 0.7px;
  font-variant-numeric: tabular-nums; text-decoration: none; display: inline-block;
  transition: border-color .14s, color .14s;
}
.chip:hover { border-color: var(--red); color: var(--white); }

/* The honesty line. Coverage stated plainly, near the input, where it cannot be missed. */
.coverage {
  margin-top: 18px; max-width: 720px;
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px 13px 17px; border-radius: var(--radius);
  background: var(--ink-1); border: 1px solid var(--line);
  border-left: 3px solid var(--red);
  font-size: 13.5px; line-height: 1.55; color: var(--text-dim);
}
.coverage svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--red); }
.coverage b { font-weight: 600; color: var(--white); }

/* Error */
.error {
  display: none; margin-top: 18px; max-width: 720px; padding: 13px 15px; border-radius: var(--radius);
  background: var(--red-wash); border: 1px solid rgba(220,38,38,0.35);
  color: var(--text); font-size: 13.5px;
}
.error.show { display: block; animation: pop .28s ease; }
.error b { color: var(--red-soft); font-weight: 600; }
.error a { color: var(--white); font-weight: 600; }

/* Panels */
#result { margin-top: 32px; display: none; }
#result.show { display: block; }

.panel { background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel + .panel, .panel + .cta, .cta + .panel { margin-top: 16px; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 17px; border-bottom: 1px solid var(--line-soft); background: var(--ink-2);
}
.panel-head .title { font-size: 11px; font-weight: 700; letter-spacing: 1.7px; text-transform: uppercase; color: var(--text-dim); }
.panel-head .echo { font-size: 12px; font-weight: 500; letter-spacing: 1px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.panel-body { padding: 19px 17px; }

/* The code itself, cell per character, mirroring the VIN tool's position schematic. */
.schema-scroll { overflow-x: auto; padding-bottom: 4px; }
.schema { display: flex; gap: 10px; min-width: max-content; margin: 0 auto; width: fit-content; }
.seg { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.seg-cells { display: flex; gap: 5px; }
.cell {
  width: 38px; height: 50px; border-radius: 6px; display: grid; place-items: center;
  font-weight: 700; font-size: 21px; color: var(--white);
  font-variant-numeric: tabular-nums;
  background: var(--ink-2); border: 1px solid var(--line);
  position: relative;
}
.cell::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px; height: 2px; border-radius: 2px;
  background: var(--seg-color);
}
.seg-label { text-align: center; max-width: 130px; }
.seg-label .t { font-weight: 700; font-size: 10.5px; letter-spacing: 1.2px; color: var(--seg-color); text-transform: uppercase; }
.seg-label .s { font-size: 10.5px; color: var(--text-faint); line-height: 1.35; }

/* Headline result */
.codehead { display: flex; flex-direction: column; gap: 7px; }
.codehead .code {
  font-weight: 800; font-size: clamp(30px, 6vw, 44px); letter-spacing: 1px; line-height: 1.04;
  color: var(--white); font-variant-numeric: tabular-nums;
}
.codehead .desc { font-weight: 500; font-size: clamp(16px, 3vw, 21px); color: var(--text); line-height: 1.35; }
.codehead .desc.muted { color: var(--text-faint); font-weight: 400; }
.tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 4px; }
.tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.9px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 5px; border: 1px solid currentColor; opacity: 0.9;
}
.tag.generic { color: var(--red-soft); }
.tag.mfr { color: var(--seg-mech); }
.tag.system { color: var(--text-dim); }

/* Extra dataset fields, rendered only when the dataset actually carries them. */
.specs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: 10px; overflow: hidden; }
@media (max-width: 560px) { .specs { grid-template-columns: 1fr; } }
.spec { background: var(--ink-1); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-height: 62px; }
.spec .k { font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-faint); }
.spec .v { font-size: 15px; font-weight: 500; word-break: break-word; color: var(--text); }

/* Related codes: real neighbours from the dataset, not invented "you may also like". */
.related { display: flex; flex-wrap: wrap; gap: 7px; }
.related a {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 7px; padding: 7px 11px; text-decoration: none;
  font-weight: 600; font-size: 12.5px; letter-spacing: 0.6px;
  font-variant-numeric: tabular-nums;
  transition: border-color .14s, color .14s;
}
.related a:hover { border-color: var(--red); color: var(--white); }
.related a .rd { font-weight: 400; letter-spacing: 0; color: var(--text-faint); }

/* Waitlist block */
.cta {
  background: var(--ink-1); border: 1px solid rgba(220,38,38,0.35); border-radius: var(--radius);
  padding: 24px 22px; position: relative; overflow: hidden; margin-top: 16px;
}
.cta::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.cta h2 { font-weight: 800; font-size: clamp(19px, 3.4vw, 24px); letter-spacing: -0.5px; color: var(--white); margin-bottom: 8px; }
.cta p { color: var(--text-dim); font-size: 14.5px; max-width: 520px; margin-bottom: 18px; }
.cta-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--red); color: var(--white); text-decoration: none;
  font-weight: 700; font-size: 15px; padding: 12px 22px; border-radius: 8px;
  transition: background .14s, transform .1s;
}
.cta-btn:hover { background: var(--red-hi); }
.cta-btn:active { transform: translateY(1px); }
.cta-btn svg { width: 15px; height: 15px; }

/* Breadcrumb on per-code pages */
.crumb { font-size: 12.5px; color: var(--text-faint); margin-bottom: 16px; }
.crumb a { color: var(--text-dim); text-decoration: none; }
.crumb a:hover { color: var(--white); }
.crumb .sep { margin: 0 7px; opacity: 0.6; }

/* Footer */
footer {
  margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-dim);
}
footer svg { width: 18px; height: 18px; flex: none; }
footer a { color: var(--white); font-weight: 600; text-decoration: none; border-bottom: 1px solid rgba(220,38,38,0.55); }
footer a:hover { border-bottom-color: var(--red); }
.foot-sep { width: 1px; height: 14px; background: var(--line); flex: none; }

/* Dataset attribution. Required by the licence, so it is part of the page, not a nicety. */
.attrib {
  margin-top: 18px; font-size: 11.5px; line-height: 1.6; color: var(--text-faint);
  max-width: 720px;
}
.attrib a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.attrib a:hover { color: var(--text); border-bottom-color: var(--text-faint); }

/* Mobile */
@media (max-width: 560px) {
  .wrap { padding: 16px 14px 52px; }
  header.bar { margin-bottom: 24px; padding-bottom: 14px; gap: 10px; }
  .lockup svg { width: 26px; height: 26px; }
  .wordmark { font-size: 18px; }
  .toolname { font-size: 11px; letter-spacing: 1.2px; }
  .field { padding: 6px 6px 6px 13px; }
  button.go { padding: 0 18px; min-height: 48px; }
  .panel + .panel, .panel + .cta, .cta + .panel { margin-top: 13px; }
  .panel-head { padding: 11px 14px; }
  .panel-body { padding: 16px 14px; }
  .spec { padding: 11px 13px; min-height: 58px; }
  .cta { padding: 20px 18px; }
  .cta-btn { width: 100%; justify-content: center; }
  .panel-head .echo { display: none; }
  .cell { width: 34px; height: 46px; font-size: 18px; }
}
@media (max-width: 380px) {
  input#code { letter-spacing: 1px; font-size: 16px; }
  .divider, .toolname { display: none; }
}

/* Manufacturer codes: the by-make table and its filter.
   The filter hides rows that are already in the DOM, so nothing here may rely on JS to put
   content on the page - only to take it off. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.make-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.make-filter input {
  flex: 1; min-width: 0; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 13px; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--white);
  transition: border-color .16s, box-shadow .16s;
}
.make-filter input:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.make-filter input::placeholder { color: var(--text-faint); }
.make-clear {
  flex: none; color: var(--text-dim); font-size: 13px; text-decoration: none;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.make-clear:hover { color: var(--white); border-bottom-color: var(--red); }
.make-clear[hidden] { display: none; }

.makes {
  list-style: none; display: grid; gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: 10px; overflow: hidden;
}
.make-row {
  background: var(--ink-1); padding: 11px 14px;
  display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: baseline;
}
.make-row[hidden] { display: none; }
/* The make carried in on ?make=, marked so a shared link lands somewhere obvious. */
.make-row.is-hit { background: var(--red-wash); }
.make-name {
  font-weight: 700; font-size: 13px; letter-spacing: 0.3px;
  color: var(--white); text-transform: uppercase;
}
.make-meaning { color: var(--text-dim); font-size: 14.5px; line-height: 1.45; }
.make-none { color: var(--text-faint); font-size: 14px; padding: 14px 2px 2px; }
.make-none[hidden] { display: none; }

/* Why the table is a table and not one sentence. Stated on the page because a reader who
   skims the rows could otherwise take a neighbouring make's meaning for their own. */
.note {
  margin-top: 15px; color: var(--text-faint); font-size: 13px; line-height: 1.6;
}

@media (max-width: 560px) {
  .make-row { grid-template-columns: 1fr; gap: 4px; }
  .make-filter { flex-wrap: wrap; }
}

/* The scan page: one paste, every code in it.
   Reuses .panel, .coverage, .tag and .note wholesale, because a scan result is the same
   kind of object as a single lookup and should not arrive looking like a different site. */

.scan-form { margin-top: 24px; max-width: 720px; }
.scan-form textarea {
  width: 100%; display: block; resize: vertical; min-height: 112px;
  background: var(--ink-1); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; outline: none;
  font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--white);
  font-variant-numeric: tabular-nums;
  transition: border-color .16s, box-shadow .16s;
}
.scan-form textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.scan-form textarea::placeholder { color: var(--text-faint); font-variant-numeric: normal; }
.scan-form .go { min-height: 46px; }
/* Scoped: on the landing page .counter.warn tints only its <b>, and that must not change. */
#scan-counter.warn { color: var(--red-soft); }

/* The truncation notice. Neutral rather than red: nothing is wrong, the list is capped. */
.coverage--warn { margin-top: 12px; border-left-color: var(--seg-mech); }
.coverage--warn svg { color: var(--seg-mech); }

.make-pick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.make-pick select {
  flex: 1; min-width: 190px; background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; outline: none;
  font-family: var(--font); font-size: 15px; color: var(--white);
  transition: border-color .16s, box-shadow .16s;
}
.make-pick select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-wash); }
.make-pick .go { min-height: 44px; }

/* One row per code, in the visitor's own order. The left rule states which of the three
   kinds a row is, matching the tag colours: standardised, manufacturer-set, or absent. */
.scan-list {
  list-style: none; display: grid; gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: 10px; overflow: hidden;
}
.scan-item {
  background: var(--ink-1); padding: 14px 16px;
  display: grid; grid-template-columns: 104px 1fr; gap: 16px; align-items: start;
  border-left: 3px solid var(--line);
}
.scan-item.is-generic { border-left-color: var(--red); }
.scan-item.is-mfr { border-left-color: var(--seg-mech); }
.si-code {
  font-weight: 800; font-size: 19px; letter-spacing: 0.7px; color: var(--white);
  font-variant-numeric: tabular-nums; text-decoration: none;
  border-bottom: 1px solid transparent; justify-self: start;
}
.si-code:hover { border-bottom-color: var(--red); }
.si-meaning { font-size: 16px; line-height: 1.4; color: var(--text); }
.si-meaning.muted { color: var(--text-faint); }
.si-note { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--text-faint); }
.si-note a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.si-note a:hover { color: var(--white); border-bottom-color: var(--red); }
.scan-item .tags { margin-top: 8px; }

/* Sending the list on is the point of the page having its own address. */
.share { display: flex; gap: 10px; flex-wrap: wrap; }
.share-btn {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 11px 18px; cursor: pointer; text-decoration: none;
  font-family: var(--font); font-weight: 600; font-size: 14px;
  transition: border-color .14s, color .14s;
}
.share-btn:hover { border-color: var(--red); color: var(--white); }
.share-btn svg { width: 17px; height: 17px; flex: none; }
.share-btn[hidden] { display: none; }

/* The landing page's route into the scan tool. */
.chip.chip-go { border-color: rgba(220,38,38,0.45); color: var(--text); }
.chip.chip-go:hover { color: var(--white); }

@media (max-width: 560px) {
  .scan-item { grid-template-columns: 1fr; gap: 6px; }
  .scan-form .go, .make-pick .go { width: 100%; }
  .make-pick select { min-width: 0; }
  .share-btn { flex: 1; justify-content: center; }
}

@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.reveal { animation: pop .34s ease both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }
