/* La Brasa Smokeshop — catálogo digital
   Mundo: papel e tinta oldschool. Ver contrato de direção no index.html. */

:root {
  --paper: #EFEBE2;
  --paper-raised: #F5F2EA;
  --ink: #141210;
  --ink-soft: #6E6558;
  --brasa: #F2A81D;
  --fogo: #E3271A;
  --hairline: color-mix(in srgb, var(--ink) 16%, var(--paper));
  --font-ui: "Courier Prime", "Courier New", monospace;
  --font-display: "Rye", "Georgia", serif;
  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-in: cubic-bezier(0.6, 0, 0.85, 0.4);
  --app-w: 430px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* atributo hidden vence qualquer display de autor */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  min-height: 100dvh;
}

/* grão de papel sobre tudo — coesão de impresso */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.08 0 0 0 0 0.07 0 0 0 0 0.06 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--brasa);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ícones autorais — um traço só pro sistema inteiro */
svg { stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; fill: none; }

.app {
  max-width: var(--app-w);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  position: relative;
}

main { flex: 1; }

/* ============ TOPBAR ============ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px;
  background: var(--paper);
  border-bottom: 1.5px solid var(--ink);
}

.topbar-spacer,
.topbar-bag { width: 44px; }

.topbar-logo {
  height: 52px;
  width: auto;
  mix-blend-mode: multiply;
}

.topbar-bag {
  position: relative;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.topbar-bag svg { width: 24px; height: 24px; }

.bag-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--fogo);
  color: var(--paper-raised);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  transition: transform 220ms var(--ease-out);
}

.bag-badge.is-pulse { transform: scale(1.25); }

/* ============ HERO ============ */

.hero {
  position: relative;
  border-bottom: 1.5px solid var(--ink);
  background: linear-gradient(160deg, #f0d9a8, var(--brasa));
}

.hero-bg {
  width: 100%;
  height: 220px;
  object-fit: cover;
  mix-blend-mode: multiply;
}

.hero-banner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(62%, 270px);
  filter: drop-shadow(0 3px 8px rgba(20, 18, 16, 0.35));
}

/* ============ CHIPS ============ */

.chips {
  display: flex;
  gap: 8px;
  padding: 14px 16px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  padding: 7px 14px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--paper);
  transition: background-color 180ms var(--ease-out), transform 120ms var(--ease-out);
}

.chip:active { transform: scale(0.96); }

.chip.is-active { background: var(--brasa); }

/* ============ GRID ============ */

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1.5px solid var(--ink);
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--paper); /* backdrop do multiply das fotos (o card é stacking context pela animação) */
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--hairline);
  animation: card-in 240ms var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 30ms);
}

.card:nth-child(odd) { border-right: 1px solid var(--hairline); }

@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

.card-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 0; /* flex column: sem isso a proporção intrínseca de foto retrato estica o quadrado */
  margin-bottom: 10px;
}

.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.card-fav {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink);
}

.card-fav svg {
  width: 21px;
  height: 21px;
  transition: transform 200ms var(--ease-out);
}

.card-fav.is-on svg {
  fill: var(--fogo);
  stroke: var(--fogo);
}

.card-fav.is-pop svg { transform: scale(1.25); }

.card-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  min-height: 2.7em;
}

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
}

.card-price { font-size: 16px; font-weight: 700; }

.card-add {
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--paper);
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.card-add svg { width: 17px; height: 17px; }

.card-add:active { transform: scale(0.92); }

.card-add.is-done { background: var(--brasa); }

/* ============ EMPTY STATES ============ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 32px 44px;
}

.empty img {
  width: 170px;
  mix-blend-mode: multiply;
  margin-bottom: 14px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 21px;
  margin-bottom: 6px;
}

.empty-text {
  color: var(--ink-soft);
  font-size: 13.5px;
  max-width: 24ch;
  margin-bottom: 18px;
}

.btn-ghost {
  padding: 10px 18px;
  border: 2px solid var(--ink);
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.btn-ghost:active { transform: scale(0.97); background: var(--brasa); }

/* ============ RODAPÉ ============ */

.foot {
  background: var(--ink);
  border-top: 1.5px solid var(--ink);
  padding: 18px 16px 22px;
  text-align: center;
}

.foot-warn {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--paper);
}

.foot-note {
  font-size: 12px;
  color: color-mix(in srgb, var(--paper) 60%, var(--ink));
  margin-top: 4px;
}

/* ============ SACOLA ============ */

.view-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 27px;
  padding: 18px 16px 10px;
}

.view-count { font-family: var(--font-ui); font-size: 15px; color: var(--ink-soft); }

.bag-items { border-top: 1.5px solid var(--ink); }

.bag-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  background: var(--paper);
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--hairline);
  animation: card-in 240ms var(--ease-out) both;
}

.bag-thumb {
  width: 78px;
  height: 78px;
}

.bag-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.bag-info { display: flex; flex-direction: column; gap: 2px; }

.bag-name { font-weight: 700; font-size: 13.5px; line-height: 1.35; }

.bag-variant { font-size: 12.5px; color: var(--ink-soft); }

.bag-price { font-size: 13.5px; }

.stepper {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  width: max-content;
}

.stepper button {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
}

.stepper button:disabled { opacity: 0.35; cursor: default; }

.stepper svg { width: 14px; height: 14px; }

.stepper-qty {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
  font-size: 13.5px;
}

.bag-remove {
  align-self: start;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: color 160ms var(--ease-out);
}

.bag-remove:active { color: var(--fogo); }

.bag-remove svg { width: 16px; height: 16px; }

/* resumo */

.bag-summary { padding: 18px 16px 26px; }

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 4px 0;
}

.summary-total {
  font-weight: 700;
  font-size: 16px;
  border-top: 1.5px solid var(--ink);
  margin-top: 8px;
  padding-top: 10px;
}

.summary-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 8px 0 16px;
}

.btn-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 18px 14px;
  background: var(--ink);
  color: var(--paper-raised);
  border-radius: 14px;
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 120ms var(--ease-out), opacity 160ms var(--ease-out);
}

.btn-primary:active { transform: scale(0.98); }

.btn-whats svg { width: 21px; height: 21px; flex: 0 0 auto; color: var(--brasa); }

.btn-whats .wa-inner { stroke-width: 1.6; }

/* ============ DOCK: barra de sacola + bottom nav ============ */

.dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
}

.cart-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: var(--brasa);
  color: var(--ink);
  border-top: 1.5px solid var(--ink);
  padding: 11px 16px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: filter 160ms var(--ease-out);
}

.cart-bar:active { filter: brightness(0.95); }

.bottomnav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--paper);
  border-top: 1.5px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 0 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  transition: color 180ms var(--ease-out);
}

.nav-item svg { width: 22px; height: 22px; }

.nav-item.is-active { color: var(--ink); }

.nav-item.is-active svg path:first-child { fill: var(--brasa); }

/* ============ SHEET DE PRODUTO ============ */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(20, 18, 16, 0.45);
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
}

.backdrop.is-open { opacity: 1; }

.sheet {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 40;
  max-width: var(--app-w);
  margin: 0 auto;
  max-height: 88dvh;
  overflow-y: auto;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-bottom: none;
  border-radius: 22px 22px 0 0;
  transform: translateY(100%);
  transition: transform 400ms var(--ease-out);
}

.sheet.is-open { transform: translateY(0); }

.sheet.is-closing { transition: transform 280ms var(--ease-in); }

.sheet-close {
  position: sticky;
  top: 10px;
  margin-left: auto;
  margin-right: 10px;
  z-index: 5;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
}

.sheet-close svg { width: 16px; height: 16px; }

.carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  margin-top: -40px;
}

.carousel::-webkit-scrollbar { display: none; }

.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: center;
  padding: 28px 24px 8px;
}

.carousel-slide img {
  width: 100%;
  height: 280px;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 10px 0 0;
}

.carousel-dots .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  background: var(--paper);
  transition: background-color 180ms var(--ease-out);
}

.carousel-dots .dot.is-active { background: var(--ink); }

.sheet-body { padding: 18px 20px 26px; }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sheet-name {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.25;
  min-width: 0;
}

.sheet-fav {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
}

.sheet-fav svg {
  width: 20px;
  height: 20px;
  transition: transform 200ms var(--ease-out);
}

.sheet-fav.is-on svg {
  fill: var(--fogo);
  stroke: var(--fogo);
}

.sheet-fav.is-pop svg { transform: scale(1.25); }

.sheet-price {
  display: inline-block;
  background: var(--brasa);
  border: 1.5px solid var(--ink);
  border-radius: 8px;
  padding: 3px 12px 2px;
  font-weight: 700;
  font-size: 19px;
  margin-top: 10px;
  white-space: nowrap;
}

.sheet-desc {
  margin-top: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 14px;
}

.sheet-variants { margin-top: 14px; }

.variants-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.variants-list { display: flex; flex-wrap: wrap; gap: 8px; }

.dot-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  margin-right: 6px;
  vertical-align: -1px;
}

.variant {
  padding: 7px 12px 6px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  font-size: 12.5px;
  background: var(--paper);
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out);
}

.variant:active { transform: scale(0.96); }

.variant.is-selected { background: var(--brasa); font-weight: 700; }

.sheet .btn-primary { margin-top: 18px; }

/* ============ SUCESSO ============ */

.success {
  position: fixed;
  inset: 0;
  z-index: 50;
  max-width: var(--app-w);
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: var(--paper);
  opacity: 0;
  transition: opacity 220ms var(--ease-out);
}

.success.is-open { opacity: 1; }

.success-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.success-check { width: 104px; height: 104px; }

.check-ring {
  stroke: var(--brasa);
  stroke-width: 3;
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
}

.check-mark {
  stroke: var(--ink);
  stroke-width: 3.5;
  stroke-dasharray: 34;
  stroke-dashoffset: 34;
}

.success.is-open .check-ring {
  animation: draw 420ms var(--ease-out) forwards;
}

.success.is-open .check-mark {
  animation: draw 300ms var(--ease-out) 260ms forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.success-text {
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ============ DESKTOP: moldura de aparelho sobre campo vermelho ============ */

@media (min-width: 700px) {
  body {
    background: var(--fogo);
    padding: 28px 0;
  }

  .app {
    height: calc(100dvh - 56px);
    overflow-y: auto;
    border: 8px solid var(--ink);
    border-radius: 42px;
    box-shadow: 0 12px 40px rgba(20, 18, 16, 0.35);
  }

  /* overlays vivem dentro da moldura do aparelho */
  .sheet {
    inset-inline: 0;
    bottom: 28px;
    max-height: calc(100dvh - 140px);
    border-bottom: 2.5px solid var(--ink);
    border-radius: 22px 22px 36px 36px;
  }

  .success {
    inset-inline: 0;
    top: 28px;
    bottom: 28px;
    border: 8px solid var(--ink);
    border-radius: 42px;
  }
}

/* ============ HOVER: cena de ponteiro (desktop emoldurado) ============ */

@media (hover: hover) {
  .chip:hover:not(.is-active),
  .variant:hover:not(.is-selected),
  .card-add:hover,
  .btn-ghost:hover,
  .sheet-close:hover {
    background: color-mix(in srgb, var(--brasa) 25%, var(--paper));
  }

  .card-fav:hover svg { transform: scale(1.12); }

  .btn-primary:hover {
    background: color-mix(in srgb, var(--ink) 86%, var(--brasa));
  }

  .nav-item:hover { color: var(--ink); }

  .bag-remove:hover { color: var(--fogo); }

  .stepper button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--brasa) 25%, var(--paper));
  }
}

/* ============ MOTION: preferência do usuário manda ============ */

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

  .carousel { scroll-behavior: auto; }
}
