/* ==========================================================================
   DriveLab — style.css
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --ink: #07090c;
  --studio: #11151a;
  --steel: #1b2027;
  --panel: rgba(13, 16, 20, 0.74);
  --line: rgba(230, 224, 214, 0.12);
  --line-strong: rgba(230, 224, 214, 0.24);
  --text: #ece7de;
  --muted: #9aa1aa;
  --brass: #cdb48a;
  --brass-hi: #e4d1ab;
  --brass-ink: #17130c;

  --font: 'Archivo', 'Helvetica Neue', Arial, system-ui, sans-serif;
  --wide: 125%;
  --semi: 112%;

  --topbar: 72px;
  --panel-w: 384px;
  --gutter: clamp(20px, 4.5vw, 72px);
  --radius-lg: 18px;
  --radius: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(120% 70% at 50% 18%, #232a33 0%, rgba(23, 28, 34, 0.6) 38%, transparent 70%),
    radial-gradient(80% 50% at 50% 100%, #0d1014 0%, transparent 70%),
    var(--ink);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
dl,
dd,
ul,
ol {
  margin: 0;
}

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

a {
  color: inherit;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

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

svg {
  display: block;
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 6px;
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--brass);
  color: var(--brass-ink);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform 0.2s;
}

.skip-link:focus {
  transform: none;
}

.wordmark {
  font-stretch: var(--wide);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark span {
  color: var(--brass);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  font-size: 0.95rem;
  font-weight: 560;
  font-stretch: var(--semi);
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.25s, border-color 0.25s, color 0.25s, transform 0.25s var(--ease);
}

.btn:active {
  transform: scale(0.98);
}

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

.btn--primary:hover {
  background: var(--brass-hi);
}

.btn--ghost {
  border-color: var(--line-strong);
}

.btn--ghost:hover {
  border-color: var(--text);
}

.btn--text {
  padding: 0 6px;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 5px;
}

.btn--text:hover {
  text-decoration-color: var(--brass);
}

.btn--quiet {
  min-height: 34px;
  padding: 0 14px;
  border-color: var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

.btn--quiet:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.btn--block {
  width: 100%;
}

/* ---------- Loader & fallback ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--ink);
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}

.loader.is-done {
  opacity: 0;
  visibility: hidden;
}

.loader__inner {
  width: min(280px, 70vw);
  text-align: center;
}

.loader .wordmark {
  display: block;
  font-size: 1.3rem;
  margin-bottom: 22px;
}

.loader__track {
  height: 1px;
  background: var(--line);
  overflow: hidden;
}

.loader__track span {
  display: block;
  height: 100%;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.5s var(--ease);
}

.loader__status {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.85rem;
}

.fallback {
  position: fixed;
  top: 50%;
  left: var(--gutter);
  right: calc(var(--panel-w) + 48px);
  z-index: 2;
  max-width: 34rem;
  margin-inline: auto;
  padding: 20px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
  transform: translateY(-50%);
}

.noscript {
  padding: 40px var(--gutter);
}

/* ---------- Stage ---------- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
  cursor: grab;
  outline: none;
}

.stage:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: -6px;
  border-radius: 0;
}

.stage.is-pickable {
  cursor: pointer;
}

.stage.is-dragging {
  cursor: grabbing;
}

.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 6;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(236, 231, 222, 0.94);
  color: var(--brass-ink);
  font-size: 0.8rem;
  font-weight: 560;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
}

.tooltip.is-visible {
  opacity: 1;
}

.stage-controls {
  position: fixed;
  bottom: 24px;
  left: calc((100vw - var(--panel-w) - 40px) / 2);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transform: translateX(-50%);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), visibility 0.5s;
}

.stage-controls button {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  transition: background-color 0.2s, color 0.2s;
}

.stage-controls button:hover {
  background: rgba(230, 224, 214, 0.08);
  color: var(--text);
}

.stage-controls svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stage-controls__reset {
  padding: 0 14px !important;
  font-size: 0.82rem;
}

/* ---------- Hotspots ---------- */
.hotspots {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s var(--ease);
}

body[data-section='performance'] .hotspots {
  opacity: 1;
}

.hotspot {
  position: absolute;
  top: 0;
  left: 0;
  transition: opacity 0.3s;
}

.hotspot.is-hidden {
  opacity: 0;
}

.hotspot__dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 1.5px solid var(--brass);
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(205, 180, 138, 0.14);
}

.hotspot__card {
  position: absolute;
  left: 18px;
  top: -44px;
  display: grid;
  gap: 1px;
  width: max-content;
  max-width: 220px;
  padding: 8px 12px 9px;
  border-left: 1px solid var(--brass);
  background: linear-gradient(90deg, rgba(8, 10, 13, 0.78), rgba(8, 10, 13, 0));
  font-size: 0.78rem;
  color: var(--muted);
}

.hotspot__card strong {
  color: var(--text);
  font-weight: 560;
  font-size: 0.86rem;
}

/* ---------- Top bar ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--topbar);
  padding: 0 var(--gutter);
  background: linear-gradient(180deg, rgba(7, 9, 12, 0.7), rgba(7, 9, 12, 0));
}

.vehicle-switch {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 16, 20, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.vehicle-switch label {
  position: relative;
}

.vehicle-switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.vehicle-switch span {
  display: block;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 560;
  font-stretch: var(--semi);
  color: var(--muted);
  transition: background-color 0.3s var(--ease), color 0.3s;
}

.vehicle-switch input:checked + span {
  background: var(--text);
  color: var(--ink);
}

.vehicle-switch input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.is-switching .vehicle-switch {
  pointer-events: none;
  opacity: 0.7;
}

.progress {
  justify-self: end;
}

.progress ol {
  display: flex;
  gap: 4px;
}

.progress a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.3s;
}

.progress__n {
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  opacity: 0.7;
}

.progress__t {
  display: none;
}

.progress a[aria-current] {
  color: var(--text);
}

.progress a[aria-current] .progress__t {
  display: inline;
}

.progress a[aria-current] .progress__n {
  color: var(--brass);
  opacity: 1;
}

.progress a:hover {
  color: var(--text);
}

/* ---------- Configurator panel ---------- */
.config {
  position: fixed;
  top: calc(var(--topbar) + 8px);
  right: 20px;
  bottom: 20px;
  z-index: 10;
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  transition: transform 0.7s var(--ease), opacity 0.5s var(--ease), visibility 0.7s, border-color 0.6s, box-shadow 0.6s;
}

body[data-section='design'] .config,
body[data-section='performance'] .config,
body[data-section='final'] .config {
  transform: translateX(calc(100% + 40px));
  opacity: 0;
  visibility: hidden;
}

body[data-section='design'] .stage-controls,
body[data-section='performance'] .stage-controls,
body[data-section='final'] .stage-controls {
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 12px);
}

body[data-section='configure'] .config {
  border-color: rgba(205, 180, 138, 0.45);
  box-shadow: 0 0 0 6px rgba(205, 180, 138, 0.06), 0 30px 80px -30px rgba(0, 0, 0, 0.8);
}

.config__sheet-toggle {
  display: none;
}

.config__main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.config__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 14px;
}

.config__model {
  font-size: 1.35rem;
  line-height: 1.1;
  font-weight: 540;
  font-stretch: var(--wide);
  letter-spacing: -0.01em;
}

.config__kind {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.config__tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin: 0 22px;
  border-bottom: 1px solid var(--line);
}

.config__tabs [role='tab'] {
  position: relative;
  padding: 10px 2px 12px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 540;
  transition: color 0.2s;
}

.config__tabs [role='tab']::after {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1px;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transition: transform 0.4s var(--ease);
}

.config__tabs [role='tab'][aria-selected='true'] {
  color: var(--text);
}

.config__tabs [role='tab'][aria-selected='true']::after {
  transform: scaleX(1);
}

.config__tabs [role='tab']:hover {
  color: var(--text);
}

.config__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 22px 18px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.config__body [role='tabpanel']:focus-visible {
  outline-offset: 4px;
}

.cfg-group {
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
  border-radius: 8px;
}

.cfg-group:last-child {
  border-bottom: 0;
}

.cfg-group.is-flash {
  animation: flash 1.2s var(--ease);
}

@keyframes flash {
  0% {
    background: rgba(205, 180, 138, 0.16);
    box-shadow: 0 0 0 10px rgba(205, 180, 138, 0.16);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 10px transparent;
  }
}

.cfg-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 560;
}

.cfg-group__value,
.cfg-group__head output {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.82rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cfg-group__value em {
  font-style: normal;
  color: var(--brass);
  margin-left: 4px;
}

/* Shared hidden-input pattern (keeps native keyboard behaviour) */
.swatch,
.thumb,
.seg,
.toggle {
  position: relative;
  cursor: pointer;
}

.swatch input,
.thumb input,
.seg input,
.toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* Swatches */
.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch__chip {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background:
    radial-gradient(60% 50% at 35% 28%, rgba(255, 255, 255, 0.38), transparent 70%),
    linear-gradient(135deg, var(--c1) 50%, var(--c2) 50%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 -6px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}

.swatch:hover .swatch__chip {
  transform: scale(1.06);
}

.swatch input:checked + .swatch__chip {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 0 0 3px var(--ink), 0 0 0 4.5px var(--brass);
}

.swatch input:focus-visible + .swatch__chip {
  outline: 2px solid var(--text);
  outline-offset: 6px;
}

/* Thumbnails */
.thumbs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.thumb {
  display: grid;
  grid-template-columns: 40px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s, background-color 0.25s;
}

.thumb:hover {
  border-color: var(--line-strong);
}

.thumb__icon {
  grid-row: 1 / 3;
  width: 40px;
  height: 40px;
  color: var(--muted);
  transition: color 0.25s;
}

.thumb__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.thumb__name {
  font-size: 0.82rem;
  font-weight: 540;
  line-height: 1.2;
}

.thumb__price {
  font-size: 0.74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.thumb:has(input:checked) {
  border-color: rgba(205, 180, 138, 0.7);
  background: rgba(205, 180, 138, 0.07);
}

.thumb:has(input:checked) .thumb__icon {
  color: var(--brass);
}

.thumb:has(input:focus-visible) {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* Segmented */
.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg {
  flex: 1;
}

.seg span {
  display: block;
  padding: 7px 4px;
  border-radius: 999px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  transition: background-color 0.3s var(--ease), color 0.3s;
}

.seg:hover span {
  color: var(--text);
}

.seg input:checked + span {
  background: var(--text);
  color: var(--ink);
  font-weight: 560;
}

.seg input:focus-visible + span {
  outline: 2px solid var(--brass);
  outline-offset: 1px;
}

/* Range */
.range {
  --fill: 50%;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brass) var(--fill), var(--line-strong) var(--fill));
}

.range::-moz-range-track {
  height: 2px;
  background: var(--line-strong);
}

.range::-moz-range-progress {
  height: 2px;
  background: var(--brass);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--text);
  box-shadow: 0 0 0 4px rgba(205, 180, 138, 0.18);
}

.range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--text);
}

.range:focus-visible {
  outline: none;
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--brass);
}

.range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px var(--ink), 0 0 0 5px var(--brass);
}

/* Toggles */
.toggles {
  display: grid;
  gap: 6px;
}

.toggle {
  display: grid;
  grid-template-columns: 1fr auto 34px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.25s, background-color 0.25s;
}

.toggle:hover {
  border-color: var(--line-strong);
}

.toggle__text {
  display: grid;
  line-height: 1.3;
}

.toggle__name {
  font-size: 0.86rem;
  font-weight: 540;
}

.toggle__detail {
  font-size: 0.75rem;
  color: var(--muted);
}

.toggle__price {
  font-size: 0.76rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.toggle__switch {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--steel);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  transition: background-color 0.3s;
}

.toggle__switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.35s var(--ease), background-color 0.3s;
}

.toggle:has(input:checked) {
  border-color: rgba(205, 180, 138, 0.6);
  background: rgba(205, 180, 138, 0.06);
}

.toggle input:checked ~ .toggle__switch {
  background: var(--brass);
}

.toggle input:checked ~ .toggle__switch::after {
  transform: translateX(14px);
  background: var(--brass-ink);
}

.toggle:has(input:focus-visible) {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* Footer */
.config__foot {
  display: grid;
  gap: 12px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--line);
}

.config__summary summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.84rem;
  cursor: pointer;
  list-style: none;
  border-radius: 6px;
}

.config__summary summary::-webkit-details-marker {
  display: none;
}

.config__summary summary::after {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s var(--ease);
}

.config__summary[open] summary::after {
  transform: rotate(-135deg);
}

.config__summary summary:hover {
  color: var(--text);
}

.config__summary dl {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  margin-top: 10px;
  font-size: 0.8rem;
}

.config__summary dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.config__summary dt {
  color: var(--muted);
}

.config__summary dd {
  text-align: right;
}

.config__price {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.config__price > span {
  display: grid;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.3;
}

.config__price small {
  font-size: 0.74rem;
  opacity: 0.8;
}

.config__price strong,
.build-sheet__price strong {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 500;
  font-stretch: var(--wide);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

/* ---------- Story ---------- */
.story {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.story a,
.story button,
.story details,
.story .build-sheet {
  pointer-events: auto;
}

.chapter {
  position: relative;
  display: flow-root;
  padding: 0 var(--gutter);
}

.chapter h2 {
  max-width: 18ch;
  font-size: clamp(2rem, 3.4vw, 3.4rem);
  line-height: 1.02;
  font-weight: 460;
  font-stretch: var(--wide);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.chapter p {
  max-width: 42ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.chapter h2 + p {
  margin-top: 18px;
}

.chapter__index {
  margin-bottom: 18px;
  color: var(--brass) !important;
  font-size: 0.85rem !important;
  font-variant-numeric: tabular-nums;
}

.chapter__content {
  position: sticky;
  top: 30vh;
  max-width: 30rem;
  padding: 28px 0;
  opacity: 0.2;
  transition: opacity 0.8s var(--ease);
}

.chapter__content--right {
  margin-left: auto;
}

body[data-section='design'] #design .chapter__content,
body[data-section='performance'] #performance .chapter__content,
body[data-section='configure'] #configure .chapter__content {
  opacity: 1;
}

.chapter--intro {
  height: 100vh;
  min-height: 640px;
}

.chapter--design {
  height: 170vh;
}

.chapter--performance {
  height: 180vh;
}

.chapter--configure {
  height: 170vh;
}

.chapter--final {
  height: 160vh;
  display: flex;
  align-items: flex-end;
  padding-bottom: 40px;
}

/* Hero */
.hero {
  position: absolute;
  top: 50%;
  left: var(--gutter);
  width: min(30rem, 31vw);
  transform: translateY(-54%);
}

.hero__label {
  margin-bottom: 20px;
  color: var(--brass);
  font-size: 0.9rem;
}

.hero__title {
  font-size: clamp(2.6rem, 4.6vw, 4.9rem);
  line-height: 0.96;
  font-weight: 420;
  font-stretch: var(--wide);
  letter-spacing: -0.035em;
}

.hero__title .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
}

.hero__title .line > span {
  display: block;
}

.hero__lede {
  margin-top: 22px;
  max-width: 34ch;
  color: var(--muted);
  font-size: 1.02rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-top: 30px;
}

.hero__specs,
.stats {
  display: flex;
  gap: clamp(20px, 3vw, 44px);
}

.hero__specs {
  position: absolute;
  left: var(--gutter);
  bottom: 34px;
}

.hero__specs div,
.stats div {
  display: flex;
  flex-direction: column-reverse;
}

.hero__specs dt,
.stats dt {
  color: var(--muted);
  font-size: 0.78rem;
}

.hero__specs dd,
.stats dd {
  font-size: 1.3rem;
  font-weight: 480;
  font-stretch: var(--wide);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

.stats {
  margin-top: 30px;
}

.hero__hint {
  position: fixed;
  left: calc((100vw - var(--panel-w) - 40px) / 2);
  bottom: 94px;
  z-index: 4;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
  transition: opacity 0.5s;
}

body:not([data-section='intro']) .hero__hint {
  opacity: 0;
}

/* Performance list */
.detail-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}

.detail-list li {
  display: grid;
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
  font-size: 0.9rem;
}

.detail-list strong {
  font-weight: 540;
}

.detail-list span {
  color: var(--muted);
}

/* Final build sheet */
.build-sheet {
  position: sticky;
  bottom: 28px;
  display: grid;
  grid-template-columns: minmax(200px, 0.8fr) 2fr minmax(260px, 1fr);
  gap: 32px;
  width: 100%;
  padding: 26px 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

body[data-section='final'] .build-sheet {
  opacity: 1;
  transform: none;
}

.build-sheet h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
}

.build-sheet .chapter__index {
  margin-bottom: 10px;
}

.build-sheet__kind {
  margin-top: 6px;
  font-size: 0.9rem !important;
}

.build-sheet__list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 24px;
  align-content: start;
  font-size: 0.82rem;
}

.build-sheet__list dt {
  color: var(--muted);
  font-size: 0.74rem;
}

.build-sheet__list dd {
  overflow-wrap: anywhere;
}

.build-sheet__foot {
  display: grid;
  align-content: space-between;
  gap: 20px;
}

.build-sheet__price {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.build-sheet__price strong {
  color: var(--text);
  font-size: 2rem;
}

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

.site-foot {
  position: relative;
  z-index: 2;
  padding: 28px var(--gutter) 40px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
  background: var(--ink);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 40;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--text);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 540;
  opacity: 0;
  transform: translate(-50%, 16px);
  pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.no-webgl .stage-controls,
body.no-webgl .hero__hint {
  display: none;
}

/* ---------- Tablet ---------- */
@media (max-width: 1180px) {
  :root {
    --panel-w: 340px;
  }

  .hero {
    width: min(26rem, 36vw);
  }

  .hero__title {
    font-size: clamp(2.3rem, 4.4vw, 3.4rem);
  }

  .hero__hint {
    display: none;
  }

  .progress__t,
  .progress a[aria-current] .progress__t {
    display: none;
  }

  .build-sheet {
    grid-template-columns: 1fr 1fr;
  }

  .build-sheet__list {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .build-sheet__foot {
    grid-row: 1;
    grid-column: 2;
  }
}

/* ---------- Mobile (bottom sheet) ---------- */
@media (max-width: 899px) {
  :root {
    --topbar: 60px;
    --gutter: 18px;
  }

  .topbar {
    grid-template-columns: auto 1fr;
    gap: 12px;
  }

  .vehicle-switch {
    justify-self: end;
  }

  .vehicle-switch span {
    padding: 6px 13px;
    font-size: 0.8rem;
  }

  .progress {
    display: none;
  }

  .stage-controls {
    display: none;
  }

  .config {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 72svh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }

  body[data-section='design'] .config,
  body[data-section='performance'] .config,
  body[data-section='final'] .config {
    transform: translateY(110%);
  }

  .config__sheet-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 60px;
    padding: 0 20px;
    border: 0;
    background: none;
    font-size: 0.92rem;
    font-weight: 540;
  }

  .config__sheet-toggle span {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .config__sheet-toggle span::before {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-135deg) translate(-2px, -2px);
    transition: transform 0.3s var(--ease);
  }

  .config.is-open .config__sheet-toggle span::before {
    transform: rotate(45deg);
  }

  .config__sheet-toggle strong {
    font-stretch: var(--wide);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
  }

  .config__main {
    display: none;
  }

  .config.is-open .config__main {
    display: flex;
    height: calc(72svh - 60px);
  }

  .config__head {
    padding-top: 4px;
  }

  .config__price {
    display: none;
  }

  .config__tabs,
  .config__body,
  .config__head,
  .config__foot {
    margin-inline: 0;
  }

  .config__tabs {
    margin: 0 20px;
  }

  .config__body {
    padding-inline: 20px;
  }

  .thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chapter--intro {
    min-height: 560px;
  }

  .hero {
    top: auto;
    bottom: 96px;
    left: var(--gutter);
    right: var(--gutter);
    width: auto;
    transform: none;
  }

  .hero__label {
    margin-bottom: 10px;
  }

  .hero__title {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }

  .hero__lede {
    margin-top: 12px;
    font-size: 0.94rem;
  }

  .hero__cta {
    margin-top: 18px;
  }

  .hero__specs {
    display: none;
  }

  .chapter__content {
    top: auto;
    position: sticky;
    bottom: 0;
    margin-top: 58vh;
    max-width: none;
    padding: 24px 0 36px;
    background: linear-gradient(180deg, transparent, rgba(7, 9, 12, 0.85) 30%);
  }

  .chapter__content--right {
    margin-left: 0;
  }

  .chapter h2 {
    font-size: clamp(1.7rem, 7.4vw, 2.3rem);
  }

  .chapter p {
    font-size: 0.95rem;
  }

  #configure .chapter__content {
    margin-top: 8vh;
    background: none;
  }

  .chapter--final {
    padding-bottom: 20px;
  }

  .build-sheet {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 18px 18px;
    bottom: 12px;
  }

  .build-sheet__list {
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 16px;
    font-size: 0.76rem;
  }

  .build-sheet__list dt {
    font-size: 0.68rem;
  }

  .build-sheet .chapter__index,
  .build-sheet__kind {
    display: none;
  }

  .build-sheet__price strong {
    font-size: 1.6rem;
  }

  .build-sheet__actions .btn {
    min-height: 42px;
    padding: 0 16px;
  }

  .build-sheet__foot {
    grid-row: auto;
    grid-column: auto;
  }

  .fallback {
    left: var(--gutter);
    right: var(--gutter);
    top: 30%;
  }

  .hotspot__card {
    max-width: 150px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
