/* Content-led reflow only. Existing motion and service controllers are unchanged. */
html {
  -webkit-text-size-adjust: 100%;
}

/* Grid items may shrink; long service names must remain inside their columns. */
.svc-page .svc-hero-grid > *,
.svc-page .svc-route li,
.svc-page .svc-possibilities > *,
.svc-page .svc-chat-grid > *,
.sac-sim .sac-calc > * {
  min-width: 0;
}
.svc-page .svc-hero h1,
.svc-page .svc-route h3,
.agent-demo .agent-bubble,
.agent-demo .agent-privacy {
  overflow-wrap: anywhere;
}

/* A landscape notch must not cover the navigation. */
.site-header {
  padding-top: env(safe-area-inset-top, 0px);
}
.site-header .nav-wrap {
  max-width: calc(100% - max(36px, calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px) + 32px)));
}

@media (max-width: 900px) {
  /* Keep the visual and the copy legible before two columns become cramped. */
  .svc-page .svc-hero-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 620px;
    min-height: 0;
    gap: 35px;
  }
  .svc-page .svc-hero h1 {
    font-size: clamp(36px, 6vw, 48px);
  }
  .svc-page .svc-display {
    transform: none;
  }
  /* The entire expanded menu remains reachable on short/landscape screens. */
  .site-header .mobile-nav {
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overscroll-behavior-y: contain;
    padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
  }
  .v2 .agent-compose textarea,
  .svc-page .agent-compose textarea {
    font-size: 16px;
  }
}

@media (max-width: 760px) {
  .svc-page .svc-route ol {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }
}

@media (max-width: 560px) {
  .svc-page .svc-hero-grid { gap: 20px; }
  .svc-page .svc-hero h1 { font-size: clamp(29px, 9vw, 36px); }
}

@media (pointer: coarse) {
  /* Prevent Safari input auto-zoom without restricting pinch zoom. */
  .v2 input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),
  .v2 select,
  .v2 textarea,
  .svc-page .agent-compose textarea {
    font-size: 16px;
  }
  button, .button, summary, [role="button"] {
    touch-action: manipulation;
  }
}

/* Desktop clearance for the 74px WhatsApp circle + halo. Keep it in the
   corner while content stays in a centered reading column outside its lane. */
@media (min-width: 901px) and (max-width: 1600px) {
  .v3 .container { width: min(var(--container), calc(100% - 240px)); }
  .svc-page .container { width: min(1240px, calc(100% - 240px)); }
  .sac-sim .sac-wrap { width: min(1180px, calc(100% - 240px)); }
}
@media (min-width: 901px) and (max-width: 1120px) {
  /* Reflow the service hero/chat rather than squeeze their narrower columns. */
  .svc-page .svc-hero-grid,
  .svc-page .svc-chat-grid {
    grid-template-columns: minmax(0, 1fr);
    max-width: 700px;
    min-height: 0;
    gap: 35px;
  }
  .svc-page .svc-display { transform: none; }
}
@media (min-width: 901px) and (max-width: 1600px) {
  /* The 3D satellite cards project beyond their scene; reserve that projection too. */
  .v3 .v2-stage-wrap { width: calc(100% - 80px); }
}
