:root {
  --bg: #14161a;
  --surface: #1d2026;
  --border: #2e333c;
  --text: #e8eaee;
  --muted: #9aa1ad;
  --accent: #ff7a1a;
  --mango: linear-gradient(135deg, #ffc233, #ff6a1a);
  --radius: 12px;
  /* Headings, the site name and the facts strip. Falls back to the body font. */
  --display: "Barlow Condensed", system-ui, "Segoe UI", Roboto, sans-serif;
}

/* Barlow Condensed (SIL Open Font License), hosted with the site in fonts/ */
@font-face {
  font-family: "Barlow Condensed";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/barlow-condensed-700-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Barlow Condensed";
  font-style: italic;
  font-weight: 800;
  font-display: swap;
  src: url("../fonts/barlow-condensed-800-italic.woff2") format("woff2");
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

main {
  animation: page-in 0.5s ease-out;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, "Segoe UI", Roboto, sans-serif;
}

a {
  color: inherit;
}

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

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}

h1 {
  font-family: var(--display);
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  text-transform: uppercase;
  text-wrap: balance;
}

h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 1.5rem;
  margin-bottom: 16px;
  font-weight: 800;
  font-style: italic;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Slanted mango stripe in front of every section heading */
h2::before {
  content: "";
  width: 22px;
  height: 10px;
  background: var(--mango);
  transform: skewX(-24deg);
  border-radius: 2px;
}

main,
.site-header,
footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  padding-bottom: 12px;
  /* Sticks to the top; the shadow extends the background to the full window width. */
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  box-shadow: 0 0 0 100vmax var(--bg);
  clip-path: inset(0 -100vmax -1px);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.brand {
  font-family: var(--display);
  font-size: 1.9rem;
  line-height: 1.2;
  font-weight: 800;
  font-style: italic;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.2s;
}

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

nav {
  display: flex;
  gap: 4px 20px;
}

nav a {
  display: inline-block;
  padding: 10px 0;
  color: var(--muted);
  text-decoration: none;
}

nav a:hover,
nav a[aria-current] {
  color: var(--text);
}

nav a[aria-current] {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.model-section + .model-section,
#find {
  margin-top: 56px;
}

/* Keeps a linked section clear of the sticky header */
.model-section {
  scroll-margin-top: 90px;
}

@media (max-width: 480px) {
  .brand {
    font-size: 1.5rem;
  }

  nav {
    gap: 4px 14px;
    font-size: 0.95rem;
  }
}

/* Hero: text over a slideshow of the cars */
.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: min(70vh, 560px);
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  background: #0f1114;
}

.hero-slides img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: translateZ(0) scale(1);
  backface-visibility: hidden;
  /* Leaving: fade out over 1.2 s and keep the zoom until the photo is invisible, then reset it. */
  transition: opacity 1.2s ease, transform 0s linear 1.2s;
}

/* Showing: fade in while the photo zooms at a constant speed. The zoom lasts longer than
   a slide stays up (5 s + fade), so it never comes to a stop on screen. It is kept fairly
   quick on purpose: a very slow zoom moves less than a pixel per frame and looks jerky.
   Only the photo on screen is given its own graphics layer (will-change). */
.hero-slides img.active {
  opacity: 1;
  transform: translateZ(0) scale(1.16);
  will-change: transform, opacity;
  transition: opacity 1.2s ease, transform 8s linear;
}

/* Darkens only a band along the bottom, so the text is readable and the car stays visible */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(15, 17, 20, 0.94) 0%, rgba(15, 17, 20, 0.6) 34%, rgba(15, 17, 20, 0) 62%);
}

/* Text and buttons on the left, slide name and markers on the right */
.hero-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 40px;
  padding: 36px 40px 28px;
}

.hero-text {
  flex: 1 1 520px;
  max-width: 760px;
}

.eyebrow,
.link-group h3 {
  font-size: 0.8rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #ffc233;
}

.eyebrow {
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 3.9rem);
  margin-bottom: 12px;
}

.hero p,
.lead {
  color: #c3c8d0;
  font-size: 1.1rem;
  margin: 0;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

/* Buttons: orange for the main action, outlined for the rest */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--mango);
  color: #14161a;
  font-weight: 700;
}

.btn-ghost {
  border-color: rgba(232, 234, 238, 0.45);
  background: rgba(15, 17, 20, 0.55);
}

.btn-outline {
  border-color: #3a404b;
}

.btn-ghost:hover,
.btn-outline:hover {
  border-color: var(--accent);
}

.hero-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hero-caption {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(15, 17, 20, 0.72);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.hero-caption:hover {
  color: var(--accent);
}

/* Slide markers: a thin bar inside a taller button, so it is easy to tap */
.hero-dots {
  display: flex;
  gap: 6px;
}

.hero-dots button {
  position: relative;
  width: 28px;
  height: 24px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.hero-dots button::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 10px;
  height: 4px;
  border-radius: 2px;
  background: rgba(232, 234, 238, 0.35);
  transition: background 0.2s;
}

.hero-dots button.active::before {
  background: var(--accent);
}

@media (max-width: 640px) {
  .hero-inner {
    padding: 24px 20px 18px;
  }

  .hero-side {
    align-items: flex-start;
  }
}

/* Facts strip under the hero: cells separated by hairlines */
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 1px;
  margin-bottom: 56px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.fact {
  display: grid;
  padding: 14px 20px;
  background: var(--bg);
}

.fact strong {
  font-family: var(--display);
  font-size: 1.6rem;
  font-style: italic;
  font-weight: 700;
  line-height: 1.15;
}

.fact span {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Section heading with something on the right (filter, "all models" link) */
.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head a {
  padding: 10px 0;
  font-weight: 600;
  text-decoration: none;
}

.section-head a:hover {
  color: var(--accent);
}

h2 .count {
  color: var(--muted);
  font-style: normal;
  font-weight: 600;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filters button {
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  color: #b3b9c4;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.filters button:hover {
  color: var(--text);
}

.filters button[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(255, 122, 26, 0.14);
  color: var(--text);
  font-weight: 600;
}

/* Small labels on cards and the model page */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 2px 10px;
  border: 1px solid #3a404b;
  border-radius: 999px;
  color: #c3c8d0;
  font-size: 0.82rem;
}

.tag-scale {
  border-color: var(--accent);
  color: #ffc233;
  font-variant-numeric: tabular-nums;
}

/* "Find Cormango": outbound links in groups */
.link-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 22px;
}

.link-group {
  padding: 18px 22px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.link-group h3 {
  margin-bottom: 6px;
}

.link-group a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-weight: 600;
  text-decoration: none;
}

.link-group a + a {
  border-top: 1px solid var(--border);
}

.link-group a::after {
  content: "↗";
  margin-left: auto;
  color: var(--muted);
}

.link-group a:hover {
  color: var(--accent);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

/* Icons are black SVGs: inverted to white, except on the orange first button. */
.link-icon {
  width: 16px;
  height: 16px;
  filter: invert(1);
}

.links a:first-child .link-icon {
  filter: none;
}

.link-group .link-icon {
  width: 18px;
  height: 18px;
}

.footer-links .link-icon {
  width: 14px;
  height: 14px;
  opacity: 0.6;
}

.links a,
.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.links a {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.95rem;
  background: rgba(29, 32, 38, 0.7);
  transition: transform 0.15s, border-color 0.15s;
}

.links a:first-child {
  background: var(--mango);
  border-color: transparent;
  color: #14161a;
  font-weight: 700;
}

.links a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.footer-links a {
  padding: 8px 0;
  text-decoration: none;
}

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

.video {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Before play is pressed: a dimmed photo, a play button and a note */
.video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
}

.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  height: 84px;
  margin: -42px 0 0 -42px;
  padding: 0 0 0 6px;
  border: 0;
  border-radius: 50%;
  background: var(--mango);
  color: #14161a;
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s;
}

.video-play:hover {
  transform: scale(1.08);
}

.video-note {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  margin: 0;
  color: #d3d7de;
  font-size: 0.9rem;
}

[hidden] {
  display: none !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 22px;
}

/* Cards start lowered and transparent; main.js adds .in when they scroll into view. */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.5s ease, transform 0.5s ease, border-color 0.2s, box-shadow 0.2s;
}

.card.in {
  opacity: 1;
  transform: none;
}

.card.in:hover {
  border-color: var(--accent);
  transform: translateY(-5px);
  transition-delay: 0s !important;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}

/* Mango line that sweeps across the bottom of a card on hover */
.card::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--mango);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
}

.card:hover::after {
  transform: scaleX(1);
}

.card-photo {
  overflow: hidden;
  background: #0f1114;
}

.card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover img {
  transform: scale(1.06);
}

.card-body {
  padding: 14px 16px 16px;
}

.card-title,
.title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-body {
  display: grid;
  gap: 10px;
}

.card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-meta {
  font-variant-numeric: tabular-nums;
}

.badge {
  flex: none;
  padding: 2px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.back {
  display: inline-block;
  margin: 10px 0 24px;
  color: var(--muted);
  text-decoration: none;
}

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

.title-row {
  justify-content: flex-start;
}

.title-row h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
}

.detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 28px;
  margin-top: 36px;
}

/* Model page */
.crumbs {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.crumbs a {
  padding: 10px 0;
  color: #b3b9c4;
  text-decoration: none;
}

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

.crumbs #crumb-name {
  color: var(--text);
}

/* Wide: photos and video on the left, the panel on the right and held in view.
   Narrow: photos, panel, video. */
.model-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  grid-template-areas:
    "gallery panel"
    "video panel";
  gap: 36px 40px;
  align-items: start;
}

.model-gallery {
  grid-area: gallery;
}

#video-section {
  grid-area: video;
  scroll-margin-top: 90px;
}

.model-panel {
  grid-area: panel;
  position: sticky;
  top: 90px;
  display: grid;
  gap: 18px;
}

.model-panel h1 {
  font-size: clamp(2.3rem, 4vw, 3.2rem);
}

.model-panel h2 {
  margin-bottom: 12px;
}

.cta {
  display: grid;
  gap: 10px;
}

.cta .btn {
  border-radius: 10px;
}

.cta-primary {
  min-height: 52px;
  font-size: 1.05rem;
}

.cta-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.more-models {
  margin-top: 64px;
}

/* The download button pinned to the bottom of the screen: phones only */
.cta-bar {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(20, 22, 26, 0.96);
  border-top: 1px solid var(--border);
}

.cta-bar .btn {
  display: flex;
  min-height: 52px;
  border-radius: 10px;
}

@media (max-width: 900px) {
  .model-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "gallery"
      "panel"
      "video";
    gap: 28px;
  }

  .model-panel {
    position: static;
  }

  .cta-bar {
    display: block;
  }

  .cta .cta-primary {
    display: none;
  }

  body.has-cta-bar {
    padding-bottom: 84px;
  }
}

/* Photos come in different shapes (16:9, 4:3, square): the frame keeps one shape
   so the page does not jump, and each photo is shown uncropped inside it. */
.photo-frame {
  position: relative;
  aspect-ratio: 3 / 2;
  background: #0f1114;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* Full size photo over the page (a <dialog>, so Esc closes it and focus stays inside) */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  /* See-through: the page stays visible, dimmed and slightly blurred, around the photo */
  background: rgba(10, 11, 13, 0.6);
  backdrop-filter: blur(4px);
  color: var(--text);
  overflow: hidden;
}

.lightbox::backdrop {
  background: none;
}

.lightbox[open] {
  display: grid;
  place-items: center;
  animation: page-in 0.2s ease-out;
}

.lightbox img {
  width: auto;
  height: auto;
  max-width: min(88vw, 1600px);
  max-height: 84dvh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  padding: 0 0 4px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(15, 17, 20, 0.65);
  color: var(--text);
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.photo-main {
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  object-fit: contain;
  transition: opacity 0.13s ease;
}

.photo-main.fading {
  opacity: 0;
}

.photo-count,
.photo-full {
  position: absolute;
  bottom: 12px;
  border-radius: 999px;
  background: rgba(15, 17, 20, 0.75);
  font-size: 0.88rem;
  font-weight: 600;
}

.photo-count {
  left: 12px;
  padding: 3px 12px;
  font-variant-numeric: tabular-nums;
}

.photo-full {
  right: 12px;
  cursor: zoom-in;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--border);
  text-decoration: none;
}

.photo-full:hover {
  border-color: var(--accent);
}

/* Previous / next arrows over the main photo */
.photo-nav {
  position: absolute;
  top: 50%;
  width: 44px;
  height: 44px;
  margin-top: -22px;
  padding: 0 0 4px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(15, 17, 20, 0.65);
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.photo-nav.prev {
  left: 12px;
}

.photo-nav.next {
  right: 12px;
}

.photo-nav:hover {
  background: var(--mango);
  border-color: transparent;
  color: #14161a;
  transform: scale(1.08);
}

.thumbs button {
  transition: border-color 0.15s, transform 0.15s;
}

.thumbs button:hover {
  transform: translateY(-2px);
}

/* Touch screens have no hover: stop cards looking "stuck" after a tap. */
@media (hover: none) {
  .card.in:hover {
    border-color: var(--border);
    transform: none;
    box-shadow: none;
  }

  .card:hover::after {
    transform: scaleX(0);
  }

  .card:hover img {
    transform: none;
  }

  .photo-nav:hover {
    background: rgba(15, 17, 20, 0.65);
    border-color: var(--border);
    color: var(--text);
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .card {
    opacity: 1;
    transform: none;
  }
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.thumbs button {
  width: 72px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: none;
  cursor: pointer;
}

.thumbs button.active {
  border-color: var(--accent);
}

.thumbs img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.specs {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.specs dt,
.specs dd {
  margin: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

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

.specs dt:last-of-type,
.specs dd:last-of-type {
  border-bottom: 0;
}

.button {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 18px;
  background: var(--accent);
  color: #14161a;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
}

.button[hidden] {
  display: none;
}

.notice {
  padding: 60px 0;
  color: var(--muted);
}

footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 70px;
  padding-top: 24px;
  padding-bottom: 32px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}
