/* store.css — neutral, restyle-friendly storefront theme for the built-in test
   store. Tokens up top so a client brand swap is a few variables. */
:root {
  --bg: #ffffff;
  --fg: #1a1a1f;
  --muted: #6b6b76;
  --line: #e6e6ea;
  --accent: #111118;
  --accent-fg: #ffffff;
  --radius: 12px;
  --maxw: 1100px;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--fg); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header { border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.site-header .wrap { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.spacer { flex: 1; }
#search-form { display: flex; flex: 0 1 320px; }
#search-input { flex: 1; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px 0 0 8px; font-size: 14px; outline: none; }
#search-form button { padding: 9px 14px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg); border-radius: 0 8px 8px 0; cursor: pointer; }
.cart-btn { padding: 9px 16px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: var(--bg); font-weight: 600; }
.cart-btn:hover { border-color: var(--fg); }

/* Category nav */
#category-nav { display: flex; flex-wrap: wrap; gap: 10px; padding: 18px 0 4px; }
.cat-link { padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: var(--muted); }
.cat-link:hover { border-color: var(--fg); color: var(--fg); }
.cat-link.active { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }

/* Product grid */
#product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; padding: 22px 0 60px; }
.card { display: block; }
.card-img { position: relative; aspect-ratio: 1/1; border-radius: var(--radius); overflow: hidden; background: #f1f1f3; }
.card-img img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.card:hover .card-img img { transform: scale(1.03); }
.badge { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.78); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.card-body { padding: 10px 2px; }
.card-name { font-weight: 600; font-size: 15px; }
.card-price { color: var(--muted); font-size: 14px; margin-top: 2px; }

/* Product detail */
.pdp { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 30px 0 70px; }
.pdp-media img#pdp-hero { width: 100%; border-radius: var(--radius); background: #f1f1f3; aspect-ratio: 1/1; object-fit: cover; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 2px solid transparent; cursor: pointer; }
.thumb.active { border-color: var(--accent); }
.pdp-cat { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pdp-name { font-size: 28px; margin: 6px 0 8px; letter-spacing: -0.01em; }
.pdp-price { font-size: 22px; font-weight: 600; margin-bottom: 18px; }

/* Variant picker (one selector per dimension: Size, Style, Color …) */
.pdp-variants { margin: 0 0 20px; display: flex; flex-direction: column; gap: 16px; }
.opt-dim { display: flex; flex-direction: column; gap: 8px; }
.opt-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.opt-vals { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); cursor: pointer; font-size: 14px; transition: border-color .15s ease, box-shadow .15s ease; }
.opt:hover { border-color: var(--fg); }
.opt.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.opt.opt-na, .opt:disabled { color: #b8b8c0; background: #fafafb; border-color: var(--line); cursor: not-allowed; text-decoration: line-through; }
.add-btn { width: 100%; max-width: 340px; padding: 14px 20px; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 16px; font-weight: 600; cursor: pointer; transition: opacity .15s ease; }
.add-btn:hover:not(:disabled) { opacity: .9; }
.add-btn:disabled { background: #c9c9d0; cursor: not-allowed; }
.pdp-stock { margin: 10px 0 18px; font-size: 14px; }
.pdp-desc { line-height: 1.6; border-top: 1px solid var(--line); padding-top: 18px; white-space: pre-wrap; }

/* Cart drawer (markup emitted by cart.js into <body>) */
.cart-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); opacity: 0; visibility: hidden; transition: opacity .2s ease; z-index: 40; }
.cart-backdrop.open { opacity: 1; visibility: visible; }
.cart-drawer { position: fixed; top: 0; right: 0; height: 100%; width: 410px; max-width: 92vw; background: var(--bg); box-shadow: -10px 0 40px rgba(0,0,0,.14); transform: translateX(100%); transition: transform .28s cubic-bezier(.4,0,.2,1); z-index: 41; display: flex; flex-direction: column; }
.cart-drawer.open { transform: translateX(0); }
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.cart-head strong { font-size: 17px; letter-spacing: -0.01em; }
.cart-close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 4px; }
.cart-close:hover { color: var(--fg); }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 20px; }
.cart-empty { color: var(--muted); padding: 48px 0; text-align: center; }
.cart-line { display: grid; grid-template-columns: 60px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-line-img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; background: #f1f1f3; }
.cart-line-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cart-line-name { font-weight: 600; font-size: 14px; }
.cart-line-price { color: var(--muted); font-size: 13px; }
.cart-qty { display: flex; align-items: center; gap: 12px; margin-top: 6px; }
.cart-qty .stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.cart-step { width: 30px; height: 30px; border: none; background: var(--bg); cursor: pointer; font-size: 16px; line-height: 1; color: var(--fg); }
.cart-step:hover { background: #f1f1f3; }
.cart-qty-n { min-width: 32px; text-align: center; font-size: 14px; font-weight: 600; }
.cart-rm { background: none; border: none; color: var(--muted); font-size: 12px; cursor: pointer; padding: 0; }
.cart-rm:hover { color: var(--fg); text-decoration: underline; }
.cart-foot { border-top: 1px solid var(--line); padding: 18px 20px; }
.cart-subtotal { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; font-size: 14px; color: var(--muted); }
.cart-subtotal #cart-subtotal { font-size: 20px; font-weight: 700; color: var(--fg); }
.cart-checkout { display: block; width: 100%; padding: 14px 20px; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 16px; font-weight: 600; cursor: pointer; text-align: center; transition: opacity .15s ease; }
.cart-checkout:hover:not(:disabled) { opacity: .9; }
.cart-checkout:disabled { background: #c9c9d0; cursor: not-allowed; }

/* Checkout page */
.checkout { padding: 10px 0 70px; }
.checkout-title { font-size: 26px; letter-spacing: -0.01em; margin: 22px 0 24px; }
.checkout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.checkout-col { border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.checkout-h2 { margin: 0 0 16px; font-size: 18px; }
.sum-line { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sum-name { color: var(--fg); }
.sum-amt { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-total { font-weight: 700; font-size: 15px; border-bottom: none; padding-top: 12px; }
.totals { margin-top: 14px; border-top: 2px solid var(--line); padding-top: 12px; }
.totals .sum-line { border-bottom: none; padding: 4px 0; }
.totals .sum-total { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; font-size: 16px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; outline: none; background: var(--bg); }
.field input:focus { border-color: var(--accent); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.ship-fields { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 2px; margin: 4px 0 16px; }
.ship-fields legend { font-weight: 600; padding: 0 6px; font-size: 14px; }
#payment-element { min-height: 40px; margin: 8px 0 16px; }
.pay-btn { width: 100%; padding: 14px 20px; border: none; border-radius: 10px; background: var(--accent); color: var(--accent-fg); font-size: 16px; font-weight: 600; cursor: pointer; transition: opacity .15s ease; }
.pay-btn:hover:not(:disabled) { opacity: .9; }
.pay-btn:disabled { background: #c9c9d0; cursor: not-allowed; }
.checkout-msg, #checkout-msg { color: #b00020; font-size: 14px; margin: 10px 0 0; min-height: 18px; }
.checkout-msg:empty { min-height: 0; margin: 0; }
#checkout-success { text-align: center; padding: 12px 0; }
#checkout-success h2 { margin-top: 0; }

@media (max-width: 720px) {
  .pdp { grid-template-columns: 1fr; gap: 24px; }
  #search-form { flex-basis: 160px; }
  .brand { font-size: 17px; }
  .checkout-grid { grid-template-columns: 1fr; gap: 20px; }
  .cart-drawer { width: 100%; }
}
