/* Meridian responsive — tablet / mobile, Safari / Chrome / Firefox */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}
img, svg, video {
  max-width: 100%;
  height: auto;
}
input, select, textarea, button {
  font-size: 16px; /* iOS Safari: без автозума */
  -webkit-appearance: none;
  appearance: none;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  margin-bottom: 32px;
}
.footer-cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
}
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.search-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 12px;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle span,
.nav-toggle span::before,
.nav-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  position: relative;
  transition: .25s ease;
}
.nav-toggle span::before,
.nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after { top: 6px; }
.nav-toggle.is-open span { background: transparent; }
.nav-toggle.is-open span::before {
  top: 0;
  -webkit-transform: rotate(45deg);
  transform: rotate(45deg);
}
.nav-toggle.is-open span::after {
  top: 0;
  -webkit-transform: rotate(-45deg);
  transform: rotate(-45deg);
}

.header-main-row {
  gap: 12px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.nav-panel {
  margin-top: 10px;
}

body {
  overflow-x: hidden;
}
.dropdown,
.hero-search .search-box,
.modal-overlay {
  -webkit-backdrop-filter: blur(8px);
}

/* ===== Tablet ≤ 992px ===== */
@media (max-width: 992px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr) !important; }
  .grid-2 { grid-template-columns: 1fr !important; }
  .grid-5 { grid-template-columns: repeat(3, 1fr) !important; }
  .grid-3 { grid-template-columns: repeat(2, 1fr) !important; }
  .advantages-grid { grid-template-columns: repeat(3, 1fr) !important; }
  .header-transparent .logo-img,
  .header-transparent .logo-img[style] { height: 52px !important; }
  .section-title { font-size: 1.9rem; }
  .search-grid { grid-template-columns: 1fr 1fr; }
  .footer-top { grid-template-columns: 1fr; gap: 28px; }
  .footer-cols { grid-template-columns: repeat(3, 1fr); gap: 20px; }
  .slider-item {
    min-width: calc((100% / 2.4) - 16px) !important;
    flex: 0 0 calc((100% / 2.4) - 16px) !important;
  }
  .hero-wrapper {
    background-attachment: scroll !important;
    min-height: 100vh;
    min-height: 100dvh;
  }

  /* Стрелки слайдера — только десктоп */
  .slider-nav { display: none !important; }

  /* Бургер уже на планшете — меню иначе не помещается */
  .nav-toggle { display: -webkit-inline-flex; display: inline-flex; }

  .header-transparent .container.flex-row.header-main-row,
  .header-transparent > .container.flex-row {
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    -webkit-align-items: center !important;
    align-items: center !important;
    -webkit-justify-content: space-between !important;
    justify-content: space-between !important;
    -webkit-flex-wrap: nowrap !important;
    flex-wrap: nowrap !important;
  }

  .header-actions {
    -webkit-flex: 1 1 auto;
    flex: 1 1 auto;
    -webkit-justify-content: flex-end;
    justify-content: flex-end;
  }
  .header-actions > div:last-child {
    display: none;
  }

  .nav-panel {
    display: none;
  }
  .nav-panel.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 10050;
    width: 100%;
    height: 100%;
    height: 100dvh;
    margin: 0;
    padding: 72px 20px 28px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(11, 26, 51, 0.97);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-sizing: border-box;
  }
  body.nav-open {
    overflow: hidden;
    touch-action: none;
  }
  body.nav-open .nav-toggle {
    position: fixed;
    top: 14px;
    right: 16px;
    z-index: 10060;
    background: rgba(255,255,255,0.12);
  }
  body.nav-open .site-header-bg,
  body.nav-open .header-transparent,
  body.nav-open .hero-wrapper {
    z-index: auto;
  }

  .main-nav {
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding-top: 8px;
    border-top: none !important;
  }
  .main-nav > li > a {
    padding: 14px 4px;
    font-size: 1.1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .dropdown {
    position: static !important;
    background: rgba(255,255,255,0.05) !important;
    border-radius: 12px !important;
    padding: 8px 0 !important;
    margin-top: 4px !important;
    min-width: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .main-nav > li:hover .dropdown { display: none !important; }
  .main-nav > li.active .dropdown { display: block !important; }
}

/* ===== Mobile / large phone ≤ 768px ===== */
@media (max-width: 768px) {
  .header-actions .phone { font-size: 1rem !important; }

  .top-bar { font-size: 0.78rem; }
  .top-bar .flex-row {
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    -webkit-align-items: flex-start !important;
    align-items: flex-start !important;
    gap: 8px;
  }
  .top-bar .top-bar-left {
    -webkit-flex-direction: row !important;
    flex-direction: row !important;
    -webkit-align-items: center !important;
    align-items: center !important;
    gap: 16px !important;
    width: 100%;
  }

  .office-card .office-row {
    -webkit-flex-direction: column !important;
    flex-direction: column !important;
    -webkit-align-items: flex-start !important;
    align-items: flex-start !important;
    gap: 8px;
  }
  .office-card .office-district,
  .office-card .office-phone,
  .office-card .office-address {
    display: block;
    width: 100%;
  }
  .office-card .office-address {
    margin-top: 0 !important;
  }
  .office-card .office-phone {
    -webkit-align-self: flex-start;
    align-self: flex-start;
  }

  .grid-3 { grid-template-columns: 1fr 1fr !important; }
  .grid-5 { grid-template-columns: 1fr 1fr !important; }
  .advantages-grid { grid-template-columns: 1fr 1fr !important; }
  .section-title { font-size: 1.65rem; }
  .section-sub { font-size: 1rem; margin-bottom: 1.25rem; }
  .header-transparent .logo-img,
  .header-transparent .logo-img[style] { height: 42px !important; }

  .hero-search { padding: 24px 0 32px; -webkit-align-items: center; align-items: center; }
  .hero-search .search-box {
    padding: 16px !important;
    border-radius: 24px !important;
  }
  .search-grid { grid-template-columns: 1fr; gap: 10px; }

  .slider-item {
    min-width: calc((100% / 1.35) - 12px) !important;
    flex: 0 0 calc((100% / 1.35) - 12px) !important;
  }
  .direction-card { height: 200px; padding: 16px; }
  .direction-card .dir-content h3 { font-size: 1.2rem; }

  .footer-cols { grid-template-columns: 1fr 1fr; gap: 24px; }
  .footer-bottom {
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: flex-start;
    align-items: flex-start;
  }

  .modal-content { padding: 24px !important; margin: 12px; max-width: calc(100% - 24px); }
  .partners-logos { gap: 16px; -webkit-justify-content: center; justify-content: center; }

  [id$="Slider"], .hot-slider, .slider-track {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
  }
}

/* ===== Small phone ≤ 480px ===== */
@media (max-width: 480px) {
  .container { padding-left: 12px; padding-right: 12px; }
  .grid-4, .grid-3 { grid-template-columns: 1fr !important; }
  .grid-5, .advantages-grid { grid-template-columns: 1fr 1fr !important; gap: 12px !important; }
  .header-transparent .logo-img,
  .header-transparent .logo-img[style] { height: 36px !important; }
  .header-actions .btn-sm { padding: 7px 12px !important; font-size: 0.78rem !important; }
  .header-actions .phone { font-size: 0.92rem !important; }
  .section-title { font-size: 1.45rem; }
  .slider-item {
    min-width: calc(100% - 24px) !important;
    flex: 0 0 calc(100% - 24px) !important;
  }
  .direction-card { height: 180px; padding: 14px; }
  .footer-cols { grid-template-columns: 1fr; gap: 20px; }
  .btn { padding: 12px 22px; font-size: 0.95rem; }
  .card-glass { padding: 20px 16px; border-radius: 20px; }

  /* Светлые секции: тёмный текст на мобиле */
  .bg-light .card-glass:not(.direction-card) h3,
  .bg-light .card-glass:not(.direction-card) h4,
  .section-light .card-glass h3,
  .section-light .card-glass h4 {
    color: #0b1a33 !important;
  }
  .bg-light .card-glass:not(.direction-card) p,
  .bg-light .card-glass:not(.direction-card) li,
  .section-light .card-glass p,
  .section-light .card-glass li {
    color: rgba(11,26,51,0.75) !important;
  }
  .bg-light .section-title:not(.section-title-blue),
  .section-light .section-title {
    color: var(--title-color, #00A3FF) !important;
  }
  .bg-light .section-sub:not(.section-sub-black),
  .section-light .section-sub {
    color: rgba(11,26,51,0.7) !important;
  }
}

/* Cookies banner already has mobile rules; safe area for notched phones */
@supports (padding: env(safe-area-inset-bottom)) {
  #cookies-banner {
    bottom: calc(12px + env(safe-area-inset-bottom));
  }
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}
