:root {
  --canvas: #EDE8DD;
  --canvas-raised: #F6F3EA;
  --ink: #201F1C;
  --ink-soft: #55503f;
  --line: #A79C87;
  --green: #3F4A3A;
  --green-dark: #2E362A;
  --brass: #C68A2E;
  --error: #A3402F;
  --radius: 2px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo, .cart-toggle, .btn-primary {
  font-family: 'Bebas Neue', 'Inter', sans-serif;
  letter-spacing: 0.03em;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--canvas);
  border-bottom: 2px solid var(--ink);
}
.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { font-size: 1.6rem; }
.logo-dot { color: var(--brass); }

.cart-toggle {
  font-size: 1rem;
  background: var(--ink);
  color: var(--canvas-raised);
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-count {
  background: var(--brass);
  color: var(--ink);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  padding: 1px 7px;
  border-radius: 10px;
}

/* ---------- Hero ---------- */
.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 90px 24px 70px;
}
.hero h1 {
  font-size: clamp(3.2rem, 9vw, 7rem);
  line-height: 0.92;
  margin: 0 0 24px;
  color: var(--green-dark);
}
.hero-sub {
  max-width: 460px;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 0 0 28px;
}
.hero-cue {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}

/* ---------- Catalog ---------- */
.catalog {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 100px;
}
.catalog-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 10px;
  margin-bottom: 30px;
}
.catalog-head h2 { font-size: 2rem; margin: 0; }
.catalog-note {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px;
}

/* Hang-tag product card */
.tag-card {
  background: var(--canvas-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tag-card::before {
  /* punch hole */
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  width: 10px;
  height: 10px;
  background: var(--canvas);
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  z-index: 2;
}
.tag-card .tag-image {
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.tag-card .tag-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tag-perf {
  border-top: 1.5px dashed var(--line);
  margin: 0;
}
.tag-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.tag-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}
.tag-select {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
  color: var(--ink);
}
.tag-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}
.tag-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.05rem;
  color: var(--green-dark);
}
.tag-add {
  background: var(--ink);
  color: var(--canvas-raised);
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tag-add:hover { background: var(--green-dark); }
.tag-add:disabled { background: var(--line); cursor: not-allowed; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--ink);
  padding: 22px 24px 40px;
  text-align: center;
}
.site-footer p {
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* ---------- Cart drawer ---------- */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(32, 31, 28, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}
.scrim.visible { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100%;
  width: min(400px, 100%);
  background: var(--canvas-raised);
  border-left: 2px solid var(--ink);
  z-index: 40;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.cart-drawer.open { transform: translateX(0); }

.cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 2px solid var(--ink);
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.3rem;
}
.cart-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink);
}
.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cart-empty {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin-top: 30px;
  text-align: center;
}
.cart-line {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
.cart-line img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: #fff;
}
.cart-line-info { flex: 1; }
.cart-line-name { font-size: 0.88rem; font-weight: 600; margin: 0 0 2px; }
.cart-line-variant { font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 6px; }
.cart-line-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
}
.qty-btn {
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  background: var(--canvas);
  cursor: pointer;
  border-radius: var(--radius);
  line-height: 1;
}
.cart-line-remove {
  background: none;
  border: none;
  color: var(--error);
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}
.cart-line-price {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  white-space: nowrap;
}

.cart-footer {
  border-top: 2px solid var(--ink);
  padding: 18px 22px 24px;
}
.cart-total-row {
  display: flex;
  justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  margin-bottom: 14px;
}

.btn-primary {
  width: 100%;
  background: var(--green-dark);
  color: var(--canvas-raised);
  border: none;
  padding: 14px;
  font-size: 1.05rem;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-primary:disabled { background: var(--line); cursor: not-allowed; }
.btn-primary:not(:disabled):hover { background: var(--green); }

.spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(246, 243, 234, 0.35);
  border-top-color: var(--canvas-raised);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
.btn-primary.loading .spinner { display: inline-block; }
.btn-primary.loading .btn-label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.checkout-error {
  color: var(--error);
  font-size: 0.82rem;
  min-height: 1em;
  margin: 10px 0 0;
}
