/* Fitment64 — layout + preview workbench */

/* --- Cross-browser reset (lightweight; no third-party normalize) --- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
picture,
svg,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  margin: 0;
}

button {
  cursor: pointer;
  background: transparent;
  border: none;
}

button:disabled {
  cursor: not-allowed;
}

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

a:hover {
  text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6,
p {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

/* --- Design tokens --- */

:root {
  --font-display: "Anton SC", sans-serif;
  --font-body: "Roboto Condensed", sans-serif;

  --color-bg-page: #e8e8e8;
  --color-bg-card: #ffffff70;
  --color-bg-input: #ffffff;
  --color-border: #1a1a1a;
  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;

  --content-max: 800px;
  --space-page: clamp(12px, 3vw, 20px);

  /*
   * WORKBENCH SPLIT — % of viewport height for the pegboard band (top).
   * Table fills the rest. MVP: edit here. (Step 3 baseline — no JS.)
   */
  --workbench-split: 35%;

  /*
   * Preview height ≈ (rail width) ÷ --preview-aspect. On short laptops that can leave no room
   * for the gallery — cap with --preview-max-height (none = uncapped).
   * Truck size inside the slot: --preview-content-scale (<1 shrinks layered art proportionally).
   * Shorter box: lower aspect’s second term (16 / 8) or tighten --preview-max-height.
   */
  --preview-aspect: 16 / 5;
  --preview-content-scale: 0.70;
  --preview-min-height: 0;
  --preview-max-height: none;

  --placeholder-bg: rgba(255, 255, 255, 0.35);
}

/* Short window: keep hero from eating the whole screen so wheels rail can scroll inside view. */
@media (max-height: 900px) {
  :root {
    --preview-min-height: 0;
    --preview-max-height: min(32dvh, 340px);
  }
}

/* Mobile-only: enlarge casting art inside the same preview slot. */
@media (max-width: 768px) {
  :root {
    --preview-content-scale: .9;
  }
}

html {
  height: 100%;
  font-size: 16px;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  overflow-x: hidden;
}

body {
  margin: 0;
  height: 100dvh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.45;
  color: var(--color-text);
  background-color: var(--color-bg-page);
}

/* Sit above fixed workbench */
body > header {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
}

body > main {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Fills viewport below header; gallery section grows */
.site-main > .controls-section,
.site-main > .preview-section {
  flex-shrink: 0;
}

.site-main > .wheels-rail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-block-start: 12px;
  padding-block-end: var(--space-page);
  position: relative;
  z-index: 1;
}

/* --- Full-screen workbench (mock: single sweep, no repeat in-page) --- */

.workbench {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-rows: var(--workbench-split) 1fr;
  pointer-events: none;
}

.workbench__pegboard {
  background-color: #d6d6d6;
  background-image: url("../assets/patterns/pegboard.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}

.workbench__table {
  background-color: #cacaca;
  background-image: url("../assets/patterns/table.png");
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center top;
}

/* Centered content column — header, controls, preview, wheels */
.content-rail {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--space-page);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 14px 28px;
}

.site-logo {
  display: block;
  height: 28px;
  width: auto;
}

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  border-radius: var(--radius-sm);
}

.btn--feedback {
  padding: 8px 14px;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
}

.btn--feedback:hover {
  background: #f3f3f3;
}

.btn--feedback:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

/* Placeholder regions — wheels grid (Step 5) */
.placeholder-block {
  margin-block: 0 12px;
  padding: 16px;
  min-height: 72px;
  border-radius: var(--radius-lg);
  background: var(--placeholder-bg);
  border: 1px dashed rgba(0, 0, 0, 0.12);
}

.placeholder-block__label {
  margin: 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

/* --- Step 3: Casting / Series (§5 layout, §11.1 custom chrome) --- */

.controls-section {
  margin-block-end: 12px;
  position: relative;
  /* Stack above preview + gallery — otherwise open lists paint under siblings and clicks miss */
  z-index: 12;
}

.controls-panel {
  padding: 14px;
  border-radius: var(--radius-lg);
  background: var(--color-bg-card);
}

.controls-panel__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 520px) {
  .controls-panel__grid {
    grid-template-columns: 1fr;
  }
}

.fit-select {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.fit-select__control {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: var(--radius-md);
  background: var(--color-bg-input);
  overflow: hidden;
}

/* Black border pinned on this box only (JS: `fit-select__control--has-value` — not parent focus/sibling logic) */
.fit-select__control--has-value {
  border-color: var(--color-border);
}

.fit-select__trigger {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  padding-right: calc(44px + 8px);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
  text-align: left;
  color: var(--color-text);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.fit-select__trigger:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.5);
}

.fit-select__trigger:disabled {
  cursor: not-allowed;
  color: var(--color-text-muted);
  background: rgba(255, 255, 255, 0.35);
}

.fit-select__trigger:focus-visible {
  z-index: 1;
}

.fit-select:not(.fit-select--has-value) .fit-select__trigger:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.fit-select--has-value .fit-select__trigger:focus-visible {
  outline: none;
}

.fit-select__suffix {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
  color: var(--color-text-muted);
}

.fit-select__chevron {
  display: flex;
  align-items: center;
  transition: transform 0.15s ease;
}

.fit-select__suffix .fit-select__reset:not([hidden]) {
  pointer-events: auto;
  cursor: pointer;
}

.fit-select__reset:not([hidden]) ~ .fit-select__chevron {
  display: none;
}

/* [hidden] must win — `.fit-select__reset:not([hidden])` uses flex and would defeat native hidden otherwise */
.fit-select__reset[hidden] {
  display: none !important;
}

.fit-select__reset:not([hidden]) {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-text-muted);
}

.fit-select__reset:not([hidden]):hover {
  color: var(--color-text);
  background: rgba(0, 0, 0, 0.04);
}

.fit-select__reset:not([hidden]):focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: -2px;
}

.fit-select__trigger[aria-expanded="true"] ~ .fit-select__suffix .fit-select__chevron {
  transform: rotate(180deg);
}

.fit-select__value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fit-select__value--placeholder {
  color: var(--color-text-muted);
}

.fit-select__list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: min(280px, 45vh);
  overflow-y: auto;
  padding: 4px;
  margin: 0;
  list-style: none;
  background: var(--color-bg-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.fit-select__option {
  padding: 10px 12px;
  font-size: 16px;
  line-height: 1.25;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.fit-select__option:hover,
.fit-select__option--active {
  background: var(--color-bg-card);
}

.fit-select__option[aria-selected="true"] {
  font-weight: 500;
}

/* --- Preview: semantic 16:9 slot (Step 2); layers in Step 4 --- */

.preview-section {
  position: relative;
  z-index: 2;
  margin-block: 4px 0;
  padding-block: 12px 14px; /* tighten/loosen vertical rhythm around preview */
}

.preview-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--preview-aspect);
  min-height: var(--preview-min-height);
  max-height: var(--preview-max-height);
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 0;

  /* Layer adjust fallbacks (identity). Per-variant classes below override. */
  --preview-nudge-shadow-x: 0%;
  --preview-nudge-shadow-y: 0%;
  --preview-scale-shadow: 1;
  --preview-nudge-chassis-x: 0%;
  --preview-nudge-chassis-y: 0%;
  --preview-scale-chassis: 1;
  /* Wheels: translate + uniform scale (keeps wheel art proportional). Unitless, e.g. 1.05. */
  --preview-nudge-wheel-rear-x: 0%;
  --preview-nudge-wheel-rear-y: 0%;
  --preview-scale-wheel-rear: 1;
  --preview-nudge-wheel-front-x: 0%;
  --preview-nudge-wheel-front-y: 0%;
  --preview-scale-wheel-front: 1;

  /*
   * Per-brand overlay size (gallery / Sheets wheel_brand_id). Set via JS — see wheels-gallery.js.
   * Multiplies the variant scales below; tuning for default-only preview adds another factor in JS.
   */
  --preview-overlay-brand-multiplier: 1;
}

/* No casting/series — art hidden; Anton SC label on top (preview-sync.js toggles .preview-stage--empty). */
.preview-placeholder {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 6% 8%;
  pointer-events: none;
  background: var(--color-bg-card);
}

.preview-placeholder__label {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.25rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: 0.02em;
  color: var(--color-text);
  text-align: center;
}

.preview-stage--empty .preview-placeholder {
  display: flex;
}

.preview-stage--empty .preview-stack {
  visibility: hidden;
}

/*
 * Hardcoded tuning — one block per casting + series (matches controls ids).
 * translate: % or px (+x right, +y down). shadow/chassis/wheels: uniform scale (proportional).
 * Optional: `--preview-content-scale` on this variant if one car needs different overall zoom.
 */
/*
 * Variant nudges: data-preview-* live on <html> (set in preview-sync.js) so DevTools → pick
 * the root <html> node to see/edit the matching rule. Same slugs as asset folders.
 */
:root[data-preview-casting="83-silverado"][data-preview-series="2023-hw-slammed"]
  #fitment64-preview-stage {
  --preview-nudge-shadow-x: 0%;
  --preview-nudge-shadow-y: 51%;
  --preview-scale-shadow: 1;
  --preview-nudge-chassis-x: 2%;
  --preview-nudge-chassis-y: 30%;
  --preview-scale-chassis: .84;
  --preview-nudge-wheel-rear-x: -26.5%;
  --preview-nudge-wheel-rear-y: 35%;
  --preview-scale-wheel-rear: .50;
  --preview-nudge-wheel-front-x: 33.5%;
  --preview-nudge-wheel-front-y: 35%;
  --preview-scale-wheel-front: .50;
}

/*
 * 930 RWB — wheels stay under `.preview-layer--body` (default z-stack). For swaps to read through the
 * silhouette, `body.png` needs transparent cutouts in the wheel areas (same idea as Silverado wells).
 */
:root[data-preview-casting="930-rwb"][data-preview-series="2019-silhouettes"] #fitment64-preview-stage {
  --preview-nudge-shadow-x: 0%;
  --preview-nudge-shadow-y: 45%;
  --preview-scale-shadow: 1;
  --preview-nudge-chassis-x: 0%;
  --preview-nudge-chassis-y: 22%;
  --preview-scale-chassis: .8;
  --preview-nudge-wheel-rear-x: -23.5%;
  --preview-nudge-wheel-rear-y: 34%;
  --preview-scale-wheel-rear: .61;
  --preview-nudge-wheel-front-x: 28.76%;
  --preview-nudge-wheel-front-y: 34%;
  --preview-scale-wheel-front: 0.58;
}

:root[data-preview-casting="99-ek-civic"][data-preview-series="2021-hw-j-imports"] #fitment64-preview-stage {
  --preview-nudge-shadow-x: 0%;
  --preview-nudge-shadow-y: 49%;
  --preview-scale-shadow: 0.91;
  --preview-nudge-chassis-x: 0%;
  --preview-nudge-chassis-y: 17%;
  --preview-scale-chassis: 0.87;
  --preview-nudge-wheel-rear-x: -31%;
  --preview-nudge-wheel-rear-y: 33%;
  --preview-scale-wheel-rear: 0.55;
  --preview-nudge-wheel-front-x: 25.2%;
  --preview-nudge-wheel-front-y: 35%;
  --preview-scale-wheel-front: 0.55;
}

/*
 * Gallery wheel geometry — `data-preview-wheel-layer="gallery"` on <html> when the user picks a
 * wheel that is not the casting stock default (wheels-gallery.js). Override only wheel variables;
 * shadow/chassis stay in the variant block above. Add one block per casting + series you need.
 */
:root[data-preview-casting="83-silverado"][data-preview-series="2023-hw-slammed"][data-preview-wheel-layer="gallery"]
  #fitment64-preview-stage {
  --preview-nudge-wheel-rear-x: -26.5%;
  --preview-nudge-wheel-rear-y: 39%;
  --preview-scale-wheel-rear: 0.5;
  --preview-nudge-wheel-front-x: 33.5%;
  --preview-nudge-wheel-front-y: 39%;
  --preview-scale-wheel-front: 0.5;
}

:root[data-preview-casting="930-rwb"][data-preview-series="2019-silhouettes"][data-preview-wheel-layer="gallery"]
  #fitment64-preview-stage {
  --preview-nudge-wheel-rear-x: -23.5%;
  --preview-nudge-wheel-rear-y: 34%;
  --preview-scale-wheel-rear: 0.51;
  --preview-nudge-wheel-front-x: 28.76%;
  --preview-nudge-wheel-front-y: 34%;
  --preview-scale-wheel-front: 0.5;
}

:root[data-preview-casting="99-ek-civic"][data-preview-series="2021-hw-j-imports"][data-preview-wheel-layer="gallery"]
  #fitment64-preview-stage {
  --preview-nudge-wheel-rear-x: -31%;
  --preview-nudge-wheel-rear-y: 33%;
  --preview-scale-wheel-rear: 0.49;
  --preview-nudge-wheel-front-x: 25.25%;
  --preview-nudge-wheel-front-y: 35%;
  --preview-scale-wheel-front: 0.49;
}

/* Example — duplicate pattern when you add static stacks for other variants:
.preview-stage--83-silverado--mainline-2022 { ... }
.preview-stage--porsche-934--hw-exotics { ... }
.preview-stage--datsun-510--j-imports { ... }
*/

/* §8 — shared stage; layers align when exports share canvas & baseline */
.preview-stack {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: scale(var(--preview-content-scale));
  transform-origin: center center;
}

.preview-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  object-fit: contain;
  object-position: center;
}

.preview-layer--shadow {
  z-index: 10;
  transform-origin: center center;
  transform: translate(var(--preview-nudge-shadow-x), var(--preview-nudge-shadow-y))
    scale(var(--preview-scale-shadow));
}

.preview-layer--chassis {
  z-index: 20;
  transform-origin: center center;
  transform: translate(var(--preview-nudge-chassis-x), var(--preview-nudge-chassis-y))
    scale(var(--preview-scale-chassis));
}

/* Transforms on wrapper — uniform scale keeps wheel proportional; avoids img+object-fit quirks */
.preview-wheel-slot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform-origin: center center;
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .preview-wheel-slot {
    overflow: visible;
  }

  .preview-wheel-img.preview-wheel-img--exit,
  .preview-wheel-img.preview-wheel-img--enter {
    animation: none !important;
  }
}

.preview-wheel-slot--rear {
  z-index: 28;
  transform: translate(var(--preview-nudge-wheel-rear-x), var(--preview-nudge-wheel-rear-y))
    scale(calc(var(--preview-scale-wheel-rear) * var(--preview-overlay-brand-multiplier)));
}

.preview-wheel-slot--front {
  z-index: 30;
  transform: translate(var(--preview-nudge-wheel-front-x), var(--preview-nudge-wheel-front-y))
    scale(calc(var(--preview-scale-wheel-front) * var(--preview-overlay-brand-multiplier)));
}

/*
 * Placeholder overlay in index.html is wrong until catalog loads; castingchange runs before wheels exist.
 * wheels-gallery.js sets data-preview-wheels-ready on <html> after the first catalogloaded + tryApplyDefaultWheel.
 */
:root:not([data-preview-wheels-ready]) #fitment64-preview-stage .preview-wheel-img {
  opacity: 0;
}

.preview-wheel-img {
  width: 100%;
  height: 100%;
  max-width: none;
  border: 0;
  display: block;
  object-fit: contain;
  object-position: center;
  opacity: 1;
  transform: translateY(0);
}

@keyframes preview-wheel-exit {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  /* Fade travels with the upward slide; full transparency only near the end */
  40% {
    opacity: 0.55;
    transform: translateY(-5%);
  }
  78% {
    opacity: 0;
    transform: translateY(-11%);
  }
  100% {
    opacity: 0;
    transform: translateY(-13%);
  }
}

@keyframes preview-wheel-enter {
  /* Start above resting position → slide down into natural wheel placement */
  0% {
    opacity: 0;
    transform: translateY(-14%);
  }
  22% {
    opacity: 0;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.preview-wheel-img.preview-wheel-img--exit {
  animation: preview-wheel-exit 0.176s ease-in forwards;
}

.preview-wheel-img.preview-wheel-img--enter {
  animation: preview-wheel-enter 0.186s ease-in forwards;
}

.preview-layer--body {
  z-index: 40;
}

/* --- Step 5: Wheel gallery (mocks: Desktop 5-up, iPhone 3-up) --- */

.wheels-gallery {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--color-bg-card);
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
  /* Keep clear of home indicator / safe area while flush to viewport */
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

/* Pinned chrome: stays above the card scroller (same effect as sticky top row) */
.wheels-gallery__chrome {
  flex-shrink: 0;
  padding: 12px 14px 10px;
  background: var(--color-bg-card);
}

.wheels-gallery__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.wheels-gallery__heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--color-text);
  flex: 1 1 auto;
  min-width: 0;
}

.wheels-gallery__reset-stock {
  flex-shrink: 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  background: var(--color-bg-input);
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.wheels-gallery__reset-stock:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.26);
}

.wheels-gallery__reset-stock:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.wheels-gallery__reset-stock:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/*
 * Wheel filters (hidden for now — restore markup + styles when needed):
 * .wheels-gallery__filter-slot, .wheels-gallery__filter-placeholder
 */

.wheels-gallery__scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* MVP: CSS spinner — swap markup/class later for a custom loading animation */
.wheels-gallery__loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  background: color-mix(in srgb, var(--color-bg-card) 88%, transparent);
  pointer-events: none;
}

.wheels-gallery__loading[hidden] {
  display: none !important;
}

.wheels-gallery__spinner {
  box-sizing: border-box;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--color-border);
  border-radius: 50%;
  animation: wheels-gallery-spin 0.65s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .wheels-gallery__spinner {
    animation: none;
    border-top-color: rgba(0, 0, 0, 0.35);
  }
}

@keyframes wheels-gallery-spin {
  to {
    transform: rotate(360deg);
  }
}

.wheels-gallery__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 14px 18px;
}

@media (max-width: 640px) {
  .wheels-gallery__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.wheels-gallery__cell {
  min-width: 0;
  display: flex;
}

.wheels-gallery__cell > .wheel-card {
  flex: 1;
  align-self: stretch;
}

.wheel-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px 10px 12px;
  border-radius: var(--radius-md);
  background: var(--color-bg-input);
  border: 2px solid rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.18s ease,
    background-color 0.16s ease,
    transform 0.14s ease;
}

.wheel-card:hover {
  border-color: rgba(0, 0, 0, 0.32);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
}

.wheel-card:active {
  transform: scale(0.985);
}

.wheel-card:focus {
  outline: none;
}

.wheel-card:focus-visible {
  border-color: var(--color-border);
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.18);
}

.wheel-card--selected {
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.12), 0 8px 22px rgba(0, 0, 0, 0.12);
}

.wheel-card--selected:hover {
  border-color: var(--color-border);
  box-shadow: 0 0 0 1px rgba(26, 26, 26, 0.16), 0 10px 26px rgba(0, 0, 0, 0.14);
}

.wheel-card__media {
  position: relative;
  width: 78%;
  max-width: 120px;
  margin: 4px auto 8px;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.wheel-card__img {
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: center;
}

.wheel-card__brand {
  margin: 0;
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  color: var(--color-text);
}

/* Reserve buy strip height on every card (with or without link, hidden until selected). */
.wheel-card__footer {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 10px;
  /* ~ padded “Buy now” chip so cards match with link hidden vs visible */
  min-height: 50px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
}

a.wheel-card__buy {
  display: none;
  width: 100%;
  margin-top: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  box-sizing: border-box;
  color: #fff;
  background: var(--color-border);
  border: none;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

a.wheel-card__buy:hover {
  filter: brightness(1.06);
}

a.wheel-card__buy:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.wheel-card--selected .wheel-card__buy {
  display: block;
}

/* --- Step 6: Feedback modal (§6.3) --- */

.feedback-modal {
  padding: 0;
  border: none;
  max-width: calc(100vw - 2 * var(--space-page));
  width: min(440px, 100%);
  background: transparent;
}

.feedback-modal::backdrop {
  background: rgba(26, 26, 26, 0.42);
}

.feedback-modal__panel {
  box-sizing: border-box;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  background: var(--color-bg-input);
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.22);
  max-height: min(90dvh, 640px);
  overflow-y: auto;
}

.feedback-modal__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feedback-modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text);
}

.feedback-modal__helper {
  margin: 10px 0 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
  color: var(--color-text-muted);
}

.feedback-modal__icon-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px -8px 0 0;
  padding: 0;
  color: var(--color-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.feedback-modal__icon-btn:hover {
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.6);
}

.feedback-modal__icon-btn:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.feedback-modal__form {
  margin-top: 16px;
}

.feedback-modal__field + .feedback-modal__field {
  margin-top: 12px;
}

.feedback-modal__label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.feedback-modal__input,
.feedback-modal__textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin: 0;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  color: var(--color-text);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: var(--radius-md);
}

.feedback-modal__textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-modal__input:focus-visible,
.feedback-modal__textarea:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.feedback-modal__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn--feedback-secondary {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.btn--feedback-secondary:hover {
  background: #f3f3f3;
}

.btn--feedback-secondary:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.btn--feedback-submit {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  color: #fff;
  background: var(--color-border);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.btn--feedback-submit:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn--feedback-submit:focus-visible {
  outline: 2px solid var(--color-border);
  outline-offset: 2px;
}

.btn--feedback-submit:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.site-logo-link {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
