/* ==========================================================================
   RESPONSIVE — breakpoints at 1280 / 1024 / 768 / 480.
   Mobile layouts are purpose-built (stacked, full-screen nav overlay,
   48px+ tap targets), not a squeezed desktop grid.
   ========================================================================== */

/* ---- ≤1440px: tighten outer gutter floor ---------------------------------- */
@media (max-width: 1440px) {
  .container, .header__inner, .hero__inner {
    padding-inline: max(var(--gutter), 32px);
  }
}

/* ---- ≤1024px: tablet landscape — grids drop to 2 columns ------------------- */
@media (max-width: 1024px) {
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .hero__inner { gap: var(--sp-4); }
  .hero__title { font-size: 48px; }
  :root { --fs-h2: 40px; }
  .footer__grid { grid-template-columns: 1fr 1fr; }
  .footer__grid > :last-child { grid-column: 1 / -1; }

  /* Scroll indicator makes little sense once the hero is closer to
     touch-scrolled height — hidden from tablet down. */
  .hero__scroll { display: none; }

  /* Custom pixel cursor is a fine-pointer/mouse affordance; force the
     system cursor back from tablet down regardless of pointer-type
     detection in script.js (covers resized/touch-hybrid viewports). */
  .pixel-cursor { display: none !important; }
  .has-custom-cursor,
  .has-custom-cursor a,
  .has-custom-cursor button {
    cursor: auto;
  }

  /* Timeline: 2x2 grid instead of a single squeezed row of 4. */
  .timeline {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-4) var(--sp-3);
    padding-top: 0;
  }
  .timeline__track, .timeline__mascot-track { display: none; }

  /* Case studies: stay one row, become a swipeable slider instead of wrapping. */
  .case-slider__arrow { display: flex; }
  .case-grid {
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .case-grid::-webkit-scrollbar { display: none; }
  .case-card { flex: 0 0 85%; scroll-snap-align: center; }

  /* Footer sleep mascot reads too small next to the other ~100-140px
     mascots once the desktop layout's extra breathing room is gone. */
  .footer__mascot { width: 130px; }
}

/* ---- ≤900px: nav → hamburger (before desktop nav links collide) ----------- */
@media (max-width: 900px) {
  .nav { display: none; }
  .header__inner .btn { display: none; }
  .hamburger { display: flex; }
  .mobile-nav { display: flex; }
}

/* ---- ≤768px: tablet — stacked sections, hamburger nav ---------------------- */
@media (max-width: 768px) {
  .container, .header__inner, .hero__inner, .contact__inner {
    padding-inline: var(--gutter-mobile);
  }
  .section { padding-block: var(--sp-8); }

  .hero { min-height: auto; padding-block: var(--sp-6); }
  .hero__inner { flex-direction: column-reverse; }
  .hero__content, .hero__mascot-wrap { width: 100%; }
  .hero__mascot-wrap { max-width: 220px; margin-inline: auto; }
  .hero__title { font-size: var(--fs-h1-mobile); min-height: 0; }
  .hero__subtitle { font-size: var(--fs-sub-mobile); max-width: none; }
  .hero__ctas { flex-direction: column; align-items: stretch; }
  .hero__ctas .btn { width: 100%; }

  .section__head h2 { font-size: var(--fs-h2-mobile); }
  .section__head p { font-size: var(--fs-body); }

  .compare-grid { grid-template-columns: 1fr; }
  .service-grid { grid-template-columns: 1fr; }
  .section__mascot { display: none; }

  .timeline { display: flex; flex-direction: column; padding-top: 0; gap: var(--sp-4); }
  .timeline__track, .timeline__mascot-track { display: none; }

  .case-card { flex: 0 0 100%; }
  .process__mascot-mobile {
    display: block;
    width: 100px;
    margin: 0 auto var(--sp-4);
  }
  .process__emphasis { font-size: 22px; }

  .contact__inner { flex-direction: column; }
  .contact__form-col, .contact__aside-col { width: 100%; }
  .contact__aside-col { margin-top: var(--sp-6); }

  .footer__grid { grid-template-columns: 1fr; gap: var(--sp-4); }
  .footer__grid > :last-child { grid-column: auto; }
  .footer__bottom { flex-direction: column; gap: var(--sp-1); }

  .modal { padding: var(--sp-4); }

  /* Case modal: go near-full-screen rather than a shrunk desktop card — the
     gallery+long-copy layout needs the room. Backdrop padding shrinks (the
     modal itself already goes full max-height via .modal's own rule); the
     service modal's own backdrop is untouched since this only targets the
     case-modal's --case modifier. */
  .modal-backdrop--case { padding: var(--sp-2); }

  /* Gallery arrows sitting inline beside the viewport (desktop layout) eat
     too much of a narrow screen's width — two 48px buttons plus gaps leaves
     the actual image a cramped sliver. Overlay them on top of the image
     instead, centered vertically at each edge; still 48px, still
     .case-slider__arrow's own styling, just taken out of flow. */
  .case-modal-gallery {
    position: relative;
    /* Clears .modal__close (24px inset, 48px tall against the modal's own
       32px mobile padding — a 40px overlap otherwise) so the close button
       and the overlaid next-arrow don't collide in the top-right corner. */
    margin-top: var(--sp-6);
  }
  .case-modal-gallery__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
  }
  .case-modal-gallery__arrow--prev { left: var(--sp-1); }
  .case-modal-gallery__arrow--next { right: var(--sp-1); }

  /* Tap targets ≥48px everywhere on touch layouts */
  .btn, .chip, .contact-button, .accordion__trigger, .nav__link { min-height: 48px; }
  .nav__link { display: flex; align-items: center; }
  /* Footer nav links are stacked 8px apart with no padding of their own —
     a 25px text line is well under the 48px target and adjacent links sit
     close enough together to invite mis-taps. */
  .footer__nav { gap: 0; }
  .footer__nav a { display: flex; align-items: center; min-height: 48px; }
}

/* ---- ≤480px: mobile — final tightening ------------------------------------- */
@media (max-width: 480px) {
  .hero__title { font-size: 28px; }
  .section__head h2 { font-size: 28px; }
  .kicker { font-size: 10px; }
  .cta-banner__text { font-size: 16px; }
  .timeline__number { width: 48px; height: 48px; font-size: 22px; }
  .case-card__metric { font-size: 26px; }
  .mobile-nav__link { font-size: 26px; }
  .form__chips { gap: 6px; }
  .chip { padding: 8px 10px; font-size: 11px; }
}
