:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --ink: #1d1c1a;
  --muted: #74706a;
  --line: #e3dfd7;
  --ph: #e9e5de;          /* image placeholder */
  --accent: #1d1c1a;
  --accent-ink: #ffffff;
  --radius: 6px;
  --gutter: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-scheme="dark"] {
  --bg: #151413;
  --surface: #1f1e1c;
  --ink: #ecebe8;
  --muted: #9c978f;
  --line: #2e2c29;
  --ph: #262422;
  --accent: #ecebe8;
  --accent-ink: #151413;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
img { display: block; }

/* top bar */
.bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: baseline; gap: 10px;
  padding: 14px var(--gutter) 12px;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.bar.scrolled { border-bottom-color: var(--line); }
.brand { font-weight: 650; font-size: 17px; letter-spacing: -.01em; }
.bar-sub { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

main { padding-bottom: calc(32px + var(--safe-b)); min-height: 70vh; }

/* section headings */
.h1 { font-size: 26px; line-height: 1.15; font-weight: 650; letter-spacing: -.02em; margin: 8px var(--gutter) 4px; }
.lead { color: var(--muted); margin: 0 var(--gutter) 20px; max-width: 34em; }
.sec { display: flex; align-items: baseline; justify-content: space-between; margin: 28px var(--gutter) 12px; }
.sec h2 { font-size: 17px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.sec a { color: var(--muted); font-size: 14px; }

/* image box */
.ph { background: var(--ph); overflow: hidden; border-radius: var(--radius); position: relative; }
.ph img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.ph img.ok { opacity: 1; }

/* categories */
.cats { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 12px; padding: 0 var(--gutter); }
.cat .ph { aspect-ratio: 4 / 5; }
.cat:first-child { grid-column: 1 / -1; }
.cat:first-child .ph { aspect-ratio: 16 / 10; }
.cat-name { margin-top: 8px; font-weight: 600; font-size: 15px; line-height: 1.25; }
.cat-count { color: var(--muted); font-size: 13px; }

/* horizontal strip */
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 0 var(--gutter) 4px; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none; }
.strip::-webkit-scrollbar { display: none; }
.strip .card { flex: 0 0 42%; scroll-snap-align: start; }

/* product grid */
.filters { display: flex; gap: 6px; padding: 0 var(--gutter); margin: 0 0 16px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  min-height: 36px; padding: 0 16px; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 10px; padding: 0 var(--gutter); }
.card .ph { aspect-ratio: 3 / 4; }
.card-t { margin-top: 7px; font-size: 14px; line-height: 1.3; font-weight: 550; }
.card-m { color: var(--muted); font-size: 12.5px; }
.badge {
  position: absolute; left: 6px; bottom: 6px; padding: 1px 6px; border-radius: 4px;
  background: rgba(20, 19, 18, .62); color: #fff; font-size: 11.5px; font-variant-numeric: tabular-nums;
}
.more { height: 1px; }
.empty { color: var(--muted); padding: 40px var(--gutter); text-align: center; }

/* item page */
.gallery { position: relative; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--ph); }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; aspect-ratio: 4 / 5; max-height: 72vh; }
.slide img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.slide img.ok { opacity: 1; }
.counter {
  position: absolute; right: 12px; bottom: 12px; padding: 2px 8px; border-radius: 4px;
  background: rgba(20, 19, 18, .62); color: #fff; font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.thumbs { display: flex; gap: 6px; padding: 10px var(--gutter) 0; overflow-x: auto; scrollbar-width: none; }
.thumbs::-webkit-scrollbar { display: none; }
.thumb { flex: 0 0 52px; height: 52px; padding: 0; border: 0; border-radius: 4px; overflow: hidden; background: var(--ph); opacity: .55; cursor: pointer; }
.thumb[aria-current="true"] { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }

.info { padding: 18px var(--gutter) 0; }
.info h1 { font-size: 22px; line-height: 1.2; font-weight: 650; letter-spacing: -.015em; margin: 0 0 4px; }
.meta { color: var(--muted); font-size: 14px; }
.about { margin: 16px 0 0; white-space: pre-line; }
.specs { margin: 16px 0 0; border-top: 1px solid var(--line); }
.specs div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; text-align: right; }

.order {
  margin: 24px var(--gutter) 0; padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px;
}
.order-l { font-size: 13px; color: var(--muted); }
.order-who { font-size: 19px; font-weight: 650; margin: 2px 0 0; letter-spacing: -.01em; word-break: break-all; }
.order-note { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.order-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.order-actions:empty { display: none; }
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  border-radius: 8px; border: 1px solid var(--ink); background: var(--accent); color: var(--accent-ink);
  font-weight: 600; font-size: 15px; cursor: pointer; padding: 0 14px; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }

/* states */
.state { padding: 18vh 28px 0; text-align: center; }
.state h1 { font-size: 20px; font-weight: 650; margin: 0 0 8px; }
.state p { color: var(--muted); margin: 0 auto 22px; max-width: 22em; }
.state .btn { flex: none; min-width: 200px; }
.skel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 8px var(--gutter); }
.skel i { display: block; aspect-ratio: 4 / 5; background: var(--ph); border-radius: var(--radius); }
.skel i:first-child { grid-column: 1 / -1; aspect-ratio: 16 / 10; }

@media (min-width: 640px) {
  .cats, .grid { grid-template-columns: repeat(3, 1fr); }
  .strip .card { flex-basis: 24%; }
  .slide { aspect-ratio: 4 / 3; }
}
