:root {
  --paper: #f7f3ec;
  --card: #fffdf9;
  --ink: #2b2620;
  --muted: #6e6559;
  --line: #e4dccf;
  --olive: #5b6b3a;
  --olive-dark: #46532c;
  --honey: #c98a1b;
  --wine: #7a2e35;
  --warn-bg: #fbefd9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
}
a { color: var(--olive-dark); }

.test-banner {
  background: var(--ink);
  color: #f3e9d6;
  font-size: 13px;
  text-align: center;
  padding: 6px 16px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--serif);
  font-size: 26px;
  letter-spacing: .02em;
  text-decoration: none;
  color: var(--ink);
}
.cart-toggle {
  display: none;
  font: inherit;
  background: none;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.badge {
  display: inline-block;
  min-width: 22px;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--olive);
  color: #fff;
  font-size: 13px;
  text-align: center;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  grid-template-areas: "intro cart" "catalog cart";
  gap: 0 48px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}
.intro { grid-area: intro; }
.catalog { grid-area: catalog; }
.cart { grid-area: cart; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--olive);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  font-weight: 600;
}
h1, h2 { font-family: var(--serif); font-weight: normal; }
h1 { font-size: clamp(32px, 5vw, 46px); line-height: 1.1; margin: 0 0 12px; }
.lede { color: var(--muted); max-width: 46ch; margin: 0 0 24px; }

.notice {
  background: var(--warn-bg);
  border-left: 3px solid var(--honey);
  padding: 10px 14px;
  margin-bottom: 24px;
  font-size: 15px;
}

.group { margin-top: 28px; }
.group h2 { font-size: 26px; margin: 0; }
.group-note { color: var(--muted); font-size: 14px; margin: 2px 0 16px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 18px;
}
.product {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.product img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #eee6d8;
  display: block;
}
.product .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.product h3 { font-family: var(--serif); font-weight: normal; font-size: 18px; line-height: 1.25; margin: 0; }
.product .format { color: var(--muted); font-size: 13px; margin: 0; }
.product .row { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.product .price { font-weight: 600; }
.product[data-cat="vino"] .price { color: var(--wine); }
.product[data-cat="miele"] .price { color: #9a6812; }
.product.sold-out img { filter: grayscale(.8); opacity: .7; }

.add {
  font: inherit;
  font-size: 14px;
  background: var(--olive);
  color: #fff;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.add:hover { background: var(--olive-dark); }
.add:disabled { background: #bdb4a6; cursor: not-allowed; }

.cart {
  position: sticky;
  top: 24px;
  align-self: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart h2 { font-size: 22px; margin: 0 0 12px; }
.close { display: none; font-size: 28px; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--muted); }

.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.cart-lines .name { font-weight: 500; }
.cart-lines .line-total { text-align: right; }
.qty { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.qty button {
  width: 26px; height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}
.remove { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; justify-self: end; }
.empty { color: var(--muted); margin: 8px 0 16px; }

.dest { border: 0; padding: 0; margin: 18px 0 0; }
.dest legend { font-weight: 600; margin-bottom: 6px; }
.dest label { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.dest label:has(input:checked) { border-color: var(--olive); background: #f1f3ea; }
.dest label.off { opacity: .5; cursor: not-allowed; }
.dest input { margin-right: 8px; accent-color: var(--olive); }
.warn { background: var(--warn-bg); padding: 8px 10px; border-radius: 6px; font-size: 14px; margin: 4px 0 0; }

.totals { margin: 18px 0; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; }
.totals .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 8px; font-weight: 600; font-size: 18px; }
.totals .grand dt { color: var(--ink); }

.pay {
  width: 100%;
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 12px;
  cursor: pointer;
}
.pay:disabled { background: #bdb4a6; cursor: not-allowed; }
.fine { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 20px 16px;
}

/* Pagina grazie */
.thanks { max-width: 560px; margin: 0 auto; padding: 72px 24px; text-align: center; }
.thanks p { color: var(--muted); }
.thanks .btn { display: inline-block; margin-top: 16px; background: var(--olive); color: #fff; padding: 10px 20px; border-radius: 999px; text-decoration: none; }

/* Mobile: il carrello diventa un pannello che sale dal basso */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; grid-template-areas: "intro" "catalog"; padding: 28px 16px 48px; }
  .site-header { padding: 14px 16px; }
  .cart-toggle { display: inline-block; }
  .close { display: block; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .cart {
    position: fixed;
    left: 0; right: 0; bottom: 0; top: auto;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -8px 30px rgba(0,0,0,.15);
    transform: translateY(105%);
    transition: transform .25s ease;
    z-index: 10;
  }
  .cart.open { transform: translateY(0); }
}
