:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --border: #e2e2e2;
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --danger: #c0392b;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); }
h1, h2 { margin: 0 0 0.5rem; }
button { font: inherit; cursor: pointer; }
select, input, textarea { font: inherit; padding: 0.5rem; border: 1px solid var(--border); border-radius: 8px; width: 100%; }
label { display: block; font-size: 0.85rem; font-weight: 600; margin: 0.75rem 0 0.25rem; }

/* Header / nav, sticky so search + category filters are always one tap away */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
}
.brand { font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.main-nav { display: flex; gap: 0.5rem; margin-left: auto; }
.nav-link {
  background: none;
  border: none;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
}
.nav-link.is-active { background: var(--bg-soft); color: var(--ink); }
.cart-button { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0.7rem; }

.search-row { padding: 0 1rem 0.75rem; }
#search-input { margin-bottom: 0.5rem; }
.filter-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.filter-row select { width: auto; min-width: 140px; }
.link-button { background: none; border: none; color: var(--accent); font-weight: 600; padding: 0.25rem; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.view[hidden] { display: none; }

.active-filters { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.active-filters .chip { background: var(--bg-soft); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.85rem; }

.design-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}
.loading, .empty-state { color: var(--muted); text-align: center; padding: 2rem 0; }

.design-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  text-align: left;
  padding: 0;
}
.design-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--bg-soft); }
.design-card .card-body { padding: 0.6rem 0.7rem; }
.design-card .card-name { font-weight: 700; font-size: 0.95rem; }
.tag-chips { display: flex; gap: 0.3rem; flex-wrap: wrap; margin: 0.3rem 0 0.5rem; }
.tag-chips .chip { background: var(--bg-soft); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.75rem; color: var(--muted); }

/* FAQ */
.faq-list details { border: 1px solid var(--border); border-radius: 8px; padding: 0.7rem 1rem; margin-bottom: 0.6rem; }
.faq-list summary { font-weight: 700; cursor: pointer; }
.faq-list p { margin: 0.5rem 0 0; color: var(--muted); }

/* Modal */
dialog { border: none; border-radius: var(--radius); padding: 0; max-width: 640px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,0.5); }
.modal-body { display: grid; grid-template-columns: 1fr; }
#modal-image { width: 100%; max-height: 320px; object-fit: contain; background: var(--bg-soft); }
.modal-form { padding: 1rem 1.25rem 1.25rem; position: relative; }
.modal-close { position: absolute; top: 0.5rem; right: 0.5rem; background: var(--bg); border: 1px solid var(--border); border-radius: 50%; width: 32px; height: 32px; z-index: 5; }
.size-note { font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0 0; }
.segmented { display: flex; gap: 0.4rem; }
.segmented button { flex: 1; border: 1px solid var(--border); background: var(--bg); border-radius: 8px; padding: 0.5rem; }
.segmented button.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

.primary-button { background: var(--accent); color: var(--accent-ink); border: none; border-radius: 8px; padding: 0.7rem 1rem; font-weight: 700; width: 100%; margin-top: 1rem; }
.primary-button:disabled { opacity: 0.5; cursor: not-allowed; }

@media (min-width: 640px) {
  .modal-body { grid-template-columns: 1fr 1fr; }
  #modal-image { max-height: none; height: 100%; }
}

/* Cart drawer */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 30; }
.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100%; width: min(420px, 100vw);
  background: var(--bg); z-index: 31; padding: 1rem; display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.2s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1); overflow-y: auto;
}
.cart-drawer.is-open { transform: translateX(0); }
.cart-header { display: flex; justify-content: space-between; align-items: center; }
.cart-header button { background: none; border: none; font-size: 1.1rem; }
.cart-items { flex: 1; margin-top: 0.5rem; }
.cart-item { display: flex; gap: 0.6rem; padding: 0.6rem 0; border-bottom: 1px solid var(--border); align-items: center; }
.cart-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--bg-soft); }
.cart-item .meta { flex: 1; font-size: 0.85rem; }
.cart-item .meta .name { font-weight: 700; }
.cart-item .remove { background: none; border: none; color: var(--danger); }
.cart-total-row { display: flex; justify-content: space-between; font-size: 1.05rem; margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--border); }
.fine-print { font-size: 0.75rem; color: var(--muted); text-align: center; margin-top: 0.5rem; }
.backorder-badge { color: #a05a00; font-weight: 700; }
