/* ===== Мобильная версия: компактные размеры, аккуратные отступы ===== */
@media (max-width: 820px) {
  html { -webkit-text-size-adjust: 100%; }
  body { font-size: 15px; line-height: 1.5; overflow-x: hidden; }

  /* шапка и меню */
  .site-header { height: 60px; }
  .brand img { width: 92px; height: 46px; }
  .cart-trigger { padding: 8px 12px; font-size: 10px; }
  .mobile-menu { gap: 14px; padding: 88px 7vw calc(28px + env(safe-area-inset-bottom)); font-size: 19px; line-height: 1.25; }
  .mobile-menu a { font-weight: 600; }

  /* первый экран */
  .hero-message-kicker { font-size: 10px; letter-spacing: .12em; }
  .hero-message h1 { font-size: clamp(24px, 7vw, 30px); line-height: 1.15; }

  /* секции и заголовки */
  .section { padding: 56px 6vw; }
  .section-label { font-size: 9px; letter-spacing: .12em; }
  .display, .section-head .display { font-size: clamp(28px, 8.2vw, 34px); line-height: 1.08; margin-top: 18px; }
  .scene-copy h2 { font-size: clamp(28px, 8vw, 34px); line-height: 1.08; margin: 16px 0; }
  .intro-text p, .scene-copy p, .section-head .section-description { font-size: 15px; line-height: 1.55; }
  h2 { font-size: clamp(22px, 6.4vw, 26px); line-height: 1.18; }
  h3 { line-height: 1.25; }

  /* кнопки */
  .cta-button { font-size: 15px; padding: 12px 12px 12px 22px; min-height: 0; }
  .cta-button .cta-arrow { width: 36px; height: 36px; font-size: 16px; flex: none; }
  .hero-cta { max-width: 320px; }
  .button { font-size: 14px; padding: 13px 18px; }
  .button.full { height: auto; }

  /* полоса преимуществ 01–04: оставляем бежевые круги и SemiBold */
  .feature-line { margin-top: 40px; padding-top: 22px; gap: 16px 12px; }
  .feature-line strong { width: 36px; height: 36px; font-size: 12px; font-weight: 600; flex: none; }
  .feature-line span { font-size: 13px; font-weight: 600; line-height: 1.3; }

  /* бегущая строка, плавающая кнопка */
  .ticker { font-size: 10px; }
  .ask-button { padding: 6px 14px 6px 6px; font-size: 13px; }
  .ask-button img { width: 32px; height: 32px; }

  /* подвал */
  .site-footer { font-size: 13px; }
  .footer-phone { font-size: 16px; }
  .footer-col h4 { font-size: 11px; }
  .footer-col a { font-size: 14px; }
  .footer-legal { font-size: 11px; }
}

@media (max-width: 460px) {
  .section { padding-block: 48px; }
  .display, .section-head .display { font-size: clamp(26px, 8vw, 31px); }
}

/* ===== Финальные размеры (перекрывают старые наслоения правил) ===== */
@media (max-width: 820px) {
  body .hero-message h1 { font-size: clamp(22px, 6.8vw, 28px) !important; line-height: 1.12 !important; }
  body .hero-message h1 .hero-line { white-space: nowrap; }
  body h1.display, body h2.display, body .display, body .section-head .display { font-size: clamp(27px, 7.8vw, 32px) !important; line-height: 1.1 !important; }
  body .th-h2, body .th-copy .th-title { font-size: clamp(26px, 7.6vw, 31px) !important; line-height: 1.12 !important; }
  body .hw-title, body main h2 { font-size: clamp(22px, 6.2vw, 26px) !important; line-height: 1.18 !important; }
  body .scene-copy h2 { font-size: clamp(27px, 7.8vw, 32px) !important; }
  body .contact-phone { font-size: 22px !important; }
  body .director-copy .signature, body .signature { font-size: 20px !important; }
  body .brand-title { font-size: 18px !important; }
  body .cart-drawer .drawer-head h3, body .drawer-head h3 { font-size: 24px !important; }
  body .cart-drawer strong { font-size: 22px !important; }

  body .cta-button { font-size: 15px !important; padding: 10px 10px 10px 22px !important; min-height: 0 !important; }
  body .cta-button .cta-arrow { width: 36px !important; height: 36px !important; font-size: 16px !important; }
  body .th-cta { min-height: 52px !important; font-size: 16px !important; padding: 0 7px 0 22px !important; border-radius: 999px !important; gap: 12px !important; }
  body .th-cta i { width: 38px !important; height: 38px !important; font-size: 20px !important; border-radius: 50% !important; }
  body .th-social { gap: 10px !important; padding: 5px 16px 5px 5px !important; width: auto !important; align-self: flex-start !important; }
  body .th-social-mark { width: 38px !important; height: 38px !important; }
  body .th-social-mark img { width: 25px !important; }
  body .th-social-text strong { font-size: 13px !important; }
  body .th-social-text small { font-size: 11px !important; }
  body .button, body .button.full, body .cart-drawer .button, body .cart-drawer .button.full { font-size: 15px !important; min-height: 48px !important; padding: 12px 18px !important; }

  body .device-tile { min-height: 0; }
  body .device-tile h3 { font-size: 16px !important; }
}

/* =====================================================================
   Мобильная доработка (iPhone / Android, 320–820 px)
   Десктоп не затрагивается: всё внутри media queries.
   ===================================================================== */
@media (max-width: 820px) {
  /* 1. Никакого горизонтального скролла */
  html, body { max-width: 100%; overflow-x: hidden; overflow-x: clip; }
  body { overflow-wrap: break-word; -webkit-tap-highlight-color: transparent; }
  img, video { max-width: 100%; }
  a, button, summary, label, select, input { touch-action: manipulation; }

  /* 2. iOS не должен увеличивать страницу при фокусе: поля ввода ≥ 16 px */
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }

  /* 3. Зоны нажатия ≥ 44 px */
  .menu-trigger { min-width: 44px; min-height: 44px; align-items: flex-end; justify-content: center; }
  .header-search { min-width: 44px; min-height: 44px; display: inline-grid; place-items: center; }
  .cart-trigger { min-height: 44px; }
  .close-button { min-width: 44px; min-height: 44px; }
  .mobile-menu a { padding-block: 4px; min-height: 44px; display: flex; align-items: center; }
  .footer-col { gap: 2px; }
  .footer-col a { padding-block: 11px; }
  .footer-legal-links a, .footer-social, .pill, .topbar-link { min-height: 44px; display: inline-flex; align-items: center; }
  .ask-panel a { min-height: 48px; }
  .ask-button { min-height: 52px; }

  /* 4. Крупные CTA-кнопки: на всю ширину, в колонку, с зазором между ними */
  .cta-buttons { flex-direction: column; align-items: stretch; gap: 12px; }
  .cta-buttons .button, .hero-cta, .cta-button { width: 100%; max-width: none; }
  body .button, body .button.full, body .th-cta { min-height: 52px !important; }
  body .cta-button { min-height: 56px !important; }

  /* 5. Корзина, модальные окна и плавающая кнопка: dvh и safe-area (панели Safari) */
  .cart-drawer { height: 100dvh; width: 100%; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .modal { padding: 12px; overscroll-behavior: contain; }
  .modal-card { max-height: 92dvh; padding: 26px 20px 22px; -webkit-overflow-scrolling: touch; }
  .modal-card h3 { font-size: 28px; margin: 8px 0 18px; }
  .mobile-menu { overscroll-behavior: contain; padding-left: max(8vw, env(safe-area-inset-left)); padding-right: max(8vw, env(safe-area-inset-right)); }
  .ask-widget { right: max(14px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); }
  .site-footer { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}

/* Узкие телефоны: iPhone SE / mini, старые Android (320–360 px) */
@media (max-width: 360px) {
  .site-header { padding-inline: 4vw; }
  .brand img { width: 88px; height: 44px; }
  .header-actions { gap: 4px; }
  .cart-trigger { padding: 8px 10px; }
  .section { padding-inline: 5vw; }
  body .hero-message h1 { font-size: 20px !important; }
  body h1.display, body h2.display, body .display, body .section-head .display { font-size: 25px !important; }
  body .th-h2, body .th-copy .th-title { font-size: 24px !important; }
  .ask-button span { display: none; }               /* остаётся круглая кнопка с фото */
  .ask-button { padding: 6px; }
  body .button, body .th-cta { font-size: 14px !important; }
}

/* Большие телефоны и небольшие планшеты (428–768 px): более просторные отступы */
@media (min-width: 428px) and (max-width: 820px) {
  .section { padding-inline: 7vw; }
  .cta-buttons { flex-direction: row; flex-wrap: wrap; }
  .cta-buttons .button { flex: 1 1 220px; width: auto; }
}

/* Касание: убираем «залипающие» hover-эффекты на сенсорных экранах */
@media (hover: none) {
  .button:hover, .cta-button:hover, .th-cta:hover, .ask-button:hover { transform: none; }
}

/* =====================================================================
   Мобильная версия: аккуратная раскладка без наложений
   ===================================================================== */
@media (max-width: 820px) {
  /* Шапка при прокрутке — сплошная, контент под ней не просвечивает */
  body .site-header.scrolled, body .site-header.solid { background: #070707 !important; border-bottom: 1px solid rgba(255,255,255,.1); }

  /* Галерея iPhone: вместо наложенных карточек — текст, затем сетка карточек */
  body .iphone-scene { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; min-height: 0; padding: 64px 6vw 72px; }
  body .scene-copy { grid-column: 1 / -1; position: relative; inset: auto; max-width: none; margin: 0 0 18px; padding: 0; z-index: 2; }
  body .scene-orbit { top: 50%; bottom: auto; left: 50%; width: 120vw; height: 120vw; transform: translate(-50%, -50%); opacity: .5; pointer-events: none; z-index: 0; }
  body .scene-side-label { display: none; }
  body .phone-card { position: relative; inset: auto; left: auto; top: auto; bottom: auto; width: auto; height: auto; aspect-ratio: 4 / 5;
    display: flex; flex-direction: column; padding: 8px 8px 12px; transform: none !important; z-index: 1; }
  body .phone-card-one { grid-column: 1 / -1; aspect-ratio: 1 / 1; }
  body .phone-card img { flex: 1 1 0; min-height: 0; height: 0; width: 100%; }
  body .phone-card span { flex: none; margin: 10px 2px 0; font-size: 10px; letter-spacing: .04em; line-height: 1.3; white-space: normal; overflow: visible; }

  /* Плавающая кнопка плавно скрывается, когда виден подвал (не закрывает адрес и ссылки) */
  .ask-widget { transition: opacity .3s ease, transform .3s ease; }
  .ask-widget.is-hidden { opacity: 0; transform: translateY(16px); pointer-events: none; }

  /* Подвал: ровные отступы между блоками */
  body .footer-main { gap: 28px; }
  body .footer-address { line-height: 1.65; }
}

/* Кнопка «Смотреть товары» на телефоне — компактнее */
@media (max-width: 820px) {
  body .hero-cta, body a.cta-button.hero-cta { display: flex !important; width: fit-content !important; max-width: none !important; margin-inline: auto !important; justify-content: center !important; gap: 14px;
    min-height: 46px !important; font-size: 14px !important; padding: 6px 6px 6px 20px !important; }
  body .hero-cta .cta-arrow { width: 32px !important; height: 32px !important; font-size: 14px !important; }
}

/* Первый экран на телефоне: крупнее текст */
@media (max-width: 820px) {
  body .hero-message { width: 96vw; padding-inline: 8px; }
  body .hero-message h1 { font-size: clamp(26px, 7.8vw, 38px) !important; line-height: 1.1 !important; }
  body .hero-message h1 .hero-line { white-space: normal; }   /* если строка не влезла — переносится, а не обрезается */
  body .hero-message-kicker { font-size: 12px; letter-spacing: .12em; margin-bottom: 14px; }
}
@media (max-width: 360px) {
  body .hero-message h1 { font-size: 25px !important; }
  body .hero-message-kicker { font-size: 11px; letter-spacing: .1em; }
}

/* Плашки «В наличии» / «Хит продаж» на карточках — одинаковый вид на ПК и телефоне:
   тёмные, в левом нижнем углу фото; «В наличии» — с зелёной точкой */
body .product-badges { top: auto; right: auto; bottom: 14px; left: 14px; align-items: flex-start; flex-direction: column-reverse; gap: 6px; max-width: calc(100% - 28px); }
body .product-badges > span { padding: 6px 12px; font-size: 12px; }
body .product-stock { display: inline-flex; align-items: center; gap: 7px; background: rgba(10,10,10,.86); color: #f3d9b8; border: 1px solid rgba(227,195,156,.55); box-shadow: none; }
body .product-stock::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #4cd964; flex: none; }
body .product-stock.is-out { background: rgba(60,60,64,.9); color: #e5e5ea; border-color: rgba(255,255,255,.25); }
body .product-stock.is-out::before { background: #8e8e93; }
body .product-stock.is-order::before { background: #ff9f0a; }
@media (max-width: 820px) {
  /* «N вариантов» — золотая, вверху слева */
  body .product-tag { top: 8px !important; left: 8px !important; right: auto; max-width: calc(100% - 16px); }
  body .product-badges { bottom: 12px; left: 8px; gap: 5px; max-width: calc(100% - 16px); }
  body .product-badges > span { padding: 5px 10px; font-size: 11px; }
}

/* Trade-in на телефоне: подзаголовок заметно меньше заголовка */
@media (max-width: 820px) {
  body .th-copy .th-sub { font-size: 16px !important; line-height: 1.5 !important; margin-top: 14px; max-width: 34em; }
}

/* Trade-in на телефоне: заголовок «Преимущества Trade-in» по центру, как у «Как работает Trade-in» */
@media (max-width: 820px) {
  body .tr-adv h2 { text-align: center; max-width: none; }
}

/* Мобильное меню: контакты — отдельный блок, не похожий на пункты разделов */
.mobile-menu-contacts { display: none; }
@media (max-width: 820px) {
  .mobile-menu .mobile-menu-contacts { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; padding-top: 24px; border-top: 1px solid var(--line); }
  .mobile-menu .mmc-label { color: var(--muted); font: 600 11px/1 var(--sf-pro, inherit); letter-spacing: .14em; text-transform: uppercase; }
  .mobile-menu .mobile-menu-contacts a { width: 100%; min-height: 48px; padding: 0 16px; gap: 10px; justify-content: center; border: 1px solid rgba(201,160,108,.45); border-radius: 999px; font-size: 15px; font-weight: 600 !important; color: var(--gold-light); background: rgba(201,160,108,.06); }
  .mobile-menu .mobile-menu-contacts a svg { width: 18px; height: 18px; flex: none; }
  .mobile-menu .mmc-phone { background: linear-gradient(135deg, #e3c39c, #a98350) !important; color: #111 !important; border-color: transparent !important; font-size: 16px !important; }
  .mobile-menu .mmc-social { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
}

/* Первый экран на телефоне: ещё крупнее заголовок (строки по-прежнему в одну линию) */
@media (max-width: 820px) {
  body .hero { padding-inline: 0 !important; }
  body .hero-copy.hero-message { width: 100% !important; max-width: 100% !important; margin-inline: 0 !important; justify-self: stretch !important; padding-inline: 6px !important; box-sizing: border-box; text-align: center; }
  body .hero-message h1 { font-size: min(8.4vw, 46px) !important; }
  body .hero-message-kicker { font-size: 12px; letter-spacing: .1em; margin-bottom: 14px; }
}

/* Первый экран на телефоне: iPhone крупнее по высоте — кадр чуть подрезан по бокам, линзы и вспышка целиком */
@media (max-width: 820px) {
  body .hero-video {
    inset: auto 0 8% 0;
    width: 100%;
    height: 64vw;
    aspect-ratio: auto;
    object-fit: cover;
    object-position: center bottom;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 22%, #000 82%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0, #000 6%, #000 94%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 22%, #000 82%, transparent 100%);
    mask-composite: intersect;
  }
}



/* Заголовок первого экрана на телефоне: 4 короткие строки, шрифт крупнее */
.hero-message h1 .hero-line-m { display: none; }
@media (max-width: 820px) {
  body .hero-message h1 .hero-line:not(.hero-line-m) { display: none; }
  body .hero-message h1 .hero-line.hero-line-m { display: block; white-space: nowrap; }
  body .hero-message h1 { font-size: min(10.4vw, 50px) !important; }
  body .hero.video-finished .hero-message h1 .hero-line-m:nth-of-type(4) > b { animation-delay: .3s; }
  body .hero.video-finished .hero-message h1 .hero-line-m:nth-of-type(5) > b { animation-delay: .45s; }
  body .hero.video-finished .hero-message h1 .hero-line-m:nth-of-type(6) > b { animation-delay: .6s; }
  body .hero.video-finished .hero-message h1 .hero-line-m:nth-of-type(7) > b { animation-delay: .75s; }
}

/* Блок «Технологии, выбранные лично»: заголовок крупнее, описание мельче */
@media (max-width: 820px) {
  body .intro .intro-title { font-size: min(9vw, 36px) !important; }
  body .intro .intro-text p { font-size: 15px !important; line-height: 1.55 !important; }
}

/* Открытое мобильное меню: шапка — размытая полоса, под ней прокручиваются пункты и не сливаются с лого */
@media (max-width: 820px) {
  .site-header.menu-open::after {
    content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: -4px; z-index: 1; pointer-events: none;
    background: rgba(8,8,8,.78);
    -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(0,0,0,.45);
  }
}

/* Доступные цвета на карточке товара */
.product-swatches { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; pointer-events: none; }
.product-swatches .swatch { display: block; width: 20px; height: 20px; border-radius: 50%; background: var(--sw, #8e8e93); box-shadow: inset 0 0 0 1px rgba(128,128,128,.4), inset 0 2px 3px rgba(255,255,255,.22); }
.product-swatches .swatch-more { font: 600 12px/1 var(--sf-pro, inherit); color: var(--muted, #8e8e93); }
@media (max-width: 820px) { .product-swatches { gap: 8px; margin-top: 10px; } .product-swatches .swatch { width: 18px; height: 18px; } }

/* «Хит продаж» — золотая плашка с пламенем и мягким бликом (ПК и телефон) */
body .product-badges > span.product-hit {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px 6px 7px;
  background: linear-gradient(135deg, #f7e2c0 0%, #d9b27a 45%, #a67a3f 100%);
  color: #1a1206; border: 1px solid rgba(255,240,215,.75);
  font: 800 11px/1 var(--sf-pro, inherit); letter-spacing: .09em; text-transform: uppercase;
  box-shadow: 0 0 0 3px rgba(227,195,156,.16), 0 8px 22px rgba(166,122,63,.45) !important;
}
body .product-badges > span.product-hit::before {
  content: ""; flex: none; width: 20px; height: 20px; border-radius: 50%;
  background: #120d06 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23f3d9b8' d='M12.6 2.5c.4 3-1.4 4.6-3 6.4-1.5 1.7-2.8 3.4-2.8 5.9a5.2 5.2 0 0 0 10.4.4c0-1.8-.7-3.1-1.6-4.2-.2 1.2-.8 2-1.7 2.4.5-3.2-.5-7.2-1.3-10.9Z'/%3E%3C/svg%3E") center / 13px no-repeat;
}
body .product-badges > span.product-hit::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.65), transparent);
  transform: skewX(-18deg); animation: hitShine 3.6s ease-in-out infinite;
}
@keyframes hitShine { 0%, 55% { left: -60%; } 100% { left: 130%; } }
@media (max-width: 640px) {
  body .product-badges > span.product-hit { padding: 5px 11px 5px 5px; font-size: 10px; gap: 6px; }
  body .product-badges > span.product-hit::before { width: 17px; height: 17px; background-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { body .product-badges > span.product-hit::after { animation: none; display: none; } }

/* Мобильное меню: юридические ссылки внизу */
.mobile-menu-legal { display: none; }
@media (max-width: 820px) {
  .mobile-menu .mobile-menu-legal { display: flex; flex-direction: column; gap: 14px; margin-top: 26px; padding: 4px 0 28px; }
  .mobile-menu .mobile-menu-legal a { padding: 0; min-height: 0; font-size: 13px; font-weight: 400 !important; line-height: 1.35; color: var(--muted); opacity: .85; text-decoration: underline; text-decoration-color: rgba(201,160,108,.35); text-underline-offset: 3px; }
}

/* «Новинка» — зелёная плашка со звездой (ПК и телефон) */
body .product-badges > span.product-new {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
  background: linear-gradient(135deg, #e9fbe4 0%, #b9eaa9 100%); color: #12380c; border: 1px solid rgba(255,255,255,.8);
  font: 800 11px/1 var(--sf-pro, inherit); letter-spacing: .09em; text-transform: uppercase;
  box-shadow: 0 0 0 3px rgba(120,200,100,.18), 0 8px 22px rgba(70,150,60,.35) !important;
}
body .product-badges > span.product-new::before { content: "★"; font-size: 12px; line-height: 1; }
@media (max-width: 640px) { body .product-badges > span.product-new { padding: 5px 10px; font-size: 10px; } }

.product-swatches .swatch.is-out { opacity: .35; }
