/* VIN Decoder and Recall Checker
   Design idea: the VIN input is a riveted steel plate, like the one on a real car.
   Everything else stays quiet so the plate is the one memorable thing. */

:root {
  --steel: #d3d9de;
  --plate: #eef1f3;
  --edge: #1b2733;
  --ink: #16202a;
  --ink-soft: #46535f;
  --line: #aeb8c1;
  --green: #0b6b4f;
  --amber: #7a4a00;
  --amber-bg: #fbefd9;
  --alert: #a32119;
  --alert-bg: #fbe4e1;

  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--steel);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.5;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 72px;
}

/* ---------- Masthead ---------- */

.masthead h1 {
  margin: 0 0 10px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 7vw, 3.1rem);
  line-height: 1;
  letter-spacing: 0.01em;
}

.masthead p {
  margin: 0 0 24px;
  max-width: 58ch;
  color: var(--ink-soft);
}

/* ---------- The plate ---------- */

.plate {
  position: relative;
  padding: 24px 22px 22px;
  border: 3px solid var(--edge);
  border-radius: 14px;
  background:
    radial-gradient(circle at 12px 12px, #8a96a1 0 3.5px, transparent 4.5px),
    radial-gradient(circle at calc(100% - 12px) 12px, #8a96a1 0 3.5px, transparent 4.5px),
    radial-gradient(circle at 12px calc(100% - 12px), #8a96a1 0 3.5px, transparent 4.5px),
    radial-gradient(circle at calc(100% - 12px) calc(100% - 12px), #8a96a1 0 3.5px, transparent 4.5px),
    var(--plate);
  box-shadow: 0 2px 0 rgba(22, 32, 42, 0.18);
}

.plate label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--ink-soft);
}

#vin-input {
  width: 100%;
  padding: 8px 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.5rem, 6.4vw, 2.3rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  box-shadow: inset 0 2px 0 rgba(22, 32, 42, 0.1);
}

#vin-input::placeholder {
  color: #8d98a2;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
}

/* The 17 character slots under the input */

.cells {
  display: grid;
  grid-template-columns: repeat(17, 1fr);
  gap: 3px;
  margin-top: 12px;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  border: 1.5px solid var(--line);
  border-radius: 3px;
  background: transparent;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(0.75rem, 3vw, 1.05rem);
  line-height: 1;
}

.cell.check { border-color: var(--green); border-width: 2px; }
.cell.filled { border-color: var(--ink); background: #fff; }
.cell.filled.check { border-color: var(--green); }
.cell.bad { border-color: var(--alert); background: var(--alert-bg); color: var(--alert); }

.plate-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 10px 0 18px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.count { font-weight: 600; color: var(--ink); }
.count.over { color: var(--alert); }

/* ---------- Buttons ---------- */

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

.btn {
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font-family: var(--body);
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn:hover { background: rgba(22, 32, 42, 0.07); }

.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: #095a42; }

.btn.quiet { border-color: transparent; text-decoration: underline; }

.btn:disabled { opacity: 0.55; cursor: progress; }

:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.btn.primary:focus-visible { outline-color: var(--ink); }

/* ---------- Status messages ---------- */

.status {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-left: 5px solid var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
}

.status:empty { display: none; }
.status.error { border-left-color: var(--alert); background: var(--alert-bg); }

/* ---------- Results ---------- */

.toolbar { margin-top: 22px; }

.section {
  margin-top: 30px;
  padding-top: 12px;
  border-top: 3px solid var(--ink);
}

.section h2 {
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.1;
}

.section > p { max-width: 62ch; margin: 0 0 14px; color: var(--ink-soft); }

.notice {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-left: 5px solid var(--amber);
  background: var(--amber-bg);
  color: var(--amber);
  font-weight: 500;
}

/* Vehicle spec sheet */

.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0 32px;
  margin: 0;
}

.specs > div {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.specs dt { font-size: 0.875rem; color: var(--ink-soft); }
.specs dd { margin: 0; font-size: 1.15rem; font-weight: 600; }

.vehicle-title {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 5.5vw, 2.3rem);
  line-height: 1.05;
}

/* Recalls */

.recall-list { margin: 0; padding: 0; list-style: none; }

.recall {
  margin: 0 0 10px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--amber);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
}

.recall summary {
  padding: 12px 14px;
  cursor: pointer;
  list-style-position: inside;
}

.recall .component { font-weight: 600; }
.recall .meta { display: block; margin-top: 2px; font-size: 0.9rem; color: var(--ink-soft); }

.recall-body { padding: 0 14px 14px; }
.recall-body h3 { margin: 12px 0 2px; font-size: 0.95rem; font-weight: 600; color: var(--ink-soft); }
.recall-body p { margin: 0; max-width: 66ch; }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 4px;
  background: var(--alert);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
}

.empty { padding: 12px 14px; border-left: 5px solid var(--green); background: rgba(255, 255, 255, 0.7); }

.footer { margin-top: 48px; font-size: 0.875rem; color: var(--ink-soft); max-width: 66ch; }

/* ---------- Small screens ---------- */

@media (max-width: 480px) {
  .plate { padding: 22px 16px 18px; }
  #vin-input { font-size: 1.3rem; letter-spacing: 0.03em; padding: 8px 10px; }
  .cells { gap: 2px; }
  .cell { height: 26px; border-width: 1px; }
  .btn { flex: 1 1 auto; }
}

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

/* ---------- Print: just the report ---------- */

@media print {
  body { background: #fff; }
  .plate, .status, .actions, .btn, .masthead p { display: none !important; }
  .page { padding: 0; max-width: none; }
  .recall { break-inside: avoid; }
}
