:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e6e6e6;
  --bg: #fafaf8;
  --card: #ffffff;
  --accent: #1a1a1a;
  --accent-ink: #ffffff;
  --star: #e8a33d;
  --green: #1e7e4e;
  --red: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { font-size: 22px; font-weight: 700; letter-spacing: -.5px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand span { color: var(--star); }
.search-wrap { flex: 1; max-width: 520px; margin: 0 auto; }
.search-wrap input {
  width: 100%; padding: 10px 16px; border: 1px solid var(--line); border-radius: 999px;
  font-size: 14px; background: var(--bg); outline: none;
}
.search-wrap input:focus { border-color: var(--ink); background: #fff; }
.cart-btn {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%;
  background: #fff; cursor: pointer; color: var(--ink);
}
.cart-btn:hover { border-color: var(--ink); }
.cart-count {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  background: var(--star); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.trust-bar { background: var(--ink); color: #fff; font-size: 12px; }
.trust-bar .container { display: flex; justify-content: center; gap: 28px; padding: 7px 20px; flex-wrap: wrap; }
.trust-bar span { opacity: .9; }

/* Hero */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -1px; }
.hero p { color: var(--muted); margin-top: 8px; font-size: 16px; }

/* Chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 18px 0 28px; }
.chip {
  padding: 7px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; font-size: 13px; cursor: pointer; color: var(--muted);
}
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; padding-bottom: 60px; }
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: transform .15s ease;
}
.card:hover { transform: translateY(-3px); }
.card-img { position: relative; aspect-ratio: 1; background: #f0f0ee; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 10px; left: 10px; background: var(--ink); color: #fff;
  font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
}
.badge.sale { background: var(--red); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-cat { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); }
.card-name { font-size: 15px; font-weight: 600; line-height: 1.35; }
.stars { color: var(--star); font-size: 13px; letter-spacing: 1px; }
.stars .count { color: var(--muted); font-size: 12px; margin-left: 5px; letter-spacing: 0; }
.card-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.price { font-size: 18px; font-weight: 700; }
.add-btn {
  padding: 9px 16px; border: none; border-radius: 8px; background: var(--accent);
  color: var(--accent-ink); font-size: 13px; font-weight: 600; cursor: pointer;
}
.add-btn:hover { opacity: .88; }
.add-btn:active { transform: scale(.97); }

/* Footer */
.site-footer { background: var(--card); border-top: 1px solid var(--line); margin-top: 20px; }
.footer-inner { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; padding: 40px 20px 24px; }
.footer-brand { font-size: 20px; font-weight: 700; }
.footer-brand span { color: var(--star); }
.site-footer p, .site-footer li { color: var(--muted); font-size: 13px; margin-top: 6px; }
.site-footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .8px; }
.site-footer ul { list-style: none; }
.footer-bottom { border-top: 1px solid var(--line); padding: 14px 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* Overlay + drawer */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90; }
.overlay.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 100vw);
  background: #fff; z-index: 100; transform: translateX(100%);
  transition: transform .25s ease; display: flex; flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,.12);
}
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 18px; }
.icon-btn { border: none; background: none; font-size: 26px; line-height: 1; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); }
.free-ship { padding: 12px 20px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.free-ship .bar { height: 5px; background: var(--line); border-radius: 999px; margin-top: 7px; overflow: hidden; }
.free-ship .bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; transition: width .3s; }
.drawer-items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 14px; }
.cart-item { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cart-item img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; background: #f0f0ee; }
.ci-info { flex: 1; min-width: 0; }
.ci-name { font-size: 13.5px; font-weight: 600; line-height: 1.3; }
.ci-price { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ci-controls { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.qty-btn {
  width: 26px; height: 26px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1;
}
.qty-btn:hover { border-color: var(--ink); }
.ci-qty { font-size: 13px; min-width: 20px; text-align: center; }
.ci-remove { border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; text-decoration: underline; margin-left: auto; }
.ci-remove:hover { color: var(--red); }
.ci-total { font-size: 14px; font-weight: 700; white-space: nowrap; }
.drawer-foot { border-top: 1px solid var(--line); padding: 16px 20px; }
.totals { font-size: 14px; }
.totals .row { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); }
.totals .row.grand { font-size: 17px; font-weight: 700; color: var(--ink); margin-top: 10px; }
.checkout-btn {
  width: 100%; margin-top: 12px; padding: 14px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 15px; font-weight: 700; cursor: pointer;
}
.checkout-btn:hover { opacity: .88; }
.checkout-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 110; display: none; align-items: flex-start; justify-content: center; overflow-y: auto; background: rgba(0,0,0,.5); padding: 40px 16px; }
.modal.show { display: flex; }
.modal-card { position: relative; background: #fff; border-radius: 14px; width: 100%; max-width: 560px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-close { position: absolute; top: 12px; right: 14px; }
.co-title { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.co-sub { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.co-steps { display: flex; gap: 8px; margin-bottom: 20px; }
.co-step { font-size: 12px; color: var(--muted); padding: 5px 12px; border-radius: 999px; background: var(--bg); }
.co-step.active { background: var(--ink); color: #fff; font-weight: 600; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--ink); }
.field input, .field select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; outline: none; background: #fff;
}
.field input:focus, .field select:focus { border-color: var(--ink); }
.field .err { border-color: var(--red) !important; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.co-actions { display: flex; gap: 10px; margin-top: 18px; }
.co-actions button { flex: 1; padding: 13px; border-radius: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }
.btn-primary { border: none; background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: .88; }
.btn-ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.pay-note { font-size: 12px; color: var(--muted); margin-top: 10px; text-align: center; }
.pay-error { background: #fdecea; color: var(--red); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-top: 12px; }
#payment-element { margin-bottom: 4px; }
#payment-element .StripeElement {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 14px;
  background: #fff;
}
#payment-element .StripeElement--focus { border-color: var(--ink); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Confirmation */
.confirm { text-align: center; padding: 10px 0; }
.confirm .check {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  background: #e8f5ee; color: var(--green); font-size: 32px;
  display: flex; align-items: center; justify-content: center;
}
.confirm h2 { font-size: 22px; margin-bottom: 6px; }
.confirm p { color: var(--muted); font-size: 14px; }
.order-id { font-weight: 700; color: var(--ink); }
.confirm .summary { text-align: left; background: var(--bg); border-radius: 10px; padding: 16px; margin-top: 18px; font-size: 13px; }
.confirm .summary .row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.confirm .summary .row.total { font-weight: 700; font-size: 15px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

@media (max-width: 720px) {
  .header-inner { gap: 10px; }
  .search-wrap { max-width: none; }
  .hero h1 { font-size: 26px; }
  .footer-inner { grid-template-columns: 1fr; gap: 18px; }
  .field-row-3 { grid-template-columns: 1fr 1fr; }
}

/* ---------- product detail modal ---------- */
.product-card-modal { max-width: 760px; }
.pd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.pd-img { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #f0f0ee; }
.pd-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-img .badge { position: absolute; top: 12px; left: 12px; z-index: 2; }
.pd-info { display: flex; flex-direction: column; gap: 10px; }
.pd-name { font-size: 24px; line-height: 1.25; }
.pd-price { font-size: 26px; font-weight: 700; }
.pd-desc { color: var(--muted); font-size: 14px; line-height: 1.6; }
.pd-controls { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.pd-qty { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.pd-qty #pd-qty { min-width: 22px; text-align: center; font-weight: 600; }
.pd-add { padding: 12px 20px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.pd-trust { list-style: none; margin-top: 12px; padding: 14px 16px; background: var(--bg); border-radius: 10px; font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

@media (max-width: 720px) {
  .pd-grid { grid-template-columns: 1fr; }
  .pd-name { font-size: 20px; }
  .pd-price { font-size: 22px; }
}
