/* ============================================================
   iStore redesign — chrome.css
   Стили для layouts/header, layouts/menu, layouts/footer.
   Зависит от переменных в theme.css (:root / [data-theme=dark]).
   Классы намеренно с префиксом rd- (redesign), чтобы НЕ конфликтовать
   с твоим легаси-CSS (.header-area, .main-menu, .mega-parent и т.д.),
   который ещё живёт на остальных страницах.
   ============================================================ */

/* ---------- promo / announcement bar ---------- */
.rd-promo {
  width: 100%;
  background: var(--accent);
  color: var(--accent-text);
  padding: 9px 16px;
  position: relative;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
}
.rd-promo__arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  opacity: .75;
  background: none;
  border: 0;
  color: inherit;
  font-size: inherit;
}
.rd-promo__arrow:hover { opacity: 1; }
.rd-promo__arrow--prev { left: 20px; }
.rd-promo__arrow--next { right: 20px; }
/* лента: слайды в ряд, трек едет transform'ом (app.js), тянется мышью/пальцем */
.rd-promo__viewport {
  overflow: hidden;
  margin: 0 28px;
  touch-action: pan-y;          /* вертикальный скролл страницы — браузеру, горизонталь — нам */
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.rd-promo__viewport.is-dragging { cursor: grabbing; }
.rd-promo__track {
  display: flex;
  transition: transform .55s cubic-bezier(.22, .61, .36, 1);
  will-change: transform;
}
.rd-promo__slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-sizing: border-box;
}
@media (prefers-reduced-motion: reduce) {
  .rd-promo__track { transition: none; }
}

/* общий drag для слайдеров (hero, карусели товаров) */
.is-dragging, .is-dragging * { user-select: none; -webkit-user-select: none; }
.is-dragging a, .is-dragging img { pointer-events: none; }

/* ---------- top header bar ---------- */
.rd-header {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
/* шапка + категории липнут вместе как единый блок (промо уезжает выше) */
.rd-stickynav { position: sticky; top: 0; z-index: 10; }
.rd-header__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.rd-header__logo { display: flex; align-items: center; white-space: nowrap; }
.rd-header__logo img { width: 160px; height: 44px; object-fit: contain; }
/* логотип по теме: светлая — обычный, тёмная — белый */
.rd-header__logo .rd-logo--dark { display: none; }
[data-theme="dark"] .rd-header__logo .rd-logo--light { display: none; }
[data-theme="dark"] .rd-header__logo .rd-logo--dark { display: block; }

.rd-header__links {
  display: flex;
  gap: 24px;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--muted);
  flex-wrap: wrap;
}
.rd-header__links a { color: inherit; text-decoration: none; }
.rd-header__links a:hover { color: var(--text); }

.rd-header__actions {
  flex: 1;
  min-width: 220px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.rd-search {
  width: 190px;
  max-width: 100%;
  height: 34px;
  background: var(--surface-alt);
  border: 0;
  border-radius: 980px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px 0 16px;
  transition: width .25s ease;
}
.rd-search:focus-within { width: 280px; }
.rd-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 12px;
  color: var(--text);
}
.rd-search input::placeholder { color: var(--muted); }
.rd-search__btn {
  width: 28px; height: 28px; flex: none;
  border-radius: 50%;
  border: 0;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
}
.rd-search__btn:hover { color: var(--accent); }

.rd-icons { display: flex; gap: 6px; }
.rd-icon {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-alt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
}
.rd-icon__badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* pill switches (lang + theme) */
.rd-pill {
  display: flex;
  background: var(--surface-alt);
  border-radius: 980px;
  overflow: hidden;
  font-size: 11px;
}
.rd-pill a,
.rd-pill button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 12px;
  color: var(--muted);
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  box-sizing: border-box;
  background: transparent;
  border: 0;
  text-decoration: none;
}
/* активный (всегда видимый) пункт — общая мин. ширина, чтобы пилюли совпадали */
.rd-pill > .is-active { min-width: 56px; }
.rd-pill .is-active {
  background: var(--accent);
  color: var(--accent-text);
}

/* ---------- category nav + mega menu ---------- */
.rd-catnav {
  width: 100%;
  background: var(--surface);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  position: relative;   /* контекст для мега-меню */
  z-index: 9;
}
.rd-catnav__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2px 24px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;            /* было overflow-x:auto — обрезало выпадашку */
  justify-content: center;
}
.rd-catnav__item {
  position: static;          /* контекст позиционирования — сама .rd-catnav (full-width) */
  display: flex;
  align-items: center;
}
.rd-catnav__link {
  padding: 11px 10px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid transparent;
  text-decoration: none;
}
.rd-catnav__link:hover,
.rd-catnav__item:hover > .rd-catnav__link,
.rd-catnav__item.is-active > .rd-catnav__link { color: var(--text); }
.rd-catnav__item.is-active > .rd-catnav__link { border-bottom-color: var(--accent); }
.rd-catnav__caret { width: 9px; height: 9px; opacity: .6; }

/* mega-menu: раскрывается на hover пункта с детьми */
.rd-mega {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  box-shadow: 0 12px 24px rgba(0,0,0,.12);
  z-index: 20;
  /* грейс-период: скрываем с задержкой, чтобы успеть довести курсор */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, visibility 0s linear .22s;
}
.rd-catnav__item:hover .rd-mega {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transition: opacity .15s ease, visibility 0s;
}
/* невидимый «мостик» поверх зазора между пунктом и меню */
.rd-mega::before {
  content: "";
  position: absolute;
  top: -10px; left: 0; right: 0;
  height: 10px;
}
.rd-mega__inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 22px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 24px;
}
.rd-mega__link {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 12px;
}
.rd-mega__link:hover { background: var(--surface-alt); }
.rd-mega__thumb {
  width: 40px; height: 40px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-alt);
  object-fit: contain;
  padding: 3px;
}

/* ---------- footer ---------- */
.rd-footer {
  margin-top: auto;   /* прижать футер к низу на коротких страницах */
  width: 100%;
  background: #1d1d1f;
  color: #f5f5f7;
  padding: 48px 24px 24px;
}
.rd-footer__grid {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  padding-bottom: 32px;
  border-bottom: 1px solid #3a3a3c;
  font-size: 13px;
}
.rd-footer__col { display: flex; flex-direction: column; gap: 6px; }
.rd-footer__col a { color: inherit; text-decoration: none; }
.rd-footer__brand { display: inline-block; margin-bottom: 8px; line-height: 0; }
.rd-footer__brand img { width: 170px; height: auto; display: block; }
.rd-footer__title { font-weight: 600; margin-bottom: 2px; }
.rd-footer__muted { color: #98989d; }
.rd-pay { display: flex; gap: 6px; flex-wrap: wrap; }
.rd-pay span,
.rd-pay img {
  padding: 3px 8px;
  border-radius: 4px;
  height: 26px;
  object-fit: contain;
}
.rd-socials { display: flex; gap: 10px; }
.rd-social {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid #3a3a3c;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}
.rd-footer__copy {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-top: 20px;
  font-size: 12px;
  color: #98989d;
  text-align: center;
}

/* ============================================================
   RESPONSIVE — бургер, мобильный drawer, брейкпоинты
   ============================================================ */

/* бургер (скрыт на десктопе) */
.rd-burger {
  display: none;
  width: 38px; height: 38px;
  border: 0; background: transparent; cursor: pointer;
  flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.rd-burger span { width: 20px; height: 2px; background: var(--text); border-radius: 2px; }

/* drawer */
.rd-drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 60; opacity: 0; visibility: hidden; transition: opacity .2s;
}
.rd-drawer-backdrop.is-open { opacity: 1; visibility: visible; }
.rd-drawer {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 300px; max-width: 85vw;
  background: var(--surface); color: var(--text);
  z-index: 61; transform: translateX(-100%);
  transition: transform .25s ease;
  display: flex; flex-direction: column; overflow-y: auto;
}
.rd-drawer.is-open { transform: translateX(0); }
.rd-drawer__head {
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.rd-drawer__title { font-size: 16px; font-weight: 600; }
.rd-drawer__close {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-alt); border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.rd-drawer__section {
  padding: 16px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 45%, transparent);
  display: flex; flex-direction: column; gap: 12px;
}
.rd-drawer__switches { display: flex; gap: 10px; flex-wrap: wrap; }
.rd-drawer__link { color: var(--text); text-decoration: none; font-size: 15px; }
.rd-drawer__link:hover { color: var(--accent); }
.rd-drawer__cat-head {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; padding: 9px 0; font-size: 15px; user-select: none;
}
.rd-drawer__cat-caret { transition: transform .2s; opacity: .6; }
.rd-drawer__cat.is-open .rd-drawer__cat-caret { transform: rotate(180deg); }
.rd-drawer__sub { display: none; flex-direction: column; gap: 10px; padding: 2px 0 8px 12px; }
.rd-drawer__cat.is-open .rd-drawer__sub { display: flex; }
.rd-drawer__sub a { color: var(--muted); text-decoration: none; font-size: 14px; }
.rd-drawer__sub a:hover { color: var(--accent); }

/* --- брейкпоинт: планшет/мобилка --- */
@media (max-width: 860px) {
  .rd-burger { display: flex; }
  .rd-header__links { display: none; }              /* ссылки -> в drawer */
  .rd-header__inner { flex-wrap: wrap; gap: 12px; padding: 10px 16px; }
  .rd-header__actions {
    order: 3; flex: 1 0 100%;                         /* поиск+иконки -> вторая строка */
    min-width: 0; justify-content: flex-start; gap: 8px;
  }
  .rd-header__actions .rd-pill { display: none; }    /* язык+тема -> в drawer */
  .rd-search { flex: 1; width: auto; }
  .rd-search:focus-within { width: auto; }           /* на мобилке уже во всю ширину */
  .rd-catnav { display: none; }                      /* категории -> в drawer */
  .rd-icons { flex: none; }
}

/* --- совсем узко --- */
@media (max-width: 420px) {
  .rd-header__logo img { width: 128px; }
  .rd-drawer { width: 88vw; }
}

/* --- иконки-плейсхолдеры в drawer (категории/подкатегории) --- */
.rd-drawer__ic {
  width: 26px; height: 26px; flex: none;
  border-radius: 6px; background: var(--surface-alt);
  object-fit: contain; padding: 2px;
}
.rd-drawer__ic--sm { width: 22px; height: 22px; border-radius: 5px; }
.rd-drawer__cat-label { display: flex; align-items: center; gap: 10px; }
.rd-drawer__link { display: flex; align-items: center; gap: 10px; }
.rd-drawer__sub a { display: flex; align-items: center; gap: 10px; }

/* --- бургер справа на мобилке --- */
@media (max-width: 860px) {
  .rd-header__logo { order: 1; }
  .rd-burger { order: 2; margin-left: auto; }
  .rd-header__actions { order: 3; }
}

/* --- динамические переключатели (pill): виден только активный, остальные раскрываются --- */
.rd-pill > a,
.rd-pill > button {
  white-space: nowrap;
  transition: max-width .2s ease, padding .2s ease, opacity .15s ease;
}
.rd-pill > a:not(.is-active),
.rd-pill > button:not(.is-active) {
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  pointer-events: none;
}
.rd-pill:hover > a,
.rd-pill:hover > button,
.rd-pill.is-open > a,
.rd-pill.is-open > button {
  max-width: 90px;
  padding-left: 12px;
  padding-right: 12px;
  opacity: 1;
  pointer-events: auto;
}

/* переключатель темы — иконки (солнце / луна / авто) */
.rd-pill--icons > button { padding-top: 4.5px; padding-bottom: 4.5px; } /* по высоте как пилюля языка */
.rd-pill--icons > .is-active { min-width: 44px; }
.rd-pill--icons svg { display: block; flex: 0 0 auto; }

/* скрыто визуально, доступно поисковикам и экранным читалкам (h1 на главной) */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
