/* ===== Tokens ===== */
:root {
  --oat: #EDE6D8;
  --oat-deep: #E1D6C0;
  --ivory: #FBF8F2;
  --ink: #2A2420;
  --ink-soft: #756A5D;
  --moss: #45532F;
  --moss-dark: #333E22;
  --clay: #9C4A34;
  --clay-soft: #F0DCCF;
  --line: #D9CDB4;

  --serif: "Fraunces", Georgia, serif;
  --sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--oat);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

/* ===== Header ===== */
.site-header {
  padding: 28px clamp(20px, 5vw, 64px) 0;
}

.wordmark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: 0.01em;
  color: var(--moss-dark);
}

/* ===== Hero ===== */
.hero {
  padding: 56px clamp(20px, 5vw, 64px) 40px;
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  color: var(--ink);
}

.hero-sub {
  font-size: 16px;
  color: var(--ink-soft);
  max-width: 46ch;
  margin: 0 auto 32px;
}

.search-wrap {
  position: relative;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  background: var(--ivory);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px 4px 20px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-wrap:focus-within {
  border-color: var(--moss);
  box-shadow: 0 0 0 4px rgba(69, 83, 47, 0.12);
}

.search-icon {
  color: var(--ink-soft);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--ink);
  padding: 14px 10px;
  min-width: 0;
}

.search-input::placeholder {
  color: #A79C8C;
}

.clear-btn {
  border: none;
  background: var(--oat-deep);
  color: var(--ink-soft);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.clear-btn:hover { background: var(--line); }

.result-count {
  margin: 20px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
}

.result-count strong {
  color: var(--clay);
  font-weight: 600;
}

/* ===== Catalog / grid ===== */
.catalog {
  padding: 0 clamp(16px, 4vw, 48px) 80px;
  max-width: 1440px;
  margin: 0 auto;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

@media (min-width: 560px) {
  .product-grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (min-width: 860px) {
  .product-grid { grid-template-columns: repeat(4, 1fr); gap: 18px; }
}

@media (min-width: 1180px) {
  .product-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
}

.product-card {
  background: var(--ivory);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.35s ease both;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.card-media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--oat-deep);
  overflow: hidden;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.card-media.img-error img { display: none; }

.card-media .img-fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  padding: 10px;
}

.card-media.img-error .img-fallback { display: flex; }

.code-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(42, 36, 32, 0.72);
  color: #F5EFE3;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(2px);
}

.card-body {
  padding: 12px 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.card-cta {
  margin-top: auto;
  display: block;
  text-align: center;
  background: var(--moss);
  color: var(--ivory);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 10px;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.card-cta:hover { background: var(--moss-dark); }

.empty-state {
  text-align: center;
  color: var(--ink-soft);
  padding: 60px 20px;
  font-size: 15px;
}

.sentinel {
  height: 1px;
}

/* ===== Footer ===== */
.site-footer {
  padding: 28px clamp(20px, 5vw, 64px) 40px;
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 60ch;
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .product-card { animation: none; }
  html { scroll-behavior: auto; }
}
