@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;1,9..144,500&family=Work+Sans:wght@400;500;600;700&display=swap');

:root {
  --bg: #eeece5;
  --surface: #ffffff;
  --surface-2: #f6f4ee;
  --border: #ddd8cb;
  --ink: #221d18;
  --muted: #6f6a5f;
  --accent: #3f5c46;
  --accent-ink: #f3f6f0;
  --accent-soft: #e2e9de;
  --rust: #a8552a;
  --rust-soft: #f3e2d4;
  --shadow: 0 1px 2px rgba(34,29,24,.06), 0 12px 28px -16px rgba(34,29,24,.22);
  --radius: 14px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Work Sans', system-ui, sans-serif;
}
a { color: inherit; }
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; text-wrap: balance; margin: 0; }
p { margin: 0; }

.wrap { max-width: 1100px; margin: 0 auto; padding-inline: 20px; }

/* ---------------------------------------------------------------- header */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding-block: 22px; gap: 16px;
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand .mark { font-family: 'Fraunces', serif; font-weight: 600; font-size: 24px; letter-spacing: -0.01em; }
.brand .tag { font-size: 12.5px; color: var(--muted); }
nav.main-nav { display: flex; align-items: center; gap: 22px; }
nav.main-nav a { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink); }
nav.main-nav a:hover { color: var(--accent); }

.cart-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 9px 16px 9px 14px;
  cursor: pointer; font: inherit; font-weight: 600; font-size: 13.5px; color: var(--ink);
  box-shadow: var(--shadow); text-decoration: none;
}
.cart-btn svg { width: 18px; height: 18px; }
.cart-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--rust); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 19px; height: 19px; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.cart-badge[hidden] { display: none; }

/* ---------------------------------------------------------------- hero */
.hero {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px;
  align-items: end; padding-block: 44px 34px;
}
.hero h1 { font-size: clamp(30px, 4vw, 44px); font-weight: 600; letter-spacing: -0.01em; line-height: 1.08; }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero p { color: var(--muted); font-size: 15px; line-height: 1.6; max-width: 62ch; margin-top: 14px; }
.hero .cta-row { display: flex; gap: 12px; margin-top: 22px; }
.stat-row { display: flex; gap: 28px; }
.stat b { display: block; font-family: 'Fraunces', serif; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- generic */
.btn {
  font: inherit; font-weight: 600; font-size: 13.5px;
  border: none; border-radius: 8px; cursor: pointer;
  padding: 0 18px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none;
}
.btn-add { background: var(--accent); color: var(--accent-ink); }
.btn-add:hover { filter: brightness(1.08); }
.btn-add[disabled] { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }

section.about { padding-block: 40px; border-top: 1px solid var(--border); display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
section.about div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
section.about h3 { font-size: 16px; margin-bottom: 8px; }
section.about p { color: var(--muted); font-size: 13.5px; line-height: 1.6; }

footer.site-footer { padding-block: 30px 50px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
footer.site-footer .contacts { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }

/* ---------------------------------------------------------------- shop grid */
.section-label { display: flex; align-items: baseline; justify-content: space-between; padding-top: 30px; padding-bottom: 16px; }
.section-label h2 { font-size: 20px; font-weight: 600; }
.section-label span { font-size: 13px; color: var(--muted); }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; padding-bottom: 60px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.card .photo { aspect-ratio: 4/3; background: linear-gradient(155deg, var(--surface-2), var(--border)); position: relative; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.card .photo img { width: 100%; height: 100%; object-fit: cover; }
.card .photo svg { width: 34px; height: 34px; opacity: .5; }
.stock-pill { position: absolute; top: 10px; left: 10px; font-size: 11px; font-weight: 700; letter-spacing: .01em; padding: 4px 9px; border-radius: 999px; background: var(--rust-soft); color: var(--rust); }
.card .body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; gap: 6px; }
.card h3 { font-size: 17px; font-weight: 600; }
.card .desc { font-size: 13px; color: var(--muted); }
.card .price { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: auto; padding-top: 8px; }

.add-row { display: flex; gap: 8px; margin-top: 10px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.stepper button { width: 30px; height: 34px; border: none; background: var(--surface-2); color: var(--ink); font-size: 15px; cursor: pointer; font-family: inherit; }
.stepper button:hover { background: var(--accent-soft); }
.stepper span { width: 24px; text-align: center; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.add-row .btn { height: 34px; flex: 1; }

.empty-state { text-align: center; color: var(--muted); padding: 60px 10px; }

/* ---------------------------------------------------------------- cart drawer */
.scrim { position: fixed; inset: 0; background: rgba(20,16,12,.35); opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 10; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 92vw);
  background: var(--surface); box-shadow: -12px 0 32px -12px rgba(0,0,0,.28);
  transform: translateX(100%); transition: transform .3s cubic-bezier(.2,.9,.3,1);
  z-index: 11; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.drawer.open { transform: translateX(0); }
@media (prefers-reduced-motion: reduce) { .drawer, .scrim { transition: none; } }

.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 18px; }
.drawer-close { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; }
.drawer-close svg { width: 20px; height: 20px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 12px 20px; }

.line { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); align-items: center; }
.line .thumb { width: 52px; height: 52px; border-radius: 8px; background: linear-gradient(155deg, var(--surface-2), var(--border)); flex-shrink: 0; overflow: hidden; }
.line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.line .title { font-size: 13.5px; font-weight: 600; }
.line .unit { font-size: 12px; color: var(--muted); margin-top: 2px; }
.line .remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; padding: 0; margin-top: 4px; }
.line-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.line-right .sum { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; }

.empty-cart { padding: 50px 10px; text-align: center; color: var(--muted); }
.empty-cart svg { width: 40px; height: 40px; opacity: .4; margin-bottom: 10px; }

.drawer-foot { border-top: 1px solid var(--border); padding: 16px 20px calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.subtotal-row { display: flex; justify-content: space-between; font-size: 14.5px; }
.subtotal-row b { font-variant-numeric: tabular-nums; font-family: 'Fraunces', serif; font-size: 19px; }

.checkout-fields { display: none; flex-direction: column; gap: 10px; }
.checkout-fields.show { display: flex; }
.checkout-fields label { font-size: 12px; color: var(--muted); font-weight: 600; }
.checkout-fields input, .checkout-fields textarea {
  width: 100%; font: inherit; font-size: 13.5px;
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px;
  background: var(--surface-2); color: var(--ink);
}
.checkout-fields textarea { resize: vertical; min-height: 50px; }

.form-error {
  display: none; font-size: 12.5px; color: var(--rust); background: var(--rust-soft);
  border-radius: 8px; padding: 8px 10px;
}
.form-error.show { display: block; }

.pay-status { display: none; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); padding: 8px 2px; }
.pay-status.show { display: flex; }
.spinner { width: 15px; height: 15px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- order-success */
.result-card {
  max-width: 480px; margin: 60px auto; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 30px; text-align: center;
}
.result-card .icon { width: 52px; height: 52px; margin: 0 auto 16px; color: var(--accent); }
.result-card.is-error .icon { color: var(--rust); }
.result-card h1 { font-size: 22px; margin-bottom: 10px; }
.result-card p { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.result-card .btn { margin-top: 22px; }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; gap: 18px; }
  section.about { grid-template-columns: 1fr; }
  nav.main-nav { display: none; }
}
