:root {
  --ink: #14141f;
  --ink-soft: #1a1a2e;
  --paper: #f7f6f2;
  --paper-2: #ffffff;
  --gold: #d99a2b;
  --gold-bright: #e8b64c;
  --muted: #6b6b78;
  --line: #e4e2da;
  --radius: 4px;
  --max: 1160px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 20px; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* Referral banner */
.ref-banner {
  background: var(--ink-soft);
  color: var(--paper);
  text-align: center;
  font-size: 0.9rem;
  padding: 10px 16px;
}
.ref-banner strong { color: var(--gold-bright); }

/* Header */
.site-head {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(247, 246, 242, 0.92);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line);
}
.head-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}
.brand-ai {
  background: var(--gold);
  color: var(--ink);
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 3px;
}
.brand-sub { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.16em; }

.cart-btn {
  font: inherit;
  font-weight: 600;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: var(--radius);
  padding: 9px 16px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.cart-count {
  background: var(--gold-bright);
  color: var(--ink);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hero */
.hero { padding: 64px 0 40px; }
.eyebrow {
  font-family: "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.78rem;
  color: var(--gold);
  margin: 0 0 14px;
}
.hero h1 {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  max-width: 16ch;
}
.lede { font-size: 1.06rem; color: var(--muted); max-width: 52ch; margin: 0; }

/* Filters */
.filters { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 28px; }
.filter {
  font: inherit;
  font-size: 0.9rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.filter:hover { border-color: var(--ink); }
.filter.is-active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 26px 22px;
  padding-bottom: 80px;
}
.loading { color: var(--muted); }

.card { display: flex; flex-direction: column; }
.card-frame {
  position: relative;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 5;
}
.card-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tag {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 3px;
  background: var(--paper);
  color: var(--ink);
}
.tag.limited { background: var(--gold-bright); }
.tag.custom { background: var(--ink); color: var(--paper); }

.card-body { padding: 12px 2px 0; display: flex; flex-direction: column; gap: 3px; }
.card-title { font-family: "Space Grotesk", sans-serif; font-weight: 500; font-size: 1.02rem; margin: 0; }
.card-creator { color: var(--muted); font-size: 0.85rem; }
.card-creator b { color: var(--ink); font-weight: 600; }
.card-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.card-price { font-family: "Space Grotesk", sans-serif; font-weight: 700; font-size: 1.05rem; }
.add-btn {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.add-btn:hover { background: var(--ink); color: var(--paper); }

/* Footer */
.site-foot { border-top: 1px solid var(--line); padding: 30px 0 60px; }
.site-foot p { color: var(--muted); font-size: 0.85rem; margin: 0; max-width: 70ch; }

/* Cart drawer */
/* The drawer and overlay start closed via the `hidden` attribute (toggled in
   app.js). The `.cart` display rule below would otherwise override the browser
   default for [hidden], leaving the drawer stuck open, so restore it here. */
.cart[hidden], .cart-overlay[hidden] { display: none; }
.cart-overlay { position: fixed; inset: 0; background: rgba(20, 20, 31, 0.4); z-index: 30; }
.cart {
  position: fixed;
  top: 0; right: 0;
  width: min(400px, 90vw);
  height: 100%;
  background: var(--paper);
  z-index: 40;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,0.14);
}
.cart-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); }
.cart-head h2 { font-family: "Space Grotesk", sans-serif; margin: 0; font-size: 1.2rem; }
.icon-btn { font-size: 1.6rem; line-height: 1; background: none; border: 0; cursor: pointer; color: var(--ink); }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 20px; }
.cart-empty { color: var(--muted); padding: 24px 0; }
.ci { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ci img { width: 54px; height: 68px; object-fit: cover; border-radius: 3px; }
.ci-mid { flex: 1; }
.ci-title { font-weight: 600; font-size: 0.92rem; }
.ci-creator { color: var(--muted); font-size: 0.8rem; }
.ci-qty { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; }
.ci-qty button { width: 24px; height: 24px; border: 1px solid var(--line); background: var(--paper-2); border-radius: 3px; cursor: pointer; font: inherit; }
.ci-price { font-family: "Space Grotesk", sans-serif; font-weight: 700; }
.cart-foot { padding: 18px 20px 24px; border-top: 1px solid var(--line); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.cart-total strong { font-family: "Space Grotesk", sans-serif; font-size: 1.4rem; }
.checkout-btn {
  width: 100%;
  font: inherit;
  font-weight: 700;
  background: var(--gold);
  color: var(--ink);
  border: 0;
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
}
.checkout-btn:disabled { background: var(--line); color: var(--muted); cursor: not-allowed; }
.cart-note { color: var(--muted); font-size: 0.78rem; text-align: center; margin: 10px 0 0; }

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