/*
 * Focused small-screen corrections for the public SPARO marketing pages.
 * Keep desktop rules and page composition untouched.
 */

@media (max-width: 900px) {
  #sparo-site-header .sparo-header-inner,
  #sparo-site-header .sparo-header-actions {
    min-width: 0;
  }

  #sparo-site-header .sparo-header-toggle,
  #sparo-header-mobile-menu .sparo-header-close {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
  }

  #sparo-site-header .lang-trigger {
    min-width: 44px;
    min-height: 44px;
  }

  #sparo-header-mobile-menu {
    width: min(340px, 100vw);
    height: 100dvh;
    max-height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom));
  }

  #sparo-header-mobile-menu nav {
    gap: 10px;
  }

  #sparo-header-mobile-menu nav > a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 10px 4px;
  }

  #sparo-header-mobile-menu nav > .sparo-header-demo {
    justify-content: center;
    height: auto !important;
    min-height: 48px !important;
    padding: 12px 18px;
  }

  body.sparo-header-offset {
    padding-top: 100px;
  }
}

@media (max-width: 767px) {
  /* Keep the compact desktop labels, with usable touch targets on phones. */
  .hero-cta-wrap .signup-btn,
  .cta-bottom-home .final-demo-wrap .signup-btn,
  .cta-section .cta-btn,
  .hero .club-btn,
  .hero .hero-btn,
  .team-section .club-btn,
  .work-with-us-section .work-with-us-btn,
  .work-with-us-submit,
  .contact-card form button[type="submit"] {
    height: auto !important;
    min-height: 44px !important;
  }

  /* Let grid/flex children shrink instead of forcing their parent wider. */
  main, section, article, .section, .section-container,
  .hero-content, .footer-content, .footer-left, .footer-links,
  .analysis-layout, .principles, .framework-copy,
  .product-showcase-inner, .product-showcase-body,
  .contact-card, .container {
    min-width: 0;
  }

  img, video, iframe, canvas, svg {
    max-width: 100%;
  }

  /* Club + High Performance content columns and embedded media. */
  .analysis-layout,
  .principles,
  .team-layout,
  .product-showcase-body,
  .framework-copy {
    grid-template-columns: minmax(0, 1fr);
    flex-direction: column;
    align-items: stretch;
    gap: 28px;
  }

  .analysis-image,
  .product-showcase-frame {
    width: 100%;
    max-width: 100%;
  }

  .analysis-image img,
  .product-showcase-frame img,
  .framework img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
  }

  .signal-strip {
    flex-wrap: wrap;
    gap: 18px 24px;
  }

  .signal,
  .signal-strip > * {
    min-width: 0;
  }

  .role-grid,
  .capability-grid,
  .pilot-steps,
  .feedback-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .role,
  .benefit,
  .feedback-card {
    min-width: 0;
  }

  .framework-copy {
    padding: 48px 22px 56px;
  }

  .hero h1,
  .hero-headline,
  .hero-section h1,
  .section h2,
  .closing h2,
  .product-showcase h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .hero-copy,
  .section-lead,
  .framework-copy p,
  .closing p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Compact navigation stays easy to reach on narrow phones. */
  #sparo-site-header {
    padding-left: 12px;
    padding-right: 12px;
  }

  #sparo-site-header .sparo-header-logo img {
    max-width: 140px;
  }

  #sparo-site-header .sparo-header-actions {
    gap: 8px;
  }

  /* Form controls and details summaries need comfortable touch areas. */
  input, select, textarea, button {
    max-width: 100%;
  }

  .contact-card input,
  .contact-card select,
  .contact-card textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .faq-item summary {
    min-height: 52px;
    align-items: center;
  }

  .footer-content,
  .footer-links {
    overflow-wrap: anywhere;
  }

  .container p,
  .container li,
  .container a,
  .container td,
  .container th {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .community-mosaic {
    max-width: calc(100vw - 32px);
  }

  /* Preserve all six moving photo frames; only constrain their container. */
  #workWithUsModal {
    padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  }

  #workWithUsModal > div {
    width: min(500px, 100%) !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 24px) !important;
    padding: 24px 20px !important;
    overscroll-behavior: contain;
  }

  #workWithUsModal input,
  #workWithUsModal select,
  #workWithUsModal textarea {
    min-height: 44px;
    max-width: 100%;
    font-size: 16px !important;
  }

  #sparo-cookie {
    width: calc(100vw - 24px) !important;
    max-width: 400px !important;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    padding: 24px 20px 20px !important;
  }

  .chat-widget-popup {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 112px);
  }
}

@media (max-width: 430px) {
  #sparo-site-header {
    height: 74px;
    padding: 4px 10px 4px 12px;
  }

  #sparo-site-header .sparo-header-inner {
    height: 64px;
  }

  #sparo-site-header .sparo-header-logo img {
    height: 60px;
    max-width: 126px;
  }

  #sparo-site-header .sparo-header-actions {
    gap: 4px;
  }

  #sparo-site-header .lang-trigger {
    padding: 4px;
  }

  #sparo-site-header .sparo-header-toggle {
    padding: 8px;
  }

  body.sparo-header-offset {
    padding-top: 96px;
  }

  .container {
    padding-right: 18px;
    padding-left: 18px;
  }

  .contact-card {
    padding: 26px 18px;
    border-radius: 18px;
  }

  .contact-card h1 {
    font-size: clamp(25px, 7.5vw, 30px);
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .faq-item summary {
    gap: 12px;
    padding: 16px 2px;
  }

  .faq-item h2 {
    font-size: 15px;
    line-height: 1.45;
  }

  .faq-item p {
    padding-right: 8px;
    overflow-wrap: anywhere;
  }

  .solution-closing-cta {
    max-width: calc(100vw - 36px);
  }
}

@media (max-width: 359px) {
  #sparo-site-header .sparo-header-logo img {
    height: 56px;
    max-width: 112px;
  }

  #sparo-site-header .sparo-header-toggle,
  #sparo-site-header .lang-trigger {
    min-width: 42px;
    width: 42px;
  }

  .hero h1,
  .hero-headline,
  .hero-section h1 {
    font-size: clamp(34px, 11vw, 40px) !important;
    letter-spacing: -.045em;
  }

  .contact-card {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #sparo-header-mobile-menu,
  #workWithUsModal,
  #sparo-cookie {
    scroll-behavior: auto;
  }
}
