:root {
  --wine: #7a3045;
  --wine-dark: #572033;
  --terracotta: #c76f50;
  --cream: #fbf7f0;
  --paper: #fffdf9;
  --ink: #27201d;
  --muted: #675d58;
  --line: #ded3c8;
  --focus: #185fa5;
  --shadow: 0 10px 30px rgba(70, 43, 34, 0.1);
  --radius: 18px;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  color: var(--ink);
  background: var(--cream);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, a { font: inherit; }
button { color: inherit; }
img { display: block; max-width: 100%; }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 12px 18px;
  color: white;
  background: var(--wine-dark);
  border-radius: 8px;
  transform: translateY(-150%);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  left: 0;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  background: var(--paper);
  box-shadow: 0 2px 12px rgba(50, 34, 28, 0.12);
}
.brand-bar {
  display: flex;
  align-items: center;
  max-width: 1180px;
  height: 82px;
  margin: auto;
  padding: 8px 24px;
}
.brand-logo { width: 270px; height: auto; }
.category-nav {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--line);
}
.nav-scroll {
  display: flex;
  width: 100%;
  max-width: 1180px;
  margin: auto;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.nav-button {
  min-width: max-content;
  min-height: 58px;
  padding: 12px 22px;
  border: 0;
  border-bottom: 4px solid transparent;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}
.nav-button:hover { background: #f6eee7; }
.nav-button.is-active { color: var(--wine); border-bottom-color: var(--wine); }

main {
  width: 100%;
  max-width: 1180px;
  min-height: 65vh;
  margin: auto;
  padding: 32px 24px 64px;
  overflow-x: clip;
}
main > section, main > article, .detail-layout, .gallery, .product-information { min-width: 0; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 40px;
  padding: clamp(32px, 6vw, 72px);
  border: 1px solid #e2d3c4;
  border-radius: 28px;
  background: linear-gradient(120deg, #fffdf9, #f3e6d9);
  box-shadow: var(--shadow);
}
.hero-copy { max-width: 720px; }
.hero h1, .section-heading h1, .section-heading h2, .product-information h1 {
  margin: 4px 0 16px;
  color: var(--wine-dark);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.2;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.6rem); }
.hero p:not(.eyebrow) { max-width: 650px; font-size: 1.1rem; }
.hero-mark { display: grid; place-items: center; }
.eyebrow {
  margin: 0;
  color: var(--terracotta);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.primary-button, .back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 13px 24px;
  border: 2px solid var(--wine);
  border-radius: 12px;
  color: white;
  background: var(--wine);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.primary-button:hover, .back-button:hover { background: var(--wine-dark); border-color: var(--wine-dark); }

.catalog-section { padding-top: 50px; }
.section-heading { margin-bottom: 24px; }
.section-heading h1, .section-heading h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.result-count { margin: 0; color: var(--muted); }
.product-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card-action {
  display: flex;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.card-action { flex-direction: column; }
.card-action:hover .card-button { background: var(--wine-dark); }
.card-image-wrap {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #eee5dc;
}
.card-image { width: 100%; height: 100%; object-fit: cover; }
.card-content { display: flex; flex: 1; flex-direction: column; align-items: flex-start; padding: 22px; }
.card-title { margin: 0 0 14px; font-size: 1.12rem; line-height: 1.4; }
.card-price { margin: auto 0 18px; color: var(--wine); font-size: 1.28rem; font-weight: 850; }
.card-button {
  display: block;
  width: 100%;
  min-height: 50px;
  padding: 10px 16px;
  border-radius: 10px;
  color: white;
  background: var(--wine);
  font-weight: 800;
  text-align: center;
}
.empty-state {
  grid-column: 1 / -1;
  padding: 42px 24px;
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  text-align: center;
}
.empty-state h2 { margin-top: 0; color: var(--wine-dark); }

.product-detail { padding-top: 8px; }
.back-button { margin-bottom: 28px; }
.back-button svg { width: 25px; margin-right: 10px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 2.5; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr); gap: 42px; }
.main-image-wrap {
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}
.main-product-image { width: 100%; height: 100%; object-fit: contain; }
.thumbnail-list {
  display: flex;
  width: 100%;
  max-width: 100%;
  gap: 12px;
  margin-top: 14px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}
.thumbnail-button {
  flex: 0 0 82px;
  width: 82px;
  height: 72px;
  padding: 3px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}
.thumbnail-button.is-active { border-color: var(--wine); box-shadow: 0 0 0 2px rgba(122, 48, 69, 0.2); }
.thumbnail-button img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
.product-information { align-self: start; padding: 24px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.product-information h1 { overflow-wrap: anywhere; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.detail-price { margin: 22px 0; color: var(--wine); font-size: 1.65rem; font-weight: 850; }
.detail-description { color: var(--muted); }
.contact-button { width: 100%; margin-top: 16px; }
.buy-button {
  width: 100%;
  margin-top: 18px;
  border-color: #176b3a;
  background: #176b3a;
}
.buy-button:hover { border-color: #10532c; background: #10532c; }
.buy-button svg {
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  margin-right: 10px;
  fill: currentColor;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom));
  color: white;
  background: var(--wine-dark);
  text-align: left;
}
.site-footer p { margin: 0; }
.is-hidden { display: none !important; }

button:focus-visible, a:focus-visible { outline: 4px solid var(--focus); outline-offset: 3px; }

@media (max-width: 820px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-layout { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-mark { display: none; }
}
@media (max-width: 540px) {
  body { font-size: 17px; }
  .brand-bar { width: 100%; justify-content: center; height: 72px; padding: 7px 16px; }
  .brand-logo { width: min(245px, 82vw); }
  .nav-scroll { padding: 0 8px; }
  .nav-button { min-height: 56px; padding: 10px 17px; }
  main { width: 100%; max-width: 100vw; padding: 22px 16px 48px; }
  .product-detail, .detail-layout, .gallery, .product-information { width: 100%; max-width: 100%; }
  .hero { padding: 30px 22px; border-radius: 20px; }
  .product-grid { grid-template-columns: 1fr; gap: 20px; }
  .card-action { flex-direction: row; }
  .card-image-wrap { flex: 0 0 40%; aspect-ratio: auto; min-height: 215px; }
  .card-content { padding: 18px; }
  .card-title { font-size: 1.05rem; }
  .card-price { font-size: 1.16rem; }
  .card-button { padding-inline: 8px; }
  .product-information { padding: 21px; }
}
@media (max-width: 370px) {
  .card-action { flex-direction: column; }
  .card-image-wrap { width: 100%; aspect-ratio: 4 / 3; min-height: auto; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.brand-bar { justify-content: space-between; }
.brand-home { padding: 0; border: 0; background: transparent; cursor: pointer; }
.bag-button { min-height: 50px; padding: 10px 18px; border: 2px solid var(--wine); border-radius: 12px; color: var(--wine); background: white; font-weight: 800; cursor: pointer; }
.bag-button span { display: inline-grid; min-width: 28px; height: 28px; margin-left: 6px; place-items: center; border-radius: 50%; color: white; background: var(--wine); }
.floating-bag { position: fixed; right: 24px; bottom: 24px; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 12px 16px; border: 0; border-radius: 999px; color: white; background: var(--wine); box-shadow: 0 8px 28px rgba(67,25,39,.32); font: inherit; font-weight: 850; cursor: pointer; }
.floating-bag strong { display: grid; min-width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--wine-dark); background: white; }
.bag-dialog { width: min(620px, calc(100% - 28px)); max-height: 88vh; padding: 30px; border: 0; border-radius: 22px; color: var(--ink); background: var(--paper); box-shadow: var(--shadow); overflow: auto; }
.bag-dialog::backdrop { background: rgba(37,20,25,.62); }
.bag-dialog h2 { margin-top: 0; color: var(--wine-dark); font-family: Georgia, serif; font-size: clamp(1.55rem,4vw,2rem); }
.bag-dialog-close { float: right; width: 48px; height: 48px; border: 0; border-radius: 50%; color: var(--wine-dark); background: #f2e7e0; font-size: 1.7rem; cursor: pointer; }
.bag-dialog-items { display: grid; gap: 12px; margin: 22px 0; }
.bag-dialog-item { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.bag-dialog-item img { width: 64px; height: 58px; border-radius: 9px; object-fit: cover; }
.bag-dialog-item p { margin: 0; font-weight: 750; }
.bag-dialog-item small { display: block; color: var(--muted); }
.bag-dialog-item-actions { display: grid; justify-items: end; gap: 6px; }
.bag-dialog-remove { min-height: 42px; padding: 7px 12px; border: 1px solid #b44a58; border-radius: 9px; color: #8a1f2d; background: white; font: inherit; font-weight: 800; cursor: pointer; }
.bag-dialog-remove:hover { color: white; background: #8a1f2d; }
.bag-dialog-empty { margin: 8px 0; padding: 24px; border-radius: 12px; background: #f5ece6; text-align: center; font-weight: 750; }
.bag-dialog-total { display: flex; justify-content: space-between; padding-top: 16px; border-top: 2px solid var(--line); font-size: 1.25rem; }
.bag-dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.bag-dialog-actions button { width: 100%; margin-top: 0; }
.quantity-label { display: block; margin-top: 20px; font-weight: 800; }
.quantity-input { width: 110px; min-height: 52px; margin-top: 6px; padding: 8px 12px; border: 2px solid var(--line); border-radius: 10px; font: inherit; }
.bag-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; }
.bag-item { display: grid; grid-template-columns: 150px 1fr; gap: 20px; margin-bottom: 18px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.bag-item img { width: 150px; height: 130px; border-radius: 12px; object-fit: cover; }
.bag-item h2 { margin: 0 0 8px; color: var(--wine-dark); font-size: 1.15rem; }
.quantity-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.quantity-controls button { min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.quantity-controls .remove-item { width: auto; padding-inline: 14px; color: #8a1f2d; }
.order-summary { align-self: start; position: sticky; top: 155px; padding: 24px; border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.order-summary p { display: flex; justify-content: space-between; font-size: 1.2rem; }
.order-summary .primary-button { width: 100%; }
.checkout-view { padding-top: 8px; }
.checkout-layout { display: grid; max-width: 900px; gap: 28px; }
.form-card { padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: var(--shadow); }
.form-card h2 { margin-top: 0; color: var(--wine-dark); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid label, #card-fields label { display: flex; flex-direction: column; gap: 6px; font-weight: 750; }
.form-grid input, #card-fields select { min-height: 52px; padding: 10px 13px; border: 2px solid var(--line); border-radius: 10px; background: white; font: inherit; }
.form-grid input:focus, #card-fields select:focus, .quantity-input:focus { border-color: var(--focus); outline: 3px solid rgba(24,95,165,.2); }
.payment-options { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.payment-options label { display: flex; align-items: center; min-height: 62px; gap: 12px; padding: 14px 18px; border: 2px solid var(--line); border-radius: 12px; font-weight: 800; cursor: pointer; }
.payment-options input { width: 24px; height: 24px; }
#card-field { min-height: 84px; margin: 14px 0; padding: 12px; border: 2px solid var(--line); border-radius: 10px; }
.checkout-submit { width: 100%; margin-top: 24px; }
.form-message { min-height: 30px; color: #8a1f2d; font-weight: 700; }
.payment-result { max-width: 700px; margin: 30px auto; padding: 40px; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); text-align: center; }
.payment-result h1 { color: var(--wine-dark); font-family: Georgia, serif; }
#pix-qr { display: block; max-width: 260px; margin: 24px auto; }
#pix-code { width: 100%; min-height: 120px; margin-bottom: 16px; padding: 12px; border: 2px solid var(--line); border-radius: 10px; resize: none; }
.secondary-button { min-height: 52px; margin-top: 18px; padding: 11px 20px; border: 2px solid var(--wine); border-radius: 12px; color: var(--wine); background: white; font-weight: 800; cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }

@media (max-width: 820px) { .bag-layout { grid-template-columns: 1fr; } .order-summary { position: static; } }
@media (max-width: 540px) {
  .bag-button { padding: 8px 11px; }
  .bag-item { grid-template-columns: 100px 1fr; padding: 14px; }
  .bag-item img { width: 100px; height: 100px; }
  .form-grid, .payment-options { grid-template-columns: 1fr; }
  .form-card, .payment-result { padding: 22px 18px; }
  .floating-bag { right: 14px; bottom: 14px; }
  .bag-dialog { padding: 22px 16px; }
  .bag-dialog-actions { grid-template-columns: 1fr; }
  .bag-dialog-item { grid-template-columns: 54px 1fr; }
  .bag-dialog-item img { width: 54px; height: 54px; }
  .bag-dialog-item-actions { grid-column: 2; justify-items: start; }
}
