/* Shared mobile layout for all public pages. Desktop components retain their styles. */
.header-cta-label-mobile { display: none; }

@media (max-width: 899px) {
  /* Match the visual order to the existing Essential, Business, AI source order. */
  .pricing-grid { grid-template-columns: minmax(0, 1fr); }
  .pricing-grid > .pricing-card { width: 100%; min-width: 0; }
  .pricing-card > * { min-width: 0; }
  .pricing-card .project-term-name { white-space: normal; }
  .pricing-card.plan-basic { order: 1; }
  .pricing-card.plan-business { order: 2; }
  .pricing-card.plan-ai { order: 3; }

  #about .about-grid > * { min-width: 0; }
  #about.specialist-profile .specialist-heading > .specialist-heading-line {
    white-space: normal;
    overflow-wrap: normal;
    text-wrap: balance;
  }
  #about .eyebrow {
    max-width: 100%;
    box-sizing: border-box;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #about .eyebrow::before { flex-shrink: 0; }
}

@media (max-width: 640px) {
  /* Use the approved, tightly cropped wordmark without its transparent margins. */
  .site-header { height: 64px; }
  .site-header .header-inner { padding-inline: 12px; gap: 8px; }
  .site-header .brand-group { min-width: 0; min-height: 44px; flex: 0 1 auto; }
  .site-header .brand-logo-wrap { min-width: 0; flex-shrink: 1; }
  .site-header .brand-logo-img {
    display: block;
    width: clamp(100px, 32vw, 140px);
    max-width: 100%;
    height: auto;
  }
  .site-header .header-actions { flex-shrink: 0; gap: 4px; }
  .site-header .header-cta {
    min-height: 44px;
    padding: 10px;
    font-size: .75rem;
    line-height: 1.2;
    flex-shrink: 0;
  }
  .header-cta-label-full { display: none; }
  .header-cta-label-mobile { display: inline; }
  .site-header .header-account-btn,
  .site-header .mobile-toggle { width: 44px; height: 44px; flex-shrink: 0; }
  .mobile-drawer-header .brand-logo-img { width: 140px; height: auto; }

  /* Paired calls to action share the same column, padding and minimum height. */
  .hero-cta-group,
  #about .about-cta-group,
  .cta-btn-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 12px;
    width: 100%;
  }
  .hero-cta-group > .btn,
  #about .about-cta-group > .btn,
  .cta-btn-row > .btn,
  #services .services-cta-wrap .services-cta-btn {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 12px 16px;
    font-size: .875rem;
    line-height: 1.4;
    white-space: normal;
    text-align: center;
    justify-content: center;
    box-sizing: border-box;
  }
  #services .services-cta-wrap { grid-template-rows: auto auto repeat(2, 1fr); align-items: stretch; }
  .hero-cta-group > .btn svg,
  .cta-btn-row > .btn svg { flex-shrink: 0; }
  .pricing-card .btn {
    min-height: 50px;
    padding: 12px;
    font-size: .875rem;
    line-height: 1.4;
    white-space: normal;
  }
  .pricing-card .configurator-badge-free { white-space: normal; max-width: 100%; }
  #about .eyebrow { font-size: .6875rem; letter-spacing: .06em; }
  #about.specialist-profile .specialist-heading {
    font-size: clamp(2rem, 8.5vw, 3rem);
    line-height: 1.08;
  }

  /* Keep the final links above both fixed controls, including phone safe areas. */
  .site-footer.footer-minimal {
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
  }
}

/* Keep mobile chat available without waiting for an entrance animation. */
@media (max-width: 768px) {
  .whatsapp-widget-container {
    z-index: 120;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: calc(16px + env(safe-area-inset-right, 0px));
  }
  .floating-whatsapp-btn {
    animation: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    min-height: 44px;
  }
  .floating-whatsapp-btn.is-active { width: 44px; height: 44px; }
  .whatsapp-chat-window {
    left: calc(12px + env(safe-area-inset-left, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    bottom: calc(76px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
    height: 490px;
    max-height: calc(100vh - 100px - env(safe-area-inset-bottom, 0px));
    max-height: calc(100dvh - 100px - env(safe-area-inset-bottom, 0px));
  }
  .whatsapp-chat-body { min-height: 0; }
  .whatsapp-privacy-note p { font-size: inherit; line-height: inherit; }
  .whatsapp-textarea { font-size: 16px; }
}

/* Service and legal content follows the same mobile action and wrapping rules. */
@media (max-width: 640px) {
  .service-pages .service-actions {
    display: grid;
    grid-template-columns: minmax(0, 320px);
    grid-auto-rows: 1fr;
    justify-content: center;
    align-items: stretch;
  }
  .service-pages .service-actions .btn {
    width: 100%;
    min-height: 50px;
    padding: 12px 16px;
    font-size: .875rem;
    line-height: 1.4;
  }
  .legal-header-inner > *, .service-content-grid > * { min-width: 0; }
  .legal-header-inner h1, .service-pages h1, .service-pages h2 { overflow-wrap: anywhere; }
  .service-pages .eyebrow, .legal-content .eyebrow {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
  }
}
