:root {
    --asphalt: #1c1b1a;
    --cream: #ede8df;
    --scorpion: #c8102e;
    --graphite: #46423e;
    --steel: #8b8880;
    --rally-white: #f7f5f0;

    --bg: var(--cream);
    --surface: var(--rally-white);
    --ink: var(--asphalt);
    --ink-muted: var(--graphite);
    --caption: var(--steel);
    --line: rgba(28, 27, 26, 0.14);
    --accent: var(--scorpion);
    --accent-ink: #ffffff;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --bg: var(--asphalt);
      --surface: #26241f;
      --ink: var(--cream);
      --ink-muted: #c9c3b7;
      --caption: #8f897c;
      --line: rgba(237, 232, 223, 0.14);
      --accent: #e8384f;
      --accent-ink: #1c1b1a;
    }
  }
  :root[data-theme="dark"] {
    --bg: var(--asphalt);
    --surface: #26241f;
    --ink: var(--cream);
    --ink-muted: #c9c3b7;
    --caption: #8f897c;
    --line: rgba(237, 232, 223, 0.14);
    --accent: #e8384f;
    --accent-ink: #1c1b1a;
  }
  :root[data-theme="light"] {
    --bg: var(--cream);
    --surface: var(--rally-white);
    --ink: var(--asphalt);
    --ink-muted: var(--graphite);
    --caption: var(--steel);
    --line: rgba(28, 27, 26, 0.14);
    --accent: var(--scorpion);
    --accent-ink: #ffffff;
  }

  * { box-sizing: border-box; }
  html { color-scheme: light dark; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }

  .mono {
    font-family: "IBM Plex Mono", "SF Mono", "Roboto Mono", ui-monospace, "Courier New", monospace;
  }

  .display {
    font-family: "Helvetica Neue", Arial, "Liberation Sans", sans-serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    text-wrap: balance;
  }

  a { color: inherit; }
  a:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
  }

  .wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 28px;
  }

  /* ---------- Header ---------- */
  header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 18px 0;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
  }
  .brand-name {
    font-size: 15px;
    letter-spacing: 0.02em;
  }
  .brand-logo { height: 52px; width: auto; display: block; }
  .brand { background: #0d0c0c; padding: 8px 14px; border-radius: 10px; }
  @media (max-width: 620px) { .brand-logo { height: 38px; } .brand { padding: 6px 10px; } }
  .navlinks {
    display: flex;
    gap: 28px;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 14px;
  }
  .navlinks a {
    text-decoration: none;
    color: var(--ink-muted);
    border-bottom: 2px solid transparent;
    padding-bottom: 3px;
  }
  .navlinks a:hover { color: var(--ink); border-color: var(--accent); }
  .nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 10px 16px;
    white-space: nowrap;
  }

  /* ---------- Scorpion mark ---------- */
  .mark { width: 34px; height: 34px; flex: none; }

  /* ---------- Hero ---------- */
  .hero {
    position: relative;
    padding: 88px 0 72px;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
  }
  .hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      linear-gradient(var(--line) 1px, transparent 1px),
      linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, black, transparent);
            mask-image: radial-gradient(ellipse 70% 60% at 70% 20%, black, transparent);
    opacity: 0.6;
    pointer-events: none;
  }
  .hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 48px;
    align-items: end;
  }
  .eyebrow {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin: 0 0 18px;
  }
  h1.display {
    font-size: clamp(40px, 6vw, 76px);
    line-height: 0.96;
    margin: 0 0 20px;
  }
  .hero-sub {
    max-width: 46ch;
    color: var(--ink-muted);
    font-size: 17px;
    margin: 0 0 32px;
  }
  .hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
  .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-decoration: none;
    border: 1px solid var(--ink);
  }
  .btn-solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
  .btn-outline { background: transparent; color: var(--ink); }

  .hero-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 22px;
  }
  .hero-panel-label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--caption);
    margin: 0 0 14px;
  }
  .chapter-list { list-style: none; margin: 0; padding: 0; }
  .chapter-list li {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 11px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
  }
  .chapter-list li:first-child { border-top: none; }
  .chapter-list .code { color: var(--caption); }

  /* ---------- Section scaffolding ---------- */
  section { padding: 72px 0; border-bottom: 1px solid var(--line); }
  .section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 36px;
    flex-wrap: wrap;
  }
  .section-tag {
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    margin: 0 0 8px;
  }
  h2.display { font-size: clamp(26px, 3.4vw, 38px); margin: 0; }
  .section-note { max-width: 42ch; color: var(--caption); font-size: 14px; margin: 0; }

  /* ---------- Catalog grid ---------- */
  .catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
  }
  .part {
    background: var(--surface);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .part-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 12px;
  }
  .part-no { color: var(--caption); }
  .part-price { font-weight: 700; }
  .part-name { font-size: 18px; font-weight: 700; margin: 0; }
  .part-desc { font-size: 14px; color: var(--ink-muted); margin: 0; flex: 1; }
  .fitment {
    font-size: 12px;
    color: var(--caption);
    border-top: 1px dashed var(--line);
    padding-top: 12px;
  }
  .part-cta {
    align-self: flex-start;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: var(--accent);
    border-bottom: 1px solid var(--accent);
    padding-bottom: 2px;
  }

  /* ---------- Build spotlight ---------- */
  .spotlight {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 40px;
    align-items: center;
  }
  .spotlight-visual {
    aspect-ratio: 4/3;
    background:
      repeating-linear-gradient(135deg, var(--line) 0 2px, transparent 2px 22px),
      var(--surface);
    border: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--caption);
    font-size: 13px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-align: center;
    padding: 24px;
  }
  .spotlight-body h3 { font-size: 24px; margin: 0 0 14px; }
  .spotlight-body p { color: var(--ink-muted); margin: 0 0 14px; }
  .spec-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-top: 1px solid var(--line);
    font-size: 13px;
  }
  .spec-row:last-of-type { border-bottom: 1px solid var(--line); }
  .spec-row span:first-child { color: var(--caption); }

  /* ---------- About ---------- */
  .about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
  }
  .about-grid p { color: var(--ink-muted); margin: 0 0 16px; }
  .stat-row { display: flex; gap: 36px; margin-top: 28px; }
  .stat b { display: block; font-size: 30px; font-family: "IBM Plex Mono", ui-monospace, monospace; }
  .stat span { font-size: 12px; color: var(--caption); text-transform: uppercase; letter-spacing: 0.06em; }

  /* ---------- Contact ---------- */
  .contact-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 40px;
  }
  .contact-card {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 28px;
  }
  .contact-card h3 { margin: 0 0 6px; font-size: 20px; }
  .contact-card p { color: var(--caption); font-size: 13px; margin: 0 0 20px; }
  .contact-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
  }
  .contact-row:last-child { border-bottom: 1px solid var(--line); }
  .contact-row span:first-child { color: var(--caption); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
  .contact-row a { text-decoration: none; font-weight: 600; }
  .placeholder { color: var(--caption); font-style: italic; font-weight: 400 !important; }

  /* ---------- Footer ---------- */
  footer { padding: 40px 0 60px; }
  .footer-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  .footer-links { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; font-size: 13px; }
  .footer-links a { text-decoration: none; color: var(--ink-muted); }
  .disclaimer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--caption);
    max-width: 70ch;
  }

  @media (max-width: 860px) {
    .navlinks { display: none; }
    .hero-grid, .spotlight, .about-grid, .contact-grid { grid-template-columns: 1fr; }
    .spotlight-visual { order: -1; }
  }

  @media (prefers-reduced-motion: no-preference) {
    .part, .btn { transition: transform 0.15s ease, background 0.15s ease; }
    .part:hover { transform: translateY(-2px); }
  }

/* ================= Store ================= */
[hidden] { display: none !important; }
.cart-btn { position: relative; border: none; cursor: pointer; font: inherit; font-size: 13px; }
.cart-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--accent-ink); color: var(--accent); font-size: 12px; text-align: center; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 22px; }
.chip { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 8px 12px;
  background: transparent; color: var(--ink-muted); border: 1px solid var(--line); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters select, .filters input, .field input, .field select, .field textarea {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 9px 11px; border-radius: 0; }
.filters input[type="search"] { flex: 1 1 200px; min-width: 0; }
.result-count { font-size: 12px; color: var(--caption); margin: 0 0 14px; }

.part-brand { font-size: 12px; color: var(--caption); text-transform: uppercase; letter-spacing: 0.06em; margin: 0; }
.part-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 11px; padding: 2px 7px; border: 1px solid var(--line); color: var(--ink-muted); }
.tag-warn { border-color: var(--accent); color: var(--accent); }
.part-buy { display: flex; gap: 8px; align-items: stretch; flex-wrap: wrap; }
.part-buy select { flex: 1 1 140px; min-width: 0; font: inherit; font-size: 13px; padding: 8px; background: var(--bg); color: var(--ink); border: 1px solid var(--line); }
.add-btn { font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 9px 14px;
  background: var(--accent); color: var(--accent-ink); border: none; cursor: pointer; }
.add-btn.added { background: var(--ink); color: var(--bg); }
.empty { padding: 40px; text-align: center; color: var(--caption); background: var(--surface); }

/* how it works */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.step { background: var(--surface); padding: 22px; }
.step b { display: block; color: var(--accent); font-size: 12px; letter-spacing: 0.1em; margin-bottom: 8px; }
.step h3 { margin: 0 0 6px; font-size: 16px; }
.step p { margin: 0; font-size: 14px; color: var(--ink-muted); }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr 1fr; } }

/* cart drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--bg); z-index: 50;
  display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 20px; }
.icon-btn { font: inherit; font-size: 22px; line-height: 1; background: none; border: none; color: var(--ink); cursor: pointer; padding: 4px 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cart-line .meta { color: var(--caption); font-size: 12px; }
.qty { display: inline-flex; align-items: center; gap: 6px; }
.qty button { font: inherit; width: 26px; height: 26px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.totals { padding: 14px 0; font-size: 14px; }
.totals div { display: flex; justify-content: space-between; padding: 4px 0; }
.totals .grand { font-weight: 700; font-size: 16px; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.note { font-size: 12px; color: var(--caption); }

.checkout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-muted); }
.field.full { grid-column: 1 / -1; }
.field textarea { min-height: 70px; resize: vertical; }
.check { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-muted); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-error { grid-column: 1 / -1; color: var(--accent); font-size: 13px; margin: 0; }
.submit-btn { grid-column: 1 / -1; font: inherit; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 14px;
  padding: 14px; background: var(--accent); color: var(--accent-ink); border: none; cursor: pointer; }
.submit-btn[disabled] { opacity: 0.6; cursor: progress; }
.success h3 { font-size: 22px; margin: 0 0 8px; }
.success .ref { font-size: 20px; font-weight: 700; color: var(--accent); }
@media (max-width: 520px) { .checkout { grid-template-columns: 1fr; } }

/* legal page */
.legal { max-width: 760px; padding-top: 48px; padding-bottom: 64px; }
.legal h2 { margin-top: 40px; font-size: 22px; }
.legal p, .legal li { color: var(--ink-muted); }

/* admin */
.adm main { padding: 32px 28px; }
.adm-order { background: var(--surface); border: 1px solid var(--line); padding: 18px; margin: 16px 0; }
.adm-order h2 { margin: 0 0 8px; font-size: 18px; }
.adm-order small { color: var(--caption); font-weight: 400; }
.adm-order table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-order th, .adm-order td { text-align: left; padding: 6px 8px; border-top: 1px solid var(--line); }
section.last { border-bottom: none; }
.copyright { font-size: 13px; color: var(--caption); }
.filters.flush { margin: 0; }
.span-all { grid-column: 1 / -1; margin: 0; }

/* ---- QA fixes ---- */
section[id], [id="catalog"] { scroll-margin-top: 96px; }
body.drawer-open { overflow: hidden; }
.qty button { width: 36px; height: 36px; }
.icon-btn { min-width: 44px; min-height: 44px; }
:root, :root[data-theme="light"] { --caption: #66625a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --caption: #a39d90; --accent-ink: #0d0c0c; } }
:root[data-theme="dark"] { --caption: #a39d90; --accent-ink: #0d0c0c; }
@media (max-width: 860px) {
  .nav { flex-wrap: wrap; row-gap: 10px; }
  .navlinks { display: flex; order: 3; width: 100%; gap: 20px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; font-size: 14px; }
  .navlinks a { white-space: nowrap; }
}
.wrap.nav { padding-left: 28px; padding-right: 28px; }
@media (max-width: 620px) { .wrap.nav { padding-left: 16px; padding-right: 16px; } .wrap:not(.nav) { padding-left: 16px; padding-right: 16px; } }
