/* ============================================================
   Genie — shared responsive layer
   Targets the fixed 1280px desktop layouts and reflows them for
   tablet / phone.

   IMPORTANT: the DC renderer RE-SERIALIZES every inline style, so
   `style="padding:0 40px"` becomes `style="padding: 0px 40px"` in the
   live DOM and `repeat(4,1fr)` becomes `repeat(4, 1fr)`. Attribute
   substring selectors below therefore match the *serialized* form
   (space after every colon/comma, bare `0` → `0px`). Class-based rules
   are preferred where a class exists.
   ============================================================ */

/* ---- Footer bottom bar (all widths) ----
   Privacy / Terms / LinkedIn sit ABOVE the divider, flush left; the
   copyright drops below it. One divider only, so .ft-grid loses its own. */
.ft-grid { border-bottom: none !important; }
footer > div > div:last-child { flex-direction: column-reverse !important; align-items: flex-start !important; padding-top: 0 !important; gap: 0 !important; }
footer > div > div:last-child > div { width: 100%; justify-content: flex-end !important; border-bottom: 1px solid var(--line-strong); padding-bottom: 22px; margin-bottom: 20px; }

/* ---- Heading legibility on phones ----
   Desktop headings run very tight (letter-spacing down to -2.8px,
   line-height 1.0). At phone sizes that reads as cramped, so loosen
   both. Values are relative (em) so they scale with the clamp()d
   font sizes. !important is required: the tight values live in
   inline styles on each heading. */
@media (max-width: 760px) {
  section h1,
  section h2,
  .cap-h2,
  .fb-title,
  .cta-band-h2 {
    letter-spacing: -0.018em !important;
    line-height: 1.16 !important;
    text-wrap: pretty;
  }
  .tm-quote { letter-spacing: -0.01em !important; line-height: 1.48 !important; text-wrap: pretty; }
  section h3, .pillar-title { letter-spacing: -0.018em !important; line-height: 1.2 !important; text-wrap: pretty; }
  section p, .tm-stat-label { line-height: 1.6 !important; }
}

/* ---- Tablet & below: tighten gutters ---- */
@media (max-width: 900px) {
  [style*="padding: 0px 40px"] { padding-left: 24px !important; padding-right: 24px !important; }
  [style*="padding: 0px 32px"] { padding-left: 20px !important; padding-right: 20px !important; }

  /* split 2-column cards & hero panels → stack */
  [style*="grid-template-columns: minmax(0px, 1.5fr)"],
  [style*="grid-template-columns: minmax(0px, 1.55fr)"],
  [style*="grid-template-columns: minmax(0px, 1.02fr)"],
  [style*="grid-template-columns: minmax(0px, 1fr) minmax(0px, 1.5fr)"],
  [style*="grid-template-columns: minmax(0px, 1fr) minmax(0px, 1fr)"],
  [style*="grid-template-columns: 1.5fr repeat(4, 1fr)"] {
    grid-template-columns: 1fr !important;
  }

  /* tools-page hero feature banner → show image above text when stacked */
  .vid-banner1 > div:last-child { order: -1; }
}

/* ---- Phone ---- */
@media (max-width: 760px) {
  .cta-headline { white-space: normal !important; font-size: 26px !important; }
  [style*="padding: 0px 40px"] { padding-left: 18px !important; padding-right: 18px !important; }
  [style*="padding: 0px 32px"] { padding-left: 18px !important; padding-right: 18px !important; }

  /* any fixed 4-up grid → 2-up */
  [style*="grid-template-columns: repeat(4, 1fr)"] { grid-template-columns: 1fr 1fr !important; }
  /* fixed 3-up grid → 1 */
  [style*="grid-template-columns: repeat(3, 1fr)"] { grid-template-columns: 1fr !important; }
  /* generic 2-col → stack */
  [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  /* closing CTA / cream panels and any remaining split grids → stack */
  [style*="grid-template-columns: 1.5fr repeat(4, 1fr)"] { grid-template-columns: 1fr 1fr !important; }

  /* footer: mobile matches desktop (no mobile-specific overrides) */

  /* footer on phones: one left-aligned column per section (the 5-col desktop
     grid collapses to a ragged 2-up otherwise) */
  footer > div { padding-left: 18px !important; padding-right: 18px !important; }
  .ft-grid { grid-template-columns: 1fr !important; gap: 30px !important; text-align: left !important; justify-items: start !important; padding-bottom: 24px !important; }
  .ft-grid > div { text-align: left !important; }
  .ft-brand { margin-bottom: 2px; }

  /* phones: the three links go flush left with everything else */
  footer > div > div:last-child > div { justify-content: flex-start !important; }

  /* nowrap display headings → allow wrap on phones */
  h1[style*="white-space: nowrap"], h2[style*="white-space: nowrap"], p[style*="white-space: nowrap"] { white-space: normal !important; }

  /* mono eyebrow pills → allow wrap + tighter tracking so they never clip on narrow screens */
  .hero-eyebrow { white-space: normal !important; letter-spacing: 1px !important; line-height: 1.3 !important; padding-top: 11px !important; padding-bottom: 9px !important; text-align: center !important; }

  /* case-study hero heading → looser leading once it wraps to several lines */
  .bingo-hero-h1 { line-height: 1.14 !important; }

  /* Book-a-demo trust logos → uniform heights + tighter gaps so the row reads cleanly */
  .bd-trust { gap: 20px !important; }
  .bd-trust > div { gap: 20px 24px !important; }
  .bd-trust img { height: 20px !important; }
  .bd-trust img[alt="Whalo"] { height: 42px !important; }

  /* homepage logo cloud → flatten both rows into an even 2-col grid so a logo is never alone on a line */
  .hp-logos { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 26px 16px !important; align-items: center !important; justify-items: center !important; }
  .hp-logo-row { display: contents !important; }
  .hp-logos img { height: 30px !important; }
  .hp-logos img[alt="Whalo"] { height: 60px !important; }
  .hp-logos img[alt="Communix"] { height: 22px !important; }

  /* dark closing-CTA banner headline → comfortable leading/tracking once wrapped */
  [data-theme="dark"] h2 { line-height: 1.12 !important; letter-spacing: -1px !important; }

  /* hero CTA is redundant with the mobile sticky Book-a-demo bar → hide on phones */
  .hero-cta { display: none !important; }

  /* tool-gallery tab row → horizontal scroll instead of overflow */
  #toolTabs { overflow-x: auto; max-width: 100%; scrollbar-width: none; }
  #toolTabs::-webkit-scrollbar { display: none; }

  /* pillar grids (the 4-category rows) → one-per-view swipe carousel */
  .pillars-grid { display: flex !important; grid-template-columns: none !important; gap: 24px !important; margin-top: 32px !important; overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .pillars-grid::-webkit-scrollbar { display: none; }
  .pillars-grid .pillar { scroll-snap-align: start; }
  .pillars-grid .pillar-title { font-size: 26px !important; letter-spacing: -1.1px; }

  /* reduce big section vertical padding a touch */
  [style*="padding: 88px 0px"] { padding-top: 56px !important; padding-bottom: 56px !important; }
  [style*="padding: 92px 0px"] { padding-top: 56px !important; padding-bottom: 56px !important; }
  [style*="padding: 64px 0px"] { padding-top: 48px !important; padding-bottom: 48px !important; }

  /* Pricing hero → trim heavy top padding on mobile; FAQ box → tighter stacked gap */
  .pr-hero { padding-top: 44px !important; }
  .faq-box { gap: 28px !important; }

  /* Bingo case study → trim heavy section bottoms on mobile */
  .cs-quote { padding-bottom: 44px !important; }
  .cs-closing { padding-bottom: 48px !important; }

  /* compare-plans table → horizontal scroll so columns never spill past the card */
  .cmp-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cmp-card { min-width: 620px; }
  /* the scroll wrapper becomes a scroll context, so drop the sticky header (it would overlap rows) */
  .cmp-head { position: static !important; top: auto !important; }
}

/* ---- Small phone ---- */
@media (max-width: 480px) {
  [style*="grid-template-columns: repeat(4, 1fr)"]:not(.pillars-grid) { grid-template-columns: 1fr !important; }
}
