/* ==========================================================================
   NADIR mobile polish — phone-first fixes without changing desktop layout.
   Loaded after styles.css / subpages.css on all marketing pages.
   ========================================================================== */

@media (max-width: 860px) {
  :root {
    --header-height: 64px;
  }

  .site-header {
    padding-top: env(safe-area-inset-top, 0px);
  }

  .mobile-menu {
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px));
  }

  html {
    overflow-x: clip;
  }

  body {
    overflow-x: clip;
  }

  .site-shell {
    overflow-x: clip;
  }

  .container,
  .container-wide,
  .nav-wrap,
  .home-page .container {
    width: min(calc(100% - 32px), var(--container-wide));
  }

  .home-page .split-heading {
    gap: 28px;
    grid-template-columns: 1fr;
  }

  .home-page .section-heading h2,
  .home-page .integration-copy h2,
  .home-page .pilot-copy h2 {
    font-size: clamp(1.65rem, 6.5vw, 2.35rem);
  }

  .bento-grid-five {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .bento-equal {
    min-height: auto;
  }

  .integrate-marquee-head {
    text-align: left;
  }

  .integrate-marquee-head h2 {
    font-size: clamp(1.55rem, 6vw, 2.1rem);
  }

  .integrate-marquee-tracks {
    margin-inline: -8px;
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  }

  .integrate-name-chip {
    min-width: 108px;
    min-height: 44px;
    padding: 10px 16px;
    font-size: 0.74rem;
  }

  .home-pricing {
    padding: 48px 0 56px;
  }

  .home-price-card {
    padding: 28px 22px;
  }

  .home-price-amount strong {
    font-size: clamp(2rem, 9vw, 2.6rem);
  }

  .contrast-card {
    padding: 22px 18px 20px;
    border-radius: var(--radius-md);
  }

  .contrast-mode-btn {
    min-height: 46px;
    font-size: 0.82rem;
  }

  .contrast-fleet-control {
    flex-wrap: wrap;
    gap: 10px 14px;
    padding: 14px 16px;
  }

  .contrast-fleet-control input[type="range"] {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .contrast-metrics strong {
    font-size: 1.35rem;
  }

  .hero-product-demo {
    max-width: none;
    padding-bottom: 12px;
  }

  .wt-hero-link {
    position: static;
    display: inline-flex;
    margin-top: 14px;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  :root {
    --header-height: 60px;
  }

  .brand-name {
    font-size: 0.92rem;
    letter-spacing: 0.16em;
  }

  .menu-button {
    width: 44px;
    height: 44px;
  }

  .mobile-menu {
    padding:
      max(20px, env(safe-area-inset-top))
      max(20px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(20px, env(safe-area-inset-left));
  }

  .mobile-menu-quick .button {
    min-height: 48px;
  }

  .hero {
    padding-top: 108px;
  }

  .hero h1 {
    font-size: clamp(2.15rem, 10.5vw, 3rem);
    line-height: 1.05;
  }

  .hero-lede {
    font-size: 0.95rem;
  }

  .wt-hero-embed {
    transform: none;
  }

  .wt-hero-embed .wt-stage-wrap {
    height: auto;
    min-height: 200px;
    max-height: min(52vw, 280px);
  }

  .loop-diagram {
    display: flex;
    overflow-x: auto;
    gap: 0;
    margin-top: 40px;
    padding: 0 0 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .loop-diagram::-webkit-scrollbar {
    display: none;
  }

  .loop-track {
    display: none;
  }

  .loop-step {
    flex: 0 0 78px;
    scroll-snap-align: start;
  }

  .step-title {
    font-size: 0.65rem;
    line-height: 1.25;
  }

  .step-icon {
    width: 44px;
    height: 44px;
  }

  .loop-detail {
    margin-top: 32px;
  }

  .health-card small {
    font-size: 0.48rem;
    white-space: normal;
    line-height: 1.3;
  }

  .vehicle-name strong {
    font-size: 0.52rem;
  }

  .vehicle-name span {
    max-width: none;
    font-size: 0.42rem;
    white-space: normal;
  }

  .risk-badge {
    font-size: 0.38rem;
  }

  .command-main {
    padding: 14px 10px 12px;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-links section {
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line-soft);
  }

  .footer-links section:last-child {
    border-bottom: 0;
  }

  .subpage .page-hero h1 {
    font-size: clamp(2.1rem, 10vw, 3rem);
  }

  .subpage .breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 0;
    white-space: normal;
    font-size: 0.52rem;
    line-height: 1.5;
  }

  .subpage .breadcrumbs i {
    flex-shrink: 0;
  }

  .doc-subsection-toggle {
    align-items: flex-start;
    padding: 14px 14px;
    gap: 10px;
  }

  .doc-subsection-head strong {
    font-size: 0.92rem;
  }

  .doc-subsection-head small {
    font-size: 0.72rem;
  }

  .doc-subsection-body {
    padding: 0 14px 16px 14px;
    font-size: 0.86rem;
  }

  .spec-matrix-wrap {
    margin-inline: -4px;
    padding-bottom: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .spec-matrix-wrap::after {
    display: block;
    margin-top: 8px;
    color: #6f6d66;
    font-size: 0.62rem;
    content: "Swipe table →";
  }

  .spec-matrix {
    min-width: 520px;
    font-size: 0.68rem;
  }

  .glossary-grid {
    grid-template-columns: 1fr;
  }

  .tier-landscape-scroll::before {
    display: block;
    margin-bottom: 8px;
    color: #6f6d66;
    font-size: 0.62rem;
    content: "Swipe tier matrix →";
  }

  .comparison-shell::before {
    display: block;
    margin-bottom: 8px;
    color: #6f6d66;
    font-size: 0.62rem;
    content: "Swipe comparison →";
  }

  .page-hero-actions,
  .page-cta-actions,
  .content-section .button-row,
  .overview-actions {
    display: grid;
    gap: 10px;
  }

  .page-hero-actions .button,
  .page-cta-actions .button,
  .content-section .button-row .button,
  .overview-actions .button {
    width: 100%;
  }

  .product-section-nav a {
    font-size: 0.72rem;
  }

  .article-content pre,
  .code-panel pre {
    overflow-x: auto;
    font-size: 0.62rem;
    -webkit-overflow-scrolling: touch;
  }

  .article-content table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .page-visual-band,
  .pv-band {
    padding-inline: 0;
  }
}

@media (max-width: 390px) {
  .mobile-menu-quick-links {
    grid-template-columns: 1fr 1fr;
  }

  .mobile-menu-quick-links a:first-child {
    grid-column: 1 / -1;
  }

  .signal-bar-items {
    grid-template-columns: 1fr;
  }

  .contrast-mode {
    gap: 8px;
  }
}
