:root {
  --bg: #f3efe6;
  --paper: #fffcf6;
  --ink: #151914;
  --muted: #5d6358;
  --line: #d9d2c4;
  --accent: #1f4d3a;
  --accent-soft: #e6efe8;
  --highlight: #c45c26;
  --ok: #1f6b3f;
  --ok-bg: #e5f4ea;
  --low: #8a4b10;
  --low-bg: #f8ead8;
  --shadow: 0 10px 30px rgba(21, 25, 20, 0.08);
  --radius: 16px;
  --header: 72px;
  --font: "Manrope", "Segoe UI", system-ui, sans-serif;
  --display: "Syne", "Trebuchet MS", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
}

img { max-width: 100%; display: block; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--header);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: #121611;
  color: #f6f1e6;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.brand svg { width: 34px; height: 34px; }
.brand-name {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.05rem;
}
.search {
  flex: 1;
  max-width: 420px;
  margin-left: auto;
  position: relative;
}
.search input {
  width: 100%;
  border: 0;
  border-radius: 999px;
  padding: 10px 16px 10px 40px;
  background: #2a3128;
  color: #f6f1e6;
  outline: none;
}
.search input::placeholder { color: #b3b8ac; }
.search input:focus { background: #323a30; box-shadow: 0 0 0 2px #c9a06a; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.7;
  pointer-events: none;
}
.cart-btn {
  position: relative;
  background: transparent;
  color: #f6f1e6;
  border: 1px solid #3c4539;
  border-radius: 999px;
  padding: 8px 14px 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cart-btn:hover { background: #2a3128; }
.cart-count {
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--highlight);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* Layout */
main { min-height: calc(100vh - var(--header) - 88px); }
.wrap { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }

.hero {
  background:
    radial-gradient(900px 280px at 10% 0%, rgba(31, 77, 58, 0.18), transparent 60%),
    linear-gradient(180deg, #ece6d8 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
  padding: 44px 0 28px;
}
.kicker {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
}
.hero h1 {
  font-family: var(--display);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  margin: 0 0 12px;
  letter-spacing: -0.03em;
}
.hero p { margin: 0; max-width: 640px; color: var(--muted); font-size: 1.05rem; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 22px 0 8px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 0.88rem;
}
.chip[aria-pressed="true"], .chip:hover {
  background: var(--accent);
  color: #f6f1e6;
  border-color: var(--accent);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  padding: 18px 0 48px;
}
.empty {
  grid-column: 1 / -1;
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--muted);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 16px 36px rgba(21, 25, 20, 0.12); }
.card-image {
  height: 188px;
  background: #f7f4ee;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}
.card-image img { max-height: 164px; width: auto; max-width: 100%; object-fit: contain; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.subcat {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.card h2 { font-size: 1rem; line-height: 1.3; margin: 0; font-weight: 700; min-height: 2.6em; }
.price { font-size: 1.2rem; font-weight: 800; margin-top: auto; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 8px;
}
.badge.in { background: var(--ok-bg); color: var(--ok); }
.badge.low { background: var(--low-bg); color: var(--low); }
.case-note { font-size: 0.78rem; color: var(--muted); }

/* Detail */
.detail { padding: 32px 0 56px; }
.back {
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 700;
  padding: 0 0 18px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}
.detail-image {
  background: #f7f4ee;
  border-radius: 18px;
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.detail-image img { max-height: 420px; width: auto; max-width: 100%; object-fit: contain; }
.detail-copy h1 { font-family: var(--display); font-size: 2rem; line-height: 1.15; margin: 0 0 8px; }
.sku { color: var(--muted); font-size: 0.9rem; margin: 0 0 16px; }
.detail .price { font-size: 1.8rem; margin: 8px 0 14px; }
.description { white-space: pre-wrap; color: #2c322a; }
.specs { list-style: none; padding: 0; margin: 16px 0 22px; color: var(--muted); font-size: 0.92rem; }
.specs li { margin: 0 0 4px; }
.add-row { display: flex; gap: 10px; align-items: center; }
.add-row input {
  width: 72px;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  text-align: center;
  background: white;
}
.btn-primary {
  background: var(--accent);
  color: #f6f1e6;
  border: 0;
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

/* Cart drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 22, 17, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 30;
}
.overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100%;
  background: var(--paper);
  z-index: 31;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,0.18);
}
.drawer.open { transform: translateX(0); }
.drawer-head, .drawer-foot { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.drawer-foot { border-bottom: 0; border-top: 1px solid var(--line); flex-direction: column; align-items: stretch; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 1.15rem; }
.icon-btn { background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--ink); }
.cart-items { flex: 1; overflow: auto; padding: 8px 20px 20px; }
.cart-line {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.cart-line img { width: 64px; height: 64px; object-fit: contain; background: #f7f4ee; border-radius: 8px; }
.cart-line h3 { margin: 0 0 4px; font-size: 0.92rem; }
.qty-ctrl { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.qty-ctrl button {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: white;
}
.remove { background: none; border: 0; color: var(--muted); font-size: 0.8rem; text-decoration: underline; padding: 0; }
.subtotal { display: flex; justify-content: space-between; font-weight: 700; font-size: 1.05rem; }
.btn-checkout {
  width: 100%;
  background: #cfc8b8;
  color: #3f3a32;
  border: 0;
  border-radius: 999px;
  padding: 13px 16px;
  font-weight: 700;
  cursor: not-allowed;
}
.checkout-note { margin: 0; font-size: 0.82rem; color: var(--muted); text-align: center; }
.cart-empty { color: var(--muted); padding: 28px 0; text-align: center; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 28px;
  background: #ece6d8;
}
.footer-inner {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.92rem;
}
.site-footer a { color: var(--accent); font-weight: 700; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.test-flag {
  background: #121611;
  color: #f6f1e6;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hidden { display: none !important; }

@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .site-header { padding: 0 14px; gap: 12px; }
  .search { max-width: none; }
  .brand-name { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .hero { padding-top: 28px; }
  .card-image { height: 150px; }
}
