/* Shops engine — base theme. Each site sets --accent in the layout. */
:root {
    --accent: #333;
    --accent-soft: color-mix(in srgb, var(--accent) 10%, white);
    --accent-hover: color-mix(in srgb, var(--accent) 85%, black);
    --bg: #f6f7f9;
    --surface: #fff;
    --text: #1d2330;
    --muted: #6b7380;
    --line: #e4e7ec;
    --warn: #b54708;
    --err: #d92d20;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
    --wrap: 1240px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 15px/1.5 Manrope, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6em; letter-spacing: -.01em; }
h1 { font-size: clamp(24px, 3.2vw, 34px); font-weight: 800; }
h2 { font-size: clamp(20px, 2.4vw, 24px); font-weight: 700; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }
.section { padding-top: 24px; padding-bottom: 32px; }
.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.warn { color: var(--warn); }
.nowrap { white-space: nowrap; }
.link { color: var(--accent); font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 44px; padding: 0 20px; border-radius: var(--radius-sm);
    border: 1px solid var(--line); background: var(--surface); cursor: pointer;
    font-weight: 600; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn--lg { height: 52px; padding: 0 28px; font-size: 16px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- header ---------- */
.topbar { background: var(--text); color: #c9ced6; font-size: 13px; }
.topbar__in { display: flex; justify-content: space-between; gap: 16px; height: 34px; align-items: center; }
.topbar__right { display: flex; gap: 20px; }
.topbar a:hover { color: #fff; }

.header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.header__in { display: flex; align-items: center; gap: 16px; height: 72px; }
.logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo img { height: 48px; width: auto; }
.logo__mark {
    width: 40px; height: 40px; border-radius: 12px; background: var(--accent); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 20px;
}
.logo__text { font-weight: 800; font-size: 19px; line-height: 1.1; display: flex; flex-direction: column; }
.logo__text small { font-weight: 500; font-size: 12px; color: var(--muted); }
.btn-catalog {
    display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px;
    border: 0; border-radius: var(--radius-sm); background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
.btn-catalog:hover { background: var(--accent-hover); }
.search { flex: 1; display: flex; position: relative; }
.search input {
    width: 100%; height: 44px; padding: 0 48px 0 16px; border: 1.5px solid var(--line);
    border-radius: var(--radius-sm); background: var(--bg); outline: none;
}
.search input:focus { border-color: var(--accent); background: #fff; }
.search button {
    position: absolute; right: 4px; top: 4px; height: 36px; min-width: 40px; border: 0;
    border-radius: 8px; background: transparent; cursor: pointer; color: var(--muted);
}
.search--big { max-width: 480px; margin: 24px auto; }
.search--big button { background: var(--accent); color: #fff; padding: 0 14px; }
.cart-link { position: relative; display: flex; align-items: center; gap: 8px; font-weight: 600; padding: 8px; }
.badge {
    position: absolute; top: 0; left: 22px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}

.menu { border-top: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); max-height: 70vh; overflow: auto; }
.menu__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 4px; padding-top: 12px; padding-bottom: 16px; }
.menu__item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm); }
.menu__item:hover { background: var(--accent-soft); }
.menu__item img { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bg); }
.menu__item span { flex: 1; font-weight: 600; }
.menu__item small { color: var(--muted); }

/* ---------- home ---------- */
.hero { background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border-bottom: 1px solid var(--line); }
.hero__in { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; align-items: center; padding-top: 48px; padding-bottom: 48px; }
.hero h1 { font-size: clamp(28px, 4.5vw, 48px); margin-bottom: 14px; }
.hero__lead { font-size: 17px; color: var(--muted); max-width: 520px; margin: 0 0 24px; }
.hero__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero__facts li { background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.hero__facts b { font-size: 16px; }
.hero__facts span { color: var(--muted); font-size: 14px; }

.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 16px; }
.section__head h2 { margin: 0; }
.cats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 16px; }
.cat { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .15s; }
.cat:hover { transform: translateY(-2px); color: inherit; }
.cat__img { aspect-ratio: 1; background: var(--bg); overflow: hidden; }
.cat__img img { width: 100%; height: 100%; object-fit: cover; }
.cat__name { font-weight: 700; padding: 12px 14px 0; line-height: 1.3; }
.cat__count { padding: 2px 14px 14px; font-size: 13px; }

/* ---------- catalog ---------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.crumbs span:last-child { color: var(--text); }
.catalog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.catalog-head h1 { margin: 0; }
.count { font-size: .55em; font-weight: 600; vertical-align: middle; }
.sort select { height: 40px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 12px; background: var(--surface); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip { padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.chip small { color: var(--muted); font-weight: 500; }
.chip:hover { border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s; }
.card:hover { transform: translateY(-2px); color: inherit; }
.card__img { position: relative; aspect-ratio: 3 / 4; background: var(--bg); }
.card__img img { width: 100%; height: 100%; object-fit: cover; }
.card__tag { position: absolute; left: 10px; bottom: 10px; background: rgba(255, 255, 255, .92); border-radius: 8px; padding: 3px 8px; font-size: 12px; font-weight: 600; }
.card__body { padding: 12px 14px 16px; }
.card__price { font-weight: 800; font-size: 18px; }
.card__name { font-size: 14px; line-height: 1.35; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card__out { color: var(--muted); font-size: 13px; margin-top: 6px; }
.card--out .card__img img { opacity: .55; }

.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.pager a, .pager span { min-width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--radius-sm); padding: 0 8px; }
.pager a { background: var(--surface); border: 1px solid var(--line); font-weight: 600; }
.pager__cur { background: var(--accent); color: #fff; font-weight: 700; }
.empty { background: var(--surface); border-radius: var(--radius); padding: 40px; text-align: center; }

/* ---------- product ---------- */
.product { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.gallery { display: grid; grid-template-columns: 76px 1fr; gap: 12px; position: sticky; top: 90px; }
.gallery__main { grid-column: 2; grid-row: 1; aspect-ratio: 3 / 4; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.gallery__main img { width: 100%; height: 100%; object-fit: contain; }
.gallery__thumbs { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 8px; max-height: 100%; overflow: auto; }
.gallery__thumbs button { padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); flex-shrink: 0; }
.gallery__thumbs button.is-active { border-color: var(--accent); }
.gallery__thumbs img { width: 72px; height: 96px; object-fit: cover; }

.buybox { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.product__title { font-size: clamp(20px, 2.4vw, 26px); }
.sku { font-size: 13px; margin-top: -6px; }
.price { display: flex; align-items: baseline; gap: 12px; margin: 16px 0 20px; }
.price [data-price] { font-size: 32px; font-weight: 800; }
.axis { margin-bottom: 18px; }
.axis__label { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.axis__label b { color: var(--text); }
.axis__values { display: flex; flex-wrap: wrap; gap: 8px; max-height: 236px; overflow: auto; padding: 2px; }
.opt { min-height: 40px; padding: 6px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 14px; }
.opt:hover { border-color: var(--accent); }
.opt.is-active, .swatch.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.opt.is-na, .swatch.is-na { opacity: .4; }
.swatch { width: 52px; height: 68px; padding: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--bg); }
.swatch img { width: 100%; height: 100%; object-fit: cover; }
.buy { display: flex; gap: 12px; margin-top: 8px; }
.buy .btn { flex: 1; }
.qty { display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; height: 52px; background: var(--surface); }
.qty button { width: 40px; height: 100%; border: 0; background: transparent; cursor: pointer; font-size: 20px; }
.qty button:hover { background: var(--bg); }
.qty input { width: 44px; height: 100%; border: 0; text-align: center; font-weight: 700; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { -webkit-appearance: none; }
.qty--sm { height: 40px; }
.qty--sm button { width: 34px; }
.stock { font-size: 14px; margin-top: 10px; }
.perks { list-style: none; padding: 16px 0 0; margin: 20px 0 0; border-top: 1px solid var(--line); display: grid; gap: 8px; font-size: 14px; color: var(--muted); }
.perks li::before { content: "✓"; color: var(--accent); font-weight: 800; margin-right: 8px; }

.product-info { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 32px; margin-top: 40px; }
.product-info section { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); align-self: start; }
.text { line-height: 1.65; }
.specs { margin: 0; display: grid; gap: 0; }
.specs div { display: grid; grid-template-columns: 1fr 1.2fr; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.specs div:last-child { border-bottom: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; }

/* ---------- cart & checkout ---------- */
.cart, .checkout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.cart__lines { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px 20px; }
.line { display: grid; grid-template-columns: 72px 1fr auto 110px 32px; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.line:last-of-type { border-bottom: 0; }
.line__img img { width: 72px; height: 96px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.line__name { font-weight: 600; line-height: 1.35; }
.line__sum { font-weight: 800; text-align: right; }
.line__del { border: 0; background: none; font-size: 24px; color: var(--muted); cursor: pointer; }
.line__del:hover { color: var(--err); }
.summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; position: sticky; top: 90px; display: grid; gap: 12px; }
.summary__row, .summary__item, .summary__total { display: flex; justify-content: space-between; gap: 12px; }
.summary__item { font-size: 14px; }
.summary__total { border-top: 1px solid var(--line); padding-top: 12px; font-size: 18px; }
.box { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 24px; border: 0; margin: 0 0 16px; }
.box legend { font-weight: 800; font-size: 18px; padding: 0; float: left; width: 100%; margin-bottom: 12px; }
.box legend + * { clear: both; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field input, .field textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); outline: none; background: var(--surface); }
.field input:focus, .field textarea:focus { border-color: var(--accent); }
.field--err input { border-color: var(--err); }
.field__err { color: var(--err); font-size: 13px; margin-top: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.radios { display: grid; gap: 8px; margin-bottom: 16px; }
.radio { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input, .check input { accent-color: var(--accent); width: 18px; height: 18px; }
.check { display: flex; gap: 10px; font-size: 13px; align-items: flex-start; }
.check a { color: var(--accent); text-decoration: underline; }
.check.field--err { color: var(--err); }
.notice { background: var(--accent-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin: 16px 0; }
.notice--ok { background: #e7f6ec; color: #135e2c; }
.notice--warn { background: #fdf0e3; color: #8a4508; }
.pay-btn { margin: 8px 0 4px; height: auto; min-height: 56px; padding: 12px 20px; text-align: center; }
.table { width: 100%; border-collapse: collapse; margin: 16px 0 20px; }
.table td { padding: 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table td:last-child { text-align: right; padding-left: 16px; }
.table__total td { font-weight: 800; font-size: 18px; border-bottom: 0; }
.page h2 { margin-top: 1.4em; }

/* ---------- footer ---------- */
.footer { background: var(--surface); border-top: 1px solid var(--line); margin-top: 48px; }
.footer__grid { display: grid; grid-template-columns: 1.3fr 1fr 1fr 1.2fr; gap: 32px; padding-top: 40px; padding-bottom: 32px; }
.footer__grid > div { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.footer__brand { font-weight: 800; font-size: 20px; }
.footer__title { font-weight: 700; margin-bottom: 4px; }
.footer__bottom { border-top: 1px solid var(--line); padding-top: 16px; padding-bottom: 24px; font-size: 13px; }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
    background: var(--text); color: #fff; border-radius: 12px; padding: 12px 18px; box-shadow: var(--shadow);
    display: flex; gap: 14px; align-items: center; font-weight: 600;
}
.toast a { color: #fff; text-decoration: underline; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
    .cats { grid-template-columns: repeat(3, 1fr); }
    .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 860px) {
    .topbar { display: none; }
    .header__in { flex-wrap: wrap; height: auto; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
    .logo { flex: 1; }
    .logo img { height: 40px; }
    .search { order: 3; flex-basis: 100%; }
    .btn-catalog span, .cart-link__label { display: none; }
    .btn-catalog { padding: 0 12px; }
    .hero__in { grid-template-columns: 1fr; padding-top: 32px; padding-bottom: 32px; }
    .product, .product-info, .cart, .checkout { grid-template-columns: 1fr; }
    .gallery { position: static; grid-template-columns: 1fr; }
    .gallery__main { grid-column: 1; }
    .gallery__thumbs { grid-column: 1; grid-row: 2; flex-direction: row; overflow-x: auto; }
    .gallery__thumbs img { width: 56px; height: 74px; }
    .summary { position: static; }
}
@media (max-width: 560px) {
    body { font-size: 14px; }
    .cats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .card__body { padding: 10px 10px 12px; }
    .card__price { font-size: 16px; }
    .card__name { font-size: 13px; }
    .buybox { padding: 18px; }
    .line { grid-template-columns: 60px 1fr auto; grid-template-areas: "img info del" "img qty sum"; gap: 8px 12px; }
    .line__img { grid-area: img; } .line__img img { width: 60px; height: 80px; }
    .line__info { grid-area: info; } .line .qty { grid-area: qty; justify-self: start; }
    .line__sum { grid-area: sum; } .line__del { grid-area: del; }
    .row2 { grid-template-columns: 1fr; }
    .footer__grid { grid-template-columns: 1fr; gap: 24px; }
}
