/*
  Vitrine "Ofertas do dia" da Home, montada por /js/ofertas-banner.js a partir do ofertas.json.
  Depende dos tokens da Home (--giles-cyan, --giles-blue, --bg, --bg-soft, --text, --text-soft, --border, --gray-300).

  Partes:
    • .nav-ofertas-pill  → atalho "🔥 Ofertas" no menu (visível também no celular)
    • .hero-ofertas      → chamariz no hero ("🔥 Ofertas do dia: até X% off →")
    • .vitrine-ofertas   → a seção: título, trilho de cards e "Ver todas"
  A seção e o chamariz começam com [hidden] e só aparecem se houver oferta válida.
*/

/* ---- atalho no menu ---- */
.nav-ofertas-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(0, 194, 255, .45);
  background: rgba(0, 194, 255, .08);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.nav-ofertas-pill:hover { border-color: var(--giles-cyan); background: rgba(0, 194, 255, .14); }
.nav-ofertas-pill:focus-visible { outline: 3px solid var(--giles-cyan); outline-offset: 2px; }
@media (max-width: 520px) { .nav-ofertas-pill { padding: 7px 11px; font-size: 13px; } }

/* ---- chamariz no hero ---- */
.hero-ofertas {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-soft);
  font-size: 14px;
  text-decoration: none;
  transition: border-color .15s ease;
}
.hero-ofertas[hidden] { display: none; }
.hero-ofertas strong { color: var(--text); }
.hero-ofertas .hero-ofertas-selo {
  padding: 2px 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--giles-cyan), var(--giles-blue));
  color: white;
  font-size: 12px;
  font-weight: 700;
}
.hero-ofertas:hover { border-color: var(--giles-cyan); }
.hero-ofertas:focus-visible { outline: 3px solid var(--giles-cyan); outline-offset: 2px; }

/* ---- seção (enxuta: título + trilho + "Ver todas") ---- */
.vitrine-ofertas { background: var(--bg-soft); padding: 48px 0 40px; overflow: hidden; }
.vitrine-ofertas[hidden] { display: none; }

.vo-topo {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.vo-topo h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.vo-ver-todas {
  flex: none;
  font-size: 15px;
  font-weight: 700;
  color: var(--giles-blue);
  text-decoration: none;
}
.vo-ver-todas:hover { text-decoration: underline; }
.vo-ver-todas:focus-visible { outline: 3px solid var(--giles-cyan); outline-offset: 2px; border-radius: 4px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vo-ver-todas { color: var(--giles-cyan); } }
:root[data-theme="dark"] .vo-ver-todas { color: var(--giles-cyan); }

/* Trilho de cards (rola na horizontal; setas no desktop) */
.vo-trilho-wrap { position: relative; }
.vo-trilho {
  list-style: none;
  margin: 0;
  padding: 4px 2px 14px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 200px;
  gap: 14px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
}
.vo-trilho > li { scroll-snap-align: start; }
.vo-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.vo-card:hover { transform: translateY(-2px); box-shadow: 0 12px 28px -14px rgba(0, 71, 224, .35); }
.vo-card:focus-visible { outline: 3px solid var(--giles-cyan); outline-offset: 2px; }
/* Foto sempre em fundo branco: as imagens do ML vêm com fundo branco */
.vo-foto { position: relative; aspect-ratio: 1; background: #fff; border-bottom: 1px solid var(--border); }
.vo-foto img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.vo-selo {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--giles-cyan), var(--giles-blue));
  color: white;
  font-size: 12px;
  font-weight: 700;
}
/* Etiqueta de origem: "Mercado Livre" (texto, nas cores da loja; não usa o logotipo) */
.vo-loja {
  position: absolute;
  left: 8px; bottom: 8px;
  padding: 0 6px;
  border-radius: 4px;
  background: #ffe600;
  color: #2d3277;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}
.vo-texto { display: flex; flex-direction: column; gap: 2px; padding: 12px 13px 14px; flex: 1; }
.vo-titulo {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  margin-bottom: 4px;
}
.vo-de { font-size: 12.5px; color: var(--text-soft); text-decoration: line-through; }
.vo-preco { font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.vo-frete { font-size: 12px; font-weight: 600; color: #0E8A4B; margin-top: 2px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vo-frete { color: #3CCF7F; } }
:root[data-theme="dark"] .vo-frete { color: #3CCF7F; }

.vo-seta {
  position: absolute;
  top: calc(50% - 28px);
  z-index: 2;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px -10px rgba(4, 10, 26, .4);
  display: grid;
  place-items: center;
}
.vo-seta--esq { left: -18px; }
.vo-seta--dir { right: -18px; }
.vo-seta:disabled { opacity: 0; pointer-events: none; }
.vo-seta:focus-visible { outline: 3px solid var(--giles-cyan); outline-offset: 2px; }

/* Aviso de afiliado (discreto) */
.vo-nota { margin: 6px 0 0; font-size: 12px; color: var(--text-soft); }

/* ---- celular ---- */
@media (max-width: 860px) {
  .vitrine-ofertas { padding: 40px 0 32px; }
  .vo-topo h2 { font-size: 21px; }
  .vo-trilho { grid-auto-columns: 150px; gap: 10px; margin: 0 -24px; padding: 4px 24px 10px; scroll-padding: 0 24px; scrollbar-width: none; }
  .vo-trilho::-webkit-scrollbar { display: none; }
  .vo-seta { display: none; }
  .vo-preco { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .vo-card, .hero-ofertas { transition: none; }
  .vo-card:hover { transform: none; }
}

/* Celular: o atalho "🔥 Ofertas" ocupa o lugar do "Fale conosco" do topo (o botão flutuante do WhatsApp continua) */
@media (max-width: 520px) {
  nav:has(.nav-ofertas-pill) { gap: 10px; }
  nav:has(.nav-ofertas-pill) > a.btn-primary { display: none; }
}
