/* Storefront Kit - light, neutral shop. The accent comes from config.js (data-accent on <html>);
   every accent is dark enough for white button text (contrast 7.8 to 15). */
:root {
  --bg: #ffffff; --soft: #f6f6f9; --chip: #f0f0f4; --ink: #1d1d22; --muted: #55555f; --line: #e2e2e8;
  --accent: #322036; --on-accent: #ffffff; --bad: #a3231f;
  --font: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
html[data-accent="navy"] { --accent: #1f3d73; }
html[data-accent="forest"] { --accent: #2f4a33; }
html[data-accent="charcoal"] { --accent: #2b2b30; }
html[data-accent="burgundy"] { --accent: #6e1f2c; }
html[data-accent="teal"] { --accent: #1f5a5a; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
a { color: var(--accent); }
button, select, input { font: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.top { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; }
.brand { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.spacer { flex: 1; }
.top a.account { color: var(--ink); text-decoration: none; font-weight: 600; }
.cart-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--ink); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 7px 16px; font-weight: 700; cursor: pointer; }
.cart-btn .count { min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: var(--on-accent); font-size: 13px; display: inline-grid; place-items: center; padding: 0 6px; }

.hero { padding: 36px 0 8px; }
.hero h2 { margin: 0 0 6px; font-size: clamp(28px, 5vw, 44px); line-height: 1.1; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 60ch; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 18px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 0; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 6px 14px; cursor: pointer; font-weight: 600; }
.chip.on { background: var(--accent); color: var(--on-accent); }
.tools label { margin-left: auto; color: var(--muted); font-size: 14px; display: flex; gap: 8px; align-items: center; }
select { border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: var(--bg); color: var(--ink); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 22px; padding-bottom: 48px; }
.card { display: flex; flex-direction: column; gap: 8px; }
.card .ph { aspect-ratio: 1; background: var(--soft); border-radius: 14px; display: grid; place-items: center; overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: contain; }
.card h3 { margin: 4px 0 0; font-size: 17px; }
.card .price { font-weight: 700; }
.card .desc { margin: 0; color: var(--muted); font-size: 14px; }
.card .opts { display: flex; gap: 8px; flex-wrap: wrap; }
.card .opts select { flex: 1; min-width: 0; }
.card .opts select.need { border-color: var(--bad); outline: 2px solid var(--bad); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.btn { flex: 1; display: inline-flex; justify-content: center; align-items: center; min-height: 40px; border-radius: 10px; padding: 8px 14px; font-weight: 700; text-decoration: none; cursor: pointer; border: 1px solid var(--accent); }
.btn.main { background: var(--accent); color: var(--on-accent); }
.btn.alt { background: var(--bg); color: var(--accent); }
.btn:disabled { opacity: 1; background: var(--chip); color: var(--muted); border-color: var(--line); cursor: default; }
.empty { color: var(--muted); padding: 40px 0; }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; padding: 22px 0 40px; }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 22px; }

/* cart drawer */
.overlay { position: fixed; inset: 0; background: rgba(20, 20, 24, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); z-index: 41; display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0, 0, 0, .18); }
.drawer header { display: flex; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer header h2 { margin: 0; font-size: 19px; flex: 1; }
.x { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; font-size: 18px; }
.items { flex: 1; overflow: auto; padding: 8px 18px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line img { width: 64px; height: 64px; object-fit: contain; background: var(--soft); border-radius: 8px; }
.line b { display: block; }
.line small { display: block; color: var(--muted); }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.rm { border: 0; background: none; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 4px 0; font-size: 13px; }
.drawer footer { border-top: 1px solid var(--line); padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; }
.total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; }
.note { margin: 0; color: var(--muted); font-size: 13px; }
.err { margin: 0; color: var(--bad); font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #ffffff; padding: 12px 18px; border-radius: 12px; z-index: 50; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: calc(100% - 32px); }

/* account page */
.panel { max-width: 460px; margin: 40px auto; padding: 0 16px; }
.panel h2 { margin: 0 0 6px; }
.form { display: grid; gap: 10px; margin: 18px 0; }
.form input { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); color: var(--ink); }
.linkbtn { border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; padding: 0; }
.order { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.order header { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; }
.order ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }

@media (max-width: 600px) {
  .tools label { margin-left: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card h3 { font-size: 15px; }
  .btns { flex-direction: column; }
}
