/* Витрина «Товары из Кореи». Сначала телефон, потом планшет (640px) и компьютер (900px). */
:root {
  color-scheme: light;
  --canvas: #fbf7f4;
  --surface: #fff;
  --ink: #24202b;
  --muted: #77707d;
  --line: #ece5e0;
  --accent: #d9466f;
  --accent-dark: #b8335a;
  --accent-soft: #fde8ee;
  --green: #2f8a5f;
  --green-soft: #e7f5ee;
  --red: #c4443f;
  --red-soft: #fdeceb;
  --wa: #25d366;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 10px 30px rgba(60, 30, 40, .08);
  --tabbar: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: 'Manrope', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px; background: var(--canvas); color: var(--ink);
  font-size: 15px; line-height: 1.5; font-weight: 500;
  padding-bottom: calc(var(--tabbar) + var(--safe-bottom));
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 3px solid rgba(217, 70, 111, .35); outline-offset: 2px; }
#app:focus { outline: none; }

.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.icon .fill, .icon-defs .fill { fill: currentColor; stroke: none; }
.icon-lg { width: 40px; height: 40px; }
.icon-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; white-space: nowrap;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--accent-dark); }
.btn:active { transform: scale(.98); }
.btn-lg { min-height: 52px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn-ghost { background: var(--accent-soft); color: var(--accent-dark); }
.btn-ghost:hover { background: #fbd9e3; }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 0; color: var(--muted); font-size: 13px; }
.link-btn:hover { color: var(--red); }
.link-btn .icon { width: 16px; height: 16px; }

.search, .select {
  display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.search:focus-within, .select:focus-within { border-color: var(--accent); }
.search input, .select select { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); height: 42px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.select select { appearance: none; cursor: pointer; padding-right: 4px; }

/* ---------- шапка ---------- */
.head { position: sticky; top: 0; z-index: 20; background: rgba(251, 247, 244, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-top: 10px; padding-bottom: 10px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -.02em; margin-right: auto; }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 18px; }
.head-cats { display: none; gap: 4px; }
.head-cats a { padding: 8px 12px; border-radius: 999px; font-weight: 600; color: var(--muted); }
.head-cats a:hover, .head-cats a.is-on { color: var(--ink); background: var(--surface); }
.head-search { order: 3; flex: 1 0 100%; }
.head-search .search { min-height: 40px; }
.head-search .search input { height: 38px; }
body[data-page="catalog"] .head-search { display: none; }
.head-nav { display: none; align-items: center; gap: 6px; }
.head-nav a { position: relative; display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 999px; font-weight: 700; }
.head-nav a:hover, .head-nav a.is-on { background: var(--surface); }
.head-cart { background: var(--ink); color: #fff; }
.head-nav .head-cart:hover, .head-nav .head-cart.is-on { background: #000; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center; font-weight: 800;
}

/* ---------- нижнее меню (телефон) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; }
.tabbar a.is-on { color: var(--accent); }
.tabbar .icon { width: 24px; height: 24px; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; line-height: 18px; font-size: 11px; padding: 0 5px; }

/* ---------- плавающая кнопка WhatsApp ---------- */
.wa {
  position: fixed; right: 16px; bottom: calc(var(--tabbar) + var(--safe-bottom) + 14px); z-index: 25;
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: var(--wa); color: #fff; box-shadow: 0 8px 24px rgba(37, 211, 102, .4);
}
.wa .icon { width: 30px; height: 30px; }
body[data-page="cart"] .wa, body[data-page="product"] .wa { bottom: calc(var(--tabbar) + var(--safe-bottom) + 14px); }

/* ---------- общие блоки ---------- */
#app { padding-top: 16px; padding-bottom: 40px; min-height: 60vh; }
.section { margin-top: 36px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title { font-size: 22px; margin-bottom: 14px; }
.section-head .section-title { margin-bottom: 0; }
.more { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-dark); font-weight: 700; white-space: nowrap; }
.more .icon { width: 16px; height: 16px; }
.page-title { font-size: 26px; margin: 4px 0 14px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumbs a:hover { color: var(--accent-dark); }
.crumbs .icon { width: 14px; height: 14px; }
.crumbs span { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h1 { color: var(--ink); font-size: 24px; }
.found { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
.found:empty { display: none; }
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar) + var(--safe-bottom) + 16px); z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); text-align: center;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- главная ---------- */
.hero {
  display: grid; gap: 20px; padding: 24px 20px; border-radius: 24px; overflow: hidden;
  background: linear-gradient(135deg, #fde8ee 0%, #fff4ea 60%, #f3f7ec 100%);
}
.eyebrow { color: var(--accent-dark); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.hero h1 { font-size: 34px; margin: 8px 0 8px; }
.lead { font-size: 18px; color: #4a4350; margin-bottom: 20px; }
.hero-pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.hero-pic { aspect-ratio: 1; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.hero-pic:nth-child(2) { transform: translateY(14px); }
.hero-pic img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }

.cats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  padding: 12px 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .15s, box-shadow .15s;
}
.cat:hover { border-color: #f4bccb; box-shadow: var(--shadow); }
.cat-img { display: grid; place-items: center; width: 100%; aspect-ratio: 1; margin-bottom: 8px; color: var(--accent); }
.cat-img img { width: 100%; height: 100%; object-fit: contain; }
.cat-name { font-weight: 800; font-size: 15px; }
.cat-count { color: var(--muted); font-size: 12px; }
.info { display: flex; gap: 16px; align-items: flex-start; padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--accent); }
.info h2 { font-size: 18px; color: var(--ink); margin-bottom: 4px; }
.info p { color: var(--muted); white-space: pre-line; }

/* ---------- каталог ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 12px; padding: 2px 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.chip:hover { border-color: #f4bccb; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }
.toolbar { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid-rail {
  grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 46%;
  overflow-x: auto; scroll-snap-type: x mandatory; margin: 0 -16px; padding: 2px 16px 8px; scrollbar-width: none;
}
.grid-rail::-webkit-scrollbar { display: none; }
.grid-rail > * { scroll-snap-align: start; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 8px 10px;
  transition: box-shadow .15s, border-color .15s;
}
.card:hover { box-shadow: var(--shadow); border-color: #f2d6de; }
.card-img { position: relative; display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.card-img img { width: 100%; height: 100%; object-fit: contain; }
.card.is-out .card-img img { opacity: .5; }
.card-name {
  margin: 8px 4px 6px; font-weight: 700; font-size: 14px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(1.3em * 2);
}
.card-name:hover { color: var(--accent-dark); }
.card-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; padding: 0 0 0 4px; }
.card-price { display: flex; flex-direction: column; line-height: 1.2; }
.price { font-weight: 800; font-size: 16px; white-space: nowrap; }
.card-price s, .product-price s { color: var(--muted); font-size: 13px; font-weight: 600; }
.tag { position: absolute; left: 8px; top: 8px; padding: 3px 9px; border-radius: 999px; background: rgba(36, 32, 43, .78); color: #fff; font-size: 11px; font-weight: 700; }
.tag-sale { background: var(--accent); }
.tag + .tag { top: 34px; }
.add {
  display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: 0 0 auto;
  min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark); font-weight: 800;
}
.add:hover { background: var(--accent); color: #fff; }
.add.is-in { background: var(--accent); color: #fff; }
.add.is-in .icon { width: 16px; height: 16px; }
.add.is-off-stock { background: none; color: var(--muted); font-size: 11px; height: auto; padding: 0; min-width: 0; text-align: right; line-height: 1.2; }
.noimg { display: grid; place-items: center; width: 100%; height: 100%; aspect-ratio: 1; color: #e7c3cd; }
.noimg .icon { width: 40px; height: 40px; }

/* скелетоны загрузки */
.sk { pointer-events: none; }
.sk .card-img, .sk-line, .gallery.sk { background: linear-gradient(90deg, #f3ece8 0%, #faf5f2 50%, #f3ece8 100%); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
.sk-line { height: 14px; border-radius: 6px; margin: 10px 4px 0; }
.sk-line.short { width: 50%; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------- карточка товара ---------- */
.product { display: grid; gap: 20px; }
.gallery { min-width: 0; }
.gallery.sk { aspect-ratio: 1; border-radius: var(--radius); }
.gallery-track {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide { flex: 0 0 100%; aspect-ratio: 1; scroll-snap-align: center; display: grid; place-items: center; padding: 12px; }
.gallery-slide img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.thumb { flex: 0 0 64px; height: 64px; padding: 4px; border-radius: 10px; border: 2px solid var(--line); background: #fff; }
.thumb.is-on { border-color: var(--accent); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.product-info h1 { font-size: 24px; }
.product-price { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 6px; }
.product-price .price { font-size: 28px; }
.stock { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 14px; margin-bottom: 18px; }
.stock .icon { width: 16px; height: 16px; }
.stock.is-in { color: var(--green); }
.stock.is-out { color: var(--red); background: var(--red-soft); padding: 4px 12px; border-radius: 999px; }
.buy { display: flex; gap: 10px; margin-bottom: 10px; }
.btn-buy { flex: 1; }
.btn-tocart { width: 100%; margin-bottom: 4px; }
.stepper { display: inline-flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; height: 52px; }
.stepper button { display: grid; place-items: center; width: 44px; height: 100%; border: 0; background: none; border-radius: 999px; }
.stepper button:hover:not(:disabled) { color: var(--accent); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper input { width: 40px; border: 0; outline: 0; background: none; text-align: center; font-weight: 800; font-size: 16px; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-sm { height: 38px; }
.stepper-sm button { width: 36px; }
.stepper-sm .icon { width: 16px; height: 16px; }
.stepper-sm span { min-width: 24px; text-align: center; font-weight: 800; }
.desc { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); color: #3d3743; }
.desc h2 { font-size: 18px; margin-bottom: 10px; color: var(--ink); }
.desc p { margin-bottom: 8px; }
.desc ul { margin: 0 0 10px; padding-left: 20px; }
.desc li { margin-bottom: 4px; }
.desc li::marker { color: var(--accent); }

/* ---------- корзина ---------- */
.cart { display: grid; gap: 16px; align-items: start; }
.lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.line {
  display: grid; grid-template-columns: 76px 1fr; gap: 6px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px;
}
.line.is-off { background: #faf8f7; }
.line.is-off .line-img, .line.is-off .line-name { opacity: .55; }
.line-img { width: 76px; height: 76px; border-radius: 10px; overflow: hidden; background: #fff; }
.line-img img { width: 100%; height: 100%; object-fit: contain; }
.line-name { font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-name:hover { color: var(--accent-dark); }
.line-price { color: var(--muted); font-size: 13px; margin-top: 2px; }
.line-warn { color: var(--red); font-size: 13px; font-weight: 700; margin-top: 4px; }
.line-note { color: var(--accent-dark); font-size: 13px; margin-top: 4px; }
.line-side { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.line-total { font-weight: 800; font-size: 16px; margin-right: auto; }
.line.is-off .line-side { justify-content: flex-end; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 12px; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; }
.summary-total { font-size: 20px; padding-top: 12px; border-top: 1px solid var(--line); }
.summary-total b { font-weight: 800; }
.summary-note { display: flex; gap: 8px; color: var(--muted); font-size: 14px; }
.summary-note .icon { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }
.summary-note.small { font-size: 13px; }
.summary .link-btn { justify-self: center; }

/* ---------- подвал ---------- */
.foot { border-top: 1px solid var(--line); background: var(--surface); padding: 28px 0 20px; font-size: 14px; }
.foot-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.foot-name { font-weight: 800; font-size: 16px; }
.foot-title { font-weight: 800; margin-bottom: 6px; }
.foot-muted { color: var(--muted); }
.foot ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.foot a:hover { color: var(--accent-dark); }
#foot-wa a { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; font-weight: 700; }
#foot-wa .icon { color: var(--wa); }
.foot-copy { margin-top: 20px; font-size: 12px; }

/* ---------- планшет ---------- */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .grid-rail { grid-template-columns: none; grid-auto-columns: 30%; }
  .toolbar { grid-template-columns: 1fr 220px; }
  .hero { grid-template-columns: 1.1fr 1fr; align-items: center; padding: 40px; }
  .hero h1 { font-size: 44px; }
  .cats { gap: 16px; }
  .cat { padding: 16px 12px 18px; }
  .cat-name { font-size: 17px; }
  .line { grid-template-columns: 96px 1fr auto; align-items: center; }
  .line-img { width: 96px; height: 96px; }
  .line-side { grid-column: auto; flex-direction: column; align-items: flex-end; gap: 6px; }
  .line-total { margin-right: 0; }
}

/* ---------- компьютер ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .tabbar { display: none; }
  .wa { bottom: 24px; right: 24px; }
  body[data-page="cart"] .wa, body[data-page="product"] .wa { bottom: 24px; }
  #toast { bottom: 24px; }
  .head-row { flex-wrap: nowrap; padding-top: 14px; padding-bottom: 14px; }
  .logo { margin-right: 8px; }
  .head-cats { display: flex; }
  .head-search { order: 0; flex: 1 1 auto; max-width: 340px; margin-left: auto; }
  body[data-page="catalog"] .head-search { display: block; visibility: hidden; }
  .head-nav { display: flex; }
  #app { padding-top: 24px; padding-bottom: 64px; }
  .grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
  .grid-rail { grid-template-columns: none; grid-auto-columns: calc((100% - 48px) / 4); margin: 0; padding: 2px 0 8px; }
  .page-title { font-size: 32px; }
  .section { margin-top: 48px; }
  .section-title { font-size: 26px; }
  .chips { margin: 0 0 14px; padding: 2px 0; flex-wrap: wrap; }
  .hero { padding: 56px; }
  .hero h1 { font-size: 52px; }
  .product { grid-template-columns: minmax(0, 520px) 1fr; gap: 40px; align-items: start; }
  .gallery { position: sticky; top: 90px; }
  .product-info h1 { font-size: 30px; }
  .buy { max-width: 440px; }
  .btn-tocart { max-width: 440px; }
  .cart { grid-template-columns: 1fr 340px; gap: 24px; }
  .summary { position: sticky; top: 90px; }
  .foot-row { grid-template-columns: 2fr 1fr; }
}

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