/* Layout: sticky header with category rail, product grid that goes 2 → 3 → 4 columns, single-column cart/checkout */
:root {
  --bg: #f6f5f9;
  --surface: #ffffff;
  --ink: #1c1b2b;
  --muted: #5f5d75;
  --line: #e2e0ec;
  --accent: #33388f;
  --accent-ink: #ffffff;
  --gold: #b9741a;
  --gold-soft: #fbefd9;
  --danger: #b3261e;
  --ok: #1e7a4f;
  --ok-soft: #e3f3ea;
  --font-display: "Rozha One", "Georgia", serif;
  --font-body: "Mukta", "Segoe UI", system-ui, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14131d; --surface: #1e1d2a; --ink: #eceaf6; --muted: #a6a3bd; --line: #312f43;
    --accent: #a3a8ff; --accent-ink: #14131d; --gold: #f0b452; --gold-soft: #3a2d16;
    --danger: #ff8a80; --ok: #7fd3a6; --ok-soft: #173327; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14131d; --surface: #1e1d2a; --ink: #eceaf6; --muted: #a6a3bd; --line: #312f43;
  --accent: #a3a8ff; --accent-ink: #14131d; --gold: #f0b452; --gold-soft: #3a2d16;
  --danger: #ff8a80; --ok: #7fd3a6; --ok-soft: #173327; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 16px; line-height: 1.5;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px);
  z-index: 30; background: var(--surface);
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap {
  max-width: 1180px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Header */
.site-head {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; }
.brand { text-decoration: none; display: flex; flex-direction: column; min-width: 0; }
.brand b { font-family: var(--font-display); font-weight: 400; font-size: 1.6rem; line-height: 1.1; color: var(--accent); }
.brand small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-link {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-weight: 600;
}
.cart-link .count {
  min-width: 22px; height: 22px; border-radius: 11px; background: var(--accent); color: var(--accent-ink);
  display: inline-grid; place-items: center; font-size: .8rem; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats a {
  flex: 0 0 auto; text-decoration: none; padding: 5px 12px; border-radius: 999px;
  color: var(--muted); font-weight: 500; font-size: .95rem;
}
.cats a:hover { color: var(--ink); }
.cats a[aria-current="page"] { background: var(--ink); color: var(--bg); }

main { padding-block: 20px 48px; min-height: 60vh; }

/* Offer strip */
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 24px; }
.offer {
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center;
  background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: var(--radius);
  padding: 14px 16px; text-align: left; cursor: pointer;
}
.offer .num { grid-row: span 2; font-family: var(--font-display); font-size: 2.6rem; line-height: 1; color: var(--gold); }
.offer .title { font-weight: 700; font-size: 1.1rem; }
.offer .sub { color: var(--muted); font-size: .9rem; }

/* Collection */
.coll-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
h1 { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.7rem, 4vw, 2.3rem); line-height: 1.15; margin: 0; text-wrap: balance; }
.count-note { color: var(--muted); font-size: .95rem; }
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 18px; }
.filters select, .filters label.chk {
  border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: .92rem;
}
.filters label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 14px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1020px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { text-decoration: none; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ph { position: relative; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; background: var(--line); max-width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease; }
.card:hover .ph img { transform: scale(1.03); }
.tag {
  position: absolute; left: 8px; top: 8px; background: var(--gold-soft); color: var(--gold);
  border: 1px solid var(--gold); font-weight: 700; font-size: .75rem; padding: 2px 8px; border-radius: 6px;
}
.soldout {
  position: absolute; inset: auto 0 0 0; background: rgba(20, 19, 29, .72); color: #fff;
  text-align: center; font-weight: 600; font-size: .85rem; padding: 6px;
}
.card.is-out img { filter: grayscale(.7); opacity: .7; }
.meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.meta .b { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; }
.meta .n { font-weight: 600; line-height: 1.3; }
.price { font-weight: 700; font-variant-numeric: tabular-nums; }
.price s { color: var(--muted); font-weight: 400; font-size: .88em; margin-left: 4px; }
.price .off { color: var(--ok); font-weight: 600; font-size: .85em; margin-left: 4px; }
.empty { padding: 40px 0; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px;
  padding: 12px 22px; font-weight: 700; font-size: 1rem; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn.block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }

/* Product */
.back { display: inline-block; margin-bottom: 14px; color: var(--muted); text-decoration: none; }
.pdp { display: grid; gap: 24px; }
@media (min-width: 820px) { .pdp { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; } }
.pdp .ph { max-width: 520px; }
.pdp-info { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pdp-info .price { font-size: 1.4rem; }
.combo-note { background: var(--gold-soft); border-left: 3px solid var(--gold); padding: 10px 14px; border-radius: 0 8px 8px 0; font-size: .95rem; }
.label { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; }
.sizes { display: flex; flex-wrap: wrap; gap: 8px; }
.size {
  min-width: 52px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); cursor: pointer; font-weight: 600;
}
.size[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); }
.size:disabled { text-decoration: line-through; color: var(--muted); cursor: not-allowed; opacity: .6; }
.stock-hint { color: var(--gold); font-size: .9rem; min-height: 1.5em; }
.facts { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 6px; color: var(--muted); }
.facts b { color: var(--ink); font-weight: 600; }
.form-error { color: var(--danger); font-size: .92rem; }

/* Cart */
.two-col { display: grid; gap: 24px; }
@media (min-width: 900px) { .two-col { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
.lines { display: grid; gap: 14px; }
.line { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.line .ph { border-radius: 8px; }
.line .n { font-weight: 600; text-decoration: none; }
.line .sub { color: var(--muted); font-size: .9rem; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; }
.stepper button { width: 32px; height: 32px; border: 0; background: none; cursor: pointer; font-size: 1.1rem; }
.stepper span { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.line.bad { opacity: .75; }
.notices { display: grid; gap: 8px; margin-bottom: 16px; }
.notice { padding: 10px 14px; border-radius: 8px; font-size: .95rem; }
.notice.todo { background: var(--gold-soft); color: var(--ink); border: 1px dashed var(--gold); }
.notice.done { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.notice.err { border: 1px solid var(--danger); color: var(--danger); }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 10px; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 120px); }
.summary h2 { font-size: 1.1rem; margin: 0; }
.row { display: flex; justify-content: space-between; gap: 12px; font-variant-numeric: tabular-nums; }
.row.save { color: var(--ok); }
.row.total { border-top: 1px solid var(--line); padding-top: 10px; font-weight: 800; font-size: 1.15rem; }
.muted { color: var(--muted); font-size: .88rem; }

/* Checkout form */
form.co { display: grid; gap: 14px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 10px 12px;
}
.field textarea { resize: vertical; min-height: 72px; }
.field.has-err input, .field.has-err textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .85rem; min-height: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.demo-note { background: var(--gold-soft); border-radius: 8px; padding: 10px 14px; font-size: .92rem; }
.mini-lines { display: grid; gap: 6px; font-size: .92rem; }
.mini-lines div { display: flex; justify-content: space-between; gap: 10px; }
.mini-lines span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Done + policies */
.done { max-width: 560px; margin: 20px auto; text-align: center; display: grid; gap: 14px; justify-items: center; }
.tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; font-size: 2rem; }
.order-no { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; }
.prose { max-width: 68ch; }
.prose h2 { font-family: var(--font-display); font-weight: 400; font-size: 1.4rem; margin: 28px 0 6px; }
.prose p { margin: 0 0 10px; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.toc a { color: var(--accent); }

/* Footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); padding-block: 28px; color: var(--muted); font-size: .92rem; }
.foot-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.foot-grid b { color: var(--ink); display: block; margin-bottom: 4px; }
.foot-grid a { color: var(--muted); }

/* Toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 40;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  display: flex; gap: 14px; align-items: center; box-shadow: 0 6px 24px rgba(0,0,0,.2); max-width: calc(100% - 32px);
}
.toast a { color: var(--bg); font-weight: 700; }
.loading { padding: 60px 0; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Product photo gallery */
.gallery { display: grid; gap: 10px; min-width: 0; max-width: 520px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; }
.thumb { flex: 0 0 64px; width: 64px; aspect-ratio: 3 / 4; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb[aria-pressed="true"] { border-color: var(--accent); }
