/* Complementos do layout da vitrine (index.html usa Tailwind, design Stitch).
 * Aqui fica só o que o Tailwind não cobre: galeria, tela cheia, barra do celular e aviso. */

html, body { overflow-x: clip; }
html:has(> body.noscroll) { overflow: hidden; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #ff4b53; outline-offset: 2px; }
.i { flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: 8px; z-index: 100; transform: translateY(-200%); padding: 8px 16px; border-radius: 8px; background: #E51A24; color: #fff; font-weight: 700; }
.skip:focus { transform: none; }
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }

/* Página montada pelo servidor (page.php): antes do vitrine.js rodar, já sem o aviso de demonstração
 * e, na página de um carro, sem mostrar a lista por um instante. */
html.vcm-live [data-purpose="announcement-bar"] > div > div:first-child { display: none; }
html.vcm-live [data-purpose="announcement-bar"] > div > div:nth-child(2) { margin-left: auto; }
html.vcm-detail :is([data-purpose="hero-filters-section"], [data-purpose="trust-badges"], [data-purpose="vehicle-inventory-grid"], [data-purpose="bottom-cta-banner"]) { display: none; }

/* O link do carro cobre o card inteiro; o botão do WhatsApp fica por cima */
.card-link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card-link:focus-visible { outline: none; }
.card-link:focus-visible::after { outline: 2px solid #ff4b53; outline-offset: -2px; border-radius: 1rem; }

/* ------------------------------------------------------------ galeria */

.gal { position: relative; background: #0a0c10; }
@media (min-width: 640px) { .gal { border-radius: 1rem; overflow: hidden; border: 1px solid #1f2530; } }
.gal-track { display: flex; aspect-ratio: 4 / 3; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-slide { flex: 0 0 100%; scroll-snap-align: center; scroll-snap-stop: always; }
.gal-slide img { width: 100%; height: 100%; object-fit: contain; cursor: zoom-in; user-select: none; -webkit-user-select: none; }
.gal-empty { aspect-ratio: 4 / 3; display: grid; place-content: center; justify-items: center; gap: 8px; color: #94a3b8; }
.gal-btn, .gal-zoom { position: absolute; display: grid; place-items: center; cursor: pointer; border: 1px solid rgba(255, 255, 255, 0.15); border-radius: 50%; background: rgba(7, 8, 10, 0.75); color: #fff; transition: background-color 0.15s; }
.gal-btn:hover, .gal-zoom:hover { background: #E51A24; }
.gal-btn { top: calc(50% - 24px); width: 48px; height: 48px; }
.gal-prev { left: 12px; }
.gal-next { right: 12px; }
.gal-btn:disabled { visibility: hidden; }
.gal-zoom { top: 12px; right: 12px; width: 44px; height: 44px; }
.gal-count { position: absolute; left: 12px; bottom: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(0, 0, 0, 0.85); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.gal-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px 4px; scrollbar-width: thin; scrollbar-color: #334155 transparent; }
@media (min-width: 640px) { .gal-thumbs { padding: 12px 0 4px; } }
.gal-thumb { flex: 0 0 84px; aspect-ratio: 4 / 3; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: #0a0c10; opacity: 0.55; cursor: pointer; transition: opacity 0.15s, border-color 0.15s; }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; }
.gal-thumb:hover { opacity: 0.9; }
.gal-thumb[aria-current="true"] { opacity: 1; border-color: #E51A24; }

/* ------------------------------------------------------------ tela cheia */

.lightbox { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #000; color: #fff; }
.lightbox[hidden] { display: none; }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: max(8px, env(safe-area-inset-top)) 12px 8px 16px; }
.lb-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-close, .lb-btn { display: grid; place-items: center; cursor: pointer; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; transition: background-color 0.15s; }
.lb-close:hover, .lb-btn:hover { background: #E51A24; }
.lb-track { flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; outline: none; }
.lb-track::-webkit-scrollbar { display: none; }
.lb-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: grid; place-items: center; }
.lb-slide img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-select: none; }
.lb-btn { position: absolute; top: calc(50% - 24px); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@media (hover: none) { .lb-btn { display: none; } }

/* ------------------------------------------------- barra fixa no celular */

.buybar { display: none; }
@media (max-width: 1023.98px) {
  .buybar:not([hidden]) {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    background: rgba(14, 16, 20, 0.97); border-top: 2px solid #E51A24;
    padding: 12px max(16px, env(safe-area-inset-right)) calc(12px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  body.has-buybar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  body.has-buybar [data-purpose="floating-whatsapp-widget"] { display: none; }
}

/* ------------------------------------------------------------ aviso */

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 70; max-width: min(36rem, calc(100% - 32px)); overflow-wrap: anywhere; padding: 12px 16px; border-radius: 10px; background: #13161c; border: 1px solid rgba(229, 26, 36, 0.5); color: #fff; opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
body.has-buybar .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  .card-glow:hover, .group:hover img { transform: none !important; }
}
