:root {
  --couro: #3d4a3a;
  --mostarda: #b8935a;
  --oliva: #2f3a2c;
  --quermesse: #c65a2e;
  --creme: #ede4cf;
  --couro-escuro: #232b21;
  --sombra: 0 4px 14px rgba(61, 74, 58, 0.18);
  /* Aparencia customizavel pelo admin (aba Layout) - valores abaixo sao o
     padrao de fabrica, sobrescritos em runtime por assets/js/layout.js
     assim que a config salva no banco chega (ver GET /api/layout). */
  --hero-bg: linear-gradient(135deg, var(--couro) 0%, var(--couro-escuro) 100%);
  --fonte-titulo: "Fraunces", serif;
  --fonte-corpo: "Inter", "Nunito", sans-serif;
  --fonte-destaque: "Caveat", cursive;
  --cor-titulo: var(--couro);
  --cor-subtitulo: var(--mostarda);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  background: var(--creme);
  color: var(--couro-escuro);
  font-family: var(--fonte-corpo);
  line-height: 1.5;
}

h1, h2, h3, .brand {
  font-family: var(--fonte-titulo);
  color: var(--cor-titulo);
  margin: 0 0 0.4em;
}

.accent {
  font-family: var(--fonte-destaque);
  color: var(--quermesse);
}

a { color: inherit; }

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* Header */
.topbar {
  background: var(--couro);
  color: var(--creme);
  padding: 18px 0;
  box-shadow: 0 2px 8px rgba(107, 66, 38, 0);
  position: sticky;
  top: 0;
  z-index: 20;
  transition: padding 0.25s ease, box-shadow 0.25s ease;
}
.topbar.rolado { padding: 10px 0; box-shadow: var(--sombra); }
.topbar .container { display: flex; align-items: center; justify-content: space-between; }
.topbar .brand { color: var(--creme); font-size: 1.6rem; margin: 0; text-decoration: none; }
.topbar .tagline { font-family: var(--fonte-destaque); font-size: 1rem; color: var(--cor-subtitulo); display: block; margin-top: -4px; }
.topbar nav a {
  color: var(--creme);
  text-decoration: none;
  margin-left: 18px;
  font-weight: 600;
  position: relative;
}
.cart-count {
  background: var(--quermesse);
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  padding: 1px 6px;
  margin-left: 4px;
  display: inline-block;
  transition: transform 0.2s ease;
}
.cart-count.pulso { animation: contadorPulso 0.4s ease; }
@keyframes contadorPulso {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

/* Hero */
.hero {
  background: var(--hero-bg);
  color: var(--creme);
  padding: 60px 0 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(217,164,65,0.05) 0 2px, transparent 2px 20px);
}
.hero h1 { color: #fff; font-size: 2.6rem; position: relative; animation: heroSobe 0.7s ease both; }
.hero p { color: var(--cor-subtitulo); font-size: 1.3rem; font-family: var(--fonte-destaque); position: relative; margin: 0 auto; max-width: 480px; animation: heroSobe 0.7s ease 0.15s both; }
@keyframes heroSobe {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Logo: so o MEDALHAO gira/vira de minimalista pra 3D (nao a marca
   inteira - pedido do usuario, 2026-09-03: "tinha que rodar so o
   medalhao"), o texto por baixo so faz um crossfade simples parado, e no
   fim fica estatico na versao 3D. Fundo das imagens removido (PNG
   transparente) - sem quadrado/cartao visivel por baixo. */
.logo-transicao {
  margin: 0 auto 8px;
  animation: heroSobe 0.8s ease both;
}
.logo-medalha-wrap {
  position: relative;
  /* width/height identicos via min() em vez de aspect-ratio - funciona em
     navegadores mobile mais antigos que nao suportam aspect-ratio (sem
     isso a altura nao resolve e as imagens absolutas colapsam, cortadas e
     empilhadas - achado testando no celular, 2026-09-03). */
  width: min(200px, 48vw);
  height: min(200px, 48vw);
  margin: 0 auto;
  perspective: 1200px;
}
.logo-camada {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.45));
  backface-visibility: hidden;
  transform-style: preserve-3d;
  transition: opacity 1.2s cubic-bezier(.45,.05,.35,1), transform 1.2s cubic-bezier(.34,1.56,.64,1);
}
.logo-minimal { opacity: 1; transform: rotateY(0deg) scale(1); z-index: 2; }
.logo-3d { opacity: 0; transform: rotateY(-110deg) scale(.8); z-index: 1; }
.logo-transicao.revelado .logo-minimal { opacity: 0; transform: rotateY(110deg) scale(.8); z-index: 1; }
.logo-transicao.revelado .logo-3d { opacity: 1; transform: rotateY(0deg) scale(1); z-index: 2; }

/* Faixa de brilho que varre o medalhao 3D bem no instante em que ele
   assume - so dispara 1x (animation-fill-mode: forwards), nao fica em
   loop. Clip circular (border-radius:50%) pra acompanhar o formato real
   do medalhao, nao um quadrado. */
.logo-brilho {
  position: absolute;
  inset: 8%;
  z-index: 3;
  pointer-events: none;
  border-radius: 50%;
  overflow: hidden;
}
.logo-brilho::after {
  content: "";
  position: absolute;
  top: -20%;
  left: -60%;
  width: 40%;
  height: 140%;
  background: linear-gradient(115deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-20deg);
  opacity: 0;
}
.logo-transicao.revelado .logo-brilho::after {
  animation: brilhoVarre 1.1s ease 1.05s 1 both;
}
@keyframes brilhoVarre {
  0% { left: -60%; opacity: 0; }
  15% { opacity: 1; }
  75% { opacity: 1; }
  100% { left: 130%; opacity: 0; }
}

/* Glow dourado que pulsa atras do medalhao no instante da revelacao - so 1
   pulso (nao fica piscando pra sempre), o resto do brilho fica sendo o
   drop-shadow normal de .logo-camada. */
.logo-glow {
  position: absolute;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,204,51,.55) 0%, rgba(255,204,51,.18) 45%, transparent 72%);
  opacity: 0;
}
.logo-transicao.revelado .logo-glow {
  animation: glowPulso 1.8s ease .95s 1 both;
}
@keyframes glowPulso {
  0% { opacity: 0; transform: scale(.7); }
  35% { opacity: 1; transform: scale(1.08); }
  100% { opacity: .35; transform: scale(1); }
}

/* Faiscas - pontinhos de luz que piscam em posicoes/instantes diferentes
   em cima do medalhao dourado, tipo brilho de joia. Cada uma dispara 1x,
   com atraso escalonado (nth-child manual via classe s1..s4). */
.logo-sparkle {
  position: absolute;
  width: 10px;
  height: 10px;
  z-index: 4;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0%, rgba(255,255,255,.8) 35%, transparent 70%);
  opacity: 0;
}
.logo-sparkle.s1 { top: 18%; left: 28%; }
.logo-sparkle.s2 { top: 62%; left: 74%; }
.logo-sparkle.s3 { top: 74%; left: 22%; }
.logo-sparkle.s4 { top: 22%; left: 70%; }
.logo-transicao.revelado .logo-sparkle.s1 { animation: faisca .9s ease 1.3s 1 both; }
.logo-transicao.revelado .logo-sparkle.s2 { animation: faisca .9s ease 1.55s 1 both; }
.logo-transicao.revelado .logo-sparkle.s3 { animation: faisca .8s ease 1.75s 1 both; }
.logo-transicao.revelado .logo-sparkle.s4 { animation: faisca .8s ease 1.95s 1 both; }
@keyframes faisca {
  0% { opacity: 0; transform: scale(0) rotate(0deg); }
  45% { opacity: 1; transform: scale(1) rotate(45deg); }
  100% { opacity: 0; transform: scale(0) rotate(90deg); }
}

@media (prefers-reduced-motion: reduce) {
  .logo-camada, .logo-brilho::after, .logo-glow, .logo-sparkle { transition: none !important; animation: none !important; }
  .logo-minimal { opacity: 0; }
  .logo-3d { opacity: 1; transform: none; }
  .logo-glow { opacity: .3; }
}

/* Banner explicativo fechavel */
.banner {
  background: var(--mostarda);
  color: var(--couro-escuro);
  padding: 12px 0;
  text-align: center;
  font-weight: 600;
  position: relative;
}
.banner .container { display: flex; align-items: center; justify-content: center; gap: 12px; }
.banner button.fechar {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--couro-escuro);
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
}
.banner.oculto { display: none; }

/* Filtros de categoria */
.filtros { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 30px 0; }
.filtros button {
  background: #fff;
  border: 2px solid var(--couro);
  color: var(--couro);
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.15s;
}
.filtros button.ativo, .filtros button:hover { background: var(--couro); color: var(--creme); }
.filtros button:active { transform: scale(0.94); }

/* Grid de produtos */
.grid-produtos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
  margin: 30px 0 60px;
}
.card-produto {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--sombra);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s cubic-bezier(.2,.8,.2,1);
  opacity: 0;
  transform: translateY(20px);
}
.card-produto.visivel { opacity: 1; transform: translateY(0); }
.card-produto:hover { transform: translateY(-6px); box-shadow: 0 10px 24px rgba(107, 66, 38, 0.24); }
.card-produto .imagem {
  aspect-ratio: 1 / 1;
  background: var(--creme);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  position: relative;
  overflow: hidden;
}
.card-produto .imagem img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; cursor: zoom-in; }
.card-produto:hover .imagem img { transform: scale(1.08); }
.card-produto .gatilho {
  position: absolute;
  top: 10px;
  left: 10px;
  color: #fff;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  animation: carimbo 0.4s ease-out;
}
@keyframes carimbo {
  0% { transform: scale(1.4) rotate(-8deg); opacity: 0; }
  100% { transform: scale(1) rotate(-4deg); opacity: 1; }
}
.card-produto .corpo { padding: 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-produto h3 { font-size: 1.05rem; margin: 0; }
.card-produto .desc { font-size: 0.85rem; color: #6b5544; flex: 1; }
.card-produto .preco { font-size: 1.3rem; font-weight: 800; color: var(--quermesse); }
.card-produto .preco small { font-size: 0.75rem; font-weight: 400; color: #6b5544; }
.card-produto button.add {
  background: var(--oliva);
  color: #fff;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 6px;
  transition: background 0.2s, transform 0.15s;
}
.card-produto button.add:hover { background: #3a4319; }
.card-produto button.add:active { transform: scale(0.97); }
.card-produto button.add:disabled { background: #999; cursor: not-allowed; }
.card-produto button.add.confirmado { background: var(--quermesse); }

/* Skeleton de carregamento */
.skeleton-card {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--sombra);
  height: 300px;
}
.skeleton-card .skeleton-bloco {
  background: linear-gradient(90deg, #eee2cc 25%, #f5ecd9 37%, #eee2cc 63%);
  background-size: 400% 100%;
  animation: skeletonBrilho 1.4s ease infinite;
}
.skeleton-card .skeleton-imagem { height: 160px; }
.skeleton-card .skeleton-linha { height: 14px; margin: 16px 16px 0; border-radius: 4px; }
.skeleton-card .skeleton-linha.curta { width: 60%; }
@keyframes skeletonBrilho {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Botao flutuante "voltar ao topo" - lado oposto do WhatsApp de proposito,
   pra nunca sobrepor (2026-09-04, pedido do usuario: em todas as paginas). */
.btn-topo {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: var(--couro);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .25s ease, transform .25s ease;
}
.btn-topo.visivel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.btn-topo:hover { background: var(--couro-escuro); }

/* Botao flutuante WhatsApp */
.whatsapp-flutuante {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #25D366;
  color: #fff;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  animation: pulso 2.2s infinite;
  z-index: 30;
}
@keyframes pulso {
  0% { box-shadow: 0 0 0 0 rgba(37,211,102,0.5); }
  70% { box-shadow: 0 0 0 14px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* Aviso de estoque */
.secao-aviso {
  background: var(--oliva);
  color: var(--creme);
  padding: 40px 0;
  text-align: center;
}
.secao-aviso form { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.secao-aviso input {
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  min-width: 220px;
}
.secao-aviso button {
  background: var(--mostarda);
  color: var(--couro-escuro);
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
}

footer {
  background: var(--couro-escuro);
  color: var(--creme);
  text-align: center;
  padding: 24px;
  font-size: 0.85rem;
}

/* Carrinho lateral */
.carrinho-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: none; z-index: 40;
}
.carrinho-overlay.aberto { display: block; }
.carrinho-painel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 90vw);
  background: #fff; z-index: 41; padding: 20px; overflow-y: auto;
  transform: translateX(100%); transition: transform 0.25s;
}
.carrinho-overlay.aberto .carrinho-painel { transform: translateX(0); }
.carrinho-item { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid #eee; }
.carrinho-item .qtd-controles { display: flex; align-items: center; gap: 6px; }
.carrinho-item .qtd-controles button { width: 24px; height: 24px; border-radius: 4px; border: 1px solid var(--couro); background: #fff; cursor: pointer; }
.carrinho-total { font-size: 1.2rem; font-weight: 800; margin: 16px 0; display: flex; justify-content: space-between; }
.btn-primario {
  background: var(--quermesse);
  color: #fff;
  border: none;
  padding: 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-size: 1rem;
}
.btn-primario:hover { background: #8c2f28; }
.btn-primario:disabled { background: #999; cursor: not-allowed; }

/* Lightbox de foto do produto */
.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(20, 12, 6, 0.88); display: none;
  align-items: center; justify-content: center; z-index: 50; padding: 24px;
}
.lightbox-overlay.aberto { display: flex; }
.lightbox-overlay img {
  max-width: min(600px, 90vw); max-height: 85vh; border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.5); object-fit: contain;
}
.lightbox-fechar {
  position: fixed; top: 20px; right: 24px; background: none; border: none;
  color: var(--creme); font-size: 2.4rem; line-height: 1; cursor: pointer; z-index: 51;
}
.lightbox-fechar:hover { color: var(--mostarda); }
.lightbox-seta {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,0.35); color: #fff; border: none; width: 44px; height: 44px;
  border-radius: 50%; font-size: 1.8rem; line-height: 1; cursor: pointer; z-index: 51;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-seta:hover { background: rgba(0,0,0,0.6); }
.lightbox-anterior { left: 16px; }
.lightbox-proxima { right: 16px; }
.lightbox-pontos { position: absolute; bottom: 22px; left: 0; right: 0; display: flex; justify-content: center; gap: 8px; }
.lightbox-pontos span { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,0.4); }
.lightbox-pontos span.ativo { background: #fff; }
.lightbox-oculto { display: none !important; }

/* Forms genericos (checkout/admin) */
.card {
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--sombra);
  padding: 24px;
  margin: 20px 0;
}
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 0.9rem; }
input, select, textarea {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #d8c9ae;
  font-family: inherit;
  font-size: 1rem;
}
.erro { color: var(--quermesse); font-weight: 600; margin-top: 8px; }
.sucesso { color: var(--oliva); font-weight: 600; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid #eee; font-size: 0.9rem; }
th { color: var(--couro); }

/* Tabelas do admin viram lista de cards empilhados no mobile - larguras de
   coluna fixas nao cabem numa tela estreita, e rolagem horizontal esconde
   os botoes de acao (achado real: um toque automatizado acabou clicando
   em "Desativar" tentando acertar "Fotos" numa tabela apertada). Cada <td>
   ja tem data-label="Coluna" no JS pra virar rotulo aqui. */
@media (max-width: 640px) {
  table thead { display: none; }
  table, table tbody, table tr, table td { display: block; width: 100%; }
  table tr {
    border: 1px solid #e5d9c3; border-radius: 10px; padding: 6px 0; margin-bottom: 12px;
  }
  table td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 8px 12px; border-bottom: none; text-align: right;
  }
  table td::before {
    content: attr(data-label); font-weight: 700; color: var(--couro); text-align: left; flex-shrink: 0;
  }
  table td.acoes-tabela { flex-direction: column; align-items: stretch; }
  table td.acoes-tabela::before { margin-bottom: 6px; }
  table td.acoes-tabela button { margin-right: 0; margin-bottom: 8px; padding: 10px; font-size: 0.9rem; }
  table td.acoes-tabela button:last-child { margin-bottom: 0; }
}
.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 700; color: #fff; display: inline-block; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: #fff; border: 2px solid var(--couro); color: var(--couro); padding: 8px 16px; border-radius: 30px; cursor: pointer; font-weight: 600; }
.tabs button.ativo { background: var(--couro); color: #fff; }
