/* ==========================================================================
   AutomationGen — responsive overrides
   Tested widths: 320 / 375 / 390 / 430 / 768 / 1024 / 1280 / 1440 / 1920
   ========================================================================== */

@media (min-width: 1600px) {
  :root { --container: 1360px; }
}

/* ---------- ≤ 1100px : tablet landscape ---------- */
@media (max-width: 1100px) {
  .scale__stage { grid-template-columns: 1fr 40px 1fr; row-gap: 32px; }
  .scale__arrow--last { display: none; }
  .scale__stage .video-wrap { grid-column: 1 / -1; }
  .case__specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .case__specs div:nth-child(3) { border-left: 0; }
  .case__specs div:nth-child(n+3) { border-top: 1px solid var(--border); }
}

/* ---------- ≤ 960px : tablet ---------- */
@media (max-width: 960px) {
  .nav__links, .nav__cta .btn { display: none; }
  .nav__toggle { display: inline-block; }

  .hero__grid { grid-template-columns: 1fr; }
  .hero__title { font-size: clamp(3rem, 11vw, 5.6rem); }

  .timeline__list { grid-template-columns: 1fr; gap: 0; }
  .timeline::before, .timeline__progress { left: 19px; right: auto; top: 20px; bottom: 40px; width: 1px; height: auto; }
  .timeline__progress { transform: scaleY(0); transform-origin: top; }
  .timeline.is-visible .timeline__progress { transform: scaleY(1); }
  .timeline li { display: grid; grid-template-columns: 40px 1fr; column-gap: 20px; padding: 0 0 32px; }
  .timeline li:last-child { padding-bottom: 0; }
  .timeline__num { grid-row: span 2; }
  .timeline h3 { margin-top: 8px; }
  .timeline p { max-width: 48ch; margin-top: 6px; }

  .case__head { grid-template-columns: 1fr; gap: 16px; }
  .about-block, .split, .contact-layout { grid-template-columns: 1fr; }
  .legal-layout { grid-template-columns: 1fr; }
  .legal-nav { position: static; }
  .legal-nav ul { grid-template-columns: repeat(2, minmax(0, 1fr)); border-left: 0; gap: 0 12px; }
  .legal-nav a { padding-left: 0; border-left: 0; }
  .legal-nav a[aria-current="page"] { color: var(--cyan); }

  .service-index a { grid-template-columns: 1fr; gap: 12px; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__brand { grid-column: 1 / -1; }
}

/* ---------- ≤ 720px : large phones ---------- */
@media (max-width: 720px) {
  .problem__grid { grid-template-columns: 1fr; }
  .problem__pane + .problem__pane { border-left: 0; border-top: 1px solid var(--border); }

  .services-grid { grid-template-columns: 1fr; }
  .service-cell, .service-cell:nth-child(2n) { padding-left: 0; padding-right: 0; border-left: 0; }

  .tech-list { grid-template-columns: 1fr; }
  .tech-list li { grid-template-columns: 1fr; gap: 4px; }

  .detail-list li, .detail-list .dl-row { grid-template-columns: 1fr; gap: 8px; }

  /* scale: stack the input → system → outputs vertically */
  .scale__stage { grid-template-columns: 1fr; row-gap: 0; }
  .scale__arrow { width: 1px; height: 28px; margin: 0 0 0 28px; }
  .scale__arrow::after { right: auto; top: auto; bottom: -1px; left: -4px; border: 4px solid transparent; border-top: 6px solid var(--border-strong); }
  .scale__arrow--last { display: block; }
  .video-wrap { margin-top: 0; }
  .video-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .hub { grid-template-columns: 1fr; justify-items: center; }
  .hub__col { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hub__core { width: 130px; height: 130px; }

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

/* ---------- ≤ 480px : phones ---------- */
@media (max-width: 480px) {
  :root { --nav-h: 60px; }
  .brand { font-size: .92rem; letter-spacing: .04em; }
  .hero__title { font-size: clamp(2.45rem, 12.4vw, 3.4rem); }
  .hero__actions .btn { flex: 1 1 100%; }
  .p-node { grid-template-columns: 28px 1fr; }
  .p-node__status { display: none; }
  .pipeline__bar span:last-child { display: none; }
  .case__specs { grid-template-columns: 1fr; }
  .case__specs div + div { border-left: 0; border-top: 1px solid var(--border); }
  .video-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .footer__grid { grid-template-columns: 1fr; }
  .hub__col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .legal-nav ul { grid-template-columns: 1fr; }
  .cta h2 { font-size: clamp(2.3rem, 11vw, 3rem); }
  .flow li { font-size: .72rem; }
}

@media (max-width: 360px) {
  .hero__title { font-size: 2.3rem; }
  .page-head h1 { font-size: 2.3rem; }
  .p-node__name { font-size: .78rem; padding: 8px 10px; }
}

/* ==========================================================================
   Reduced motion — decorative motion off, content always visible
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0s !important;
  }
  .js .reveal, .js .reveal-lines .line > span, .js .video-tile.is-pending { opacity: 1 !important; transform: none !important; }
  .p-particle { display: none; }
  .cta__graphic .wire--lit { stroke-dasharray: none; }
}

/* Fewer sample tiles on small screens so the scale grid stays compact */
@media (max-width: 720px) {
  .video-grid .video-tile:nth-child(n+12):not(.video-tile--n) { display: none; }
}
