/* ==========================================================================
   BASE — compartilhado pela vitrine (index.html) e pelo produto (produto.html)
   --------------------------------------------------------------------------
   0. Tokens (cores, vidro, fonte)
   1. Reset
   2. Transição entre páginas (View Transitions)
   3. Componentes de VIDRO: .glass, .glassBtn, .glassPanel, .toast
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. TOKENS — troque aqui as cores da sua marca
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  --color-bg: #12101c;
  --color-text: #ffffff;
  --color-muted: rgb(255 255 255 / .7);
  --color-hairline: rgb(255 255 255 / .14);

  /* O "vidro". Glassmorphism = vidro fosco. A receita:
       1. fundo SEMI-TRANSPARENTE (deixa a foto aparecer por trás)
       2. backdrop-filter: blur()  -> desfoca o que está ATRÁS do elemento
       3. borda fina clara + brilho interno no topo (a "quina" do vidro)
       4. sombra suave para destacar do fundo */
  --glass-bg: rgb(20 18 32 / .34);          /* tom escuro: contraste em fotos claras */
  --glass-bg-hover: rgb(255 255 255 / .2);
  --glass-border: rgb(255 255 255 / .28);
  --glass-highlight: rgb(255 255 255 / .35); /* brilho na borda de cima */
  --glass-blur: 20px;
  --glass-shadow: 0 12px 40px rgb(0 0 0 / .35);
  --glass-fallback: rgb(18 16 28 / .86);     /* navegador sem backdrop-filter */

  --glass-icon: rgb(255 255 255 / .92);
  --glass-solid-bg: #ffffff;   /* botão "cheio": filtro ativo, adicionar ao carrinho */
  --glass-solid-fg: #12101c;

  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   1. RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}

img, video { display: block; max-width: 100%; }
figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* Ícones SVG de traço: a cor segue o texto (currentColor) */
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   2. TRANSIÇÃO ENTRE PÁGINAS
   Navegadores com View Transitions (Chrome/Edge/Safari recentes) fazem um
   "morph": a foto clicada na vitrine cresce até virar a foto principal do
   produto. Os dois elementos recebem o MESMO view-transition-name
   ("product-media"). Navegadores sem suporte só trocam de página.
   -------------------------------------------------------------------------- */
@view-transition { navigation: auto; }

::view-transition-group(product-media) {
  animation-duration: .6s;
  animation-timing-function: cubic-bezier(.22, 1, .36, 1);
}
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .35s; }

/* --------------------------------------------------------------------------
   3. VIDRO
   -------------------------------------------------------------------------- */
.glass {
  border: 1px solid var(--glass-border);
  background:
    linear-gradient(135deg, rgb(255 255 255 / .12), rgb(255 255 255 / 0) 60%),
    var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%);
          backdrop-filter: blur(var(--glass-blur)) saturate(170%);
  box-shadow:
    inset 0 1px 0 var(--glass-highlight), /* brilho na borda de cima */
    var(--glass-shadow);                  /* sombra externa */
}

/* Navegadores sem backdrop-filter: fundo mais opaco para manter a leitura */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-fallback); }
}

/* Botão de vidro: pílula com ícone e/ou texto */
.glassBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  min-width: 44px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--glass-icon);
  font: 600 14px/1 var(--font-family);
  letter-spacing: .2px;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color .3s var(--ease-out),
    color .3s var(--ease-out),
    transform .3s var(--ease-out);
  -webkit-tap-highlight-color: transparent;
}
.glassBtn--icon { width: 44px; padding: 0; }   /* só ícone, redondo */
.glassBtn--lg { height: 52px; padding: 0 22px; font-size: 15px; }

/* Versão "cheia" (ação principal) */
.glassBtn--solid {
  --glass-bg: var(--glass-solid-bg);
  --glass-bg-hover: var(--glass-solid-bg);
  color: var(--glass-solid-fg);
  border-color: transparent;
}

@media (hover: hover) and (pointer: fine) {
  /* troca só a variável: a mesma receita de vidro, mais clara */
  .glassBtn:hover { --glass-bg: var(--glass-bg-hover); }
  .glassBtn--solid:hover { transform: translateY(-1px); }
}
.glassBtn:active { transform: scale(.97); }

.glassBtn:focus-visible,
.glass :focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Contador (ex.: itens no carrinho) */
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--glass-solid-bg);
  color: var(--glass-solid-fg);
  font: 700 11px/1 var(--font-family);
  font-variant-numeric: tabular-nums;
}
.badge:empty { display: none; }

/* Aviso rápido ("Adicionado ao carrinho") */
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  top: calc(80px + env(safe-area-inset-top, 0px));
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 999px;
  font: 600 14px/1.3 var(--font-family);
  text-align: center;
  opacity: 0;
  transform: translate(-50%, -8px);
  pointer-events: none;
  transition: opacity .3s var(--ease-out), transform .3s var(--ease-out);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Painel (compartilhar, carrinho): folha de baixo no celular,
   janela centralizada no desktop */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgb(8 6 14 / .45);
  -webkit-backdrop-filter: blur(4px);
          backdrop-filter: blur(4px);
}
@media (min-width: 640px) { .overlay { align-items: center; } }

.glassPanel {
  width: min(440px, 100%);
  max-height: calc(100svh - 32px);
  overflow: auto;
  padding: 22px;
  border-radius: 28px;
  --glass-bg: rgb(20 18 32 / .62); /* mais opaco: tem bastante texto */
}

.glassPanel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.glassPanel__title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .glassBtn, .toast { transition: none; }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
