:root {
  --bg: #faf8f5;
  --bg-muted: #f0ebe3;
  --surface: #ffffff;
  --text: #1c1917;
  --text-muted: #57534e;
  --primary: #b45309;
  --primary-hover: #92400e;
  --border: #e7e5e4;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(28, 25, 23, 0.08), 0 4px 12px rgba(28, 25, 23, 0.04);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --max: 1200px;
  --narrow: 720px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

.container { width: min(100% - 2rem, var(--max)); margin-inline: auto; }
.container--narrow { width: min(100% - 2rem, var(--narrow)); margin-inline: auto; }

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.75rem 0;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.125rem;
  color: var(--text);
  text-decoration: none;
}

.nav { display: flex; gap: 1.25rem; flex: 1; }
.nav a { color: var(--text-muted); font-weight: 500; text-decoration: none; }
.nav a:hover { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }

.search-form {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg);
}

.search-form input {
  border: none;
  background: transparent;
  padding: 0.4rem 0.75rem;
  font: inherit;
  width: 160px;
}

.search-form button {
  border: none;
  background: transparent;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  color: var(--text-muted);
}

.cart-link {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.cart-link__count {
  background: var(--primary);
  color: #fff;
  font-size: 0.75rem;
  min-width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-hover); text-decoration: none; color: #fff; }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--bg-muted); text-decoration: none; }
.btn--disabled { background: var(--border); color: var(--text-muted); cursor: not-allowed; }
.btn--sm { padding: 0.375rem 0.75rem; font-size: 0.875rem; }
.btn--lg { padding: 0.875rem 1.5rem; font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn.is-active-bookmark { color: #e11d48; border-color: #fecdd3; background: #fff1f2; }

/* Hero */
.hero {
  background: linear-gradient(135deg, #fef3c7 0%, #faf8f5 50%, #fce7f3 100%);
  padding: 3rem 0;
}

.hero__inner { display: grid; gap: 2rem; }
.hero__eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.8125rem; color: var(--primary); font-weight: 700; margin: 0 0 0.5rem; }
.hero h1 { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.1; margin: 0 0 1rem; }
.hero__lead { font-size: 1.125rem; color: var(--text-muted); max-width: 36rem; margin: 0 0 1.5rem; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero__stats { display: flex; gap: 2rem; }
.stat { display: flex; flex-direction: column; }
.stat strong { font-size: 2rem; line-height: 1; }
.stat span { color: var(--text-muted); font-size: 0.875rem; }

/* Sections */
.page { padding: 2rem 0 3rem; min-height: 50vh; }
.section { padding: 2.5rem 0; }
.section--muted { background: var(--bg-muted); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1.5rem; gap: 1rem; }
.section__head h2 { margin: 0; font-size: 1.5rem; }

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: 0 0 0.25rem; font-size: 2rem; }
.page-head p { margin: 0; color: var(--text-muted); }

/* Grids */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.info-card h3 { margin: 0 0 0.5rem; font-size: 1rem; }
.info-card p { margin: 0; color: var(--text-muted); font-size: 0.9375rem; }

/* Product card */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.product-card__image-link { display: block; aspect-ratio: 1; background: var(--bg-muted); }
.product-card__image { width: 100%; height: 100%; object-fit: cover; }
.product-card__placeholder {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--bg-muted);
}

.product-card__body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: 0.5rem; }
.product-card__shop { font-size: 0.8125rem; color: var(--text-muted); text-decoration: none; }
.product-card__title { margin: 0; font-size: 1rem; line-height: 1.3; }
.product-card__title a { color: var(--text); text-decoration: none; }
.product-card__title a:hover { color: var(--primary); }
.product-card__meta { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.product-card__price { font-weight: 700; font-size: 1.0625rem; }
.product-card__actions { display: flex; gap: 0.5rem; margin-top: auto; }

/* Shop card */
.shop-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.shop-card__link {
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.shop-card__avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  text-transform: uppercase;
  overflow: hidden;
  flex-shrink: 0;
}

.shop-card__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}

.shop-card__title { margin: 0 0 0.5rem; font-size: 1.125rem; }
.shop-card__desc { margin: 0; color: var(--text-muted); font-size: 0.9375rem; }

/* Badges */
.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}

.badge--stock { background: #dcfce7; color: #166534; }
.badge--order { background: #fef3c7; color: #92400e; }
.badge--out { background: #f5f5f4; color: #78716c; }

/* Breadcrumbs */
.breadcrumbs { margin-bottom: 1rem; font-size: 0.875rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 0.25rem; list-style: none; padding: 0; margin: 0; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: 0.25rem; color: var(--text-muted); }
.breadcrumbs a { color: var(--text-muted); }

/* Catalog */
.catalog-layout { display: grid; grid-template-columns: 220px 1fr; gap: 2rem; align-items: start; }
.catalog-layout > .catalog-main:only-child { grid-column: 1 / -1; }
.catalog-sidebar { position: sticky; top: 5rem; }
.catalog-sidebar fieldset + fieldset,
.catalog-sidebar fieldset + .shop-submenu,
.catalog-sidebar .shop-submenu + fieldset { margin-top: 1.25rem; }
.shop-sidebar-block { border: none; padding: 0; margin: 0; min-width: 0; }
.shop-sidebar-block__title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--text);
}
.shop-sidebar-block legend { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.875rem; }
.filter-list--nested { margin: 0.2rem 0 0.35rem 0.85rem; }
.filter-list--nested a { font-size: 0.875rem; }
.shop-submenu { border: none; margin: 0; }
.shop-submenu__summary {
  font-weight: 700;
  font-size: 0.875rem;
  cursor: pointer;
  list-style: none;
  color: var(--text);
}
.shop-submenu__summary::-webkit-details-marker { display: none; }
.shop-submenu__summary::before {
  content: "▸";
  display: inline-block;
  margin-right: 0.35rem;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}
.shop-submenu[open] > .shop-submenu__summary::before { transform: rotate(90deg); }
.shop-submenu__body { margin-top: 0.75rem; }
.shop-submenu__group + .shop-submenu__group { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.shop-submenu__shop-name {
  margin: 0 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
}
.filter-form fieldset { border: none; padding: 0; margin: 0 0 1.5rem; }
.filter-form legend { font-weight: 700; margin-bottom: 0.5rem; font-size: 0.875rem; }
.filter-list { list-style: none; padding: 0; margin: 0; }
.filter-list a { display: flex; justify-content: space-between; padding: 0.35rem 0; color: var(--text-muted); text-decoration: none; font-size: 0.9375rem; }
.catalog-sidebar .filter-list a::first-letter { text-transform: uppercase; }
.filter-list a.is-active, .filter-list a:hover { color: var(--primary); font-weight: 600; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; cursor: pointer; }

.chip-nav { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.5rem; }
.chip {
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}
.chip::first-letter { text-transform: uppercase; }

.chip.is-active, .chip:hover { border-color: var(--primary); color: var(--primary); background: #fffbeb; }

.pagination { display: flex; gap: 0.5rem; margin-top: 2rem; flex-wrap: wrap; }
.pagination a, .pagination__current {
  min-width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  font-size: 0.875rem;
}

.pagination__current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Product detail */
.product-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; align-items: start; }
.product-gallery { display: grid; gap: 0.75rem; }
.product-gallery__img { border-radius: var(--radius); border: 1px solid var(--border); }
.product-gallery__placeholder {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  background: var(--bg-muted);
  border-radius: var(--radius);
}

.product-detail__shop { color: var(--text-muted); font-size: 0.9375rem; text-decoration: none; }
.product-detail h1 { margin: 0.25rem 0 1rem; font-size: 2rem; line-height: 1.2; }
.product-detail__price-row { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.product-detail__price { font-size: 1.75rem; font-weight: 700; }
.product-detail__desc { color: var(--text-muted); margin-bottom: 1rem; line-height: 1.6; }
.product-detail__actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.5rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }
.tag {
  font-size: 0.8125rem;
  padding: 0.25rem 0.625rem;
  background: var(--bg-muted);
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
}

/* Shop header */
.shop-header {
  display: flex;
  gap: 1.5rem;
  align-items: start;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.shop-header__avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  flex-shrink: 0;
  text-transform: uppercase;
}

.shop-header h1 { margin: 0 0 0.5rem; }
.shop-header__desc { color: var(--text-muted); margin: 0 0 0.5rem; }
.shop-header__meta { margin: 0; font-size: 0.875rem; color: var(--text-muted); }

/* Cart */
.cart-layout { display: grid; grid-template-columns: 1fr 300px; gap: 2rem; align-items: start; }
.cart-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  align-items: center;
}

.cart-item__img { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--bg-muted); }
.cart-item__title { font-weight: 600; margin: 0 0 0.25rem; }
.cart-item__shop { font-size: 0.8125rem; color: var(--text-muted); margin: 0; }
.cart-item__price { font-weight: 700; white-space: nowrap; }
.cart-item__controls { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.cart-item__controls input { width: 3rem; text-align: center; padding: 0.25rem; border: 1px solid var(--border); border-radius: 6px; }

.cart-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: sticky;
  top: 5rem;
}

.cart-summary h2 { margin: 0 0 0.5rem; font-size: 1.125rem; }
.cart-summary__total { font-size: 1.5rem; font-weight: 700; margin: 0 0 1rem; }
.cart-summary__note { font-size: 0.8125rem; color: var(--text-muted); margin: 0.75rem 0 0; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field--full { grid-column: 1 / -1; }
.field span { font-size: 0.875rem; font-weight: 600; }
.field input, .field textarea {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  background: var(--surface);
}

.field input:focus, .field textarea:focus {
  outline: 2px solid #fcd34d;
  border-color: var(--primary);
}

.checkout-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.checkout-section h2 { margin: 0 0 1rem; font-size: 1.125rem; }
.checkout-total { text-align: right; font-size: 1.125rem; margin: 1rem 0 0; }
.form-hint { font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.75rem; }

.payment-notice {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 0.875rem 1rem;
  font-size: 0.9375rem;
  color: #78350f;
  margin: 1rem 0;
}

.alert { padding: 0.875rem 1rem; border-radius: var(--radius); margin: 1rem 0; }
.alert--error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert--success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }

/* Account */
.account-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.account-nav a {
  padding: 0.5rem 1rem;
  border-radius: 8px 8px 0 0;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
}

.account-nav a.is-active { color: var(--primary); background: var(--bg-muted); font-weight: 700; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-card h1 { margin: 0 0 0.75rem; }
.auth-card p { color: var(--text-muted); margin: 0 0 1.5rem; }

.header-auth {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
}

.header-auth:hover { color: var(--primary); text-decoration: none; }

.header-auth--user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-auth__logout {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
}

.header-auth__logout:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.muted { color: var(--text-muted); }

.profile-form .field input[readonly] {
  background: var(--bg-muted);
  color: var(--text-muted);
  cursor: default;
}

.orders-list { display: flex; flex-direction: column; gap: 0.75rem; }
.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}

.order-card__head { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.order-card__id { font-weight: 700; }
.order-card__status { font-size: 0.8125rem; padding: 0.2rem 0.5rem; border-radius: 999px; background: var(--bg-muted); }
.order-card__items { font-size: 0.9375rem; color: var(--text-muted); margin: 0; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state h2 { margin: 0 0 0.5rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: space-between;
  align-items: start;
}

.site-footer nav { display: flex; gap: 1rem; }
.site-footer nav a { color: var(--text-muted); text-decoration: none; }
.site-footer__copy { color: var(--text-muted); font-size: 0.875rem; margin: 0; }

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--text);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 900px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .catalog-sidebar { position: static; }
  .product-detail { grid-template-columns: 1fr; }
  .cart-layout { grid-template-columns: 1fr; }
  .nav { display: none; }
}

@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .hero__stats { gap: 1rem; }
  .search-form input { width: 120px; }
}
