/* =====================================================================
   AVELINE – Estilos da loja
   (Layout com utilitários Tailwind; aqui ficam estados e componentes.)
   ===================================================================== */

:root {
  --wine: #541623;
  --dark: #2D1B1E;
  --cream: #F2E9D4;
  --gold: #CBB68E;
  --gold-hover: #b8a074;
  --linen: #FAF7F2;
  --surface: #FFFBF7;
  --border: #E8DED1;
}

html { scroll-behavior: smooth; scroll-padding-top: 90px; }
.font-serif { font-variant-numeric: lining-nums; }
body { background: var(--linen); }

.announcement-track {
  display: flex;
  width: max-content;
  animation: marquee 40s linear infinite;
}
.announcement-segment {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: 11px;
  letter-spacing: 0.22em;
  font-weight: 500;
  text-transform: uppercase;
}
@keyframes marquee {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* Navegadores nao aplicam a fonte da pagina em controles de formulario. */
input, select, textarea, button { font-family: inherit; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--linen); }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 3px; }

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  user-select: none;
}
.material-symbols-outlined.is-filled { font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24; }

/* ---------- Header ---------- */
.glass-nav {
  background: rgba(255, 251, 247, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.nav-link { border-bottom: 2px solid transparent; padding-bottom: 4px; transition: color .2s, border-color .2s; }
.nav-link:hover { color: var(--wine); }
.nav-link.is-active { color: var(--wine); border-color: var(--gold); }

.nav-pill {
  padding: .35rem .85rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--dark);
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 9999px;
  transition: all .2s;
  white-space: nowrap;
}
.nav-pill:hover { border-color: var(--wine); color: var(--wine); }
.nav-pill.is-active { background: var(--wine); border-color: var(--wine); color: #fff; }

/* ---------- Filtros do catálogo ---------- */
.cat-pill {
  padding: .4rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--dark);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-radius: 9999px;
  transition: all .2s;
}
.cat-pill:hover { border-color: var(--wine); }
.cat-pill.is-active { background: var(--wine); border-color: var(--wine); color: #fff; }

/* ---------- Bússola olfativa ---------- */
.tag-btn {
  padding: .5rem 1rem;
  background: #fff;
  border: 1px solid var(--border);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  transition: all .2s;
}
.tag-btn:hover { border-color: var(--gold); }
.tag-btn.is-active { background: var(--gold); border-color: var(--gold); color: var(--wine); }

/* ---------- Carrossel do hero ---------- */
.hero-slide { transition: opacity .7s ease; }
.hero-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--gold); opacity: .35;
  border: none; cursor: pointer;
  transition: opacity .3s, transform .3s;
}
.hero-dot:hover { opacity: .6; }
.hero-dot.is-active { opacity: 1; transform: scale(1.25); }

/* ---------- Cards de produto ---------- */
.product-media { position: relative; overflow: hidden; background: rgba(242, 233, 212, .35); }
.product-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.group:hover .product-media img { transform: scale(1.05); }
.product-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  color: var(--gold);
  background: radial-gradient(circle at 50% 40%, #fff 0%, rgba(242, 233, 212, .55) 70%);
}
.product-placeholder .material-symbols-outlined { font-size: 56px; }
/* Miniaturas (sacola, favoritos, busca): placeholder compacto */
.w-14 > .product-placeholder .material-symbols-outlined,
.w-20 > .product-placeholder .material-symbols-outlined { font-size: 24px; }
.w-14 > .product-placeholder span:not(.material-symbols-outlined),
.w-20 > .product-placeholder span:not(.material-symbols-outlined) { display: none; }

.family-chip {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--wine);
  background: rgba(242, 233, 212, .7);
  border: 1px solid rgba(203, 182, 142, .4);
}

/* ---------- Drawers, modais e overlay ---------- */
.backdrop {
  position: fixed; inset: 0; z-index: 45;
  background: rgba(45, 27, 30, .45);
  backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .3s;
}
.backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer { transition: transform .45s cubic-bezier(.22, .61, .36, 1); }
.drawer.drawer-right { transform: translateX(100%); }
.drawer.drawer-left  { transform: translateX(-100%); }
.drawer.is-open { transform: translateX(0); }

.modal {
  position: fixed; inset: 0; z-index: 55;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal-panel { transform: translateY(16px) scale(.98); transition: transform .3s; max-height: calc(100vh - 2rem); overflow-y: auto; }
.modal.is-open .modal-panel { transform: none; }

body.is-locked { overflow: hidden; }

/* Seletor de tamanho no detalhe do produto */
.variant-option {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  background: #fff;
  font-size: .8rem;
  cursor: pointer;
  transition: all .2s;
}
.variant-option:hover { border-color: var(--wine); }
.variant-option.is-active { border-color: var(--wine); background: rgba(242, 233, 212, .5); box-shadow: inset 3px 0 0 var(--wine); }

.thumb-btn { border: 1px solid var(--border); opacity: .7; transition: all .2s; }
.thumb-btn:hover, .thumb-btn.is-active { border-color: var(--wine); opacity: 1; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 70;
  transform: translate(-50%, 20px);
  opacity: 0; pointer-events: none;
  background: var(--dark); color: var(--cream);
  padding: .8rem 1.25rem;
  font-size: .78rem; letter-spacing: .04em;
  border: 1px solid rgba(203, 182, 142, .4);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  transition: all .3s;
  max-width: calc(100vw - 32px);
}
#toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
#toast.is-error { background: #7f1d1d; }

/* ---------- Skeleton de carregamento ---------- */
.skeleton {
  background: linear-gradient(90deg, #f3ece0 25%, #faf6ef 50%, #f3ece0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Alvos de toque (44px, recomendação Apple/Google) ---------- */
.tap-target {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
}

/* clip (e não hidden) porque hidden criaria contexto de rolagem e
   quebraria o position:sticky do cabeçalho. */
body { overflow-x: clip; }
* { -webkit-tap-highlight-color: transparent; }

/* ---------- Mobile: ajustes gerais ---------- */
@media (max-width: 639px) {
  /* Campos com menos de 16px fazem o iOS dar zoom sozinho ao focar. */
  input, select, textarea { font-size: 16px !important; }
  .order-field::placeholder, #newsletter-email::placeholder { font-size: 14px; }

  /* Menu mobile: cada link vira uma faixa tocável */
  #mobile-menu-nav a,
  #mobile-menu-nav button {
    display: flex; align-items: center;
    min-height: 48px;
    padding: 0 .5rem;
    border-bottom: 1px solid rgba(232, 222, 209, .7);
  }
  #mobile-menu-nav > *:last-child { border-bottom: none; }

  /* Filtros e tags: altura tocável sem ficarem enormes */
  .cat-pill { padding: .6rem 1rem; min-height: 40px; display: inline-flex; align-items: center; }
  .tag-btn { padding: .55rem .85rem; font-size: .7rem; min-height: 40px; }

  /* Opções de tamanho no detalhe do produto */
  .variant-option { min-height: 48px; }

  /* Links do rodapé: espaçados o bastante para não errar o toque */
  footer li a, footer a { display: inline-flex; align-items: center; min-height: 36px; }
  footer ul.space-y-2 > li + li { margin-top: .25rem; }

  /* Botões dos cards de produto */
  .card-action { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .card-wish { width: 44px; height: 44px; }

  /* Hero: título menor, botões empilhados */
  #inicio h1 { font-size: 2rem; line-height: 1.15; }

  /* Hero carrossel: card compacto */
  .hero-slide .backdrop-blur-md { padding: .75rem 1rem; }
  .hero-slide .font-serif.text-xl { font-size: 1rem; }
  .hero-slide button[onclick^="openProduct"] { padding-top: .5rem; padding-bottom: .5rem; }

  /* Catálogo: filtros rolam na horizontal */
  #catalog-filters { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding-bottom: 4px; }
  #catalog-filters::-webkit-scrollbar { display: none; }
  #catalog-filters .cat-pill { flex-shrink: 0; }

  /* Quiz result: empilhado */
  #quiz-result { flex-direction: column; text-align: center; padding: 1rem; }
  #quiz-result .product-media { width: 80px; height: 96px; }

  /* Depoimentos: empilhados (1 coluna) */
  .grid.grid-cols-1.md\:grid-cols-3 > figure { padding: 1.25rem; }

  /* Footer: copyright empilha */
  footer .grid { gap: 1.5rem; }

  /* Modal do produto: ocupa tudo */
  .modal-panel { max-height: 100vh; max-height: 100dvh; border-radius: 0; }
  #product-modal .modal-panel { max-width: 100%; }

  /* Botões do hero menores */
  #inicio a[href="#catalogo"],
  #inicio a[href="#sobre"] { padding: .75rem 1.25rem; font-size: .65rem; }

  /* WhatsApp flutuante: menor no mobile */
  a[data-link="whatsapp-hello"] { padding: .75rem; bottom: 1rem; right: 1rem; }
  a[data-link="whatsapp-hello"] svg { width: 1.5rem; height: 1.5rem; }

  /* Sobre: padding menor */
  #sobre { padding-top: 3rem; padding-bottom: 3rem; }
  #sobre .aspect-\[3\/4\] { aspect-ratio: 16/10; }

  /* Modal do produto: imagem menor para caber info */
  #product-modal-content .product-media { aspect-ratio: 1/1 !important; max-height: 55vw; }

  /* Sacola: CEP e telefone um abaixo do outro */
  #cart-footer .grid-cols-2 { grid-template-columns: 1fr; }

  /* Barra de aviso: sem espaçamento exagerado entre letras */
  #announcement-bar { letter-spacing: .12em; }
}

/* ---------- Touch: hover desativado e alvos maiores ---------- */
@media (hover: none) {
  .group:hover .product-media img { transform: none; }
  .product-media img { transition: none; }
}

/* Vale para tablets em modo toque, não só para telas estreitas. */
@media (pointer: coarse) {
  .cat-pill, .tag-btn, .variant-option { min-height: 44px; }
  .card-action { min-height: 44px; }
  .thumb-btn { min-width: 48px; min-height: 48px; }
}

/* ---------- Drawers e modais: altura real no iOS ---------- */
/* 100vh no Safari móvel inclui a barra de endereço e corta o conteúdo. */
@supports (height: 100dvh) {
  .drawer { height: 100dvh; }
  .modal { height: 100dvh; }
  .modal-panel { max-height: calc(100dvh - 2rem); }
}

/* Rolagem suave dentro dos drawers no iOS */
.drawer, .modal-panel, #cart-items-list, #wishlist-items {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ---------- Safe area (iPhone com notch) ---------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  footer { padding-bottom: calc(3rem + env(safe-area-inset-bottom)); }
  #cart-footer,
  #mobile-menu-nav,
  .drawer nav { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
  a[data-link="whatsapp-hello"] { bottom: calc(1rem + env(safe-area-inset-bottom)); }
}

/* Notch em paisagem: só no mobile, para não mexer no padding do desktop. */
@media (max-width: 639px) and (orientation: landscape) {
  header > div, #announcement-bar, main > div > section {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }
}

/* ---------- Acessibilidade ---------- */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Descrição formatada do produto (vinda do editor do admin) */
.rich-text p { margin: 0 0 .7rem; }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text h2 { font-family: 'Segoe UI', 'Playfair Display', serif; font-size: 1.3rem; color: var(--wine); margin: .6rem 0 .5rem; }
.rich-text h3 { font-family: 'Segoe UI', 'Playfair Display', serif; font-size: 1.1rem; color: var(--wine); margin: .6rem 0 .4rem; }
.rich-text ul, .rich-text ol { margin: 0 0 .7rem; padding-left: 1.4rem; }
.rich-text ul { list-style: disc; }
.rich-text ol { list-style: decimal; }
.rich-text li { margin-bottom: .25rem; }
.rich-text a { color: var(--wine); text-decoration: underline; }
.rich-text pre {
  margin: 0 0 .7rem; padding: .6rem .7rem;
  background: rgba(242, 233, 212, .4);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .78rem; white-space: pre-wrap;
}

/* Banners: o texto fica sobre imagem escura, então herda a cor clara */
.banner-copy h2, .banner-copy h3, .banner-copy a { color: inherit; }
.banner-title p { margin: 0; }
.banner-title h2, .banner-title h3 { font-size: inherit; margin: 0; }
.banner-title ul, .banner-title ol { padding-left: 1.4rem; }
.banner-title ul { list-style: disc; }
.banner-title ol { list-style: decimal; }

/* ---------- Carrossel de banners ---------- */
.banner-carousel {
  position: relative; overflow: hidden; width: 100%;
  transition: height .45s cubic-bezier(.22, .61, .36, 1);
}
.banner-track {
  display: flex; height: 100%;
  align-items: flex-start;   /* sem esticar: cada imagem mantém a altura dela */
  transition: transform .5s cubic-bezier(.22, .61, .36, 1);
}
.banner-slide { width: 100%; }
/* Com texto sobreposto a altura é fixa, então o slide preenche o carrossel */
.banner-carousel[data-banner-fixed="1"] .banner-track { align-items: stretch; }
.banner-carousel[data-banner-fixed="1"] .banner-slide { height: 100%; }

.banner-arrow, .hero-arrow {
  position: absolute; top: 50%; z-index: 2;
  transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  color: #F2E9D4;
  background: rgba(26, 10, 16, .6);
  border: 1px solid rgba(203, 182, 142, .45);
  border-radius: 9999px;
  backdrop-filter: blur(4px);
  transition: background .2s, border-color .2s;
}
.banner-arrow:hover, .hero-arrow:hover { background: rgba(26, 10, 16, .85); border-color: var(--gold); }
.banner-arrow-prev, .hero-arrow-prev { left: 12px; }
.banner-arrow-next, .hero-arrow-next { right: 12px; }

/* O slide ativo do hero recebe z-10, então as setas precisam vir acima */
.hero-arrow { z-index: 20; }

.banner-dots {
  position: absolute; left: 50%; bottom: 16px; z-index: 2;
  transform: translateX(-50%);
  display: flex; gap: 8px;
}
.banner-dot {
  width: 9px; height: 9px;
  border-radius: 9999px;
  background: rgba(203, 182, 142, .3);
  border: 1px solid rgba(203, 182, 142, .6);
  transition: background .2s, width .2s;
}
.banner-dot.is-active { background: var(--gold); width: 22px; }

@media (max-width: 639px) {
  .banner-arrow, .hero-arrow { width: 38px; height: 38px; }
  .banner-arrow-prev, .hero-arrow-prev { left: 6px; }
  .banner-arrow-next, .hero-arrow-next { right: 6px; }
}
