/* ============================================
   CRITICAL MOBILE - Above-the-fold only
   Loaded only on mobile (media query on link).
   Desktop: this file is not applied.
   ============================================ */

@media (max-width: 940px) {
  /* --- BUG 5: Global container overflow --- */
  html,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }
  main {
    overflow-x: hidden;
  }

  /* Announcement bar: mobile optimisations (desktop unchanged) */
  #site-header .announcement-bar {
    padding: 0.4rem 0;
  }
  #site-header .announcement-bar-container {
    padding-inline: 1rem;
  }
  .announcement-bar-inner {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    padding: 0 0.25rem;
  }
  .announcement-bar-badge {
    font-size: 0.6rem;
    padding: 0.2rem 0.4rem;
    white-space: normal;
    line-height: 1.3;
  }
  .announcement-bar-badge .announcement-bar-badge-text {
    white-space: normal;
  }
  .announcement-bar-flag {
    margin-left: 0.2em;
  }
  .announcement-bar-flag svg {
    width: 14px;
    height: auto;
  }
  .announcement-bar-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.2rem;
    padding: 0.35rem 0;
    font-size: 0.75rem;
    min-height: 44px;
  }

  body.announcement-bar-visible .mt-header,
  body.announcement-bar-visible main section:first-of-type:not(.hero-centered) {
    padding-top: 120px !important;
  }

  /* Reserve space for header before load to prevent CLS */
  #header-placeholder {
    display: block;
    min-height: 72px;
    width: 100%;
    flex-shrink: 0;
  }

  /* Main content offset for sticky header on mobile */
  .mt-header {
    padding-top: 72px !important;
  }
  main section:first-of-type:not(.hero-centered) {
    padding-top: 72px !important;
  }

  /* --- BUG 6: Container padding --- */
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-inline: 1rem;
    max-width: 100%;
  }

  /* Hero uses dynamic viewport height on mobile only */
  .hero-centered.mt-header,
  main .hero-centered:first-of-type {
    min-height: calc(100dvh - 60px - 1dvh);
    height: calc(100dvh - 60px - 1dvh);
  }

  @supports not (height: 100dvh) {
    .hero-centered.mt-header,
    main .hero-centered:first-of-type {
      min-height: calc(100vh - 60px - 1vh);
      height: calc(100vh - 60px - 1vh);
    }
  }

  /* --- BUG 1: Homepage hero text overflow --- */
  .hero-headline-oneline {
    white-space: normal !important;
    display: block !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .hero-centered .hero-card,
  .hero-centered .hero-title-blur-card {
    overflow: hidden !important;
    max-width: 100% !important;
  }
  .hero-centered {
    overflow: hidden !important;
    max-width: 100%;
  }
  .hero-title-blur-card h1,
  .hero-centered h1,
  .page-hero-title {
    font-size: clamp(1.4rem, 5vw, 2rem) !important;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  /* Typed/rotating text line (second line of h1) */
  .hero-centered h1 .bold,
  .hero-centered #typed,
  .hero-centered .typed-cursor {
    font-size: clamp(1.4rem, 5vw, 2rem) !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  .hero-title-blur-card .sub,
  .hero-centered .sub,
  .page-hero-tagline {
    font-size: 0.95rem !important;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }
  .hero-card,
  .hero-title-blur-card {
    padding: 1rem 1.5rem !important;
  }

  /* --- BUG 2: Hero CTA buttons stack but less oversized --- */
  .hero-centered .cta-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
  }
  .hero-centered .cta-row .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    display: inline-flex;
    width: auto;
    min-height: 0;
  }

  /* ========== SOLUTIONS: static cards on mobile (no trapezium, no bg grid) ========== */
  .solutions2-wrapper {
    background: rgba(12, 12, 16, 0.95);
  }
  .solutions2-bg-grid-wrap {
    display: none !important;
  }
  #solutions .section-title,
  .solutions2-section .section-title,
  #solutions-content .section-title {
    font-size: 1.5rem !important;
    text-align: center;
    padding: 0 1rem;
    margin-top: 0 !important;
  }
  #solutions .section-sub,
  .solutions2-section .section-sub {
    text-align: center;
    padding: 0 1rem;
    margin-bottom: 1.5rem !important;
  }
  #solutions-content .solutions2-inner,
  .solutions2-section .solutions2-inner {
    padding-inline: 1rem;
  }
  #solutions-content .solutions2-grid,
  #solutions .services-grid.solutions2-grid {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: unset !important;
    gap: 1rem !important;
    margin-top: 0;
  }
  #solutions-content .service-card,
  .solutions2-section .service-card {
    display: block !important;
    min-height: 0 !important;
    width: 100% !important;
    margin-bottom: 0 !important;
    padding: 1.25rem 1rem !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 12px !important;
    box-shadow: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  #solutions-content .service-card h3,
  .solutions2-section .service-card h3 {
    font-size: 1.1rem !important;
    margin-bottom: 0.5rem !important;
  }
  #solutions-content .service-card .service-tagline,
  .solutions2-section .service-card .service-tagline {
    font-size: 0.85rem !important;
    margin-bottom: 1rem !important;
  }
  #solutions-content .service-card .service-links,
  .solutions2-section .service-card .service-links {
    padding: 0 !important;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  #solutions-content .service-link,
  .solutions2-section .service-link {
    font-size: 0.8rem !important;
    padding: 0.4rem 0.8rem !important;
  }

  /* ========== INDUSTRIES: static cards on mobile ========== */
  #industries_test {
    padding-bottom: 5rem !important;
  }
  #industries_test .industries-test-inner.fade-in-up {
    opacity: 1;
    transform: none;
  }
  #industries_test .industries-test-header {
    padding: 1.5rem 1rem !important;
  }
  #industries_test .industries-test-header .section-title {
    font-size: 1.5rem !important;
  }
  #industries_test .industries-test-blades {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 1rem 1rem !important;
  }
  #industries_test .industries-test-blade {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 320px !important;
    max-height: none !important;
    margin-bottom: 1rem !important;
    padding: 0 !important;
    background: rgba(18, 18, 24, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    border-radius: 12px !important;
    position: relative !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    isolation: isolate !important;
  }
  #industries_test .industries-test-blade:last-child {
    margin-bottom: 0 !important;
  }
  #industries_test .industries-test-blade-v {
    display: none !important;
  }
  #industries_test .industries-test-blade-bg {
    position: absolute !important;
    inset: 0 !important;
    background-size: cover !important;
    background-position: center !important;
    opacity: 0.1 !important;
    z-index: 0 !important;
    pointer-events: none !important;
  }
  #industries_test .industries-test-blade-overlay {
    position: absolute !important;
    inset: 0 !important;
    background: rgba(18, 18, 24, 0.85) !important;
    z-index: 1 !important;
    pointer-events: none !important;
  }
  #industries_test .industries-test-blade .industries-test-blade-h,
  #industries_test .industries-test-blade:not(.expanded) .industries-test-blade-h {
    display: block !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    font-size: 1.25rem !important;
    font-weight: 600 !important;
    padding: 1rem 1rem 0.25rem !important;
    margin: 0 !important;
    color: #fff !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
  }
  #industries_test .industries-test-blade .industries-test-blade-content,
  #industries_test .industries-test-blade:not(.expanded) .industries-test-blade-content {
    display: block !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    padding: 0 1rem 1rem !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }
  #industries_test .industries-test-blade-content p {
    display: block !important;
    font-size: 0.9rem !important;
    padding: 0 !important;
    margin: 0 !important;
    line-height: 1.55 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    overflow: visible !important;
  }
  #industries_test .industries-test-blade-pills,
  #industries_test .industries-test-blade-content .btn {
    display: none !important;
  }
  #industries_test .industries-test-dots {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .hero-title-blur-card h1,
  .hero-centered h1 {
    font-size: clamp(1.25rem, 4vw, 1.75rem) !important;
  }
  .hero-centered h1 .bold,
  .hero-centered #typed {
    font-size: clamp(1.25rem, 4vw, 1.75rem) !important;
  }
  #solutions-content .section-title,
  .solutions2-section .section-title {
    font-size: 1.35rem !important;
  }
}
