/*
  Design notes (one reason for each decision).
  Palette: cool studio grey, white, near-black, and one blue. The blue is the paint of the car.
  Type: Instrument Sans, a tight grotesque that stays clear at display size.
        Courier Prime for labels, because it reads like a workshop job ticket.
  Motif: the tick scale between sections. It is the scale of a paint-depth gauge.
  Radius: 6px for controls, 14px for cards. Full round only for the nav button and one image.
  Theme: light only. The page is a white photo studio for a dark car.
*/

:root {
  --bg: #e9edf0;
  --surface: #ffffff;
  --ink: #101113;
  --ink-2: #4a5057;
  --soft: #868c93;
  --line: #cfd6db;
  --accent: #1447c8;
  --dark: #141516;
  --on-dark: #f3f4f5;
  --on-dark-2: #a9afb5;
  --gutter: clamp(1rem, 4vw, 3.5rem);
  --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Courier Prime', 'Courier New', monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.45;
  overflow-x: clip;
}

h1,
h2,
h3,
p,
ol,
figure,
fieldset {
  margin: 0;
  padding: 0;
}

ol {
  list-style: none;
}

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

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
}

button,
a,
summary,
label,
input[type='radio'] {
  cursor: pointer;
}

button:disabled,
input:disabled,
input:disabled + span {
  cursor: not-allowed;
}

button {
  font: inherit;
  color: inherit;
}

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

h1,
h2 {
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.5rem, 5.2vw, 5rem);
}

h2 {
  font-size: clamp(2rem, 3.7vw, 3.4rem);
}

.soft {
  color: var(--soft);
}

.mono,
.label {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.35;
  text-transform: uppercase;
  color: var(--ink-2);
}

.label {
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.label__mark {
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px var(--bg), inset 0 0 0 10px currentColor;
}

.wrap {
  max-width: 90rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1rem;
  border-radius: 6px;
}

.skip:focus {
  top: 0.5rem;
}

/* Tick scale divider. */
.ticks {
  height: 1.1rem;
  color: var(--ink);
  opacity: 0.32;
  background: repeating-linear-gradient(90deg, currentColor 0 1px, transparent 1px 7px);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent);
}

/* ---------- buttons ---------- */

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}

.button--light {
  background: #fff;
  color: var(--ink);
}

.button--light:hover {
  background: var(--ink);
  color: #fff;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled {
  opacity: 0.55;
}

.link-button {
  background: none;
  border: 0;
  padding: 0.75rem 0;
  min-height: 2.75rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  color: var(--ink);
}

.link-button:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

.link-button:active {
  color: var(--ink-2);
}

/* ---------- header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  max-width: 90rem;
  margin-inline: auto;
  padding: 0.75rem var(--gutter);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  text-decoration: none;
}

.menu-button {
  min-height: 2.75rem;
  padding: 0 1rem;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 6px;
  font-size: 0.9375rem;
}

.menu-button:hover {
  background: var(--ink);
  color: #fff;
}

.menu-button[aria-expanded='true'] {
  background: var(--ink);
  color: #fff;
}

.site-nav {
  display: none;
  flex-basis: 100%;
  flex-direction: column;
  padding-bottom: 0.5rem;
}

.site-nav[data-open='true'] {
  display: flex;
}

.site-nav a {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.85rem;
  border-radius: 6px;
  font-size: 0.9375rem;
  text-decoration: none;
}

.site-nav a:hover {
  background: #fff;
}

.site-nav a:active {
  background: var(--line);
}

.site-nav a[aria-current='true'] {
  background: #d9dfe4;
}

.site-nav .site-nav__cta {
  background: var(--ink);
  color: #fff;
  justify-content: center;
  margin-top: 0.5rem;
}

.site-nav .site-nav__cta:hover {
  background: var(--accent);
}

.site-nav .site-nav__cta:focus-visible {
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .menu-button {
    display: none;
  }

  .site-nav,
  .site-nav[data-open] {
    display: flex;
    flex-basis: auto;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
    padding: 0;
  }

  .site-nav .site-nav__cta {
    margin: 0 0 0 1rem;
    padding-inline: 1.2rem;
    border-radius: 999px;
  }
}

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

.hero {
  max-width: 90rem;
  margin-inline: auto;
}

.hero__stage {
  position: relative;
  display: flex;
  flex-direction: column;
  /* A soft pool of light under the car. It gives the car a floor to stand on. */
  background: radial-gradient(ellipse 70% 45% at 50% 82%, #f8fafb 0%, #e9edf0 70%);
}

.hero__copy {
  padding: 2rem var(--gutter) 0;
  display: grid;
  gap: 1.25rem;
}

.hero__label {
  display: block;
}

.hero__headline {
  display: grid;
  gap: 1rem;
  max-width: 34rem;
}

.hero__sub {
  max-width: 26rem;
}

.hero__hint {
  color: var(--ink);
  padding: 0 var(--gutter) 1rem;
}

.stage {
  position: relative;
  height: clamp(17rem, 72vw, 30rem);
}

#car-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

#car-canvas:active {
  cursor: grabbing;
}

.stage[data-state='loading'] #car-canvas,
.stage[data-state='error'] #car-canvas {
  visibility: hidden;
}

.stage__status {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  pointer-events: none;
}

.stage[data-state='ready'] .stage__status {
  display: none;
}

.stage[data-state='error'] .stage__status {
  color: var(--ink);
  border: 1px dashed var(--ink-2);
  margin: 1rem var(--gutter);
  border-radius: 14px;
}

.tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 3;
  padding: 0.35rem 0.6rem;
  background: var(--ink);
  color: #fff;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.hero__card {
  margin: 0 var(--gutter) 1.25rem;
  padding: 1.1rem 1.1rem 1.2rem;
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  /* One corner is cut, like a parts tag. */
  clip-path: polygon(0 0, calc(100% - 1.6rem) 0, 100% 1.6rem, 100% 100%, 0 100%);
  display: grid;
  gap: 0.9rem;
  justify-items: start;
}

.hero__card p {
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.hero__card :focus-visible {
  outline-color: #fff;
}

.dock {
  display: grid;
  gap: 1rem;
  padding: 1.1rem var(--gutter) 1.4rem;
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.dock__group {
  display: grid;
  gap: 0.5rem;
}

.dock__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.8rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.875rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

/* Each toggle states its condition in words, not only in colour. */
.chip[aria-pressed]::after {
  content: 'closed';
  font-family: var(--mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--ink-2);
}

.chip[aria-pressed='true']::after {
  content: 'open';
  color: #cfd8ff;
}

.chip--lamp[aria-pressed]::after {
  content: 'off';
}

.chip--lamp[aria-pressed='true']::after {
  content: 'on';
}

.chip:hover {
  border-color: var(--ink);
}

.chip:active {
  background: var(--bg);
}

.chip[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.chip:disabled {
  opacity: 0.5;
}

.chip--plain {
  justify-self: start;
  border-color: var(--ink);
}

.chip--plain:hover {
  background: var(--ink);
  color: #fff;
}

.swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0 0.8rem 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.875rem;
}

.swatch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
}

.swatch__dot {
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: var(--c);
  border: 1px solid rgb(0 0 0 / 0.35);
}

.swatch:hover {
  border-color: var(--ink);
}

.swatch:active {
  background: var(--bg);
}

.swatch:has(input:checked) {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
  font-weight: 600;
}

.swatch:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.swatch:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

@media (min-width: 900px) {
  .hero__stage {
    display: block;
    min-height: clamp(36rem, 82vh, 52rem);
  }

  .hero__copy {
    position: relative;
    z-index: 2;
    grid-template-columns: 1fr 1fr;
    padding-top: 3rem;
    pointer-events: none;
  }

  .hero__headline {
    max-width: 38rem;
  }

  .stage {
    position: absolute;
    inset: 0;
    height: auto;
  }

  .hero__card {
    position: absolute;
    z-index: 2;
    left: var(--gutter);
    bottom: 1.75rem;
    width: 15.5rem;
    margin: 0;
  }

  .hero__hint {
    position: absolute;
    z-index: 2;
    right: var(--gutter);
    bottom: 1.75rem;
    max-width: 17rem;
    padding: 0;
    text-align: right;
    pointer-events: none;
  }

  .dock {
    grid-template-columns: 1fr auto auto;
    align-items: end;
    gap: 2rem;
  }
}

/* ---------- model snapshots ---------- */

.shot {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 14px;
  background: radial-gradient(ellipse 80% 55% at 50% 80%, #f8fafb 0%, #dfe5e9 75%);
}

.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot[data-state='loading']::after,
.shot[data-state='error']::after {
  content: 'Rendering this view';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-transform: uppercase;
  color: var(--ink-2);
}

.shot[data-state='error']::after {
  content: '3D view not available in this browser';
  color: var(--ink);
}

/* ---------- approach ---------- */

.approach {
  background: var(--surface);
  padding-block: clamp(2.5rem, 6vw, 5rem);
  max-width: none;
}

.approach > * {
  max-width: 83rem;
  margin-inline: auto;
}

.approach__grid {
  display: grid;
  gap: 2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.approach__text {
  display: grid;
  gap: 1.25rem;
  align-content: start;
}

.approach .label__mark {
  box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 10px currentColor;
}

.approach__lede {
  max-width: 30rem;
}

.approach__row {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.shot--small img {
  aspect-ratio: 7 / 5;
}

.shot--small {
  background: none;
  border-radius: 0;
  overflow: visible;
}

.shot--small img {
  border-radius: 14px;
  background: radial-gradient(ellipse 80% 55% at 50% 80%, #f8fafb 0%, #dfe5e9 75%);
}

.shot--small[data-state]::after {
  bottom: 2.75rem;
}

.note {
  display: grid;
  gap: 0.6rem;
  align-content: space-between;
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 1.05rem;
  line-height: 1.3;
}

.shot--tall img {
  aspect-ratio: 13 / 16;
}

.shot__over {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: grid;
  gap: 0.75rem;
  justify-items: start;
  padding: 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 1.25rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.shot__over :focus-visible {
  outline-color: #fff;
}

@media (min-width: 900px) {
  .approach__grid {
    grid-template-columns: 1.25fr 0.9fr;
    gap: clamp(2rem, 5vw, 5rem);
    align-items: end;
  }

  .approach__row {
    grid-template-columns: 1.3fr 1fr;
    margin-top: 2.5rem;
  }
}

/* ---------- services ---------- */

.services {
  padding-block: clamp(2.5rem, 6vw, 5rem) clamp(4rem, 8vw, 6.5rem);
}

.services__head {
  display: grid;
  gap: 1.25rem;
  margin-block: clamp(2rem, 5vw, 3.5rem) 2rem;
}

.services__lede {
  max-width: 22rem;
}

.cards {
  display: grid;
  gap: 0.9rem;
}

.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem 1rem;
  width: 100%;
  height: 100%;
  padding: 0.8rem 0.8rem 1.1rem;
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
  transition: border-color 0.15s, transform 0.15s;
}

.card:hover {
  border-color: var(--ink);
}

.card:active {
  transform: translateY(1px);
}

.card:disabled {
  opacity: 0.7;
}

.shot--card {
  grid-column: 1 / -1;
  border-radius: 10px;
}

.shot--card img {
  aspect-ratio: 11 / 9;
}

.card__tag {
  grid-column: 1 / -1;
  justify-self: start;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.card__title {
  font-size: 1.3rem;
  line-height: 1.12;
  letter-spacing: -0.02em;
  max-width: 14rem;
}

.card__num {
  font-size: 1.5rem;
  color: var(--soft);
}

.card__go {
  grid-column: 1 / -1;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.card:hover .card__go {
  color: var(--accent);
}

@media (min-width: 720px) {
  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .services__head {
    grid-template-columns: 1fr 2fr 1.2fr;
    align-items: end;
  }

  .services__head .label {
    align-self: end;
    padding-bottom: 0.4rem;
  }

  .cards {
    margin-left: 25%;
  }
}

/* ---------- method (dark) ---------- */

.method {
  position: relative;
  background: var(--dark);
  color: var(--on-dark);
  padding-block: clamp(4rem, 8vw, 6rem) clamp(3rem, 7vw, 5.5rem);
}

/* The light section ends in a tab that drops into the dark one. */
.method::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  width: min(60%, 36rem);
  height: 1.75rem;
  transform: translateX(-50%);
  background: var(--bg);
  clip-path: polygon(0 0, 100% 0, calc(100% - 2.25rem) 100%, 2.25rem 100%);
}

.method .ticks {
  color: var(--on-dark);
}

.method .label {
  color: var(--on-dark);
}

.method .label__mark {
  box-shadow: inset 0 0 0 2px var(--dark), inset 0 0 0 10px currentColor;
}

.method :focus-visible {
  outline-color: #fff;
}

.method__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: end;
  gap: 1.25rem;
  margin-block: clamp(2rem, 5vw, 3.5rem) clamp(1.75rem, 4vw, 3rem);
}

.shot--pill {
  border-radius: 999px;
}

.shot--pill img {
  aspect-ratio: 20 / 7;
}

.steps {
  display: grid;
  gap: 1.75rem 2rem;
  margin-top: clamp(2rem, 5vw, 3.5rem);
}

.steps li {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  padding-top: 0.9rem;
  border-top: 1px solid #3a3d41;
}

.steps__num {
  color: var(--on-dark-2);
}

.steps h3 {
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

.steps p {
  color: var(--on-dark-2);
  font-size: 0.9375rem;
}

@media (min-width: 620px) {
  .steps {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  .steps {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ---------- footer ---------- */

.site-footer {
  display: grid;
  gap: 1rem;
  padding-block: 2.5rem 3rem;
}

.site-footer .mono {
  max-width: 44rem;
}

.site-footer a {
  display: inline-block;
  padding-block: 0.8rem;
  color: var(--ink);
  text-underline-offset: 0.25em;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

.site-footer a:active {
  color: var(--ink-2);
}

@media (min-width: 900px) {
  .site-footer {
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}
