/* mobile.css: MOBILE-ONLY overrides, owned by the mobile agent. Loaded last on every page.
   Everything here must sit inside @media (max-width: 900px) or narrower.
   Rules are keyed to section classes / aria-labelledby ids, never nth-child positions.
   No font-size / font-weight here: type.css owns the 5 text styles. */

/* ======================================================================
   Phones + small tablets (<=900px)
   ====================================================================== */
@media (max-width: 900px) {

  /* One left edge on phones + small tablets: centred multi-line paragraphs are hard to read on a narrow screen */
  .h3-head, .ab-head, :is(.h3-sec, .r3-sec, .ab-sec) [class*="-head"],
  :is(.h3-head, .ab-head, :is(.h3-sec, .r3-sec, .ab-sec) [class*="-head"]) :is(h2, p) { text-align: left !important; margin-left: 0 !important; margin-right: 0 !important; }
  .h3-bridge { text-align: left !important; }

  /* headings break nicely everywhere */
  h1, h2, h3 { text-wrap: balance; }
  p, li, dd, blockquote { text-wrap: pretty; }

  /* ---------- Logo marquee: shorter band (gaps stay at the page's 78px, per Ryan) ---------- */
  .h3-logos.warm { padding: 40px 0 !important; }
  .h3-loghead { margin-bottom: 20px !important; }
  .h18-set img { height: calc(38px * var(--h)) !important; }
  .h18-track { animation-duration: 94s !important; } /* same ~37px/s as the page's own 100s at 44px logos */

  /* ---------- Home: case carousel controls are proper thumb targets ---------- */
  .h3-cases .link, .cx-back { min-height: 44px; display: inline-flex; align-items: center; }

  /* ---------- Creators of all sizes / Bigger names: photo-left rows instead of squeezed 2-col cards ---------- */
  .h5-people { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
  .h5-people .card { flex-direction: row !important; align-items: stretch; }
  .h5-people .card > img { width: 112px !important; flex: 0 0 112px; aspect-ratio: auto !important; height: auto !important; min-height: 112px; object-fit: cover; }
  .h5-people .body { padding: 16px 16px 16px 18px !important; justify-content: center; }
  .h5-people b { margin-bottom: 4px !important; }
  .h5-people p { margin: 0 0 8px !important; flex: none !important; }

  /* ---------- Sound familiar (hm-p): one column here, so the brick help line answers the chat bubbles
     instead of sitting above them. Pure reorder via display:contents; source order (and no-CSS reading order) unchanged. */
  .h7-feel { display: flex !important; flex-direction: column; gap: 0 !important; align-items: stretch; }
  .h7-feel .h7-feel-head { display: contents; }
  .h7-feel .h7-chat { order: 1; margin-top: 40px; }
  .h7-feel .h7-feel-head p.h7-help { order: 2; margin-top: 32px !important; }

  /* ---------- Who we are: stat cards tighter ---------- */
  .h5-stats { gap: 12px !important; }
  .h5-stats li { padding: 20px !important; }
  .h5-stats strong { margin-bottom: 4px !important; }

  /* ---------- Written reviews: one swipeable row (like the video row under it) ---------- */
  .rv-quotes { display: flex !important; grid-template-columns: none !important; gap: 12px !important; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: -20px !important; margin-right: -20px !important; padding: 0 20px 4px !important; scroll-padding: 0 20px;
    scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .rv-quotes::-webkit-scrollbar { display: none; }
  .rv-quotes { padding: 0 9vw 4px !important; scroll-padding: 0 !important; } /* batch67: centred, starts on the middle review */
  .rv-quotes > li { flex: 0 0 82vw; scroll-snap-align: center; display: flex !important; grid-row: auto !important; }
  .rv-quotes .rv-q { display: flex !important; flex-direction: column; width: 100% !important; height: auto !important; }
  .rv-quotes .rv-q blockquote { flex: 1; }
  .rv-quotes:has(+ .mb-count) { margin-bottom: 0 !important; }
  .rv-quotes + .mb-count { margin-bottom: 48px; }

  /* ---------- Case studies ---------- */
  /* grid items must be allowed to shrink, or the swipe row widens the page */
  .cx-body { grid-template-columns: minmax(0, 1fr) !important; }
  .cx-art, .cx-ch { min-width: 0; }
  /* screenshot gallery -> swipe row with a peek of the next shot */
  .cs-gallery { display: flex !important; gap: 12px !important; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: -20px !important; margin-right: -20px !important; padding: 0 20px 8px !important; scroll-padding: 0 20px;
    scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .cs-gallery::-webkit-scrollbar { display: none; }
  .cs-gallery figure { flex: 0 0 86%; scroll-snap-align: start; }
  .cs-gallery figure:only-child { flex-basis: 100%; }
  .cx-fix + p { margin-top: 32px !important; } /* paragraph after the went-wrong/changed boxes (Lizzie 'What we caught') */
  .cs-gallery figure:first-child .frame img, .cs-gallery .frame img { aspect-ratio: 4 / 3 !important; object-fit: contain; width: 100%; }
  .mb-count { margin-top: 12px; color: var(--ink-3, #777); display: flex; align-items: center; gap: 8px; }
  .mb-count i { display: block; width: 6px; height: 6px; border-radius: 3px; background: var(--line, #ddd); transition: width .25s ease, background .25s ease; }
  .mb-count i.on { width: 18px; background: var(--coral, #C76242); }

  /* ---------- About ---------- */
  .ab-usp article { padding: 24px !important; }
  .ab-usp .n { display: block; margin-bottom: 8px; }

  /* ---------- Legal pages (.lg): long permission names (instagram_business_manage_messages) widened the page to 417px ---------- */
  .lg-body :is(p, li, dd, td, th, b, code) { overflow-wrap: anywhere; }
  .lg-body table { display: block; max-width: 100%; overflow-x: auto; }
}

@media (max-width: 860px) {
  /* Nav: menu button + slide-down panel (built by mobile.js). 860px = exactly where a2.css hides .nav ul */
  .nav .wrap { position: relative; }
  .nav .btn { margin-left: auto; }
  .mb-burger { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0 -8px 0 4px;
    padding: 0; border: 0; background: transparent; color: var(--ink, #1a1a1a); border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mb-burger svg { display: block; }
  .mb-burger .x { display: none; }
  .mb-open .mb-burger .x { display: block; }
  .mb-open .mb-burger .bars { display: none; }
  .mb-panel { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-bottom: 1px solid var(--line, #eee);
    box-shadow: 0 16px 32px rgba(0,0,0,.06); padding: 8px 20px 24px; display: none; }
  .mb-open .mb-panel { display: block; animation: mb-drop .22s ease-out both; }
  @keyframes mb-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
  .nav .mb-panel ul { display: block !important; list-style: none; margin: 0; padding: 0; }
  .mb-panel li + li { border-top: 1px solid var(--line, #eee); }
  .nav .mb-panel ul a { padding: 0; border-radius: 0; background: none; min-height: 56px; }
  .mb-panel a { display: flex; align-items: center; min-height: 56px; color: var(--ink, #1a1a1a); text-decoration: none; }
  .mb-panel a[aria-current="page"] { color: var(--brick, #6E2921); }
  .nav .mb-panel a.btn { color: #fff; min-height: 52px; }
  .mb-panel .btn { margin-top: 16px; width: 100%; justify-content: center; min-height: 52px; }

}

/* ======================================================================
   Phones (<=720px)
   ====================================================================== */
@media (max-width: 720px) {

  /* What we actually do (hm-wd): chips / caption share the section's left edge */
  .wd-lead { text-align: left !important; }
  .wd-tags { justify-content: flex-start !important; margin-left: 0 !important; }
  /* the four step cards: icon beside the title instead of on its own row */
  .wd4 li { display: grid !important; grid-template-columns: 44px minmax(0, 1fr); column-gap: 16px; align-items: center; }
  .wd4 .ic { width: 44px !important; height: 44px !important; margin: 0 !important; }
  .wd4 h3 { margin: 0 !important; }
  .wd4 p { grid-column: 1 / -1; margin-top: 12px !important; }

  /* hero: full-width primary CTA, easy to hit with a thumb */
  .h3-actions .btn, .ab-hero .acts .btn { width: 100%; justify-content: center; min-height: 52px; }

  /* final CTA bands: full-width button, left edge like every other section */
  .cta-c { text-align: left !important; }
  .cta-c h2, .cta-c p { margin-left: 0 !important; margin-right: 0 !important; }
  .cta-c .btn, .cs-cta .btn, .cta.r2-c1 .btn, .ct .btn { width: 100%; justify-content: center; min-height: 52px; }

  /* video reviews (motion.js .tvm-view): full-bleed on phones. The 8% edge fade made the first card's name unreadable
     on a 390px screen; a swipe row running off both edges reads as swipeable, like the written reviews above it. */
  section .tvm-view { margin-left: -20px !important; margin-right: -20px !important; padding-left: 20px !important;
    -webkit-mask-image: none !important; mask-image: none !important; }
  /* results CTA: shorter photo + tighter stack so the band is not a full screen tall */
  .cta.r2-c1 .wrap { gap: 32px !important; }
  .cta.r2-c1 figure { max-width: none !important; }
  .cta.r2-c1 figure img { aspect-ratio: 16 / 9 !important; object-position: center 28%; }
  .cta.r2-c1 .btn { margin-top: 32px !important; }

  /* home case cards: 4:5 portrait so the white name label sits on the shoulders, not over the chin */

  /* case pages: client portrait becomes a wide crop instead of a half-width square */
  .cs-portrait { max-width: none !important; }
  .cs-portrait img { aspect-ratio: 16 / 10 !important; object-position: center 22%; }
  .cs-portrait img[src*="lizzie"] { aspect-ratio: 4 / 3 !important; object-position: center 4%; } /* 22% cut off the top of her head; her head sits near the top of the source */
  /* pages with no stats block (Lizzie, Lutke): hero pad + snap margin left an empty 64px gap; match Robbie's ~40px */
  .cs-hero + .wrap > .cx-snap:first-child { margin-top: 8px !important; }

  /* about 'What working with us looks like': 16/7 strips made the screenshots unreadable at ~300px */
  .h20-path figure, .h20-path > li:nth-child(even) figure { aspect-ratio: 4 / 3 !important; }
  .h20-path figure img { object-fit: cover; }

  /* about 'Our goal' brick band: same left edge as every other section */
  .ab-mission { text-align: left !important; }
  .ab-mission h2, .ab-mission p { margin-left: 0 !important; margin-right: 0 !important; }

  /* faq side CTA: full width like the other CTAs */
  .fq-ask .btn { width: 100%; justify-content: center; min-height: 52px; }

  /* contact: Email row sat 4px inside the card's edge */
  .ct-alt { padding-left: 0 !important; padding-right: 0 !important; }

  /* 'Not your typical agency' (home): drop the outer card on phones so the rows use the full width
     instead of a box inside a box; them/us icons share one left edge */
  .h5-vs { background: transparent !important; padding: 0 !important; border-radius: 0 !important; }
  .h5-vs .them { padding: 0 14px; }

  /* 'Bigger names' (.h5-people): small square photo beside name + reach, description full width below
     (the 112px full-height photo left a ~180px text column, 5-6 lines per card) */
  .h5-people .card { display: grid !important; grid-template-columns: 64px minmax(0, 1fr); column-gap: 16px; align-items: center; padding: 20px !important; }
  .h5-people .card > img { grid-row: 1 / span 2; width: 64px !important; height: 64px !important; min-height: 0 !important; flex: none; aspect-ratio: 1 !important; border-radius: 12px; }
  .h5-people .body { display: contents !important; }
  .h5-people b { grid-column: 2; grid-row: 1; align-self: end; margin: 0 !important; }
  .h5-people span { grid-column: 2; grid-row: 2; align-self: start; margin-top: 2px; }
  .h5-people p { grid-column: 1 / -1; grid-row: 3; margin: 14px 0 0 !important; }

  /* about: team cards — portrait beside name, bio below (was two full-screen photos) */
  .ab-team article { display: grid !important; grid-template-columns: 112px minmax(0, 1fr); column-gap: 18px; align-items: center; }
  .ab-team article > img { grid-row: 1 / span 2; width: 112px !important; height: 112px !important; aspect-ratio: 1 !important; object-fit: cover; object-position: center 20%; margin: 0 !important; border-radius: 16px; }
  .ab-team article > h3 { align-self: end; margin: 0 !important; }
  .ab-team article > .role { align-self: start; }
  .ab-team article > p { grid-column: 1 / -1; margin-top: 16px !important; }
}

/* Video reviews (motion.js .tvm-view): on phones, or with reduced motion, no marquee. A native swipe row like the
   written reviews, with position dots (mobile.js). The inline transform motion.js writes each frame is overridden here,
   and the aria-hidden clones are hidden. */
@media (max-width: 720px), (max-width: 900px) and (prefers-reduced-motion: reduce) {
  section .tvm-view { overflow-x: auto !important; overflow-y: hidden; scroll-snap-type: x mandatory; scroll-padding: 0 20px;
    touch-action: auto !important; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: none !important; mask-image: none !important; }
  section .tvm-view::-webkit-scrollbar { display: none; }
  section .tvm-view .tv-row { transform: none !important; will-change: auto !important; padding: 0 calc(50% - 100px) !important; }
  section .tvm-view .tv-row > li { scroll-snap-align: center; } /* batch67: centred; mobile.js adds clones both sides so it loops either way */
  section .tvm-view { scroll-padding: 0 !important; padding-left: 0 !important; padding-right: 0 !important; }
}
@media (max-width: 900px) and (min-width: 721px) and (prefers-reduced-motion: reduce) {
  section .tvm-view { scroll-padding: 0; }
  section .tvm-view .tv-row { padding-right: 0 !important; }
}

/* Small phones */
@media (max-width: 380px) {
  .ab-team article { grid-template-columns: 96px minmax(0, 1fr); }
  .ab-team article > img { width: 96px !important; height: 96px !important; }
  .nav .btn { padding: 0 12px !important; }
}
