:root {
  --nav-height: 60px;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(12, 15, 20, 0.08);
  --glass-blur: 14px;

  --font-sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --bg-page: #f5f6fa;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-subtle: rgba(12, 15, 20, 0.04);
  --text-main: #0c0f14;
  --text-muted: rgba(12, 15, 20, 0.58);
  --border-subtle: rgba(12, 15, 20, 0.04);
  --shadow-soft: 0 2px 8px rgba(12, 15, 20, 0.04), 0 12px 32px rgba(12, 15, 20, 0.06);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.02), 0 4px 16px rgba(12, 15, 20, 0.05);
  --shadow-card-hover: 0 4px 12px rgba(12, 15, 20, 0.06), 0 16px 40px rgba(12, 15, 20, 0.08);
  --radius-card: 20px;
  --radius-sm: 8px;
  --radius-medium: 14px;
  /* Совместимость: этим именем размечено полтора десятка правил. Само
     значение задаётся в base.css одним набором на весь магазин. */
  --focus-ring: var(--focus-field-shadow);
  --input-bg: #f0f2f5;
  --motion-fast: 160ms;
  --motion-base: 220ms;
  --motion-slow: 320ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::after {
  background-image:
    radial-gradient(ellipse 120% 120% at 100% 100%, rgba(200, 255, 42, 0.12), rgba(200, 255, 42, 0.04) 40%, transparent 70%),
    radial-gradient(ellipse 80% 80% at 10% 0%, rgba(0, 0, 0, 0.06), transparent 55%);
}

h1,
h2,
h3,
.card-title,
.section-title {
  letter-spacing: -0.02em;
}

::selection {
  background: rgba(200, 255, 42, 0.55);
  color: #000;
}

/* Общее правило фокуса переехало в base.css: его грузят все три макета —
   витрина, кабинет продавца и админка, — а этот файл только витрина. */

.page-header {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--glass-border);
}

.page-header .header-inner {
  padding-top: 12px;
  padding-bottom: 12px;
}

.page-footer {
  background: var(--glass-bg);
  backdrop-filter: blur(calc(var(--glass-blur) - 2px));
  -webkit-backdrop-filter: blur(calc(var(--glass-blur) - 2px));
  border-top: 1px solid var(--glass-border);
}

.card {
  background: #ffffff;
  border: 1px solid rgba(12, 15, 20, 0.04);
  border-radius: 20px;
}


.cart-modal-overlay {
  z-index: 1100;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-top: 1px solid var(--glass-border);
  z-index: 100;
  padding-bottom: var(--safe-bottom);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.04);
}

.mobile-bottom-nav__inner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 100%;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1;
  height: 100%;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--motion-base) var(--motion-ease);
}

.mobile-nav-item .bi {
  font-size: 22px;
  line-height: 1;
  transition: color var(--motion-base) var(--motion-ease);
}

.mobile-nav-item.is-active {
  color: var(--text-main);
}

.mobile-nav-cart-count {
  position: absolute;
  top: 6px;
  right: calc(50% - 14px);
  background: var(--accent-color);
  color: #000;
  font-size: 9px;
  font-weight: 700;
  height: 14px;
  min-width: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  border: 1px solid #fff;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: block;
  }

  .cart-toast-container {
    bottom: calc(var(--nav-height) + 18px + var(--safe-bottom));
  }

  .page-footer {
    padding-bottom: calc(var(--nav-height) + 20px + var(--safe-bottom));
  }

  .main-nav,
  .header-actions .nav-toggle {
    display: none;
  }

  .header-inner {
    justify-content: center;
    padding: 12px;
  }

  /* Корзина вынута из потока, чтобы логотип стоял ровно по центру строки. Без
     собственного top она вставала туда, где оказалась бы в потоке, — то есть по
     центру всей шапки, — и нижним краем наезжала на строку поиска, которая
     переносится на вторую строку. Привязываем её к строке логотипа: 12px —
     верхний отступ .header-inner, 44px — высота логотипа. */
  .header-actions {
    position: absolute;
    top: 12px;
    right: 14px;
    height: 44px;
  }

  .logo-wrapper img {
    height: 44px;
  }
}

.home-hero h1 {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.03em;
}

.home-hero__primary {
  background: radial-gradient(circle at top right, rgba(200, 255, 42, 0.15), transparent 40%), #fff;
  border: 1px solid rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.pill {
  background: color-mix(in srgb, var(--color-accent, var(--accent-color)) 18%, #fff);
  color: #3f6300;
  font-weight: 700;
  letter-spacing: 0.06em;
  
  animation: none;
  box-shadow: none;
}

.primary-button {
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: var(--radius-medium, 18px);
  padding: 14px 28px;
  border: none;
  background: var(--accent-color);
  color: #0c0f14;
  box-shadow: 0 4px 12px rgba(200, 255, 42, 0.2), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition:
    box-shadow var(--motion-base) var(--motion-ease),
    background-color var(--motion-base) var(--motion-ease);
  position: relative;
  overflow: hidden;
}

.primary-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.15), transparent);
  opacity: 1;
}

.primary-button:hover {
  background: var(--accent-color-hover);
  box-shadow: 0 4px 12px rgba(200, 255, 42, 0.24), inset 0 0 0 1px rgba(77, 104, 0, 0.18);
}

.primary-button:active {
  box-shadow: 0 2px 8px rgba(200, 255, 42, 0.2);
}

/* Оформление полей по умолчанию — именно ПО УМОЛЧАНИЮ, поэтому обёрнуто
   в :where().

   Селектор вида `input[type="text"]` весит больше одного класса, и это правило
   молча перебивало стили компонентов, написанные через класс. Так реферальная
   ссылка стала белой по светлому (фон приезжал отсюда, цвет оставался свой), а
   счётчик количества на карточке товара резал цифры: отсюда приходили
   padding 12px и line-height 24px, а высота поля 42px при border-box
   оставляла содержимому 18px. Оба раза автор компонента был уверен, что его
   правило работает.

   :where() обнуляет вес селектора: базовый вид остаётся там, где своих стилей
   нет, а любое правило компонента теперь выигрывает — как и задумывалось. */
:where(input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="search"], textarea) {
  background: var(--input-bg, #f0f2f5);
  border: 1px solid transparent;
  border-radius: var(--radius-sm, 14px);
  padding: 12px 18px;
  font-size: 15px;
  transition:
    border-color var(--motion-base) var(--motion-ease),
    box-shadow var(--motion-base) var(--motion-ease),
    background-color var(--motion-base) var(--motion-ease);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* Побелевший фон на фокусе — тоже умолчание: у поля со своей заливкой
   (например тёмного) он был бы неуместен. */
:where(input[type="text"], input[type="email"], input[type="url"], input[type="number"], input[type="search"], textarea):focus {
  background: #fff;
}

/* А вот рамка фокуса обязана быть везде и всегда — это доступность, а не
   оформление. Поэтому она осталась полновесным селектором и перебивает
   компоненты; фон при этом больше ни с кем не спорит. */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--focus-field-border);
  box-shadow: var(--focus-field-shadow);
}

.catalog-search:focus-within {
  border-color: var(--focus-field-border);
  box-shadow: var(--focus-field-shadow);
}

.catalog-brands__search:focus {
  outline: none;
  border-color: var(--focus-field-border);
  box-shadow: var(--focus-field-shadow);
}

.home-hero__content {
  flex: 1;
  z-index: 2;
  padding-right: 20px;
}

.home-hero__mascot {
  flex: 0 0 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.home-hero__mascot img {
  max-width: 100%;
  height: auto;
  transform: rotate(5deg);
}

@media (max-width: 768px) {
  .home-hero__primary {
    flex-direction: column-reverse;
    align-items: flex-start;
    overflow: visible;
  }

  .home-hero__mascot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 140px;
    max-width: 45%;
    opacity: 0.9;
    flex: none;
  }

  .home-hero__content {
    padding-right: 0;
    padding-bottom: 24px;
  }
}

.referral-page {
  max-width: 100%;
  min-width: 0;
}

.referral-page>div {
  max-width: 100%;
  min-width: 0;
  padding: 0;
  gap: 20px;
}

.referral-page .card {
  border-radius: var(--radius-card);
  padding: 24px;
  margin-bottom: 20px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.referral-page .card:last-child {
  margin-bottom: 0;
}

.referral-hero.card {
  border-radius: var(--radius-card);
  padding: 24px;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.referral-invite.card,
.referral-page>div>.card {
  border-radius: var(--radius-card);
  height: 100%;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}

.referral-percent-table-wrap {
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.referral-percent-table {
  table-layout: fixed;
  width: 100%;
}

.referral-invite__input {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  min-width: 0;
}

.referral-flow__box {
  border-radius: var(--radius-sm);
}

@media (max-width: 768px) {
  .referral-page>div {
    padding: 0;
  }

  .referral-page .card {
    padding: 20px 18px;
  }

  .referral-hero.card {
    padding: 20px 18px;
  }

  .referral-invite__link-row {
    flex-wrap: wrap;
  }

  .referral-invite__link-row .referral-invite__input {
    min-width: 0;
    width: 100%;
  }

  .referral-invite__link-row .primary-button {
    flex-shrink: 0;
    width: 100%;
  }
}


.tg-popup-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(12, 15, 20, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tg-popup-overlay[hidden] {
  display: none;
}

.tg-popup {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 28px 24px;
  max-width: 360px;
  width: 100%;
  border: 1px solid var(--glass-border);
}

.tg-popup__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.tg-popup__text {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.tg-popup__cta {
  display: inline-block;
  width: 100%;
  text-align: center;
  margin-bottom: 16px;
}

.tg-popup__later {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
}

.tg-popup__later input {
  cursor: pointer;
}

.tg-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
}

.tg-popup__close:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}


.primary-button:active {
  transform: translateY(0) scale(0.98);
}

.catalog-chip:active,
.catalog-brand:active,
.catalog-category:active {
  transform: scale(0.96);
  transition-duration: 0.08s;
}


.catalog-chip.is-active,
.catalog-brand.is-active {
  animation: chipBounce var(--motion-slow) var(--motion-ease);
}

@keyframes chipBounce {
  0% {
    transform: scale(0.92);
  }

  50% {
    transform: scale(1.04);
  }

  100% {
    transform: scale(1);
  }
}


.page-inner>*:first-child {
  animation: pageContentFadeIn 0.36s var(--motion-ease);
}

@keyframes pageContentFadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.card {
  box-shadow: var(--shadow-card);
  transition: border-color var(--motion-base) var(--motion-ease), box-shadow var(--motion-base) var(--motion-ease);
}

@media (hover: hover) and (pointer: fine) {
  .card:hover {
    border-color: rgba(14, 15, 17, 0.14);
    box-shadow: var(--shadow-card);
  }
}

.home-hero__primary,
.home-delivery.card,
.catalog-product-card,
.catalog-card {
  border-radius: var(--radius-card, 20px);
}

.home-hero__primary {
  box-shadow: var(--shadow-card);
}

.home-hero__primary:hover {
  border-color: rgba(14, 15, 17, 0.14);
  box-shadow: var(--shadow-card);
}

.page-main-inner>*+* {
  margin-top: 2px;
}

.page-footer-inner {
  gap: 10px 16px;
}

.page-footer-nav {
  flex-wrap: wrap;
  row-gap: 8px;
}


@media (min-width: 769px) {

  .catalog-brands__desktop-only,
  .catalog-chip-grid {
    transition: opacity 0.2s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes fadeScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(200, 255, 42, 0.4);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(200, 255, 42, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(200, 255, 42, 0);
  }
}

.animate-fade-scale {
  animation: fadeScaleIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.animate-slide-up {
  animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.delay-100 {
  animation-delay: 100ms;
}

.delay-200 {
  animation-delay: 200ms;
}

.delay-300 {
  animation-delay: 300ms;
}


.product-variants-section {
  background: var(--glass-bg, rgba(255, 255, 255, 0.45));
  border: 1px solid var(--border-subtle, rgba(0, 0, 0, 0.08));
  border-radius: 20px;
  padding: 16px;
  margin-bottom: 20px;
  transition: border-color 0.3s ease, background-color 0.3s ease, box-shadow 0.3s ease;
}

.product-variants-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
}

.product-variants-title {
  color: var(--text-muted, #777);
  font-weight: 500;
}

.product-variants-selected-label {
  margin-left: auto;
  margin-right: 8px;
  color: var(--text-main, #111);
  font-weight: 700;
  text-transform: capitalize;
}

.product-variants-required-badge {
  background: #fee2e2;
  color: #ef4444;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  animation: pulse-red 2s infinite;
}


@keyframes pulse-red {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
  }
}


/* .product-variations / .product-variation / .product-variants-section--needs-choice
   moved to catalog.css (loads after this file on product pages, so the rules win
   on source order alone and no longer need !important). */

@media (max-width: 768px) {
  .product-variants-section {
    padding: 14px;
    margin-bottom: 16px;
  }
}
