/* ---------- Tokens ---------- */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --tint: #f1f4f1;
  --media: #f3f0ea;
  --ink: #1c1c1a;
  --muted: #6c6b66;
  --line: #e7e3db;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --sale: #b3402a;
  --radius: 14px;
  --radius-sm: 10px;
  --gutter: 20px;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 500; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: rgba(251, 250, 248, 0.92);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { font-family: var(--font-display); font-size: 1.375rem; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.cart-btn { position: relative; display: grid; place-items: center; width: 44px; height: 44px; background: none; border: 0; border-radius: 50%; cursor: pointer; }
.cart-btn:hover { background: var(--tint); }
.cart-count {
  position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font-size: 0.6875rem; font-weight: 600; line-height: 1;
}
.cart-count[hidden] { display: none; }

/* ---------- Demo banner ---------- */
.demo-banner { padding: 8px var(--gutter); background: var(--ink); color: #fff; text-align: center; font-size: 0.8125rem; line-height: 1.4; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 28px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 500; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); color: #fff; }
.btn--primary:hover { background: #000; }
.btn--ghost { background: transparent; border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; }
.btn--grow { flex: 1; }
.btn:disabled { background: #d9d6cf; color: #8b8983; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero-inner { padding-top: 72px; padding-bottom: 8px; text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; font-weight: 600; color: var(--accent); margin-bottom: 14px; }
.hero h1 { font-size: clamp(1.75rem, 4.5vw, 2.75rem); max-width: 640px; margin: 0 auto 14px; text-wrap: balance; }
.hero-text { max-width: 480px; margin: 0 auto 24px; color: var(--muted); }
.hero-text:last-child { margin-bottom: 0; }

/* ---------- Product grid ---------- */
.section { padding: 48px 0 96px; }
/* Flex (not grid) so an incomplete last row is centred, which suits a 5-product catalogue. */
.grid { --cols: 1; --gap-x: 24px; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 32px var(--gap-x); }
.grid > li { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap-x)) / var(--cols)); min-width: 0; }
@media (min-width: 600px) { .grid { --cols: 2; } }
@media (min-width: 960px) { .grid { --cols: 3; --gap-x: 28px; row-gap: 44px; } }

.card { display: block; text-decoration: none; }
.card-media { position: relative; aspect-ratio: 1 / 1; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.card:hover .card-media img { transform: scale(1.035); }
.card-body { padding-top: 14px; text-align: center; }
.card-title { font-family: var(--font-body); font-size: 1.0625rem; font-weight: 500; letter-spacing: 0; line-height: 1.35; margin-bottom: 4px; }
.card-price { margin: 0; color: var(--muted); }
.badge {
  position: absolute; top: 12px; left: 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--surface); color: var(--ink); font-size: 0.75rem; font-weight: 600;
}
.badge--sale { background: var(--sale); color: #fff; }
.price--sale { color: var(--sale); }
.price-was { color: var(--muted); font-size: 0.9em; }

/* ---------- Product page ---------- */
.section--product { padding-top: 28px; }
.back-link { display: inline-block; margin-bottom: 24px; color: var(--muted); text-decoration: none; font-size: 0.9375rem; }
.back-link:hover { color: var(--ink); }
.pdp { display: grid; gap: 32px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.pdp > * { min-width: 0; }
@media (min-width: 900px) { .pdp { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 64px; } .pdp-info { position: sticky; top: 96px; } }

.gallery-main { aspect-ratio: 1 / 1; border-radius: var(--radius); overflow: hidden; background: var(--media); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumbs button {
  flex: 0 0 72px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm);
  overflow: hidden; background: var(--media); cursor: pointer; opacity: 0.75;
}
.gallery-thumbs button.is-active { border-color: var(--ink); opacity: 1; }
.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }

.pdp-title { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 10px; }
.pdp-price { font-size: 1.375rem; margin-bottom: 24px; }

.option { border: 0; margin: 0 0 20px; padding: 0; }
.option legend { padding: 0; margin-bottom: 10px; font-size: 0.9375rem; font-weight: 500; }
.option-values { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  min-height: 42px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer; font-size: 0.9375rem;
}
.pill:hover { border-color: var(--ink); }
.pill.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill.is-unavailable:not(.is-active) { color: #a9a69f; text-decoration: line-through; }

.pdp-buy { display: flex; gap: 12px; margin-bottom: 12px; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.qty button { width: 44px; height: 48px; border: 0; background: none; cursor: pointer; font-size: 1.25rem; border-radius: 999px; }
.qty button:hover { background: var(--tint); }
.qty span { min-width: 28px; text-align: center; font-weight: 500; }
.qty--sm button { width: 34px; height: 34px; font-size: 1.0625rem; }
.pdp-note { margin-bottom: 0; }
.form-error { color: var(--sale); font-size: 0.9rem; margin: 8px 0; }
.form-error[hidden] { display: none; }
.form-note { margin: 8px 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--tint); color: var(--ink); font-size: 0.875rem; }

.pdp-desc { margin-top: 32px; padding-top: 28px; border-top: 1px solid var(--line); }
.prose { color: #3a3a37; }
.prose h2, .prose h3, .prose h4 { font-family: var(--font-body); font-weight: 600; font-size: 1.0625rem; margin: 1.4em 0 0.5em; letter-spacing: 0; }
.prose > :first-child { margin-top: 0; }
.prose ul, .prose ol { padding-left: 1.25em; margin: 0 0 1em; }
.prose li { margin-bottom: 0.35em; }
.prose li > p { margin: 0; }
.prose img { border-radius: var(--radius-sm); margin: 1em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; margin-bottom: 1em; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose a { color: var(--accent); }

/* ---------- Cart drawer ---------- */
.drawer { position: fixed; inset: 0; z-index: 50; }
.drawer[hidden] { display: none; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(20, 20, 18, 0.4); opacity: 0; transition: opacity 0.2s; }
.drawer-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  display: flex; flex-direction: column; background: var(--bg);
  transform: translateX(100%); transition: transform 0.25s ease; box-shadow: -8px 0 32px rgba(0, 0, 0, 0.08);
}
.drawer.is-open .drawer-overlay { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }
.drawer.is-busy .drawer-body { opacity: 0.6; pointer-events: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.25rem; }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; font-size: 1.75rem; line-height: 1; cursor: pointer; }
.icon-btn:hover { background: var(--tint); }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 20px; }
.drawer-empty { text-align: center; color: var(--muted); padding: 48px 0; }
.drawer-foot { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.subtotal { display: flex; justify-content: space-between; font-size: 1.0625rem; margin-bottom: 4px; }

.cart-lines { list-style: none; margin: 0; padding: 0; }
.cart-line { display: grid; grid-template-columns: 80px 1fr auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.cart-line:last-child { border-bottom: 0; }
.cart-line-img { width: 80px; height: 80px; border-radius: var(--radius-sm); overflow: hidden; background: var(--media); }
.cart-line-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-title { display: block; font-weight: 500; text-decoration: none; line-height: 1.3; margin-bottom: 2px; }
.cart-line-info p { margin: 0 0 8px; }
.cart-line-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; font-size: 0.9375rem; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 28px 0 36px; color: var(--muted); font-size: 0.875rem; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 12px 28px; justify-content: space-between; align-items: center; }
.footer-inner p { margin: 0; }
.footer-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.footer-legal { font-size: 0.75rem; color: var(--muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Contact ---------- */
.contact { max-width: 560px; }
.contact h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); margin-bottom: 14px; }
.contact p { color: var(--muted); }
.contact-email { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 8px; }
.contact-address { font-size: 1.125rem; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }

/* ---------- States ---------- */
.notice { max-width: 520px; margin: 48px auto; text-align: center; }
.notice h2 { font-size: 1.5rem; margin-bottom: 10px; }
.skeleton { aspect-ratio: 1 / 1; border-radius: var(--radius); background: linear-gradient(100deg, #efece5 30%, #f7f5f0 50%, #efece5 70%); background-size: 300% 100%; animation: shimmer 1.4s infinite linear; list-style: none; }
.skeleton--line { aspect-ratio: auto; height: 28px; margin-bottom: 14px; }
.skeleton--line.short { width: 40%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 599px) {
  :root { --gutter: 16px; }
  .hero-inner { padding-top: 44px; padding-bottom: 0; }
  .section { padding: 36px 0 64px; }
  .footer-right { align-items: flex-start; }
}
