/* ===========================
   Основные стили для мобильных и планшетов
   =========================== */
@media (max-width:1200px){
  body, html {
    height: auto;
    min-height: auto;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body.home-page {
    overflow-y: auto; /* разрешаем вертикальную прокрутку при переполнении */
  }

  /* --- Динамический padding-top для header --- */
  body.home-page header {
    padding-top: calc(
      /* маленькие телефоны: 5px + safe area */
      5px + env(safe-area-inset-top)
    );
  }

  body.home-page {
    --hero-text-max: 32ch;
  }

  /* Hero content выравниваем слева на мобильных */
  .hero-content {
    width: 100% !important;
    max-width: 100% !important;
    align-self: flex-start !important;
    align-items: flex-start !important;
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  body.home-page header.hero-section h1 {
    text-align: left !important;
    width: 100% !important;
    max-width: var(--hero-text-max) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Typewriter показываем на мобильных и выравниваем слева */
  #typewriter {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: left !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: var(--hero-text-max) !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  #typewriter-text {
    display: inline !important;
    color: #00ffff !important;
    text-align: left !important;
  }
  #cursor {
    display: inline-block !important;
    width: 8px !important;
    min-width: 8px !important;
    height: 1.3em !important;
    background-color: #00ffff !important;
  }

  /* Гарантируем, что контент не перекрывается фиксированным футером/баннером */
  main {
    height: auto;
    min-height: auto;
    padding-bottom: calc(var(--cookie-banner-height, 0px) + env(safe-area-inset-bottom, 0) + 80px); /* Reduced from 140px */
    overflow: visible !important;
  }

  h1 {
    font-size: 2em;
  }

  /* Мягче фоновые эффекты на мобильных для лучшей читаемости hero/CTA */
  body.home-page canvas#bgCanvasLines {
    opacity: 0.35 !important;
  }

  body.home-page .it-icon {
    opacity: 0.3 !important;
  }
}

/* ===========================
   Телефоны: до 768px
   =========================== */
@media (max-width:768px){

  body.home-page .hero-btn {
    padding: 18px 22px;
    font-size: 1.06em;
    max-width: 100%;
  }

  body.home-page .stats-grid {
    gap: 22px;
  }

  body.home-page .stats-section h2 {
    font-size: clamp(2.2rem, 10vw, 3rem);
    margin-bottom: 34px;
  }

  body.home-page .stat-card {
    padding: 34px 20px;
    min-height: 0;
  }

  body.home-page .stat-number {
    font-size: clamp(3.2rem, 14vw, 4.4rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  body.home-page .stat-label {
    font-size: 1.05em;
    line-height: 1.35;
  }

  body.home-page .quick-start-badge {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    line-height: 1.35;
  }
}

/* ===========================
   Дополнительное скрытие на очень узких экранах (≤279px)
   =========================== */
@media (max-width:279px){
  body, html {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    height: auto !important;
    position: static !important;
    -webkit-overflow-scrolling: touch;
  }
  body.home-page {
    overflow-y: auto !important; /* разрешаем прокрутку */
  }
  body.home-page header,
  main {
    height: auto !important;
    min-height: auto !important;
    padding-bottom: 50px;
  }
  #Button_pages {
    margin: 20px auto 70px;
  }
}

/* ===========================
   Планшеты: 768px–1200px
   =========================== */
@media (min-width:768px) and (max-width:1200px){
  body.home-page header {
    padding-top: 90px; /* для планшетов */
  }
}

/* ===========================
   Десктоп: ≥1201px
   =========================== */
@media (min-width:1201px){
  body.home-page header {
    padding-top: 150px; /* стандартный отступ для больших экранов */
  }
}
