/* Локальная сетка страницы «САСТ». */
@media (min-width: 1024px) {
  /* Баннер начинается в 40 px от страницы; его внутренние элементы — ещё
     в 40 px от края самого баннера. */
  #root main > .flex-1 > section:first-child {
    margin-left: 40px !important;
    margin-right: 40px !important;
    height: 880px !important;
    min-height: 880px !important;
  }

  #root main > .flex-1 > section:first-child > .relative.z-10 {
    max-width: none !important;
    padding-left: 40px !important;
    padding-right: 40px !important;
  }

  /* Шапка располагается внутри зелёного баннера на той же сетке. */
  #root main > .relative > div.absolute {
    top: 80px !important;
    left: 80px !important;
    right: 80px !important;
    padding: 0 !important;
  }

  /* Фиксированная шапка появляется после херо с полем 40 px слева. */
  #root main > .relative > div.fixed {
    left: 40px !important;
    right: 40px !important;
  }

  /* Контент следующих секций выровнен по полям страницы 40 px. */
  #root main > .flex-1 > section:not(:first-child) > div:not(.absolute) {
    padding-left: 40px !important;
    padding-right: 40px !important;
  }

  /* У части разделов контейнер с содержимым находится уровнем глубже.
     Для них применяем те же поля непосредственно к центрированному
     контейнеру, чтобы сетка была одинаковой по всей странице. */
  #root main > .flex-1 > section:not(:first-child) [class*="max-w-"][class*="mx-auto"] {
    max-width: none !important;
    padding-left: 40px !important;
    padding-right: 40px !important;
  }
}

/* Keep the geodatabase screenshot consistent with the rounded carousel media. */
#root img[alt="База геоданных"] {
  border-radius: 12px !important;
}

@media (max-width: 1023px) {
  #root main > div.relative:first-child > div.absolute {
    top: 40px !important;
    padding-top: 16px !important;
  }
}

/* Кнопка возврата к началу страницы сохраняет одинаковое положение. */
#root main button[aria-label="Наверх"] {
  right: 40px !important;
  bottom: 40px !important;
}

/* Повторяем тонкую стрелку с главной страницы Антереал. */
#root main button[aria-label="Наверх"] > svg {
  display: none !important;
}

#root main button[aria-label="Наверх"]::after {
  content: "↑";
  font-family: Arial, sans-serif;
  font-size: 38px;
  font-weight: 300;
  line-height: 1;
}

/* «Платформой уже пользуются» — две карточки по структуре главной страницы. */
.sast-trust-section,
#root main > .flex-1 > section:not(:first-child) {
  margin-top: 220px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}

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

.sast-trust-container {
  width: 100%;
  max-width: none !important;
  margin: 0 auto;
}

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

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

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

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

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

.sast-trust-card__photo {
  object-fit: cover;
}

.sast-trust-card__shade {
  background: rgba(4, 39, 28, .48);
}

.sast-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);
}

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

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

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

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

.sast-trust-card__content p {
  max-width: 760px;
  margin: 16px 0 0;
  color: #55796c;
  font-size: clamp(16px, 1.18vw, 20px);
  line-height: 1.5;
}

@media (max-width: 1023px) {
  #root main > .flex-1 > section:first-child {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  .sast-trust-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .sast-trust-card__media {
    height: 220px;
    min-height: 220px;
    border-radius: 24px;
  }
}

/* Mobile layout follows the shared product-page system used by Antereal GIS. */
@media (max-width: 767px) {
  /* Hero and its two separate header controls. */
  #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, 0.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, 0.18) !important; }

  /* The fixed header after the hero keeps the same two-block construction. */
  #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, 0.18) !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, 0.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; }

  /* Same hero rhythm and type scale as Antereal GIS. */
  #root main > .flex-1 > section:first-child { min-height: 678px !important; }
  #root main > .flex-1 > section:first-child > .relative.z-10 { padding: 116px 16px 48px !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; }

  /* One mobile scale for all section and card headings. */
  #root main > .flex-1 > section:not(:first-child) h2, .sast-trust-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, .sast-trust-card__content h3 { font-size: 24px !important; line-height: 1.2 !important; overflow-wrap: normal; word-break: normal; }

  /* Every section follows the exact width of the hero banner (16 px outer gutter). */
  #root main > .flex-1 > section:not(:first-child), .sast-trust-section { margin-top: 150px !important; }
  #root main > .flex-1 > section:not(:first-child) > div:not(.absolute) { padding-right: 16px !important; padding-left: 16px !important; }

  /* Four Russian-development cards are readable in a single column. */
  #root main > .flex-1 > section .min-\[360px\]\:grid-cols-2 { grid-template-columns: minmax(0, 1fr) !important; }

  /* The trust cards use the same width as the hero banner and every GIS block. */
  .sast-trust-container { width: calc(100% - 32px) !important; max-width: none !important; margin-right: auto !important; margin-left: auto !important; }
  #root main > .flex-1 > section.sast-trust-section > .sast-trust-container { padding-right: 0 !important; padding-left: 0 !important; }
  .sast-trust-grid { gap: 32px !important; }
  .sast-trust-grid { width: calc(100% + 32px) !important; margin-left: -16px !important; }
  .sast-trust-card__media { border-radius: 24px !important; }

  /* Same compact scroll-to-top control as Antereal GIS. */
  #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; }
}
