/* ============================================================
   PartsPilot - design tokens (minimal / neutral + purple)
   ============================================================ */
:root {
  --bg: #fafafb;
  --surface: #ffffff;
  --surface-2: #f5f4f8;
  --border: #e8e6f0;
  --border-strong: #d7d3e6;

  --text: #14121f;
  --text-2: #45435a;
  --muted: #6b6880;

  --primary: #7c3aed;
  --primary-600: #6d28d9;
  --primary-700: #5b21b6;
  --primary-tint: #f3eefe;
  --primary-tint-2: #e9e0fb;

  --success: #059669;
  --success-700: #047857;
  --success-tint: #ecfdf5;
  --danger: #dc2626;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(20, 18, 31, 0.05);
  --shadow: 0 6px 24px rgba(20, 18, 31, 0.07);
  --shadow-lg: 0 24px 60px rgba(124, 58, 237, 0.16);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 1160px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }

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

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 1000;
  background: var(--primary); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 6px;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--primary-600); background: var(--primary-tint);
  padding: 5px 11px; border-radius: 999px;
}
.grad {
  background: linear-gradient(100deg, var(--primary) 0%, #a855f7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.muted { color: var(--muted); }

/* ============================== Buttons ============================== */
.btn {
  --h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--h); padding: 0 20px;
  border: 1px solid transparent; border-radius: 12px;
  font: inherit; font-weight: 600; font-size: 0.98rem;
  cursor: pointer; text-align: center;
  transition: transform 0.15s var(--ease), background 0.18s, box-shadow 0.18s, border-color 0.18s, opacity 0.18s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: translateY(1px); }
.btn-sm { --h: 40px; padding: 0 16px; font-size: 0.9rem; border-radius: 10px; }
.btn-lg { --h: 56px; padding: 0 28px; font-size: 1.05rem; border-radius: 14px; }
.btn-block { width: 100%; }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 18px rgba(124, 58, 237, 0.28); }
.btn-primary:hover { background: var(--primary-600); box-shadow: 0 10px 26px rgba(124, 58, 237, 0.34); }
.btn-primary:disabled { background: var(--border-strong); color: #fff; box-shadow: none; cursor: not-allowed; opacity: 0.7; }

.btn-ghost { background: var(--surface); color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.linkish {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--primary-600); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}

/* ============================== Nav ============================== */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner { display: flex; align-items: center; gap: 20px; height: 68px; }
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.22rem; letter-spacing: -0.03em; }
.logo .accent { color: var(--primary); }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  color: #fff; background: linear-gradient(140deg, var(--primary), #9333ea);
  border-radius: 10px; box-shadow: var(--shadow-sm);
}
.logo-mark svg { width: 20px; height: 20px; }
.nav-links { display: flex; gap: 26px; margin-left: 12px; }
.nav-links a { color: var(--text-2); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover { color: var(--text); }
.nav .btn { margin-left: auto; }

/* ============================== Hero ============================== */
.hero { position: relative; overflow: hidden; padding: 64px 0 72px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 50% at 15% 0%, rgba(124, 58, 237, 0.10), transparent 70%),
    radial-gradient(50% 50% at 100% 10%, rgba(168, 85, 247, 0.10), transparent 70%);
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 56px; align-items: center; }
.hero-copy h1 { font-size: clamp(2.2rem, 4.6vw, 3.5rem); font-weight: 800; margin: 16px 0 14px; }
.lede { font-size: 1.12rem; color: var(--text-2); max-width: 46ch; margin: 0 0 24px; }

.trust-row {
  display: flex; align-items: center; gap: 8px;
  margin: 18px 0 0; font-size: 0.86rem; color: var(--muted);
}
.trust-row svg { width: 16px; height: 16px; color: var(--success); }

/* ----- Picker ----- */
.picker {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  padding: 8px; max-width: 520px;
}
.picker-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; }
.picker-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border: none; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.92rem; color: var(--muted);
  border-radius: 11px; transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.picker-tab svg { width: 18px; height: 18px; }
.picker-tab.is-active { background: var(--surface); color: var(--primary-700); box-shadow: var(--shadow-sm); }

.picker-panel { padding: 18px 14px 14px; display: grid; gap: 14px; }
.picker-panel.is-hidden { display: none; }

.field { display: grid; gap: 6px; }
.field label, .plate-label { font-size: 0.82rem; font-weight: 600; color: var(--text-2); }
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; min-height: 48px; padding: 0 40px 0 14px;
  font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: 12px; appearance: none; cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.select-wrap select:hover { border-color: var(--primary); }
.select-wrap select:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.select-wrap select:focus-visible { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint-2); outline: none; }
.caret { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); pointer-events: none; }

/* ----- Plate ----- */
.plate {
  display: flex; align-items: stretch; height: 60px;
  border: 2px solid #11131a; border-radius: 10px; overflow: hidden;
  background: #ffd400; box-shadow: var(--shadow-sm);
}
.plate-gb {
  display: grid; align-content: center; justify-items: center; gap: 2px;
  width: 44px; background: #0a3aa0; color: #fff; font-weight: 700; font-size: 0.7rem;
}
.plate-gb span { letter-spacing: 0.04em; }
.plate-input {
  flex: 1; border: none; background: #ffd400; color: #11131a;
  font-family: "Inter", sans-serif; font-weight: 800; font-size: 1.8rem;
  letter-spacing: 0.06em; text-align: center; text-transform: uppercase;
}
.plate-input::placeholder { color: rgba(17, 19, 26, 0.35); }
.plate-input:focus { outline: none; }
.plate:focus-within { box-shadow: 0 0 0 3px var(--primary-tint-2); }
.plate-help { font-size: 0.82rem; color: var(--muted); margin: -4px 0 0; }
.plate-result { font-size: 0.92rem; }
.plate-result .ok { color: var(--success-700); font-weight: 600; }
.plate-result .bad { color: var(--danger); }
.plate-result .result-card {
  display: flex; align-items: center; gap: 12px; margin-top: 4px;
  padding: 12px; background: var(--success-tint); border: 1px solid #b6ebd2; border-radius: 12px;
}
.plate-result .result-card.result-info {
  background: var(--primary-tint); border-color: var(--primary-tint-2);
}

/* ----- Hero demo (live compare preview) ----- */
.hero-demo { position: relative; }
.demo-glow {
  position: absolute; inset: 8% 4% 4% 8%; z-index: -1; border-radius: 40px;
  background: radial-gradient(closest-side, rgba(124, 58, 237, 0.25), transparent);
  filter: blur(30px);
}
.demo-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 20px; max-width: 420px; margin-left: auto;
}
.demo-head { display: flex; align-items: center; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.demo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-tint); }
.demo-title { font-size: 0.86rem; color: var(--muted); }
.demo-vehicle { margin-left: auto; font-size: 0.78rem; font-weight: 600; color: var(--primary-700); background: var(--primary-tint); padding: 3px 10px; border-radius: 999px; }
.demo-part { display: flex; align-items: center; gap: 12px; padding: 16px 0 6px; }
.demo-part-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); }
.demo-part-icon svg { width: 22px; height: 22px; }
.demo-part-name { font-weight: 700; }
.demo-part-cat { font-size: 0.82rem; color: var(--muted); }
.demo-rows { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.demo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px;
  opacity: 0; transform: translateY(6px); transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), border-color 0.3s, background 0.3s;
}
.demo-row.show { opacity: 1; transform: none; }
.demo-row.best { border-color: #b6ebd2; background: var(--success-tint); }
.demo-retailer { font-weight: 600; font-size: 0.92rem; }
.demo-price { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.demo-row.best .demo-price { color: var(--success-700); }
.demo-badge { font-size: 0.68rem; font-weight: 700; color: var(--success-700); background: #fff; border: 1px solid #b6ebd2; padding: 2px 7px; border-radius: 999px; }
.demo-foot { min-height: 22px; margin-top: 12px; font-size: 0.88rem; color: var(--text-2); }
.demo-foot strong { color: var(--success-700); }

/* ============================== Bands / sections ============================== */
.band { padding: 28px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
.step { display: grid; gap: 6px; }
.step-n {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--primary-tint); color: var(--primary-700); font-weight: 800;
}
.step h3 { font-size: 1.05rem; }
.step p { margin: 0; color: var(--text-2); font-size: 0.95rem; }

.section { padding: 72px 0; }
.section-muted { background: var(--surface-2); }
.section-head { margin-bottom: 36px; max-width: 620px; }
.section-head.center { margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); font-weight: 800; margin-top: 12px; }

/* ----- Bento features ----- */
.bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.feat { padding: 24px; transition: transform 0.18s var(--ease), box-shadow 0.18s; }
.feat:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.feat-lg { grid-column: span 1; grid-row: span 2; background: linear-gradient(160deg, #fff, var(--primary-tint)); }
.feat-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--primary-tint); color: var(--primary-700); margin-bottom: 14px; }
.feat-icon svg { width: 24px; height: 24px; }
.feat h3 { font-size: 1.1rem; margin-bottom: 6px; }
.feat p { margin: 0; color: var(--text-2); font-size: 0.95rem; }

/* ----- Retailer logos ----- */
.logos { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.logo-chip {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 14px 22px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-sm);
}
.logo-chip.soon { color: var(--muted); font-weight: 500; }
.logo-badge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #fff; font-weight: 800; font-size: 0.82rem; }
.logo-badge.ecp { background: #e2001a; }
.logo-badge.gsf { background: #003d7d; }
.logo-badge.mmw { background: #ee6c00; }
.logo-badge.bcp { background: #00a651; }
.logo-badge.more { background: var(--surface-2); color: var(--muted); font-size: 1.3rem; }

/* ----- Final CTA ----- */
.cta { padding: 84px 0; }
.cta-inner {
  text-align: center; background: linear-gradient(150deg, #1c1530, #3b1d6e 60%, #5b21b6);
  color: #fff; border-radius: var(--radius-lg); padding: 56px 24px;
  box-shadow: var(--shadow-lg);
}
.cta-inner h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); font-weight: 800; }
.cta-inner p { margin: 12px 0 26px; color: rgba(255, 255, 255, 0.78); font-size: 1.05rem; }
.cta-inner .btn-primary { background: #fff; color: var(--primary-700); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); }
.cta-inner .btn-primary:hover { background: #f4eefe; }

/* ============================== Footer ============================== */
.footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; padding: 22px 24px; font-size: 0.85rem; color: var(--text-2); }

/* ============================================================
   Comparison page
   ============================================================ */
body.app { background: var(--bg); }

.vehicle-bar { background: var(--surface); border-bottom: 1px solid var(--border); }
.vehicle-bar .wrap { display: flex; align-items: center; gap: 18px; padding: 18px 24px; }
.vehicle-thumb { width: 132px; height: 78px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.vehicle-meta h1 { font-size: 1.3rem; }
.vehicle-meta h1 small { font-weight: 500; color: var(--muted); font-size: 0.9rem; }
.vehicle-meta p { margin: 3px 0 0; color: var(--muted); font-size: 0.9rem; }
.vehicle-badge { margin-left: auto; background: var(--primary-tint); color: var(--primary-700); padding: 6px 13px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; }

.layout { display: grid; grid-template-columns: 312px 1fr; gap: 26px; padding: 28px 24px 64px; }

.sidebar { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 20px; align-self: start; position: sticky; top: 90px; }
.sidebar h2 { font-size: 1.08rem; margin-bottom: 14px; }
.build-list { list-style: none; margin: 0; padding: 0; }
.build-list li { display: flex; justify-content: space-between; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.build-list li .bl-cat { color: var(--muted); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; }
.build-list li .bl-price { color: var(--success-700); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.build-list .empty { color: var(--muted); font-style: italic; border: none; }
.build-total { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 2px solid var(--border); }
.build-total strong { font-size: 1.4rem; color: var(--success-700); font-variant-numeric: tabular-nums; }
.disclaimer { margin-top: 18px; font-size: 0.74rem; color: var(--muted); line-height: 1.5; }

/* ---- department grid (category picker) ---- */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }
.dept-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px 18px; cursor: pointer; text-align: left;
  transition: transform 0.18s var(--ease), box-shadow 0.18s, border-color 0.18s;
}
.dept-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary-tint-2); }
.dept-card:focus-visible { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint-2); }
.dept-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px;
  background: var(--primary-tint); color: var(--primary-700); margin-bottom: 10px;
}
.dept-icon svg { width: 26px; height: 26px; }
.dept-name { font-weight: 600; font-size: 0.98rem; line-height: 1.25; }
.dept-meta { color: var(--muted); font-size: 0.78rem; }
.dept-from { color: var(--success-700); font-weight: 700; font-size: 0.82rem; font-variant-numeric: tabular-nums; margin-top: 2px; }

/* ---- back button ---- */
.cat-back {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  background: none; border: none; cursor: pointer; color: var(--primary-700);
  font-weight: 600; font-size: 0.9rem; padding: 4px 0; margin-bottom: 4px;
}
.cat-back:hover { color: var(--primary); }
.cat-back svg { width: 18px; height: 18px; }

/* ---- detail (single category) ---- */
.categories { display: flex; flex-direction: column; gap: 16px; }
.category { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.category-head { display: flex; align-items: center; gap: 11px; padding: 15px 20px; border-bottom: 1px solid var(--border); }
.category-head h3 { font-size: 1.05rem; }
.category-head .count { color: var(--muted); font-size: 0.82rem; margin-left: auto; }
.category-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--primary-tint); color: var(--primary-700); }
.category-icon svg { width: 20px; height: 20px; }
.parts-wrap { overflow-x: auto; }

.parts { width: 100%; border-collapse: collapse; min-width: 560px; }
.parts th, .parts td { padding: 13px 16px; text-align: left; border-top: 1px solid var(--border); }
.parts th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.parts tbody tr:hover { background: var(--surface-2); }

.part-cell { display: flex; align-items: center; gap: 12px; }
.part-thumb { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--primary-tint); color: var(--primary-700); border: 1px solid var(--primary-tint-2); }
.part-thumb svg { width: 24px; height: 24px; }
.part-name { font-weight: 600; }
.part-meta { font-size: 0.78rem; color: var(--muted); }

.price-cell { text-align: right; white-space: nowrap; }
.price { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--text); }
.price.best { color: var(--success-700); }
.best-tag { display: inline-flex; align-items: center; gap: 3px; font-size: 0.64rem; font-weight: 700; color: var(--success-700); background: var(--success-tint); border: 1px solid #b6ebd2; padding: 2px 6px; border-radius: 999px; margin-left: 4px; }
.oos { color: var(--muted); text-decoration: line-through; }
.oos-tag { display: block; font-size: 0.66rem; color: var(--danger); text-transform: uppercase; letter-spacing: 0.04em; }
.spread { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.footer .footer-inner { justify-content: flex-start; }
.loading { color: var(--muted); padding: 28px; }

/* ============================== Responsive ============================== */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-demo { order: -1; }
  .demo-card { margin: 0 auto; }
  .nav-links { display: none; }
  .bento, .steps { grid-template-columns: 1fr; }
  .feat-lg { grid-row: span 1; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; order: 2; }
}

@media (max-width: 520px) {
  .hero { padding: 40px 0 48px; }
  .picker { max-width: 100%; }
  .plate-input { font-size: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .demo-row { opacity: 1; transform: none; }
}
