/* ============================================================
   Auto Plus 01 — fiche véhicule (fiche.html?id=…)
   Préfixe .fiche-* ; couleurs uniquement via les tokens de base.css
   ============================================================ */

/* ---------- Barre : fil d'Ariane + retour ---------- */
.fiche-nav {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-top: 28px;
}
/* Liens du fil d'Ariane : cible de 24 × 24 px au moins (WCAG 2.5.8) */
.fiche-nav .breadcrumb a { display: inline-flex; align-items: center; min-height: 24px; min-width: 24px; }
.fiche-nav__back { font-size: 14px; }
.fiche-nav__back .i { font-size: 16px; }
.fiche-nav__back:hover .i { transform: translateX(-3px); }

/* ---------- Grille principale ---------- */
.fiche-layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 48px; align-items: start;
  padding-block: 24px 64px;
}
.fiche-main { display: flex; flex-direction: column; gap: 40px; min-width: 0; }
.fiche-block { display: flex; flex-direction: column; gap: 18px; }
.fiche-block--tight { gap: 14px; }

/* ---------- Galerie ---------- */
.fiche-gallery { display: flex; flex-direction: column; gap: 14px; }
.fiche-stage {
  position: relative; height: 480px; border-radius: var(--radius-panel);
  background: var(--panel-alt); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.fiche-stage__halo {
  position: absolute; left: 50%; top: 62%; width: 900px; height: 500px; transform: translate(-50%, -50%);
  background: radial-gradient(ellipse at center, rgba(30, 63, 122, 0.8), rgba(30, 63, 122, 0) 65%);
  pointer-events: none;
}
.fiche-stage__horizon {
  position: absolute; left: 0; right: 0; top: 62.5%; height: 1px; pointer-events: none;
  background: linear-gradient(90deg, rgba(143, 166, 214, 0), rgba(143, 166, 214, 0.5), rgba(143, 166, 214, 0));
}
.fiche-stage__floor {
  position: absolute; left: 0; right: 0; top: calc(62.5% + 1px); bottom: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(24, 40, 72, 0.6), rgba(11, 18, 32, 0.2));
}
.fiche-stage__media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
/* Néon de l'atelier au-dessus de la voiture détourée (tube et cône, comme en haut de l'accueil) ;
   une photo non détourée a sa propre lumière */
.fiche-stage__lamp { position: absolute; inset: 0; pointer-events: none; }
.fiche-stage__lamp::before {
  content: ""; position: absolute; top: 20px; left: 28%; right: 28%; height: 3px; border-radius: 2px;
  background: rgb(var(--light));
  box-shadow: 0 0 12px 2px rgba(var(--light), 0.5), 0 0 44px 12px rgba(var(--light), 0.14);
}
.fiche-stage__lamp::after {
  content: ""; position: absolute; top: 22px; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, rgba(var(--light), 0.1), rgba(var(--light), 0.03) 55%, rgba(var(--light), 0));
  clip-path: polygon(28% 0, 72% 0, 90% 100%, 10% 100%);
}
.fiche-stage:has(.fiche-stage__photo) .fiche-stage__lamp,
.fiche-stage:has(.fiche-stage__empty) .fiche-stage__lamp { display: none; }
/* La barre rouge du logo, posée au sol sous la voiture */
.fiche-stage__redline {
  position: absolute; left: 13%; right: 13%; top: 95.5%; height: 3px; border-radius: 2px;
  background: var(--accent);
}
.fiche-stage__open {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0;
  background: transparent; color: inherit; cursor: zoom-in;
  display: flex; align-items: center; justify-content: center;
}
.fiche-stage__open:focus-visible { outline-offset: -4px; border-radius: var(--radius-panel); }
.fiche-stage__car { display: block; width: min(640px, 82%); }
.fiche-stage__car .car-stage__img { transition: transform .4s var(--ease-out); }
.fiche-stage__open:hover .car-stage__img { transform: translateY(-4px); }
.fiche-stage__photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.fiche-stage__empty { position: relative; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.fiche-stage__placeholder { width: 320px; height: 107px; }
.fiche-stage__note {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted);
}
.fiche-stage__new { position: absolute; top: 16px; left: 16px; z-index: 2; }
.fiche-stage__count {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  padding: 6px 12px; font-size: 12px; letter-spacing: 0; text-transform: none;
}
.fiche-stage__demo {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
  max-width: calc(100% - 32px);
}
.fiche-stage__nav {
  position: absolute; top: 50%; z-index: 3; width: 44px; height: 44px; transform: translateY(-50%);
  border: 1px solid var(--border-hover); border-radius: var(--radius-pill);
  background: rgba(11, 18, 32, 0.8); color: var(--text); font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s, background-color .2s;
}
.fiche-stage__nav:hover { border-color: var(--text); background: rgba(11, 18, 32, 0.95); }
.fiche-stage__nav .i { stroke-width: 2.2; }
.fiche-stage__nav--prev { left: 16px; }
.fiche-stage__nav--next { right: 16px; }

/* Vignettes */
.fiche-thumbs { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; min-height: 90px; }
.fiche-thumb {
  position: relative; height: 90px; padding: 0; overflow: hidden; cursor: pointer;
  border: 2px solid var(--border); border-radius: 12px; background: var(--panel-alt);
  display: flex; align-items: center; justify-content: center;
  transition: border-color .2s;
}
.fiche-thumb:hover, .fiche-thumb[aria-pressed="true"] { border-color: var(--text); }
.fiche-thumb picture { width: 100%; height: 100%; }
.fiche-thumb__img { width: 100%; height: 100%; object-fit: cover; }
.fiche-thumb__img--cutout { object-fit: contain; padding: 8px; }
.fiche-thumb--more { background: var(--panel); color: var(--text); font-size: 14px; font-weight: 800; }

/* ---------- En-tête ---------- */
.fiche-head { display: flex; flex-direction: column; gap: 16px; }
.fiche-head__tags { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Caractéristiques ---------- */
.fiche-specs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.fiche-specs dd { margin: 0; }
@media (min-width: 1101px) and (max-width: 1240px) {
  .fiche-specs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Place réservée avant l'arrivée des données (décalages de mise en page, CLS) :
   la scène photo a une hauteur fixe et les vignettes une hauteur minimale ; ici le titre
   (2 lignes, cas le plus courant), la rangée de tags et les 12 caractéristiques (cases de 78 px). */
.fiche-head:has(.fiche-head__tags:empty) .display { min-height: 2.1em; }
.fiche-head__tags:empty { min-height: 36px; }
.fiche-specs:empty { min-height: 258px; }       /* 3 rangées de 4 */
@media (min-width: 1101px) and (max-width: 1240px) {
  .fiche-specs:empty { min-height: 348px; }     /* 4 rangées de 3 */
}

/* ---------- Équipements ---------- */
.fiche-equip { display: flex; gap: 10px; flex-wrap: wrap; }
.fiche-equip__none { font-size: 14px; color: var(--text-dim); }

/* ---------- Le mot du garage ---------- */
.fiche-desc { max-width: 720px; font-size: 16px; line-height: 1.6; color: var(--text-dim); }
.fiche-meta { display: flex; gap: 24px; flex-wrap: wrap; font-size: 14px; color: var(--text-dim); }
.fiche-meta li { display: flex; align-items: center; gap: 8px; }
.fiche-meta .i { font-size: 16px; color: var(--accent-soft); }

/* ---------- Aside : prix + garage ---------- */
.fiche-aside {
  display: flex; flex-direction: column; gap: 20px;
  position: sticky; top: calc(var(--header-h) + 24px);
}
/* Fenêtres basses (portables) : l'aside collé défile dans sa hauteur pour garder le téléphone accessible */
@media (max-height: 880px) and (min-width: 1101px) {
  .fiche-aside { max-height: calc(100vh - var(--header-h) - 24px); overflow-y: auto; }
}
.fiche-price {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: 28px; display: flex; flex-direction: column; gap: 18px;
}
.fiche-price__head { display: flex; flex-direction: column; gap: 4px; }
.fiche-price__label { font-size: 13px; color: var(--text-dim); }
.fiche-price__value {
  font-family: var(--font-display); font-stretch: 112%; font-weight: 900; font-size: 44px; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.fiche-price__fin { font-size: 14px; color: var(--text-dim); }
.fiche-price__actions { display: flex; flex-direction: column; gap: 10px; }
.fiche-price__actions .btn { width: 100%; min-height: 54px; }
.fiche-price__link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; font-size: 14px;
}
.fiche-price__link .i { font-size: 16px; }
.fiche-price__included {
  border-top: 1px solid var(--border); padding-top: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.fiche-price__included-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
}
.fiche-price__legal { font-size: 12px; line-height: 1.4; color: var(--text-muted); }

/* ---------- Affichette de pare-brise (direction choisie par le client le 28/09/2026) ----------
   Le prix et les infos clés sur le papier du bon de reprise, comme l'affichette posée derrière
   le pare-brise d'une occasion : la seule surface claire de la page porte l'action (essai, rappel). */
.affichette {
  --affichette-x: 28px;
  --accent-soft: #B3261A;   /* rouge foncé, lisible sur le papier (lien de reprise, coches) */
  background: var(--paper); color: var(--paper-ink); border: 0; padding-top: 0; overflow: hidden;
  box-shadow: 0 32px 64px -28px rgba(0, 0, 0, 0.75), 0 12px 24px -14px rgba(0, 0, 0, 0.5);
}
.affichette :focus-visible { outline-color: var(--accent); }
.affichette__band {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin-inline: calc(-1 * var(--affichette-x)); padding: 16px var(--affichette-x) 14px;
  background: var(--accent); color: #fff;
}
.affichette__sale {
  font-family: var(--font-display); font-stretch: 115%; font-weight: 900; font-size: 22px;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.affichette__garage { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.affichette__facts {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0;
  border: 1px solid var(--paper-line); border-radius: 10px; overflow: hidden;
}
.affichette__facts > div { padding: 9px 12px; border-bottom: 1px solid var(--paper-line); }
.affichette__facts > div:nth-child(odd) { border-right: 1px solid var(--paper-line); }
.affichette__facts > div:nth-last-child(-n+2) { border-bottom: 0; }
.affichette__facts dt { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--paper-faint); }
.affichette__facts dd { margin: 0; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; }
.affichette .fiche-price__label,
.affichette .fiche-price__fin,
.affichette .fiche-price__legal,
.affichette .check-list li { color: var(--paper-dim); }
.affichette .btn--ghost { color: var(--paper-ink); border-color: var(--paper-line); background: #fff; }
.affichette .btn--ghost:hover { color: var(--paper-ink); border-color: var(--paper-faint); }
.affichette .fiche-price__included { border-top: 2px dashed rgba(11, 18, 32, 0.18); }
.affichette .fiche-price__included-title { color: var(--paper-faint); }
/* Lien « Garanties légales » de l'encadré, sur le papier de l'affichette */
.affichette .fiche-price__included a { color: var(--paper-ink); text-decoration: underline; text-underline-offset: 2px; }

.fiche-garage {
  background: var(--panel-deep); border: 1px solid var(--border); border-radius: var(--radius-panel);
  padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.fiche-garage__title { font-family: var(--font-display); font-stretch: 110%; font-weight: 800; font-size: 18px; }
.fiche-garage__info { font-size: 14px; line-height: 1.5; color: var(--text-dim); }
.fiche-garage__tel { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 16px; font-weight: 800; }
.fiche-garage__tel .i { font-size: 18px; }

/* ---------- Véhicules similaires ---------- */
.fiche-similar { padding-block: 64px 72px; }
.fiche-similar__inner { display: flex; flex-direction: column; gap: 28px; }
.fiche-similar .card-vehicle__media { height: 190px; }

/* "Véhicules" reste la rubrique active (aria-current="true", la page courante étant la fiche) */
.nav a[aria-current="true"], .mobile-nav a[aria-current="true"] { color: var(--accent-soft); }

/* ---------- États : introuvable / erreur ---------- */
.fiche-notfound {
  padding-block: 96px; display: flex; flex-direction: column; align-items: flex-start; gap: 18px;
}
.fiche-notfound .lead { max-width: 560px; }
.fiche-error { padding-block: 64px; }

/* ---------- Barre fixe mobile (prix + essai) ---------- */
.fiche-bar { display: none; }

/* ---------- Visionneuse plein écran ---------- */
.fiche-lightbox {
  position: fixed; inset: 0; z-index: 100; padding: 72px 76px 60px;
  background: rgba(5, 9, 18, 0.94);
  display: flex; align-items: center; justify-content: center;
  overscroll-behavior: contain;
}
.fiche-lightbox__media { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.fiche-lightbox__media picture { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.fiche-lightbox__img { width: 100%; height: 100%; object-fit: contain; cursor: default; }
.fiche-lightbox__btn {
  position: absolute; z-index: 2; width: 44px; height: 44px;
  border: 1px solid var(--border-hover); border-radius: var(--radius-pill);
  background: rgba(11, 18, 32, 0.85); color: var(--text); font-size: 18px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .2s;
}
.fiche-lightbox__btn:hover { border-color: var(--text); }
.fiche-lightbox__btn .i { stroke-width: 2.2; }
.fiche-lightbox__close { top: 16px; right: 16px; }
.fiche-lightbox__prev { left: 16px; top: 50%; transform: translateY(-50%); }
.fiche-lightbox__next { right: 16px; top: 50%; transform: translateY(-50%); }
.fiche-lightbox__count {
  position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 13px; font-weight: 700; color: var(--text-dim);
}

/* ---------- Tablette : une colonne, aside sous le contenu ---------- */
@media (max-width: 1100px) {
  .fiche-layout { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .fiche-aside { position: static; }

  /* Barre fixe prix + essai dès que l'aside n'est plus collé ; le pied de page garde la place dessous */
  .fiche-bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
    background: rgba(11, 18, 32, 0.94); border-top: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .fiche-bar__price { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
  .fiche-bar__price small { font-size: 12px; color: var(--text-dim); }
  .fiche-bar__price strong {
    font-family: var(--font-display); font-stretch: 110%; font-weight: 900; font-size: 22px; line-height: 1;
    font-variant-numeric: tabular-nums;
  }
  .fiche-bar .btn { flex-shrink: 0; }
  body.has-fiche-bar .site-footer { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* Un élément qui reçoit le focus (Tab) ne doit pas finir caché sous la barre fixe */
  html:has(body.has-fiche-bar) { scroll-padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
}

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .fiche-nav { padding-top: 20px; gap: 8px 16px; }
  .fiche-layout { padding-block: 20px 48px; gap: 32px; }
  .fiche-main { gap: 32px; }
  .fiche-stage { height: 260px; border-radius: var(--radius-card); }
  .fiche-stage__halo { width: 520px; height: 300px; }
  .fiche-stage__car { width: min(420px, 80%); }
  .fiche-stage__placeholder { width: 200px; height: 67px; }
  .fiche-stage__new, .fiche-stage__count { top: 12px; }
  .fiche-stage__new { left: 12px; }
  .fiche-stage__count { right: 12px; }
  .fiche-stage__demo {
    bottom: 12px; left: 12px; right: 12px; transform: none; max-width: none; justify-content: center;
    font-size: 12px; letter-spacing: 0.06em; white-space: normal; text-align: center; padding: 6px 12px;
  }
  .fiche-stage__nav--prev { left: 10px; }
  .fiche-stage__nav--next { right: 10px; }
  .fiche-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; min-height: 72px; }
  /* 5 vignettes (annonce de 5 photos), ou 5 + « +N photos » : une seule rangée, jamais une vignette
     seule sur la deuxième ligne (navigateur sans :has() : 4 colonnes, comme avant) */
  .fiche-thumbs:has(> :nth-child(5):last-child) { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .fiche-thumbs:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .fiche-thumb { height: 72px; }
  .fiche-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fiche-specs:empty { min-height: 518px; }     /* 6 rangées de 2 */
  .fiche-meta { flex-direction: column; gap: 10px; }
  .fiche-price { padding: 22px 18px; }
  .affichette { --affichette-x: 18px; padding-top: 0; }
  .fiche-price__value { font-size: 36px; }
  .fiche-garage { padding: 20px 18px; }
  .fiche-similar { padding-block: 48px; }
  .fiche-notfound { padding-block: 56px; }
  .fiche-notfound .btn { width: 100%; }

  .fiche-lightbox { padding: 68px 12px 72px; }
  .fiche-lightbox__prev, .fiche-lightbox__next { top: auto; bottom: 14px; transform: none; }
  .fiche-lightbox__prev { left: 12px; }
  .fiche-lightbox__next { right: 12px; }
  .fiche-lightbox__close { top: 12px; right: 12px; }
  .fiche-lightbox__count { bottom: 26px; }
}

@media (max-width: 640px) {
  .fiche-nav { flex-direction: column; align-items: flex-start; gap: 2px; }
  .fiche-head { gap: 12px; }
  .fiche-head__tags { gap: 8px; }
  .fiche-head__tags:empty { min-height: 80px; }  /* les tags passent sur 2 rangées */
  /* Scène plus haute, voiture calée en haut : le badge démo (3 lignes) ne recouvre plus les roues */
  .fiche-stage { height: 300px; }
  .fiche-stage__car { width: min(420px, 74%); align-self: flex-start; margin-top: 40px; }
  .fiche-thumbs { min-height: 64px; }
  .fiche-thumb { height: 64px; }
  .fiche-thumb__img--cutout { padding: 5px; }
  .fiche-desc { font-size: 15px; }
}

/* Très petits écrans (280 à 340 px) : prix et « Réserver un essai » tiennent dans la barre fixe */
@media (max-width: 340px) {
  /* 6 éléments sur une rangée : moins de 44 px de large ; deux rangées de 3 à la place. 5 éléments :
     écarts de 8 px, 44 px au moins par vignette jusqu'à 280 px */
  .fiche-thumbs:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .fiche-thumbs:has(> :nth-child(5):last-child) { gap: 8px; }
  .fiche-bar { gap: 10px; }
  .fiche-bar__price strong { font-size: 19px; }
  .fiche-bar .btn { padding-inline: 16px; }
}

/* ---------- Impression ---------- */
@media print {
  /* Les fonds ne s'impriment pas par défaut : bandeau de l'affichette en noir sur blanc */
  .affichette { box-shadow: none; border: 1px solid #999; }
  .affichette__band { background: none; color: #111; border-bottom: 2px solid #111; }
  .fiche-stage__lamp, .fiche-stage__redline { display: none; }
}
