/* ============================================================
   GALAB-BG — design system v2
   Type: Nunito (display) + Inter (body), both with Cyrillic
   Palette: warm paper / deep forest green / amber
   ============================================================ */
:root {
  --bg: #f6f3ed;
  --bg-soft: #efeade;
  --card: #fffdf9;
  --ink: #242a25;
  --muted: #7a756c;
  --line: #e6e0d3;
  --accent: #1b6a52;
  --accent-dark: #0f4c3a;
  --accent-soft: #e2efe6;
  --amber: #e9a63c;
  --amber-ink: #4d3409;
  --danger: #b3402f;
  --danger-soft: #f7e9e5;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(35, 42, 36, .06);
  --shadow: 0 2px 6px rgba(35, 42, 36, .06), 0 18px 44px rgba(35, 42, 36, .09);
  --shadow-lg: 0 4px 12px rgba(35, 42, 36, .1), 0 32px 70px rgba(35, 42, 36, .18);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-display: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
/* Element resets stop at the admin (html.admin-theme) so shadcn can style itself. */
:where(html:not(.admin-theme)) a { color: inherit; text-decoration: none; }
:where(html:not(.admin-theme)) button { font: inherit; color: inherit; }
:where(html:not(.admin-theme)) ::selection { background: var(--accent-soft); color: var(--accent-dark); }
:where(html:not(.admin-theme)) :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

:where(html:not(.admin-theme)) h1,
:where(html:not(.admin-theme)) h2,
:where(html:not(.admin-theme)) h3,
:where(html:not(.admin-theme)) h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.14;
  letter-spacing: -0.022em;
  margin: 0 0 .55em;
}
:where(html:not(.admin-theme)) h1 { font-size: clamp(1.8rem, 3.4vw, 2.4rem); }
:where(html:not(.admin-theme)) h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); }
:where(html:not(.admin-theme)) h3 { font-size: 1.12rem; }
:where(html:not(.admin-theme)) p { margin: 0 0 1em; }

:where(html:not(.admin-theme)) .container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ── header ─────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(246, 243, 237, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 68px; }
.logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display);
  font-weight: 900; font-size: 1.16rem; letter-spacing: -.02em;
}
.logo b { color: var(--accent); }

.top-nav { display: flex; gap: 20px; align-items: center; }
.top-nav a { color: var(--muted); font-weight: 600; font-size: .95rem; transition: color .15s; }
.top-nav a:hover { color: var(--ink); }
.nav-phone { font-variant-numeric: tabular-nums; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lang-switch {
  font-size: .84rem; font-weight: 700; padding: 7px 13px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  transition: border-color .15s, color .15s, transform .15s;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent-dark); }
.cart-link { position: relative; display: flex; padding: 9px; border-radius: 11px; transition: background .15s; }
.cart-link:hover { background: var(--accent-soft); }
.cart-badge {
  position: absolute; top: -2px; right: -4px;
  background: var(--accent); color: #fff;
  font-size: .68rem; font-weight: 700; line-height: 1;
  padding: 4px 6px; border-radius: 999px; min-width: 18px; text-align: center;
  box-shadow: 0 2px 6px rgba(27, 106, 82, .4);
}

/* ── hero ───────────────────────────────────────────────── */
.hero { position: relative; overflow: hidden; background: var(--accent-dark); }
.hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center 62%;
  transform: scale(1.03); filter: saturate(1.08);
}
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(7, 26, 19, .92) 0%, rgba(7, 26, 19, .58) 46%, rgba(7, 26, 19, .12) 100%);
}
.hero-inner {
  position: relative; z-index: 1;
  padding: clamp(64px, 9vw, 104px) 20px clamp(56px, 8vw, 92px);
  color: #fff;
}
.hero-inner h1 {
  font-size: clamp(2.2rem, 6vw, 3.7rem);
  max-width: 20ch; margin-bottom: 15px;
  letter-spacing: -0.028em;
}
.hero-inner p { max-width: 50ch; font-size: 1.09rem; opacity: .93; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: 999px; border: 0; cursor: pointer;
  font: inherit; font-weight: 700; font-size: .97rem;
  transition: transform .14s ease, background .16s, box-shadow .16s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 8px 20px rgba(27, 106, 82, .34);
}
.btn-primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.btn-primary:disabled { background: #b9c4bb; box-shadow: none; cursor: not-allowed; transform: none; }
.btn-ghost {
  background: rgba(255, 255, 255, .13); color: #fff;
  border: 1px solid rgba(255, 255, 255, .55);
  backdrop-filter: blur(6px);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .25); }
.btn-lg { padding: 16px 30px; font-size: 1.04rem; width: 100%; }

/* ── sections ───────────────────────────────────────────── */
.section { padding: 46px 20px; }
.section > h2 { margin-bottom: 20px; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.section-head h2 { margin-bottom: 0; }
.link-more { color: var(--accent-dark); font-weight: 700; font-size: .92rem; transition: opacity .15s; }
.link-more:hover { opacity: .75; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 20px; }
.crumbs a:hover { color: var(--accent-dark); }
.crumbs span { color: var(--ink); }
.cat-heading { margin: 34px 0 20px; }

/* ── cards ──────────────────────────────────────────────── */
:where(html:not(.admin-theme)) .grid { display: grid; gap: 18px; align-items: stretch; }
.prod-grid { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); }
.cat-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.cat-grid > .card { max-width: 540px; }
.how-grid { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }

.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: #d9d2c2; }
.card-media { aspect-ratio: 4 / 3; background: var(--bg-soft); position: relative; overflow: hidden; }
.card-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .45s cubic-bezier(.2, .7, .3, 1);
}
.card:hover .card-media img { transform: scale(1.055); }
.cat-card .card-media { aspect-ratio: 16 / 10; }
.card-body {
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 18px 18px; flex: 1;
}
.card-body h3 { margin: 0; font-size: 1.03rem; letter-spacing: -.01em; flex: 1; }
.card-price {
  font-weight: 800; font-size: 1.07rem; font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 6px;
}
.card-price .muted { font-weight: 600; }

.badge {
  position: absolute; top: 12px; left: 12px; z-index: 2;
  font-size: .72rem; font-weight: 800; padding: 5px 11px; border-radius: 999px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(8px);
}
.badge-in {
  background: rgba(226, 239, 230, .92); color: var(--accent-dark);
  border: 1px solid rgba(27, 106, 82, .28);
}
.badge-out {
  background: rgba(247, 233, 229, .92); color: var(--danger);
  border: 1px solid rgba(179, 64, 47, .28);
}

/* ── how-to-order steps ─────────────────────────────────── */
.how-item {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 18px 19px; box-shadow: var(--shadow-sm);
}
.how-item b { display: block; margin-bottom: 3px; font-size: .98rem; }
.how-item .muted { font-size: .88rem; margin: 0; line-height: 1.5; }
.how-num {
  flex: 0 0 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-dark);
  font-family: var(--font-display); font-weight: 900; border-radius: 999px;
}

/* ── product page ───────────────────────────────────────── */
.product-layout { display: grid; grid-template-columns: 1.02fr .98fr; gap: 42px; align-items: start; }
@media (max-width: 880px) { .product-layout { grid-template-columns: 1fr; gap: 24px; } }

.gallery { position: sticky; top: 92px; }
@media (max-width: 880px) { .gallery { position: static; } }
.gallery-main {
  border-radius: 20px; overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-soft);
  box-shadow: var(--shadow-sm);
}
.gallery-main img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.gthumb {
  width: 70px; height: 70px; padding: 0; cursor: pointer;
  border: 2px solid transparent; border-radius: 12px; overflow: hidden;
  background: var(--bg-soft); transition: border-color .15s, transform .15s;
}
.gthumb:hover { transform: translateY(-2px); }
.gthumb.active { border-color: var(--accent); }
.gthumb img { width: 100%; height: 100%; object-fit: cover; }

.p-stock { color: var(--accent-dark); font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
.p-stock.out { color: var(--danger); }
.p-price {
  font-family: var(--font-display);
  font-size: 2.05rem; font-weight: 900; letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  display: flex; align-items: baseline; gap: 8px;
}
.p-price .muted { font-family: var(--font-body); font-weight: 600; }

.option-block { margin-bottom: 20px; }
.option-block > label { display: block; font-weight: 700; font-size: .92rem; margin-bottom: 9px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 17px; border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); font-size: .93rem; font-weight: 600;
  font-variant-numeric: tabular-nums; cursor: pointer;
  transition: border-color .13s, background .15s, color .15s, transform .13s;
}
.chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.chip.selected { background: var(--accent); border-color: var(--accent); color: #fff; }

.buy-row { display: flex; gap: 14px; margin: 22px 0 14px; flex-wrap: wrap; align-items: center; }
.buy-row .btn-primary { flex: 1; min-width: 190px; }
.qty-stepper {
  display: inline-flex; align-items: center;
  border: 1.5px solid var(--line); border-radius: 999px;
  background: var(--card); overflow: hidden;
}
.qty-stepper button {
  width: 44px; height: 48px; border: 0; background: none; cursor: pointer;
  font-size: 1.18rem; font-weight: 700; color: var(--muted);
  transition: color .15s, background .15s;
}
.qty-stepper button:hover { color: var(--accent-dark); background: var(--accent-soft); }
.qty-stepper input {
  width: 48px; height: 48px; border: 0; text-align: center;
  font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; background: transparent;
  -moz-appearance: textfield; appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.p-meta { margin-bottom: 20px; }
.p-desc { border-top: 1px solid var(--line); padding-top: 20px; margin-top: 6px; }
.p-desc p { margin-bottom: 14px; line-height: 1.65; }

/* sticky mobile buy bar */
.mobile-buy { display: none; }
@media (max-width: 700px) {
  .mobile-buy {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    display: flex; align-items: center; gap: 14px;
    background: rgba(255, 253, 249, .94);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px rgba(35, 42, 36, .1);
  }
  .mobile-buy .btn { flex: 1; }
  .product-page { padding-bottom: 120px; }
}

/* ── cart ───────────────────────────────────────────────── */
.cart-row {
  display: grid; grid-template-columns: 78px 1fr auto auto; gap: 14px; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; margin-bottom: 12px;
  transition: box-shadow .15s;
}
.cart-row:hover { box-shadow: var(--shadow-sm); }
.cart-row img { width: 78px; height: 78px; object-fit: cover; border-radius: var(--radius-sm); background: var(--bg-soft); }
.cart-row .qty-stepper { transform: scale(.94); transform-origin: right center; }
.cart-remove {
  border: 0; background: none; color: var(--muted); font-size: 1.05rem;
  cursor: pointer; padding: 8px; border-radius: 999px; line-height: 1;
  transition: color .15s, background .15s;
}
.cart-remove:hover { color: var(--danger); background: var(--danger-soft); }
@media (max-width: 620px) {
  .cart-row { grid-template-columns: 64px 1fr; row-gap: 10px; }
  .cart-row img { width: 64px; height: 64px; }
}
.cart-summary { max-width: 440px; display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.cart-summary .btn { width: 100%; }

/* ── checkout ───────────────────────────────────────────── */
.checkout-layout { display: grid; grid-template-columns: 1fr .9fr; gap: 28px; align-items: start; }
@media (max-width: 900px) { .checkout-layout { grid-template-columns: 1fr; } }

.form-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.form-card h3 { margin-bottom: 16px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .87rem; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; padding: 12px 14px; font: inherit;
  border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #fbfaf6;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(27, 106, 82, .14);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.form-error {
  background: var(--danger-soft); color: var(--danger);
  border-radius: 10px; padding: 11px 14px; font-size: .89rem; font-weight: 600;
}

/* summary card */
.summary-card {
  position: sticky; top: 92px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.sum-items-list {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 10px; border-bottom: 1px dashed var(--line);
}
.sum-item { display: flex; justify-content: space-between; gap: 10px; font-size: .92rem; }
.sum-line { display: flex; justify-content: space-between; align-items: baseline; }
.sum-line.total { border-top: 2px solid var(--ink); padding-top: 10px; }
.sum-line.total b { color: var(--accent-dark); font-size: 1.32rem; font-variant-numeric: tabular-nums; }

/* ── success ────────────────────────────────────────────── */
.success-page { display: flex; justify-content: center; }
.success-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); max-width: 560px; width: 100%;
  padding: 46px 38px; margin: 40px 0; text-align: center;
}
.success-icon {
  width: 66px; height: 66px; margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-dark);
  font-family: var(--font-display); font-size: 2rem; font-weight: 900;
  border-radius: 999px;
}
.order-num-box {
  display: flex; justify-content: space-between; align-items: center;
  margin: 22px 0; padding: 15px 17px;
  background: var(--accent-soft); border-radius: var(--radius-sm);
}
.order-num-box b {
  font-family: var(--font-display); font-size: 1.14rem;
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}
.success-summary {
  text-align: left; font-size: .93rem; margin-bottom: 22px;
  display: flex; flex-direction: column; gap: 7px;
}
.s-row { display: flex; justify-content: space-between; gap: 10px; }

/* ── footer (dark) ──────────────────────────────────────── */
.site-footer { background: #14211a; color: #cfdad2; margin-top: 24px; }
.footer-grid { display: grid; grid-template-columns: 1.35fr 1fr 1fr; gap: 30px; padding: 44px 20px 28px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-grid h4 { color: #fff; font-size: .95rem; margin: 0 0 11px; }
.footer-grid a { display: block; color: rgba(215, 226, 218, .72); font-size: .92rem; margin-bottom: 8px; transition: color .15s; }
.footer-grid a:hover { color: #fff; }
.footer-grid p { color: rgba(215, 226, 218, .68); }
.footer-logo { margin-bottom: 10px; }
.footer-logo span { color: #fff; }
.footer-logo b { color: #3ecf9a; }
.footer-base {
  padding: 15px 20px 23px;
  border-top: 1px solid rgba(255, 255, 255, .1);
  color: rgba(215, 226, 218, .55);
}

/* ── toast ──────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translateX(-50%) translateY(18px);
  background: var(--ink); color: #fff;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 600; font-size: .92rem;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow-lg);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 700px) {
  .toast { bottom: 84px; } /* above mobile buy bar */
}

/* ── mobile header (phone number lives in the hero/footer on small screens) ── */
@media (max-width: 640px) {
  .header-inner { height: 58px; gap: 12px; }
  .logo { font-size: 1.02rem; gap: 8px; white-space: nowrap; }
  .top-nav { gap: 12px; }
  .top-nav a { font-size: .85rem; }
  .nav-phone { display: none; }
  .lang-switch { padding: 6px 10px; font-size: .78rem; }
  .cart-link { padding: 7px; }
}
/* phones: the row must fit 320px — logo links home, so "Начало" is redundant */
@media (max-width: 480px) {
  .site-header .container { padding: 0 14px; }
  .header-inner { height: 56px; gap: 10px; }
  .logo { font-size: .95rem; gap: 7px; flex-shrink: 0; }
  .top-nav { gap: 11px; }
  .top-nav a { font-size: .85rem; }
  .top-nav .nav-home { display: none; }
  .header-actions { gap: 10px; }
  .lang-switch { padding: 6px 10px; font-size: .78rem; }
  .cart-link { padding: 7px; }
}
