:root {
  --ink: #14213D;
  --paper: #EBEFF2;
  --card: #FFFFFF;
  --chrome: #8A97A1;
  --line: #C9D1D8;
  --muted: #4A5868;
  --red: #C8102E;
  --red-deep: #9E0B23;
  --plate-1: #E7EBEE;
  --plate-2: #B9C2C9;

  --f: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --wide: 125%;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1320px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 17px/1.55 var(--f);
  font-stretch: 100%;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
button { font: inherit; color: inherit; }

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

h1, h2, h3 {
  font-stretch: var(--wide);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0;
}

/* ---------- masthead ---------- */
.masthead {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.masthead .wrap {
  display: flex; align-items: center; gap: 28px;
  min-height: 76px;
}
.brand { display: block; flex: none; }
.brand img { height: 46px; width: auto; }
.nav { display: flex; gap: 24px; margin-left: auto; font-weight: 600; font-size: 15px; }
.nav a { text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; }
.nav a[aria-current="page"] { border-bottom-color: var(--red); }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--red); color: #fff;
  border: 0; border-radius: 3px;
  padding: 11px 18px;
  font-weight: 700; font-size: 15px; font-stretch: 110%;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--red-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.ghost:hover { background: var(--ink); color: #fff; }

@media (max-width: 760px) {
  .masthead .wrap { flex-wrap: wrap; gap: 10px 20px; padding-top: 10px; padding-bottom: 10px; }
  .brand img { height: 36px; }
  .masthead .btn { margin-left: auto; padding: 8px 12px; font-size: 14px; }
  .nav { order: 3; width: 100%; margin: 0; gap: 20px; }
}

/* ---------- hero ---------- */
.hero { padding: clamp(24px, 4vw, 56px) 0 clamp(40px, 6vw, 80px); }
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px) clamp(24px, 4vw, 56px);
  align-items: start;
}
.hero h1 { grid-column: 1 / -1; max-width: 16ch; }
.featured-label { margin: 0 0 10px; font-size: 15px; color: var(--muted); }
.featured-label strong { color: var(--ink); font-stretch: 112%; }
.hero-photo {
  margin: 0; position: relative;
  background: var(--ink);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 2px;
}
.hero-photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity .9s ease;
}
.hero-photo img.is-front { opacity: 1; }
.hero-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(20,33,61,.35); }
.hero-progress span { display: block; height: 100%; width: 0; background: var(--red); }
.hero-progress span.run { animation: fill var(--hero-ms, 6000ms) linear forwards; }
.hero-photo.paused .hero-progress span { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
.hero-cycle { display: flex; align-items: center; gap: 6px; }
.hero-cycle button {
  height: 44px; min-width: 44px; padding: 0 12px;
  border: 2px solid var(--ink); border-radius: 3px; background: transparent;
  font-weight: 700; font-size: 15px; cursor: pointer;
}
.hero-cycle button[aria-label] { font-size: 22px; line-height: 1; }
.hero-cycle button:hover { background: var(--ink); color: #fff; }
.hero-cycle #hero-pause { min-width: 76px; }
#hero-pos { margin-left: 8px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hero-photo button {
  all: unset; position: absolute; inset: 0; cursor: zoom-in;
}
.hero-photo button:focus-visible { outline: 3px solid var(--red); outline-offset: -6px; }
.hero h1 {
  font-size: clamp(38px, 6.2vw, 92px);
  line-height: .98;
}
.hero .lede { font-size: 19px; color: var(--muted); max-width: 34ch; margin: 0; }
.hero-meta { display: grid; gap: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
}

/* ---------- ID plate: the stamped aluminium tag riveted inside the engine bay ---------- */
.plate {
  position: relative;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px 3px),
    linear-gradient(170deg, var(--plate-1), var(--plate-2) 70%, #A7B1B9);
  border-radius: 6px;
  padding: 18px 26px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.8), inset 0 -1px 0 rgba(0,0,0,.18), 0 1px 2px rgba(20,33,61,.25);
  color: #2B3442;
  font-stretch: 112%;
}
.plate::before, .plate::after {
  content: ""; position: absolute; top: 50%; width: 9px; height: 9px; margin-top: -4.5px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #8D98A2 60%, #5C6670);
  box-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.plate::before { left: 9px; }
.plate::after { right: 9px; }
.plate dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 14px;
}
.plate dt { font-weight: 500; color: #56616E; }
.plate dd {
  margin: 0; font-weight: 700;
  /* stamped: light edge below, dark above */
  text-shadow: 0 1px 0 rgba(255,255,255,.75), 0 -1px 0 rgba(0,0,0,.18);
}
.plate .plate-title {
  font-size: 13px; font-weight: 600; color: #56616E;
  border-bottom: 1px solid rgba(43,52,66,.25);
  padding-bottom: 6px; margin-bottom: 10px;
}

/* ---------- garage ---------- */
.garage { padding: clamp(40px, 6vw, 72px) 0 88px; background: var(--card); border-top: 1px solid var(--line); }
.garage-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 16px 32px; margin-bottom: 24px;
}
.garage-head h2 { font-size: clamp(32px, 4vw, 52px); }
.garage-head p { margin: 6px 0 0; color: var(--muted); }
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 14px 0; margin-bottom: 28px;
  border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line);
}
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button {
  border: 1px solid var(--line); background: var(--card);
  border-radius: 999px; padding: 6px 13px; font-size: 14px; font-weight: 600; cursor: pointer;
}
.filters button span { color: var(--chrome); font-weight: 500; margin-left: 3px; }
.filters button:hover { border-color: var(--ink); }
.filters button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.filters button[aria-pressed="true"] span { color: #AFC0D6; }
.sort { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.sort select {
  font: inherit; color: var(--ink); font-weight: 600;
  border: 1px solid var(--line); border-radius: 3px; padding: 6px 8px; background: var(--card);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 36px 24px;
}
.car { margin: 0; }
.car > button {
  all: unset; display: block; width: 100%; cursor: pointer;
}
.car .shot {
  position: relative;
  aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--paper);
  border-radius: 2px;
}
.car .shot img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.car > button:hover .shot img { transform: scale(1.035); }
.car > button:focus-visible .shot { outline: 3px solid var(--red); outline-offset: 3px; }
.car .count {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(20,33,61,.82); color: #fff;
  font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 2px;
}
.car h3 { font-size: 19px; margin: 12px 0 3px; line-height: 1.15; }
.car > button:hover h3 { color: var(--red); }
.car .sub { font-size: 15px; color: var(--muted); margin: 0; }

.car.yours .shot {
  display: grid; place-items: center; text-align: center;
  background: transparent;
  border: 2px dashed var(--chrome);
  color: var(--muted);
  padding: 20px;
}
.car.yours .shot img { width: 92px; height: auto; opacity: .55; margin: 0 auto 10px; }
.car.yours a { text-decoration: none; display: block; }

.empty { color: var(--muted); padding: 40px 0; }

/* ---------- add your car (placeholder for the upcoming member system) ---------- */
.add {
  background: var(--ink); color: #E8EDF2;
  padding: clamp(48px, 7vw, 96px) 0;
}
.add .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: center; }
.add h2 { font-size: clamp(32px, 4.4vw, 58px); color: #fff; }
.add p { max-width: 46ch; margin: 0 0 14px; color: #C3CDD8; }
.add ul { margin: 0 0 24px; padding-left: 20px; color: #C3CDD8; }
.add .btn[disabled] { background: #3A4964; color: #C3CDD8; cursor: not-allowed; }
@media (max-width: 800px) { .add .wrap { grid-template-columns: 1fr; } }

/* ---------- footer ---------- */
.foot { padding: 40px 0 56px; font-size: 14px; color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 16px 40px; justify-content: space-between; align-items: center; }
.foot img { height: 30px; width: auto; opacity: .8; }
.foot nav { display: flex; gap: 20px; }

/* ---------- viewer (car detail + photo lightbox) ---------- */
dialog.viewer {
  border: 0; padding: 0; margin: auto;
  width: min(1200px, 100vw - 32px); max-height: calc(100vh - 32px);
  background: var(--card); color: var(--ink);
  border-radius: 4px; overflow: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}
dialog.viewer::backdrop { background: rgba(10,18,34,.82); }
dialog.viewer[open] { animation: rise .22s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.viewer-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.stage { background: #0E1626; position: relative; display: grid; align-content: center; min-height: 320px; }
.stage img { width: 100%; max-height: calc(100vh - 140px); object-fit: contain; }
.stage .nav-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 0; cursor: pointer; font-size: 22px; line-height: 1;
}
.stage .prev { left: 12px; }
.stage .next { right: 12px; }
.caption { margin: 0; padding: 10px 14px 2px; background: #0E1626; color: #D5DDE6; font-size: 15px; }
.thumbs { display: flex; gap: 6px; padding: 8px; background: #0E1626; overflow-x: auto; }
.thumbs button { all: unset; cursor: pointer; flex: none; opacity: .55; }
.thumbs button[aria-current="true"], .thumbs button:hover { opacity: 1; }
.thumbs button:focus-visible { outline: 2px solid #fff; }
.thumbs img { width: 84px; height: 63px; object-fit: cover; }
.info { padding: 28px 28px 32px; display: grid; gap: 20px; align-content: start; }
.info h2 { font-size: 32px; padding-right: 40px; }
.info .story { margin: 0; white-space: pre-line; }
.info .story.none { color: var(--muted); font-style: italic; }
.close {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--card); font-size: 22px; line-height: 1;
  box-shadow: 0 1px 4px rgba(0,0,0,.25);
}
.share { font-size: 14px; color: var(--muted); }
.share button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 820px) {
  .viewer-grid { grid-template-columns: 1fr; }
  dialog.viewer { width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; }
}

/* ---------- inner pages ---------- */
.page-head { padding: clamp(36px, 5vw, 64px) 0 28px; }
.page-head h1 { font-size: clamp(38px, 5vw, 68px); margin-bottom: 14px; }
.page-head p { color: var(--muted); max-width: 60ch; margin: 0; font-size: 18px; }
.models { columns: 4 220px; column-gap: 16px; padding-bottom: 80px; }
.models button { all: unset; display: block; cursor: zoom-in; margin-bottom: 16px; break-inside: avoid; background: var(--card); padding: 10px; border-radius: 2px; }
.models button:focus-visible { outline: 3px solid var(--red); }
.models button { box-sizing: border-box; width: 100%; }
.models img { width: 100%; height: auto; margin: 0 auto; }

.links { padding-bottom: 88px; display: grid; gap: 48px; }
.link-group h2 { font-size: 26px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); margin-bottom: 4px; }
.link-group ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 32px; }
.link-group li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.link-group a { font-weight: 700; font-size: 17px; text-decoration: none; }
.link-group a:hover { text-decoration: underline; }
.link-group .where { color: var(--chrome); font-weight: 500; font-size: 14px; margin-left: 6px; }
.link-group p { margin: 3px 0 0; color: var(--muted); font-size: 15px; }
.links-note { color: var(--muted); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  .hero-photo img { transition: none !important; }
  /* the progress bar still runs: it's what advances the cycle, and it moves slowly in one direction */
  .hero-progress span.run { animation: fill var(--hero-ms, 6000ms) linear forwards !important; }
  .hero-photo.paused .hero-progress span.run { animation-play-state: paused !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- member area ---------- */
.account { padding-top: clamp(32px, 5vw, 56px); padding-bottom: 88px; min-height: 60vh; }
.account h1 { font-size: clamp(34px, 4.6vw, 60px); margin-bottom: 12px; }
.account h2 { font-size: 26px; margin: 40px 0 12px; }
.account .lede { color: var(--muted); font-size: 18px; max-width: 60ch; margin: 0; }
.loading, .empty { color: var(--muted); }
.fine { font-size: 14px; color: var(--muted); }
.notice { background: var(--card); border-left: 4px solid var(--red); padding: 14px 18px; max-width: 70ch; }

label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
input[type="text"], input[type="email"], input:not([type]), input[inputmode], textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--chrome); border-radius: 3px;
  padding: 10px 12px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus-visible, textarea:focus-visible { outline: 3px solid var(--red); outline-offset: 1px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row input { flex: 1 1 220px; width: auto; }
.form-msg { margin: 10px 0 0; font-size: 15px; min-height: 1.4em; }
.form-msg.bad { color: var(--red); font-weight: 600; }
.form-msg.good { color: #1D6B3A; font-weight: 600; }
.btn.danger { background: transparent; color: var(--red); box-shadow: inset 0 0 0 2px var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.dev { background: #FFF6D6; padding: 10px 14px; font-size: 15px; }

.signin { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 48px; align-items: start; }
.signin-box { background: var(--card); padding: 28px; border-radius: 4px; border-top: 4px solid var(--ink); }
.signin-box form { display: grid; gap: 14px; }
.signin-box form label { margin: 0; }
.signin-box h2 { margin: 0; font-size: 24px; }
.signin-box .btn { justify-content: center; width: 100%; }
#turnstile:empty { display: none; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
@media (max-width: 820px) { .signin { grid-template-columns: 1fr; gap: 24px; } }

.account-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 16px 32px; margin-bottom: 24px; }
.account-actions { display: flex; gap: 10px; }
.my-cars { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px; margin: 28px 0 40px; }
.my-car { text-decoration: none; display: block; }
.my-car .shot { aspect-ratio: 4 / 3; background: var(--card); border-radius: 2px; overflow: hidden; display: grid; place-items: center; color: var(--muted); }
.my-car .shot img { width: 100%; height: 100%; object-fit: cover; }
.my-car h3 { font-size: 19px; margin: 12px 0 2px; }
.my-car .sub { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.my-car:hover h3 { color: var(--red); }
.my-car.new-car .shot { background: transparent; border: 2px dashed var(--chrome); font-size: 48px; font-weight: 300; }

.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--line); color: var(--ink); }
.badge.live { background: #D7EEDD; color: #1D6B3A; }
.badge.pending { background: #FFF0C7; color: #7A5600; }
.badge.hidden { background: #F8D7DC; color: var(--red-deep); }

.profile { margin-top: 16px; max-width: 560px; }
.profile summary { cursor: pointer; font-weight: 600; }
.profile form { margin-top: 14px; }

.editor .back { font-weight: 600; text-decoration: none; }
.status-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); margin: 0 0 28px; }
.car-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 20px; max-width: 900px; }
.car-form .field { grid-column: span 3; }
.car-form .field.narrow { grid-column: span 1; }
.car-form .field.wide { grid-column: 1 / -1; }
.car-form .field:has(#f-make) { grid-column: span 4; }
.car-form .field:has(#f-condition) { grid-column: span 3; }
@media (max-width: 700px) { .car-form .field, .car-form .field.narrow, .car-form .field:has(#f-make) { grid-column: 1 / -1; } }

.photos-block { margin-top: 48px; max-width: 900px; }
.dropzone {
  display: grid; place-items: center; gap: 4px; text-align: center;
  border: 2px dashed var(--chrome); border-radius: 4px; padding: 28px; cursor: pointer; background: var(--card);
}
.dropzone.over, .dropzone:hover { border-color: var(--ink); }
.dropzone:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone span { color: var(--muted); font-weight: 400; }
.photo-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.photo-list li { background: var(--card); padding: 8px; border-radius: 3px; display: grid; gap: 8px; align-content: start; }
.photo-list img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-list input { font-size: 14px; padding: 7px 9px; }
.photo-actions { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.photo-actions button { all: unset; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.photo-actions button:focus-visible { outline: 2px solid var(--red); }
.cover-tag { color: #1D6B3A; font-weight: 600; }
.photo-list li.uploading .ph { aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, var(--paper) 0 10px, var(--card) 10px 20px); }
.photo-list li.uploading p { margin: 0; font-size: 14px; color: var(--muted); }
.photo-list li.failed p { color: var(--red); }
.publish-bar { margin-top: 40px; padding: 20px 0; border-top: 2px solid var(--ink); display: grid; gap: 14px; max-width: 900px; }

/* approvals */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 24px; background: var(--card); padding: 18px; border-radius: 4px; margin-bottom: 20px; }
.review-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; align-content: start; }
.review-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.review h3 { font-size: 22px; margin: 0 0 4px; }
.review .sub { color: var(--muted); font-weight: 500; font-size: 15px; margin: 0; }
.review .owner { margin: 10px 0; font-size: 15px; }
.review .story { white-space: pre-line; margin: 0 0 14px; }
.admin-tools { margin-top: 48px; max-width: 560px; }
@media (max-width: 760px) { .review { grid-template-columns: 1fr; } }
