/* QA mobile navigation refinement — compact dropdown under the hamburger. */
@media (max-width: 920px) {
  .nav-links {
    position: fixed !important;
    top: 76px !important;
    right: 0 !important;
    left: auto !important;
    width: min(155px, calc(100vw - 8px)) !important;
    max-height: calc(100dvh - 92px);
    padding: 4px !important;
    gap: 1px !important;
    align-items: stretch !important;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,.11) !important;
    border-right: 0 !important;
    border-radius: 14px 0 0 14px !important;
    background: rgba(8,18,32,.97) !important;
    box-shadow: -12px 18px 42px rgba(0,0,0,.4) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .nav-links a {
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    min-height: 40px;
    padding: 8px 6px !important;
    border-radius: 9px;
    text-align: left !important;
    font-size: .82rem !important;
    line-height: 1.15;
    white-space: nowrap;
  }

  .nav-links a:hover,
  .nav-links a:focus-visible {
    background: rgba(255,255,255,.045);
    outline: none;
  }

  .nav-links a.active,
  .nav-links a[aria-current="page"] {
    background: rgba(217,170,74,.08);
  }
}

/* QA mobile homepage refinement — mobile only. Desktop/tablet layout remains untouched. */
@media (max-width: 640px) {
  body[data-page="home"] .wrap {
    width: min(calc(100% - 24px), var(--max));
  }

  body[data-page="home"] .section {
    padding: 9px 0 !important;
  }

  body[data-page="home"] .section-title,
  body[data-page="home"] .product-carousel-heading .section-title {
    font-size: clamp(1.42rem, 6.8vw, 1.72rem) !important;
    line-height: 1.06 !important;
  }

  body[data-page="home"] .eyebrow {
    margin-bottom: 4px !important;
    font-size: .64rem !important;
    letter-spacing: .1em !important;
  }

  /* Hero: preserve the cinematic treatment while removing phone-only excess height. */
  body[data-page="home"] .home-showcase {
    min-height: 640px !important;
  }

  body[data-page="home"] .home-showcase-inner {
    padding-top: 28px !important;
    padding-bottom: 20px !important;
  }

  body[data-page="home"] .home-showcase-copy h1,
  body[data-page="home"] .home-showcase-copy .hero-title {
    font-size: clamp(2.15rem, 10.8vw, 3rem) !important;
    line-height: .95 !important;
  }

  body[data-page="home"] .home-showcase-copy .hero-lead {
    font-size: .91rem !important;
    line-height: 1.42 !important;
  }

  body[data-page="home"] .home-showcase-statement {
    margin-top: 11px !important;
    font-size: .78rem !important;
    line-height: 1.3 !important;
  }

  body[data-page="home"] .hero-actions {
    gap: 6px !important;
  }

  body[data-page="home"] .hero-actions .btn {
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: .72rem !important;
  }

  /* At-a-glance: compact 2-column grid. */
  body[data-page="home"] .stats-band {
    padding: 8px 0 !important;
  }

  body[data-page="home"] .stats-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body[data-page="home"] .stats-grid .stat {
    min-height: 0 !important;
    padding: 9px 9px !important;
    border-radius: 12px !important;
  }

  body[data-page="home"] .stats-grid .stat:last-child {
    grid-column: 1 / -1;
  }

  body[data-page="home"] .stat b {
    font-size: 1.48rem !important;
    line-height: 1 !important;
  }

  body[data-page="home"] .stat span {
    margin-top: 3px !important;
    font-size: .72rem !important;
  }

  body[data-page="home"] .stat small {
    margin-top: 1px !important;
    font-size: .59rem !important;
    line-height: 1.2 !important;
  }

  /* Service/product carousels: one concise mobile card at a time. */
  body[data-page="home"] .product-carousel-heading {
    margin-bottom: 7px !important;
  }

  body[data-page="home"] .product {
    border-radius: 14px !important;
  }

  body[data-page="home"] .product-main {
    gap: 9px !important;
    padding: 11px !important;
  }

  body[data-page="home"] .product-copy h2 {
    margin-bottom: 5px !important;
    font-size: clamp(1.26rem, 6.3vw, 1.58rem) !important;
    line-height: 1.03 !important;
  }

  body[data-page="home"] .r3-service-name {
    margin: 3px 0 5px !important;
    font-size: .72rem !important;
  }

  body[data-page="home"] .product-desc {
    display: -webkit-box !important;
    margin: 4px 0 8px !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: .78rem !important;
    line-height: 1.38 !important;
  }

  body[data-page="home"] .chips {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    overflow-x: auto !important;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  body[data-page="home"] .chips::-webkit-scrollbar,
  body[data-page="home"] .product .buy::-webkit-scrollbar,
  body[data-page="home"] .venture-grid::-webkit-scrollbar,
  body[data-page="home"] .page-grid::-webkit-scrollbar {
    display: none;
  }

  body[data-page="home"] .chip {
    flex: 0 0 auto !important;
    padding: 5px 8px !important;
    font-size: .61rem !important;
  }

  body[data-page="home"] .product .buy {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    overflow-x: auto !important;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  body[data-page="home"] .product .buy .btn {
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 7px 9px !important;
    font-size: .66rem !important;
  }

  body[data-page="home"] .release-price,
  body[data-page="home"] .platform-difference {
    margin: 6px 0 !important;
    font-size: .68rem !important;
  }

  body[data-page="home"] .product-card-visual,
  body[data-page="home"] .mobile-detailing-visual,
  body[data-page="home"] .cleaning-operations-visual,
  body[data-page="home"] .construction-operations-visual,
  body[data-page="home"] .pool-reference-visual {
    height: 150px !important;
    min-height: 150px !important;
    overflow: hidden !important;
    border-radius: 11px !important;
  }

  body[data-page="home"] .product-card-visual img,
  body[data-page="home"] .mobile-detailing-visual img,
  body[data-page="home"] .cleaning-operations-visual img,
  body[data-page="home"] .construction-operations-visual img,
  body[data-page="home"] .pool-reference-visual img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }

  /* Repetitive metadata is available on detail pages; remove it from compact mobile homepage. */
  body[data-page="home"] .product-meta-row,
  body[data-page="home"] .free-row {
    display: none !important;
  }

  body[data-page="home"] .product-carousel-controls {
    min-height: 20px !important;
    margin-top: 4px !important;
  }

  body[data-page="home"] .product-carousel-controls > .product-carousel-arrow {
    width: 34px !important;
    height: 34px !important;
  }

  body[data-page="home"] .product-carousel-dots button {
    height: 22px !important;
  }

  /* Vision: keep the full idea but compress supporting cards. */
  body[data-page="home"] .vision {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
  }

  body[data-page="home"] .vision-main {
    grid-column: 1 / -1 !important;
  }

  body[data-page="home"] .vision > div {
    padding: 9px !important;
  }

  body[data-page="home"] .vision > div:last-child {
    grid-column: 1 / -1 !important;
  }

  body[data-page="home"] .vision h2,
  body[data-page="home"] .vision h3 {
    margin-bottom: 3px !important;
    font-size: .92rem !important;
  }

  body[data-page="home"] .vision-main h2 {
    font-size: 1.18rem !important;
  }

  body[data-page="home"] .vision p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: .69rem !important;
    line-height: 1.3 !important;
  }

  /* Ventures and capability cards become shorter horizontal swipe rows. */
  body[data-page="home"] .venture-grid,
  body[data-page="home"] .page-grid {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    scroll-snap-type: x mandatory;
    overscroll-behavior-inline: contain;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  body[data-page="home"] .venture-grid > .venture,
  body[data-page="home"] .page-grid > .content-card {
    flex: 0 0 74% !important;
    min-width: 0 !important;
    scroll-snap-align: start;
    padding: 11px !important;
  }

  body[data-page="home"] .venture h3,
  body[data-page="home"] .content-card h3 {
    margin-bottom: 4px !important;
    font-size: 1rem !important;
  }

  body[data-page="home"] .venture p,
  body[data-page="home"] .content-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: .72rem !important;
    line-height: 1.32 !important;
  }

  body[data-page="home"] .venture-kicker,
  body[data-page="home"] .venture-link {
    font-size: .66rem !important;
  }

  body[data-page="home"] .content-card .btn {
    min-height: 36px !important;
    padding: 7px 9px !important;
    font-size: .64rem !important;
  }

  /* Large live previews: keep the visual proof, but reduce them to a compact window on phones. */
  body[data-page="home"] .planlead-feature,
  body[data-page="home"] .kitverio-pro-feature,
  body[data-page="home"] .aurel {
    gap: 8px !important;
  }

  body[data-page="home"] .planlead-site-preview,
  body[data-page="home"] .planlead-site-preview .demo-window-viewport,
  body[data-page="home"] .kitverio-pro-live-preview,
  body[data-page="home"] .kitverio-pro-live-preview iframe,
  body[data-page="home"] .aurel-shot,
  body[data-page="home"] .aurel-shot .demo-window-viewport {
    min-height: 200px !important;
    height: 200px !important;
  }

  body[data-page="home"] .planlead-feature-copy h2,
  body[data-page="home"] .kitverio-pro-feature h2,
  body[data-page="home"] .aurel h2 {
    font-size: 1.52rem !important;
    margin-bottom: 5px !important;
  }

  body[data-page="home"] .planlead-feature-copy > p:not(.eyebrow),
  body[data-page="home"] .kitverio-pro-feature p,
  body[data-page="home"] .aurel p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: .74rem !important;
    line-height: 1.34 !important;
  }

  body[data-page="home"] .planlead-feature .buy,
  body[data-page="home"] .kitverio-pro-feature .buy,
  body[data-page="home"] .aurel .buy {
    display: flex !important;
    flex-wrap: nowrap !important;
    gap: 5px !important;
    overflow-x: auto !important;
  }

  body[data-page="home"] .planlead-feature .buy .btn,
  body[data-page="home"] .kitverio-pro-feature .buy .btn,
  body[data-page="home"] .aurel .buy .btn {
    flex: 0 0 auto !important;
    min-height: 36px !important;
    padding: 7px 9px !important;
    font-size: .64rem !important;
  }

  body[data-page="home"] .development .dev-card {
    padding: 10px !important;
  }

  body[data-page="home"] .development .dev-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: .7rem !important;
  }

  /* Compact partner/footer finish on phones. */
  body[data-page="home"] .repair-partners {
    padding: 10px 0 !important;
  }

  body[data-page="home"] .footer {
    padding-top: 18px !important;
  }

  body[data-page="home"] .footer-copy {
    font-size: .72rem !important;
    line-height: 1.35 !important;
  }

  /* Keep the assistant accessible without covering so much content. */
  body[data-page="home"] .chat-toggle {
    right: 8px !important;
    bottom: 8px !important;
    min-height: 42px !important;
    padding: 8px 12px !important;
    font-size: .76rem !important;
  }
}

/* Third mobile pass: make the homepage hero genuinely phone-sized. */
@media (max-width: 640px) {
  body[data-page="home"] .home-showcase,
  body[data-page="home"] .home-showcase-inner {
    min-height: 520px !important;
  }

  body[data-page="home"] .home-showcase-inner {
    justify-content: flex-start !important;
    padding-top: 18px !important;
    padding-bottom: 54px !important;
  }

  body[data-page="home"] .home-showcase-copy-stage {
    min-height: 350px !important;
  }

  body[data-page="home"] .home-showcase .hero-eyebrow {
    margin-bottom: 9px !important;
    padding: 7px 10px !important;
    font-size: .56rem !important;
    letter-spacing: .13em !important;
  }

  body[data-page="home"] .home-showcase-copy h1,
  body[data-page="home"] .home-showcase-copy .hero-title {
    font-size: clamp(1.95rem, 9.4vw, 2.55rem) !important;
    line-height: .98 !important;
    max-width: 12ch !important;
  }

  body[data-page="home"] .home-showcase-copy .hero-lead {
    margin-top: 11px !important;
    max-width: 39ch !important;
    font-size: .82rem !important;
    line-height: 1.38 !important;
  }

  body[data-page="home"] .home-showcase-statement {
    margin-top: 9px !important;
    font-size: .69rem !important;
    line-height: 1.28 !important;
  }

  body[data-page="home"] .home-showcase .hero-actions {
    display: flex !important;
    gap: 6px !important;
    margin-top: 8px !important;
    padding-top: 0 !important;
  }

  body[data-page="home"] .home-showcase .hero-actions .btn {
    width: auto !important;
    min-height: 35px !important;
    padding: 7px 10px !important;
    font-size: .66rem !important;
  }

  body[data-page="home"] .home-showcase .hero-actions .btn:not(.primary) {
    display: none !important;
  }

  body[data-page="home"] .home-showcase-controls {
    bottom: 6px !important;
  }
}
