:root {
  --paper: #E4DCC8;
  --paper-card: #EFE9DA;
  --ink: #1F1B16;
  --ink-soft: #4A4136;
  --denim: #2C4A5E;
  --mustard: #C99A2E;
  --line: #B9AF97;
  --stamp-red: #A33327;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  line-height: 1.5;
}

h1, h2, .stamp-mark, .price-tag, .cat-nav a {
  font-family: 'Special Elite', monospace;
}

/* Header */
.site-head {
  display: flex;
  justify-content: center;
  padding: 32px 24px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.site-logo {
  width: 100%;
  max-width: 460px;
  height: auto;
}

/* Category nav */
.cat-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 24px;
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  max-width: 900px;
  margin: 0 auto;
}

.cat-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper-card);
  transition: background 0.15s ease, color 0.15s ease;
}

.cat-nav a:hover,
.cat-nav a:focus-visible {
  background: var(--denim);
  color: var(--paper);
  outline: none;
}

/* Categories */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

.category {
  padding-top: 48px;
  scroll-margin-top: 60px;
}

.category h2 {
  font-size: 1.4rem;
  margin: 0 0 4px;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  margin-top: 20px;
}

.empty-note {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 0.9rem;
  border: 1px dashed var(--line);
  padding: 20px;
  text-align: center;
}

/* Item card */
.item {
  background: var(--paper-card);
  border: 1px solid var(--line);
  padding: 10px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item .photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--paper);
  border: 1px solid var(--line);
}

.item .photo-fallback {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--line);
  font-size: 0.75rem;
  text-align: center;
  padding: 8px;
}

.item .name {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
}

.item .meta {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 0;
}

.item .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.price-tag {
  color: var(--denim);
  font-size: 1rem;
}

.condition {
  font-size: 0.72rem;
  padding: 2px 8px;
  border: 1px solid var(--ink);
  border-radius: 2px;
}

.condition.new {
  background: var(--mustard);
  border-color: var(--mustard);
  color: var(--ink);
}

.buy-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.buy-card-btn {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 0.82rem;
  background: var(--denim);
  color: var(--paper);
  border: none;
  padding: 9px 12px;
  border-radius: 2px;
  cursor: pointer;
}

.buy-card-btn:hover {
  opacity: 0.9;
}

.buy-card-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.paypal-slot {
  min-height: 35px;
}

.cart-toggle {
  margin-left: auto;
  font-family: 'Special Elite', monospace;
  font-size: 0.8rem;
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--mustard);
  color: var(--ink);
  cursor: pointer;
}

#cart-count {
  font-weight: 700;
}

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 20;
}

.cart-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cart-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 90vw);
  background: var(--paper);
  border-left: 2px solid var(--ink);
  transform: translateX(100%);
  transition: transform 0.2s ease;
  z-index: 21;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

.cart-panel.open {
  transform: translateX(0);
}

.cart-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.cart-panel-head h2 {
  margin: 0;
  font-size: 1.2rem;
}

#cart-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink);
  line-height: 1;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  font-size: 0.85rem;
}

.cart-item-name {
  flex: 1;
}

.cart-item-price {
  font-family: 'Special Elite', monospace;
  color: var(--denim);
}

.cart-item-remove {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--stamp-red);
}

.cart-footer {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-family: 'Special Elite', monospace;
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.cart-checkout-btn {
  width: 100%;
  margin-bottom: 10px;
}

.add-cart-btn {
  font-family: 'Work Sans', sans-serif;
  font-size: 0.78rem;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 7px 12px;
  border-radius: 2px;
  cursor: pointer;
}

.add-cart-btn:hover {
  background: var(--paper);
}

.sold-stamp {
  position: absolute;
  top: 12px;
  right: 8px;
  color: var(--stamp-red);
  border: 3px solid var(--stamp-red);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.9rem;
  transform: rotate(10deg);
  opacity: 0.85;
  pointer-events: none;
}

/* Footer */
.site-foot {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 24px 48px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

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