/* ---------- Nav: hamburger toggle (all viewports, only visible ≤768px) ---------- */
.nav__toggle {
  flex-direction: column;
  justify-content: space-between;
  width: 22px;
  height: 15px;
  background: none;
  border: none;
  padding: 0;
}
.nav__toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--color-cream-bright);
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav__toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

/* ---------- Tablet (≤1024px) ---------- */
@media (max-width: 1024px) {
  .hero__stats { display: none; }
  .services__grid { grid-template-columns: repeat(2, 1fr); }

  .about__grid { grid-template-columns: 1fr; }
  .about__icons { display: none; }

  .portfolio__grid { grid-template-columns: 1fr; max-width: 640px; margin: 0 auto; gap: 36px; }
  .portfolio__item--wide, .portfolio__item--tall { grid-column: auto; }

  .process__steps { grid-template-columns: repeat(3, 1fr); row-gap: 40px; }
  .process__track, .process__track-glow { display: none; }

  .testimonials__grid { grid-template-columns: 1fr; max-width: 560px; margin: 0 auto; gap: 24px; }
  .testimonials__logo-grid { grid-template-columns: repeat(3, 1fr); }

  .site-footer__grid { grid-template-columns: 1fr 1fr; row-gap: 48px; }
}

/* ---------- Mobile nav (≤768px) ---------- */
@media (max-width: 768px) {
  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: calc(100% + 12px);
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    border-radius: 20px;
    border: 1px solid rgba(250, 189, 83, 0.15);
    background: rgba(13, 8, 5, 0.94);
    backdrop-filter: blur(24px);
    padding: 16px;
    box-shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.6);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  }
  .nav__links.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav__link, .nav__cta { justify-content: center; padding: 12px 14px; text-align: center; }
  .nav__cta { margin-top: 8px; }

  .final-cta__beam { display: none; }

  /* ---------- Mobile Hero: static image, no video, no pinned cinematic ----------
     hero.js never assigns the video's src on this breakpoint, so this display
     swap is about correctness/paint, not the actual download guard. The blurred
     god-rays layer is dropped too — a filter:blur() this size is meaningfully
     more expensive on mobile GPUs for an effect that's easy to live without. */
  .hero__video, .hero__rays { display: none; }
  .hero__mobile-image { display: block; }

  /* ---------- Mobile: skip the decorative About → Services video transition ----
     No unique content, purely cinematic — collapsed to zero height rather than
     given a static-image fallback. butterfly-transition.js never assigns any of
     the three videos' src on this breakpoint either, so this is belt-and-
     suspenders for layout, not the actual download guard. */
  .butterfly-transition { display: none; }

  .expertise__pin {
    flex-direction: column;
    align-items: flex-start;
    min-height: auto;
    padding: 72px 0 48px;
    gap: 28px;
  }
  .expertise__title { width: auto; padding-left: 6vw; font-size: 48px; }
  /* Auto-slide only (expertise.js): overflow hidden blocks manual swiping but
     still lets the script scroll it; pan-y keeps vertical page scroll working. */
  .expertise__scroller {
    width: 100%;
    overflow-x: hidden;
    overflow-y: hidden;
    touch-action: pan-y;
    scroll-snap-type: x mandatory;
    scroll-padding-left: 6vw;
    padding-left: 6vw;
  }
  .expertise__track { transform: none !important; }
  .expertise__card { flex-basis: 72vw; scroll-snap-align: start; }

  /* ---------- Mobile: brand slider shows 2 plaques instead of 4 ---------- */
  .brand-slider__item { flex-basis: 148px; min-height: 84px; padding: 14px; }
  .brand-slider__item img { max-width: 106px; max-height: 42px; }
  .brand-slider__arrow { width: 36px; height: 36px; }
}

/* ---------- Service icons: thin the scatter as the canvas narrows ---------- */
@media (max-width: 1024px) {
  .svc-icon { height: 48px; width: 48px; margin: -24px 0 0 -24px; }
  .svc-icon__glyph svg { height: 20px; width: 20px; }
}

/* ---------- Mobile (≤640px) ---------- */
@media (max-width: 640px) {
  .hero { padding: 8px; }
  .hero__viewport { height: calc(100vh - 16px); }
  .hero__banner { border-radius: 18px; }
  .hero__banner::after { inset: 8px; border-radius: 12px; }
  body.home .hero { padding: 0; }
  body.home .hero__viewport { height: 100vh; }
  body.home .hero__banner { border-radius: 0; box-shadow: none; }
  .hero__copy { padding: 110px 7vw 36px; justify-content: flex-end; }
  .hero__headline { font-size: clamp(40px, 11vw, 58px); margin-bottom: 18px; }
  .hero__subtext { margin-bottom: 22px; font-size: 15.5px; }
  .hero__cta-group .btn { padding: 15px 26px; font-size: 15px; }
  .hero__cue, .hero__stats, .hero__corners { display: none; }

  /* Twelve chips crowd a phone frame, so thin the scatter to the first eight. */
  .svc-icon { height: 42px; width: 42px; margin: -21px 0 0 -21px; }
  .svc-icon__glyph svg { height: 18px; width: 18px; }

  .about { padding: 90px 6vw; }

  .services { padding: 90px 6vw 110px; }
  .services__grid { grid-template-columns: 1fr; }

  .portfolio { padding: 90px 6vw 110px; }
  /* Home Featured Work: the first two projects, stacked, then "View All Projects". */
  body.home .portfolio__item:nth-child(n+3) { display: none; }
  body.home .portfolio__footer { margin-top: 48px; }

  .process { padding: 90px 6vw 110px; }
  .process__steps { grid-template-columns: 1fr; row-gap: 32px; }

  .testimonials { padding: 90px 6vw 110px; }
  .testimonials__logo-grid { grid-template-columns: repeat(2, 1fr); }

  .final-cta { padding: 100px 6vw; }
  .final-cta__gathering { height: 170px; width: 170px; }
  .final-cta__logo { height: 90px; }

  .site-footer { padding: 90px 6vw 0; }
  .site-footer__grid { grid-template-columns: 1fr; row-gap: 40px; }
}

/* ---------- Phones (portrait): frame the man *and* the laptop ----------
   `cover` on a 16:9 photo in a tall viewport keeps only a centre strip (the man).
   Scale by height instead so his head and the laptop both fit, shift right to
   frame them, and fade the photo's top/bottom edges into the ink background.
   The gradient layer shares the photo's size and position, so it lines up. */
@media (max-width: 768px) and (orientation: portrait) {
  .home-cinematic-bg {
    background:
      linear-gradient(180deg, var(--color-ink) 0%, rgba(13, 8, 5, 0) 16%, rgba(13, 8, 5, 0) 74%, var(--color-ink) 100%) 79% 36% / 100% 64vh no-repeat,
      url("../images/home-bg-laptop-work.jpg") 79% 36% / auto 64vh no-repeat,
      var(--color-ink);
  }
}
