/* Mobile layout and type fixes (≤640px). Loaded on every page via _includes/head.njk. */
    /* Mobile hero (≤640px): full-width portrait fading into navy, name overlaid, CTA in first screen */
    @media (max-width: 640px) {
      .hero { padding-top: 0 !important; min-height: auto !important; }
      .hero-content { display: flex !important; flex-direction: column; align-items: stretch !important; justify-content: flex-start !important; width: 100%; max-width: 100%; padding: 0 0 56px !important; gap: 0 !important; }
      .hero-profile-img, .hero-profile-fallback {
        order: -1; width: 100% !important; height: 58vh !important; max-height: 500px; min-height: 360px;
        margin: 0 !important; border-radius: 0 !important; box-shadow: none !important;
        object-fit: cover; object-position: center 20%;
        -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
                mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
      }
      .hero-text { position: relative; z-index: 2; width: 100%; min-width: 0; margin-top: -110px; padding: 0 24px; box-sizing: border-box; }
      .eyebrow { font-size: 0.7rem !important; line-height: 1.5; margin-bottom: 14px !important; }
      .hero-name { font-size: 2.6rem !important; line-height: 1.05; }
      .hero-name span em { font-size: 1.5rem; line-height: 1.2; }
      .hero-credential { font-size: 0.72rem !important; line-height: 1.7; }
      .hero-tagline { font-size: 1.1rem !important; line-height: 1.55; margin-top: 16px !important; }
      .hero-leadership { margin-top: 18px; }
      .leader-item { font-size: 0.78rem; line-height: 1.5; }
      .hero-btns { display: grid !important; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-top: 24px; }
      .hero-btns a { justify-content: center; text-align: center; min-width: 0; white-space: normal; }
      .hero-stats-mobile { margin-top: 24px; }
      .hero-cta-note { font-size: 0.8rem; line-height: 1.6; }
      .scroll-cue { display: none !important; }
    }
    /* Mobile polish (≤640px) */
    @media (max-width: 640px) {
      /* Header: solid navy with gold hairline instead of translucent grey */
      nav.scrolled, html body nav.scrolled { background: rgba(16, 29, 46, 0.97) !important; box-shadow: 0 1px 0 rgba(201, 168, 76, 0.25) !important; }
      /* Chat bubble sits above the Call / WhatsApp / Book bar */
      .ask-fab { bottom: 88px !important; right: 16px !important; width: 52px; height: 52px; }
      .ask-fab svg { width: 28px; height: 28px; }
      /* Hand icons: the button and link text stay; the decorative hand is hidden on phones */
      span:has(> svg .ch-hand), svg:has(.ch-hand) { display: none !important; }
      /* Expertise: swipeable row of cards instead of six stacked screens */
      .exp-grid { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; gap: 14px; padding: 4px 0 18px; margin: 0; max-width: 100%; box-sizing: border-box; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
      .exp-grid::-webkit-scrollbar { display: none; }
      .exp-grid-item { display: block !important; flex: 0 0 84%; min-width: 0; scroll-snap-align: start; }
      .exp-grid-item .exp-card { height: 100%; box-sizing: border-box; }
      html, body { overflow-x: hidden; }
      /* Comparison table: stacked cards instead of a clipped table */
      .gynae-table-wrap { overflow: visible; }
      .gynae-table, .gynae-table thead, .gynae-table tbody, .gynae-table tr, .gynae-table td { display: block; width: 100%; }
      .gynae-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
      .gynae-table tr { margin-bottom: 14px; border: 1px solid rgba(42, 74, 110, 0.14); background: #fff; padding: 6px 0; }
      .gynae-table td { border: none !important; padding: 9px 16px !important; font-size: 0.92rem; }
      .gynae-table td:first-child { font-size: 1.1rem; padding-top: 12px !important; }
      .gynae-table td::before { content: attr(data-label); display: block; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mid-grey); margin-bottom: 2px; }
      .gynae-table td:first-child::before { display: none; }
    }
  
/* ---------- Shared mobile rules (≤640px): all languages ---------- */
@media (max-width: 640px) {
  /* Body copy: 16px minimum for paragraphs and list text (Bengali/Hindi need it most) */
  body p, body li, body dd, body blockquote { font-size: max(1rem, 16px) !important; line-height: 1.65 !important; }
  /* Stacked-card tables: any table marked gynae-table or m-stack */
  .m-stack, .m-stack thead, .m-stack tbody, .m-stack tr, .m-stack td { display: block; width: 100%; }
  .m-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .m-stack tr { margin-bottom: 14px; border: 1px solid rgba(42, 74, 110, 0.14); background: #fff; padding: 6px 0; }
  .m-stack td { border: none !important; padding: 9px 16px !important; font-size: 1rem !important; }
  .m-stack td:first-child { font-size: 1.1rem !important; padding-top: 12px !important; }
  .m-stack td::before { content: attr(data-label); display: block; font-size: 0.875rem; line-height: 1.4; color: #5a6b7d; margin-bottom: 2px; }
  /* Latin labels are uppercase and may go to 12px; Bengali and Hindi keep 14px (no case, longer words) */
  :lang(en) .m-stack td::before { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
  .m-stack td:first-child::before { display: none; }
}

/* ---------- Pass 2 (≤640px): header on scroll, bottom bar, hero fit, contrast ---------- */
@media (max-width: 640px) {
  /* Scrolled header is navy on phones, so all header text and icons must be light */
  nav.scrolled .nav-brand-name { color: #ffffff !important; }
  nav.scrolled .nav-brand-title { color: rgba(255, 255, 255, 0.7) !important; }
  nav.scrolled .hamburger span { background: #ffffff !important; }
  nav.scrolled .share-btn, nav.scrolled [class*="share"] { color: #ffffff !important; border-color: rgba(255, 255, 255, 0.3) !important; }
  /* Bottom bar: solid, never see-through over content */
  .sticky-bar { background: #15263d !important; opacity: 1 !important; }
  .sticky-bar a.sb-book { background: #8a6420 !important; }
  /* Hero: photo a little shorter so name and specialty line sit above the bottom bar */
  .hero-profile-img, .hero-profile-fallback { height: 46vh !important; min-height: 300px !important; }
  .hero-text { margin-top: -96px !important; }
  /* Hero note text: readable on navy */
  .hero-cta-note, .hero-cta-note p { color: rgba(255, 255, 255, 0.82) !important; }
}

/* ---------- Pass 3 (≤640px): hero order. Name, credential and main button first; stats, tagline and roles below ---------- */
@media (max-width: 640px) {
  .hero-text { display: flex; flex-direction: column; }
  .hero-text > .eyebrow { order: 1; }
  .hero-text > .hero-name { order: 2; }
  .hero-text > .hero-credential { order: 3; }
  .hero-text > .hero-btns { order: 4; }
  .hero-text > .hero-stats-mobile { order: 5; }
  .hero-text > .hero-tagline { order: 6; }
  .hero-text > .hero-leadership { order: 7; }
  .hero-text > .hero-cta-note { order: 8; }
}

/* ---------- Contrast fixes (WCAG AA, all screen sizes; found in staging Lighthouse) ---------- */
footer.site-footer .ft-bottom, footer.site-footer .ft-bottom a { color: rgba(255, 255, 255, 0.82) !important; }
.reviews-more-btn { color: #1f5fa6 !important; border-color: #1f5fa6 !important; }
.reviews-more-btn:hover { color: #fff !important; background: #1f5fa6 !important; }
.practice-note a, .practice-note a:visited { color: #1f5fa6 !important; }
footer.site-footer .ft-title { color: #d9b76a !important; }

/* ---------- Pass 4 (≤640px): phone overflow fixes ---------- */
@media (max-width: 640px) {
  /* Desktop stat strip is replaced by the 3-up mobile bar on phones */
  .hero-stats { display: none !important; }
  .hero-stats-mobile { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* Service cards: let grid cells shrink so long words wrap instead of being clipped */
  .exp-grid-item, .exp-grid-item > .exp-card { min-width: 0; max-width: 100%; }
  .exp-card { grid-template-columns: 30px minmax(0, 1fr) !important; column-gap: 14px !important; padding: 24px 20px 26px !important; }
  .exp-card h3, .exp-card p { min-width: 0; overflow-wrap: anywhere; }
  .exp-card h3 { font-size: 1.3rem; }
}

/* ---------- Pass 5 (≤640px): stat labels, About stats, smooth expertise swipe ---------- */
@media (max-width: 640px) {
  /* Hero stat bar: no mid-word breaks; tighter cells so each label fits its column */
  .hero-stats-mobile { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hsm-item { min-width: 0; padding: 14px 4px; }
  .hsm-l { overflow-wrap: normal; word-break: normal; letter-spacing: 0.02em; font-size: 0.6rem; }
  /* About stats row: three equal cells, labels wrap at word boundaries */
  .exp-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; min-width: 0; max-width: 100%; }
  .exp-stat { min-width: 0; }
  .exp-stat-l { overflow-wrap: normal; word-break: normal; font-size: 0.66rem; line-height: 1.35; }
  /* Expertise swipe: free scrolling with no snap, and no transforms, transitions or blur inside the scroller */
  .exp-grid { scroll-snap-type: none !important; overscroll-behavior-x: contain; touch-action: pan-x pan-y; -webkit-overflow-scrolling: auto; scroll-behavior: auto; }
  .exp-grid .reveal, .exp-grid .exp-card { transition: none !important; opacity: 1 !important; transform: none !important; }
  .exp-grid .exp-card, .exp-grid .exp-card *, .exp-grid .exp-card::before, .exp-grid .exp-card::after { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; filter: none !important; }
  .exp-grid .exp-card:hover { transform: none !important; }
  .exp-grid-item { scroll-snap-align: none; }
  .exp-grid-item .exp-card { will-change: auto; }
}

/* ---------- Pass 6: colour contrast (WCAG AA) on all sizes ---------- */
footer.site-footer .ft-bottom, footer.site-footer .ft-bottom div, footer.site-footer .ft-bottom a { color: #d6dde6 !important; opacity: 1 !important; }
footer.site-footer .ft-links a, footer.site-footer .ft-contact a { color: #d6dde6 !important; }
footer.site-footer .ft-reg { color: #d6dde6 !important; }
.reviews-cta a, .pt-reviews-cta a { color: #1f4a78 !important; }

/* ---------- Pass 7: footer legal line carries its own dark background so contrast never depends on what sits behind it ---------- */
footer.site-footer { background-color: #101d2e !important; }
footer.site-footer .ft-bottom { background: #101d2e !important; position: relative; z-index: 1; }
footer.site-footer .ft-bottom div, footer.site-footer .ft-bottom a { background: transparent; }

/* ---------- Pass 8: footer link columns carry their own dark background and brighter text (Bengali page flagged) ---------- */
footer.site-footer .ft-col, footer.site-footer .ft-links li, footer.site-footer .ft-contact li { background: #101d2e !important; }
footer.site-footer .ft-links a, footer.site-footer .ft-contact a { color: #e6ebf1 !important; }

/* Bottom bar with five items (Home, Cancers, Call, WhatsApp, Book): tighter labels on narrow phones */
@media (max-width: 400px) {
  .sticky-bar a { padding: 6px 2px; }
  .sticky-bar a span { font-size: 0.68rem; line-height: 1.2; text-align: center; }
  .sticky-bar svg { width: 18px; height: 18px; }
}
