/* Layout: a race-game garage screen. A picker strip on top, the car and its telemetry below,
   compare at the bottom. Dark-only by choice: the HUD look depends on it. */
/* Palette: asphalt and carbon neutrals with a cool blue cast, one hazard-yellow accent for
   anything you can act on, signal red for warnings only. */
/* Type: Barlow Condensed (italic, heavy) for headings, Barlow for body, IBM Plex Mono for telemetry. */
:root {
  --asphalt: #0a0c0f;
  --carbon: #13171d;
  --carbon-2: #1b2129;
  --rule: #2a323d;
  --ink: #f1f3f5;
  --ink-soft: #8b96a3;
  --hazard: #ffc400;
  --hazard-ink: #111;
  /* Section markers and card rules: decoration, so neutral; the accent stays for things you can act on. */
  --marker: #4b5664;
  --signal: #ff4d3d;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(900px 480px at 80% -10%, #1d2632 0%, transparent 60%),
    var(--asphalt);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  padding: 0 20px;
  min-height: 100vh;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding-block: 32px 72px;
}

/* ---- Masthead: a starting-grid banner -------------------------------- */

.masthead {
  position: relative;
  padding: 22px 24px 22px 28px;
  margin-bottom: 22px;
  background: var(--carbon);
  border-left: 6px solid var(--hazard);
  overflow: hidden;
}

.masthead::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 220px;
  height: 100%;
  background: repeating-linear-gradient(
    115deg,
    transparent 0 18px,
    var(--hazard) 18px 22px
  );
  opacity: 0.16;
  pointer-events: none;
}

.eyebrow, .field span, legend, th, .note, .status, .spec-list dt, .pip-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
}

/* Small labels never sit above a heading: one that carries data (a handle, a date) follows it.
   An empty one (filled later by script) takes no room. */
.eyebrow:empty { display: none; }
h1 + .eyebrow, h2 + .eyebrow, h3 + .eyebrow { margin: -6px 0 12px; }

h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 6px 0 12px;
  text-wrap: balance;
}

.lede {
  color: var(--ink-soft);
  margin: 0;
  max-width: 62ch;
  text-wrap: pretty;
}

/* Inner pages get a one-line banner so the content starts above the fold; home keeps the full hero. */
.masthead:not(.home-masthead):not(.home-hero):not(.member-head) { padding: 14px 20px 14px 22px; margin-bottom: 16px; }
.masthead:not(.home-masthead):not(.home-hero):not(.member-head) h1 { font-size: clamp(26px, 3.2vw, 34px); margin: 2px 0 4px; }
.masthead:not(.home-masthead):not(.home-hero):not(.member-head) .lede { font-size: 15px; line-height: 1.4; }

.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  text-wrap: balance;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 10px;
  background: var(--marker);
  transform: skewX(-18deg);
  vertical-align: middle;
}

.sub {
  margin: 0;
  color: var(--ink-soft);
}

/* ---- Panels: HUD cards with a cut corner ----------------------------- */

.picker, .panel, .viewer-panel, .compare {
  position: relative;
  background: var(--carbon);
  border: 1px solid var(--rule);
  padding: 20px;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.picker {
  border-left: 3px solid var(--marker);
}

/* ---- Picker ---------------------------------------------------------- */

.picker-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-top: 14px; }

.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

select, input[type="text"] {
  font: inherit;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--asphalt);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
}

select:not(:disabled):hover { border-color: var(--ink-soft); }
select:disabled { opacity: 0.4; }

.status {
  min-height: 1.5em;
  margin: 12px 0 0;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--font-body);
  font-size: 14px;
}
.status.error { color: var(--signal); }

/* ---- Garage layout --------------------------------------------------- */

.car {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

@media (max-width: 820px) {
  .car { grid-template-columns: minmax(0, 1fr); }
}

/* The 3D stage stays in view while the visitor scrolls the paint, stats and mods beside it
   (desktop) or under it (phones), so every pick shows on the car as it is made. */
.viewer-panel {
  position: sticky;
  top: 12px;
  z-index: 4;
}
.car-side { display: grid; gap: 20px; min-width: 0; }
.paint-panel .colors { margin-bottom: 14px; }
.viewer-frame { position: relative; }
.viewer-change {
  position: absolute;
  left: 10px;
  bottom: 18px;
  max-width: calc(100% - 20px);
  margin: 0;
  padding: 6px 10px;
  background: rgba(10, 12, 15, 0.86);
  border-left: 3px solid var(--hazard);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}
.viewer-change[hidden] { display: none; }
.viewer-change .off { color: var(--ink-soft); }

@media (max-width: 820px) {
  /* Phones: a compact stage pinned to the top, options scroll underneath it. */
  .viewer-panel {
    top: 0;
    padding: 10px 12px 6px;
    clip-path: none;
    box-shadow: 0 10px 18px -12px rgba(0, 0, 0, 0.9);
  }
  .viewer-panel .viewer-head { flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .viewer-panel .viewer-head .section-title { font-size: 18px; margin: 0; }
  .viewer-panel .viewer-head .sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .viewer-panel .viewer { aspect-ratio: auto; height: min(34vh, 60vw); margin: 6px 0 4px; }
  .viewer-panel #viewer-hint { display: none; }
  .viewer-panel #viewer-note { font-size: 12px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

.viewer {
  width: 100%;
  aspect-ratio: 4 / 3;
  margin: 8px 0 8px;
  max-width: 100%;
  background:
    radial-gradient(circle at 50% 35%, #2a3440 0%, #12171e 62%, #0a0c0f 100%);
  border: 1px solid var(--rule);
}

.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer.interactive canvas { cursor: grab; touch-action: none; }
.viewer.interactive.dragging canvas { cursor: grabbing; }

.viewer-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.viewer-head .sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--hazard);
}

.note { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-size: 13px; margin: 0 0 16px; }
.note-inline { text-transform: none; letter-spacing: 0; font-family: var(--font-body); font-weight: 400; }

.colors {
  border: none;
  padding: 0;
  margin: 0 0 18px;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.swatch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px 7px 7px;
  border: 1px solid var(--rule);
  background: var(--asphalt);
  color: var(--ink-soft);
  cursor: pointer;
  border-radius: 0;
  transform: skewX(-8deg);
}

.swatch > * { transform: skewX(8deg); }

.swatch i {
  width: 18px;
  height: 18px;
  display: inline-block;
  border: 1px solid #000;
}

.swatch[aria-checked="true"] {
  color: var(--ink);
  border-color: var(--hazard);
  box-shadow: inset 0 -3px 0 var(--hazard);
}

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

.btn {
  font: inherit;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--carbon-2);
  border: 1px solid var(--rule);
  border-radius: 0;
  padding: 11px 20px;
  cursor: pointer;
  transform: skewX(-10deg);
}

.btn > * { display: inline-block; transform: skewX(10deg); }

.btn.primary {
  background: var(--hazard);
  color: var(--hazard-ink);
  border-color: var(--hazard);
}

.btn:hover:not(:disabled) { border-color: var(--ink-soft); }
.btn.primary:hover:not(:disabled) { background: #ffd52e; border-color: #ffd52e; }

.btn.quiet {
  background: none;
  border-color: transparent;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-style: normal;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.06em;
  padding: 6px 4px;
  transform: none;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn:disabled { opacity: 0.45; cursor: default; }

.btn:focus-visible, .swatch:focus-visible, select:focus-visible, input:focus-visible {
  outline: 2px solid var(--hazard);
  outline-offset: 3px;
}

.share { margin-top: 14px; }

/* ---- Telemetry: spec readouts --------------------------------------- */

.facts {
  display: grid;
  gap: 16px;
}

.spec-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0;
  margin: 0;
}

.spec-list dt,
.spec-list dd {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  margin: 0;
}

.spec-list dd {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--ink);
}

.spec-list dt:last-of-type,
.spec-list dd:last-of-type { border-bottom: none; }

/* Safety: five-segment rating bars, lit like a rev counter. */
.rating {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 15px;
  flex-wrap: wrap;
}

.rating strong {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.pips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pips i {
  display: inline-block;
  width: 18px;
  height: 10px;
  background: var(--carbon-2);
  border: 1px solid var(--rule);
  transform: skewX(-18deg);
}

.pips i.on {
  background: var(--hazard);
  border-color: var(--hazard);
}

.pip-label {
  margin-left: 8px;
  font-size: 11px;
  color: var(--ink);
  white-space: nowrap;
}

/* Recalls: hazard stripes along the top when there is anything to read. */
.panel.alert {
  border-color: var(--signal);
}

.panel.alert::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    var(--hazard) 0 10px,
    #111 10px 20px
  );
}

.panel.alert .section-title::before { background: var(--signal); }

.recall {
  border-top: 1px solid var(--rule);
  padding: 12px 0;
  font-size: 14px;
}
.recall:first-child { border-top: none; padding-top: 0; }
.recall strong { font-weight: 600; }
.recall p { margin: 4px 0 0; color: var(--ink-soft); }

/* ---- Compare: the pit-wall timing table ----------------------------- */

.compare { margin-top: 24px; }

.compare-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  margin-top: 8px;
  background: var(--asphalt);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}

thead th {
  background: var(--carbon-2);
  color: var(--ink);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tbody th {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

tbody td { color: var(--ink); }
tr:last-child td, tr:last-child th { border-bottom: none; }

.trim-detail {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 12px;
  color: var(--hazard);
  margin-top: 2px;
}

:focus-visible {
  outline: 2px solid var(--hazard);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .picker, .panel, .viewer-panel { transition: border-color 0.15s ease; }
}


/* ---- Top bar and left menu drawer ----------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.menu-button {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0 10px;
  background: var(--carbon);
  border: 1px solid var(--rule);
  cursor: pointer;
}

.menu-button span {
  display: block;
  height: 3px;
  background: var(--hazard);
}

.menu-button:hover { border-color: var(--ink-soft); }

.brand {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-size: 18px;
  color: var(--ink);
  text-decoration: none;
}

.menu-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10;
}

.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(320px, 86vw);
  z-index: 11;
  background: var(--carbon);
  border-right: 3px solid var(--hazard);
  padding: 16px 18px 24px;
  overflow-y: auto;
  transform: translateX(-100%);
  visibility: hidden;
}

.side-menu.open {
  transform: none;
  visibility: visible;
}

@media (prefers-reduced-motion: no-preference) {
  .side-menu { transition: transform 0.2s ease; }
}

.side-menu-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.side-menu-head span {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.menu-close {
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--carbon-2);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  cursor: pointer;
}

.side-group { margin-bottom: 22px; }

.side-heading {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 20px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
  margin: 0 0 8px;
}

.side-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.side-list a {
  display: block;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 16px;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  background: var(--asphalt);
}

.side-list a:hover { color: var(--ink); border-color: var(--ink-soft); }

.side-list a[aria-current="page"] {
  color: var(--hazard-ink);
  background: var(--hazard);
  border-color: var(--hazard);
}

/* ---- Curated page ---------------------------------------------------- */
/* Search */
.curated-search { display: grid; gap: 6px; margin-bottom: 18px; }
.curated-search-row { display: flex; gap: 10px; align-items: center; }
.curated-search input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--asphalt);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.curated-search input[type="search"]:hover { border-color: var(--ink-soft); }
.curated-search input[type="search"]::-webkit-search-cancel-button { display: none; }
.curated-search .btn.quiet { min-height: 44px; padding: 6px 10px; }

/* Tabs sort the styles into four ways to browse, as on the Guns site */
.curated-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.curated-tabs::-webkit-scrollbar { display: none; }
.curated-tabs [role="tab"] {
  min-width: max-content;
  min-height: 44px;
  padding: 12px 18px 10px;
  margin-bottom: -1px;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  font: italic 800 18px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.curated-tabs [role="tab"]:hover { color: var(--ink); }
.curated-tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--hazard); }
.curated-tabs [role="tab"]:focus-visible { outline: 2px solid var(--hazard); outline-offset: -2px; }

.curated-tabs + [role="tabpanel"] { padding-top: 14px; }
.category-button[hidden] { display: none; }


.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-button {
  font: inherit;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--asphalt);
  border: 1px solid var(--rule);
  padding: 10px 18px;
  cursor: pointer;
  transform: skewX(-10deg);
}

.category-button > * { display: inline-block; }

.category-button[aria-pressed="true"] {
  color: var(--hazard-ink);
  background: var(--hazard);
  border-color: var(--hazard);
}

.category-button:hover:not([aria-pressed="true"]) { color: var(--ink); border-color: var(--ink-soft); }
.category-button { min-height: 44px; }
.category-button:focus-visible { outline: 2px solid var(--hazard); outline-offset: 3px; }

.category-blurb {
  margin: 14px 0 0;
  font-size: 15px;
  color: var(--ink);
}

.pick-grid.group-grid {
  margin-top: 18px;
}

.group-card.is-open {
  border-color: var(--hazard);
}

#curated-note { margin: 16px 0 0; }

.group-also {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.group-older {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.picks[hidden] { display: none; }

.picks {
  scroll-margin-top: 16px;
}

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}

.group-head .section-title:focus { outline: none; }
.group-head .section-title:focus-visible { outline: 2px solid var(--hazard); outline-offset: 4px; }
.group-back { min-height: 44px; }

.pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.pick-actions .pick-open { margin-top: 0; }
.pick-more { min-height: 44px; }

.group-blurb {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--ink-soft);
}

.group-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* The group's color sits in a swatch; some markers are too dark to carry text on carbon. */
.group-label::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--marker);
  vertical-align: 1px;
}

.pick-empty {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 15px;
  padding: 16px 18px;
  border: 1px dashed var(--rule);
}

.picks {
  margin-top: 24px;
}

.pick-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.pick-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--carbon);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--marker);
  padding: 16px 18px 18px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 0 100%);
}

.pick-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 20px;
  line-height: 1.1;
  text-transform: uppercase;
  margin: 0;
  text-wrap: balance;
}

.pick-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  flex: 1;
}

.pick-open {
  align-self: flex-start;
  text-decoration: none;
  margin-top: 4px;
}

.pick-photo {
  margin: 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pick-photo img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--asphalt);
  border: 1px solid var(--rule);
}

/* Curated cards: a live 3D model of the pick (static/showcase3d.js) in place of a photo. */
.pick-model {
  position: relative;
  margin: 0 0 4px;
  background: radial-gradient(circle at 50% 38%, #2a3440 0%, #12171e 65%, #0a0c0f 100%);
  border: 1px solid var(--rule);
  border-bottom: 2px solid color-mix(in srgb, var(--hazard) 55%, transparent);
}
.pick-model .showcase-canvas { display: block; width: 100%; aspect-ratio: 16 / 10; height: auto; cursor: grab; touch-action: pan-y; }
.pick-model.dragging .showcase-canvas { cursor: grabbing; }
.pick-model:not(.showcase-ready) { min-height: 0; aspect-ratio: 16 / 10; }
.pick-model:not(.showcase-ready) .showcase-canvas { background: linear-gradient(90deg, transparent 0, rgba(255, 255, 255, 0.03) 50%, transparent 100%); }

.photo-credit {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.photo-credit a { color: var(--ink-soft); }
.photo-credit a:hover { color: var(--ink); }

.pick-stats {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}

.pick-stats dt { color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.pick-stats dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pick-stats-status { grid-column: 1 / -1; margin: 0; color: var(--ink-soft); font-family: var(--font-body); font-size: 13px; }

/* ---- Game stats (Telemetry) ----------------------------------------- */

.game-stats { display: grid; gap: 10px; margin-bottom: 12px; }
.game-stats .stat { grid-template-columns: 13ch 1fr 8ch; color: var(--ink); }
.game-stats .stat > b { white-space: nowrap; }
/* Mods: solid fill up to min(stock, built); the span between stock and built is a lighter
   shade of the same accent, so gains extend past stock and losses pull the solid bar back. */
.game-stats .stat {
  --base: var(--value);
  --lo: min(var(--base), var(--value));
  --hi: max(var(--base), var(--value));
}
.game-stats .stat::after {
  background:
    linear-gradient(90deg,
      var(--a) calc(var(--lo) * 1%),
      color-mix(in srgb, var(--a) 38%, transparent) calc(var(--lo) * 1%) calc(var(--hi) * 1%),
      transparent calc(var(--hi) * 1%)),
    repeating-linear-gradient(90deg, var(--hud-line, var(--rule, #3a3f44)) 0 calc(10% - 2px), transparent 0 10%);
}
/* Stock marker: a tick that stands above and below the bar at the stock value, shown only
   when a mod changes the stat, so you can see where stock is and which way it moved. */
.game-stats .stat-modded::before {
  content: ""; grid-column: 2; grid-row: 1; align-self: center; justify-self: start;
  position: relative; z-index: 1;
  width: 2px; height: 18px; margin-left: calc(var(--base) * 1% - 1px);
  background: var(--ink);
}
.game-stats .stat { grid-template-columns: 13ch 1fr 10ch; }

/* ---- Customize section ---------------------------------------------- */

.customize { min-width: 0; }

.customize-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.custom-group {
  border: 1px solid var(--rule);
  background: var(--asphalt);
  margin: 0;
  padding: 12px 14px 14px;
  min-width: 0;
}

.custom-group legend {
  padding: 0 6px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.custom-option {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  padding: 8px 0;
  border-top: 1px solid var(--rule);
  cursor: pointer;
}

.custom-option:first-of-type { border-top: none; }

.custom-option input {
  grid-row: span 2;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--hazard);
}

.custom-name {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--ink);
}

.custom-note {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.4;
}

.custom-option input:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }

/* Parts that don't fit this car: greyed out, with the reason as the note. */
.custom-option-off { cursor: default; }
.custom-option-off .custom-name { color: var(--ink-soft); text-decoration: line-through; text-decoration-thickness: 1px; }
.custom-option-off input { opacity: 0.4; }
.custom-group-none { opacity: 0.6; }
.custom-group-none .custom-note { margin: 4px 0 0; }
.wheel-fit { margin-top: 6px; }
/* A part with spec levels: picking it opens its levels (radio buttons) underneath. */
.custom-family { border-top: 1px solid var(--rule); }
.custom-family:first-of-type { border-top: none; }
.custom-family > .custom-option { border-top: none; }
.custom-levels { margin: 0 0 8px 28px; border-left: 2px solid var(--hazard); padding-left: 12px; }
.custom-level {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px;
  padding: 6px 0; cursor: pointer;
}
.custom-level input { grid-row: span 3; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--hazard); }
.custom-option input { grid-row: span 3; }
/* LED color for lit mods: preset swatches and a color wheel under the picked level. */
.led-color { padding: 6px 0 4px; }
.led-color-title { display: block; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.led-color-swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.led-swatch {
  width: 26px; height: 26px; border-radius: 50%; padding: 0; cursor: pointer;
  border: 2px solid var(--rule); background: var(--led);
  box-shadow: 0 0 8px 1px color-mix(in srgb, var(--led) 55%, transparent);
}
.led-swatch[aria-pressed="true"] { border-color: var(--ink); outline: 2px solid var(--hazard); outline-offset: 2px; }
.led-swatch:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }
.led-color-wheel { width: 34px; height: 28px; padding: 0; border: 1px solid var(--rule); border-radius: 6px; background: none; cursor: pointer; }
.custom-effects { grid-column: 2; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; font-weight: 600; }
.custom-effects .delta-up { color: var(--hud-good, #5fc27a); }
.custom-effects .delta-down { color: var(--hud-bad, #e2645a); }
.custom-effects .delta-none { color: var(--ink-soft); font-weight: 400; }
.custom-option-off .custom-effects { opacity: 0.5; }
.custom-summary { margin: 2px 0 8px; font-size: 13px; line-height: 1.45; color: var(--ink-soft); font-style: italic; }
/* Modifications: broad sections (Wheels and tires, Performance, ...) holding the part groups. */
.mod-sections { display: grid; gap: 14px; margin-top: 12px; }
.mod-section { background: var(--carbon-2); }
.mod-section .section-title { font-size: 18px; margin-bottom: 0; }
.mod-section .customize-groups { margin-top: 12px; }


/* ---- Collapsible sections ------------------------------------------- */

.collapse-head {
  position: relative;
  padding-right: 40px;
  cursor: pointer;
}

.collapse-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  padding: 0;
  background: none;
  border: 1px solid var(--rule);
  color: var(--hazard);
  cursor: pointer;
}

.collapse-toggle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-50%, -70%) rotate(45deg);
}

.collapse-head:hover .collapse-toggle { border-color: var(--hazard); }
.collapsed .collapse-toggle::before { transform: translate(-70%, -50%) rotate(-45deg); }
.collapsed > :not(.collapse-head) { display: none !important; }
.collapsed .section-title, .collapsed .collapse-head { margin-bottom: 0; }

@media (prefers-reduced-motion: no-preference) {
  .collapse-toggle::before { transition: transform 0.15s ease; }
}

/* More details: crash rating and recalls at the very bottom, shown once a car is loaded. */
.details { margin-top: 24px; }
.details-body { display: grid; gap: 16px; }
.details-body .panel { background: var(--carbon-2); }
#car[hidden] ~ .details { display: none; }
/* Real-world figure under each telemetry label (hp, lb/hp, lb, in). */
.game-stats .stat > span { line-height: 1.2; }
.game-stats .stat-unit {
  display: block; margin-top: 3px;
  color: var(--ink-soft); font-size: 10px; letter-spacing: .04em; text-transform: none;
  white-space: nowrap;
}
.game-stats .stat { grid-template-columns: 16ch 1fr 10ch; }
/* Industry best / Class toggle above the telemetry bars. */
.stat-scale { display: flex; gap: 8px; margin-bottom: 12px; }
.stat-scale[hidden] { display: none; }
.stat-scale .hud-chip { background: transparent; color: var(--ink-soft); cursor: pointer; }
.stat-scale .hud-chip:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }

/* Paint: Custom swatch and the custom paint or wrap panel. */
.swatch-custom i { background-image: conic-gradient(from 0deg, #ff4d3d, #ffc400, #3ddc84, #3da5ff, #b05cff, #ff4d3d) !important; }
.custom-paint { margin-top: 12px; padding: 12px; border: 1px solid var(--rule); background: var(--carbon-2); }
.custom-paint[hidden] { display: none; }
.custom-paint-title { margin: 0 0 10px; font-weight: 600; color: var(--ink); }
.custom-paint-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 10px; }
.custom-paint-field { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-soft); }
.custom-paint-label { font-size: 14px; color: var(--ink-soft); min-width: 56px; }
.custom-paint input[type="color"] { width: 40px; height: 30px; padding: 0; border: 1px solid var(--rule); background: transparent; cursor: pointer; }
.custom-paint input[type="color"]:disabled { opacity: 0.35; cursor: default; }
.custom-paint input[type="text"] { width: 10ch; font: 500 14px var(--font-mono); padding: 5px 6px; color: var(--ink); background: var(--asphalt); border: 1px solid var(--rule); }
.custom-paint select { font: inherit; font-size: 14px; padding: 5px 6px; color: var(--ink); background: var(--asphalt); border: 1px solid var(--rule); }
.custom-paint input[type="checkbox"] { accent-color: var(--hazard); }
.paint-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.paint-chip { width: 26px; height: 26px; padding: 0; border: 1px solid var(--rule); cursor: pointer; }
.paint-chip:hover, .paint-chip:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }
.paint-mod { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; row-gap: 2px; align-items: center; padding: 8px 0; }
.paint-mod .custom-note { grid-column: 1; }
.paint-mod .btn { grid-column: 2; grid-row: 1 / 3; }

/* ---- Collapsible drawer groups ---- */

.side-group.is-collapsed { margin-bottom: 6px; }

.side-group.is-collapsed .side-heading { margin-bottom: 0; }

.side-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  margin: 0;
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.side-toggle:focus-visible {
  outline: 2px solid var(--hazard);
  outline-offset: 2px;
}

.side-chevron {
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-right: 2px solid var(--hazard);
  border-bottom: 2px solid var(--hazard);
  transform: rotate(45deg);
}

.side-toggle[aria-expanded="false"] .side-chevron { transform: rotate(-45deg); }

@media (prefers-reduced-motion: no-preference) {
  .side-chevron { transition: transform 0.15s ease; }
}

.side-list[hidden],
.side-group [hidden] { display: none !important; }

/* ---- Matchmaker ------------------------------------------------------ */
.quiz-question { border: 0; margin: 0 0 18px; padding: 0; }
.quiz-legend { font: italic 800 20px/1.2 var(--font-display); text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 10px; color: var(--ink); }
.quiz-answer { position: relative; cursor: pointer; }
.quiz-answer input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.quiz-answer:has(input:checked) { color: var(--hazard-ink); background: var(--hazard); border-color: var(--hazard); }
.quiz-answer:has(input:focus-visible) { outline: 2px solid var(--hazard); outline-offset: 3px; }
.quiz-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.quiz-actions .sub { margin: 0; }
.match-grid { counter-reset: none; }
.trim-matches {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px;
  margin: 0 0 18px; padding: 0; list-style: none;
}
.trim-match { display: grid; gap: 4px; padding: 12px 14px; background: var(--asphalt); border: 1px solid var(--rule); }
.trim-match-name { font-weight: 600; color: var(--ink); }
.trim-match-version { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; }
.trim-match .match-reason { margin: 4px 0 0; font-weight: 400; }
.match-reason { margin: 0 0 6px; font-weight: 600; color: var(--ink); }

/* Match cards line up row by row: label, photo, name, reason, note, buttons share subgrid rows,
   so every card in a grid row is the same height and the buttons sit on one baseline. */
.match-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.match-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; row-gap: 10px; align-content: start; }
.match-card .pick-photo { margin: 0; }
.match-card .match-reason { margin: 0; }
.match-card .pick-actions { align-self: end; flex-direction: column; flex-wrap: nowrap; margin: 4px 4px 0; }
.match-card .pick-actions .btn {
  align-self: stretch;
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 8px 14px; margin: 0;
  font-size: 15px; line-height: 1.15; text-align: center; text-decoration: none;
}
.pick-photo-blank {
  display: grid; place-items: center; aspect-ratio: 4 / 3;
  background: var(--asphalt); border: 1px dashed var(--rule);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft);
}

/* "From Curated" breadcrumb on the configurator (static/crumb.js) */
.curated-crumb { margin: -6px 0 14px; font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--ink-soft); }
.curated-crumb a { color: var(--hazard); text-underline-offset: 3px; }
.curated-crumb a:focus-visible { outline: 2px solid var(--hazard); outline-offset: 2px; }

/* "Read the legends" links under a style's blurb */
.curated-legends { margin: -4px 0 14px; font-size: 14px; }
.curated-legends[hidden] { display: none; }
.curated-legends a { color: var(--hazard); text-underline-offset: 3px; }

/* Forum and Social read as one Community page: a shared tab bar under the banner. */
.community-tabs { display: flex; gap: 4px; margin: -4px 0 18px; border-bottom: 1px solid var(--rule); }
.community-tabs a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 18px;
  margin-bottom: -1px;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  font: italic 800 18px/1 var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.community-tabs a:hover { color: var(--ink); }
.community-tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--hazard); }
.community-tabs a:focus-visible { outline: 2px solid var(--hazard); outline-offset: -2px; }

/* Compare from Curated: a tray that follows the page while picks are in the compare list */
.compare-tray {
  position: sticky;
  bottom: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin-top: 18px;
  padding: 10px 14px;
  background: var(--carbon-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--hazard);
  font-family: var(--font-mono);
  font-size: 13px;
}
.compare-tray[hidden], .compare-tray [hidden] { display: none; }
.compare-add[aria-pressed="true"] { color: var(--ink); border-color: var(--ink-soft); }
