/* Responsive rules for the Growth Foundry pages.
   The site is authored with inline styles at desktop scale; media queries can't be
   inline, so breakpoint overrides live here and key up off data-r tokens. */

/* ---------- Tablet ---------- */
@media (max-width: 1080px) {
  [data-r~="rootgap"] { gap: 80px !important; }
  [data-r~="pad"] { padding-left: 32px !important; padding-right: 32px !important; }
  [data-r~="g3"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [data-r~="split"] { grid-template-columns: minmax(0, 1fr) !important; gap: 40px !important; }
  [data-r~="tocsticky"] { position: static !important; top: auto !important; }

  /* service cards stack: image goes full width, text below */
  [data-r~="svccard"] { gap: 32px !important; min-height: 0 !important; }
  [data-r~="svcimg"] { flex: 1 1 100% !important; max-width: 100% !important; min-height: 0 !important; aspect-ratio: 16 / 9 !important; }
  [data-r~="panel"] { padding: 48px 32px !important; }
  [data-r~="band"] { height: 320px !important; }
  [data-r~="float"] { width: min(360px, 80%) !important; }
  [data-r~="herorow"] { padding: 88px 0 40px !important; }
  [data-r~="tall"] { min-height: 320px !important; }
  [data-r~="row4"] { grid-template-columns: 48px minmax(0, 1fr) 88px !important; gap: 20px !important; }
  [data-r~="row4"] > *:nth-child(3) { display: none !important; }
  [data-r~="flexwide"] { gap: 48px !important; }
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  [data-r~="rootgap"] { gap: 64px !important; }
  [data-r~="pad"] { padding-left: 20px !important; padding-right: 20px !important; }
  [data-r~="g2"],
  [data-r~="g3"] { grid-template-columns: minmax(0, 1fr) !important; }
  [data-r~="g2"],
  [data-r~="g3"],
  [data-r~="split"] { row-gap: 40px !important; }
  [data-r~="panel"] { padding: 32px 22px !important; }
  [data-r~="band"] { height: 240px !important; }
  [data-r~="float"] { width: min(240px, 62%) !important; }
  [data-r~="brk"] { display: none !important; }
  [data-r~="herorow"] { padding: 56px 0 32px !important; gap: 28px !important; }
  [data-r~="heroh1"] { font-size: clamp(1.875rem, 8.4vw, 2.5rem) !important; }
  [data-r~="tall"] { min-height: 260px !important; }
  [data-r~="flexwide"] { gap: 32px !important; }
  [data-r~="field"] { width: 100% !important; }

  /* nav has to fit a 360px viewport alongside the lockup */
  [data-r~="nav"] { gap: 14px !important; }
  [data-r~="nav"] a { font-size: 13px !important; }
  [data-r~="logo"] { height: 20px !important; }

  /* index rows collapse to number + title */
  [data-r~="row4"] { grid-template-columns: 34px minmax(0, 1fr) !important; gap: 12px !important; }
  [data-r~="row4"] > *:nth-child(3),
  [data-r~="row4"] > *:last-child { display: none !important; }

  /* marquees run shorter on small screens */
  [data-marquee] { gap: 40px !important; }

  /* The blurred colour plates are the loading placeholder, so they stay — but a
     48px radius is expensive to raster on iOS, and half that looks the same at
     phone size. Backdrop blur on the nav goes entirely; it repaints on scroll. */
  section div[style*="blur("],
  footer div[style*="blur("] { filter: blur(24px) !important; }
  [data-fixednav] { backdrop-filter: none !important; background: #ffffff !important; }

  /* skip layout + paint for offscreen sections while scrolling */
  body > div > section,
  body > div > footer { content-visibility: auto; contain-intrinsic-size: auto 700px; }

  /* The hero photo strip stops animating on phones and becomes a swipeable rail.
     A 12-tile animated row is one enormous composited layer — iOS falls back to
     software rasterising it, which is what made scrolling crawl. Native
     overflow scrolling runs on the compositor instead, and swiping is the
     better phone interaction anyway. */
  [data-r~="mscroll"] {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }
  [data-r~="mscroll"]::-webkit-scrollbar { display: none; }
  [data-marquee="images"] {
    animation: none !important;
    will-change: auto !important;
    padding-inline: 20px;
  }
  [data-marquee="images"] > div { scroll-snap-align: center; }
  /* the second copy of the list only exists to make the loop seamless */
  [data-marquee="images"] > div:nth-child(n+7) { display: none !important; }
  [data-marquee="images"] > div[style*="flex:0 0 380px"] { flex: 0 0 78vw !important; height: 400px !important; }

  /* text strips keep moving — they cost almost nothing — but shed the layer hint */
  [data-marquee]:not([data-marquee="images"]) { will-change: auto !important; }

  [data-r~="svcimg"] { aspect-ratio: 4 / 3 !important; }

  /* Safety net: a minmax() floor wider than the viewport can't shrink on its
     own, so neutralise any grid track minimum we haven't tokenised by hand. */
  section div[style*="minmax("],
  footer div[style*="minmax("] { grid-template-columns: minmax(0, 1fr) !important; }
}

/* ---------- Small mobile ---------- */
@media (max-width: 420px) {
  [data-r~="pad"] { padding-left: 16px !important; padding-right: 16px !important; }
  [data-r~="nav"] { gap: 10px !important; }
  [data-r~="nav"] a { font-size: 12px !important; }
  [data-r~="logo"] { height: 18px !important; }
  [data-r~="panel"] { padding: 26px 18px !important; }
}
