html {
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  min-width: 0 !important;
  overflow-x: hidden;
}

img,
svg,
video {
  max-width: 100%;
}

.wrap {
  width: min(100% - 24px, 1160px) !important;
}

.btn {
  white-space: normal;
  text-align: center;
}

@media (max-width: 1180px) {
  .nav {
    gap: 14px;
  }

  .menu {
    gap: 16px;
    margin-left: 20px !important;
  }

  .nav-right {
    gap: 10px;
  }

  .phone svg {
    display: none;
  }

  .hero h1 {
    font-size: 50px !important;
  }

  .products-grid,
  .catalog-grid,
  .benefits-grid,
  .why-grid,
  .values-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  .wrap {
    padding: 0 16px !important;
  }

  section {
    padding: 56px 0 !important;
  }

  header.site {
    position: relative !important;
    padding: 0 !important;
    background: rgba(10, 22, 40, 0.98) !important;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    min-height: auto !important;

    padding-top: 22px !important;
    padding-bottom: 22px !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0 !important;
    position: relative !important;
  }

  header.site .logo,
  header.site .logo.logo-image {
    position: absolute !important;
    left: calc(50% - 16px) !important;
    transform: translateX(-50%) !important;
    justify-content: center !important;
    pointer-events: auto !important;
  }

  header.site .logo.logo-image img {
    width: 120px !important;
    max-height: 48px !important;
  }

  .mob-lang .lang-sw {
    height: 40px !important;
    padding: 4px !important;
    align-items: stretch !important;
  }

  .mob-lang .lang-btn {
    padding: 0 14px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 13px !important;
    border-radius: 5px !important;
  }

  .menu {
    display: none !important;
  }

  .nav-right {
    display: none !important;
  }

  .hero {
    min-height: auto !important;
    padding: 64px 0 !important;
  }

  .hero h1,
  .page-head h1 {
    font-size: 42px !important;
    line-height: 1.05 !important;
  }

  .lead,
  .page-head p {
    font-size: 16px !important;
    max-width: 100% !important;
  }

  .hero-cta,
  .catalog-cta,
  .partners-cta,
  .cta-banner .row {
    flex-direction: column;
    align-items: stretch !important;
  }

  .hero-cta .btn,
  .catalog-cta .btn,
  .partners-cta .btn,
  .cta-banner .btn {
    width: 100%;
    justify-content: center;
  }

  .features,
  .stats,
  .stats-strip,
  .world-stats,
  .products-grid,
  .catalog-grid,
  .partners-grid,
  .benefits-grid,
  .tiers-grid,
  .process,
  .why-grid,
  .regions,
  .values-grid,
  .ct-grid,
  .depts,
  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .about,
  .mission,
  .logistics,
  .contact-grid,
  .contact-main,
  .apply,
  .map-block,
  .hours-grid {
    grid-template-columns: 1fr !important;
  }

  .about-grid,
  .gallery {
    grid-template-columns: 1fr 1fr !important;
  }

  .stats {
    gap: 12px !important;
  }

  .stat,
  .stat-item,
  .ws-item {
    min-width: 0;
  }

  .section-title,
  .mission h2,
  .about h2,
  .logistics h2,
  .cta-banner h2,
  .apply h2 {
    font-size: 30px !important;
    line-height: 1.15 !important;
  }

  .form-card,
  .map-card,
  .apply,
  .logistics,
  .cta-banner {
    padding: 28px !important;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start !important;
  }

  .stats-strip,
  .world-stats {
    padding: 0 !important;
  }

  .stat-item,
  .ws-item {
    padding: 28px 20px !important;
  }

  .stat-item + .stat-item::before,
  .ws-item + .ws-item::before {

    top: 0 !important;
    bottom: auto !important;
    left: 8% !important;
    right: 8% !important;
    width: auto !important;
    height: 1px !important;
  }

  .stat-item .num,
  .ws-item .num {
    font-size: 40px !important;
  }

  .map-block {
    display: flex !important;
    flex-direction: column-reverse !important;
    gap: 24px !important;
    padding: 24px !important;
  }

  .map-vis {
    aspect-ratio: 1/1 !important;
    min-height: 280px;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(100% - 12px, 1160px) !important;
    padding: 0 10px !important;
  }

  .nav {
    padding-top: 22px !important;
    padding-bottom: 22px !important;
  }

  section {
    padding: 42px 0 !important;
  }

  .hero h1,
  .page-head h1 {
    font-size: 34px !important;
  }

  .section-title,
  .mission h2,
  .about h2,
  .logistics h2,
  .cta-banner h2,
  .apply h2 {
    font-size: 25px !important;
  }

  .about-grid,
  .gallery,
  .certs-row,
  .quality-bar,
  .map-meta,
  .row {
    grid-template-columns: 1fr !important;
  }

  .cats {
    justify-content: flex-start !important;
    overflow-x: auto;
    flex-wrap: nowrap !important;
    padding-bottom: 8px;
  }

  .cat {
    flex: 0 0 auto;
  }

  .prod-foot,
  .contact-main .row,
  .form .row,
  form .row {
    grid-template-columns: 1fr !important;
    flex-direction: column;
  }

  .prod-foot .btn,
  form .btn {
    width: 100%;
    justify-content: center;
  }

  .product-card,
  .prod-card,
  .benefit,
  .tier,
  .value-card,
  .why,
  .ct-tile,
  .dept,
  .region,
  .partner-card {
    border-radius: 12px !important;
  }

  .timeline::before {
    left: 20px !important;
    transform: none !important;
  }

  .tl-item,
  .tl-item:nth-child(even),
  .tl-item:nth-child(odd) {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    gap: 16px !important;
    align-items: start !important;
    margin-bottom: 20px !important;
  }

  .tl-item .tl-content,
  .tl-item:nth-child(even) .tl-content,
  .tl-item:nth-child(odd) .tl-content {
    grid-column: 2 !important;
    grid-row: 1 !important;
    text-align: left !important;
    min-width: 0;
  }

  .tl-item .tl-dot,
  .tl-item:nth-child(even) .tl-dot,
  .tl-item:nth-child(odd) .tl-dot {
    grid-column: 1 !important;
    grid-row: 1 !important;
    margin-top: 6px !important;
  }

  .tl-spacer {
    display: none !important;
  }

  .region {
    width: 100%;
    min-width: 0;
  }
}

/* ══════════════ Доступность ══════════════ */

/* Кнопка WhatsApp: тёмный текст на зелёном — контраст 7.5:1 вместо 2:1 */
.btn.wa { color: #052e16; }
.btn.wa svg { fill: currentColor; }

/* Видимая рамка фокуса для навигации с клавиатуры */
:focus-visible { outline: 2px solid var(--accent-2, #2f7bff); outline-offset: 3px; }

/* Якорные ссылки не прячутся под закреплённой шапкой */
html { scroll-padding-top: 88px; }

.stat .num,
.stat-item .num,
.ws-item .num { font-variant-numeric: tabular-nums; }

/* ══════════════ Шапка: при прокрутке закрепляется, компактная, с размытым фоном ══════════════ */
/* Класс .is-stuck ставит shared.js */
header.site.is-stuck {
  position: fixed !important;
  top: 0; left: 0; right: 0;
  z-index: 90;
  padding: 0 !important;
  background: rgba(1, 4, 11, 0.78) !important;
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 32px -16px rgba(0, 0, 0, 0.7);
}
header.site.is-stuck .nav { padding-top: 10px !important; padding-bottom: 10px !important; }
header.site.is-stuck .logo.logo-image img { width: 150px !important; max-height: 56px !important; }
@media (max-width: 768px) {
  header.site.is-stuck .logo.logo-image img { width: 116px !important; max-height: 44px !important; }
}

/* ══════════════ Первый экран: плавное появление и медленное приближение фона ══════════════ */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  header.site.is-stuck { animation: hpHeaderIn 0.35s cubic-bezier(.2, .7, .2, 1); }

  .hero::before { animation: hpKenBurns 20s cubic-bezier(.25, .1, .25, 1) both; transform-origin: 65% 40%; }
  .hero h1 { animation: hpRise 1s cubic-bezier(.2, .7, .2, 1) .1s both; }
  .hero h1 .accent { animation: hpGlow 1.4s ease .7s both; }
  .hero .lead { animation: hpRise .9s cubic-bezier(.2, .7, .2, 1) .28s both; }
  .hero .hero-cta { animation: hpRise .9s cubic-bezier(.2, .7, .2, 1) .42s both; }
  .hero .features { animation: hpRise .9s cubic-bezier(.2, .7, .2, 1) .56s both; }
  .hero .stats { animation: hpRise .9s cubic-bezier(.2, .7, .2, 1) .7s both; }

  .page-head .crumbs,
  .page-head h1,
  .page-head p { animation: hpRise .8s cubic-bezier(.2, .7, .2, 1) both; }
  .page-head h1 { animation-delay: .08s; }
  .page-head p { animation-delay: .18s; }
}
@keyframes hpHeaderIn { from { transform: translateY(-100%); } to { transform: none; } }
@keyframes hpKenBurns { from { transform: scale(1.12); } to { transform: scale(1); } }
@keyframes hpRise { from { opacity: 0; transform: translate3d(0, 26px, 0); } to { opacity: 1; transform: none; } }
@keyframes hpGlow { from { opacity: 0; filter: blur(8px); } to { opacity: 1; filter: none; } }

/* ══════════════ Появление блоков при прокрутке ══════════════ */
/* .hp-anim на <html> и .reveal на блоках ставит shared.js — без JS всё видно сразу */
.hp-anim .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity .8s cubic-bezier(.2, .65, .25, 1), transform .8s cubic-bezier(.2, .65, .25, 1);
}
.hp-anim .reveal.is-visible { opacity: 1; transform: none; }

/* ══════════════ Фото: мерцающая заглушка, плавное появление, аккуратный вид при ошибке ══════════════ */
.hp-anim .is-loading { position: relative; }
.hp-anim .is-loading::after {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.07) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: hpShimmer 1.4s linear infinite;
}
@keyframes hpShimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

.product-img img,
.prod-img img,
.ph img,
.mission-img img,
.logistics-img img {
  transition: opacity .7s ease, transform .8s cubic-bezier(.2, .7, .2, 1);
}
.hp-anim .hp-img { opacity: 0; }
.hp-anim .hp-img.is-loaded { opacity: 1; }

/* Если фото не загрузилось — вместо «битой» иконки бледный логотип */
.img-failed { position: relative; }
.img-failed::before {
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background: url("logo.png") center / 38% auto no-repeat;
  opacity: .18;
}

/* ══════════════ Карточки: подсветка и лёгкое приближение фото при наведении ══════════════ */
.product-card,
.prod-card { transition: transform .3s ease, border-color .3s ease, box-shadow .3s ease; }
.product-card:hover,
.prod-card:hover { box-shadow: 0 24px 48px -24px rgba(30, 108, 255, 0.55); }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .product-card:hover .product-img img,
  .prod-card:hover .prod-img img,
  .about-grid .ph:hover img,
  .gallery .ph:hover img,
  .mission-img:hover img,
  .logistics-img:hover img { transform: scale(1.06); }
}

/* ══════════════ «Поток по трубе»: разделитель секций ══════════════ */
/* Разметка: <div class="flow-divider" aria-hidden="true"><span></span></div> */
.flow-divider {
  position: relative;
  height: 12px;
  width: min(100% - 24px, 1160px);
  margin: 0 auto;
  overflow: hidden;
  background: linear-gradient(90deg, transparent, rgba(47, 123, 255, 0.3) 12%, rgba(47, 123, 255, 0.3) 88%, transparent) center / 100% 2px no-repeat;
}
/* муфта посередине */
.flow-divider::before {
  content: "";
  position: absolute; left: 50%; top: 50%; z-index: 1;
  width: 26px; height: 10px;
  transform: translate(-50%, -50%);
  border: 1.5px solid rgba(47, 123, 255, 0.6);
  border-radius: 3px;
  background: var(--bg, #01040B);
}
/* бегущий «поток»; анимация идёт, только пока разделитель на экране (.in-view ставит shared.js) */
.flow-divider span {
  position: absolute; top: 5px; left: 0;
  width: 18%; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(47, 123, 255, 0.9) 45%, #9cc4ff 55%, transparent);
  transform: translateX(-100%);
  animation: hpFlow 4.2s cubic-bezier(.45, .05, .35, 1) infinite;
  animation-play-state: paused;
}
.flow-divider.in-view span { animation-play-state: running; }
@keyframes hpFlow { from { transform: translateX(-100%); } to { transform: translateX(560%); } }

/* ══════════════ Уменьшение движения: системная настройка пользователя ══════════════ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .reveal,
  .hp-img { opacity: 1 !important; transform: none !important; }
  header.site.is-stuck { position: static !important; }
}
