*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
img { max-width: 100%; display: block; }

:root {
  --board: #20241f;
  --board-light: #2b3129;
  --board-line: #3a4136;
  --chalk: #f4f1e8;
  --chalk-dim: color-mix(in srgb, #f4f1e8 68%, transparent);
  --tomato: #d64933;
  --citrus: #e8a33d;
  --leaf: #7f9f6e;
  --crate: #b08a5f;
  --sky: #7fa6b0;

  --font-display: "Fraunces", serif;
  --font-body: "Karla", sans-serif;
  --max: 1180px;
  --gutter: clamp(20px, 5vw, 56px);
}

body {
  background: var(--board);
  color: var(--chalk);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px var(--gutter);
  background: var(--board);
  border-bottom: 1px solid var(--board-line);
}
.nav__brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.nav__mark { width: 24px; height: 24px; color: var(--tomato); }
.nav__brand span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.01em;
}
.nav__search { flex: 1; max-width: 420px; margin-inline-start: clamp(12px, 4vw, 48px); }
.nav__search input {
  width: 100%;
  background: var(--board-light);
  border: 1px solid var(--board-line);
  color: var(--chalk);
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
}
.nav__search input::placeholder { color: var(--chalk-dim); }
.cart-toggle {
  margin-inline-start: auto;
  position: relative;
  background: var(--board-light);
  border: 1px solid var(--board-line);
  border-radius: 999px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: none;
}
.cart-toggle svg { width: 18px; height: 18px; color: var(--chalk); }
.cart-toggle__count {
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  background: var(--tomato);
  color: var(--chalk);
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- layout ---------- */
main > section { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- hero ---------- */
.hero { padding-top: clamp(56px, 9vw, 100px); padding-bottom: clamp(40px, 6vw, 72px); max-width: 640px; }
.hero__eyebrow { color: var(--citrus); font-weight: 600; font-size: 15px; margin-bottom: 12px; }
.hero__headline {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 1.02;
}
.hero__sub { margin-top: 20px; font-size: 18px; color: var(--chalk-dim); max-width: 46ch; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 28px;
  padding: 13px 26px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background 0.15s ease;
}
.btn--primary { background: var(--tomato); color: var(--chalk); }
.btn--primary:hover { background: color-mix(in srgb, var(--tomato) 85%, white); }
.btn:active { transform: translateY(1px); }

/* ---------- shop controls ---------- */
.shop { padding-bottom: clamp(56px, 8vw, 96px); }
.shop__controls { margin-bottom: 28px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  background: transparent;
  border: 1px solid var(--board-line);
  color: var(--chalk-dim);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.tab.is-active { background: var(--chalk); color: var(--board); border-color: var(--chalk); }

/* ---------- product grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.grid__empty { color: var(--chalk-dim); padding: 40px 0; }

.card {
  background: var(--board-light);
  border: 1px solid var(--board-line);
  border-radius: 14px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: repeating-linear-gradient(90deg, var(--crate) 0 10px, transparent 10px 14px);
  opacity: 0.7;
}
.card__icon {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.card__icon svg { width: 30px; height: 30px; color: var(--chalk); }
.card[data-category="produce"] .card__icon { background: var(--leaf); }
.card[data-category="bakery"] .card__icon { background: var(--crate); }
.card[data-category="dairy"] .card__icon { background: var(--sky); }
.card[data-category="pantry"] .card__icon { background: var(--citrus); }
.card[data-category="beverages"] .card__icon { background: var(--tomato); }

.card h3 { font-family: var(--font-display); font-weight: 600; font-size: 19px; }
.card__unit { color: var(--chalk-dim); font-size: 13px; margin-top: 2px; }
.card__row { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.card__price {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  background: var(--board);
  border: 1px dashed var(--board-line);
  padding: 4px 10px;
  border-radius: 8px;
}
.card__add {
  background: transparent;
  border: 1px solid var(--chalk-dim);
  color: var(--chalk);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.card__add:hover { background: var(--chalk); color: var(--board); }

/* ---------- why ---------- */
.why {
  padding-bottom: clamp(64px, 9vw, 110px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.why__block h3 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin-bottom: 8px; }
.why__block p { color: var(--chalk-dim); font-size: 15px; max-width: 32ch; }

/* ---------- cart drawer ---------- */
.cart {
  position: fixed;
  top: 0;
  inset-inline-end: 0;
  height: 100vh;
  width: min(380px, 100vw);
  background: var(--board-light);
  border-inline-start: 1px solid var(--board-line);
  display: flex;
  flex-direction: column;
  transform: translateX(110%);
  transition: transform 0.25s ease;
  z-index: 51;
}
[dir="rtl"] .cart { transform: translateX(-110%); }
.cart.is-open { transform: translateX(0); }
.cart__head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--board-line); }
.cart__head h2 { font-family: var(--font-display); font-weight: 600; font-size: 22px; }
.cart__head button { background: none; border: none; color: var(--chalk); font-size: 16px; cursor: pointer; }
.cart__items { flex: 1; overflow-y: auto; padding: 12px 20px; }
.cart__empty { color: var(--chalk-dim); padding: 20px 0; }
.cart-line { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--board-line); }
.cart-line__icon { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; flex: none; }
.cart-line__icon svg { width: 18px; height: 18px; color: var(--chalk); }
.cart-line__body { flex: 1; }
.cart-line__body strong { display: block; font-size: 14px; }
.cart-line__body span { color: var(--chalk-dim); font-size: 13px; }
.cart-line__remove { background: none; border: none; color: var(--chalk-dim); cursor: pointer; font-size: 13px; text-decoration: underline; }
.cart__footer { padding: 20px; border-top: 1px solid var(--board-line); }
.cart__total { display: flex; justify-content: space-between; font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.cart__checkout { width: 100%; }
.cart__note { margin-top: 12px; font-size: 13px; color: var(--chalk-dim); }

.cart-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.cart-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ---------- footer ---------- */
.footer { padding: 28px var(--gutter) 40px; border-top: 1px solid var(--board-line); }
.footer p { max-width: 60ch; font-size: 14px; color: var(--chalk-dim); }
.footer a { color: var(--citrus); text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav__search { display: none; }
  .why { grid-template-columns: 1fr; }
}
