/* Public site (index / vehicules / car / favoris / legal) — self-contained,
   doesn't import the admin stylesheets (css/admin/). Dark theme by
   default (near-black surfaces, one white area: the footer), light theme
   via the nav's theme button (:root[data-theme="light"], see theme.js).
   Accent + secondary colors come from Paramètres > Customisation du site. */

:root {
  color-scheme: dark;

  /* Overridden at runtime from settings.accent_color — this is only the
     default for a fresh install / before the settings request answers. */
  --color-accent: #FF5A36;
  /* Second stop of the accent gradient (settings.secondary_color). */
  --color-secondary: #E11D48;
  --gradient-accent: linear-gradient(135deg, var(--color-accent) 0%, var(--color-secondary) 100%);
  --color-accent-hover: color-mix(in srgb, var(--color-accent) 82%, black);
  --color-accent-soft: color-mix(in srgb, var(--color-accent) 16%, transparent);
  --color-accent-contrast: #FFFFFF;

  --color-bg: #0B0B0D;
  --color-surface: #16161A;
  --color-surface-2: #1E1E23;
  --color-surface-3: #28282E;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-text: #F4F4F5;
  --color-text-muted: #9D9DA6;
  --color-text-faint: #6B6B74;
  --color-hover: rgba(255, 255, 255, 0.06);
  --nav-bg: rgba(11, 11, 13, 0.88);
  /* Accent used as a TEXT color (kickers, brand names, links...). Same as
     the accent on dark backgrounds; darkened in the light theme, where the
     bright accent would be too pale on white to read. */
  --color-accent-text: var(--color-accent);

  --color-light: #FFFFFF;
  --color-light-surface: #F4F4F5;
  --color-light-border: #E4E4E7;
  --color-light-text: #111113;
  --color-light-muted: #5F5F68;

  --color-featured: #FF8A1F;
  --color-new: #22C55E;
  --color-sold: #8A8A93;
  --color-danger: #F04438;
  --color-success: #22C55E;
  --color-favorite: #FF4D8D;

  --font-display: "Barlow Condensed", "Inter", sans-serif;
  --font-body: "Inter", system-ui, sans-serif;

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --page-width: 1400px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav-height: 76px;

  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Light theme. Anything that sits on a photo keeps the dark tokens (see
   below); the landing page hero has its own light version (-- Hero). */
:root[data-theme="light"] {
  color-scheme: light;
  --color-bg: #F4F4F6;
  --color-surface: #FFFFFF;
  --color-surface-2: #F1F1F4;
  --color-surface-3: #E3E3E8;
  --color-border: rgba(17, 17, 19, 0.09);
  --color-border-strong: rgba(17, 17, 19, 0.18);
  --color-text: #111113;
  --color-text-muted: #55555E;
  --color-text-faint: #7A7A84;
  --color-hover: rgba(17, 17, 19, 0.05);
  --nav-bg: rgba(255, 255, 255, 0.9);
  --shadow-lg: 0 24px 60px rgba(17, 17, 19, 0.12);
  --color-accent-text: color-mix(in srgb, var(--color-accent) 72%, black);
}

/* Areas that are always dark whatever the theme: the lightbox (photos on
   black). It simply re-declares the dark tokens. */
:root[data-theme="light"] .lightbox {
  color-scheme: dark;
  --color-surface: #16161A;
  --color-surface-2: #1E1E23;
  --color-surface-3: #28282E;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-border-strong: rgba(255, 255, 255, 0.16);
  --color-text: #F4F4F5;
  --color-text-muted: #9D9DA6;
  --color-text-faint: #6B6B74;
  --color-hover: rgba(255, 255, 255, 0.06);
  --color-accent-text: var(--color-accent);
  color: var(--color-text);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.material-symbols-outlined {
  font-size: 1.25em;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  user-select: none;
}

.container {
  width: 100%;
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* -- Buttons ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.btn:hover {
  background: var(--color-surface-3);
}

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

.btn:focus-visible,
.icon-btn:focus-visible,
.chip:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.btn-accent {
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
}

.btn-accent:hover {
  background: var(--color-accent) var(--gradient-accent);
  filter: brightness(0.92) saturate(1.05);
}

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

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

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 54px;
  padding: 0 28px;
  font-size: 1rem;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 0.85rem;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--color-border-strong);
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text);
  backdrop-filter: blur(8px);
  transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}

.icon-btn:hover:not(:disabled) {
  background: var(--color-surface-3);
}

/* On top of photos (cards, gallery, lightbox): always dark glass. */
.car-card-media .icon-btn,
.gallery-stage .icon-btn,
.lightbox .icon-btn {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(11, 11, 13, 0.55);
  color: #F4F4F5;
}

.car-card-media .icon-btn:hover:not(:disabled),
.gallery-stage .icon-btn:hover:not(:disabled),
.lightbox .icon-btn:hover:not(:disabled) {
  background: rgba(11, 11, 13, 0.85);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* -- Nav bar ------------------------------------------------------------ */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}

/* Landing page: floats transparently over the hero until scrolled. */
.site-nav.is-overlay {
  position: fixed;
  left: 0;
  right: 0;
}

.site-nav.is-overlay:not(.is-scrolled) {
  background: transparent;
  backdrop-filter: none;
  border-bottom-color: transparent;
}

.site-nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
}

.brand-icon .material-symbols-outlined {
  font-size: 26px;
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

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

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text);
  line-height: 1.05;
}

.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 560px) {
  :root {
    --nav-height: 64px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .brand-name {
    font-size: 1.05rem;
    max-width: 9.5em;
  }

  .site-nav-actions .btn {
    padding: 0 12px;
    min-height: 40px;
  }

  .site-nav-actions .btn-text {
    display: none;
  }
}

/* -- Section titles ----------------------------------------------------- */

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 40%, transparent);
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.display-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  text-transform: uppercase;
}

.display-title .accent {
  color: var(--color-accent-text);
}

.section {
  padding: clamp(56px, 8vw, 104px) 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.section-head-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.section-lead {
  margin: 0;
  max-width: 560px;
  color: var(--color-text-muted);
}

/* -- Hero (landing page) ------------------------------------------------ */

.hero {
  color: var(--color-text);
  position: relative;
  display: flex;
  align-items: flex-end;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--nav-height) + 40px) 0 clamp(32px, 6vh, 64px);
  overflow: hidden;
  isolation: isolate;
  /* background-image is set inline by index.html (uploaded hero image,
     GET /api/site/hero-image) */
  background-color: #1A1A1D;
  background-position: center 60%;
  background-size: cover;
  background-repeat: no-repeat;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(11, 11, 13, 0.92) 0%, rgba(11, 11, 13, 0.7) 38%, rgba(11, 11, 13, 0.15) 70%, rgba(11, 11, 13, 0.25) 100%),
    linear-gradient(180deg, rgba(11, 11, 13, 0.65) 0%, rgba(11, 11, 13, 0) 28%, rgba(11, 11, 13, 0) 55%, rgba(11, 11, 13, 0.95) 100%);
}

.hero-inner {
  display: grid;
  gap: 40px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  max-width: 720px;
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9vw, 6.6rem);
  line-height: 0.9;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.hero-title .accent {
  color: var(--color-accent-text);
}

.hero-lead {
  margin: 0;
  max-width: 560px;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  color: color-mix(in srgb, var(--color-text) 80%, transparent);
}

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

.hero-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.hero-search {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 10px;
  width: min(100%, 860px);
  padding: 12px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: rgba(11, 11, 13, 0.7);
  backdrop-filter: blur(16px);
}

.hero-stats {
  display: flex;
  gap: 12px;
}

.hero-stat {
  display: flex;
  flex-direction: column;
  min-width: 128px;
  padding: 14px 18px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: rgba(11, 11, 13, 0.6);
  backdrop-filter: blur(16px);
}

.hero-stat-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1;
}

.hero-stat-label {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 18px;
  translate: -50% 0;
  color: rgba(255, 255, 255, 0.55);
  animation: hero-bob 2.4s ease-in-out infinite;
}

@keyframes hero-bob {
  50% {
    transform: translateY(6px);
  }
}

/* Light theme: the photo fades into the light page background instead of
   black (same shape as the dark gradient: strong behind the text on the
   left, clear on the right, blending into the page at the bottom), and the
   search bar and stats become white glass. The nav floating over the hero
   follows the theme like everything else. */
:root[data-theme="light"] .hero {
  background-color: #E9E9EC;
}

:root[data-theme="light"] .hero::before {
  background:
    linear-gradient(90deg, rgba(244, 244, 246, 0.82) 0%, rgba(244, 244, 246, 0.6) 38%, rgba(244, 244, 246, 0.05) 70%, rgba(244, 244, 246, 0.1) 100%),
    linear-gradient(180deg, rgba(244, 244, 246, 0.5) 0%, rgba(244, 244, 246, 0) 25%, rgba(244, 244, 246, 0) 65%, rgba(244, 244, 246, 0.95) 100%);
}

/* On phones the text spans the whole width, photo included: even veil. */
@media (max-width: 700px) {
  :root[data-theme="light"] .hero::before {
    background: linear-gradient(180deg, rgba(244, 244, 246, 0.72) 0%, rgba(244, 244, 246, 0.62) 60%, rgba(244, 244, 246, 0.95) 100%);
  }
}

:root[data-theme="light"] .hero-search {
  background: rgba(255, 255, 255, 0.75);
  box-shadow: 0 12px 32px rgba(17, 17, 19, 0.08);
}

:root[data-theme="light"] .hero-stat {
  background: rgba(255, 255, 255, 0.7);
}

:root[data-theme="light"] .hero-scroll {
  color: rgba(17, 17, 19, 0.45);
}

@media (max-width: 900px) {
  .hero-search {
    grid-template-columns: 1fr 1fr;
  }

  .hero-search .btn {
    grid-column: 1 / -1;
  }

  .hero-scroll {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-search {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    width: 100%;
  }

  .hero-stat {
    flex: 1;
    min-width: 0;
  }
}

/* -- Form controls ------------------------------------------------------ */

.select,
.input,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.95rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.textarea {
  min-height: 110px;
  padding: 12px 14px;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23A1A1AA' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.select:focus,
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-soft);
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field .material-symbols-outlined {
  position: absolute;
  left: 14px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-field .input {
  padding-left: 44px;
}

/* -- Car cards ---------------------------------------------------------- */

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

.cars-grid-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 56px 24px;
  border: 1px dashed var(--color-border-strong);
  border-radius: var(--radius);
  text-align: center;
  color: var(--color-text-muted);
}

.car-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: pointer;
  transition: transform 0.3s var(--ease), border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-lg);
}

.car-card-media {
  position: relative;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: var(--color-surface-2);
}

.car-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), opacity 0.25s var(--ease);
}

.car-card:hover .car-card-media img {
  transform: scale(1.04);
}

.car-card-noimage {
  display: grid;
  place-items: center;
  gap: 6px;
  height: 100%;
  color: var(--color-text-faint);
  font-size: 0.85rem;
}

.car-card-noimage .material-symbols-outlined {
  font-size: 44px;
}

/* Keeps the photo readable under the badges/arrows at either edge. */
.car-card-media::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.4) 100%);
}

.car-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #FFFFFF;
  backdrop-filter: blur(6px);
}

.car-badge .material-symbols-outlined {
  font-size: 15px;
  font-variation-settings: "FILL" 1, "wght" 600, "GRAD" 0, "opsz" 20;
}

.car-badge-featured {
  background: var(--color-featured);
}

.car-badge-new {
  background: var(--color-new);
}

.car-badge-sold {
  background: rgba(40, 40, 46, 0.9);
  color: #D4D4D8;
}

.car-card-fav {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
}

.car-card-fav.is-active,
.fav-toggle.is-active {
  color: var(--color-favorite);
}

.car-card-fav.is-active .material-symbols-outlined,
.fav-toggle.is-active .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.car-card-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  translate: 0 -50%;
  width: 36px;
  height: 36px;
  opacity: 0;
}

.car-card-nav.prev {
  left: 10px;
}

.car-card-nav.next {
  right: 10px;
}

.car-card:hover .car-card-nav:not(:disabled),
.car-card-nav:focus-visible {
  opacity: 1;
}

.car-card:hover .car-card-nav:disabled {
  opacity: 0.35;
}

/* Touch screens have no hover: swipe instead, arrows stay out of the way. */
@media (hover: none) {
  .car-card-nav {
    display: none;
  }
}

.car-card-dots {
  position: absolute;
  bottom: 12px;
  left: 50%;
  z-index: 2;
  translate: -50% 0;
  display: flex;
  gap: 5px;
}

.car-card-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
  transition: width 0.25s var(--ease), background 0.25s var(--ease);
}

.car-card-dots span.is-active {
  width: 18px;
  border-radius: 3px;
  background: #FFFFFF;
}

.car-card-year {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(11, 11, 13, 0.72);
  font-size: 0.78rem;
  font-weight: 700;
  /* on a photo: always light text, whatever the theme */
  color: #F4F4F5;
}

.car-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  padding: 20px 22px 22px;
}

.car-card-brand {
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.car-card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.car-card-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.car-card-specs li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.car-card-specs .material-symbols-outlined {
  font-size: 17px;
  color: var(--color-text-faint);
}

.car-card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.car-card-price-label {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-faint);
}

.car-card-price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  line-height: 1;
  color: var(--color-text);
  white-space: nowrap;
}

.car-card-price.is-sold {
  color: var(--color-sold);
}

.car-card.is-sold .car-card-media img {
  filter: grayscale(0.7);
}

.car-card-missing {
  cursor: default;
}

.car-card-missing:hover {
  transform: none;
  box-shadow: none;
}

/* -- Home sections ------------------------------------------------------ */

.rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, calc((100% - 72px) / 4));
  gap: 24px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.rail::-webkit-scrollbar {
  display: none;
}

.rail > * {
  scroll-snap-align: start;
}

@media (max-width: 1200px) {
  .rail {
    grid-auto-columns: minmax(300px, calc((100% - 48px) / 3));
  }
}

@media (max-width: 900px) {
  .rail {
    grid-auto-columns: minmax(280px, 80%);
  }
}

.rail-controls {
  display: flex;
  gap: 8px;
}

.rail-controls .icon-btn {
  width: 44px;
  height: 44px;
  background: var(--color-surface-2);
}

.services {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.service-card-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
}

.service-card-icon .material-symbols-outlined {
  font-size: 28px;
}

.service-card h3 {
  margin: 6px 0 0;
  font-size: 1.2rem;
}

.service-card p {
  margin: 0;
  color: var(--color-text-muted);
}

.service-card-index {
  position: absolute;
  top: 18px;
  right: 24px;
  font-family: var(--font-display);
  font-size: 3.2rem;
  font-weight: 800;
  color: color-mix(in srgb, var(--color-text) 6%, transparent);
}

@media (max-width: 900px) {
  .services {
    grid-template-columns: 1fr;
  }
}

.cta-banner {
  position: relative;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  align-items: center;
  gap: 32px;
  padding: clamp(32px, 5vw, 64px);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--color-accent) 45%, transparent) 0%, transparent 55%),
    linear-gradient(135deg, var(--color-surface-2) 0%, var(--color-surface) 100%);
  border: 1px solid var(--color-border);
  overflow: hidden;
}

.cta-banner p {
  margin: 16px 0 0;
  max-width: 520px;
  color: var(--color-text-muted);
}

.cta-banner-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

@media (max-width: 900px) {
  .cta-banner {
    grid-template-columns: 1fr;
  }

  .cta-banner-actions {
    justify-content: flex-start;
  }
}

/* -- Inventory page ----------------------------------------------------- */

.page-head {
  padding: 48px 0 32px;
  border-bottom: 1px solid var(--color-border);
}

.page-head-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.page-head-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}

.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 0.95;
  text-transform: uppercase;
}

.page-title .count {
  color: var(--color-accent-text);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar .search-field {
  width: min(100%, 320px);
}

.toolbar .select {
  width: auto;
  min-width: 210px;
}

.inventory {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
  padding-top: 32px;
  padding-bottom: 80px;
}

.inventory-results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.inventory-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filters-open-btn {
  display: none;
}

.filters-open-btn .badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
  font-size: 0.75rem;
}

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

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 6px 5px 12px;
  border: 1px solid color-mix(in srgb, var(--color-accent) 35%, transparent);
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  font-size: 0.82rem;
}

.active-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
}

.active-chip button:hover {
  background: var(--color-hover);
  color: var(--color-text);
}

.active-chip .material-symbols-outlined {
  font-size: 16px;
}

.link-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

/* Filters panel: a sticky column on wide screens, a left drawer below. */

.filters-panel {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--nav-height) - 40px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

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

.filters-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.filters-close {
  display: none;
}

.filters-body {
  flex: 1;
  overflow-y: auto;
  padding: 0 22px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-3) transparent;
}

.filters-foot {
  display: none;
  gap: 10px;
  padding: 14px 22px 20px;
  border-top: 1px solid var(--color-border);
}

.filter-group {
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
}

.filter-group:first-child {
  border-top: 0;
  padding-top: 4px;
}

.filter-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.filter-label output {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--color-text);
}

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

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text);
  font-size: 0.87rem;
  font-weight: 500;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}

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

.chip.is-active {
  border-color: transparent;
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
}

.check-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 232px;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-3) transparent;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  font-size: 0.92rem;
  cursor: pointer;
}

.check-item:hover {
  background: var(--color-hover);
}

.check-item input {
  appearance: none;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  border: 1.5px solid var(--color-border-strong);
  border-radius: 5px;
  background: var(--color-surface-2);
  transition: background 0.15s, border-color 0.15s;
}

.check-item input::after {
  content: "";
  width: 9px;
  height: 5px;
  margin-top: -2px;
  border: solid #FFFFFF;
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg) scale(0);
  transition: transform 0.15s var(--ease);
}

.check-item input:checked {
  border-color: transparent;
  background: var(--color-accent) var(--gradient-accent);
}

.check-item input:checked::after {
  transform: rotate(-45deg) scale(1);
}

.check-item input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.check-item-count {
  margin-left: auto;
  color: var(--color-text-faint);
  font-size: 0.8rem;
}

.filter-hint {
  margin: 0;
  color: var(--color-text-faint);
  font-size: 0.85rem;
}

.filter-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.range {
  width: 100%;
  height: 20px;
  margin: 0;
  appearance: none;
  background: transparent;
  --fill: 100%;
}

.range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-secondary) var(--fill), var(--color-surface-3) var(--fill));
}

.range::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-secondary) var(--fill), var(--color-surface-3) var(--fill));
}

.range::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -7px;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.range::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid #FFFFFF;
  border-radius: 50%;
  background: var(--color-accent);
}

.range-bounds {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  color: var(--color-text-faint);
  font-size: 0.75rem;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.92rem;
  cursor: pointer;
}

.switch-row + .switch-row {
  margin-top: 12px;
}

.switch {
  appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--color-surface-3);
  transition: background 0.2s var(--ease);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #FFFFFF;
  transition: transform 0.2s var(--ease);
}

.switch:checked {
  background: var(--color-accent) var(--gradient-accent);
}

.switch:checked::after {
  transform: translateX(18px);
}

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

.filters-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

@media (max-width: 1024px) {
  .inventory {
    grid-template-columns: minmax(0, 1fr);
  }

  .filters-open-btn {
    display: inline-flex;
  }

  .filters-panel {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 90;
    width: min(380px, 88vw);
    max-height: none;
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border-left: 0;
    transform: translateX(-105%);
    transition: transform 0.35s var(--ease);
    box-shadow: var(--shadow-lg);
  }

  .filters-panel.is-open {
    transform: none;
  }

  .filters-panel.is-open ~ .filters-backdrop,
  .filters-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .filters-close {
    display: inline-grid;
  }

  .filters-foot {
    display: flex;
  }

  .filters-foot .btn {
    flex: 1;
  }
}

@media (max-width: 640px) {
  .toolbar,
  .toolbar .search-field,
  .toolbar .select {
    width: 100%;
  }
}

/* -- Car detail page ---------------------------------------------------- */

.detail {
  padding-top: 28px;
  padding-bottom: 80px;
}

.detail-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
  font-weight: 500;
}

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

.detail-updated {
  color: var(--color-text-faint);
  font-size: 0.85rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: start;
  gap: 28px;
}

.detail-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gallery-stage {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  cursor: zoom-in;
}

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

.gallery-stage .car-card-noimage {
  cursor: default;
}

.gallery-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 46px;
  height: 46px;
}

.gallery-nav.prev {
  left: 16px;
}

.gallery-nav.next {
  right: 16px;
}

.gallery-count {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(11, 11, 13, 0.75);
  font-size: 0.85rem;
  font-weight: 600;
  /* on a photo: always light text, whatever the theme */
  color: #F4F4F5;
}

.gallery-stage .car-badge {
  top: 16px;
  left: 16px;
}

.gallery-thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--color-surface-3) transparent;
  padding-bottom: 4px;
}

.gallery-thumb {
  flex: 0 0 auto;
  width: 112px;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--color-surface);
  opacity: 0.6;
  transition: opacity 0.2s, border-color 0.2s;
}

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

.gallery-thumb:hover {
  opacity: 0.9;
}

.gallery-thumb.is-active {
  border-color: var(--color-accent);
  opacity: 1;
}

.panel {
  padding: clamp(22px, 3vw, 32px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.panel-title {
  margin: 0 0 18px;
  font-size: 1.25rem;
}

.panel-text {
  margin: 0;
  color: var(--color-text-muted);
  white-space: pre-line;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.spec-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface-2);
  min-width: 0;
}

.spec-tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.spec-tile-label .material-symbols-outlined {
  font-size: 16px;
}

.spec-tile-value {
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .spec-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.detail-side {
  position: sticky;
  top: calc(var(--nav-height) + 20px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-kicker {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-text);
}

.detail-title {
  margin: 8px 0 4px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1;
  text-transform: uppercase;
}

.detail-version {
  margin: 0;
  color: var(--color-text-muted);
}

.detail-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.detail-quick li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.detail-quick .material-symbols-outlined {
  font-size: 18px;
  color: var(--color-text-faint);
}

.detail-price-block {
  margin: 22px 0;
  padding: 22px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.detail-price-label {
  font-size: 0.85rem;
  color: var(--color-text-faint);
}

.detail-price {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  line-height: 1;
}

.detail-price.is-sold {
  color: var(--color-sold);
}

.detail-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 1024px) {
  .detail-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Single column: photos, then title/price/actions, then the rest. */
  .detail-layout > .detail-main {
    display: contents;
  }

  .detail-main > .gallery {
    order: 1;
  }

  .detail-side {
    position: static;
    order: 2;
  }

  .detail-main > .panel {
    order: 3;
  }
}

/* Admin preview banner (car page, /admin/car/{id} only). */
.admin-banner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid rgba(77, 159, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(77, 159, 255, 0.08);
  color: color-mix(in srgb, #4D9FFF 55%, var(--color-text));
}

.admin-banner-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-warning {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: rgba(240, 68, 56, 0.12);
  color: color-mix(in srgb, var(--color-danger) 55%, var(--color-text));
}

.admin-warning ul {
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.admin-warning li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.admin-warning-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
}

.btn-danger:hover {
  background: color-mix(in srgb, var(--color-danger) 82%, black);
}

.not-found {
  padding: 120px 0;
  text-align: center;
  color: var(--color-text-muted);
}

/* -- Modals ------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  animation: fade-in 0.2s var(--ease);
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.modal-panel {
  width: min(100%, 560px);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: pop-in 0.25s var(--ease);
}

.modal-panel-wide {
  width: min(100%, 860px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 26px 0;
}

.modal-head h2 {
  margin: 0;
  font-size: 1.35rem;
}

.modal-body {
  padding: 22px 26px 26px;
}

.contact-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 28px;
}

@media (max-width: 720px) {
  .contact-modal-grid {
    grid-template-columns: 1fr;
  }
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.contact-list-icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
}

.contact-list-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint);
}

.contact-list a:hover {
  color: var(--color-accent-text);
}

.share-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.share-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  font-weight: 500;
  font-size: 0.92rem;
}

.share-option:hover {
  border-color: var(--color-border-strong);
  background: var(--color-surface-3);
}

.share-option img {
  width: 20px;
  height: 20px;
}

.share-copied {
  margin: 14px 0 0;
  color: var(--color-success);
  font-size: 0.9rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.share-copied.visible {
  opacity: 1;
}

.lightbox {
  background: rgba(0, 0, 0, 0.94);
  grid-template-rows: 1fr auto;
}

.lightbox img {
  max-width: min(100%, 1400px);
  max-height: calc(100vh - 120px);
  border-radius: var(--radius);
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  width: 52px;
  height: 52px;
}

.lightbox-nav.prev {
  left: 16px;
}

.lightbox-nav.next {
  right: 16px;
}

.lightbox-count {
  margin: 12px 0 0;
  color: var(--color-text-muted);
}

/* -- Contact forms (footer, modal) -------------------------------------- */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.form-confirmation {
  display: none;
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: rgba(34, 197, 94, 0.12);
  color: #16A34A;
  font-size: 0.9rem;
  font-weight: 500;
}

.form-confirmation.visible {
  display: block;
}

.form-confirmation.is-error {
  background: rgba(240, 68, 56, 0.12);
  color: var(--color-danger);
}

/* -- Footer (the one white area) ---------------------------------------- */

.site-footer {
  padding: 0 var(--gutter) var(--gutter);
}

.footer-card {
  /* White area: native controls (consent checkbox...) render light here. */
  color-scheme: light;
  max-width: calc(var(--page-width) - 2 * 0px);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px);
  border-radius: var(--radius-lg);
  background: var(--color-light);
  color: var(--color-light-text);
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
}

.footer-location {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-width: 0;
}

.site-footer .brand-name {
  color: var(--color-light-text);
}

.footer-lead {
  margin: 0;
  max-width: 460px;
  color: var(--color-light-muted);
}

.site-footer .contact-list-icon {
  background: color-mix(in srgb, var(--color-accent) 12%, white);
}

.site-footer .contact-list-label {
  color: var(--color-light-muted);
}

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

.footer-map iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.footer-map-link {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: var(--color-light);
  color: var(--color-light-text);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.footer-map-link:hover {
  color: var(--color-accent-text);
}

.site-footer .contact-form-title {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.site-footer .contact-form > p {
  margin: 0 0 6px;
  color: var(--color-light-muted);
}

.site-footer .field label {
  color: var(--color-light-muted);
}

.site-footer .input,
.site-footer .textarea {
  border-color: var(--color-light-border);
  background: var(--color-light-surface);
  color: var(--color-light-text);
}

.site-footer .input:focus,
.site-footer .textarea:focus {
  background: var(--color-light);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: clamp(28px, 4vw, 48px);
  padding-top: 20px;
  border-top: 1px solid var(--color-light-border);
  color: var(--color-light-muted);
  font-size: 0.85rem;
}

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

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-footer {
    padding: 0 10px 10px;
  }
}

/* Designer credit, under the white footer card: small and faint on
   purpose, it shouldn't compete with the dealer's own content. */
.site-credit {
  margin: 14px 0 4px;
  text-align: center;
  color: var(--color-text-faint);
  font-size: 1rem;
}

.site-credit a {
  color: var(--color-text-muted);
  transition: color 0.2s var(--ease);
}

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

/* -- Photo loading (cards, detail gallery, lightbox) ---------------------
   loadPhoto() (cards.js) puts .is-loading on the photo's container while
   the next photo downloads: the previous photo is hidden right away (so it
   never looks like the arrow did nothing) and a spinner shows. The
   spinner fades in after a short delay, so a cached photo swaps in
   without a flash. */
.is-loading > img {
  opacity: 0;
}

.is-loading::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #FFFFFF;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: photo-spin 0.8s linear infinite, photo-spinner-in 0.2s ease 0.15s forwards;
}

@keyframes photo-spin {
  to {
    rotate: 360deg;
  }
}

@keyframes photo-spinner-in {
  to {
    opacity: 1;
  }
}

.filters-head > div {
  display: flex;
  align-items: center;
  gap: 8px;
}


/* -- Revamp #44 additions ------------------------------------------------ */

.pre-line {
  white-space: pre-line;
}

.nowrap {
  white-space: nowrap;
}

.section-flush-top {
  padding-top: 0;
}

.section-tight {
  padding-top: 32px;
}

/* Skip link: first thing keyboard users reach, jumps past the nav. */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  background: var(--color-light);
  color: var(--color-light-text);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

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

main:focus {
  outline: none;
}

/* Favorites button in the nav, with its count badge. */
.nav-fav {
  position: relative;
  padding: 0 12px;
}

.nav-fav .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
  color: var(--color-favorite);
}

.nav-fav-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Inventory: search + sort bar, under the page header. */
.catalog-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 24px;
}

.catalog-toolbar .search-field {
  flex: 1 1 320px;
}

.sort-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-field-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.sort-field .select {
  width: auto;
  min-width: 220px;
}

.catalog-toolbar + .inventory {
  padding-top: 20px;
}

@media (max-width: 640px) {
  .sort-field,
  .sort-field .select {
    width: 100%;
  }

  .sort-field .select {
    min-width: 0;
  }
}

/* Contact forms: honeypot (hidden from people, bots fill it) + consent. */
.hp-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--color-text-muted);
  cursor: pointer;
}

.site-footer .consent {
  color: var(--color-light-muted);
}

.consent input {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--color-accent);
}

.consent a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Footer map: loaded only after a click (third-party request). */
.footer-map-consent {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 16px;
  border: 0;
  background:
    radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--color-accent) 14%, white) 0%, transparent 60%),
    var(--color-light-surface);
  color: var(--color-light-text);
  text-align: center;
}

.footer-map-consent .material-symbols-outlined {
  font-size: 34px;
  color: var(--color-accent-text);
}

.footer-map-consent strong {
  font-size: 0.95rem;
}

.footer-map-consent small {
  max-width: 320px;
  color: var(--color-light-muted);
  font-size: 0.78rem;
}

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

.footer-links a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.footer-links a:hover {
  text-decoration-color: currentColor;
}

/* Cookie notice (informational only — nothing to consent to). */
.cookie-notice {
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(calc(100% - 32px), 760px);
  padding: 14px 16px 14px 20px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--color-surface) 96%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  transform: translateX(-50%);
  font-size: 0.87rem;
  color: var(--color-text-muted);
}

.cookie-notice p {
  margin: 0;
}

.cookie-notice a {
  color: var(--color-text);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .cookie-notice {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Legal pages. */
.legal {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-bottom: 40px;
}

.legal > * {
  max-width: 900px;
}

.legal-list {
  margin: 0;
}

.legal-row {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}

.legal-row:last-child {
  border-bottom: 0;
}

.legal-row dt {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.legal-row dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.legal a {
  color: var(--color-accent-text);
}

.legal-bullets {
  margin: 12px 0;
  padding-left: 20px;
  color: var(--color-text-muted);
}

.legal-bullets li + li {
  margin-top: 8px;
}

.legal .panel-text + .panel-text {
  margin-top: 12px;
}

@media (max-width: 640px) {
  .legal-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Visible keyboard focus everywhere. */
a:focus-visible,
.check-item input:focus-visible,
.consent input:focus-visible,
.gallery-stage:focus-visible,
.gallery-thumb:focus-visible,
.share-option:focus-visible,
.select:focus-visible,
.input:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Respect "reduce motion" OS settings. */
@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;
  }
}

/* -- Theme toggle (nav): a normal bordered button holding a two-position
   sun/moon switch; the active side is filled with the accent gradient.
   Same design in the admin panel (css/admin/components.css). ------------ */

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 5px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.theme-toggle-btn:hover {
  background: var(--color-hover);
}

.theme-toggle-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.theme-toggle-track {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: var(--color-surface-2);
}

.theme-switch-option {
  display: grid;
  place-items: center;
  width: 30px;
  height: 28px;
  border-radius: 6px;
  color: var(--color-text-muted);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.theme-switch-option .material-symbols-outlined {
  font-size: 18px;
}

.theme-toggle-btn[data-theme="light"] .theme-switch-option[data-theme-value="light"],
.theme-toggle-btn[data-theme="dark"] .theme-switch-option[data-theme-value="dark"] {
  background: var(--color-accent) var(--gradient-accent);
  color: var(--color-accent-contrast);
}

/* Light theme: the white footer card needs an edge on the light page. */
:root[data-theme="light"] .footer-card {
  border: 1px solid var(--color-light-border);
}

/* Small phones: four nav buttons + the logo don't fit — icons only, and
   the theme switch shows just the current mode (still toggles on click). */
@media (max-width: 480px) {
  .site-nav-actions {
    gap: 6px;
  }

  #nav-vehicules-link span:not(.material-symbols-outlined) {
    display: none;
  }

  .theme-toggle-btn .theme-switch-option {
    display: none;
  }

  .theme-toggle-btn[data-theme="light"] .theme-switch-option[data-theme-value="light"],
  .theme-toggle-btn[data-theme="dark"] .theme-switch-option[data-theme-value="dark"] {
    display: grid;
  }
}
