/* «Antereal Routes API используют» — карточки в формате блока САСТ. */
.routes-hero-map {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.routes-hero-map__image,
.routes-hero-map__shade,
.routes-hero-map__runner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.routes-hero-map__image {
  object-fit: cover;
  object-position: center;
}

.routes-hero-map__shade {
  background:
    linear-gradient(90deg,
      rgba(2, 20, 18, .94) 0%,
      rgba(2, 24, 21, .83) 24%,
      rgba(3, 29, 25, .58) 43%,
      rgba(3, 27, 24, .24) 65%,
      rgba(3, 25, 23, .16) 100%),
    linear-gradient(180deg, rgba(1, 16, 18, .12), rgba(1, 16, 18, .24));
}

.routes-hero-map__runner {
  overflow: visible;
}

#root main > .flex-1 > section:first-child {
  background:
    linear-gradient(90deg, rgba(2, 20, 18, .94) 0%, rgba(2, 24, 21, .83) 24%, rgba(3, 29, 25, .58) 43%, rgba(3, 27, 24, .24) 65%, rgba(3, 25, 23, .16) 100%),
    linear-gradient(180deg, rgba(1, 16, 18, .12), rgba(1, 16, 18, .24)),
    url("/landing/assets/routes-hero-map.png?v=2") center / cover no-repeat !important;
}

/* The background lives on the hero from first paint. The injected layer now
   contains only the moving marker, so re-rendering it cannot flash the map. */
.routes-hero-map__image,
.routes-hero-map__shade {
  display: none;
}

#root main > .flex-1 > section:first-child > div[class*="pointer-events-none"][class*="select-none"]:not(.routes-hero-map) {
  display: none !important;
}

#root main > .flex-1 > section:first-child h1 {
  color: #fff !important;
  text-shadow: 0 2px 18px rgba(0, 0, 0, .42);
}

#root main > .flex-1 > section:first-child h1 .text-primary {
  color: #79b9ff !important;
  text-shadow: 0 0 16px rgba(78, 157, 240, .68);
}

/* Кнопка презентации размещается непосредственно под заголовком херо. */
.routes-hero-copy h1 {
  margin-bottom: 0 !important;
}

.routes-hero-download {
  display: flex;
  justify-content: flex-start;
  margin-top: 100px;
}

@media (min-width: 1024px) {
  .routes-hero-copy {
    position: relative;
    top: -80px;
  }
}

/* Mobile product-page system shared with Antereal GIS. */
@media (max-width: 767px) {
  /* Separate logo and menu controls inside the hero. */
  #root main > div.relative:first-child > div.absolute { top: 56px !important; right: 32px !important; left: 32px !important; padding: 0 !important; }
  #root main > div.relative:first-child > div.absolute > div { position: relative; display: block !important; width: 100%; min-height: 54px; }
  #root main > div.relative:first-child > div.absolute > div > div[class~="xl:hidden"] { position: static; display: inline-flex !important; width: auto !important; min-height: 54px; padding: 0 14px !important; border-radius: 999px !important; box-shadow: 0 10px 32px rgba(27,50,42,.18) !important; }
  #root main > div.relative:first-child > div.absolute > div > div[class~="xl:hidden"] a img:first-child { display: none !important; }
  #root main > div.relative:first-child > div.absolute > div > div[class~="xl:hidden"] a img:nth-child(2) { display: block !important; width: auto; max-width: 100%; height: 24px !important; }
  #root main > div.relative:first-child > div.absolute > div > div[class~="xl:hidden"] button { position: absolute !important; top: 0; right: 0; width: 54px !important; height: 54px !important; border-radius: 999px !important; background: #fff !important; box-shadow: 0 10px 32px rgba(27,50,42,.18) !important; }

  /* The sticky header preserves the same two separate blocks. */
  #root main > div.relative > div.fixed.top-4 { top: 16px !important; right: 32px !important; left: 32px !important; padding: 0 !important; }
  #root main > div.relative > div.fixed.top-4 > div { position: relative; display: block !important; width: 100%; min-height: 54px; }
  #root main > div.relative > div.fixed.top-4 > div > div[class~="xl:hidden"] { position: static; display: inline-flex !important; width: auto !important; min-height: 54px; padding: 0 14px !important; border-radius: 999px !important; box-shadow: 0 10px 32px rgba(27,50,42,.18) !important; }
  #root main > div.relative > div.fixed.top-4 > div > div[class~="xl:hidden"] a img:first-child { display: none !important; }
  #root main > div.relative > div.fixed.top-4 > div > div[class~="xl:hidden"] a img:nth-child(2) { display: block !important; width: auto; max-width: 100%; height: 24px !important; }
  #root main > div.relative > div.fixed.top-4 > div > div[class~="xl:hidden"] button { position: absolute !important; top: 0; right: 0; width: 54px !important; height: 54px !important; border-radius: 999px !important; background: #fff !important; box-shadow: 0 10px 32px rgba(27,50,42,.18) !important; }

  /* Hero uses the GIS height and mobile type rhythm. */
  #root main > .flex-1 > section:first-child { min-height: 678px !important; }
  #root main > .flex-1 > section:first-child > .relative.z-10.flex { min-height: 678px !important; padding: 116px 16px 48px !important; }
  #root main > .flex-1 > section:first-child .routes-hero-copy { flex: 0 0 auto !important; justify-content: flex-start !important; }
  #root main > .flex-1 > section:first-child h1 { margin-bottom: 30px !important; font-size: 31.5px !important; line-height: 35px !important; }
  #root main > .flex-1 > section:first-child p { font-size: 18.72px !important; line-height: 27.7056px !important; }

  .routes-hero-download { margin-top: 32px !important; }
  .routes-hero-download > a { font-size: 18px !important; }

  /* Hero-width grid, 150 px rhythm, and unified type. */
  #root main > .flex-1 > section:not(:first-child), .routes-trust-section { margin-top: 150px !important; padding-top: 0 !important; padding-bottom: 0 !important; }
  #root main > .flex-1 > section:not(:first-child) > div:not(.absolute) { padding-right: 16px !important; padding-left: 16px !important; }
  #root main > .flex-1 > section:not(:first-child) h2, .routes-trust-container > h2, .routes-capabilities-container > h2 { font-size: 28px !important; line-height: 1.15 !important; overflow-wrap: normal; word-break: normal; }
  #root main > .flex-1 > section:not(:first-child) h3, .routes-trust-card__content h3, .routes-capabilities-card h3 { font-size: 24px !important; line-height: 1.2 !important; overflow-wrap: normal; word-break: normal; }
  #root main > .flex-1 > section .min-\[360px\]\:grid-cols-2 { grid-template-columns: minmax(0,1fr) !important; }

  .routes-trust-container, .routes-capabilities-container { width: calc(100% - 32px) !important; max-width: none !important; margin-right: auto !important; margin-left: auto !important; padding: 0 !important; }
  .routes-trust-grid, .routes-capabilities-grid { grid-template-columns: minmax(0,1fr) !important; gap: 24px !important; margin-top: 32px !important; }
  .routes-trust-card__media { height: 220px !important; border-radius: 24px !important; }
  .routes-capabilities-card { padding: 24px !important; border-radius: 24px !important; }
  .routes-trust-card__content { padding-top: 20px !important; }

  #root main button[aria-label="Наверх"] { right: 32px !important; bottom: 32px !important; width: 52px !important; height: 52px !important; }
  #root main button[aria-label="Наверх"]::after { font-size: 24px !important; }

  /* A compact, scannable replacement for the missing benefits anchor. */
  .routes-benefits-section { margin-top: 150px !important; }
  .routes-benefits-section__inner { width: calc(100% - 32px); margin: 0 auto; }
  .routes-benefits-section h2 { margin: 0; color: #173d30; font-size: 28px; font-weight: 700; line-height: 1.15; }
  .routes-benefits-grid { display: grid; gap: 16px; margin-top: 32px; }
  .routes-benefit-card { padding: 24px; border-radius: 24px; background: #f2f6fb; }
  .routes-benefit-card:nth-child(2) { background: #eaf2fb; }
  .routes-benefit-card:nth-child(3) { background: #f7f8fc; }
  .routes-benefit-card__number { display: block; margin-bottom: 20px; color: #4176ab; font-size: 14px; font-weight: 700; }
  .routes-benefit-card h3 { margin: 0 0 12px; color: #173d30; font-size: 24px; line-height: 1.2; }
  .routes-benefit-card p { margin: 0; color: #1b322acc; font-size: 16px; line-height: 1.5; }
}

/* Mobile: capability descriptions must never exceed the viewport. */
@media (max-width: 767px) {
  .routes-capabilities-section,
  .routes-capabilities-container,
  .routes-capabilities-card {
    max-width: 100%;
    overflow-x: clip;
  }

  .routes-capabilities-card,
  .routes-capabilities-card * {
    overflow-wrap: normal;
    word-break: normal;
  }
}

.routes-hero-download > a {
  opacity: 1 !important;
  transform: none !important;
  min-height: auto;
  padding: clamp(18px, 1.9vw, 28px) clamp(28px, 2.8vw, 56px);
  border: 1px solid #fff !important;
  border-radius: 999px;
  background: transparent !important;
  box-shadow: none !important;
  color: #fff !important;
  font-size: calc(var(--fs-cta) * 1.2) !important;
  font-weight: 600;
  transition: background-color .2s ease, color .2s ease !important;
}

.routes-hero-download > a:hover,
.routes-hero-download > a:focus-visible {
  background: #fff !important;
  color: hsl(var(--foreground)) !important;
}

.routes-trust-section {
  position: relative;
  height: auto !important;
}

.routes-capabilities-section {
  position: relative;
  overflow: hidden;
}

.routes-capabilities-container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 100px max(40px, calc((100vw - 1800px) / 2 + 40px));
}

.routes-capabilities-container h2 {
  margin: 0;
  color: #173d30;
  font-size: var(--fs-h2);
  font-weight: 700;
  line-height: 1.1;
}

.routes-capabilities-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  margin-top: 48px;
}

.routes-capabilities-card {
  min-width: 0;
  padding: 32px;
  border-radius: 32px;
  background: #F7F8FC;
  display: flex;
  flex-direction: column;
}

.routes-capabilities-card__icon {
  display: flex;
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  color: #4176AB;
}

.routes-capabilities-card__icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.routes-capabilities-card h3 {
  margin: 0 0 16px;
  color: #173d30;
  font-size: var(--fs-h3);
  font-weight: 700;
  line-height: 1.2;
}

.routes-capabilities-card p {
  margin: 16px 0 0;
  color: #1B322ACC;
  font-size: var(--fs-body-sm);
  line-height: 1.5;
}

/* Кнопка «наверх» сохраняет одинаковое положение и вид на всех экранах. */
#root main button[aria-label="Наверх"] {
  right: 40px !important;
  bottom: 40px !important;
  width: 70px !important;
  height: 70px !important;
  padding: 0 0 2px !important;
}

#root main button[aria-label="Наверх"] svg {
  display: none;
}

#root main button[aria-label="Наверх"]::after {
  content: "↑";
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
}

.routes-trust-container {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 100px max(40px, calc((100vw - 1800px) / 2 + 40px));
}

.routes-trust-container > h2 {
  margin-bottom: 40px;
}

.routes-trust-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.routes-trust-card { min-width: 0; }

.routes-trust-card__media {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: 32px;
  background: #0a7146;
}

.routes-trust-card__photo,
.routes-trust-card__shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.routes-trust-card__photo { object-fit: cover; }
.routes-trust-card__shade { background: rgba(4, 39, 28, .48); }

.routes-trust-card__logo {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: min(64%, 410px);
  max-height: 46%;
  object-fit: contain;
  transform: translate(-50%, -50%);
  filter: brightness(0) invert(1);
}

.routes-trust-card:first-child .routes-trust-card__logo { filter: none; }

.routes-trust-card:nth-child(2) .routes-trust-card__logo {
  width: min(78%, 480px);
  transform: translate(-50%, -50%) scale(1.5);
}

.routes-trust-card__content { padding-top: 24px; }

.routes-trust-card__content h3 {
  margin: 0;
  color: #173d30;
  font-size: 29px;
  line-height: 1.15;
  font-weight: 700;
}

.routes-trust-card__content p {
  max-width: 890px;
  margin: 16px 0 0;
  color: #1B322ACC;
  font-size: clamp(16px, 1.18vw, 20px);
  line-height: 1.5;
}

@media (max-width: 1023px) {
  .routes-hero-download { margin-top: 48px; }
  .routes-hero-download > a {
    min-height: auto;
    padding: clamp(18px, 1.9vw, 28px) clamp(28px, 2.8vw, 56px);
    font-size: calc(var(--fs-cta) * 1.2) !important;
  }

  .routes-trust-container { padding: 72px 16px; }
  .routes-trust-grid { grid-template-columns: 1fr; gap: 40px; }
  .routes-trust-card__media { border-radius: 24px; }
  .routes-capabilities-container { padding: 72px 16px; }
  .routes-capabilities-grid { grid-template-columns: 1fr; gap: 16px; margin-top: 32px; }
  .routes-capabilities-card { padding: 24px; border-radius: 24px; }
}

/* Routes API: единая сетка для широких экранов. */
@media (min-width: 1024px) {
  .routes-capabilities-card h3 {
    min-height: calc(var(--fs-h3) * 4);
  }

  /* Между содержимым соседних разделов: 110 px снизу и 110 px сверху = 220 px. */
  #root main section:not(.bg-section):not(.routes-trust-section) {
    padding-top: 110px !important;
    padding-bottom: 110px !important;
  }

  #root main section.bg-section {
    padding-top: 110px !important;
    padding-bottom: 110px !important;
  }

  /* Баннер сохраняет своё положение, меняется только нижняя граница. */
  #root main > .flex-1 > section:first-child {
    height: 880px !important;
    min-height: 880px !important;
  }

  /* Хедер расположен на 40 px внутри границ баннера (сам баннер отстоит от страницы на 40 px). */
  #root main > .relative > div.absolute {
    top: 80px !important;
    right: 80px !important;
    left: 80px !important;
    padding: 0 !important;
  }

  /* Контент херо: 40 px от внутренних границ голубого баннера. */
  #root main > .flex-1 > section:first-child > .relative.z-10.flex {
    max-width: none !important;
    min-height: 880px !important;
    height: 880px !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
    padding-bottom: 40px !important;
  }

  #root main > .flex-1 > section:first-child > .relative.z-10.flex > div:last-child {
    margin-right: 0 !important;
  }

  /* Все последующие секции используют поля страницы в 40 px. */
  #root main > .flex-1 > section:not(:first-child) > div:not(.contents) {
    max-width: none !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
  }

  #root main > .flex-1 > section:not(:first-child) [class*="max-w-"][class*="mx-auto"],
  #root main > footer > div[class*="max-w-"][class*="mx-auto"] {
    max-width: none !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
  }

  /* Часть блоков находится внутри составных секций, а не прямо в .flex-1. */
  #root main section > div[class*="max-w-"][class*="mx-auto"] {
    max-width: none !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
  }

  /* Блок доверия не использует Tailwind-контейнер и имел собственный расчёт поля. */
  #root main .routes-trust-container {
    max-width: none !important;
    padding-top: 110px !important;
    padding-bottom: 110px !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
  }

  #root main .routes-capabilities-container {
    max-width: none !important;
    padding-top: 110px !important;
    padding-bottom: 110px !important;
    padding-right: 40px !important;
    padding-left: 40px !important;
  }

  /* Всплывающий хедер использует те же поля страницы. */
  #root main > .relative > div.fixed {
    right: 40px !important;
    left: 40px !important;
  }

  /* Кнопка возврата наверх повторяет форму и стрелку главной страницы. */
  #root main button[aria-label="Наверх"] {
    right: 40px !important;
    bottom: 40px !important;
    width: 70px !important;
    height: 70px !important;
    padding: 0 0 2px !important;
  }

  #root main button[aria-label="Наверх"] svg {
    display: none;
  }

  #root main button[aria-label="Наверх"]::after {
    content: "↑";
    font-size: 30px;
    font-weight: 400;
    line-height: 1;
  }
}

/* Final mobile overrides: placed after legacy rules so their dimensions win. */
@media (max-width: 767px) {
  /* Center the Routes title and action in the same hero rhythm as GIS. */
  /* Apply the final layout to the source markup too, before the helper
     class is added by JavaScript. This prevents the hero title from jumping. */
  #root main > .flex-1 > section:first-child > .relative.z-10.flex > div.max-w-3xl.flex-1 {
    position: static !important;
    flex: 0 0 auto !important;
    justify-content: flex-start !important;
  }

  /* The presentation action is in its final bottom position before the
     enhancement script adds its helper class, so it cannot jump down. */
  #root main > .flex-1 > section:first-child > .relative.z-10.flex > div.max-w-3xl.flex-1 > h1 + div {
    position: absolute !important;
    right: 16px;
    bottom: 48px;
    left: 16px;
    margin-top: 0 !important;
  }

  #root main > .flex-1 > section:first-child > .relative.z-10.flex {
    padding-top: 150px !important;
  }

  #root main > .flex-1 > section:first-child .routes-hero-download {
    position: absolute !important;
    right: 16px;
    bottom: 48px;
    left: 16px;
    margin-top: 0 !important;
  }

  #root main > .flex-1 > section:first-child .routes-hero-copy { position: static !important; }

  /* Restore original advantages and capabilities; only their mobile grid changes. */
  #advantages,
  #capabilities {
    margin-top: 150px !important;
  }

  /* Four Russian-development cards in one readable column. */
  #russian .grid.grid-cols-1 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #russian h2 { font-size: 28px !important; line-height: 1.15 !important; }
  #russian h3 { font-size: 24px !important; line-height: 1.2 !important; }

  /* Client cards follow the exact outer width of the hero banner. */
  #trust .routes-trust-container {
    width: calc(100% - 32px) !important;
    max-width: none !important;
    margin-right: auto !important;
    margin-left: auto !important;
    padding: 0 !important;
  }

  #trust .routes-trust-grid {
    width: 100% !important;
    margin: 32px 0 0 !important;
  }

  #trust .routes-trust-card__media {
    width: 100% !important;
    height: 220px !important;
  }

  /* The complete blue round scroll control uses the GIS dimensions. */
  #root main button[aria-label="Наверх"] {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    min-height: 52px !important;
    right: 32px !important;
    bottom: 32px !important;
  }

  /* Mobile advantages: heading on white, then a swipeable row of four cards. */
  #advantages.routes-mobile-benefits {
    margin-top: 150px !important;
  }

  #advantages .routes-mobile-benefits__inner {
    width: calc(100% - 32px);
    margin: 0 auto;
  }

  #advantages .routes-mobile-benefits__title {
    margin: 0 0 32px;
    color: #173d30;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.15;
  }

  #advantages .routes-mobile-benefits__track {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding: 0 0 8px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  #advantages .routes-mobile-benefits__track::-webkit-scrollbar { display: none; }

  #advantages .routes-mobile-benefits__dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
  }

  #advantages .routes-mobile-benefits__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #c4d5e7;
    transition: width .2s ease, background-color .2s ease;
  }

  #advantages .routes-mobile-benefits__dot[aria-current="true"] {
    width: 24px;
    background: #4176ab;
  }

  #advantages .routes-mobile-benefits__card {
    display: flex;
    flex: 0 0 100%;
    min-height: 330px;
    flex-direction: column;
    padding: 24px;
    border-radius: 24px;
    background: #e5eef7;
    scroll-snap-align: start;
  }

  #advantages .routes-mobile-benefits__icon {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
    place-items: center;
    border-radius: 14px;
    background: rgba(65, 118, 171, .12);
    color: #4176ab;
  }

  #advantages .routes-mobile-benefits__icon svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
  #advantages .routes-mobile-benefits__card h3 { margin: 0 0 14px; color: #173d30; font-family: inherit; font-size: 24px; font-weight: 700; line-height: 1.2; }
  #advantages .routes-mobile-benefits__card p { margin: 0; color: #1b322acc; font-family: inherit; font-size: 16px; font-weight: 400; line-height: 1.5; }
}
