:root {
  --ink: #202325;
  --page-bg: #f4f1ea;
  --surface: #fff;
  --surface-soft: #f8f6f1;
  --accent: #a04226;
  --muted: #625e58;
  --line: rgba(32, 35, 37, 0.15);
  --success: #4f6925;
}

* { box-sizing: border-box; }
html { background: var(--page-bg); }
body {
  min-height: 100vh;
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: "Inter", sans-serif;
}
a { color: inherit; }
button, input { font: inherit; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.catalog-header,
.catalog-main {
  width: min(calc(100% - 32px), 1320px);
  margin-inline: auto;
}
.catalog-header { padding: 34px 0 20px; }
.catalog-title {
  max-width: 760px;
  margin: 0;
  font-family: "EB Garamond", Georgia, serif;
  font-size: clamp(34px, 4.5vw, 50px);
  font-weight: 600;
  line-height: 1.05;
}
.catalog-lead {
  max-width: 620px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2vw, 18px);
  line-height: 1.55;
}
.catalog-main { padding: 0 0 54px; }

.category-filter {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  padding: 2px 2px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.category-filter[hidden] { display: none; }
.category-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 15px;
  border: 1px solid rgba(32, 35, 37, 0.28);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.category-chip:hover { border-color: var(--accent); color: var(--accent); }
.category-chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}
.catalog-note {
  margin: 0 0 22px;
  padding: 10px 0 10px 13px;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.catalog-note[hidden] { display: none; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.product-card[hidden] { display: none; }
.product-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.product-media {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-soft);
  text-decoration: none;
}
.product-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}
.product-media:hover img { transform: scale(1.015); }
.product-image-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #89847c;
  font-size: 12px;
  text-align: center;
}
.sale-flag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 750;
}
.product-body {
  display: flex;
  min-height: 230px;
  flex-direction: column;
  padding: 13px;
}
.product-eyebrow {
  min-height: 15px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.product-card h2 {
  display: -webkit-box;
  min-height: 44px;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.15;
}
.product-card h2 a { text-decoration: none; }
.product-card h2 a:hover { color: var(--accent); text-decoration: underline; }
.product-description {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.product-commerce { margin-top: auto; padding-top: 12px; }
.product-price {
  color: var(--accent);
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.product-price-prefix { margin-right: 3px; color: var(--muted); font-size: 11px; font-weight: 600; }
.product-stock {
  margin-top: 3px;
  color: var(--success);
  font-size: 11px;
  font-weight: 700;
}
.product-stock.out { color: var(--muted); }
.variant-preview {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  margin-top: 9px;
}
.variant-preview img,
.variant-preview-empty {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  object-fit: contain;
}
.variant-count { margin-left: 2px; color: var(--muted); font-size: 10.5px; }
.view-product {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 12px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}
.view-product:hover { background: #34383a; }
.products-empty {
  grid-column: 1 / -1;
  padding: 44px 18px;
  border-block: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.cartbar {
  position: fixed;
  z-index: 40;
  right: 14px;
  bottom: 15px;
  left: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(calc(100% - 28px), 520px);
  margin: auto;
  padding: 11px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.26);
  transform: translateY(130%);
  transition: transform 180ms ease;
}
.cartbar.show { transform: translateY(0); }
.cartbar-info { min-width: 0; color: #fff; }
.cartbar-info .n { overflow: hidden; color: rgba(255,255,255,.72); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.cartbar-info .t { margin-top: 2px; font-size: 13px; font-weight: 700; }
.cartbar-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

@media (min-width: 620px) {
  .catalog-header, .catalog-main { width: min(calc(100% - 48px), 1320px); }
  .products-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  .product-body { min-height: 250px; padding: 17px; }
  .product-card h2 { min-height: 48px; font-size: 21px; }
}
@media (min-width: 1020px) {
  .products-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
  .catalog-header { padding-top: 42px; }
}
@media (max-width: 420px) {
  .catalog-header, .catalog-main { width: min(calc(100% - 24px), 1320px); }
  .catalog-header { padding-top: 25px; }
  .catalog-title { font-size: 31px; }
  .catalog-lead { font-size: 14px; }
  .products-grid { gap: 9px; }
  .product-body { min-height: 215px; padding: 11px; }
  .product-eyebrow { font-size: 9px; }
  .product-card h2 { min-height: 41px; font-size: 17px; }
  .product-description { display: none; }
  .product-price { font-size: 18px; }
  .variant-preview img, .variant-preview-empty { width: 25px; height: 25px; }
  .variant-preview img:nth-of-type(n+4) { display: none; }
  .view-product { padding-inline: 5px; font-size: 11.5px; }
  .cartbar { right: 0; bottom: 0; left: 0; width: 100%; border-radius: 9px 9px 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
