/* Reset and layout primitives used on every storefront page.
   Color/type/radius/shadow values come from /css/tokens.css (loaded
   first on every page) — this block just maps them onto the names
   this file's rules already use. */

:root {
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-surface-alt: var(--surface-alt);
  --color-ink: var(--ink-900);
  --color-ink-soft: var(--ink-700);
  --color-brand: var(--brand-shop);
  --color-brand-dark: var(--brand-shop-dark);
  --color-line: var(--line);
  --color-success: var(--status-success);
  --color-warn: var(--status-warn);
  --color-danger: var(--status-danger);
  --radius: var(--radius-md);
  --radius-sm: var(--radius-sm);
  --shadow: var(--shadow-md);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  margin: 0 0 0.5em;
  color: var(--color-ink);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(250, 246, 242, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-line);
  height: var(--header-h);
  transition: box-shadow 0.2s ease, background-color 0.2s ease;
}
.site-header.is-scrolled {
  background: rgba(250, 246, 242, 0.98);
  box-shadow: var(--shadow-sm);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--color-brand-dark);
}
.brand-logo { display: none; height: 40px; width: auto; max-width: 160px; object-fit: contain; }

.main-nav {
  display: flex;
  gap: 6px;
  font-size: 0.95rem;
}
.main-nav a {
  position: relative;
  padding: 9px 6px;
  color: var(--color-ink-soft);
  font-weight: 500;
  transition: color 0.15s ease;
}
.main-nav a:hover { color: var(--color-brand-dark); }
.main-nav a.is-active { color: var(--color-brand-dark); font-weight: 600; }
.main-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-brand);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.cart-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  color: var(--color-ink);
  transition: background-color 0.15s ease;
}
.cart-link:hover { background: var(--color-surface-alt); }
.cart-link svg { width: 21px; height: 21px; }

.cart-count {
  position: absolute;
  top: 2px;
  right: 2px;
  background: var(--color-brand);
  color: #fff;
  border: 2px solid var(--color-bg);
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* ---------- Mobile nav toggle ---------- */
.nav-toggle {
  display: none;
  width: 42px;
  height: 42px;
  border: none;
  background: none;
  border-radius: var(--radius-pill);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.nav-toggle:hover { background: var(--color-surface-alt); }
.nav-toggle span {
  display: block;
  width: 19px;
  height: 2px;
  border-radius: 2px;
  background: var(--color-ink);
  transition: transform 0.2s ease, opacity 0.15s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.mobile-nav {
  display: none;
  flex-direction: column;
  padding: 4px 24px 12px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
}
.mobile-nav.is-open { display: flex; }
.mobile-nav a {
  padding: 13px 2px;
  border-bottom: 1px solid var(--color-line);
  font-size: 0.98rem;
  color: var(--color-ink);
}
.mobile-nav a:last-child { border-bottom: none; }
.mobile-nav a.is-active { color: var(--color-brand-dark); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.12s ease, opacity 0.12s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--color-brand);
  color: #fff;
}
.btn-primary:hover { background: var(--color-brand-dark); }

.btn-outline {
  background: transparent;
  border-color: var(--color-brand);
  color: var(--color-brand-dark);
}
.btn-outline:hover { background: rgba(169, 116, 79, 0.08); }

.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Cards / grid ---------- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 28px;
}

.product-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.product-card__image {
  aspect-ratio: 1 / 1;
  background: var(--color-surface-alt);
  overflow: hidden;
}
.product-card__image img { width: 100%; height: 100%; object-fit: cover; }

.product-card__body {
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-card__name { font-size: 1.05rem; }
.product-card__price { color: var(--color-brand-dark); font-weight: 600; }
.product-card__category { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-ink-soft); }

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.field label { font-size: 0.85rem; font-weight: 600; color: var(--color-ink-soft); }
.field input, .field textarea, .field select {
  padding: 11px 14px;
  border: 1px solid var(--color-line);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--color-surface);
  color: var(--color-ink);
  font-family: inherit;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--color-brand);
}
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

/* ---------- Quantity stepper ---------- */
.qty-stepper {
  display: inline-flex; align-items: stretch; border: 1px solid var(--color-line);
  border-radius: var(--radius-pill); overflow: hidden; height: 36px; width: fit-content;
}
.qty-stepper button {
  width: 34px; background: var(--color-bg); border: none; color: var(--color-ink);
  font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.qty-stepper button:hover { background: var(--color-surface-alt); }
.qty-stepper button[disabled] { opacity: 0.5; cursor: not-allowed; }
.qty-stepper input {
  width: 40px; border: none; border-left: 1px solid var(--color-line); border-right: 1px solid var(--color-line);
  text-align: center; font-size: 0.9rem; font-family: inherit; color: var(--color-ink);
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Status badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: capitalize;
}
.badge-pending_payment { background: var(--status-warn-soft); color: var(--status-warn); }
.badge-payment_submitted { background: var(--status-info-soft); color: var(--status-info); }
.badge-paid { background: var(--status-success-soft); color: var(--status-success); }
.badge-processing { background: var(--status-info-soft); color: var(--status-info); }
.badge-shipped { background: var(--status-teal-soft); color: var(--status-teal); }
.badge-delivered { background: var(--status-success-soft); color: var(--status-success); }
.badge-cancelled { background: var(--status-danger-soft); color: var(--color-danger); }
.badge-refunded { background: var(--status-purple-soft); color: var(--status-purple); }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 90px;
  background: var(--color-ink);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.88rem;
}
.site-footer a { color: rgba(255, 255, 255, 0.78); }
.site-footer a:hover { color: #fff; }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-top: 56px;
  padding-bottom: 40px;
}
.footer-brand .brand { color: #fff; }
.footer-brand p {
  margin: 14px 0 0; font-size: 0.88rem; line-height: 1.7;
  color: rgba(255, 255, 255, 0.55); max-width: 320px;
}

.footer-col h4 {
  font-family: var(--font-body); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: rgba(255, 255, 255, 0.45); margin: 0 0 16px;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.footer-col li { font-size: 0.9rem; display: flex; align-items: center; gap: 10px; }
.footer-icon { width: 15px; height: 15px; flex: none; color: rgba(255, 255, 255, 0.4); }
.footer-col [data-business-address] { white-space: pre-line; }

.footer-bottom-wrap { border-top: 1px solid rgba(255, 255, 255, 0.12); }
.footer-bottom {
  padding-top: 20px; padding-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 0.82rem; color: rgba(255, 255, 255, 0.45);
}
.footer-bottom a { color: rgba(255, 255, 255, 0.6); }

@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; padding-bottom: 32px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-ink-soft);
}

.section {
  padding: 56px 0;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.helper-text { font-size: 0.85rem; color: var(--color-ink-soft); }
.error-text { color: var(--color-danger); font-size: 0.88rem; margin-top: 6px; }

/* ---------- Mini-cart drawer ---------- */
.cart-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(20, 16, 13, 0.45);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease; z-index: 90;
}
.cart-drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 100%; max-width: 420px;
  background: var(--color-surface); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.28s ease; z-index: 91;
}
.cart-drawer.is-open { transform: translateX(0); }

.cart-drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--color-line); flex-shrink: 0;
}
.cart-drawer__header h2 { margin: 0; font-size: 1.2rem; }
.cart-drawer__close {
  background: none; border: none; color: var(--color-ink-soft); cursor: pointer;
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cart-drawer__close:hover { background: var(--color-surface-alt); color: var(--color-ink); }

.cart-drawer__body { flex: 1; overflow-y: auto; padding: 8px 24px; }
.cart-drawer__empty { text-align: center; padding: 60px 0; color: var(--color-ink-soft); }
.cart-drawer__empty p { margin-bottom: 16px; }

.cart-drawer__item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--color-line); }
.cart-drawer__item:last-child { border-bottom: none; }
.cart-drawer__item img {
  width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover;
  background: var(--color-surface-alt); flex-shrink: 0;
}
.cart-drawer__item-info { flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cart-drawer__item-name { font-weight: 600; font-size: 0.92rem; }
.cart-drawer__item-color { font-size: 0.78rem; color: var(--color-ink-soft); }
.cart-drawer__item-price { font-size: 0.82rem; color: var(--color-ink-soft); }
.cart-drawer__qty { display: inline-flex; align-items: center; gap: 10px; margin-top: 2px; }
.cart-drawer__qty span { min-width: 14px; text-align: center; font-size: 0.9rem; }
.cart-drawer__qty button {
  width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--color-line);
  background: var(--color-bg); color: var(--color-ink); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 0.9rem; line-height: 1;
}
.cart-drawer__qty button:hover { background: var(--color-surface-alt); }
.cart-drawer__remove {
  background: none; border: none; color: var(--color-ink-soft); cursor: pointer; align-self: flex-start;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 50%;
}
.cart-drawer__remove:hover { background: var(--color-surface-alt); color: var(--color-danger); }

.cart-drawer__footer { padding: 20px 24px 24px; border-top: 1px solid var(--color-line); flex-shrink: 0; }
.cart-drawer__subtotal { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 16px; }
.cart-drawer__view-link { display: block; text-align: center; margin-top: 12px; font-size: 0.88rem; color: var(--color-ink-soft); }
.cart-drawer__view-link:hover { color: var(--color-brand-dark); }

body.cart-drawer-open { overflow: hidden; }

@media (max-width: 480px) {
  .cart-drawer { max-width: 100%; }
}

@media (max-width: 720px) {
  .main-nav { display: none; }
  .nav-toggle { display: inline-flex; }
  .field-row { flex-direction: column; }
  .section-heading { flex-direction: column; align-items: stretch; gap: 14px; }
}

@media (max-width: 480px) {
  .site-header .container { gap: 10px; }
  .brand { font-size: 1.2rem; gap: 8px; }
}
