/* ════════════════════════════════════════════════════════════════
   MÉCAREMAP — GARAGE DE L'ACCUEIL (js/garage.js) : choix de la voiture du studio 3D
   Le bouton prend la place de la jauge « Studio 3D » quand la voiture est prête (.car-dock).
   Animations : transform / opacité uniquement ; aucun flou au-dessus du rendu 3D.
   ════════════════════════════════════════════════════════════════ */
.car-dock.is-ready .car-load { position: absolute; right: 0; bottom: 0; }
.gar {
  position: relative; display: grid; justify-items: end; gap: 8px;
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity .4s ease, transform .4s var(--s-ease);
}
.gar.is-on { opacity: 1; transform: none; pointer-events: auto; }

/* Bouton « Votre voiture · Changer » */
.gar-btn {
  display: inline-flex; align-items: center; gap: 12px; margin: 0;
  padding: 7px 14px 7px 7px; border-radius: var(--r-md); cursor: pointer;
  color: var(--s-ink); background: rgba(8, 8, 12, .84); border: 1px solid var(--s-line-2);
  box-shadow: 0 16px 36px -18px rgba(0, 0, 0, .95);
  font: inherit; text-align: left;
  transition: transform .35s var(--s-ease), border-color .3s, box-shadow .35s;
}
.gar-btn:hover, .gar-btn:focus-visible { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: none; outline: none; }
.gar-btn:active { transform: scale(.98); }
.gar-ic {
  position: relative; display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%;
  color: #fff; background: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
}
.gar-ic svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gar-ic::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid var(--line-strong); opacity: 0; }
.gar.is-busy .gar-ic::after { animation: garPing 1.3s cubic-bezier(0, 0, .2, 1) infinite; }
@keyframes garPing { 0% { transform: scale(.8); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.gar-btn-tx { display: grid; gap: 4px; min-width: 0; }
.gar-btn-tx small { font: 600 9.5px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--s-mute); }
.gar-btn-tx b { font: 600 12.5px/1.1 var(--font-ui); letter-spacing: .05em; color: var(--s-ink); white-space: nowrap; }
.gar-chg {
  display: inline-flex; align-items: center; gap: 5px; margin-left: 2px; padding-left: 12px; border-left: 1px solid var(--s-line-2);
  font: 600 10.5px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--text);
}
.gar-chg svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .4s var(--s-ease); }
.gar.is-open .gar-chg svg { transform: rotate(180deg); }

/* Liste des voitures (s'ouvre au-dessus du bouton) */
.gar-panel {
  position: absolute; right: 0; bottom: calc(100% + 12px); z-index: 5;
  display: flex; flex-direction: column; width: min(372px, calc(100vw - 32px)); max-height: min(64vh, 560px);
  border-radius: var(--r-lg); overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 20, 26, .985), rgba(9, 9, 13, .985));
  border: 1px solid var(--s-line-2); box-shadow: 0 34px 80px -26px rgba(0, 0, 0, .95), inset 0 1px 0 rgba(255, 255, 255, .05);
  opacity: 0; transform: translateY(12px) scale(.98); transform-origin: 100% 100%;
  transition: opacity .25s ease, transform .4s var(--s-ease);
}
.gar-panel[hidden] { display: none; }
.gar.is-open .gar-panel { opacity: 1; transform: none; }
.gar-head { padding: 16px 18px 10px; border-bottom: 1px solid var(--s-line); }
.gar-h { margin: 0 0 5px; font: 600 12px/1.2 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--s-ink); }
.gar-hint { margin: 0; font: 500 11.5px/1.4 var(--s-body); color: var(--s-mute); }
.gar-list { margin: 0; padding: 8px; list-style: none; display: grid; gap: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.gar-car {
  position: relative; display: grid; grid-template-columns: 104px 1fr 22px; align-items: center; gap: 13px;
  padding: 7px 10px 7px 7px; border-radius: var(--r-md); cursor: pointer; outline: none;
  transition: background .2s ease, box-shadow .25s ease;
}
.gar.is-open .gar-car { animation: garIn .5s var(--s-ease) backwards; animation-delay: calc(var(--i, 0) * 28ms + 60ms); }
@keyframes garIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.gar-car:hover, .gar-car:focus-visible { background: rgba(255, 255, 255, .055); }
.gar-car:focus-visible { box-shadow: none; }
.gar-car.is-cur { background: var(--accent-soft); box-shadow: none; }
.gar-thumb {
  display: block; width: 104px; aspect-ratio: 16 / 9; border-radius: var(--r-sm); overflow: hidden;
  background: radial-gradient(120% 90% at 50% 70%, #1d1d24, #0a0a0d);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.gar-thumb { position: relative; display: grid; place-items: center; }
.gar-thumb > svg { width: 42%; height: auto; fill: none; stroke: rgba(255, 255, 255, .38); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.gar-thumb img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s ease, transform .4s var(--s-ease); }
.gar-thumb.has-img img { opacity: 1; }
.gar-thumb.has-img > svg { visibility: hidden; }
.gar-car:hover .gar-thumb img { transform: scale(1.06); }
.gar-tx { display: grid; gap: 5px; min-width: 0; }
.gar-tx b { font: 700 14px/1.15 var(--s-body); color: var(--s-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gar-tx small { font: 600 10px/1 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--s-mute); }
.gar-ok { display: grid; place-items: center; color: var(--text); opacity: 0; transform: scale(.6); transition: opacity .3s, transform .4s var(--s-ease); }
.gar-ok svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.gar-car.is-cur .gar-ok { opacity: 1; transform: none; }
/* téléchargement de la voiture choisie : fine jauge rouge sous la ligne */
.gar-bar { position: absolute; left: 10px; right: 10px; bottom: 3px; height: 2px; border-radius: var(--r-xs); background: var(--s-line-2); overflow: hidden; opacity: 0; transition: opacity .3s; }
.gar-bar b { position: absolute; inset: 0; background: var(--accent); box-shadow: none; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); transition: transform .25s linear; }
.gar-car.is-load .gar-bar { opacity: 1; }
.gar-car.is-fail { box-shadow: inset 0 0 0 1px rgba(255, 140, 60, .55); }
.gar-st { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Téléphone : bouton centré sous la voiture, liste centrée au-dessus */
@media (max-width: 899px) {
  .gar { justify-items: center; }
  .gar-panel { right: auto; left: 50%; margin-left: calc(min(372px, calc(100vw - 32px)) / -2); transform-origin: 50% 100%; max-height: min(58vh, 520px); }
  .gar-btn { padding-right: 12px; }
}
@media (max-width: 380px) {
  .gar-car { grid-template-columns: 84px 1fr 20px; gap: 10px; }
  .gar-thumb { width: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  .gar, .gar-panel, .gar-btn, .gar-chg svg, .gar-thumb img { transition: none; }
  .gar.is-open .gar-car, .gar.is-busy .gar-ic::after { animation: none; }
}

/* Thème clair */
html[data-theme="light"] .gar-btn { background: rgba(255, 255, 255, .94); box-shadow: 0 14px 30px -18px rgba(20, 24, 40, .55); }
html[data-theme="light"] .gar-panel { background: linear-gradient(180deg, #ffffff, #f5f6f8); box-shadow: 0 30px 70px -26px rgba(20, 24, 40, .5); }
html[data-theme="light"] .gar-car:hover, html[data-theme="light"] .gar-car:focus-visible { background: rgba(18, 20, 26, .045); }
html[data-theme="light"] .gar-car.is-cur { background: var(--accent-soft); }
html[data-theme="light"] .gar-thumb { background: radial-gradient(120% 90% at 50% 70%, #262630, #0d0d11); }
