/* Mobile-first enhancements — phones & tablets */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: clip;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img, video {
  height: auto;
}

/* Mobile-only extras in burger menu — never in desktop nav row */
.nav-links .nav-mobile-extra {
  display: none !important;
}

@media (max-width: 900px) {
  .nav-links.open .nav-mobile-extra {
    display: block !important;
    padding: 12px 24px 20px;
    border-top: 1px solid var(--border);
  }

  .nav-links.open .nav-mobile-extra a,
  .nav-links.open .nav-mobile-extra .btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
  }
}

@media (max-width: 900px) {
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  .section {
    padding: 56px 0;
  }

  .hero {
    padding: 48px 0 32px;
  }

  .hero h1 {
    font-size: clamp(1.85rem, 8vw, 2.75rem);
    line-height: 1.12;
  }

  .hero-line {
    white-space: normal;
  }

  .hero-left > p,
  .hero-left p {
    font-size: 16px !important;
    max-width: none !important;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-buttons .btn {
    justify-content: center;
    width: 100%;
    min-height: 48px;
  }

  .navbar-inner {
    gap: 8px;
  }

  .nav-logo img {
    height: 52px;
  }

  .nav-right {
    gap: 8px;
  }

  .nav-right .btn-sm {
    padding: 8px 12px;
    font-size: 12px;
  }

  .nav-tg-badge {
    width: 30px;
    height: 30px;
  }

  .nav-links.open {
    top: 60px;
    max-height: calc(100dvh - 60px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .nav-links.open a {
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .services-intro-text {
    font-size: 15px;
  }

  .services-grid {
    gap: 12px;
  }

  .service-card {
    min-height: 0;
  }

  .process-step-trigger {
    padding: 16px 18px;
    gap: 12px;
  }

  .process-step-text {
    padding: 0 18px 18px 18px;
    font-size: 14px;
  }

  .process-step.open .process-step-body {
    max-height: 480px;
  }

  .case-card {
    flex: 0 0 100% !important;
    padding: 20px;
  }

  .cases-slider-btn {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .about-text-card {
    padding: 20px;
  }

  .about-visual img {
    border-radius: 12px;
  }

  .team-card-top {
    padding: 18px;
  }

  .team-avatar {
    width: 72px;
    height: 72px;
  }

  .contact-panel {
    padding: 20px;
  }

  .contact-form-wrap input,
  .contact-form-wrap textarea,
  .contact-form-wrap select {
    font-size: 16px;
  }

  .footer-top {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }

  .tech-strip-container {
    padding: 20px 16px;
  }

  .tech-logos-row {
    justify-content: center;
    gap: 12px 16px;
  }

  .tech-logo {
    height: 28px;
    max-width: 100px;
  }

  .modal-content {
    width: calc(100% - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    margin: 12px;
  }

  .tg-mini-banner {
    left: 12px;
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
  }
}

@media (max-width: 600px) {
  .section {
    padding: 44px 0;
  }

  h2, .section-title-reveal {
    font-size: clamp(1.35rem, 6vw, 1.75rem);
  }

  .nav-right .nav-phone,
  .nav-right .btn-coral-outline {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  .services-cta {
    padding: 24px 0 0 16px !important;
  }

  .services-cta-art {
    width: 100% !important;
    right: auto !important;
    transform: none !important;
    position: relative !important;
    top: auto !important;
  }

  .services-cta-visual {
    min-height: 140px !important;
    overflow: hidden;
  }

  .cta-inner {
    padding-left: 16px !important;
  }

  .cta-deco img {
    max-width: 100% !important;
    position: relative !important;
    right: auto !important;
    margin: 0 auto;
  }

  .cta-text .btn {
    width: 100%;
    justify-content: center;
  }

  .robots-slider-nav button {
    width: 44px;
    height: 44px;
  }

  .media-card {
    padding: 16px;
  }

  .media-thumb {
    min-height: 100px;
    max-height: 160px;
  }

  .media-card-telegram {
    margin-bottom: clamp(48px, 12vw, 60px) !important;
  }

  .tg-channel-pill img {
    max-height: clamp(34px, 6vw, 40px) !important;
  }

  .media-panel {
    overflow: visible;
  }


  .tg-cta-card {
    flex-direction: column;
    text-align: center;
    padding: 24px 16px;
  }
}

/* Video intro: desktop only */
@media (max-width: 900px) {
  .video-intro-layer,
  .video-intro-spacer {
    display: none !important;
  }
}

/* Touch: no hover lift, bigger tap targets */
@media (pointer: coarse) {
  .card-hover:hover,
  .service-card:hover,
  .robot-card:hover,
  .case-card:hover,
  .team-card:hover,
  .process-step:not(.open):hover {
    transform: none;
    box-shadow: 3px 3px 0 var(--graphic-shadow);
  }

  .btn:active {
    transform: scale(0.98);
  }

  .info-tooltip-trigger::after {
    white-space: normal;
    max-width: min(280px, 90vw);
    text-align: center;
  }
}

/* Low-end / mobile perf mode (class from JS) */
html.is-mobile-lite #particle-canvas,
html.is-mobile-lite #cursor-glow,
html.is-mobile-lite .aurora-blob,
html.is-mobile-lite .intro-video-grain,
html.is-mobile-lite .noise-overlay,
html.is-mobile-lite .scroll-progress-bar,
html.is-mobile-lite .cursor-trail-dot,
html.is-mobile-lite .tilt-card,
html.is-mobile-lite .marquee-section {
  display: none !important;
}

/* Stack simulation — desktop only */
@media (max-width: 900px), (pointer: coarse) {
  .stack-canvas-wrap {
    display: none !important;
  }
}

html.is-mobile .stack-canvas-wrap,
html.is-mobile-lite .stack-canvas-wrap {
  display: none !important;
}

html.img-loading img[data-lazy] {
  background: linear-gradient(110deg, #f0f0f0 8%, #fafafa 18%, #f0f0f0 33%);
  background-size: 200% 100%;
  animation: mobileShimmer 1.2s linear infinite;
}

@keyframes mobileShimmer {
  to { background-position: -200% 0; }
}

html.img-ready img[data-lazy] {
  animation: none;
  background: none;
}
