:root {
  color-scheme: light;
  --blue: #00a0e3;
  --blue-dark: #0086c0;
  --gold: #fecc00;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --field: #f0f0f3;
  --line: rgba(0, 0, 0, 0.1);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
  --radius: 20px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-h: 52px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display",
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3 {
  letter-spacing: -0.03em;
  line-height: 1.06;
  font-weight: 700;
  margin: 0;
}

p { margin: 0; }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ---------- Навигация ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1024px;
  margin: 0 auto;
  height: var(--nav-h);
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.nav-links::-webkit-scrollbar { display: none; }

.nav-links a {
  color: var(--ink);
  opacity: 0.82;
  font-size: 0.8125rem;
  white-space: nowrap;
  transition: opacity 0.25s var(--ease);
}
.nav-links a:hover { opacity: 1; text-decoration: none; }

/* ---------- Общие блоки ---------- */

.container { max-width: 1024px; margin: 0 auto; }

.section { padding: clamp(72px, 11vw, 128px) 22px; }
.section.alt { background: var(--bg-alt); }

.section-head {
  max-width: 700px;
  margin: 0 auto clamp(40px, 6vw, 64px);
  text-align: center;
}

.section-head h2 {
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.section-head p {
  margin-top: 16px;
  font-size: clamp(1.0625rem, 2vw, 1.3125rem);
  color: var(--muted);
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(72px, 12vw, 132px) 22px clamp(64px, 10vw, 112px);
}

.hero::before {
  content: "";
  position: absolute;
  top: -280px;
  left: 50%;
  width: 900px;
  height: 900px;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(254, 204, 0, 0.16), transparent 62%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero-logo {
  display: block;
  width: min(100%, 620px);
  height: auto;
  margin: 0 auto clamp(26px, 4vw, 38px);
}

/* Скрывает элемент визуально, оставляя его скринридерам и поисковым роботам. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  white-space: nowrap;
  clip-path: inset(50%);
}

/* Перебивает .hero > * { position: relative }, иначе заголовок остался бы в потоке. */
.hero > .visually-hidden { position: absolute; }

.hero-lead {
  max-width: 620px;
  margin: clamp(20px, 3vw, 28px) auto 0;
  font-size: clamp(1.125rem, 2.4vw, 1.5rem);
  line-height: 1.4;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: clamp(30px, 4vw, 42px);
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 980px;
  padding: 12px 26px;
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  background: var(--blue);
  color: #fff;
  transition: background 0.25s var(--ease), opacity 0.25s var(--ease);
}
.btn:hover { background: var(--blue-dark); text-decoration: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.ghost {
  background: transparent;
  color: var(--blue);
  border-color: rgba(0, 160, 227, 0.4);
}
.btn.ghost:hover { background: rgba(0, 160, 227, 0.1); }

.btn.block { width: 100%; }
.btn.lg { padding: 14px 32px; font-size: 1.0625rem; }

/* ---------- Продукция ---------- */

.product-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  margin-bottom: 30px;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 380px;
}

.search-box input {
  width: 100%;
  padding: 12px 40px 12px 42px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.search-box input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 160, 227, 0.18);
}

/* Убираем нативный крестик Chrome/Safari — есть своя кнопка. */
.search-box input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: var(--muted);
  pointer-events: none;
}

#product-search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 26px;
  height: 26px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
#product-search-clear:hover { background: var(--line); color: var(--ink); }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.chip:hover { border-color: var(--blue); }

.chip.is-active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.chip-count {
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.chip.is-active .chip-count { color: rgba(255, 255, 255, 0.75); }

/* Категория без совпадений остаётся кликабельной, но гаснет. */
.chip.is-empty:not(.is-active) { opacity: 0.4; }

.product-count {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.product-group + .product-group { margin-top: 42px; }

.product-group-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1.375rem;
  letter-spacing: -0.02em;
}

.product-group-count {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--field);
  font-size: 0.8125rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.product-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.product-media {
  aspect-ratio: 4 / 3;
  background: linear-gradient(150deg, rgba(254, 204, 0, 0.18), rgba(0, 160, 227, 0.1));
  display: grid;
  place-items: center;
  overflow: hidden;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-media img.is-fallback { width: 46%; height: auto; object-fit: contain; opacity: 0.55; }

.product-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.product-cat {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.product-body h3 { font-size: 1.1875rem; letter-spacing: -0.02em; }

.product-desc {
  font-size: 0.9375rem;
  color: var(--muted);
  flex: 1;
}

.product-price {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.product-max { font-size: 0.8125rem; color: var(--muted); }

/* ---------- Степпер ---------- */

.stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  background: var(--field);
  border-radius: 980px;
  padding: 4px;
  align-self: flex-start;
}

.stepper button {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--blue);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s var(--ease);
}
.stepper button:hover:not(:disabled) { background: rgba(0, 160, 227, 0.14); }
.stepper button:disabled { opacity: 0.3; cursor: not-allowed; }

.stepper input {
  width: 48px;
  border: none;
  background: transparent;
  color: var(--ink);
  text-align: center;
  font: inherit;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Формы ---------- */

.form-card {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 4vw, 40px);
}

.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 13px 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 160, 227, 0.18);
}

.field textarea { resize: vertical; min-height: 96px; }

.choice-row { display: flex; gap: 10px; flex-wrap: wrap; }

.choice {
  flex: 1 1 140px;
  position: relative;
}
.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice span {
  display: block;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: center;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
}
.choice input:checked + span {
  border-color: var(--blue);
  background: rgba(0, 160, 227, 0.1);
  color: var(--blue);
  font-weight: 500;
}

/* ---------- Сводка заказа ---------- */

.summary {
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 13px 16px;
  font-size: 0.9375rem;
  border-bottom: 1px solid var(--line);
}
.summary-row:last-child { border-bottom: none; }

.summary-row .qty { color: var(--muted); font-size: 0.875rem; }

.summary-row.total {
  background: var(--field);
  font-weight: 600;
  font-size: 1.0625rem;
}

.summary-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---------- Плавающая панель корзины ---------- */

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 10px 10px 22px;
  border-radius: 980px;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.16);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.5s var(--ease), opacity 0.4s var(--ease);
}
.cart-bar.show { transform: translate(-50%, 0); opacity: 1; }

.cart-bar-info { font-size: 0.9375rem; white-space: nowrap; }
.cart-bar-info strong { font-weight: 600; }
.cart-bar-info span { color: var(--muted); }

/* ---------- Контакты ---------- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.contact-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
}

.contact-card .label {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}

.contact-card .value { font-size: 1.0625rem; }

/* ---------- Уведомления ---------- */

.alert {
  padding: 13px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  font-size: 0.9375rem;
}
.alert.error {
  background: rgba(255, 59, 48, 0.12);
  color: #d7382f;
}
.alert.success {
  background: rgba(52, 199, 89, 0.14);
  color: #1d8a3c;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* ---------- Подвал ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 40px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 0.8125rem;
}
.footer a { color: var(--muted); }

/* ---------- Появление при прокрутке ---------- */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .product-card:hover { transform: none; }
  .cart-bar { transition: opacity 0.2s linear; }
}
