:root {
  --green: #0f8a5f;
  --green-dark: #0a6847;
  --green-soft: #e7f5ee;
  --ink: #17231e;
  --muted: #5d6b64;
  --line: #dfe7e2;
  --bg: #ffffff;
  --bg-alt: #f5f8f6;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body { margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 2rem; margin-bottom: 1.2rem; }
h3 { font-size: 1.1rem; }
.container { width: min(1120px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* Header */
.header { position: sticky; top: 0; z-index: 20; background: rgba(255,255,255,.95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header__row { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; text-decoration: none; }
.logo__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: #fff; }
.nav { display: flex; gap: 22px; margin-left: auto; }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--green); }
.header__phone { font-weight: 700; text-decoration: none; white-space: nowrap; }
.cart-btn { display: flex; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: var(--green); color: #fff; font: inherit; font-weight: 600; padding: 9px 16px; cursor: pointer; }
.cart-btn:hover { background: var(--green-dark); }
.cart-btn__count { min-width: 22px; padding: 0 6px; border-radius: 99px; background: #fff; color: var(--green); font-size: .85rem; text-align: center; }

/* Hero */
.hero { background: linear-gradient(135deg, var(--green-soft), #fff 70%); padding: 72px 0; }
.hero__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.hero h1 span { color: var(--green); display: block; }
.hero__lead { font-size: 1.15rem; color: var(--muted); max-width: 520px; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }
.hero__facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hero__facts li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; color: var(--muted); }
.hero__facts b { display: block; color: var(--ink); font-size: 1.15rem; }

/* Buttons & inputs */
.btn { display: inline-block; border: 1px solid transparent; border-radius: 10px; padding: 12px 22px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; text-align: center; }
.btn--primary { background: var(--green); color: #fff; }
.btn--primary:hover { background: var(--green-dark); }
.btn--ghost { background: #fff; border-color: var(--line); }
.btn--ghost:hover { border-color: var(--green); color: var(--green); }
.btn--block { display: block; width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }
.input:focus, .btn:focus-visible, .chip:focus-visible, .cart-btn:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.icon-btn { border: 0; background: none; font-size: 1.2rem; cursor: pointer; padding: 6px 10px; border-radius: 8px; }
.icon-btn:hover { background: var(--bg-alt); }

/* Sections */
.section { padding: 64px 0; }
.section--alt { background: var(--bg-alt); }
.toolbar { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-bottom: 24px; }
.toolbar .input { max-width: 260px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 7px 16px; font: inherit; cursor: pointer; }
.chip:hover { border-color: var(--green); }
.chip.is-active { background: var(--green); border-color: var(--green); color: #fff; }

/* Products */
/* flex вместо grid: неполный ряд (и 1–3 товара) центрируется, а не прижимается влево */
.grid { --cols: 4; --gap: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: var(--gap); }
.grid > .product { flex: 0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols)); min-width: 0; }
.grid > p { flex: 1 1 100%; text-align: center; }
@media (max-width: 1100px) { .grid { --cols: 3; } }
@media (max-width: 780px) { .grid { --cols: 2; --gap: 14px; } }
@media (max-width: 520px) { .grid { --cols: 1; } }
.product { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; transition: box-shadow .15s, transform .15s; }
.product:hover { box-shadow: 0 8px 24px rgba(15,60,40,.1); transform: translateY(-2px); }
.product__img { display: grid; place-items: center; aspect-ratio: 1 / 1; background: var(--green-soft); }
.product__img img { width: 100%; height: 100%; object-fit: cover; }
.product__img svg { width: 84px; height: 84px; }
.product__body { display: flex; flex-direction: column; flex: 1; padding: 16px; gap: 6px; }
.product__cat { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--green); font-weight: 700; }
.product__name { font-size: 1.05rem; margin: 0; }
.product__meta { font-size: .88rem; color: var(--muted); margin: 0; }
.product__info { display: flex; flex-direction: column; gap: 6px; flex: 1; }
/* нижняя часть карточки: одинаковая высота у всех товаров, прижата ко дну */
.product__action { display: flex; flex-direction: column; margin-top: 10px; }
.product .seg { margin-top: 0; height: 36px; flex: none; }
.product .seg--ph { visibility: hidden; }
.prices { padding: 12px 0 10px; min-height: 118px; display: grid; gap: 4px; align-content: start; }
.prices small { display: block; }
.prices__retail { font-size: 1.3rem; font-weight: 800; }
.prices__retail small, .prices__opt small { font-weight: 400; color: var(--muted); font-size: .8rem; }
.prices__opt { font-size: .9rem; color: var(--green-dark); font-weight: 600; }
.buy { display: flex; gap: 8px; margin-top: 0; height: 40px; }
.qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; }
.qty button { border: 0; background: none; width: 32px; height: 38px; font-size: 1.1rem; cursor: pointer; }
.qty input { width: 44px; border: 0; text-align: center; font: inherit; background: none; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.buy .btn { flex: 1; padding: 9px 12px; }

/* Cards, steps */
.cards3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.card p { margin: 0; color: var(--muted); }
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.steps li { counter-increment: s; position: relative; padding-top: 52px; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 700; }
.steps b { display: block; color: var(--ink); margin-bottom: 2px; }

/* Footer */
.footer { background: #12201a; color: #c5d3cb; padding: 48px 0; }
.footer h3 { color: #fff; }
.footer a { text-decoration: none; }
.footer p { margin: 0 0 12px; }
.footer__row { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.logo--light { color: #fff; margin-bottom: 8px; }

/* Cart drawer */
.overlay { position: fixed; inset: 0; background: rgba(10,20,15,.5); z-index: 30; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(440px, 100%); background: #fff; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s; box-shadow: -8px 0 32px rgba(0,0,0,.15); }
.drawer.is-open { transform: none; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { margin: 0; font-size: 1.3rem; }
.drawer__body { flex: 1; overflow-y: auto; padding: 16px 20px 24px; }
.cart-empty { text-align: center; color: var(--muted); padding: 24px 0; }
.line { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line__name { font-weight: 600; }
.line__sum { font-weight: 700; text-align: right; }
.line__price { font-size: .85rem; color: var(--muted); }
.line__price.is-opt { color: var(--green-dark); font-weight: 600; }
.line__rm { border: 0; background: none; color: var(--muted); cursor: pointer; font: inherit; font-size: .85rem; text-align: right; }
.line__rm:hover { color: #c0392b; }
.form { display: grid; gap: 12px; margin-top: 20px; }
.form label { display: grid; gap: 4px; font-size: .9rem; font-weight: 600; }
.form .input { font-weight: 400; }
.form__error { color: #c0392b; margin: 0; min-height: 1.2em; font-size: .9rem; }
.total { display: flex; justify-content: space-between; font-size: 1.2rem; }
.success { text-align: center; padding: 40px 0; }

@media (max-width: 860px) {
  .nav, .header__phone { display: none; }
  .cart-btn { margin-left: auto; }
  .hero { padding: 40px 0; }
  .hero__grid { grid-template-columns: 1fr; }
  .section { padding: 44px 0; }
}

[hidden] { display: none !important; }

.seg { display: flex; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: #fff; padding: 6px 8px; font: inherit; font-size: .85rem; cursor: pointer; }
.seg button.is-active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }

.form label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.form label.check input { width: 18px; height: 18px; accent-color: var(--green); }

.seg--form { margin-top: 0; }
.seg--form button { padding: 9px 8px; font-size: .92rem; }

/* Страница товара */
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 20px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--green); }
.crumbs span { margin: 0 4px; }
.pp { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.pp__img { border-radius: var(--radius); overflow: hidden; background: var(--green-soft); aspect-ratio: 1 / 1; }
.pp__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 4px 0 8px; }
.pp__prices { margin: 20px 0; padding: 16px 0; border-block: 1px solid var(--line); display: grid; gap: 6px; }
.pp__price b { font-size: 1.6rem; }
.pp__price span, .pp__opt span { color: var(--muted); font-size: .9rem; }
.pp__opt { color: var(--green-dark); font-weight: 600; }
.pp__buy { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pp__buy .qty { height: 44px; }
.pp__added { margin-top: 14px; color: var(--green-dark); font-weight: 600; }
.pp__added a { color: inherit; }
.product__name a { text-decoration: none; color: inherit; }
.product__name a:hover { color: var(--green); }
.product__img a { display: block; width: 100%; height: 100%; }
@media (max-width: 760px) { .pp { grid-template-columns: 1fr; gap: 20px; } }

a.cart-btn { text-decoration: none; }

/* Значок «i» с описанием поверх фото */
.product__img { position: relative; }
.info { position: absolute; top: 10px; right: 10px; z-index: 3; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: rgba(255,255,255,.92); color: var(--green-dark); font: italic 700 15px/1 Georgia, "Times New Roman", serif; cursor: pointer; transition: background .15s, color .15s; }
.info:hover, .info:focus-visible, .product.is-open .info { background: var(--green); border-color: var(--green); color: #fff; }
.pop { position: absolute; inset: 0; z-index: 2; padding: 48px 16px 16px; overflow-y: auto; background: #fff; font-size: .92rem; line-height: 1.5; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s; }
.pop p { margin: 0 0 10px; white-space: pre-line; }
.pop a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.pop a:hover { text-decoration: underline; }
/* наведение — просто подсказка; клик закрепляет её и делает прокручиваемой/кликабельной */
.info:hover ~ .pop, .info:focus-visible ~ .pop { opacity: 1; visibility: visible; }
.product.is-open .pop { opacity: 1; visibility: visible; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .pop, .info { transition: none; } }

/* Самовывоз и доставка (тексты из админки) */
.terms { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.terms__text p { margin: 0 0 10px; color: var(--muted); }
.terms__text ul { margin: 0 0 10px; padding-left: 20px; color: var(--muted); }
.terms__text li { margin-bottom: 4px; }
.terms__text > :last-child { margin-bottom: 0; }
.card h3 a, .card p a { color: var(--green-dark); font-weight: 600; text-decoration: none; }
.card p a:hover { text-decoration: underline; }
