:root {
  color-scheme: light dark;
  --bg: #f6f2ec;
  --panel: #fffdf9;
  --text: #171513;
  --muted: #777068;
  --line: #d8d0c7;
  --accent: #8b1e2d;
  --button-text: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11100f;
    --panel: #191715;
    --text: #f7f2eb;
    --muted: #aaa198;
    --line: #37312c;
    --accent: #c94e60;
    --button-text: #ffffff;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input { font: inherit; }
button { color: inherit; }
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 18px 14px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, serif; font-size: 27px; letter-spacing: .08em; }
h2 { font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.icon-button, .dialog-close {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 999px;
}
.icon-button { width: 42px; height: 42px; font-size: 25px; }
main { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.search-panel { padding: 14px 18px 4px; }
.search-panel label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}
.search-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  padding: 12px 14px;
}
.category-nav {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 15px 18px;
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }
.category {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  padding: 9px 13px;
}
.category.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 10px 18px 16px;
}
.count { color: var(--muted); font-size: 13px; }
.status { padding: 30px 18px; color: var(--muted); text-align: center; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 10px;
  padding: 0 10px;
}
.product-open {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}
.image-wrap {
  position: relative;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--panel);
}
.product-image { width: 100%; height: 100%; object-fit: cover; display: block; }
.sold-badge {
  position: absolute;
  left: 9px;
  bottom: 9px;
  background: rgba(18,16,14,.82);
  color: white;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.product-copy { padding: 9px 3px 0; }
.product-title {
  font-family: Georgia, serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.25;
}
.product-meta { margin-top: 4px; color: var(--muted); font-size: 12px; }
.product-price { margin-top: 6px; font-size: 14px; }
.product-dialog {
  width: min(100%, 720px);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: auto;
  border: 0;
  background: var(--bg);
  color: var(--text);
  padding: 0 0 calc(24px + env(safe-area-inset-bottom));
}
.product-dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-close {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 14px;
  z-index: 5;
  width: 42px;
  height: 42px;
  font-size: 26px;
}
.detail-gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 88%;
  gap: 7px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}
.detail-gallery img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  scroll-snap-align: start;
  background: var(--panel);
}
.detail-body { padding: 22px 18px; }
.detail-body h2 { margin-bottom: 8px; }
.detail-price { font-size: 18px; margin-bottom: 16px; }
.detail-description { color: var(--muted); line-height: 1.55; white-space: pre-line; }
.detail-actions {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}
.action {
  display: block;
  width: 100%;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  text-decoration: none;
}
.action-primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--button-text);
}
.action-secondary {
  border: 1px solid var(--line);
  color: var(--text);
}
@media (min-width: 620px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
