/*
 * GrossAuto — public storefront styles.
 *
 * A different problem from the admin: this is read by a customer on a phone,
 * once, looking for one part. Larger type, more whitespace, fewer affordances.
 *
 * Light by default and only light — the storefront is a shop window. The dark
 * palette is kept behind [data-theme="dark"] rather than following the OS, so
 * the brand red and the graphite logo are always shown on the ground they
 * were drawn for.
 */

:root {
  color-scheme: light;
  --c-bg: #f6f8fb;
  --c-surface: #ffffff;
  --c-surface-2: #f1f4f9;
  --c-border: #e4e9f1;
  --c-border-strong: #ccd5e2;
  --c-text: #111826;
  --c-text-muted: #5c6879;
  --c-text-subtle: #8b95a6;

  /* The logo's red, and the graphite it sits on. */
  --c-brand: #d0202b;
  --c-brand-hover: #ad1a23;
  --c-brand-soft: #fdecec;
  --c-ink: #1a2130;

  --c-primary: var(--c-brand);
  --c-primary-hover: var(--c-brand-hover);
  --c-accent: #ea580c;
  --c-success: #1f7a4f;
  --c-warning: #8a5a00;
  --c-danger: #92211f;

  --wrap: 1180px;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgb(16 24 40 / 5%);
  --shadow: 0 2px 6px rgb(16 24 40 / 6%), 0 16px 36px rgb(16 24 40 / 8%);
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #141517;
  --c-surface: #1c1e21;
  --c-surface-2: #232629;
  --c-border: #2e3135;
  --c-border-strong: #3d4045;
  --c-text: #ececea;
  --c-text-muted: #a2a19d;
  --c-text-subtle: #7c7a75;
  --c-brand: #e8515a;
  --c-brand-hover: #f27077;
  --c-brand-soft: #2c1a1c;
  --c-ink: #ececea;
  --c-accent: #d98149;
  --c-success: #6cc199;
  --c-warning: #d9a441;
  --c-danger: #e07373;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 45%);
  --shadow: 0 2px 6px rgb(0 0 0 / 50%), 0 16px 36px rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0 0 0.5rem; line-height: 1.2; letter-spacing: -0.024em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
p { margin: 0 0 1rem; }
a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 1rem; }

/* ---------------------------------------------------------------- head -- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid var(--c-border);
  background: color-mix(in srgb, var(--c-surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.site-head__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
  flex-wrap: wrap;
}

.logo { display: flex; align-items: center; }
.logo:hover { text-decoration: none; }

/* Sized by height so the wordmark keeps its ratio whatever the file is. */
.logo__img { width: auto; height: 50px; object-fit: contain; display: block; }
.logo__img--foot { height: 40px; opacity: 0.92; }

.site-search { display: flex; flex: 1; min-width: 260px; gap: 0.5rem; }
.site-search__input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--c-border-strong);
  min-height: 46px;
  border-radius: 999px;
  background: var(--c-surface-2);
  color: var(--c-text);
  font: inherit;
  transition: border-color 130ms ease, box-shadow 130ms ease, background-color 130ms ease;
}
.site-search__input::placeholder { color: var(--c-text-subtle); }
.site-search__input:focus {
  outline: none;
  background: var(--c-surface);
  border-color: var(--c-ink);
  box-shadow: 0 0 0 3px rgb(26 33 48 / 10%);
}
.site-search__btn {
  padding: 0.6rem 1.35rem;
  border: none;
  border-radius: 999px;
  background: var(--c-brand);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 130ms ease;
}
.site-search__btn:hover { background: var(--c-brand-hover); }

/* Customer portal entry point. Outlined rather than filled: it is a door for
   the minority of visitors who have an account, and it must not outrank the
   red search button next to it. */
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--c-border-strong);
  border-radius: 999px;
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 0.9rem;
  font-weight: 650;
  white-space: nowrap;
  transition: border-color 130ms ease, background-color 130ms ease, color 130ms ease;
}
.account-link:hover {
  text-decoration: none;
  border-color: var(--c-ink);
  background: var(--c-surface-2);
}
.account-link__icon { flex: none; }

.lang { display: flex; gap: 0.15rem; padding: 3px; border-radius: 999px; background: var(--c-surface-2); }
.lang__link {
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--c-text-muted);
}
.lang__link:hover { background: var(--c-surface); color: var(--c-text); text-decoration: none; }
.lang__link--on { background: var(--c-ink); color: #fff; }
.lang__link--on:hover { background: var(--c-ink); color: #fff; }

.site-nav { border-top: 1px solid var(--c-border); background: transparent; }
.site-nav__inner { display: flex; gap: 1.5rem; overflow-x: auto; }
.site-nav__link {
  padding: 0.7rem 0;
  color: var(--c-text-muted);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.site-nav__link:hover { color: var(--c-text); text-decoration: none; border-bottom-color: var(--c-brand); }

.site-main { padding: 2.5rem 1rem 4.5rem; }

/* ---------------------------------------------------------------- foot -- */

.site-foot {
  border-top: 1px solid var(--c-border);
  padding: 2.5rem 0;
  color: var(--c-text-muted);
  font-size: 0.9rem;
  background: var(--c-surface);
}
.site-foot__inner { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.site-foot__brand { display: flex; align-items: center; }
.site-foot__brand:hover { text-decoration: none; }
.site-foot__nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.site-foot__nav a { color: var(--c-text-muted); font-weight: 550; }
.site-foot__nav a:hover { color: var(--c-text); }
.site-foot__copy { margin: 0 0 0 auto; color: var(--c-text-subtle); }

/* ---------------------------------------------------------------- hero -- */

.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(2.25rem, 6vw, 4.5rem) clamp(1.25rem, 4vw, 3.5rem);
  border: 1px solid var(--c-border);
  border-radius: 24px;
  margin-bottom: 3.5rem;
  background:
    radial-gradient(circle at 92% 12%, rgb(208 32 43 / 9%), transparent 42%),
    linear-gradient(150deg, var(--c-surface-2), var(--c-surface) 62%);
  box-shadow: var(--shadow-sm);
}
/* A red rule down the leading edge — the one place the hero borrows the
   logo's colour, so the wordmark above it is not the only brand cue. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--c-brand), color-mix(in srgb, var(--c-brand) 25%, transparent));
}
.hero__eyebrow {
  margin: 0 0 0.5rem;
  color: var(--c-brand);
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hero h1 { font-size: clamp(2rem, 5.5vw, 3.5rem); letter-spacing: -0.04em; max-width: 18ch; }
.hero__lead { font-size: clamp(1rem, 2.2vw, 1.2rem); color: var(--c-text-muted); max-width: 52ch; }
.hero__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 1.75rem; }

/* --------------------------------------------------------------- cards -- */

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }

.pcard {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  overflow: hidden;
  padding: 0;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.pcard:hover {
  border-color: color-mix(in srgb, var(--c-brand) 34%, var(--c-border));
  box-shadow: var(--shadow);
  transform: translateY(-4px);
  text-decoration: none;
}
.pcard__media { display: grid; place-items: center; width: 100%; aspect-ratio: 16 / 10; overflow: hidden; background: var(--c-surface-2); }
.pcard__media img { width: 100%; height: 100%; object-fit: contain; transition: transform 220ms ease; }
.pcard:hover .pcard__media img { transform: scale(1.035); }
.pcard__placeholder, .product__placeholder {
  width: 46%;
  max-width: 150px;
  height: auto;
  opacity: 0.16;
  filter: grayscale(1);
}
.product__placeholder { width: 34%; }
.pcard__sku { margin: 1rem 1rem 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--c-text-muted); }
.pcard__name { margin: 0.35rem 1rem 0.5rem; font-weight: 650; line-height: 1.35; }
.pcard__brand { margin: 0 1rem; font-size: 0.85rem; color: var(--c-text-muted); }
.pcard__foot { margin-top: auto; padding: 0.9rem 1rem 1rem; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.pcard__price { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.tile {
  display: block;
  padding: 1.1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  color: inherit;
  font-weight: 650;
  box-shadow: var(--shadow-sm);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.tile:hover {
  border-color: color-mix(in srgb, var(--c-brand) 34%, var(--c-border));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  text-decoration: none;
}
.tile__meta { display: block; font-weight: 400; font-size: 0.85rem; color: var(--c-text-muted); margin-top: 0.2rem; }

/* ---------------------------------------------------------- availability */

.stock { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.85rem; font-weight: 650; }
.stock::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stock--in { color: var(--c-success); }
.stock--low { color: var(--c-warning); }
.stock--out { color: var(--c-danger); }

/* ------------------------------------------------------------- product -- */

.product { display: grid; gap: 2rem; grid-template-columns: 1fr; }
@media (min-width: 800px) { .product { grid-template-columns: 1fr 320px; } }

.product__media {
  aspect-ratio: 4 / 3;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  display: grid;
  place-items: center;
  color: var(--c-text-muted);
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.product__media img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }

.buybox {
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.35rem;
  background: var(--c-surface);
  position: sticky;
  top: 1rem;
  box-shadow: var(--shadow);
}
.buybox__price { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.025em; font-variant-numeric: tabular-nums; }
.buybox__ask { font-size: 1.1rem; font-weight: 650; color: var(--c-text-muted); }

.cta {
  display: block;
  width: 100%;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  text-align: center;
  font-weight: 650;
  margin-top: 0.6rem;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  transition: background-color 130ms ease, border-color 130ms ease;
}
.cta:hover { text-decoration: none; background: var(--c-surface-2); }
.cta--primary { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.cta--primary:hover { background: var(--c-brand-hover); border-color: var(--c-brand-hover); }
/* The hero's buttons sit side by side rather than stacking full-width. */
.cta--inline { display: inline-block; width: auto; margin-top: 0; padding-inline: 1.6rem; }

.spec { width: 100%; border-collapse: collapse; }
.spec th, .spec td { text-align: left; padding: 0.6rem 0; border-bottom: 1px solid var(--c-border); vertical-align: top; }
.spec th { color: var(--c-text-muted); font-weight: 500; width: 40%; }
.spec td { font-family: var(--font-mono); font-size: 0.9rem; }

/* --------------------------------------------------------------- misc --- */

.crumbs { font-size: 0.85rem; color: var(--c-text-muted); margin-bottom: 1rem; }
.crumbs a { color: var(--c-text-muted); }
.crumbs a:hover { color: var(--c-text); }

.filters {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.filters label { display: block; font-size: 0.8rem; color: var(--c-text-muted); margin-bottom: 0.2rem; }
.filters select, .filters input {
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font: inherit;
}
.filters select:focus, .filters input:focus { outline: none; border-color: var(--c-ink); box-shadow: 0 0 0 3px rgb(26 33 48 / 10%); }
.filters button {
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--c-ink);
  border-radius: var(--radius-sm);
  background: var(--c-ink);
  color: #fff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}
.filters button:hover { background: #000; }

.pager { display: flex; gap: 0.75rem; justify-content: center; margin-top: 2.5rem; }
.pager a {
  padding: 0.6rem 1.2rem;
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 550;
}
.pager a:hover { text-decoration: none; border-color: var(--c-ink); }

.notice { padding: 3rem 1rem; text-align: center; color: var(--c-text-muted); }
.notice strong { display: block; color: var(--c-text); font-size: 1.15rem; margin-bottom: 0.3rem; }

.muted { color: var(--c-text-muted); }
.mono { font-family: var(--font-mono); }
.section { margin-bottom: 3rem; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; gap: 1rem; }
.section__head h2 { margin: 0; }

.buybox__stock { margin-block: 0.6rem 0; }

@media (max-width: 720px) {
  .site-head { position: static; }
  .site-head__inner { align-items: center; }
  .logo__img { height: 40px; }
  /* flex-basis:100% is what actually forces the wrap — width:100% alone loses
     to the flex-basis:0 from `flex: 1`, and the input's automatic minimum size
     then pushes the row off-screen. */
  .site-search { order: 3; flex: 1 0 100%; width: 100%; min-width: 0; }
  .site-search__input { min-width: 0; }
  /* Icon only — the aria-label on the anchor carries the name. */
  .account-link { margin-left: auto; padding-inline: 0.7rem; }
  .account-link__label { display: none; }
  .lang { margin-left: 0; }
  .site-main { padding-top: 1.5rem; }
  .hero { border-radius: 18px; margin-bottom: 2rem; }
  .hero h1 { max-width: none; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
  .pcard__foot { align-items: flex-start; flex-direction: column; }
  .site-foot__inner { align-items: flex-start; flex-direction: column; gap: 1rem; }
  .site-foot__copy { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* --------------------------------------------------------- error page --- */

.errpage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}
.errpage__card {
  width: min(100%, 460px);
  text-align: center;
}
.errpage__brand { display: inline-flex; }
.errpage__brand:hover { text-decoration: none; }
.errpage__logo { width: auto; height: 52px; object-fit: contain; }
/* Large but quiet: the number identifies the failure, it is not the message. */
.errpage__status {
  margin: 1.75rem 0 0;
  font-size: 3.25rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: -0.05em;
  color: var(--c-border-strong);
  font-variant-numeric: tabular-nums;
}
.errpage__title { margin: 0.75rem 0 0; }
.errpage__message { margin: 0.6rem 0 1.75rem; color: var(--c-text-muted); }
/* The two strings worth quoting in a bug report, and nothing else. */
.errpage__meta {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 1.75rem 0 0;
  font-size: 0.75rem;
  color: var(--c-text-subtle);
}
.errpage__meta .mono { font-family: var(--font-mono); }

.errpage .btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--c-brand);
  border-radius: var(--radius-sm);
  background: var(--c-brand);
  color: #fff;
  font-weight: 650;
}
.errpage .btn:hover { background: var(--c-brand-hover); text-decoration: none; }
