/* ==========================================================================
   Good Star — компоненты сайта, которых нет в эталонном styles.css.

   Эталон рассчитан на статические страницы: у него нет живого поиска
   с подсказками, меток активных фильтров, скелетонов и серверной пагинации.
   Эти части реализованы на сайте и оформлены здесь в тех же токенах,
   что и эталон, чтобы вид оставался единым.

   Подключается после reference/goodstar-reference.css.
   ========================================================================== */

/* ---------------------------------------------------------- 1. Поиск */

.gs-search { position: relative; width: 100%; }

.gs-search__form {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.gs-search__form:hover { border-color: #cbd4df; }
.gs-search__form:focus-within {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(27, 98, 176, .14);
}

.gs-search__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex: 0 0 44px;
  color: var(--muted);
  pointer-events: none;
}

.gs-search__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 50px;
  padding: 0 8px 0 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
}
.gs-search__input:focus { outline: none; }
.gs-search__input::placeholder { color: #9aa7b6; }
.gs-search__input::-webkit-search-cancel-button { display: none; }

.gs-search__clear {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  margin-right: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
}
.gs-search__clear:hover { background: var(--brand-50); color: var(--brand-900); }
.gs-search__clear[hidden] { display: none; }

.gs-search__submit {
  flex: 0 0 auto;
  height: 40px;
  margin-right: 5px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--brand-900);
  color: #fff;
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s var(--ease);
}
.gs-search__submit:hover { background: var(--brand-600); }

/* ---- выпадающие подсказки ---- */

.gs-search__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 120;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--sh-2);
  overflow: hidden auto;
  max-height: min(70vh, 520px);
}
.gs-search__panel[hidden] { display: none; }

.gs-search__row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.gs-search__row:last-child { border-bottom: 0; }
.gs-search__row:hover,
.gs-search__row.is-active { background: var(--brand-50); color: var(--ink); }
.gs-search__row.is-active { outline: 2px solid var(--brand-600); outline-offset: -2px; }

.gs-search__thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: var(--radius);
  background: var(--bg);
}

.gs-search__texts { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.gs-search__name {
  font-weight: 600;
  font-size: .9375rem;
  line-height: 1.3;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-search__cat {
  font-size: .8125rem;
  color: var(--brand-600);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-search__snippet {
  font-size: .8125rem;
  color: var(--muted);
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gs-search__price { font-size: .8125rem; font-weight: 700; color: var(--brand-900); }

.gs-search__go { flex: 0 0 auto; color: var(--muted); font-size: 1.375rem; line-height: 1; }
.gs-search__row.is-active .gs-search__go { color: var(--brand-600); }

.gs-search__all {
  display: block;
  padding: 13px 14px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: .9375rem;
  font-weight: 600;
  color: var(--brand-600);
  text-decoration: none;
}
.gs-search__all:hover { background: var(--brand-50); }

.gs-search__message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px 16px;
  text-align: center;
}
.gs-search__message strong { color: var(--ink); font-size: .9375rem; }
.gs-search__message span { color: var(--muted); font-size: .8125rem; }

.gs-search__row--skeleton { pointer-events: none; }

/* Размещение: в шапке поиск раскрывается по иконке, поэтому ширину
   задаёт контейнер .search-popover эталона. */
.search-popover .gs-search { max-width: 640px; }
.mobile-menu__contact .gs-search { margin-bottom: 12px; }
.catalog-sidebar .gs-search { margin-bottom: 18px; }
.catalog-sidebar .gs-search__input { height: 44px; font-size: .9375rem; }
.catalog-sidebar .gs-search__icon { width: 38px; flex-basis: 38px; }
.catalog-sidebar .gs-search__submit { height: 34px; padding: 0 12px; font-size: .8125rem; }

/* ------------------------------------------- 2. Метки активных фильтров */

.gs-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}
.gs-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: .8125rem;
  line-height: 1.2;
  text-decoration: none;
  max-width: 100%;
}
.gs-chip:hover { border-color: var(--paprika); color: var(--paprika); }
.gs-chip__group { color: var(--muted); }
.gs-chip__value {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22ch;
}
.gs-chip__x { font-size: 1rem; line-height: 1; color: var(--muted); }
.gs-chip:hover .gs-chip__x { color: var(--paprika); }
.gs-chip--reset {
  background: var(--brand-50);
  border-color: #cfe0f0;
  color: var(--brand-900);
  font-weight: 600;
}
.gs-chip--reset:hover { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }

/* Счётчик выбранных фильтров на кнопке «Фильтры» */
.filter-trigger { position: relative; }
.gs-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-500);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 700;
}
.gs-filter-count[hidden] { display: none; }

/* ----------------------------------------------------- 3. Скелетоны */

.gs-skeleton {
  display: block;
  background: linear-gradient(90deg, var(--bg) 25%, #edf1f6 37%, var(--bg) 63%);
  background-size: 400% 100%;
  animation: gs-shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes gs-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.gs-skeleton--line { height: 12px; margin-bottom: 8px; }
.gs-skeleton--short { width: 60%; }

.gs-card-skeleton { pointer-events: none; border: 1px solid var(--line); border-radius: var(--radius-card); overflow: hidden; }
.gs-card-skeleton__media { aspect-ratio: 1 / 1; border-radius: 0; }
.gs-card-skeleton__body { padding: 16px; }

.gs-results.is-loading { opacity: .75; }

@media (prefers-reduced-motion: reduce) {
  .gs-skeleton { animation: none; }
}

/* --------------------------------------------------- 4. Пагинация */

.gs-pagination { margin-top: 32px; }
.gs-pagination ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.gs-pagination a,
.gs-pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: .9375rem;
  text-decoration: none;
}
.gs-pagination a:hover { background: var(--brand-50); border-color: var(--brand-600); color: var(--brand-600); }
.gs-pagination .active span { background: var(--brand-900); border-color: var(--brand-900); color: #fff; }
.gs-results-note { margin-top: 14px; color: var(--muted); font-size: .875rem; }

/* ------------------------------------------------------- 5. Формы заявки */

.gs-form { display: grid; gap: 14px; }
.gs-form__row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .gs-form__row { grid-template-columns: 1fr; } }

.gs-field { display: flex; flex-direction: column; gap: 6px; }
.gs-field label { font-size: .875rem; font-weight: 500; color: var(--ink); }
.gs-field .gs-req { color: var(--paprika); }
.gs-field input:not([type="checkbox"]):not([type="radio"]),
.gs-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
}
.gs-field textarea { min-height: 120px; resize: vertical; }
.gs-field input:focus, .gs-field textarea:focus {
  outline: none;
  border-color: var(--brand-600);
  box-shadow: 0 0 0 3px rgba(27, 98, 176, .14);
}
.gs-field input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--brand-600); }
.gs-field--error input, .gs-field--error textarea,
.gs-field input.is-invalid, .gs-field textarea.is-invalid { border-color: var(--paprika); }
.gs-field__error, .invalid-feedback, .field-error {
  color: var(--paprika);
  font-size: .8125rem;
  margin-top: 4px;
}
.gs-field-hint { color: var(--muted); font-size: .8125rem; margin: -6px 0 0; }

.gs-consent {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: .875rem;
}
.gs-consent input { flex: 0 0 auto; }

.gs-alert {
  margin: 0;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  font-size: .9375rem;
}
.gs-alert--ok { background: #eaf6f0; border-color: #bfe3d2; color: #14663f; }
.gs-alert--err { background: #fbedea; border-color: #f0cbc4; color: #8f3320; }
.gs-alert[hidden] { display: none; }

.gs-form-context {
  display: inline-block;
  margin-bottom: 12px;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--brand-50);
  color: var(--brand-900);
  font-size: .8125rem;
  font-weight: 600;
}

/* Метка товара выводится только у формы «Запросить цену»: у формы
   консультации товара нет, и класс перебивал атрибут hidden. */
.gs-form-context[hidden] { display: none; }
.gs-hidden-fields { display: none; }

/* Honeypot — вне потока, но без выхода за пределы страницы */
.gs-hp {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.gs-visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------- 6. Мелкие поправки */

/* Ссылка «Перейти к содержимому» */
.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 999;
  transform: translateY(-120%);
  padding: 12px 20px;
  background: var(--brand-900);
  color: #fff;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
}
.skip-link:focus { transform: none; }

/* Зоны нажатия не меньше 44 px */
.topbar__links a,
.footer-contact-links a { display: inline-flex; align-items: center; min-height: 44px; }

/* Хлебные крошки: высоту задаёт сам пункт, а не ссылка внутри него.
   Последний пункт — обычный текст без ссылки, и когда высоту держала
   только ссылка, он оказывался выше остальных. */
.breadcrumbs { align-items: center; }
.breadcrumbs li { display: inline-flex; align-items: center; min-height: 40px; }
.breadcrumbs li:not(:last-child)::after { display: inline-flex; align-items: center; }
.breadcrumbs a { display: inline; }

/* ============================================ 7. Каталог: наши дополнения */

/* Заголовок группы фильтров — кнопка сворачивания. */
.filter-group__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-family: 'Manrope', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.filter-group__toggle .icon { flex: 0 0 auto; transition: transform .2s var(--ease); }
.filter-group__toggle[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.filter-group__toggle[aria-expanded="false"] + .filter-group__list { display: none; }
.filter-group__list { display: grid; gap: 4px; }

.filter-option {
  min-height: 44px;
  padding-inline: 6px;
  margin-inline: -6px;
  border-radius: var(--radius);
  transition: background-color .2s var(--ease);
}
.filter-option:hover { background: var(--brand-50); }
.filter-option input { accent-color: var(--brand-600); width: 18px; height: 18px; flex: 0 0 auto; }
/* min-width: 0 обязателен: без него элемент flex не сжимается уже
   самого длинного слова, и подписи фильтров вылезают за колонку. */
.filter-option > span:first-of-type { flex: 1 1 auto; min-width: 0; }
.filter-option__count { flex: 0 0 auto; color: var(--muted); font-size: .8125rem; }
.filter-option:has(input:checked) > span:first-of-type { color: var(--brand-900); font-weight: 600; }

.filter-actions { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); }

.catalog-search-row { max-width: 560px; margin-bottom: 28px; }

/* Карточка товара: подпись раздела и строка о цене. */
.product-card__category {
  font-size: .75rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.product-card__price {
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-family: 'Manrope', system-ui, sans-serif;
  font-weight: 700;
  font-size: .9375rem;
  color: var(--brand-900);
}
/* Все карточки строки одинаковой высоты, кнопки на одном уровне. */
.catalog-grid .product-card__body { display: flex; flex-direction: column; gap: 8px; }
.product-card__facts { min-height: 66px; }
.product-card__facts span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -------------------------- 8. Шторка фильтров на узких экранах ---------- */

/* В эталоне мобильные фильтры — отдельный блок .filter-drawer.
   Здесь роль шторки играет сама колонка: дублировать форму нельзя,
   иначе в ней окажутся два одинаковых набора полей.

   Граница ровно та же, что у эталона (1024px): в эталоне с этой ширины
   каталог становится двухколоночным. Если сделать шторку шире, колонка
   выпадает из сетки и товары сжимаются в первую, узкую колонку. */
@media (max-width: 1023.98px) {
  .catalog-sidebar {
    display: block;
    position: fixed;
    z-index: 140;
    inset: 0 auto 0 0;
    width: min(92vw, 380px);
    padding: 22px;
    overflow-y: auto;
    background: var(--surface);
    border-right: 1px solid var(--line);
    box-shadow: var(--sh-2);
    transform: translateX(-102%);
    visibility: hidden;
    transition: transform .25s var(--ease), visibility .25s var(--ease);
  }
  .catalog-sidebar.is-open { transform: none; visibility: visible; }
}

@media (min-width: 1024px) {
  .catalog-sidebar .filter-drawer__head { display: none; }
  .filter-trigger { display: none; }
}

/* ------------------------- 9. Защита от скрытого содержимого ------------- */

/* В эталоне блоки .reveal изначально прозрачны и проявляются скриптом.
   Если JavaScript отключён или не успел отработать, содержимое осталось бы
   невидимым. Прозрачность включается только когда страница помечена как
   поддерживающая скрипты — метку ставит инлайновый скрипт в шапке. */
.reveal { opacity: 1; transform: none; }
html.js .reveal { opacity: 0; transform: translateY(16px); }
html.js .reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity 300ms var(--ease), transform 300ms var(--ease);
}
@media (prefers-reduced-motion: reduce) {
  html.js .reveal { opacity: 1; transform: none; }
}

/* --------------------- 10. Переносы длинных названий -------------------- */

/* Названия у Good Star — длинные составные слова: «вкусоароматические»,
   «фосфатосодержащие», «вспомогательные». В эталоне заголовки карточек
   короткие, поэтому переносы там не требовались, а карточка обрезает
   всё лишнее (overflow: hidden) — длинное слово теряло хвост.
   Разрешаем перенос по слогам (язык страницы объявлен как ru). */
.category-card__body > :is(h2, h3, h4),
.product-card__title,
.doc-card h3,
.mega-menu__item strong,
.filter-option span,
.footer-col a,
.breadcrumbs li,
.spec-table th,
.spec-table td {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* Уровень заголовка в карточке зависит от страницы: на обзоре каталога
   карточка раздела — это h2 (под h1 страницы), на главной — h3.
   Размер при этом должен быть одинаковым и помещаться в узкую колонку. */
.category-card__body > :is(h2, h3, h4) {
  font-size: clamp(1.05rem, 1.4vw, 1.25rem);
  line-height: 1.3;
}

/* ------------------- 11. Узкая колонка фильтров не должна распираться ---- */

/* Колонка фильтров — 260px. По умолчанию элементы сетки и поля ввода
   не сжимаются уже своего содержимого: поле поиска держит ширину
   примерно в 20 символов, а группы фильтров — длину самого длинного
   слова. Из-за этого форма поиска и заголовки групп выходили за колонку.
   minmax(0, 1fr) и min-width: 0 разрешают сжатие. */
.filter-panel,
.filter-group,
.filter-group__list { grid-template-columns: minmax(0, 1fr); }

.catalog-sidebar .gs-search,
.catalog-sidebar .gs-search__form { min-width: 0; }
/* flex-basis: 0 — иначе поле требует ширину «по умолчанию» (около
   20 символов) и вместе со значком не помещается в строку. */
.catalog-sidebar .gs-search__input { min-width: 0; flex: 1 1 0; }

/* В колонке шириной 260px поле и кнопка в один ряд не помещаются:
   от поля остаётся десяток символов. Переносим кнопку под поле —
   значок поиска при этом остаётся в одной строке с полем. */
.catalog-sidebar .gs-search__form { flex-wrap: wrap; }
/* Главное действие в колонке — «Применить» (жёлтая кнопка внизу),
   поэтому кнопка поиска оформлена сдержанно и не спорит с ней. */
.catalog-sidebar .gs-search__submit {
  flex: 1 0 100%;
  margin-top: 8px;
  height: 38px;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--line);
}
.catalog-sidebar .gs-search__submit:hover { background: #e2ecf8; border-color: #c8d4e2; }

/* Группы фильтров лежат внутри формы, а промежутки заданы у панели —
   форма их не наследует, и заголовки групп прилипали к предыдущему списку. */
.filter-panel > form[data-gs-filter-form] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

/* -------------------- 12. Карточка товара в узкой колонке --------------- */

/* Подписи кнопок у нас длиннее эталонных («Запросить цену» вместо
   короткой надписи), поэтому пара кнопок в ряд помещается не всегда.
   auto-fit ставит их в один столбец, когда карточка узкая — это
   происходит на промежуточной ширине 1024–1279px, где каталог уже
   трёхколоночный, но рядом ещё стоит панель фильтров. */
.catalog-grid:not(.is-list) > .product-card,
.product-scroller > .product-card { grid-template-columns: minmax(0, 1fr); }

.catalog-grid:not(.is-list) .product-card__actions {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

/* В полосе карточка узкая (около 290px), и надпись «Запросить цену»
   в два столбца не помещается — переносится по слогам. Ставим кнопки
   одна под другой: надпись умещается в строку. */
.product-scroller .product-card__actions { grid-template-columns: minmax(0, 1fr); }

.product-card__facts,
.product-card__facts * { overflow-wrap: break-word; }

/* ---------------------- 13. Ровный ряд карточек документов -------------- */

/* Названия документов разной длины, поэтому кнопка «Открыть документ»
   оказывалась на разной высоте. Прижимаем её к низу карточки. */
.doc-card { grid-template-rows: auto auto 1fr; align-content: stretch; }
.doc-card > .btn { align-self: end; }

/* На странице «Сертификаты» документы выкладываются сеткой и помещаются
   целиком: полоса с боковой прокруткой из эталона годится для блока-анонса
   на главной, а здесь заставляла прокручивать ряд вбок. */
.docs-row--grid {
  grid-auto-flow: row;
  grid-auto-columns: auto;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 20px;
  padding-bottom: 0;
  overflow: visible;
  scroll-snap-type: none;
}

/* Документы разного формата: сертификаты ISO — вертикальный A4,
   свидетельство Halal — горизонтальное. Обрезка по ширине прятала бы
   половину горизонтального листа, поэтому страница вписывается целиком. */
.doc-card__preview { background: #fff; }
.doc-card__preview img { object-fit: contain; object-position: center; }

/* ------------------ 14. Прокрутка мобильного меню ----------------------- */

/* В эталоне пунктов меню немного, и оно всегда помещалось в экран.
   У Good Star в меню пять разделов каталога, четыре страницы, поиск,
   телефон и кнопка заявки — на экране 390×844 нижняя часть оказывалась
   за пределами видимой области и была недоступна. */
.mobile-menu {
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* Поле поиска в меню требует ширину «по умолчанию» (около 20 символов)
   и вместе со значком и кнопкой распирало колонку меню за край экрана. */
.mobile-menu,
.mobile-menu__contact,
.mobile-menu__nav { grid-template-columns: minmax(0, 1fr); }
.mobile-menu .gs-search,
.mobile-menu .gs-search__form { min-width: 0; }
.mobile-menu .gs-search__input { min-width: 0; flex: 1 1 0; }


/* =========================== 15. Правки по замечаниям владельца ========== */

/* Поле поиска в шапке.
   В эталоне правило «.search-popover input» рисует рамку и фон —
   вместе с нашей рамкой формы получалось поле внутри поля. */
.search-popover .gs-search__input {
  min-height: 0;
  padding: 0 8px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.search-popover .gs-search__input:focus-visible { box-shadow: none; }
.search-popover .gs-search__form { width: 100%; }

/* Меню в подвале: пункты вплотную друг к другу. */
.footer-col { gap: 2px; }
.footer-col a { padding-block: 3px; }
.footer-col h3 { margin-bottom: 6px; }

/* Логотип в подвале — на белой подложке, как в эталоне. */
.footer-logo { background: #fff; }
.footer-logo img { width: 138px; height: auto; display: block; }

/* Обзор каталога: разделы по три в ряд. */
.category-grid--catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 1024px) {
  .category-grid--catalog { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Списки товаров в разделе — по две карточки в ряд на любой ширине
   от планшета и выше: карточка становится крупнее и читается лучше. */
@media (min-width: 768px) {
  .catalog-grid:not(.is-list) { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Карточка стала вдвое шире, и квадратная область изображения
     оставляла много пустого места сверху и снизу. */
  .catalog-grid:not(.is-list) .product-card__media { aspect-ratio: 4 / 3; }
}

/* Меню каталога: слева разделы, справа позиции выбранного.
   Само слово «Каталог» — ссылка на страницу каталога, поэтому панель
   раскрывается наведением и фокусом, без скрипта. */
@media (min-width: 1024px) {
  .nav-catalog > .nav-catalog__link {
    min-height: 72px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    color: var(--ink);
    font-size: .8125rem;
    font-weight: 600;
    text-decoration: none;
  }
  .nav-catalog > .nav-catalog__link:hover { color: var(--brand-600); }
  .nav-catalog > .nav-catalog__link .icon {
    width: 14px;
    height: 14px;
    transition: transform 180ms var(--ease);
  }
  .nav-catalog:hover > .nav-catalog__link .icon,
  .nav-catalog:focus-within > .nav-catalog__link .icon { transform: rotate(180deg); }

  .mega-menu {
    grid-template-columns: 288px minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
  }
  .mega-menu.is-open,
  .nav-catalog:hover .mega-menu,
  .nav-catalog:focus-within .mega-menu {
    transform: translate(-50%, 0);
    visibility: visible;
    opacity: 1;
  }

  /* ---- перечень разделов ---- */
  .mega-menu__rail {
    display: grid;
    align-content: start;
    gap: 2px;
    padding: 16px 12px;
    border-right: 1px solid var(--line);
    background: var(--brand-50);
  }
  .mega-menu__tab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius);
    color: var(--ink);
    font: 600 .9375rem/1.3 Manrope, sans-serif;
    text-decoration: none;
    transition: background 140ms var(--ease), color 140ms var(--ease);
  }
  .mega-menu__tab-name { flex: 1 1 auto; min-width: 0; }
  .mega-menu__tab-count {
    flex: 0 0 auto;
    min-width: 26px;
    padding: 2px 7px;
    border-radius: 999px;
    background: rgba(27, 98, 176, .12);
    color: var(--brand-600);
    font-size: .75rem;
    font-weight: 700;
    text-align: center;
  }
  .mega-menu__tab .icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    color: var(--brand-600);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 140ms var(--ease), transform 140ms var(--ease);
  }
  .mega-menu__tab:hover { background: rgba(255, 255, 255, .7); color: var(--brand-600); }
  .mega-menu__tab.is-active {
    background: var(--surface);
    box-shadow: inset 3px 0 var(--accent-500);
    color: var(--brand-900);
  }
  .mega-menu__tab.is-active .icon { opacity: 1; transform: none; }
  .mega-menu__tab.is-active .mega-menu__tab-count {
    background: var(--accent-500);
    color: var(--ink);
  }

  /* ---- позиции раздела ---- */
  .mega-menu__panels {
    display: grid;
    grid-template-rows: 1fr auto;
    padding: 22px 26px 18px;
  }
  .mega-menu__panel[hidden] { display: none; }

  /* Разделы разной длины, поэтому нижняя строка прижата к низу панели
     и заполняет пустое место под короткими списками. */
  .mega-menu__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
  .mega-menu__foot-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-600);
    font-size: .875rem;
    font-weight: 600;
    text-decoration: none;
  }
  .mega-menu__foot-link:hover { text-decoration: underline; }
  .mega-menu__foot-link .icon { width: 16px; height: 16px; }
  .mega-menu__foot .btn--sm {
    min-height: 40px;
    padding: 0 18px;
    font-size: .8125rem;
  }

  .mega-menu__panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 20px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }
  .mega-menu__panel-head a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-900);
    font: 800 1.0625rem/1.2 Manrope, sans-serif;
    text-decoration: none;
  }
  .mega-menu__panel-head a:hover { color: var(--brand-600); }
  .mega-menu__panel-head .icon { width: 17px; height: 17px; color: var(--brand-600); }
  .mega-menu__panel-head span { color: var(--muted); font-size: .8125rem; }

  /* Позиций в разделе до дюжины: раскладываем в несколько рядов колонками —
     так двухстрочные названия не растягивают всю строку. */
  .mega-menu__list {
    columns: 215px 3;
    column-gap: 18px;
    max-height: 320px;
    padding: 0;
    margin: 0;
    overflow-y: auto;
    list-style: none;
  }
  .mega-menu__list li { break-inside: avoid; }
  .mega-menu__list a {
    display: block;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: .8438rem;
    line-height: 1.35;
    text-decoration: none;
    transition: background 140ms var(--ease), color 140ms var(--ease);
  }
  .mega-menu__list a:hover { background: var(--brand-50); color: var(--brand-600); }
}

@media (prefers-reduced-motion: reduce) {
  .mega-menu__tab,
  .mega-menu__tab .icon,
  .mega-menu__list a { transition: none; }
}

/* Меню каталога на узком экране: разделы раскрываются по нажатию. */

/* Пункты внутри <details> — не прямые потомки сетки меню, поэтому
   раскладку им задаёт собственная обёртка: у самого <details> браузеры
   заворачивают содержимое в служебный блок, и сетка на нём не работает. */
.mobile-menu__sub { display: grid; }

.mobile-menu__group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}
.mobile-menu__group summary::-webkit-details-marker { display: none; }
.mobile-menu__group-name { flex: 1 1 auto; min-width: 0; }
.mobile-menu__count {
  flex: 0 0 auto;
  min-width: 26px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(27, 98, 176, .12);
  color: var(--brand-600);
  font-family: Inter, sans-serif;
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}
.mobile-menu__group summary .icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: transform 180ms var(--ease);
}
.mobile-menu__group[open] summary .icon { transform: rotate(180deg); }
/* Позиция раздела — второй уровень: мельче и со смещением. */
.mobile-menu__sub > a {
  padding: 11px 0 11px 14px;
  font-family: Inter, sans-serif;
  font-size: .9375rem;
  font-weight: 500;
}
.mobile-menu__all { color: var(--brand-600); }

@media (prefers-reduced-motion: reduce) {
  .mobile-menu__group summary .icon { transition: none; }
}

/* Форма внутри всплывающего окна: без собственной рамки и отступов —
   их даёт само окно. */
.form-plain { display: grid; gap: 0; }
.modal__dialog .form-card__hint { margin-bottom: 16px; color: var(--muted); font-size: .875rem; }
.modal__dialog .gs-form-context { margin-bottom: 14px; }
.modal__dialog .gs-form { display: grid; gap: 14px; }

/* Нижняя строка подвала: ссылки в один ряд. */
.footer-bottom__links { display: flex; flex-wrap: wrap; gap: 8px 18px; }

/* ==================== 16. Полоса товаров с перелистыванием ============== */

/* Заголовок раздела и кнопки перелистывания в одной строке. */
.section-head--row {
  max-width: none;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px 24px;
}
/* Только первый блок — надзаголовок с заголовком. Кнопкам справа
   нужна строка, поэтому правило к ним применяться не должно. */
.section-head--row > :first-child { display: grid; gap: 8px; }

.scroller-nav { display: flex; gap: 8px; }
.scroller-nav .icon-btn { width: 44px; height: 44px; background: var(--surface); }
.scroller-nav .icon-btn:disabled { opacity: .35; cursor: default; }
.scroller-nav .icon-btn:not(:disabled):hover {
  color: var(--brand-600);
  border-color: #c8d4e2;
}

/* Полоса прокручивается по горизонтали и «прилипает» к карточкам.
   Правило эталона .product-scroller задаёт ширину колонок; здесь —
   только то, что нужно для перелистывания кнопками. */
.product-scroller { scroll-behavior: smooth; }
.product-scroller:focus-visible {
  outline: 2px solid var(--brand-600);
  outline-offset: 4px;
}
.product-scroller > .product-card { scroll-snap-align: start; }

@media (prefers-reduced-motion: reduce) {
  .product-scroller { scroll-behavior: auto; }
}

/* ============ 17. Блоки главной: преимущества, список работы с клиентом === */

/* Преимущества отечественного производителя — карточки со значками.
   Прежняя сетка эталона рисовала таблицу: на тёмном фоне ячейки сливались,
   а текст читался плохо. */
.advantages { display: grid; gap: 14px; }

.advantage {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 24px 22px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, .06);
  transition: background 180ms var(--ease), border-color 180ms var(--ease),
              transform 180ms var(--ease);
}
.advantage:hover {
  border-color: rgba(242, 183, 5, .55);
  background: rgba(255, 255, 255, .1);
  transform: translateY(-2px);
}

.advantage__icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(242, 183, 5, .16);
  color: var(--accent-500);
}
.advantage__icon .icon { width: 24px; height: 24px; }

.advantage h3 {
  color: var(--surface);
  font: 700 1.0625rem/1.3 Manrope, sans-serif;
}
.advantage p {
  color: rgba(255, 255, 255, .84);
  font-size: .9375rem;
  line-height: 1.55;
}

@media (min-width: 680px) {
  .advantages { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
}
@media (min-width: 1024px) {
  .advantages { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}

/* Заключение под карточками: вывод отбит цветной чертой. */
.section-outro { display: grid; gap: 18px; max-width: 820px; margin-top: 36px; }
.section-outro p { color: var(--muted); }
.section-outro__lead {
  padding-left: 18px;
  border-left: 3px solid var(--accent-500);
  font: 700 1.1875rem/1.4 Manrope, sans-serif;
}
.section--dark .section-outro p { color: rgba(255, 255, 255, .84); }
.section--dark .section-outro__lead { color: var(--surface); }

@media (prefers-reduced-motion: reduce) {
  .advantage { transition: none; }
  .advantage:hover { transform: none; }
}

/* Список «Работа с клиентом»: пункты — целые предложения, поэтому
   на широких экранах они встают в две колонки, а не в одну длинную. */
.check-list--cols { max-width: 1000px; }

@media (min-width: 900px) {
  .check-list--cols { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 40px; }
}

/* Список «Что для нас важно?» на странице «О компании»: в тексте владельца
   пункты помечены галочками, здесь они выводятся знаком, а не эмодзи. */
.gs-check { display: grid; gap: 10px; padding: 0; margin: 0; list-style: none; }
.gs-check li { position: relative; padding-left: 30px; }
.gs-check li::before {
  position: absolute;
  top: 0;
  left: 0;
  color: var(--success);
  font-weight: 700;
  content: '✓';
}

/* Факса у компании больше нет, и в служебной строке подвала остаётся
   один блок. В эталоне она разбита на узкую и широкую колонки, поэтому
   единственный блок надо растянуть — иначе два адреса почты сжимаются. */
.footer-utility__item:only-child { grid-column: 1 / -1; }
.footer-utility__item a + a { margin-left: 18px; }

/* ------------------------------------------------------------------ блог
   Штатный блог OpenCart (cms/blog) в оформлении эталона: карточка записи
   повторяет карточку раздела каталога, страница записи — информационную
   страницу. Значения — из переменных эталона. */
.blog-grid { display: grid; gap: 20px; }
.blog-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--sh-1);
  transition: transform 200ms var(--ease), border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.blog-card:hover { transform: translateY(-2px); border-color: #c8d4e2; box-shadow: var(--sh-2); }
.blog-card__image { aspect-ratio: 16 / 10; overflow: hidden; background: var(--bg); }
.blog-card__image img { width: 100%; height: 100%; object-fit: cover; }
.blog-card__body { display: grid; align-content: start; gap: 12px; padding: 24px; color: var(--ink); text-decoration: none; }
.blog-card__body h3 { overflow-wrap: anywhere; hyphens: auto; }
.blog-card__body p { color: var(--muted); font-size: .9375rem; }
.blog-card__body .text-link { margin-top: 4px; }
.blog-card__date,
.blog-post__date { color: var(--muted); font-size: .8125rem; }

.blog-topics { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.blog-topics__item {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 18px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
}
.blog-topics__item:hover { border-color: var(--brand-600); }
.blog-topics__item[aria-current="page"] { color: #fff; background: var(--brand-900); border-color: var(--brand-900); }

.blog-grid + .pagination,
.blog-grid + nav { margin-top: 32px; }

.empty-state h2 { font-size: clamp(1.2rem, 2vw, 1.5rem); }
.empty-state p { color: var(--muted); }

.blog-post { display: grid; gap: 28px; max-width: 850px; }
.blog-post__image { width: 100%; height: auto; border-radius: var(--radius-card); }
.blog-post .content-prose img { max-width: 100%; height: auto; }
.blog-post__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }

@media (min-width: 768px) {
  .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Фото в карточках товаров и разделов заполняют весь блок, без полей.
   Превью генерируются без белой подложки (см. fillThumb в модели
   каталога), поэтому обрезаются только края снимка. */
.product-card__media img,
.category-card__image img {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  object-fit: cover;
  object-position: center;
  mix-blend-mode: normal;
}
.product-card__media > a { display: block; height: 100%; }
