/* ============================================================
   MENA InsureLab — Mobile refinements
   Loaded after site.css, page.css and home.css. Tightens layout,
   type, spacing and tap targets at narrow viewports. Targeted to
   the specific overflow / cramping issues observed at ≤760px,
   with extra care at ≤480px.
   ============================================================ */

/* ---------- 0. Global guardrails ---------- */
@media (max-width: 760px) {
  /* Catch any accidental horizontal scroll caused by oversized
     wordmarks / scrims / decorative shapes. */
  html, body { overflow-x: clip; }
  body { -webkit-text-size-adjust: 100%; }

  /* Make hover-only transforms safe on touch (cards do translateY(-2px)
     even when finger taps — leaves a brief stuck state). */
  .persona:hover,
  .route:hover,
  .adv:hover,
  .tier:hover,
  .case-card:hover,
  .leader:hover,
  .pcard:hover,
  .offer:hover { transform: none; }

  /* Grid items default to min-width: auto, which means their min-content
     can blow out a grid column past the container width — pushing copy
     and CTAs off-screen behind overflow-x: clip. Force grid tracks built
     with the bare `1fr` token at narrow viewports to behave as
     `minmax(0, 1fr)` by zeroing the implicit floor on direct grid
     children. The classes below are the layouts that use bare 1fr and
     can carry long copy or media. */
  .phero__copy > *,
  .leadership > *,
  .leadership__cards > *,
  .cta-open__inner > *,
  .saudi-block > *,
  .cta-block > *,
  .contact-grid > *,
  .case-grid > *,
  .personas > *,
  .offer-grid > *,
  .offer-grid--showcase > *,
  .offer-grid--on-dark > *,
  .eco-section > *,
  .routes > *,
  .tiers > *,
  .caps > *,
  .stats > *,
  .pgrid > *,
  .thesis > *,
  .leadership__copy > *,
  .platform-grid > *,
  .df-intro > *,
  .df-grid > *,
  .df-steps__list > *,
  .cquote-pair > *,
  .cquote > *,
  .problem-grid > *,
  .phase-grid > * { min-width: 0; }

  /* Bare paragraphs and headings in copy blocks: allow long words to
     break before they force an overflow. text-wrap: balance/pretty on
     short headlines can also expand min-content past container width on
     narrow viewports. */
  .leadership__copy h2,
  .leadership__copy p,
  .leadership__copy li,
  .phero__copy h1,
  .phero__deck,
  .home-hero__headline,
  .home-hero__deck { overflow-wrap: anywhere; }
}

/* ---------- 0b. Case-study hero variant ---------- */
/* The case-study pages override .phero__copy with a 1.1fr / 0.9fr grid
   at higher specificity than the base .phero__copy mobile rule, so the
   2-column layout sticks at mobile and pushes the right column 160px+
   off the right edge. Collapse case-study hero to 1fr at <=960px. */
@media (max-width: 960px) {
  .phero--case .phero__copy { grid-template-columns: 1fr; }
}

/* ---------- 1. Section rhythm ---------- */
@media (max-width: 760px) {
  :root {
    --section-y: clamp(56px, 9vw, 88px);
    --gutter: clamp(18px, 5vw, 28px);
  }
  .section-head { margin-bottom: 28px; }
  .display-lg { font-size: clamp(1.9rem, 7vw, 2.4rem); line-height: 1.08; }
  .display-xl { font-size: clamp(2.4rem, 9vw, 3.2rem); line-height: 1.05; }
}

@media (max-width: 480px) {
  :root {
    --gutter: 16px;
    --section-y: 56px;
  }
}

/* ---------- 2. Header ---------- */
@media (max-width: 760px) {
  .site-header__inner { height: 64px; gap: 16px; }
  .site-header__logo img { height: 28px; }
  .site-header__menu-btn { width: 44px; height: 44px; }
  .site-header__menu-btn svg { width: 22px; height: 22px; }

  /* Drawer top inset must match the (now shorter) header height. */
  .site-header__drawer { inset: 64px 0 0 0; padding-top: 16px; padding-bottom: 32px; }
  .site-header__drawer a { font-size: 1.25rem; padding: 14px 0; }
  .site-header__drawer .btn { margin-top: 16px; width: 100%; justify-content: center; }
}

/* ---------- 3. Home hero (video) ---------- */
@media (max-width: 760px) {
  .home-hero--video {
    min-height: 88vh;
    margin-top: -64px;        /* matches shorter header */
    padding-top: 64px;
  }
  .home-hero__container {
    padding-top: 48px;
    padding-bottom: 56px;
  }
  .home-hero__copy { gap: 20px; }
  .home-hero__copy::before {
    /* Localized scrim — keep it contained, not -64px out of frame. */
    inset: -24px -16px -16px -16px;
  }
  .home-hero__eyebrow { font-size: 0.6875rem; gap: 8px; }
  .home-hero__headline-lede { font-size: clamp(2rem, 9vw, 2.6rem); }
  .home-hero__deck { font-size: 1rem; line-height: 1.55; }
  .home-hero__actions { gap: 10px; width: 100%; }
  .home-hero__actions .btn--lg { flex: 1 1 auto; min-width: 0; }
}

@media (max-width: 480px) {
  .home-hero__actions { flex-direction: column; align-items: stretch; }
  .home-hero__actions .btn--lg { width: 100%; }
}

/* ---------- 4. Persona hero (used on every interior page) ---------- */
@media (max-width: 760px) {
  .phero { padding-top: clamp(40px, 7vw, 64px); }
  .phero__copy { padding-bottom: 36px; gap: 20px; }
  .phero__copy h1 { font-size: clamp(2rem, 8.5vw, 2.6rem); max-width: none; }
  .phero__deck { font-size: 1rem; }
  .phero__rhs { gap: 16px; }
  .phero__actions { gap: 10px; width: 100%; }
  .phero__actions .btn { flex: 1 1 auto; min-width: 0; }
  .phero__photo { aspect-ratio: 4 / 3; padding: 16px; }
  .phero__photo .cap { max-width: 88%; padding: 12px 14px; }
  .phero__photo .tag { top: 14px; left: 14px; }

  /* Decorative circle — pull off-screen so it doesn't push layout. */
  .phero::before {
    top: -200px;
    right: -200px;
    width: 280px;
    height: 280px;
  }

  /* Centered hero variant */
  .phero__copy--centered .phero__actions { justify-content: stretch; margin-top: 28px; }
  .phero__copy--centered .phero__subtitle { font-size: 1rem; line-height: 1.5; }
}

@media (max-width: 480px) {
  .phero__actions { flex-direction: column; align-items: stretch; }
  .phero__actions .btn { width: 100%; }
  .phero__strip .pcol { padding: 20px 16px; }
  .phero__strip .pcol .num { font-size: 1.25rem; }
}

/* ---------- 5. Cards — tighten interior padding ---------- */
@media (max-width: 560px) {
  .persona { padding: 28px 22px; min-height: 0; gap: 14px; }
  .persona__title { font-size: 1.5rem; }
  .persona__pitch { font-size: 0.9375rem; }

  .route { padding: 28px 22px; min-height: 0; gap: 16px; }
  .route__title { font-size: 1.5rem; }

  .adv { padding: 24px 22px; min-height: 0; gap: 12px; }

  .tier { padding: 28px 22px; gap: 16px; }
  .tier__name { font-size: 1.375rem; }

  .case-card { padding: 24px 22px; gap: 18px; }
  .case-card__body { font-size: 1rem; }
  .case-card__metric-num { font-size: 1.625rem; }

  .leader { padding: 16px; gap: 14px; }
  .leader__portrait { width: 80px; }

  .pcard { padding: 18px 16px; gap: 10px; }
  .pcard__logo { padding-right: 60px; height: 32px; }

  .eco-panel { padding: 22px 20px; gap: 16px; }
  .eco-panel__row { gap: 12px; padding: 12px 0; }
  .eco-panel__row .num { width: 26px; font-size: 0.6875rem; }
  .eco-panel__row .label { font-size: 0.875rem; }

  .offer { padding: 28px 22px; min-height: 0; gap: 12px; }

  .outcome { padding: 28px 22px; min-height: 0; gap: 12px; }

  .saudi-block { padding: 32px 24px; gap: 24px; }

  .cta-block { padding: 40px 28px; gap: 28px; }
}

/* ---------- 6. Type clamps at extreme narrow ---------- */
@media (max-width: 480px) {
  .h1 { font-size: 1.625rem; }
  .h2 { font-size: 1.375rem; }
  .h3 { font-size: 1.1875rem; }
  .body-lg { font-size: 1rem; }
  .cta-open h2 { font-size: 1.75rem; line-height: 1.1; }
  .saudi-block h3 { font-size: 1.25rem; }
}

/* ---------- 7. Buttons & tap targets ---------- */
@media (max-width: 760px) {
  .btn { min-height: 44px; height: auto; padding: 12px 18px; }
  .btn--lg { min-height: 52px; padding: 14px 22px; font-size: 0.9375rem; }
  .btn--sm { min-height: 36px; padding: 8px 14px; }
}

/* ---------- 8. Logo marquee ---------- */
@media (max-width: 760px) {
  .logo-marquee { --marquee-duration: 36s; }
  .logo-marquee__track { gap: 36px; padding: 0 18px; }
  .logo-marquee__img { height: 26px; max-width: 110px; }
}

/* ---------- 9. Stats / Numbers (home) ---------- */
@media (max-width: 480px) {
  .stat { padding: 28px 18px; gap: 8px; }
  .stat__num { font-size: 1.875rem; }
  .stat__num::after { margin-top: 10px; }
  .stat__label { font-size: 0.8125rem; }
}

/* ---------- 10. Hero meta footer (home) ---------- */
@media (max-width: 760px) {
  .home-hero__footer { padding: 14px 0; }
  .home-hero__meta-item,
  .home-hero__meta-item--center { font-size: 0.625rem; }
  .home-hero__scroll-line { width: 40px; }
}

/* ---------- 11. Gallery (home) ---------- */
@media (max-width: 760px) {
  .gallery__track {
    grid-auto-columns: 78vw;
    gap: 16px;
    scroll-padding-left: var(--gutter);
  }
  .gallery__cell { padding: 12px; aspect-ratio: 4 / 5; }
  .gallery__nav { margin-top: 20px; }
  .gallery__btn { width: 44px; height: 44px; }
}

/* ---------- 12. Eco-section: panel order ---------- */
@media (max-width: 760px) {
  /* The panel reads as the proof point; show it above the headline copy
     on narrow viewports so the data lands first. */
  .eco-section { gap: 24px; }
  .eco-panel__foot { gap: 12px; flex-wrap: wrap; font-size: 0.625rem; }
}

/* ---------- 13. Case cards (home) ---------- */
@media (max-width: 760px) {
  .case-grid { gap: 16px; }
  .case-card__metric { gap: 12px; padding-top: 16px; }
  .case-card__metric-label { font-size: 0.625rem; }
}

/* ---------- 14. Saudi callout ---------- */
@media (max-width: 760px) {
  .section--photo::before { background-attachment: scroll; }
  .saudi-block { gap: 20px; }
  .saudi-block h3 { font-size: 1.375rem; line-height: 1.2; }
  .saudi-block p { font-size: 0.9375rem; }
  .saudi-block .btn { width: 100%; justify-content: center; }
}

/* ---------- 15. CTA bands ---------- */
@media (max-width: 760px) {
  .cta-open { padding-top: 64px; padding-bottom: 8px; }
  .cta-open h2 { font-size: clamp(1.625rem, 6.5vw, 2rem); line-height: 1.1; }
  .cta-open__inner { gap: 20px; }
  .cta-open__actions .btn { width: 100%; justify-content: center; }
  .cta-open__email { font-size: 0.875rem; word-break: break-all; }

  .cta-block { padding: 40px 28px; gap: 28px; }
  .cta-block::after { width: 220px; height: 220px; right: -80px; bottom: -80px; }
  .cta-block::before { width: 140px; height: 140px; }
  .cta-block__copy h2 { font-size: clamp(1.625rem, 6vw, 2rem); }
  .cta-block__actions .btn { width: 100%; justify-content: center; }
}

/* ---------- 16. Footer ---------- */
@media (max-width: 760px) {
  .site-footer { padding-top: 56px; padding-bottom: 28px; }
  .site-footer__grid { gap: 32px 24px; padding-bottom: 40px; }
  .site-footer__brand > img { height: 30px; margin-bottom: 20px; }
  .site-footer__brand p { font-size: 0.9375rem; }
  .site-footer__col h5 { margin-bottom: 14px; }
  .site-footer__col ul { gap: 10px; }

  /* The big animated wordmark used to overflow because of white-space:
     nowrap + a clamp() min of 3rem. Allow wrapping and shrink. */
  .site-footer__wordmark {
    font-size: clamp(2.4rem, 16vw, 4.5rem);
    white-space: normal;
    margin: 36px 0 28px;
    line-height: 0.95;
    letter-spacing: -0.045em;
    word-break: break-word;
  }
  .site-footer__wordmark::after { height: 0.7em; }

  .site-footer__bottom { gap: 10px; font-size: 0.75rem; }

  /* WhatsApp pill: don't let it bump the phone number to a weird wrap. */
  .site-footer .wa-tag { margin-left: 4px; }
}

@media (max-width: 480px) {
  .site-footer__grid { gap: 28px; }
  .site-footer__wordmark { font-size: clamp(2rem, 17vw, 3.6rem); }
}

/* ---------- 17. Filter bar ---------- */
@media (max-width: 760px) {
  .filterbar { gap: 6px; padding-bottom: 16px; margin-bottom: 24px; }
  .filter-chip { padding: 8px 12px; font-size: 0.6875rem; }
  .filterbar.is-sticky-enabled { top: 64px; padding-top: 10px; padding-bottom: 10px; }
  .filterbar__visible {
    width: 100%;
    text-align: right;
    padding-left: 0;
    margin-top: 2px;
  }
}

/* ---------- 18. Thesis / leadership ---------- */
@media (max-width: 760px) {
  .thesis__body {
    font-size: 1rem;
    padding-left: 16px;
  }
  .thesis__body p:first-child::first-letter {
    font-size: 3.2rem;
    margin: 2px 8px 0 -2px;
  }
  .leadership__copy p { font-size: 1rem; }
  .leadership__cards { gap: 12px; }
}

/* Leader card at narrow widths — page.css flips it to flex-direction:row
   at <=640px (portrait + 3 sibling text blocks). With no flex-wrap, the
   pill-shaped LinkedIn button can push the card past container width on
   small Android screens. Restructure to grid so portrait sits beside a
   stacked column of name / role / link. */
@media (max-width: 640px) {
  .leadership__cards .leader {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    align-items: center;
    column-gap: 14px;
    row-gap: 4px;
  }
  .leadership__cards .leader__portrait {
    grid-row: 1 / span 3;
    width: 96px;
  }
  .leadership__cards .leader__name,
  .leadership__cards .leader__role { min-width: 0; }
  .leadership__cards .leader__linkedin {
    margin-top: 6px;
    justify-self: start;
  }
}
@media (max-width: 560px) {
  .leadership__cards .leader {
    grid-template-columns: 80px minmax(0, 1fr);
    column-gap: 12px;
  }
  .leadership__cards .leader__portrait { width: 80px; }
}

/* ---------- 19. Loop (insur-studio) ---------- */
@media (max-width: 560px) {
  .loop__stage { padding: 24px 22px; gap: 10px; }
  .loop__title { font-size: 1.375rem; }
  .loop__stage::after { display: none; }
}

/* ---------- 20. Forms (contact + others) ---------- */
@media (max-width: 760px) {
  .contact-form { gap: 28px; }
  .contact-form fieldset { gap: 14px; }
  .contact-form legend { padding-bottom: 12px; margin-bottom: 4px; }
  .route-picker label { padding: 14px 16px; gap: 12px; }
  .field input,
  .field textarea,
  .field select {
    /* Below 16px iOS forces zoom-on-focus. Lock to 16px on mobile. */
    font-size: 16px;
  }
  .aside-card { padding: 22px; }
  .contact-faq { margin-top: 36px; padding-top: 28px; }
}

/* ---------- 21. Partner cards ---------- */
@media (max-width: 560px) {
  .pcard__name { font-size: 0.9375rem; }
  .pcard__desc { font-size: 0.8125rem; }
  .pcard__region { top: 12px; right: 12px; font-size: 0.5625rem; }
}

/* ---------- 22. Eco panel: collapse status to its own row at narrow ---------- */
@media (max-width: 420px) {
  .eco-panel__row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "num label"
      ".   status";
    row-gap: 6px;
  }
  .eco-panel__row .num    { grid-area: num; }
  .eco-panel__row .label  { grid-area: label; }
  .eco-panel__row .status { grid-area: status; justify-self: start; }
}

/* ---------- 23. Phero strip overlap (when stacked under hero photo) ---------- */
@media (max-width: 560px) {
  .phero__strip .pcol .label { font-size: 0.625rem; }
}

/* ---------- 24. Tier card details ---------- */
@media (max-width: 560px) {
  .tier__includes li { font-size: 0.9375rem; }
  .tier__price { font-size: 0.75rem; padding: 8px 12px; }
}

/* ---------- 25. Capabilities bento (for-insurtechs etc.) ---------- */
@media (max-width: 560px) {
  .cap-cell { padding: 24px 22px; gap: 10px; }
  .cap-cell__title { font-size: 1.125rem; }
}

/* ---------- 26. Timeline ---------- */
@media (max-width: 560px) {
  .tstep { padding-right: 0; gap: 12px; }
  .tstep__num { width: 48px; height: 48px; }
  .tstep__title { font-size: 1.125rem; }
}

/* ---------- 27. People-band & similar image grids ---------- */
@media (max-width: 560px) {
  .people-band { gap: 16px; }
  .people-band__cell { aspect-ratio: 4 / 3; padding: 12px; }
}

/* ---------- 28. Powered-by relationship band ---------- */
@media (max-width: 760px) {
  .poweredby { padding: 32px 24px; gap: 24px; }
  .poweredby__brand { padding: 16px 18px; }
  .poweredby__connector { padding: 0; }
}

/* ---------- 29. Partner strip ---------- */
@media (max-width: 760px) {
  .partner-strip { padding: 36px 0; }
  .partner-strip__label { margin-bottom: 20px; }
  .partner-strip__item { height: 56px; font-size: 0.8125rem; }
}

/* ---------- 30. Cohort/CTA generic gentleness ---------- */
@media (max-width: 760px) {
  .split-head { margin-bottom: 28px; gap: 16px; }
  .split-head__copy { gap: 12px; }
  .proof-intro { margin-bottom: 28px; gap: 20px; }
}

/* ---------- 31. Sticky filter & sticky thesis head at scroll ---------- */
@media (max-width: 760px) {
  .thesis__head { position: static; }
}

/* ---------- 32. Case-study specific tightening ---------- */
@media (max-width: 760px) {
  .case-summary__media,
  .corridor-photo-band {
    aspect-ratio: 16 / 11;
  }
  .pullquote { padding: 28px 24px; }
  .learnings { gap: 12px; }
  .more-cases { gap: 12px; }
}

/* ---------- 33. The InsurTech bento services ---------- */
@media (max-width: 560px) {
  .svc { padding: 24px 22px; }
  .why-grid .why { padding: 24px 22px; }
  .audience { padding: 24px 22px; }
  .phase { padding: 24px 22px; }
  .crail__cell { padding: 20px; }
}

/* ---------- 34. For-investors Corridor compare / quote pair ---------- */
@media (max-width: 760px) {
  .compare-col,
  .compare-col--with { padding: 22px 20px; }
  .platform-card { padding: 28px 22px; }
  .cquote { padding: 0; }
  .cquote__photo { aspect-ratio: 16 / 10; }
  .phase-grid > .phase { padding: 24px 22px; }
}

/* ---------- 35. Beta tag / chip alignment ---------- */
@media (max-width: 480px) {
  .offer__title .beta { font-size: 0.5625rem; padding: 2px 5px; }
  .phero__betatag { font-size: 0.625rem; padding: 5px 10px; }
}

/* ---------- 36. Body base ---------- */
@media (max-width: 480px) {
  body { font-size: 0.9375rem; line-height: 1.55; }
}

/* ---------- 37. Side-by-side image slots → stack ---------- */
@media (max-width: 760px) {
  .img-slot__caption { padding: 16px 18px; gap: 8px; max-width: 92%; }
  .img-slot__title { font-size: 0.9375rem; }
  .img-slot__desc { font-size: 0.8125rem; }
}

/* ---------- 38. Reveal lift smaller on mobile (less janky on touch) ---------- */
@media (max-width: 480px) {
  .reveal { transform: translateY(8px); }
  .reveal--up { transform: translateY(14px); }
}

/* ---------- 39. Numbers grid (the-insurtech) ---------- */
@media (max-width: 560px) {
  .numbers-grid > * { padding: 24px 22px; }
}
