/* Heritage RC Racing — storefront
   Palette taken from the logo livery: black ink, white, blue / red / yellow stripes. */
:root {
  --ink: #000;
  --paper: #fff;
  --pit: #f1f2f4;
  --line: #d6d9df;
  --steel: #5a616e;
  --blue: #1b5fd9;
  --red: #e3202a;
  --yellow: #f5bd00;
  --display: "Saira", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --wrap: 1240px;
  --slant: -12deg;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--body);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; outline: none; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: .6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1rem, 3vw, 2rem); }

/* ---------- Type ---------- */
h1, h2, h3 { font-family: var(--display); font-style: italic; font-weight: 850; font-stretch: 88%; line-height: 1.02; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.9rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); }
h3 { font-size: 1.25rem; }
.lead { font-size: 1.125rem; max-width: 34em; color: #222; }
.muted { color: var(--steel); }
.price { font-family: var(--display); font-style: italic; font-weight: 800; font-stretch: 95%; font-size: 1.2rem; }
.price s { color: var(--steel); font-weight: 500; font-size: .85em; margin-left: .4em; }

/* ---------- Buttons: slanted like the logo lettering ---------- */
.btn {
  --bg: var(--ink); --fg: #fff;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: 0 1.6rem; border: 0; cursor: pointer; text-decoration: none;
  background: var(--bg); color: var(--fg);
  font-family: var(--display); font-style: italic; font-weight: 800; font-size: 1.05rem; font-stretch: 95%;
  transform: skewX(var(--slant));
}
.btn > * , .btn { }
.btn span { display: inline-block; transform: skewX(calc(var(--slant) * -1)); }
.btn:hover { --bg: var(--blue); }
.btn[disabled] { --bg: var(--line); --fg: var(--steel); cursor: not-allowed; }
.btn.ghost { --bg: transparent; --fg: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { --bg: var(--ink); --fg: #fff; }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; color: var(--steel); }

/* ---------- Header ---------- */
.announce { background: var(--ink); color: #fff; font-size: .875rem; text-align: center; padding: .45rem 1rem; }
.site-head { border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.head-row { display: flex; align-items: center; gap: 1.25rem; min-height: 72px; }
.brand img { width: 172px; height: auto; }
.search { flex: 1; display: flex; max-width: 520px; border: 2px solid var(--ink); }
.search input { flex: 1; min-width: 0; border: 0; padding: .55rem .8rem; background: transparent; }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--blue); outline-offset: 1px; }
.search button { border: 0; background: var(--ink); color: #fff; width: 46px; cursor: pointer; display: grid; place-items: center; }
.head-nav { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; font-weight: 600; white-space: nowrap; }
.head-nav a { text-decoration: none; }
.head-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }
.lang { background: none; border: 0; padding: .25rem 0; cursor: pointer; font-weight: 600; color: var(--steel); }
.lang:hover { color: var(--ink); }
.cart-link { display: inline-flex; align-items: center; gap: .45rem; }
.cart-count {
  min-width: 1.7rem; height: 1.7rem; padding: 0 .4rem; display: inline-grid; place-items: center;
  background: var(--yellow); color: var(--ink); font-family: var(--display); font-style: italic; font-weight: 800;
  transform: skewX(var(--slant));
}
.cart-count.bump { animation: bump .35s ease-out; }
@keyframes bump { 40% { transform: skewX(var(--slant)) scale(1.3); background: var(--red); color: #fff; } }

@media (max-width: 860px) {
  .head-row { flex-wrap: wrap; gap: .6rem 1rem; padding-top: .6rem; padding-bottom: .6rem; }
  .brand img { width: 140px; }
  .head-nav { gap: .9rem; }
  .head-nav a[href="#/kits"] { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
}

/* ---------- Livery stripes (the signature) ---------- */
.livery { display: grid; gap: 5px; }
.livery i { display: block; height: 9px; transform: skewX(-38deg); }
.livery i:nth-child(1) { background: var(--blue); }
.livery i:nth-child(2) { background: var(--red); }
.livery i:nth-child(3) { background: var(--yellow); }

/* ---------- Hero ---------- */
.hero { padding: clamp(1.5rem, 4vw, 3rem) 0 clamp(2rem, 5vw, 4rem); overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); align-items: center; }
.hero-art img { width: 100%; max-width: 640px; }
.hero h1 { max-width: 12ch; }
.finder { position: relative; background: var(--ink); color: #fff; padding: 1.8rem 1.8rem 1.6rem; margin-top: 1.6rem; }
.finder .livery { position: absolute; left: 1.8rem; right: 40%; top: -16px; }
.finder h2 { font-size: 1.5rem; margin-bottom: 1rem; }
.finder label { display: block; font-size: .85rem; font-weight: 600; color: #c9ccd3; margin-bottom: .3rem; }
.finder-row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1.1rem; }
.finder select { width: 100%; min-height: 48px; padding: 0 .8rem; background: #fff; color: var(--ink); border: 0; font-weight: 600; }
.finder select:disabled { background: #3a3d44; color: #8d929c; }
.finder .btn { --bg: var(--yellow); --fg: var(--ink); }
.finder .btn:hover { --bg: #fff; }
.finder .btn[disabled] { --bg: #3a3d44; --fg: #8d929c; }
.finder-foot { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.finder-foot a { color: #fff; font-size: .95rem; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { order: -1; }
  .hero-art img { max-width: 460px; margin: 0 auto; }
}
@media (max-width: 480px) { .finder-row { grid-template-columns: 1fr; } }

/* ---------- Sections ---------- */
.section { padding: clamp(2rem, 5vw, 3.5rem) 0; }
.section.pit { background: var(--pit); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: .4rem 0 0; }

/* ---------- Kit timeline ---------- */
.timeline { overflow-x: auto; padding-bottom: .8rem; scrollbar-width: thin; }
.decades { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 0; min-width: 1080px; }
.decade { border-left: 2px solid var(--ink); padding: 0 1rem 0 1rem; }
.decade-year {
  font-family: var(--display); font-style: italic; font-weight: 900; font-stretch: 80%;
  font-size: clamp(2.6rem, 5vw, 3.6rem); line-height: .9; margin: 0 0 1rem; color: var(--ink);
}
.decade:nth-child(1) .decade-year { -webkit-text-stroke: 0; }
.kit-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.kit {
  display: grid; grid-template-columns: 3.2rem 1fr auto; align-items: center; gap: .6rem;
  padding: .55rem .7rem; text-decoration: none; background: var(--paper); border-left: 4px solid transparent;
}
.kit:hover, .kit:focus-visible { border-left-color: var(--red); background: #fff; }
.kit-y { font-family: var(--display); font-style: italic; font-weight: 700; color: var(--steel); font-size: .95rem; }
.kit-name { font-weight: 700; line-height: 1.2; }
.kit-name small { display: block; font-weight: 500; color: var(--steel); font-size: .8rem; }
.section:not(.pit) .kit { background: var(--pit); }

/* ---------- Condition tags ---------- */
.cond {
  display: inline-block; padding: .12rem .6rem; font-size: .78rem; font-weight: 700; line-height: 1.5;
  transform: skewX(var(--slant)); background: var(--ink); color: #fff; white-space: nowrap;
}
.cond > span { display: inline-block; transform: skewX(calc(var(--slant) * -1)); }
.cond-nos { background: var(--blue); }
.cond-used { background: var(--ink); }
.cond-repro { background: var(--yellow); color: var(--ink); }
.cond-printed { background: var(--red); }
.cond-donor { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }

.guide { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1.8rem 2rem; }
.guide dt { margin-bottom: .5rem; }
.guide dd { margin: 0; color: #222; max-width: 30em; }

/* ---------- Product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 2rem 1.4rem; }
.card { position: relative; display: flex; flex-direction: column; text-decoration: none; }
.card-img { aspect-ratio: 1 / 1; background: var(--pit); overflow: hidden; display: grid; place-items: center; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card .cond { position: absolute; top: .6rem; left: .7rem; }
.card-body { padding-top: .7rem; display: grid; gap: .25rem; }
.card-name { font-weight: 600; line-height: 1.3; }
.card:hover .card-name { text-decoration: underline; text-underline-offset: 3px; }
.card-fits { font-size: .85rem; color: var(--steel); line-height: 1.35; }
.card-foot { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-top: .15rem; }
.card-stock { font-size: .8rem; color: var(--steel); }
.card.sold .card-img { opacity: .55; }
.card.sold .card-stock { color: var(--red); font-weight: 700; }

.ph { width: 100%; height: 100%; display: grid; place-items: center; color: #9aa0ab; }
.ph svg { width: 46%; height: auto; }

/* ---------- Shop layout ---------- */
.shop { display: grid; grid-template-columns: 250px 1fr; gap: 2.5rem; padding: 2rem 0 4rem; }
.filters { align-self: start; position: sticky; top: 96px; display: grid; gap: 1.3rem; }
.filters h2 { font-size: 1.3rem; margin: 0; }
.field label, .field .label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.field select, .field input[type=text], .field input[type=email], .field input[type=tel], .field textarea {
  width: 100%; min-height: 44px; padding: .5rem .7rem; border: 2px solid var(--ink); background: #fff; border-radius: 0;
}
.field textarea { min-height: 90px; resize: vertical; }
.field.invalid input, .field.invalid select { border-color: var(--red); background: #fff5f5; }
.check { display: flex; align-items: center; gap: .55rem; font-weight: 600; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; accent-color: var(--ink); }
.filters-toggle { display: none; }
.shop-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.shop-top h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0; }
.shop-top .field { display: flex; align-items: center; gap: .6rem; }
.shop-top .field label { margin: 0; white-space: nowrap; }
.shop-top select { min-width: 190px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1.2rem; margin-top: 2.5rem; }
.empty { background: var(--pit); padding: 2rem; max-width: 40em; }
@media (max-width: 860px) {
  .shop { grid-template-columns: 1fr; gap: 1rem; padding-top: 1.2rem; }
  .filters { position: static; display: none; background: var(--pit); padding: 1.2rem; }
  .filters.open { display: grid; }
  .filters-toggle { display: inline-flex; }
}

/* ---------- Product page ---------- */
.crumbs { font-size: .9rem; color: var(--steel); padding: 1.2rem 0 0; }
.crumbs a { color: var(--steel); }
.product { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(1.5rem, 4vw, 3.5rem); padding: 1.2rem 0 3rem; }
.gallery-main { aspect-ratio: 1 / 1; background: var(--pit); display: grid; place-items: center; overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: .5rem; margin-top: .6rem; flex-wrap: wrap; }
.thumbs button { width: 76px; height: 76px; padding: 0; border: 2px solid transparent; background: var(--pit); cursor: pointer; }
.thumbs button[aria-current="true"] { border-color: var(--ink); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.p-info h1 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); margin: .8rem 0 .6rem; }
.p-refs { display: flex; flex-wrap: wrap; gap: .3rem 1.4rem; font-size: .9rem; color: var(--steel); margin: 0 0 1.2rem; }
.p-refs b { color: var(--ink); font-weight: 600; }
.p-price { font-size: 2rem; }
.p-stock { font-weight: 600; margin: .2rem 0 1.2rem; }
.p-stock.last { color: var(--red); }
.p-buy { display: flex; gap: .8rem; align-items: end; flex-wrap: wrap; margin-bottom: 1.8rem; }
.qty { display: inline-flex; border: 2px solid var(--ink); height: 48px; }
.qty button { width: 42px; border: 0; background: #fff; cursor: pointer; font-size: 1.2rem; font-weight: 700; }
.qty button:hover { background: var(--pit); }
.qty input { width: 3rem; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.fits { border-top: 2px solid var(--ink); padding-top: 1rem; margin-bottom: 1.5rem; }
.fits h2, .p-desc h2 { font-size: 1.2rem; margin-bottom: .6rem; }
.fits ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .45rem; }
.fits a { display: inline-block; padding: .3rem .7rem; background: var(--pit); text-decoration: none; font-weight: 600; font-size: .92rem; }
.fits a:hover { background: var(--ink); color: #fff; }
.fits a small { font-weight: 500; color: var(--steel); }
.fits a:hover small { color: #c9ccd3; }
.p-desc { border-top: 2px solid var(--ink); padding-top: 1rem; }
.p-desc .text { white-space: pre-line; max-width: 38em; }
@media (max-width: 860px) { .product { grid-template-columns: 1fr; } }

/* ---------- Cart & checkout ---------- */
.page { padding: 2rem 0 4rem; }
.cart-grid { display: grid; grid-template-columns: 1fr 360px; gap: 2.5rem; align-items: start; }
.lines { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.line { display: grid; grid-template-columns: 84px 1fr auto; gap: 1rem; padding: 1rem 0; border-bottom: 1px solid var(--line); align-items: center; }
.line-img { width: 84px; height: 84px; background: var(--pit); overflow: hidden; }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-name { font-weight: 600; text-decoration: none; }
.line-name:hover { text-decoration: underline; }
.line-meta { font-size: .85rem; color: var(--steel); }
.line-ctrl { display: flex; align-items: center; gap: .8rem; margin-top: .4rem; }
.line-ctrl .qty { height: 38px; }
.line-ctrl .qty button { width: 34px; }
.summary { background: var(--pit); padding: 1.5rem; position: sticky; top: 96px; }
.summary h2 { font-size: 1.4rem; }
.sum-row { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; }
.sum-row.total { border-top: 2px solid var(--ink); margin-top: .5rem; padding-top: .8rem; font-weight: 700; }
.sum-row.total .price { font-size: 1.5rem; }
.sum-note { font-size: .85rem; color: var(--steel); margin: .6rem 0 1rem; }
.summary .field { margin: .5rem 0 .2rem; }
.mini-lines { list-style: none; padding: 0; margin: 0 0 .8rem; font-size: .92rem; }
.mini-lines li { display: flex; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.notice { padding: .9rem 1rem; border-left: 5px solid var(--yellow); background: #fff8dc; margin-bottom: 1.2rem; }
.notice.err { border-color: var(--red); background: #fff1f1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 0; padding: 0; margin: 0 0 2rem; }
legend { font-family: var(--display); font-style: italic; font-weight: 850; font-size: 1.4rem; margin-bottom: .8rem; padding: 0; }
.pay-opt { display: flex; gap: .7rem; align-items: center; padding: .9rem 1rem; border: 2px solid var(--line); margin-bottom: .6rem; cursor: pointer; font-weight: 600; }
.pay-opt:has(input:checked) { border-color: var(--ink); }
.pay-opt input { accent-color: var(--ink); width: 1.1rem; height: 1.1rem; }
@media (max-width: 860px) {
  .cart-grid { grid-template-columns: 1fr; }
  .summary { position: static; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Order confirmation ---------- */
.confirm { max-width: 720px; }
.confirm .livery { width: 180px; margin-bottom: 1.4rem; }
.bank { background: var(--ink); color: #fff; padding: 1.5rem; margin: 1.5rem 0; }
.bank h2 { font-size: 1.4rem; }
.bank dl { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.2rem; margin: 1rem 0 0; }
.bank dt { color: #c9ccd3; }
.bank dd { margin: 0; font-weight: 700; word-break: break-word; }

/* ---------- Info pages ---------- */
.info { max-width: 760px; }
.zones { list-style: none; padding: 0; margin: 1.5rem 0; border-top: 2px solid var(--ink); }
.zones li { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.zones b { font-weight: 700; }

/* ---------- Footer ---------- */
.site-foot { border-top: 2px solid var(--ink); padding: 1.8rem 0 2.2rem; margin-top: 2rem; }
.foot-row { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.foot-row p { margin: 0; color: var(--steel); flex: 1; min-width: 220px; }
.foot-row nav { display: flex; gap: 1.2rem; font-weight: 600; }

/* ---------- Misc ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 150%);
  background: var(--ink); color: #fff; padding: .8rem 1.3rem; font-weight: 600; z-index: 50;
  transition: transform .25s ease-out, visibility 0s .25s; border-left: 6px solid var(--yellow); visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform .25s ease-out; }
.loading { height: 50vh; }
.err-page { padding: 4rem 0; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 720px) {
  .decades { grid-template-columns: 1fr; min-width: 0; gap: 2rem; }
  .decade.reissues { padding-left: calc(1rem + 6px); }
  .timeline { overflow: visible; }
}

/* Re-releases column: same list, marked by the livery stripe on its rule */
.decade.reissues { border-left: 0; position: relative; padding-left: calc(1rem + 6px); }
.decade.reissues::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  background: linear-gradient(var(--blue) 0 33.3%, var(--red) 33.3% 66.6%, var(--yellow) 66.6%);
}
.decade.reissues .decade-year { font-size: clamp(2rem, 4vw, 2.8rem); padding-top: .25em; }

/* Brand marks: uploaded logo, or the make's name until a logo is added */
.bmark { display: block; width: auto; max-width: 110px; object-fit: contain; }
.bmark.sm { height: 16px; max-width: 64px; }
.bmark.kit-logo { height: 20px; max-width: 70px; }
.bmark.lg { height: 30px; max-width: 140px; }
.bmark-txt {
  display: inline-block; padding: .05rem .45rem; font-size: .72rem; font-weight: 700; line-height: 1.4;
  border: 1.5px solid currentColor; color: var(--steel); white-space: nowrap;
}
.bmark-txt.lg { font-size: .9rem; padding: .15rem .6rem; color: var(--ink); }
.bmark-txt.kit-logo { font-size: .68rem; }
.card-fits { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; }
.card-brands { display: inline-flex; gap: .3rem; align-items: center; }
.fits-brand { display: grid; grid-template-columns: 140px 1fr; gap: .8rem; align-items: center; padding: .5rem 0; }
.fits-brand + .fits-brand { border-top: 1px solid var(--line); }
@media (max-width: 480px) { .fits-brand { grid-template-columns: 1fr; gap: .4rem; } }
