:root {
  --bg: #f6f3ee;
  --card: #ffffff;
  --ink: #1d1b18;
  --muted: #6f6a62;
  --line: #e4ded4;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --soft: #fbe9dd;
  --ok: #2b8a3e;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Anuphan", system-ui, sans-serif; font-size: 16px; line-height: 1.55;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

.demo-bar { background: var(--ink); color: #f6f3ee; font-size: 13px; text-align: center; padding: 6px 16px; }

.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px; background: rgba(246,243,238,.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { text-decoration: none; font-weight: 600; font-size: 18px; white-space: nowrap; }
.logo b { color: var(--accent); }
.logo-mark { color: var(--accent); }
.nav { display: flex; gap: 14px; align-items: center; font-size: 15px; }
.nav a { text-decoration: none; color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--ink); }
.cart-link { color: var(--ink) !important; font-weight: 500; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; text-align: center; line-height: 20px; }

main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 48px; outline: none; }
.foot { max-width: 1080px; margin: 0 auto; padding: 24px 16px 40px; border-top: 1px solid var(--line); font-size: 14px; }
.muted { color: var(--muted); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 8px; }
h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 17px; font-weight: 600; }
.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section-head a { color: var(--accent); text-decoration: none; font-size: 15px; white-space: nowrap; }

/* hero */
.hero { display: grid; gap: 20px; align-items: center; padding: 8px 0 4px; }
.hero p { color: var(--muted); font-size: 17px; margin: 8px 0 20px; max-width: 34em; }
.hero-art { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
@media (min-width: 760px) { .hero { grid-template-columns: 1.1fr 1fr; padding-top: 24px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px;
  border-radius: 999px; border: 1px solid var(--ink); background: var(--ink); color: #fff; text-decoration: none;
  font-weight: 500; cursor: pointer; transition: transform .12s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* categories */
.cats { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.cat { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.cat .num { color: var(--accent); font-size: 13px; font-weight: 600; }
.cat p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.cat.soon { opacity: .55; pointer-events: none; }
.cat.soon .num::after { content: " · เร็ว ๆ นี้"; color: var(--muted); font-weight: 400; }

/* product grid */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .cats { grid-template-columns: repeat(5, 1fr); } }
.card { display: flex; flex-direction: column; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s; }
.card:hover { border-color: #cfc6b8; }
.card .thumb { background: #efebe4; aspect-ratio: 1 / 1; display: grid; place-items: center; padding: 12px; }
.card .body { padding: 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.card .name { font-weight: 600; font-size: 15px; }
.card .meta { color: var(--muted); font-size: 13px; }
.card .price { margin-top: auto; padding-top: 6px; font-weight: 600; }

/* steps */
.steps { display: grid; gap: 12px; counter-reset: step; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.step { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; counter-increment: step; }
.step::before { content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.step p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

/* filters */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 14px; text-decoration: none; font-size: 14px; white-space: nowrap; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* product page */
.crumb { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.crumb a { text-decoration: none; }
.pdp { display: grid; gap: 20px; }
@media (min-width: 860px) { .pdp { grid-template-columns: 1.05fr 1fr; align-items: start; } .pdp .gallery { position: sticky; top: 76px; } }
.gallery .stage { background: var(--card); border: 1px solid var(--line); border-radius: 20px; aspect-ratio: 1/1; display: grid; place-items: center; padding: 24px; }
.gallery .stage svg { width: 100%; height: 100%; }
.gallery .note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.opt { margin-top: 20px; }
.opt-label { display: flex; justify-content: space-between; font-weight: 600; margin-bottom: 8px; }
.opt-label span { font-weight: 400; color: var(--muted); }
.designs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.design { border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 8px; cursor: pointer; text-align: center; font-size: 13px; }
.design svg { width: 100%; aspect-ratio: 1/1; background: #f3efe9; border-radius: 8px; margin-bottom: 6px; }
.design[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft); }
.sizes { display: grid; gap: 8px; }
.size { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1.5px solid var(--line); background: var(--card); border-radius: 12px; padding: 12px 14px; cursor: pointer; text-align: left; }
.size small { display: block; color: var(--muted); font-size: 13px; }
.size[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--soft); }
.size b { white-space: nowrap; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.qty button { width: 40px; height: 40px; border: 0; background: none; cursor: pointer; font-size: 18px; }
.qty span { min-width: 28px; text-align: center; font-weight: 600; }
.specs { margin-top: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; font-size: 14px; }
.specs div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.specs div:last-child { border: 0; }
.specs dt, .specs span:first-child { color: var(--muted); }
.buybar { display: flex; gap: 12px; align-items: center; margin-top: 22px; }
.buybar .total { font-size: 22px; font-weight: 700; }
@media (max-width: 859px) {
  .buybar { position: sticky; bottom: 0; background: rgba(246,243,238,.96); backdrop-filter: blur(8px); margin: 22px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
}
.buybar .btn { flex: 1; }

/* cart & checkout */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.line { display: grid; grid-template-columns: 72px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line:last-child { border-bottom: 0; }
.line .mini { background: #f3efe9; border-radius: 10px; aspect-ratio: 1/1; padding: 6px; }
.line .opts { color: var(--muted); font-size: 13px; }
.line .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 0; }
.two { display: grid; gap: 18px; }
@media (min-width: 860px) { .two { grid-template-columns: 1.4fr 1fr; align-items: start; } }
.sum div { display: flex; justify-content: space-between; padding: 4px 0; }
.sum .grand { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; font-size: 19px; font-weight: 700; }
.empty { text-align: center; padding: 48px 16px; }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 500; font-size: 15px; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: #fff; font-size: 16px; }
.field input:focus, .field textarea:focus { outline: 2px solid var(--soft); border-color: var(--accent); }
.radio { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); }
.radio span { flex: 1; }

.qr { display: grid; gap: 12px; justify-items: center; text-align: center; }
.qr .box { position: relative; width: 200px; background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.qr .stamp { position: absolute; inset: 0; display: grid; place-items: center; }
.qr .stamp span { background: var(--accent); color: #fff; padding: 4px 12px; border-radius: 6px; font-weight: 600; transform: rotate(-12deg); }

/* order / tracking */
.status-row { display: grid; gap: 14px; }
@media (min-width: 760px) { .status-row { grid-template-columns: 1fr 1fr; } }
.timeline { list-style: none; margin: 8px 0 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 28px; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); }
.timeline li::after { content: ""; position: absolute; left: 12px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.now { color: var(--ink); font-weight: 600; }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px var(--soft); }
.pill { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--accent); font-weight: 600; }
.order-no { font-family: ui-monospace, monospace; font-size: 20px; letter-spacing: .04em; }
.sim { margin-top: 12px; border: 1px dashed var(--accent); border-radius: 12px; padding: 12px; background: #fff8f3; font-size: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; font-size: 15px; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 420px) {
  .nav { gap: 10px; font-size: 14px; }
  .nav a[href="#/track"] { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
