/* ─────────────────────────────────────────────────────────────────
   Aesthetic: refined boutique (NYT Cooking × Aesop product page).
   Cream paper bg, deep ink, single sage-green accent. Source Serif 4
   for product names + display, DM Sans for body/UI, JetBrains Mono
   for prices and category tags. Strong typographic contrast,
   generous whitespace, hairline rules.
   ───────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700&family=Source+Serif+4:ital,opsz,wght@0,8..60,300..700;1,8..60,300..600&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --font-serif: 'Source Serif 4', 'Iowan Old Style', Georgia, serif;
  --font-ui:    'DM Sans', system-ui, sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --cream:       #f8f4ec;
  --cream-soft:  #f1ece0;
  --paper:       #ffffff;
  --ink:         #1c1d1a;
  --ink-soft:    #4b4d4a;
  --ink-mute:    #82847f;
  --ink-faint:   #b6b8b2;
  --rule:        #e6e0d2;
  --rule-strong: #c8c2b4;

  --sage:        #5e7c4f;
  --sage-deep:   #46603a;
  --sage-soft:   #e8efe0;

  --ember:       #b1462d;
  --error:       #a11d1d;
  --error-soft:  #f6e3e0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01';
}

.store { min-height: 100vh; display: flex; flex-direction: column; }

/* ── Top bar ─────────────────────────────────────────────────────── */

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 20px 32px;
  background: var(--cream);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 10;
}
.topbar .logo {
  background: none; border: none;
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 24px;
  color: var(--ink);
  cursor: pointer;
  letter-spacing: -0.01em;
  display: flex; align-items: baseline; gap: 8px;
  padding: 0;
  font-variation-settings: 'opsz' 32;
}
.topbar .logo::before {
  content: '·';
  color: var(--sage);
  font-size: 22px;
  line-height: 1;
}

.topbar .search {
  flex: 1; max-width: 480px;
  padding: 9px 14px;
  font-family: var(--font-ui);
  font-size: 13px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 999px;
  transition: border-color 0.15s ease;
}
.topbar .search::placeholder { color: var(--ink-mute); }
.topbar .search:focus { outline: none; border-color: var(--sage); }

.topbar .cart-btn {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  transition: all 0.12s ease;
}
.topbar .cart-btn:hover { background: var(--cream-soft); border-color: var(--rule-strong); }
.cart-count {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  background: var(--ink);
  color: var(--cream);
  padding: 2px 8px;
  border-radius: 999px;
  min-width: 22px; text-align: center;
}

main { flex: 1; max-width: 1200px; width: 100%; margin: 0 auto; padding: 32px 32px 80px; }

/* ── Browse view ─────────────────────────────────────────────────── */

.layout-aside { display: grid; grid-template-columns: 200px 1fr; gap: 40px; }
@media (max-width: 720px) { .layout-aside { grid-template-columns: 1fr; } }

.sidebar {
  padding-top: 4px;
  position: sticky; top: 100px; height: fit-content;
}
.sidebar h3 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 12px;
}
.cat-list { list-style: none; padding: 0; margin: 0; }
.cat-list li { margin: 0; }
.cat-list button {
  display: flex; justify-content: space-between; align-items: baseline;
  width: 100%;
  background: none; border: none; cursor: pointer;
  padding: 8px 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 16px;
  color: var(--ink-soft);
  text-align: left;
  border-bottom: 1px solid var(--rule);
  transition: color 0.12s ease;
  font-variation-settings: 'opsz' 20;
}
.cat-list button:hover { color: var(--ink); }
.cat-list button.active {
  color: var(--ink);
  font-style: italic;
  font-weight: 500;
}
.cat-list button.active::before {
  content: '→ ';
  color: var(--sage);
  font-style: normal;
  font-weight: 600;
}

/* Product grid */

.grid > h2 {
  margin: 0 0 28px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-variation-settings: 'opsz' 36;
}
.empty { color: var(--ink-mute); font-size: 14px; }

.cards {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px;
}
.card {
  display: flex; flex-direction: column;
  background: transparent;
}
.card-image {
  background: var(--paper);
  border: 1px solid var(--rule);
  padding: 56px 24px;
  cursor: pointer;
  font-size: 96px;
  line-height: 1;
  text-align: center;
  border-radius: 4px;
  transition: all 0.2s ease;
}
.card-image:hover {
  background: var(--cream-soft);
  border-color: var(--rule-strong);
}
.card-body { padding: 18px 4px 0; display: flex; flex-direction: column; gap: 4px; }
.card-title {
  background: none; border: none; padding: 0; cursor: pointer;
  text-align: left;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.005em;
  color: var(--ink);
  line-height: 1.25;
  font-variation-settings: 'opsz' 24;
  margin-bottom: 2px;
}
.card-title:hover { font-style: italic; }
.brand {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}
.rating { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-mute); margin: 4px 0; }
.stars { color: var(--ember); letter-spacing: -1px; font-size: 11px; }
.rating-num { font-weight: 600; color: var(--ink); font-family: var(--font-mono); }
.reviews { font-family: var(--font-mono); }
.price {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-top: 6px;
}
.badge-prime {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--sage);
  margin-top: 4px;
}
.badge-prime::before { content: '◉'; margin-right: 4px; color: var(--sage); }
.badge-prime.sm { margin: 0; font-size: 9px; }
.add-btn {
  margin-top: 12px;
  padding: 9px 14px;
  background: var(--paper);
  border: 1px solid var(--ink);
  color: var(--ink);
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  text-transform: uppercase;
  transition: all 0.15s ease;
}
.add-btn:hover { background: var(--ink); color: var(--cream); }

/* ── Product detail ──────────────────────────────────────────────── */

.product-detail { padding: 0; background: transparent; border: none; }
.link-back {
  background: none; border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer;
  padding: 0 0 20px;
}
.link-back:hover { color: var(--sage); }
.product-row { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
@media (max-width: 720px) { .product-row { grid-template-columns: 1fr; gap: 24px; } }
.product-image {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 88px 24px;
  text-align: center;
  font-size: 160px;
  line-height: 1;
}
.product-info h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 36px;
  letter-spacing: -0.02em;
  margin: 6px 0 16px;
  line-height: 1.1;
  color: var(--ink);
  font-variation-settings: 'opsz' 48;
}
.price-big {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 28px;
  color: var(--ink);
  margin: 20px 0 6px;
  letter-spacing: -0.02em;
}
.desc {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.6;
  margin: 16px 0 0;
}
.qty-row {
  display: flex; align-items: end; gap: 12px;
  margin-top: 28px;
}
.qty-row label {
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.qty-row select {
  padding: 9px 12px;
  font-family: var(--font-mono);
  font-size: 14px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
}
.qty-row select:focus { outline: 2px solid var(--sage); }

/* ── Cart ────────────────────────────────────────────────────────── */

.cart { background: transparent; border: none; padding: 0; }
.cart.empty { text-align: center; padding: 80px 24px; }
.cart h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 36px;
  letter-spacing: -0.02em;
  margin: 0 0 28px;
  color: var(--ink);
  font-variation-settings: 'opsz' 48;
}

.cart-lines { list-style: none; padding: 0; margin: 0 0 20px; }
.cart-line {
  display: grid; grid-template-columns: 80px 1fr auto; gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--rule);
  align-items: center;
}
.cart-line:last-child { border-bottom: 1px solid var(--ink); }
.line-image { font-size: 56px; text-align: center; }
.line-info h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 18px;
  letter-spacing: -0.005em;
  margin: 0 0 4px;
}
.line-actions { display: flex; align-items: center; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--ink-mute); }
.line-actions label { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; }
.line-actions select {
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: 0;
}
.line-price {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 17px;
  color: var(--ink);
}
.link-danger {
  background: none; border: none;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
  cursor: pointer; padding: 0;
}
.link-danger:hover { color: var(--error); }

.totals {
  background: var(--cream-soft);
  border-radius: 4px;
  padding: 20px 24px;
  margin: 20px 0;
  display: flex; flex-direction: column; gap: 6px;
}
.totals div { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-soft); margin: 0; }
.totals dt, .totals dd { margin: 0; font-family: var(--font-ui); }
.totals dd { font-family: var(--font-mono); font-weight: 500; color: var(--ink); }
.totals .grand {
  padding-top: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--rule-strong);
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 400;
  color: var(--ink);
}
.totals .grand dd { font-family: var(--font-mono); font-weight: 600; font-size: 18px; }
.totals .free { color: var(--sage); font-family: var(--font-mono); font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }

.cart-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; }
.cart-actions button {
  padding: 10px 22px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border-radius: 0;
  cursor: pointer;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ink);
}
.cart-actions button:hover { background: var(--cream-soft); }
.cart-actions button.primary {
  background: var(--sage);
  color: var(--paper);
  border-color: var(--sage);
}
.cart-actions button.primary:hover { background: var(--sage-deep); border-color: var(--sage-deep); }

/* ── Checkout ────────────────────────────────────────────────────── */

.checkout { padding: 0; background: none; }
.checkout h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 36px;
  margin: 0 0 24px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.checkout-grid { display: grid; grid-template-columns: 1fr 340px; gap: 40px; }
@media (max-width: 900px) { .checkout-grid { grid-template-columns: 1fr; } }
.checkout-main { display: flex; flex-direction: column; gap: 32px; background: transparent; border: none; padding: 0; }
.checkout-main section {
  background: transparent;
  border: none;
  border-top: 1px solid var(--rule);
  padding: 24px 0 0;
  margin: 0;
}
.checkout-main section:first-of-type { border-top: none; padding-top: 0; }
.checkout-main section h2 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 16px;
  padding: 0;
  border: none;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.checkout label {
  display: flex; flex-direction: column; gap: 6px;
  margin-bottom: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.checkout label input {
  font-family: var(--font-ui);
  font-size: 14px;
  padding: 9px 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--rule-strong);
  color: var(--ink);
  border-radius: 0;
}
.checkout label input:focus { outline: none; border-bottom: 1px solid var(--sage); }

.method-radios { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.method-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  cursor: pointer;
  margin: 0;
}
.method-card.selected {
  background: var(--sage-soft);
  border-color: var(--sage);
}
.method-card input { margin-top: 2px; accent-color: var(--sage); }
.method-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 15px;
  color: var(--ink);
}
.method-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.05em;
  color: var(--ink-mute);
  text-transform: uppercase;
}
.reveal {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 14px;
  background: none;
  border: none;
  padding: 0;
}
.muted { font-size: 12px; color: var(--ink-mute); margin-top: 4px; line-height: 1.5; }
.form-error {
  color: var(--error);
  font-size: 12px;
  padding: 10px 14px;
  background: var(--error-soft);
  border-left: 3px solid var(--error);
  margin-top: 12px;
}

.checkout-summary {
  background: var(--cream-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 24px 24px 28px;
  height: fit-content;
  position: sticky;
  top: 96px;
}
.checkout-summary h2 {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 16px;
  padding: 0;
  border: none;
}
.summary-lines { list-style: none; padding: 0; margin: 0 0 16px; font-size: 13px; }
.summary-lines li { display: flex; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--rule); }
.summary-lines .qty { font-family: var(--font-mono); font-size: 11px; color: var(--ink-mute); min-width: 28px; }
.summary-lines .name { flex: 1; font-family: var(--font-serif); }
.summary-lines .lp { font-family: var(--font-mono); font-weight: 500; }
.checkout-summary button.primary {
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  background: var(--sage);
  color: var(--paper);
  border: 1px solid var(--sage);
  border-radius: 0;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.15s ease;
}
.checkout-summary button.primary:hover:not(:disabled) { background: var(--sage-deep); border-color: var(--sage-deep); }
.checkout-summary button.primary:disabled { background: var(--ink-faint); border-color: var(--ink-faint); cursor: not-allowed; }

/* ── Paying screen ───────────────────────────────────────────────── */

.paying {
  background: var(--cream-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 64px 32px;
  text-align: center;
}
.paying h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 28px;
  color: var(--sage);
  margin: 0 0 8px;
}
.paying p { color: var(--ink-mute); font-size: 14px; max-width: 40ch; margin: 0 auto; }
.paying button {
  margin-top: 24px;
  padding: 9px 18px;
  border: 1px solid var(--ink);
  background: transparent;
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink);
}
.paying button:hover { background: var(--ink); color: var(--cream); }

/* ── Success ─────────────────────────────────────────────────────── */

.success {
  background: transparent;
  border: none;
  padding: 80px 32px;
  text-align: center;
}
.success h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-style: italic;
  font-size: 42px;
  letter-spacing: -0.02em;
  color: var(--sage-deep);
  margin: 0 0 12px;
}
.success p { color: var(--ink-soft); margin: 6px 0; font-size: 15px; }
.success code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--cream-soft);
  padding: 3px 8px;
  border-radius: 0;
  color: var(--ink);
}
.success button.primary {
  margin-top: 32px;
  padding: 12px 28px;
  background: var(--sage);
  color: var(--paper);
  border: 1px solid var(--sage);
  border-radius: 0;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}
.success button.primary:hover { background: var(--sage-deep); border-color: var(--sage-deep); }
