/* AUTOPARTS_KAZ — микроанимации и «пружина». Только CSS, без скриптов и библиотек.
   Подключать ПОСЛЕ style.css:  <link rel="stylesheet" href="css/motion.css?v=1">

   1. плавное появление секций при прокрутке
   2. hover-эффекты на кнопках
   3. лёгкое движение иконок и картинок
   4. мягкое открытие окна товара и корзины

   Ничего резкого: сдвиги 1–18 px, длительности 0.2–0.4 с. Всё движение отключается,
   если в системе включено «уменьшить движение». Анимируются только opacity, translate,
   scale, transform — их рисует видеокарта, раскладка страницы не пересчитывается. */

/* ---------- цвета меняются плавно всегда (это не движение) ---------- */
.btn,
.tv-add button,
.tv-toggle button,
.bt-toggle button,
.na-nav button,
.mobile-cta-bar a,
.modelinks__list a,
.sm-list a,
.cats .btn {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease,
              box-shadow .2s ease, transform .2s ease, opacity .2s ease;
}
.header__search input { transition: box-shadow .2s ease; }
.header__search input:focus { box-shadow: 0 0 0 3px rgba(255, 255, 255, .28); outline: none; }

@media (prefers-reduced-motion: no-preference) {

  /* ---------- 2. кнопки: чуть приподнимаются под курсором, слегка вдавливаются при нажатии ---------- */
  @media (hover: hover) {
    .btn:hover,
    .tv-add button:hover,
    .cats .btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 4px 12px rgba(0, 0, 0, .14);
    }
    .tv-toggle button:hover,
    .bt-toggle button:hover,
    .na-nav button:hover:not(:disabled),
    .modelinks__list a:hover,
    .sm-list a:hover {
      transform: translateY(-1px);
    }
  }
  .btn:active,
  .tv-add button:active,
  .tv-toggle button:active,
  .bt-toggle button:active,
  .na-nav button:active:not(:disabled),
  .mobile-cta-bar a:active,
  .cats .btn:active {
    transform: translateY(0) scale(.98);
    box-shadow: none;
    transition-duration: .08s;
  }

  /* ---------- 3. иконки и картинки ---------- */
  /* звезда у «Новых поступлений» — медленно «дышит» */
  .na-title .na-icon { animation: apk-breathe 3.6s ease-in-out infinite; }

  /* плитки марок и подборок (Toyota, Lexus, Горячий товар, Распродажа) */
  .bl-logos a { transition: transform .25s ease, box-shadow .25s ease; }
  .bl-logos a img { transition: scale .35s ease; }

  /* фото в карточках чуть приближается под курсором */
  .card__img,
  .model-card__imgwrap img,
  .na-photo img,
  .sm-card__img img { transition: scale .35s ease; }

  /* точки наличия по городам появляются по очереди */
  .stock i.on { animation: apk-dot .5s ease backwards; }
  .stock i.on:nth-child(2) { animation-delay: .08s; }

  /* крестик закрытия окна слегка поворачивается */
  .modal__close { transition: color .2s ease, rotate .25s ease; }

  @media (hover: hover) {
    .bl-logos a:hover { transform: translateY(-3px); }
    .bl-logos a:hover img { scale: 1.05; }
    .card:hover .card__img,
    .model-card:hover .model-card__imgwrap img,
    .na-card:hover .na-photo img,
    .sm-card:hover .sm-card__img img { scale: 1.04; }
    .modal__close:hover { rotate: 90deg; }
  }

  /* ---------- 4. окно товара и корзина открываются мягко ---------- */
  .modal.open { animation: apk-fade .2s ease both; }
  .modal.open .modal__card { animation: apk-pop .26s cubic-bezier(.2, .7, .3, 1) both; }

  /* ---------- 1. появление секций при прокрутке (только CSS) ----------
     Анимация привязана к положению блока на экране, а не ко времени. Блок, который уже
     виден при открытии страницы, показывается сразу. Браузер без поддержки
     animation-timeline просто показывает страницу как раньше.
     fill-mode: backwards — после появления анимация «отпускает» блок, поэтому hover-эффекты
     и наложение окон работают как обычно. Используем translate, а не transform, чтобы не
     спорить с transform у карточек под курсором. */
  @supports (animation-timeline: view()) {
    .model-picker,
    .na-section,
    .order-banner,
    .modelinks,
    .page-title,
    .intro,
    .cats,
    .siblings,
    .faq,
    .tz-grid > *,
    .footer__inner > div,
    .footer__maps > div,
    .grid > .card,
    .model-grid > .model-card,
    .sm-cards > .sm-card {
      animation: apk-rise linear backwards;
      animation-timeline: view();
      animation-range: entry 0px entry 180px;
    }
    /* мелкие карточки проявляются быстрее, чтобы сетка не «плыла» */
    .grid > .card,
    .model-grid > .model-card,
    .sm-cards > .sm-card { animation-range: entry 0px entry 110px; }
  }
}

@keyframes apk-rise    { from { opacity: 0; translate: 0 18px; } to { opacity: 1; translate: 0 0; } }
@keyframes apk-fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes apk-pop     { from { opacity: 0; translate: 0 12px; scale: .985; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes apk-breathe { 0%, 100% { scale: 1; } 50% { scale: 1.07; } }
@keyframes apk-dot     { from { opacity: 0; scale: .4; } to { opacity: 1; scale: 1; } }

/* ======================================================================================
   ПРУЖИНА (25.10.2026) — «пружинящие» кнопки и окна без библиотек (вместо motion.dev).
   Кривые linear(…) — рассчитанные затухающие колебания: --apk-spring — пружинистая (кнопки,
   перелёт ~23% — на сдвиге в 2px это лёгкий «отскок»), --apk-spring-soft — мягкая (окна, ~8%).
   Браузер без linear() берёт обычное плавное ease. Всё — только при «движение не уменьшено».
   ====================================================================================== */
:root {
  --apk-spring: cubic-bezier(.2, .9, .3, 1.25);
  --apk-spring-soft: cubic-bezier(.2, .8, .3, 1.05);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    --apk-spring: linear(0, 0.034, 0.124, 0.252, 0.403, 0.562, 0.718, 0.86, 0.982, 1.081, 1.154, 1.203, 1.228, 1.233, 1.222, 1.199,
      1.168, 1.132, 1.095, 1.059, 1.027, 0.999, 0.977, 0.961, 0.951, 0.946, 0.946, 0.949, 0.955, 0.962, 0.971, 0.98, 0.988, 0.995, 1.001, 1.006, 1);
    --apk-spring-soft: linear(0, 0.023, 0.085, 0.172, 0.275, 0.385, 0.495, 0.601, 0.699, 0.786, 0.862, 0.925, 0.976, 1.015, 1.044, 1.065,
      1.077, 1.083, 1.083, 1.08, 1.074, 1.066, 1.057, 1.048, 1.039, 1.03, 1.022, 1.016, 1.01, 1.005, 1.001, 0.998, 0.996, 0.994, 0.993, 0.993, 1);
  }
}

/* новые кнопки и карточки (Поделиться, В список, Список, Вы смотрели, подборка) — те же цвета/тени, что у .btn */
.pm-share, .sl-btn, .sl-pill, .rv-card, .pdb-card, .tvp-sib__item, .chips a {
  transition: background-color .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease, transform .2s ease;
}

@media (prefers-reduced-motion: no-preference) {
  /* кнопки: подъём и возврат — пружиной; нажатие — быстро вниз, отпускание — отскок */
  .btn, .tv-add button, .cats .btn, .pm-share, .sl-btn, .sl-pill, .mobile-cta-bar a, .na-nav button,
  .rv-card, .pdb-card, .tvp-sib__item, .model-card, .na-card, .bl-logos a {
    transition-property: background-color, border-color, color, box-shadow, transform, translate, scale;
    transition-duration: .2s, .2s, .2s, .25s, .55s, .55s, .55s;
    transition-timing-function: ease, ease, ease, ease, var(--apk-spring), var(--apk-spring), var(--apk-spring);
  }
  @media (hover: hover) {
    .pm-share:hover, .sl-btn:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(0, 0, 0, .12); }
    .rv-card:hover, .pdb-card:hover, .tvp-sib__item:hover, .model-card:hover, .na-card:hover { transform: translateY(-3px); }
    .sl-pill:hover { transform: translateX(-50%) translateY(-2px); }
  }
  .btn:active, .tv-add button:active, .cats .btn:active, .pm-share:active, .sl-btn:active, .mobile-cta-bar a:active,
  .rv-card:active, .pdb-card:active, .tvp-sib__item:active {
    transform: translateY(0) scale(.96);
    transition-duration: .2s, .2s, .2s, .1s, .08s, .08s, .08s;
    transition-timing-function: ease;
  }
  .sl-pill:active { transform: translateX(-50%) scale(.94); transition-duration: .08s; transition-timing-function: ease; }

  /* окно товара, корзина, окна «Список» — выезжают мягкой пружиной */
  .modal.open .modal__card { animation: apk-pop-spring .6s var(--apk-spring-soft) both; }
  .sl-mod .sl-box { animation: apk-pop-spring .55s var(--apk-spring-soft) both; }
  .sl-pill { animation: apk-pill-in .6s var(--apk-spring) both; }

  /* плавный переход между страницами сайта (Chrome/Edge 126+, Safari 18.2+; остальные — как раньше) */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: apk-vt-out .18s ease both; }
  ::view-transition-new(root) { animation: apk-vt-in .32s cubic-bezier(.2, .7, .3, 1) both; }
}

@keyframes apk-pop-spring { from { opacity: 0; translate: 0 22px; scale: .97; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes apk-pill-in    { from { opacity: 0; translate: 0 20px; } to { opacity: 1; translate: 0 0; } }
@keyframes apk-vt-out     { to { opacity: 0; } }
@keyframes apk-vt-in      { from { opacity: 0; translate: 0 8px; } }

/* ======================================================================================
   UI-EXTRAS (25.10.2026) — стили к js/ui-extras.js и заглушкам загрузки. Идеи с 21st.dev, без библиотек.
   ====================================================================================== */

/* 2. заглушки карточек, пока грузится каталог (стоят прямо в HTML, app.js их заменяет) */
.sk-card { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 10px); overflow: hidden; }
.sk-card i, .sk-card b { display: block; background: #eceef2; }
.sk-card i { aspect-ratio: 4 / 3; }
.sk-card b { height: 12px; margin: 12px 14px 0; border-radius: 6px; }
.sk-card b:nth-of-type(2) { width: 62%; }
.sk-card b:last-child { width: 40%; height: 16px; margin-bottom: 16px; }

/* 3. уведомление */
.apk-toast { position: fixed; left: 50%; top: 84px; z-index: 130; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 14px; border-radius: 12px; background: #241f5e; color: #fff; font-size: .92rem; font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25); transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  transition: opacity .2s ease, transform .2s ease; }
.apk-toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.apk-toast__ok { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #25d366; align-items: center; justify-content: center; font-size: .8rem; flex: none; }
.apk-toast button { margin-left: 4px; border: 0; border-radius: 8px; padding: 7px 12px; background: rgba(255, 255, 255, .16); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.apk-toast button:hover { background: rgba(255, 255, 255, .28); }

/* 4. «Наверх» — над кнопкой «Перезвоните» слева */
.apk-top { position: fixed; left: 24px; bottom: 88px; z-index: 74; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line, #e5e7eb);
  background: #fff; color: #241f5e; box-shadow: 0 6px 18px rgba(0, 0, 0, .15); cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .2s ease, transform .2s ease; }
.apk-top svg { width: 22px; height: 22px; fill: currentColor; }
.apk-top.show { opacity: 1; transform: none; pointer-events: auto; }
@media (max-width: 900px) { .apk-top { left: 15px; bottom: calc(138px + env(safe-area-inset-bottom)); width: 44px; height: 44px; } }

/* 5. бегущая лента моделей (главная) */
.apk-mq { overflow: hidden; padding: 14px 0 4px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent); }
.apk-mq__track { display: flex; width: max-content; }
.apk-mq__set { display: flex; gap: 10px; padding-right: 10px; }
.apk-mq a { white-space: nowrap; padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line, #e5e7eb); color: var(--text, #1a1a1a); text-decoration: none; font-size: .88rem; transition: border-color .2s ease, color .2s ease; }
.apk-mq a b { color: #241f5e; }
.apk-mq a span { color: var(--muted, #7a838e); font-size: .8rem; }
.apk-mq a:hover { border-color: var(--red, #e11d2e); }

/* 6. счётчики (главная) */
.apk-stats { padding: 6px 0 26px; }
.apk-stats__row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.apk-stats__row > div { background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 10px); padding: 16px 14px; text-align: center; }
.apk-stats b { display: block; font-size: 1.9rem; line-height: 1.1; color: #241f5e; font-variant-numeric: tabular-nums; }
.apk-stats span { display: block; margin-top: 4px; color: var(--muted, #7a838e); font-size: .85rem; }
@media (max-width: 900px) { .apk-stats__row { grid-template-columns: repeat(2, 1fr); gap: 8px; } .apk-stats__row > div { padding: 12px 10px; } .apk-stats span { font-size: .78rem; } .apk-stats__row > div:first-child { grid-column: 1 / -1; } .apk-stats b { font-size: 1.6rem; } }

/* 9. фото: лупа и просмотр */
.pm__imgwrap, .pm__gallery-slide, .tvp-photo { cursor: zoom-in; overflow: hidden; }
.pm__imgwrap img, .pm__gallery-slide img, .tvp-photo img { transition: scale .25s ease; }
.pm__imgwrap img.apk-zoom, .pm__gallery-slide img.apk-zoom, .tvp-photo img.apk-zoom { scale: 2; }
html.apk-lb-open { overflow: hidden; }
.apk-lb { position: fixed; inset: 0; z-index: 140; background: rgba(10, 12, 16, .94); }
.apk-lb__track { display: flex; width: 100%; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.apk-lb__track::-webkit-scrollbar { display: none; }
.apk-lb__slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; display: flex; align-items: center; justify-content: center; padding: 56px 12px; }
.apk-lb__slide img { max-width: 100%; max-height: 100%; object-fit: contain; touch-action: pan-x pinch-zoom; background: #fff; border-radius: 6px; }
.apk-lb__close { position: absolute; top: 10px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.apk-lb__arr { position: absolute; top: 50%; translate: 0 -50%; width: 48px; height: 48px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 1.6rem; cursor: pointer; }
.apk-lb__arr--prev { left: 14px; }
.apk-lb__arr--next { right: 14px; }
.apk-lb__close:hover, .apk-lb__arr:hover { background: rgba(255, 255, 255, .26); }
.apk-lb__count { position: absolute; left: 50%; bottom: 16px; translate: -50% 0; color: #fff; font-size: .9rem; opacity: .8; }
@media (hover: none) { .apk-lb__arr { display: none; } }

@media (prefers-reduced-motion: no-preference) {
  /* 2. заглушки мерцают */
  .sk-card i, .sk-card b { background: linear-gradient(90deg, #eceef2 25%, #f7f8fa 50%, #eceef2 75%); background-size: 200% 100%; animation: apk-sk 1.3s linear infinite; }
  /* 3, 4: появление с пружиной */
  .apk-toast { transition: opacity .2s ease, transform .5s var(--apk-spring); }
  .apk-top { transition: opacity .2s ease, transform .5s var(--apk-spring), box-shadow .2s ease; }
  @media (hover: hover) { .apk-top.show:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0, 0, 0, .2); } }
  /* 5. лента едет, под курсором — стоит */
  .apk-mq__track { animation: apk-marquee 60s linear infinite; }
  .apk-mq:hover .apk-mq__track, .apk-mq:focus-within .apk-mq__track { animation-play-state: paused; }
  /* 7. запасное появление блоков (ui-extras.js ставит .apk-rv только там, где нет animation-timeline) */
  .apk-rv.apk-rv { opacity: 0; translate: 0 18px; transition: opacity .45s ease, translate .6s var(--apk-spring-soft); }
  .apk-rv.apk-rv.apk-in { opacity: 1; translate: 0 0; }
  /* 8. блеск на кнопках WhatsApp — раз в 5 секунд */
  .btn--wa, .mobile-cta-bar .wa { position: relative; overflow: hidden; isolation: isolate; }
  .btn--wa::after, .mobile-cta-bar .wa::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%); translate: -120% 0; animation: apk-shine 5s ease-in-out infinite; }
}
/* без движения — лента просто листается пальцем/колёсиком */
@media (prefers-reduced-motion: reduce) { .apk-mq { overflow-x: auto; } .apk-mq__set[aria-hidden] { display: none; } }

@keyframes apk-sk      { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@keyframes apk-marquee { to { transform: translateX(-50%); } }
@keyframes apk-shine   { 0%, 72% { translate: -120% 0; } 100% { translate: 120% 0; } }

/* 10. «Уведомить о поступлении» (ui-extras.js) — под ценой товара в пути / нет в наличии */
.apk-ntf { margin: 12px 0 6px; padding: 14px 16px; border: 1px solid #c9cdf2; border-radius: 12px; background: #f4f5fd; }
.apk-ntf__t { font-weight: 700; color: #241f5e; }
.apk-ntf__s { margin-top: 4px; font-size: .86rem; color: var(--muted, #7a838e); }
.apk-ntf__f { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.apk-ntf__f input { flex: 1 1 150px; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; font: inherit; background: #fff; }
.apk-ntf__f input:focus { outline: none; border-color: #3b2f92; box-shadow: 0 0 0 3px rgba(59, 47, 146, .15); }
.apk-ntf__f button { flex: 1 1 100%; min-height: 44px; border: 0; border-radius: 10px; background: #241f5e; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.apk-ntf__f button:hover { background: #3b2f92; }
.apk-ntf__f button:disabled { opacity: .6; cursor: wait; }
.apk-ntf__hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; opacity: 0; }
.apk-ntf__m { margin-top: 8px; font-size: .88rem; }
.apk-ntf__m:empty { display: none; }
.apk-ntf__m.ok { color: #1c7d3f; font-weight: 700; }
.apk-ntf__m.err { color: #c0392b; }
.apk-ntf__tg { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; margin-top: 10px; border-radius: 10px; background: #2aabee; color: #fff !important; font-weight: 700; text-decoration: none; }
.apk-ntf__tg:hover { background: #229ed9; }
.apk-ntf__tg svg { width: 20px; height: 20px; fill: currentColor; }
.apk-ntf__more { display: block; margin: 8px auto 0; border: 0; background: none; color: #3b2f92; font: inherit; font-size: .86rem; text-decoration: underline; cursor: pointer; }
.apk-ntf__f[hidden] { display: none; }
/* строки окна товара: подпись и значение не слипаются, длинное значение переносится (Взаимозамена) */
.pm__row { gap: 12px; }
.pm__row > span:last-child { text-align: right; overflow-wrap: anywhere; }

/* «Хит продаж» (29.10.2026): h=1 — 40 самых продаваемых за 30 дней (CloudShop) */
.card__imgwrap { position: relative; }
.apk-hit { position: absolute; left: 8px; top: 8px; z-index: 2; display: inline-flex; align-items: center; gap: 3px; padding: 3px 9px; border-radius: 999px;
  background: linear-gradient(135deg, #ff6a00, #e8352e); color: #fff; font-size: .74rem; font-weight: 800; line-height: 1.3; letter-spacing: .2px;
  box-shadow: 0 2px 8px rgba(232, 53, 46, .35); pointer-events: none; white-space: nowrap; }
.card > .apk-hit { position: static; align-self: flex-start; margin: 10px 12px 0; }
.apk-hit--inline { position: static; vertical-align: middle; margin: 0 0 6px; }
.tv-name .apk-hit--inline { margin: 0 4px 0 0; font-size: .68rem; padding: 2px 7px; }

/* «Новости» (29.10.2026): ссылка в шапке и блок видео на главной (ui-extras.js) */
.header__news { color: #fff; border: 1px solid rgba(255, 255, 255, .35); background: transparent; text-decoration: none; }
.header__news:hover { background: rgba(255, 255, 255, .12); }
@media (max-width: 560px) { .header__news { padding: 9px 12px; min-height: 40px; font-size: .85rem; } }
.apk-news { padding: 8px 0 30px; }
.apk-news__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.apk-news__head h2 { margin: 0; }
.apk-news__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.apk-news__card { display: flex; flex-direction: column; gap: 6px; background: #fff; border: 1px solid var(--line, #e5e7eb); border-radius: var(--radius, 10px); overflow: hidden; color: var(--text, #1a1a1a); text-decoration: none; }
.apk-news__ph { position: relative; display: block; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.apk-news__ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.apk-news__play { position: absolute; left: 50%; top: 50%; width: 56px; height: 40px; margin: -20px 0 0 -28px; border-radius: 12px; background: rgba(230, 33, 23, .92); }
.apk-news__play::after { content: ""; position: absolute; left: 22px; top: 11px; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent #fff; }
.apk-news__date { padding: 0 14px; font-size: .8rem; color: var(--muted, #7a838e); }
.apk-news__title { padding: 0 14px 14px; font-weight: 700; line-height: 1.35; }
@media (max-width: 800px) { .apk-news__grid { grid-template-columns: 1fr; } }
