/* Base: reset, page, shared components. Needs tokens.css first.
   Component list and intent: docs/design-plan.md, "Components". */

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
[hidden] { display: none !important; }
img, svg, canvas, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
h1, h2, h3, h4, p, li { overflow-wrap: break-word; }

/* ---------- page ---------- */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  accent-color: var(--c-sodium);
  scrollbar-color: var(--c-line-strong) transparent;
}
body {
  min-height: 100vh;
  font-family: var(--f-text);
  font-size: var(--t-3);
  line-height: var(--lh-text);
  color: var(--c-chalk);
  background-color: var(--c-asphalt);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--c-sodium); color: var(--c-asphalt); }

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: 750;
  font-stretch: 110%;
  line-height: var(--lh-snug);
}
h1 { font-size: var(--t-5); font-weight: var(--wt-heavy); font-stretch: 120%; line-height: var(--lh-tight); }
h2 { font-size: var(--t-4); }
h3 { font-size: var(--t-3); font-stretch: var(--w-normal); font-weight: var(--wt-bold); }
p { max-width: var(--measure); }

/* Quiet display text: condensed and light, the other end of the weight contrast. */
.quiet {
  font-family: var(--f-display);
  font-stretch: var(--w-narrow);
  font-weight: var(--wt-light);
  color: var(--c-chrome);
}
.muted { color: var(--c-chrome); }

/* Every number: prices, stats, totals, pin numbers. */
.num {
  font-family: var(--f-num);
  font-variant-numeric: var(--f-num-features);
  font-feature-settings: "tnum" 1, "zero" 1;
  letter-spacing: 0;
}
.delta--gain { color: var(--c-seaglass); }
.delta--loss { color: var(--c-chrome); }

.link {
  color: var(--c-chalk);
  text-decoration: underline;
  text-decoration-color: var(--c-sodium);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease);
}
.link:hover { color: var(--c-sodium); }

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

/* ---------- focus ring ---------- */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
:focus:not(:focus-visible) { outline: none; }

/* Page heading and vehicle metadata. */
.sunstrip {
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  padding: var(--s-5);
}
.sunstrip__title {
  flex: 1;
  min-width: 0;
  font-size: var(--t-6);
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: -.025em;
}
.sunstrip__meta {
  flex: none;
  display: flex;
  align-items: baseline;
  gap: var(--s-4);
  font-size: var(--t-3);
  font-weight: var(--wt-bold);
}

/* Content under the sun strip follows it in, staggered by --i. */
.reveal {
  animation: rise var(--dur-slow) var(--ease) both;

}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 2.5rem;
  padding: 0 var(--s-4);
  font-family: var(--f-display);
  font-size: var(--t-2);
  font-stretch: 112%;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  color: var(--c-chalk);
  background: transparent;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-control);
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:hover { border-color: var(--c-chrome); background: var(--c-raised); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn--primary { border-radius: var(--r-pill); color: var(--c-asphalt); background: var(--c-sodium); border-color: var(--c-sodium); }
.btn--primary:hover { background: color-mix(in oklab, var(--c-sodium) 82%, var(--c-chalk)); border-color: transparent; }
.btn--ghost { border-color: transparent; }
.btn--ghost:hover { border-color: transparent; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---------- inputs ---------- */
.input {
  width: 100%;
  min-height: 2.75rem;
  padding: 0 var(--s-3);
  font-family: var(--f-text);
  font-size: var(--t-3);
  color: var(--c-chalk);
  background: var(--c-raised);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-control);
  transition: border-color var(--dur) var(--ease);
}
.input::placeholder { color: var(--c-chrome); opacity: 1; }
.input:hover { border-color: var(--c-chrome); }

/* ---------- chips (filters; radio or toggle) ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0 var(--s-4);
  font-family: var(--f-display);
  font-size: var(--t-2);
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  color: var(--c-chrome);
  background: transparent;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-control);
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.chip:hover { color: var(--c-chalk); border-color: var(--c-chrome); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  color: var(--c-sodium);
  border-color: var(--c-sodium);
  background: var(--c-sodium-tint);
}

/* ---------- badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0.12em 0.55em;
  font-family: var(--f-display);
  font-size: var(--t-1);
  font-stretch: 110%;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--c-chrome);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-control);
}
/* Exclusive parts use a lilac tonal badge. */
.badge--exclusive {
  color: var(--c-tube);
  font-weight: var(--wt-bold);
  border-color: transparent;
  background: light-dark(#efe5fa, #40314e);
}

/* ---------- tabs ---------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--c-line);
}
.tab {
  position: relative;
  flex: 1 1 0;
  min-height: 2.75rem;
  padding: var(--s-2) var(--s-2);
  font-family: var(--f-display);
  font-size: var(--t-2);
  font-stretch: 92%;
  font-weight: 600;
  color: var(--c-chrome);
  background: none;
  border: 0;
  transition: color var(--dur) var(--ease);
}
.tab:hover { color: var(--c-chalk); }
.tab[aria-selected="true"] { color: var(--c-chalk); }
/* The light strip under the active tab, echoing the garage wall strips. */
.tab::after {
  content: "";
  position: absolute;
  left: var(--s-2);
  right: var(--s-2);
  bottom: -1px;
  height: 3px;
  border-radius: 2px;
  background: var(--c-sodium);
  transform: scaleX(0);
  transition: transform var(--dur) var(--ease);
}
.tab[aria-selected="true"]::after { transform: scaleX(1); }

/* ---------- accordion ---------- */
.acc { border-bottom: 1px solid var(--c-line); }
.acc-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 3rem;
  padding: var(--s-2) var(--s-4);
  font-family: var(--f-text);
  font-size: var(--t-3);
  font-weight: 500;
  text-align: left;
  color: var(--c-chalk);
  background: none;
  border: 0;
  transition: background-color var(--dur) var(--ease);
}
.acc-head:hover { background: var(--c-raised); }
.acc-head::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  margin-inline: 0.1em 0.15em;
  border-right: 2px solid var(--c-chrome);
  border-bottom: 2px solid var(--c-chrome);
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}
.acc-head[aria-expanded="true"]::before { transform: rotate(45deg); }
.acc-pick {
  font-size: var(--t-2);
  font-weight: var(--wt-regular);
  color: var(--c-chrome);
  text-align: right;
}
.acc-head[aria-expanded="true"] .acc-pick { color: var(--c-sodium); }
.acc-body { padding-bottom: var(--s-2); }

/* ---------- option row (inside an accordion) ---------- */
.option {
  display: grid;
  grid-template-columns: 1rem 1fr auto;
  align-items: baseline;
  column-gap: var(--s-3);
  row-gap: 2px;
  width: 100%;
  padding: var(--s-2) var(--s-4) var(--s-2) calc(var(--s-4) - 3px);
  font-family: var(--f-text);
  font-size: var(--t-2);
  text-align: left;
  color: var(--c-chalk);
  background: none;
  border: 0;
  border-left: 3px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.option:hover { background: var(--c-raised); }
/* The radio dot. */
.option::before {
  content: "";
  align-self: center;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 1.5px solid var(--c-chrome);
  transition: background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.option[aria-checked="true"] { border-left-color: var(--c-sodium); background: var(--c-raised); }
.option[aria-checked="true"]::before {
  border-color: var(--c-sodium);
  background: var(--c-sodium);
  box-shadow: inset 0 0 0 2px var(--c-raised);
  animation: click var(--dur) var(--ease);
}
@keyframes click {
  50% { transform: scale(1.3); }
}
.option__name { font-weight: 500; }
.option__price { justify-self: end; }
.option__meta {
  grid-column: 2 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-1) var(--s-3);
  font-size: var(--t-1);
  color: var(--c-chrome);
}

/* ---------- popover ---------- */
.popover {
  min-width: 12rem;
  max-width: min(20rem, calc(100vw - 2 * var(--s-3)));
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-2);
  color: var(--c-chalk);
  background: var(--c-raised-2);
  border: 0;
  border-radius: var(--r-container);
  box-shadow: var(--shadow-float);
}
.popover[popover] { margin: 0; inset: auto; position: fixed; }
.popover__title {
  margin-bottom: var(--s-2);
  font-family: var(--f-display);
  font-size: var(--t-2);
  font-weight: var(--wt-bold);
}
.popover ul { padding: 0; list-style: none; display: grid; gap: var(--s-1); }

/* ---------- toast ---------- */
.toast-region {
  position: fixed;
  left: var(--s-5);
  bottom: var(--s-5);
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-2);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  max-width: 26rem;
  padding: var(--s-3) var(--s-4);
  font-size: var(--t-2);
  color: var(--c-chalk);
  background: var(--c-raised-2);
  border-left: 3px solid var(--c-sodium);
  border-radius: var(--r-container);
  box-shadow: var(--shadow-float);
  animation: rise var(--dur-slow) var(--ease) both;
}

/* ---------- phone ---------- */
@media (max-width: 640px) {
  /* The strip keeps the title on one line; the meta drops below it. */
  .sunstrip { flex-wrap: wrap; row-gap: 0; padding: var(--s-4); }
  .sunstrip__title { flex-basis: 100%; font-size: 1.75rem; }
  .sunstrip__meta { font-size: var(--t-2); gap: var(--s-3); }
  .toast-region { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); align-items: stretch; }
  .toast { max-width: none; }
}
@media (pointer: coarse) {
  .btn { min-height: 2.75rem; }
  .chip { min-height: 2.75rem; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0ms !important;
    scroll-behavior: auto !important;
  }
}
