:root{
  --bg: #f9f7f2;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --border: #e3ddd2;
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --radius: 12px;
  --gap: 16px;
  --accent: #6b1f1f; /* deep burgundy */
  --accent-contrast: #ffffff;
  --panel: #fffaf2;
}

*{ box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body{
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:20px;
  border-bottom:1px solid var(--border);
  background-image: linear-gradient(rgba(107,31,31,0.04), rgba(107,31,31,0.04)), url("./vineyard_bg.png");
  background-size: cover;
  background-position: center;
}
.brand{ display:flex; gap:12px; align-items:center; }
.logo{
  width:40px; height:40px; border:1px solid var(--border);
  border-radius:50%; display:grid; place-items:center;
  font-weight:700;
}
.brand h1{ margin:0; font-size:22px; font-weight:700; font-family: "Cormorant Garamond", serif; letter-spacing: 0.3px; }
.brand p{ margin:0; font-size:12px; color:var(--muted); }

.cart-toggle{
  padding:10px 14px; border:1px solid var(--border);
  border-radius:8px; background:#fff; cursor:pointer;
}
.cart-toggle span{
  display:inline-block; min-width:24px; text-align:center; margin-left:8px;
  border:1px solid var(--border); border-radius:999px; padding:2px 6px;
}

.layout{
  display:grid;
  grid-template-columns: 1fr 360px;
  gap: var(--gap);
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}
.products{
  min-width:0;
}
.products-header{
  display:flex; justify-content:space-between; align-items:center; margin-bottom: 12px;
}
.search input{
  padding:10px 12px; border:1px solid var(--border); border-radius:8px; width:220px;
}

.product-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: var(--gap);
}
.card{
  border:1px solid var(--border);
  border-radius: var(--radius);
  overflow:hidden;
  background:#fff;
  display:flex; flex-direction:column;
  box-shadow: var(--shadow);
}
.card .thumb{
  width:100%; aspect-ratio: 1/1; background:#f2eee7; border-bottom:1px solid var(--border);
  display:grid; place-items:center;
}
.card .thumb img{ max-width:80%; max-height:80%; object-fit:contain; }
.card .body{ padding: 12px; display:flex; flex-direction:column; gap:8px; }
.card .title{ font-weight:600; font-family: "Cormorant Garamond", serif; }
.card .desc{ color:var(--muted); font-size:14px; }
.card .footer{
  display:flex; align-items:center; justify-content:space-between; margin-top:auto;
}
.price{ font-weight:700; color: var(--accent); }
button.primary{
  background:var(--accent); color:var(--accent-contrast); border:none; padding:10px 12px; border-radius:8px; cursor:pointer;
}
button.primary:disabled{ opacity:.6; cursor:not-allowed; }
button.secondary{
  background:#fff; color:#000; border:1px solid var(--border); padding:10px 12px; border-radius:8px; cursor:pointer;
}

.cart-panel{
  border:1px solid var(--border);
  border-radius: var(--radius);
  height: fit-content;
  align-self: start;
  box-shadow: var(--shadow);
  position: sticky;
  top: 24px;
  background: var(--panel);
  display:flex; flex-direction:column;
}
.cart-header{
  display:flex; justify-content:space-between; align-items:center; padding: 12px; border-bottom:1px solid var(--border);
}
.cart-items{ max-height: 420px; overflow:auto; display:flex; flex-direction:column; gap:8px; padding: 12px; }
.cart-item{
  display:grid; grid-template-columns: 64px 1fr auto; gap:10px; align-items:center;
  border:1px solid var(--border); border-radius:8px; padding:8px;
}
.cart-item img{ width:64px; height:64px; object-fit:contain; background:#fafafa; border-radius:8px; }
.cart-item .name{ font-weight:600; }
.cart-item .qty{ display:flex; align-items:center; gap:8px; }
.qty button{ width:28px; height:28px; border:1px solid var(--border); border-radius:6px; background:#fff; cursor:pointer; }
.cart-footer{ border-top:1px solid var(--border); padding:12px; display:flex; flex-direction:column; gap:12px; }
.totals .row{ display:flex; justify-content:space-between; margin: 6px 0; }
.totals .row.small{ color:var(--muted); font-size: 14px; }
.totals .row.total{ font-weight:700; }

.toast{
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background:#111; color:#fff; padding:10px 14px; border-radius:8px; opacity:0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events:none;
}
.toast.show{ opacity:1; transform: translateX(-50%) translateY(-6px); }

.checkout-dialog{
  border:none; border-radius:12px; padding:0; width:min(520px, 92vw);
}
.checkout-content{
  padding:16px; display:flex; flex-direction:column; gap:12px;
}
.checkout-content h3{ margin:0; }
.checkout-line{ display:flex; justify-content:space-between; margin:6px 0; }
.checkout-content .primary{ margin-top:8px; }

.close{ background:#fff; border:1px solid var(--border); border-radius:6px; width:28px; height:28px; cursor:pointer; }

.pay-badges{ display:flex; gap:8px; flex-wrap:wrap; margin:8px 0 16px; }
.pay-badges .badge img{ height:24px; width:auto; display:block; }
.badge{ display:flex; align-items:center; gap:6px; }
.badge svg{ width:24px; height:16px; display:block; }
.badge.visa{ color:#1a1f71; }
.badge.mastercard{ color:#e31837; }
.badge.paypal{ color:#003087; }
.badge.amex{ color:#2e77bc; }
.badge.unionpay{ color:#008c45; }

@media (max-width: 980px){
  .layout{ grid-template-columns: 1fr; }
  .cart-panel{
    position: fixed; right: 16px; bottom: 16px; left: 16px; top: auto;
    max-height: 60vh; overflow: hidden;
    display:none;
  }
  .cart-panel.open{ display:flex; }
  .product-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 560px){
  .product-grid{ grid-template-columns: 1fr; }
  .search input{ width: 100%; }
}

.nav{ display:flex; gap:14px; align-items:center; }
.nav a{ color: var(--text); text-decoration:none; font-weight:600; padding:6px 8px; border-radius:6px; }
.nav a[aria-current="page"]{ background:#efe8dd; }
@media (max-width:980px){ .header{ flex-wrap:wrap; } .nav{ width:100%; overflow:auto; } }