/* Reset & base */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: Verdana, Arial, sans-serif;
  color: #1a1a1a;
  background: #f8f6f4;
  line-height: 1.5;
  overflow-wrap: break-word;
  overflow-x: clip;
}
a, button, input, [role="button"] { -webkit-tap-highlight-color: rgba(0,0,0,0.08); }

/* Шапка */
.header {
  background: #fff;
  color: #293133;
  font-size: 20px;
  position: relative;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.logo, .footer-logo {
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  order: 1;
}
.header-drawer { display: contents; }
.nav { order: 2; }
.search-wrap { order: 3; }
.header-actions { order: 4; }
.header-menu-label { display: none; }
.menu-toggle {
  display: none;
  order: 5;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #293133;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.menu-toggle:hover { background: rgba(41, 49, 51, 0.08); }
.menu-toggle-bars,
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.menu-toggle-bars {
  position: relative;
}
.menu-toggle-bars::before,
.menu-toggle-bars::after {
  content: '';
  position: absolute;
  left: 0;
}
.menu-toggle-bars::before { top: -7px; }
.menu-toggle-bars::after { top: 7px; }
.header.is-menu-open .menu-toggle-bars { background: transparent; }
.header.is-menu-open .menu-toggle-bars::before {
  transform: translateY(7px) rotate(45deg);
}
.header.is-menu-open .menu-toggle-bars::after {
  transform: translateY(-7px) rotate(-45deg);
}
.menu-backdrop {
  display: none;
}
.logo-img {
  height: 50px;
  width: auto;
  display: block;
  object-fit: contain;
}
.footer .logo-img {
  filter: drop-shadow(0 0 4px rgba(255,255,255,0.75)) drop-shadow(0 0 12px rgba(255,255,255,0.45));
}
.footer-logo-img {
  height: 44px;
}
.logo:hover, .footer-logo:hover { opacity: 0.9; }
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #293133;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.2;
  padding: 10px 14px;
  border: 1px solid rgba(41, 49, 51, 0.4);
  border-radius: 8px;
}
.nav-link:hover, .nav-link.is-current { background: rgba(41, 49, 51, 0.08); }

/* Поиск: до 600px, сжимается вместе с шапкой */
.search-wrap {
  display: flex;
  align-items: stretch;
  flex: 1 1 200px;
  max-width: 600px;
  min-width: 120px;
  order: 3;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.2);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.search-input {
  flex: 1;
  min-width: 0;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  color: #1a1a1a;
  font-size: 20px;
  font-family: inherit;
}
.search-input::placeholder { color: rgba(0,0,0,0.45); }
.search-input:focus { outline: none; }
.search-btn {
  padding: 10px 14px;
  border: 0;
  border-left: 1px solid rgba(0,0,0,0.1);
  background: #9370DB;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
}
.search-btn:hover { background: #8360c9; }
.search-btn svg {
  width: 20px;
  height: 20px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.icon-btn {
  color: #293133;
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.icon-btn:hover { background: rgba(41, 49, 51, 0.08); }
.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #293133;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  font-family: inherit;
  line-height: 1.2;
  padding: 10px 14px;
  border: 1px solid rgba(41, 49, 51, 0.4);
  border-radius: 8px;
}
.btn-login:hover { background: rgba(41, 49, 51, 0.08); }

/* Основной контент — каталог на всю ширину */
.home-intro {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 24px 0;
}
.home-title {
  margin: 0 0 10px;
  font-size: 1.55rem;
  line-height: 1.3;
}
.home-lead {
  margin: 0 0 8px;
  max-width: 820px;
  color: rgba(0,0,0,0.72);
}
.home-links {
  margin: 0;
  color: rgba(0,0,0,0.6);
}
.home-links a { color: #293133; }
.content-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}
.content-page h1 { margin: 0 0 16px; font-size: 1.7rem; }
.content-page h2 { margin: 24px 0 10px; font-size: 1.2rem; }
.content-page p, .content-page li { color: rgba(0,0,0,0.78); }
.content-page a { color: #293133; }
.content-page img,
.article-page img {
  max-width: 100%;
  height: auto;
}
.articles-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 32px 24px 56px;
}
.articles-title { margin: 0 0 8px; font-size: 1.7rem; }
.articles-lead { margin: 0 0 28px; color: rgba(0,0,0,0.7); }
.articles-list { display: flex; flex-direction: column; gap: 12px; }
.article-card {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  text-decoration: none;
  color: inherit;
}
.article-card:hover .article-card-title { text-decoration: underline; }
.article-card-media {
  display: block;
  width: 100px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  background: #ece8e4;
  flex-shrink: 0;
}
.article-card-media img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  display: block;
}
.article-card-body { min-width: 0; }
.article-card-title {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}
.article-card-excerpt {
  margin: 0;
  color: rgba(0,0,0,0.72);
  font-size: 0.95rem;
}
.article-back { margin: 0 0 12px; }
.article-back a { color: rgba(0,0,0,0.6); text-decoration: none; }
.article-back a:hover { text-decoration: underline; }
.article-admin {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}
.article-admin[hidden] { display: none; }
.article-delete-btn {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #d94c4c;
  border-radius: 8px;
  background: #fff;
  color: #c0392b;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.article-delete-btn:hover:not(:disabled) { background: #fdeeee; }
.article-delete-btn:disabled { opacity: 0.5; cursor: wait; }
.article-admin-status {
  font-size: 0.9rem;
  color: rgba(0,0,0,0.6);
}
.article-admin-status.is-error { color: #c0392b; }
.article-date {
  display: block;
  font-size: 0.9rem;
  color: rgba(0,0,0,0.5);
  margin-bottom: 8px;
}
.article-page h1 { margin-bottom: 20px; }
.article-page ul { padding-left: 1.25em; margin: 0 0 16px; }
.article-page li { margin: 6px 0; }
.article-related {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.article-related h2 { margin: 0 0 16px; font-size: 1.15rem; }
.article-related .articles-list { gap: 10px; }
.article-related .article-card-title { font-size: 1.05rem; }
.category-articles {
  margin: 0 0 18px;
  color: rgba(0,0,0,0.72);
}
.category-articles a { color: #9370DB; font-weight: 600; text-decoration: none; }
.category-articles a:hover { text-decoration: underline; }
.category-tile-name {
  display: block;
  padding: 8px 10px 10px;
  font-weight: 600;
  text-align: center;
}
.category-tile::after { display: none; }
.product-lead {
  margin: 0 0 16px;
  white-space: pre-wrap;
  color: rgba(0,0,0,0.78);
}

.main { width: 100%; min-height: 60vh; }
.catalog {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

/* Страница категорий */
.category-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}
.category-page-inner { max-width: 1200px; margin: 0 auto; }
.category-title { margin: 0 0 6px; font-size: 1.6rem; }
.category-subtitle { margin: 0 0 18px; color: rgba(0,0,0,0.65); }
.category-subtitle a { color: #9370DB; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
.category-tile {
  display: block;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.category-tile::after {
  content: '';
  display: block;
  height: 28px;
}
.category-grid .category-tile:nth-child(1)::after { background: #e74c3c; }
.category-grid .category-tile:nth-child(2)::after { background: #9b59b6; }
.category-grid .category-tile:nth-child(3)::after { background: #1abc9c; }
.category-grid .category-tile:nth-child(4)::after { background: #e67e22; }
.category-grid .category-tile:nth-child(5)::after { background: #2c3e50; }
.category-grid .category-tile:nth-child(6)::after { background: #f39c12; }
.category-grid .category-tile:nth-child(7)::after { background: #27ae60; }
.category-grid .category-tile:nth-child(8)::after { background: #2980b9; }
.category-grid .category-tile:nth-child(9)::after { background: #8e44ad; }
.category-grid .category-tile:nth-child(10)::after { background: #c0392b; }
.category-grid .category-tile:nth-child(11)::after { background: #e91e63; }
.category-grid .category-tile:nth-child(12)::after { background: #34495e; }
.category-grid .category-tile:nth-child(13)::after { background: #00acc1; }
.category-grid .category-tile:nth-child(14)::after { background: #ff6f00; }
.category-grid .category-tile:nth-child(15)::after { background: #1976d2; }
.category-grid .category-tile:nth-child(16)::after { background: #546e7a; }
.category-grid .category-tile:nth-child(17)::after { background: #6d4c41; }
.category-grid .category-tile:nth-child(18)::after { background: #5d4037; }
.category-grid .category-tile:nth-child(19)::after { background: #00897b; }
.category-tile::after { display: none !important; }
.category-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}
.category-img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  display: block;
  background: #e8e4e0;
}
/* Сетка: до 5 карточек в ряд по 225px, дальше подстраивается под ширину экрана */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
  max-width: 1221px; /* 5 × 225px + 4 × 24px */
  margin: 0 auto;
}

.catalog-card {
  background: transparent;
  border-radius: 0;
  overflow: visible;
  display: flex;
  flex-direction: column;
  padding: 0;
  gap: 8px;
}
.catalog-card-panel {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  padding: 0 8px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.catalog-card-image-wrap {
  display: block;
  flex-shrink: 0;
  position: relative;
}
.catalog-card-image {
  width: calc(100% + 16px);
  aspect-ratio: 3 / 4;
  height: auto;
  margin-left: -8px;
  margin-right: -8px;
  object-fit: cover;
  background: #e8e4e0;
  display: block;
  border-radius: 0;
}
.catalog-card-name-link {
  color: inherit;
  text-decoration: none;
}
.catalog-card-name-link:hover {
  text-decoration: underline;
}
.catalog-card-body {
  padding: 6px 0 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.catalog-card-name {
  margin: 0 0 10px;
  font-size: 0.95rem;
  font-weight: 400;
  color: #2d2a26;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  flex-shrink: 0;
}
.catalog-card-price,
.product-price,
.discount-badge {
  display: none !important;
}
.catalog-card-btn {
  margin-top: 0;
  margin-bottom: 0;
  margin-left: 0;
  margin-right: 0;
  display: block;
  width: 100%;
  padding: 10px 12px;
  background: #a73afd;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
  box-sizing: border-box;
  flex-shrink: 0;
}
.catalog-card-btn:hover { background: #8f22ea; }

.favorite-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: transform 0.15s ease, background 0.2s ease, color 0.2s ease;
}
.favorite-btn:hover {
  transform: scale(1.06);
}
.favorite-btn--card {
  position: absolute;
  top: 10px;
  right: 2px;
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  color: #999;
  font-size: 24px;
  border-radius: 0;
  box-shadow: none;
  z-index: 3;
}
/* Пока товар не в избранном, сердце прозрачное — видно только контур */
.favorite-btn--card:not(.is-active) {
  color: transparent;
  -webkit-text-stroke: 1.4px rgba(90, 90, 90, 0.85);
}
.favorite-btn--card.is-active {
  color: #FF0000;
  -webkit-text-stroke: 0;
}
.favorite-btn--product {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #999;
  font-size: 22px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.favorite-btn--product:not(.is-active) {
  color: transparent;
  -webkit-text-stroke: 1.4px rgba(90, 90, 90, 0.85);
}
.favorite-btn--product.is-active {
  color: #FF0000;
  -webkit-text-stroke: 0;
}

.catalog-load-more-wrap {
  text-align: center;
  padding: 24px;
}
.catalog-load-more-wrap.hidden { display: none; }
.catalog-load-more-btn {
  padding: 12px 32px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #708090;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.catalog-load-more-btn:hover {
  background: #5a6a7a;
}
.catalog-end {
  text-align: center;
  padding: 24px;
  color: #666;
  font-size: 0.95rem;
}
.catalog-end.hidden { display: none; }

.favorites-title {
  margin: 0 0 20px;
  text-align: center;
  color: #2d2a26;
}
.favorites-empty {
  text-align: center;
  color: #666;
  font-size: 1rem;
}
.favorites-empty.hidden { display: none; }
.search-results-query {
  margin: 0 0 16px;
  text-align: center;
  color: #666;
  font-size: 0.95rem;
}

/* Подвал */
.footer {
  background: #293133;
  color: #e8e4e0;
  margin-top: 48px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 24px 24px;
}
.footer-top {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 48px;
  padding-bottom: 32px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.footer-logo { margin-right: 24px; }
.footer-logo .logo-text { color: #fff; }

/* Скрыть логотипы в футере */
.footer-logo,
.footer-logo-img { display: none !important; }
.footer-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 48px;
  flex: 1;
}
.footer-col-title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}
.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
}
/* Списки категорий длинные, поэтому разбиваем их на две колонки */
.footer-col:not(.footer-col-help):not(.footer-col-social) .footer-links {
  column-count: 2;
  column-gap: 28px;
}
.footer-links li {
  margin-bottom: 6px;
  break-inside: avoid;
}
.footer-links a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-block;
  padding: 6px 0;
}
.footer-links a:hover { color: #fff; }

.footer-col-social {
  flex: 0 0 auto;
}
.footer-col-social .footer-col-title {
  margin-bottom: 10px;
}
.footer-social {
  display: flex;
  gap: 12px;
}
.footer-social-link {
  color: rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.footer-social-link:hover { color: #fff; }
.footer-qr {
  display: inline-block;
  margin-top: 14px;
  padding: 4px;
  background: #fff;
  border-radius: 6px;
  line-height: 0;
}
.footer-qr img {
  display: block;
  width: 80px;
  height: 80px;
}

.footer-bottom { padding-top: 20px; }
.footer-copy {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  text-align: center;
  line-height: 1.6;
}

/* Карточка товара */
.product-main {
  padding: 24px 24px 48px;
}
.product-card {
  max-width: 1100px;
  margin: 0 auto;
}
.product-title {
  margin: 0 0 24px;
  font-size: 1.75rem;
  font-weight: 700;
  color: #2d2a26;
  line-height: 1.3;
}
.product-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.product-gallery {
  flex: 0 0 450px;
  order: 1;
  max-width: 100%;
  position: relative;
  display: flex;
  align-items: center;
}
.product-gallery-inner {
  position: relative;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  border-radius: 12px;
  background: #e8e4e0;
  width: 450px;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 80vh;
  touch-action: pan-y;
}
.product-gallery-track {
  display: flex;
  transition: transform 0.3s ease;
  width: 100%;
  height: 100%;
}
.product-gallery-img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}
.product-gallery-dots {
  display: none; /* включается только на телефонах, где галерея листается свайпом */
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 10px;
}
.product-gallery-dot {
  position: relative;
  width: 8px;
  height: 8px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.18);
  cursor: pointer;
  transition: background 0.2s;
}
/* Точка маленькая, но попадать по ней пальцем нужно уверенно */
.product-gallery-dot::after {
  content: '';
  position: absolute;
  inset: -10px;
}
.product-gallery-dot.is-active { background: #9370DB; }
.product-gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(147, 112, 219, 0.9);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.product-gallery-prev { left: 12px; }
.product-gallery-next { right: 12px; }
.product-gallery-btn:hover {
  background: rgba(131, 96, 201, 0.95);
}
.product-side {
  flex: 1;
  min-width: 280px;
  order: 2;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.product-price-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.product-order-btn {
  display: inline-block;
  padding: 12px 24px;
  background: #9370DB;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 0;
  transition: background 0.2s;
}
.product-order-btn:hover {
  background: #8360c9;
}
.product-description-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #2d2a26;
}
.product-description-text {
  margin: 0;
  font-size: 14px;
  color: #444;
  line-height: 1.6;
  white-space: pre-line;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: #FF0000;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease, background 0.2s ease;
  z-index: 1200;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #d90000;
}
/* ==========================================================================
   Адаптив
   ========================================================================== */

/* Планшеты: уменьшаем боковые отступы, чтобы контенту было просторнее */
@media (max-width: 1024px) {
  .home-intro { padding: 20px 16px 0; }
  .home-title { font-size: 1.3rem; }
  .content-page { padding: 24px 16px 40px; }
  .articles-page { padding: 24px 16px 40px; }
  .catalog { padding: 24px 16px 40px; }
  .category-page { padding: 24px 16px 40px; }
  .product-main { padding: 20px 16px 40px; }
  .footer-inner { padding: 32px 16px 20px; }
}

/* Карточка товара: галерея и описание в одну колонку */
@media (max-width: 900px) {
  .product-layout { gap: 20px; }
  .product-gallery { flex: 0 0 100%; }
  .product-gallery-inner { width: 100%; max-width: 420px; max-height: none; margin: 0 auto; }
  .product-side { min-width: 0; flex: 1 1 100%; }
}

/* На телефоне и узком планшете: логотип, поиск и кнопка-меню справа.
   Каталог, интересное, кабинет, избранное и просмотренные — в выезжающей панели. */
@media (max-width: 820px) {
  .header {
    position: sticky;
    top: 0;
    z-index: 100;
    font-size: 16px;
    background: #fff;
    padding-top: env(safe-area-inset-top, 0px);
  }
  .header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  }
  .logo { order: 1; }
  .search-wrap {
    order: 2;
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
  }
  .menu-toggle {
    margin-left: auto;
    display: inline-flex;
    order: 3;
    position: relative;
    z-index: 3;
  }
  .logo-img { height: 40px; }
  .header-drawer {
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    top: calc(100% - 4px);
    right: max(8px, env(safe-area-inset-right, 0px));
    left: auto;
    bottom: auto;
    width: min(300px, calc(100vw - 16px));
    max-height: min(420px, calc(100dvh - 80px));
    margin: 0;
    padding: 10px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow-y: auto;
    z-index: 2;
    transform: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s;
  }
  .header.is-menu-open .header-drawer {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .header-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    order: 1;
    margin-left: 0;
  }
  .nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    order: 2;
    width: 100%;
    margin-top: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }
  .btn-login { order: 1; }
  .icon-btn--fav { order: 2; }
  .icon-btn--viewed { order: 3; }
  .header-drawer .nav-link,
  .header-drawer .icon-btn,
  .header-drawer .btn-login {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 12px 10px;
    border: none;
    border-radius: 10px;
    white-space: normal;
    text-align: left;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.3;
  }
  .header-drawer .icon-btn svg { flex-shrink: 0; }
  .header-drawer .nav-link:hover,
  .header-drawer .nav-link.is-current,
  .header-drawer .icon-btn:hover,
  .header-drawer .btn-login:hover {
    background: rgba(41, 49, 51, 0.08);
  }
  .header-menu-label { display: inline; }
  .menu-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.4);
  }
  .menu-backdrop[hidden] { display: none; }
  body.is-menu-open { overflow: hidden; }
}

/* Телефоны */
@media (max-width: 700px) {
  .header-inner {
    gap: 8px;
    padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px));
  }
  .logo-img { height: 34px; }
  .content-page { padding: 16px 12px 32px; }
  .content-page h1 { font-size: 1.3rem; }
  .articles-page { padding: 16px 12px 32px; }
  .article-card { gap: 12px; padding: 10px; }
  .article-card-title { font-size: 1.02rem; }
  .article-card-excerpt { font-size: 0.9rem; }
  .search-input { font-size: 16px; padding: 12px; }
  .search-btn { padding: 12px; }
  .search-btn svg { width: 18px; height: 18px; }

  /* Каталог: две карточки в ряд — привычный для маркетплейсов формат */
  .catalog { padding: 16px 10px 28px; }
  .catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    max-width: none;
  }
  .catalog-card {
    padding: 0;
    border-radius: 0;
    gap: 6px;
  }
  .catalog-card-panel {
    padding: 0 6px 10px;
    border-radius: 10px;
  }
  .catalog-card-image {
    width: calc(100% + 12px);
    margin-left: -6px;
    margin-right: -6px;
    border-radius: 0;
  }
  .catalog-card-body { padding-top: 6px; }
  .catalog-card-name { font-size: 0.8rem; margin-bottom: 8px; }
  .catalog-card-btn {
    padding: 11px 6px;
    font-size: 0.78rem;
    margin-bottom: 0;
  }
  .favorite-btn--card {
    top: 2px;
    right: 1px;
    padding: 7px 8px;
    font-size: 26px;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.45));
  }

  .catalog-load-more-wrap { padding: 18px 0 8px; }
  .catalog-load-more-btn { width: 100%; padding: 14px 20px; }
  .favorites-title { font-size: 1.25rem; margin-bottom: 14px; }
  .favorites-empty, .search-results-query { font-size: 0.9rem; }

  /* Категории */
  .category-page { padding: 16px 10px 28px; }
  .category-title { font-size: 1.3rem; }
  .category-subtitle { font-size: 0.9rem; margin-bottom: 14px; }
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .category-tile { border-radius: 10px; }
  .category-img { height: 110px; }
  .category-tile::after { height: 18px; }

  /* Карточка товара */
  .product-main { padding: 14px 12px 32px; }
  .product-title { font-size: 1.15rem; margin-bottom: 14px; }
  .product-gallery {
    flex-direction: column;
    align-items: stretch;
  }
  .product-gallery-inner { flex: none; max-width: none; }
  .product-gallery-dots { display: flex; }
  .product-gallery-btn {
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.35);
  }
  .product-gallery-btn:hover { background: rgba(0,0,0,0.45); }
  .product-gallery-btn svg { width: 22px; height: 22px; }
  .product-gallery-prev { left: 6px; }
  .product-gallery-next { right: 6px; }
  .product-price-row {
    gap: 12px;
    margin-bottom: 18px;
  }
  .favorite-btn--product {
    top: 8px;
    right: 8px;
  }
  .product-order-btn {
    flex: 1 1 100%;
    text-align: center;
    padding: 14px 16px;
  }
  .product-description-title { font-size: 1rem; }
  .product-description-text { font-size: 16px; }

  /* Подвал */
  .footer { margin-top: 28px; }
  .footer-inner { padding: 24px 14px calc(16px + env(safe-area-inset-bottom, 0px)); }
  .footer-top { gap: 20px; padding-bottom: 18px; }
  .footer-columns { gap: 18px 24px; }
  .footer-col { flex: 1 1 140px; }
  /* Две колонки ссылок помещаются только на всю ширину экрана */
  .footer-col:not(.footer-col-help):not(.footer-col-social) { flex: 1 1 100%; }
  .footer-col:not(.footer-col-help):not(.footer-col-social) .footer-links { column-gap: 18px; }
  .footer-col-social { flex: 1 1 auto; }
  .footer-col-title { font-size: 0.95rem; margin-bottom: 8px; }
  .footer-links a {
    display: inline-block;
    padding: 8px 0;
    font-size: 0.9rem;
  }
  .footer-copy { font-size: 0.8rem; }

  .back-to-top {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: 44px;
    height: 44px;
  }
}

/* Узкие телефоны: ужимаем только отступы, размеры кнопок не трогаем,
   иначе по ним станет неудобно попадать пальцем */
@media (max-width: 380px) {
  .header-inner {
    padding: 8px max(8px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px));
    gap: 6px;
  }
  .logo-img { height: 32px; }
  .catalog { padding: 14px 8px 24px; }
  .catalog-grid { gap: 8px; }
  .catalog-card-btn { font-size: 0.74rem; }
  .category-img { height: 92px; }
  .article-card {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 10px;
  }
  .article-card-media,
  .article-card-media img {
    width: 72px;
    height: 72px;
  }
}

/* На тач-экранах hover залипает — отключаем визуальные эффекты наведения */
@media (hover: none) {
  .catalog-card-name-link:hover { text-decoration: none; }
  .favorite-btn:hover { transform: none; }
  .category-tile:hover {
    transform: none;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  }
}
