/* The Shepherd Friends — 2F-B / Homepage and About Us mobile corrections.
   Loaded after Phase 2F-A; these rules never apply to Donate, News, Contact,
   Events, Programmes or the payment/status pages.

   Desktop section designs stay intact. The original About Us template/CSS
   were not included in the recent incremental archives, so the small About
   annotation script marks sections only when headings are actually found.
*/

@media (max-width: 850px) {
  /* Shared promise: content should never inherit half-width text after the
     image and text stack. Prevent CSS grid's implicit min-content overflow. */
  body[data-sf2fb-page="home"] .about-feature,
  body[data-sf2fb-page="home"] .story-grid,
  body[data-sf2fb-page="home"] .section-title-row {
    min-width: 0;
    grid-template-columns: minmax(0,1fr) !important;
    flex-direction: column !important;
    align-items: stretch;
  }
  body[data-sf2fb-page="home"] .about-feature > *,
  body[data-sf2fb-page="home"] .story-grid > *,
  body[data-sf2fb-page="home"] .section-title-row > * {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  body[data-sf2fb-page="home"] .intro-section .about-feature-copy,
  body[data-sf2fb-page="home"] .story-section .story-copy { max-width: 100%; }

  /* About Us: recover the Who We Are column which occupied only half the
     usable mobile width in the client's full-page capture. */
  body[data-sf2fb-page="about"] .sf2fb-who-layout {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    grid-template-columns: minmax(0,1fr) !important;
    gap: clamp(20px, 4vw, 32px) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  body[data-sf2fb-page="about"] .sf2fb-who-layout.container {
    width:min(calc(100% - 40px), 1260px)!important;
    max-width:calc(100% - 40px)!important;
    margin-inline:auto!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-who-layout > * {
    flex: 0 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  body[data-sf2fb-page="about"] .sf2fb-who :is(h1,h2,h3,p) {
    max-width: min(100%, 680px);
    overflow-wrap: normal;
  }
  body[data-sf2fb-page="about"] .sf2fb-who-photo {
    width: 100%;
    max-width: 100%;
    height: auto;
    object-fit: cover;
  }

  body[data-sf2fb-page="about"] .sf2fb-about-hero {
    display:flex!important;
    flex-direction:column!important;
    grid-template-columns:minmax(0,1fr)!important;
    min-width:0!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero > * {
    width:100%!important;
    min-width:0!important;
    max-width:100%!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media {
    position:relative;
    height:clamp(260px,53vw,370px)!important;
    overflow:hidden;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media img {
    position:absolute;
    inset:0;
    display:block;
    width:100%!important;
    height:100%!important;
    object-fit:cover;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is(.breadcrumbs,[aria-label="Breadcrumb"]) {
    margin-bottom: 12px !important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero h1 { text-wrap: balance; }
}

@media (max-width: 650px) {
  /* Hero slide information is a single grouped block, not spaced into
     disconnected eyebrow / title / paragraph / buttons. Keep existing dots
     and the four quick actions in their intended positions. */
  body[data-sf2fb-page="home"] .hero-slide-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
  }
  body[data-sf2fb-page="home"] .hero-slide-content .hero-eyebrow { margin-bottom: 10px !important; }
  body[data-sf2fb-page="home"] .hero-slide-content h1 {
    font-size: clamp(32px, 8.9vw, 46px) !important;
    line-height: 1.13 !important;
    letter-spacing: -.043em;
    max-width: 100%;
    text-wrap: balance;
    margin-bottom: 14px !important;
  }
  body[data-sf2fb-page="home"] .hero-slide-content p {
    font-size: clamp(13px, 3.7vw, 16px) !important;
    line-height: 1.53 !important;
    max-width: 100%;
    margin-bottom: 18px !important;
  }
  body[data-sf2fb-page="home"] .hero-actions { display:flex; flex-wrap:wrap; gap:10px; max-width:100%; }
  body[data-sf2fb-page="home"] .hero-actions .button {
    flex: 1 1 150px;
    min-width: 0;
    max-width: 100%;
    text-align:center;
    justify-content:center;
    white-space:normal;
  }
  body[data-sf2fb-page="home"] .action-strip {
    display: grid;
    grid-template-columns: repeat(2,minmax(0,1fr)) !important;
    gap: 9px !important;
  }
  body[data-sf2fb-page="home"] .action-strip > * { min-width:0; width:100%; }
  body[data-sf2fb-page="home"] .action-card {
    min-width:0 !important;
    padding: clamp(13px,3.5vw,18px) !important;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:8px;
  }
  body[data-sf2fb-page="home"] .action-card span,
  body[data-sf2fb-page="home"] .action-card strong,
  body[data-sf2fb-page="home"] .action-card small { min-width:0; overflow-wrap:break-word; }
  body[data-sf2fb-page="home"] .action-card svg { width:26px!important; height:26px!important; flex:0 0 auto; }
  body[data-sf2fb-page="home"] .action-card strong { font-size:clamp(12px,3.3vw,15px); line-height:1.3; }
  body[data-sf2fb-page="home"] .action-card small { font-size:clamp(10px,2.7vw,12px); line-height:1.4; }
  body[data-sf2fb-page="home"] .action-card .action-end { display:none; }
  body[data-sf2fb-page="home"] .programme-grid,
  body[data-sf2fb-page="home"] .stat-grid { grid-template-columns: minmax(0,1fr) !important; }
  body[data-sf2fb-page="home"] .section-title-row h2,
  body[data-sf2fb-page="home"] .intro-section h2,
  body[data-sf2fb-page="home"] .story-copy h2 {
    font-size:clamp(30px,8vw,43px);
    line-height:1.14;
    text-wrap:balance;
  }
  body[data-sf2fb-page="home"] .section-title-row h2 br { display:none; }
  body[data-sf2fb-page="home"] .intro-section .about-feature-copy p,
  body[data-sf2fb-page="home"] .story-section .story-copy p { max-width:100%; }

  /* About hero: photograph and copy should not each demand the height of a
     complete desktop hero. The source photo and text are preserved. */
  body[data-sf2fb-page="about"] .sf2fb-about-hero {
    display:flex!important;
    flex-direction:column!important;
    grid-template-columns:minmax(0,1fr)!important;
    min-height:0!important;
    height:auto!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero > * {
    min-width:0!important;
    width:100%!important;
    max-width:100%!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media {
    position:relative;
    height:clamp(225px,66vw,345px)!important;
    max-height:345px!important;
    overflow:hidden;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media img {
    display:block;
    position:absolute;
    inset:0;
    width:100%!important;
    height:100%!important;
    object-fit:cover;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is([class*="hero-copy"],[class*="hero-content"]) {
    min-width:0;
    max-width:100%;
    padding:clamp(26px,7vw,42px) max(20px,5vw)!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero h1 {
    font-size:clamp(33px,8.7vw,46px)!important;
    line-height:1.12!important;
    margin-bottom:14px!important;
  }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is(.eyebrow,[class*="eyebrow"]) { margin-bottom:9px!important; }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is(.breadcrumbs,[aria-label="Breadcrumb"]) { margin-bottom:12px!important; }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is(.hero-actions,.about-hero-actions) { gap:10px; margin-top:18px; }
  body[data-sf2fb-page="about"] .sf2fb-about-hero :is(.hero-actions,.about-hero-actions) .button { max-width:100%;white-space:normal; }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media { max-width:100%; min-width:0; }
  body[data-sf2fb-page="about"] .sf2fb-about-hero-media img { max-width:100%; object-fit:cover; }
  body[data-sf2fb-page="about"] .sf2fb-who { padding-block:clamp(40px,9.5vw,60px)!important; }
  body[data-sf2fb-page="about"] .sf2fb-who h2,
  body[data-sf2fb-page="about"] .sf2fb-who h3 {
    font-size:clamp(30px,8.1vw,43px)!important;
    line-height:1.14!important;
    max-width:100%!important;
    text-wrap:balance;
  }
  body[data-sf2fb-page="about"] .sf2fb-who p {
    font-size:clamp(14px,3.65vw,16px);
    line-height:1.65;
    width:100%;
    max-width:100%;
  }
  body[data-sf2fb-page="about"] .sf2fb-who-photo {
    display:block;
    width:100%!important;
    max-width:100%!important;
    max-height:350px;
    object-fit:cover;
  }
  /* Keep the now-approved compact founder layout rather than changing it. */
  body[data-sf2fb-page="about"] .s2f-founder-section { padding-block:24px!important; }
}

@media (max-width:380px) {
  body[data-sf2fb-page="home"] .hero-actions .button { flex-basis:100%; }
  body[data-sf2fb-page="home"] .action-card { padding:12px!important; }
  body[data-sf2fb-page="home"] .action-card svg { width:21px;height:21px; }
  body[data-sf2fb-page="home"] .action-card strong { font-size:12px; }
}

@media (prefers-reduced-motion:reduce) {
  body[data-sf2fb-page="home"] .action-card { transition:none; }
}
