/* ============================================
   TOKENS
   ============================================ */
:root {
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --ink: #201C1A;
  --muted: #6B6259;
  --primary: #1F4D3C;
  --primary-light: #2E6B54;
  --accent: #C4602C;
  --line: #E7E0D6;
  --danger: #B33A3A;

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;

  --max-w: 1180px;
  --radius: 12px;
  --radius-sm: 8px;

  --s1: 0.5rem;
  --s2: 1rem;
  --s3: 1.5rem;
  --s4: 2.5rem;
  --s5: 4rem;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
}

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

.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--s3); }

.eyebrow {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: var(--s1);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-light); }
.btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { transform: translateY(-2px); }
.btn--ghost { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn--ghost:hover { border-color: var(--primary); }
.btn--small { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn--block { width: 100%; }

/* ============================================
   NAV (rendered via components.js)
   ============================================ */
#site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 247, 242, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.nav__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s2) var(--s3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.nav__logo {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
}
.nav__logo span { color: var(--accent); }

.nav__links {
  display: none;
  gap: var(--s3);
  font-weight: 500;
  font-size: 0.92rem;
}
.nav__links a { color: var(--muted); padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.nav__links a:hover, .nav__links a.is-active { color: var(--ink); border-color: var(--accent); }

.nav__right { display: flex; align-items: center; gap: var(--s2); }

.nav__cart-icon {
  position: relative;
  font-size: 1.2rem;
  line-height: 1;
}
.cart-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  border-radius: 999px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  font-family: var(--font-body);
}

.nav__auth-warning {
  font-size: 0.75rem;
  color: var(--danger);
  border: 1px dashed var(--danger);
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
}

.nav__toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 6px;
}
.nav__toggle span { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform 0.2s ease, opacity 0.2s ease; }
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav__links.is-open {
  display: flex;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  padding: var(--s3);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  gap: var(--s2);
}

/* ============================================
   HERO (home)
   ============================================ */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s5) var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}
.hero__title { font-size: clamp(2rem, 7vw, 3.2rem); margin-bottom: var(--s2); }
.hero__sub { color: var(--muted); max-width: 50ch; margin-bottom: var(--s3); }
.hero__img { border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/10; }
.hero__img img { width: 100%; height: 100%; object-fit: cover; }

.category-strip {
  display: flex;
  gap: var(--s2);
  overflow-x: auto;
  padding: var(--s3) var(--s3) var(--s4);
  scrollbar-width: none;
}
.category-strip::-webkit-scrollbar { display: none; }
.category-chip {
  flex-shrink: 0;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ============================================
   PRODUCT GRID / CARDS
   ============================================ */
.section-head {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s4) var(--s3) var(--s3);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s2);
}
.section-head h2 { font-size: clamp(1.4rem, 4vw, 1.9rem); }

.product-grid {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--s3) var(--s5);
  display: grid;
  gap: var(--s3);
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.product-card:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(32, 28, 26, 0.08); }

.product-card__img { aspect-ratio: 1/1; overflow: hidden; background: var(--bg); }
.product-card__img img { width: 100%; height: 100%; object-fit: cover; }

.product-card__body { padding: var(--s2) var(--s2) var(--s3); display: flex; flex-direction: column; gap: 0.3rem; flex: 1; }
.product-card__cat { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.product-card__name { font-size: 1rem; font-weight: 600; }
.product-card__rating { font-size: 0.8rem; color: var(--accent); }

.product-card__price-row { display: flex; align-items: baseline; gap: 0.5rem; margin-top: 0.3rem; }
.product-card__price { font-weight: 700; font-size: 1.05rem; }
.product-card__old-price { font-size: 0.85rem; color: var(--muted); text-decoration: line-through; }

.product-card__cta { margin-top: auto; padding-top: var(--s2); }

/* ============================================
   PRODUCT DETAIL
   ============================================ */
.product-detail {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s4) var(--s3) var(--s5);
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.product-detail__img { border-radius: var(--radius); overflow: hidden; aspect-ratio: 1/1; background: var(--surface); border: 1px solid var(--line); }
.product-detail__img img { width: 100%; height: 100%; object-fit: cover; }

.product-detail__cat { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.3rem; }
.product-detail__name { font-size: clamp(1.6rem, 5vw, 2.2rem); margin-bottom: var(--s2); }
.product-detail__price-row { display: flex; align-items: baseline; gap: 0.7rem; margin-bottom: var(--s3); }
.product-detail__price { font-size: 1.6rem; font-weight: 700; }
.product-detail__old-price { color: var(--muted); text-decoration: line-through; }
.product-detail__desc { color: var(--muted); margin-bottom: var(--s3); max-width: 60ch; }

.qty-selector {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--s3);
}
.qty-selector button {
  width: 40px; height: 40px;
  background: var(--surface);
  border: none;
  font-size: 1.1rem;
}
.qty-selector button:hover { background: var(--bg); }
.qty-selector span { width: 40px; text-align: center; font-weight: 600; }

.add-confirm {
  margin-top: var(--s2);
  font-size: 0.9rem;
  color: var(--primary);
  font-weight: 600;
  display: none;
}
.add-confirm.is-shown { display: block; }

/* ============================================
   CART PAGE
   ============================================ */
.cart-page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--s4) var(--s3) var(--s5);
}

.cart-layout {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.cart-items { display: flex; flex-direction: column; gap: var(--s2); }

.cart-item {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: var(--s2);
  padding: var(--s2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  align-items: center;
}
.cart-item__img { width: 72px; height: 72px; border-radius: var(--radius-sm); overflow: hidden; }
.cart-item__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item__name { font-weight: 600; margin-bottom: 0.2rem; }
.cart-item__unit { font-size: 0.82rem; color: var(--muted); }
.cart-item__row { display: flex; align-items: center; justify-content: space-between; margin-top: 0.5rem; flex-wrap: wrap; gap: 0.5rem; }
.cart-item__remove { font-size: 0.8rem; color: var(--danger); font-weight: 600; }
.cart-item__total { font-weight: 700; }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s3);
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}
.cart-summary__row { display: flex; justify-content: space-between; font-size: 0.92rem; color: var(--muted); }
.cart-summary__row--total { font-size: 1.1rem; font-weight: 700; color: var(--ink); padding-top: var(--s2); border-top: 1px dashed var(--line); }

.empty-state {
  text-align: center;
  padding: var(--s5) var(--s3);
  color: var(--muted);
}
.empty-state h2 { color: var(--ink); margin-bottom: var(--s2); }

/* ============================================
   CHECKOUT
   ============================================ */
.checkout-page {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--s4) var(--s3) var(--s5);
}

.checkout-gate {
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s5) var(--s3);
}
.checkout-gate h2 { margin-bottom: var(--s2); }
.checkout-gate p { color: var(--muted); margin-bottom: var(--s3); max-width: 40ch; margin-left: auto; margin-right: auto; }

.order-summary {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--s3);
  margin-bottom: var(--s3);
}
.order-summary__item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px dashed var(--line); font-size: 0.9rem; }
.order-summary__item:last-of-type { border-bottom: none; }

.checkout-success {
  text-align: center;
  padding: var(--s5) var(--s3);
}
.checkout-success .icon { font-size: 3rem; margin-bottom: var(--s2); }

/* ============================================
   FOOTER
   ============================================ */
#site-footer {
  text-align: center;
  padding: var(--s3);
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--line);
}
#site-footer p { margin: 0.2rem 0; }

/* ============================================
   BREAKPOINTS — mobile-first
   ============================================ */
@media (min-width: 480px) {
  .product-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }

  .hero { flex-direction: row; align-items: center; padding-top: var(--s5); padding-bottom: var(--s5); }
  .hero__text, .hero__img { flex: 1; }

  .product-grid { grid-template-columns: repeat(3, 1fr); }

  .product-detail { flex-direction: row; align-items: flex-start; }
  .product-detail__img, .product-detail__info { flex: 1; }

  .cart-layout { flex-direction: row; align-items: flex-start; }
  .cart-items { flex: 2; }
  .cart-summary { flex: 1; position: sticky; top: 90px; }

  .cart-item { grid-template-columns: 90px 1fr; }
  .cart-item__img { width: 90px; height: 90px; }
}

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