:root {
  --ink: #1d1d1b;
  --muted: #6b6b66;
  --line: #e4e2dc;
  --bg: #faf9f6;
  --accent: #1d1d1b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
[hidden] { display: none !important; }

.site-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.page { max-width: 1100px; margin: 0 auto; padding: 20px; }
h1 { font-size: 1.75rem; margin: 0 0 8px; }
.lead { color: var(--muted); margin: 0 0 24px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  display: block;
  text-decoration: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.card img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; background: #f1efea; }
.card-body { padding: 12px 16px 16px; }
.card-body p { margin: 0 0 4px; }
.card-name { font-weight: 600; }
.card-dims { color: var(--muted); font-size: 0.9rem; }

.product { display: grid; gap: 24px; }
.viewer { position: relative; }
model-viewer {
  width: 100%;
  height: 60vh;
  min-height: 320px;
  background: #f1efea;
  border-radius: 12px;
}
.ar-button {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  padding: 16px;
  font: inherit;
  font-weight: 600;
  font-size: 1.05rem;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.back { color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.details h1 { margin-top: 8px; }
.price { font-size: 1.25rem; font-weight: 600; margin: 0 0 12px; }
.dims-row { font-weight: 500; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.toggle input { width: 20px; height: 20px; }

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff4e5;
  border: 1px solid #f3d3a6;
}
.notice.error { background: #fdecec; border-color: #f2b8b8; }
.product > #inapp-hint { grid-column: 1 / -1; margin: 0; }

.site-footer {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 16px 20px 32px;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--line);
}

@media (min-width: 800px) {
  .product { grid-template-columns: 3fr 2fr; align-items: start; }
  model-viewer { height: 70vh; }
}

.qr { display: none; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 0.8rem; }
.qr img { width: 72px; height: 72px; image-rendering: pixelated; }
@media (hover: hover) and (pointer: fine) {
  .qr { display: flex; }
}

.mode { display: inline-flex; margin: 4px 0 16px; border: 1px solid var(--ink); border-radius: 999px; overflow: hidden; }
.mode button { font: inherit; font-weight: 600; padding: 10px 18px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.mode button[aria-pressed="true"] { background: var(--ink); color: #fff; }

.steps {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.94);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}
.steps p { margin: 0 0 2px; }
.step-count { color: var(--muted); font-size: 0.85rem; }
.step-title { font-weight: 700; font-size: 1.05rem; }
.step-text { font-size: 0.9rem; line-height: 1.3; }
.step-nav { display: flex; gap: 8px; margin-top: 8px; }
.step-nav button {
  flex: 1;
  font: inherit;
  font-weight: 600;
  padding: 8px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.step-nav button:disabled { opacity: 0.35; cursor: default; }

.product.building model-viewer { height: 78vh; }
