:root {
  --bg: #ffffff;
  --paper: #f6f3ee;
  --ink: #0e0e10;
  --muted: #66666d;
  --line: #e3dfd8;
  --accent: #cb11ab;
  --accent-ink: #a30d89;
  --accent-soft: #fbe3f6;
  --ok: #0f7a4f;
  --warn: #9a5b00;
  --danger: #c4261d;
  --radius: 4px;
  --font: "Onest", "Segoe UI", system-ui, sans-serif;
  --wrap: 1240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: #fff; }
.hidden { display: none !important; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input:focus-visible, select:focus-visible { outline-offset: 0; }

/* Утилитарная полоса */
.strip {
  background: var(--ink); color: #f1eee8; font-size: 0.82rem; text-align: center; padding: 8px 16px;
}

/* Шапка */
.topbar {
  position: sticky; top: 0; z-index: 40; background: rgba(255,255,255,0.96);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 14px 24px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 24px; align-items: center;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.2rem;
  letter-spacing: -0.02em; color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand.compact { font-size: 1rem; margin-bottom: 8px; color: #fff; }
.brand-mark {
  width: 38px; height: 38px; border-radius: var(--radius); background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 0.82rem; font-weight: 800; letter-spacing: 0.02em;
}
.brand-accent { color: var(--accent); }
.search {
  display: flex; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; background: #fff;
}
.search:focus-within { border-color: var(--accent); }
.search input {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 11px 14px; outline: none;
}
.search button {
  border: 0; background: var(--ink); color: #fff; padding: 0 22px; cursor: pointer; font-weight: 600;
}
.search button:hover { background: var(--accent); }
.top-actions { display: flex; gap: 22px; align-items: center; font-size: 0.95rem; font-weight: 500; }
.top-actions a:not(.btn) { color: var(--ink); padding: 6px 0; border-bottom: 2px solid transparent; }
.top-actions a:not(.btn):hover { text-decoration: none; border-bottom-color: var(--ink); }
.top-actions a[aria-current="page"]:not(.btn) { border-bottom-color: var(--accent); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 2px;
  border-radius: 10px; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700;
}

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--radius); padding: 11px 20px; border: 2px solid var(--ink);
  background: transparent; color: var(--ink); cursor: pointer; font-weight: 600; font-size: 0.95rem;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: var(--accent); border-color: var(--accent); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn-light { background: #fff; border-color: #fff; color: var(--ink); }
.btn-light:hover { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }
.btn-accent:disabled:hover { background: var(--accent); color: #fff; }

/* Контейнеры */
.hero, .section, .catalog-layout, .narrow, .auth-wrap, .product-page, .footer-inner {
  max-width: var(--wrap); margin: 0 auto; padding: 36px 24px;
}

/* Главная */
.hero {
  display: grid; grid-template-columns: 1.35fr 1fr; gap: 48px; padding-top: 56px; padding-bottom: 40px;
}
.hero h1 {
  font-size: clamp(2.4rem, 5.4vw, 4.6rem); line-height: 1.02; letter-spacing: -0.045em; font-weight: 800;
  margin-bottom: 22px; max-width: 14ch;
}
.lede { color: var(--muted); font-size: 1.1rem; line-height: 1.6; max-width: 38rem; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 34px; }
.hero-stats { display: flex; gap: 0; list-style: none; border-top: 1px solid var(--ink); }
.hero-stats li { display: grid; gap: 2px; padding: 16px 28px 0 0; margin-right: 28px; }
.hero-stats li + li { border-left: 1px solid var(--line); padding-left: 28px; }
.hero-stats strong { font-size: 1.5rem; letter-spacing: -0.02em; }
.hero-stats span { color: var(--muted); font-size: 0.85rem; }

.hero-panel { display: grid; gap: 0; align-content: start; }
.deal { background: var(--accent); color: #fff; padding: 32px; border-radius: var(--radius); }
.deal-big { font-size: clamp(3.6rem, 8vw, 6rem); font-weight: 800; letter-spacing: -0.06em; line-height: 0.9; }
.deal h2 { font-size: 1.6rem; margin: 14px 0 8px; letter-spacing: -0.02em; }
.deal p { opacity: 0.92; margin-bottom: 22px; line-height: 1.5; }
.deal :focus-visible { outline-color: #fff; }
.facts { display: grid; grid-template-columns: 1fr 1fr; margin-top: 8px; }
.facts div { padding: 14px 0; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { padding-right: 16px; }
.facts div:nth-child(even) { padding-left: 16px; border-left: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 0.82rem; }
.facts dd { font-weight: 700; font-size: 1.05rem; }

.section-head {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  margin-bottom: 20px; padding-bottom: 12px; border-bottom: 2px solid var(--ink);
}
.section-head h2 { font-size: 1.7rem; letter-spacing: -0.03em; font-weight: 800; }
.page-title { font-size: 2.2rem; letter-spacing: -0.035em; font-weight: 800; margin-bottom: 8px; }
.link { font-weight: 600; color: var(--ink); border-bottom: 2px solid var(--accent); }
.link:hover { text-decoration: none; background: var(--accent-soft); }
.muted { color: var(--muted); }
.tiny { font-size: 0.82rem; }

/* Категории */
.cats { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.cat {
  display: flex; align-items: baseline; gap: 14px; text-align: left; border: 0; border-bottom: 1px solid var(--line);
  background: transparent; padding: 20px 8px; cursor: pointer; font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em;
  transition: background .15s ease, padding .15s ease;
}
.cat-n { color: var(--accent); font-size: 0.82rem; font-weight: 600; min-width: 1.6rem; }
.cat:hover { background: var(--paper); padding-left: 16px; }

/* Товары */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 32px 20px; }
.product-card { display: grid; gap: 10px; align-content: start; }
.thumb { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--paper); }
.thumb .mark { width: 100%; height: 100%; transition: transform .35s ease; }
.product-card:hover .thumb .mark { transform: scale(1.04); }
.sale-tag {
  position: absolute; left: 10px; top: 10px; background: var(--ink); color: #fff; font-size: 0.78rem;
  font-weight: 700; padding: 4px 8px; border-radius: 2px;
}
.mark-letter { font-family: var(--font); font-weight: 800; letter-spacing: -0.04em; }
.mark-brand { font-family: var(--font); font-weight: 700; }
.product-card h3 { font-size: 1rem; line-height: 1.3; font-weight: 600; min-height: 2.6em; }
.price-row { display: flex; align-items: baseline; gap: 10px; }
.price { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.02em; }
.old { color: var(--muted); text-decoration: line-through; font-size: 0.92rem; }
.meta-row { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.84rem; }
.rating { display: inline-flex; align-items: center; gap: 5px; }
.rating svg { width: 12px; height: 12px; fill: var(--accent); }
.product-card .actions { display: flex; gap: 8px; margin-top: 4px; }
.product-card .actions .btn { flex: 1; padding: 9px 8px; font-size: 0.88rem; }

.dual { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 2px solid var(--ink); margin-top: 24px; }
.dual-col { padding: 32px 32px 32px 0; }
.dual-col + .dual-col { border-left: 1px solid var(--line); padding-left: 32px; padding-right: 0; }
.dual-col h3 { font-size: 1.4rem; letter-spacing: -0.02em; margin-bottom: 12px; }
.dual-col ul { margin: 0 0 20px 18px; color: var(--muted); line-height: 1.8; }

/* Каталог */
.catalog-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; }
.filters { height: fit-content; position: sticky; top: 96px; border-top: 2px solid var(--ink); padding-top: 14px; }
.filters h3 { margin-bottom: 16px; font-size: 1.1rem; }
.filters label { display: grid; gap: 8px; margin-bottom: 18px; font-size: 0.9rem; font-weight: 600; }
.filters select, .filters input[type="range"] { width: 100%; }
.filters select, .auth-card input[type="email"], .auth-card input[type="password"], .auth-card input[type="text"],
.seller-col input:not([type="file"]) {
  border: 1px solid #c9c4ba; border-radius: var(--radius); padding: 10px 12px; background: #fff; font-weight: 500;
}
.filters select:focus, .auth-card input:focus, .seller-col input:focus { border-color: var(--accent); }
.filters input[type="range"] { accent-color: var(--accent); }
.range-val { font-weight: 500; color: var(--muted); }
.check { display: flex !important; align-items: center; gap: 10px; font-weight: 500 !important; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.filters .btn { width: 100%; margin-bottom: 12px; }

/* Карточка товара */
.product-page { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; }
.product-gallery { border-radius: var(--radius); overflow: hidden; background: var(--paper); aspect-ratio: 1 / 1; }
.product-gallery .mark { width: 100%; height: 100%; }
.crumbs { color: var(--muted); font-size: 0.9rem; margin-bottom: 10px; }
.product-info h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.08; margin-bottom: 14px; letter-spacing: -0.04em; font-weight: 800; }
.product-info .price { font-size: 2rem; }
.product-info .stock-line { margin-top: 10px; color: var(--muted); justify-content: flex-start; gap: 14px; }
.specs { margin: 22px 0; display: grid; border-top: 2px solid var(--ink); }
.specs div { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.specs span:last-child { font-weight: 600; text-align: right; }
.product-info .hero-cta { margin: 20px 0 0; }

/* Корзина */
.narrow { max-width: 880px; }
.narrow.wide { max-width: var(--wrap); }
.cart-list { margin: 22px 0 0; border-top: 2px solid var(--ink); }
.cart-empty { padding: 36px 0; display: grid; gap: 14px; justify-items: start; border-bottom: 1px solid var(--line); }
.cart-empty strong { font-size: 1.3rem; letter-spacing: -0.02em; }
.cart-line {
  padding: 14px 0; display: grid; grid-template-columns: 76px 1fr auto; gap: 18px; align-items: center;
  border-bottom: 1px solid var(--line);
}
.cart-line .thumb { aspect-ratio: 1 / 1; cursor: default; }
.cart-summary { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 0; }
.total { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }

/* Формы */
.auth-wrap { display: grid; place-items: center; padding-top: 64px; padding-bottom: 80px; }
.auth-card { width: min(440px, 100%); border-top: 4px solid var(--accent); padding: 28px 0 0; }
.auth-card h2 { margin-bottom: 8px; font-size: 1.8rem; letter-spacing: -0.03em; font-weight: 800; }
.auth-card form { display: grid; gap: 14px; margin: 20px 0; }
.auth-card label, .seller-col label { display: grid; gap: 6px; font-size: 0.9rem; font-weight: 600; }

.seller-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 28px; border-top: 2px solid var(--ink); }
.seller-col { padding: 26px 28px 26px 0; display: grid; gap: 12px; align-content: start; }
.seller-col + .seller-col { border-left: 1px solid var(--line); padding-left: 28px; }
.seller-col h3 { font-size: 1.2rem; letter-spacing: -0.02em; }
.seller-col form { display: grid; gap: 12px; }
.seller-col .btn { justify-self: start; }

.alert {
  margin-top: 14px; padding: 12px 14px; border-left: 4px solid var(--warn);
  background: #fff6e6; color: var(--warn); font-size: 0.92rem;
}
.alert.danger { background: #fdecea; color: var(--danger); border-left-color: var(--danger); }
.alert.ok { background: #e8f6ef; color: var(--ok); border-left-color: var(--ok); }

.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50; background: var(--ink); color: #fff;
  padding: 13px 18px; border-radius: var(--radius); border-left: 4px solid var(--accent);
  max-width: min(380px, calc(100vw - 32px)); font-size: 0.92rem;
}

/* Подвал */
.footer { background: var(--ink); color: #d8d5cf; margin-top: 56px; }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; padding-top: 40px; padding-bottom: 40px; }
.foot-note { color: #9a9892; max-width: 34ch; }
.footer .brand-mark { width: 30px; height: 30px; font-size: 0.7rem; }
.footer-links { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.footer-links a { color: #fff; font-weight: 500; }
.footer :focus-visible { outline-color: #fff; }

@media (max-width: 1000px) {
  .topbar-inner { grid-template-columns: 1fr auto; row-gap: 12px; padding: 12px 16px; }
  .search { grid-column: 1 / -1; order: 3; }
  .hero, .product-page, .catalog-layout { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { max-width: none; }
  .filters { position: static; }
  .cats { grid-template-columns: 1fr 1fr; }
  .dual, .seller-grid { grid-template-columns: 1fr; }
  .dual-col, .seller-col { padding: 24px 0; }
  .dual-col + .dual-col, .seller-col + .seller-col { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; }
}

@media (max-width: 640px) {
  .strip { font-size: 0.76rem; text-align: left; }
  .top-actions { gap: 14px; font-size: 0.88rem; flex-wrap: wrap; justify-content: flex-end; }
  .top-actions .btn { padding: 8px 14px; }
  .hero, .section, .catalog-layout, .narrow, .auth-wrap, .product-page, .footer-inner { padding-left: 16px; padding-right: 16px; }
  .hero { padding-top: 32px; }
  .hero-stats { flex-wrap: wrap; }
  .hero-stats li { padding-right: 18px; margin-right: 18px; }
  .hero-stats li + li { padding-left: 18px; }
  .cats { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: 1fr 1fr; gap: 24px 12px; }
  .product-card .actions { flex-direction: column; }
  .cart-line { grid-template-columns: 60px 1fr; }
  .cart-line > :last-child { grid-column: 2; }
  .cart-summary { flex-direction: column; align-items: stretch; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
