/* Quiet, product-first storefront: neutral greys, one blue accent, generous space.
   Light/dark comes from Telegram's colour scheme (html[data-theme]) or the OS. */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface2: #fafafc;
  --text: #1d1d1f;
  --text2: #6e6e73;
  --text3: #86868b;
  --line: rgba(0, 0, 0, .09);
  --accent: #0071e3;
  --accent-press: #0077ed;
  --accent-text: #ffffff;
  --danger: #e30000;
  --success: #1aa34a;
  --glass: rgba(245, 245, 247, .72);
  --shadow: 0 2px 12px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .04);
  --radius: 20px;
  --radius-s: 12px;
  --ease: cubic-bezier(.28, .11, .32, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #1c1c1e; --surface2: #232326; --text: #f5f5f7; --text2: #a1a1a6; --text3: #86868b;
    --line: rgba(255, 255, 255, .12); --accent: #2997ff; --accent-press: #47a6ff; --glass: rgba(22, 22, 23, .72);
    --shadow: none; --danger: #ff453a; --success: #30d158;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #1c1c1e; --surface2: #232326; --text: #f5f5f7; --text2: #a1a1a6; --text3: #86868b;
  --line: rgba(255, 255, 255, .12); --accent: #2997ff; --accent-press: #47a6ff; --glass: rgba(22, 22, 23, .72);
  --shadow: none; --danger: #ff453a; --success: #30d158;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(108px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; letter-spacing: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* ---------- nav */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--line);
}
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 16px; max-width: 980px; margin: 0 auto; }
.wordmark { font-size: 19px; font-weight: 600; letter-spacing: -.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.langs { display: flex; gap: 2px; }
.langs button { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--text3); padding: 6px 7px; border-radius: 8px; transition: color .2s var(--ease); }
.langs button.on { color: var(--text); }
.bag { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; }
.bag svg { width: 22px; height: 22px; stroke-width: 1.5; }
.bag-count {
  position: absolute; top: 3px; right: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--text); color: var(--bg); font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; letter-spacing: 0;
}

main { max-width: 980px; margin: 0 auto; padding: 0 16px; }

/* ---------- hero */
.hero { padding: 36px 4px 8px; }
.hero-title {
  margin: 0; font-size: clamp(34px, 9.5vw, 56px); line-height: 1.07; font-weight: 700; letter-spacing: -.04em;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
}
.hero-sub { margin: 12px 0 0; font-size: 19px; line-height: 1.4; color: var(--text2); letter-spacing: -.02em; max-width: 34ch; }

.perks { list-style: none; margin: 24px -16px 0; padding: 0 16px 4px; display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; }
.perks::-webkit-scrollbar { display: none; }
.perks li {
  flex: 0 0 auto; scroll-snap-align: start; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border-radius: 14px; padding: 12px 16px 12px 12px; font-size: 14px; line-height: 1.3; font-weight: 500; box-shadow: var(--shadow);
}
.perks svg { width: 24px; height: 24px; color: var(--accent); flex-shrink: 0; }

/* ---------- filters */
.segmented { display: flex; margin: 32px 0 0; padding: 2px; background: rgba(118, 118, 128, .12); border-radius: 10px; }
.segmented button {
  flex: 1; padding: 7px 8px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text);
  transition: background .25s var(--ease), box-shadow .25s var(--ease);
}
.segmented button.on { background: var(--surface); font-weight: 600; box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 3px 1px rgba(0, 0, 0, .04); }
:root[data-theme="dark"] .segmented button.on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segmented button.on { background: #636366; } }

.cats { display: flex; gap: 8px; margin: 18px -16px 0; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button {
  flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 82px; padding: 4px 0;
  font-size: 12px; font-weight: 500; line-height: 1.2; color: var(--text2); text-align: center;
}
.cats .ic {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  color: var(--text); box-shadow: var(--shadow); transition: transform .25s var(--ease), background .25s var(--ease), color .25s var(--ease);
}
.cats .ic svg { width: 28px; height: 28px; stroke-width: 1.4; }
.cats button.on { color: var(--text); font-weight: 600; }
.cats button.on .ic { background: var(--text); color: var(--bg); }
.cats button:active .ic { transform: scale(.94); }

.section-title { margin: 36px 4px 14px; font-size: 24px; line-height: 1.17; font-weight: 700; letter-spacing: -.03em; }

/* ---------- product grid */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.card {
  background: var(--surface); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); cursor: pointer; transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  animation: rise .5s var(--ease) both;
}
.card:active { transform: scale(.98); }
.card .art { margin: 8px 8px 0; border-radius: 14px; }
.card .info { padding: 12px 14px 14px; display: flex; flex-direction: column; flex: 1; }
.eyebrow { margin: 0; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text3); }
.card .name {
  margin: 4px 0 0; font-size: 15px; line-height: 1.3; font-weight: 600; letter-spacing: -.016em;
}
.swatches { display: flex; gap: 6px; margin-top: 8px; }
.swatches:empty { display: none; }
.swatch { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 .5px rgba(0, 0, 0, .25); }
:root[data-theme="dark"] .swatch { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .swatch { box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); } }
.variants { font-size: 12px; color: var(--text3); }
.card .foot { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.price { margin: 0; font-size: 15px; font-weight: 500; letter-spacing: -.01em; white-space: nowrap; }
.plus {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: var(--accent); color: var(--accent-text); transition: transform .2s var(--ease), background .2s;
}
.plus svg { width: 16px; height: 16px; stroke-width: 2.2; }
.plus:active { transform: scale(.9); }

/* Product art: photo when there is one, otherwise a calm line drawing of the category. */
.art { position: relative; aspect-ratio: 1 / 1; overflow: hidden; display: grid; place-items: center; background: var(--art-bg, var(--surface2)); }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 8%; }
.art .glyph { width: 46%; height: 46%; color: var(--art-ink, var(--text3)); stroke-width: 1; }
.art[data-cat="glasses"] { --art-bg: linear-gradient(160deg, #eef3fb, #dde7f5); --art-ink: #4a6fa5; }
.art[data-cat="hygiene"] { --art-bg: linear-gradient(160deg, #eef8f5, #d9efe8); --art-ink: #3c8a74; }
.art[data-cat="beauty"]  { --art-bg: linear-gradient(160deg, #fbf1f2, #f3dfe2); --art-ink: #b06a78; }
.art[data-cat="textile"] { --art-bg: linear-gradient(160deg, #f8f4ee, #ede4d6); --art-ink: #a07c4f; }
.art[data-cat="tea"]     { --art-bg: linear-gradient(160deg, #f3f6ea, #e3ead0); --art-ink: #7a8a3e; }
:root[data-theme="dark"] .art { --art-bg: #2c2c2e !important; --art-ink: #a1a1a6 !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .art { --art-bg: #2c2c2e !important; --art-ink: #a1a1a6 !important; } }
/* Photos are shot on white: in light mode "multiply" melts that white into the soft grey tile;
   in dark mode they sit on a clean white tile instead. */
.art.photo { --art-bg: #f5f5f7 !important; }
.art.photo img { mix-blend-mode: multiply; padding: 5%; }
:root[data-theme="dark"] .art.photo { --art-bg: #ffffff !important; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .art.photo { --art-bg: #ffffff !important; } }
.art-big { border-radius: 18px; aspect-ratio: 4 / 3; margin-top: 4px; }
.art-big .glyph { width: 34%; height: 34%; }
.art-s { width: 72px; flex-shrink: 0; border-radius: 12px; }
.art-s .glyph { width: 52%; height: 52%; stroke-width: 1.3; }

.empty { text-align: center; color: var(--text2); padding: 48px 0; }

/* ---------- buttons */
.btn {
  display: block; width: 100%; min-height: 52px; padding: 14px 22px; border-radius: 980px;
  font-size: 17px; font-weight: 600; letter-spacing: -.02em; text-align: center;
  transition: background .2s var(--ease), transform .15s var(--ease), opacity .2s;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { background: var(--accent-press); }
.btn-primary:disabled { opacity: .4; transform: none; }
.btn-quiet { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }

.stepper {
  display: inline-flex; align-items: center; height: 32px; border-radius: 980px; background: var(--bg); flex-shrink: 0;
}
.stepper button { width: 32px; height: 32px; display: grid; place-items: center; color: var(--accent); }
.stepper button svg { width: 14px; height: 14px; stroke-width: 2.2; }
.stepper span { min-width: 18px; text-align: center; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- cart */
.back { display: inline-flex; align-items: center; gap: 2px; margin: 18px 0 0 -6px; color: var(--accent); font-size: 17px; }
.back svg { width: 22px; height: 22px; stroke-width: 2; }
.page-title { margin: 10px 4px 20px; font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -.035em; }

.meter { background: var(--surface); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.meter p { margin: 0 0 10px; font-size: 14px; color: var(--text2); }
.meter p b { color: var(--text); font-weight: 600; }
.meter.ok p { margin: 0; color: var(--success); font-weight: 600; }
.meter.ok .meter-track { display: none; }
.meter-track { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: 2px; background: var(--accent); transition: width .6s var(--ease); }

.group { background: var(--surface); border-radius: 16px; overflow: hidden; margin-bottom: 14px; box-shadow: var(--shadow); }
.group-title { margin: 34px 4px 12px; font-size: 22px; font-weight: 700; letter-spacing: -.03em; }

.line { display: flex; gap: 14px; align-items: center; padding: 14px 16px; position: relative; }
.line + .line::before { content: ""; position: absolute; top: 0; left: 102px; right: 0; border-top: .5px solid var(--line); }
.line .meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.line .lname { font-size: 15px; font-weight: 600; line-height: 1.3; letter-spacing: -.016em; }
.line .lopt { font-size: 13px; color: var(--text2); }
.line .lfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.line .lprice { font-size: 15px; font-weight: 500; white-space: nowrap; }

.totals { padding: 6px 16px; }
.totals .row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 15px; color: var(--text2); }
.totals .row span:last-child { color: var(--text); }
.totals .total { border-top: .5px solid var(--line); margin-top: 4px; padding: 14px 0 10px; font-size: 19px; font-weight: 700; color: var(--text); letter-spacing: -.025em; }

.fields .field { display: block; padding: 10px 16px 10px; position: relative; }
.fields .field + .field::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--line); }
.field span { display: block; font-size: 12px; font-weight: 500; color: var(--text3); letter-spacing: 0; }
.field input, .field textarea {
  display: block; width: 100%; margin-top: 2px; padding: 0; border: 0; outline: 0; background: none; resize: none;
  font: inherit; font-size: 17px; color: var(--text); letter-spacing: -.02em;
}
.field textarea { min-height: 1.47em; field-sizing: content; }
.field.bad span { color: var(--danger); }
.field:focus-within span { color: var(--accent); }
.footnote { margin: -4px 4px 18px; font-size: 13px; color: var(--text3); line-height: 1.4; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; font-size: 15px; line-height: 1.35; cursor: pointer; }
.switch {
  appearance: none; -webkit-appearance: none; margin: 0; flex-shrink: 0; position: relative;
  width: 51px; height: 31px; border-radius: 16px; background: rgba(120, 120, 128, .16); cursor: pointer;
  transition: background .25s var(--ease);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 3px 1px rgba(0, 0, 0, .06); transition: transform .25s var(--ease);
}
.switch:checked { background: var(--success); }
.switch:checked::after { transform: translateX(20px); }
.switch-row.bad span { color: var(--danger); }

.info { display: flex; gap: 12px; align-items: flex-start; padding: 4px 4px 0; color: var(--text2); }
.info svg { width: 22px; height: 22px; flex-shrink: 0; margin-top: 1px; }
.info p { margin: 0; font-size: 13px; line-height: 1.45; }
.error { margin: 16px 4px 0; padding: 12px 14px; border-radius: 12px; font-size: 14px; color: var(--danger); background: color-mix(in srgb, var(--danger) 9%, transparent); }

/* ---------- done */
.done { text-align: center; padding-top: 12vh; }
.done-mark { width: 88px; height: 88px; color: var(--success); stroke-width: 3; }
.done-mark circle { stroke-dasharray: 227; stroke-dashoffset: 227; animation: draw .7s var(--ease) forwards; }
.done-mark path { stroke-dasharray: 50; stroke-dashoffset: 50; animation: draw .45s .55s var(--ease) forwards; }
.done .page-title { margin-top: 22px; }
.done-text { margin: -6px auto 32px; max-width: 30ch; color: var(--text2); }
.done .btn { max-width: 320px; margin: 0 auto; }

/* ---------- product sheet */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .36); animation: fade .3s var(--ease); }
.sheet-body {
  position: relative; background: var(--surface); border-radius: 22px 22px 0 0; max-height: 92vh; overflow-y: auto;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom)); animation: up .45s var(--ease);
  width: 100%; max-width: 640px; margin: 0 auto;
}
.sheet.closing .sheet-body { animation: down .25s var(--ease) forwards; }
.sheet.closing .sheet-backdrop { animation: fade .25s var(--ease) reverse forwards; }
.sheet-grip { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet-x {
  position: absolute; top: 14px; right: 14px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(118, 118, 128, .14); color: var(--text2);
}
.sheet-x svg { width: 14px; height: 14px; stroke-width: 2.4; }
.sheet-body .eyebrow { margin-top: 20px; }
.sheet-name { margin: 6px 0 0; font-size: 28px; line-height: 1.14; font-weight: 700; letter-spacing: -.035em; }
.sheet-desc { margin: 10px 0 0; font-size: 17px; color: var(--text2); line-height: 1.47; }
.opt-label { margin: 24px 0 10px; font-size: 15px; font-weight: 600; }
.options { display: flex; flex-wrap: wrap; gap: 10px; }
.options button {
  display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; font-size: 15px;
  box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .2s var(--ease);
}
.options button.on { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 600; }
.options .swatch { width: 18px; height: 18px; }
.sheet-buy { display: flex; align-items: center; gap: 16px; margin-top: 28px; }
.sheet-price { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.sheet-buy .btn { flex: 1; }

/* ---------- bottom bar + toast */
.bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--glass); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--line); animation: up .4s var(--ease);
}
.bar .btn { max-width: 640px; margin: 0 auto; }
.toast {
  position: fixed; left: 50%; top: calc(64px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 40;
  display: flex; align-items: center; gap: 8px; padding: 10px 18px 10px 14px; border-radius: 980px; max-width: 90vw;
  font-size: 15px; font-weight: 500; color: var(--text); background: var(--glass);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .12); animation: drop .35s var(--ease);
}
.toast svg { width: 18px; height: 18px; color: var(--success); stroke-width: 2.4; }

@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes down { to { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes drop { from { opacity: 0; transform: translate(-50%, -12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
