/* ============================================================
   Chemvexa Mobile Optimization v1.2.6
   Page-by-page mobile fixes. All rules are scoped to mobile
   breakpoints — desktop rendering is never touched.
   Brand: royal blue #0B4DA2 · teal #0AA99B · navy #0A2F6B
   ============================================================ */

/* ================= HOMEPAGE (body.home) ================= */
@media (max-width: 768px) {

  /* Safety: never allow horizontal scrolling on mobile */
  body.home { overflow-x: hidden; }

  /* 0. TRUE ROOT CAUSE FIX (v1.0.3) — an Elementor HTML widget in the
        Safety section (4fa7a24) ships an unscoped <style> block with
        `body { display:flex; justify-content:center; padding:60px 0; }`.
        That turns the whole <body> into a flex container, so wide
        content gets centered off-canvas on mobile (hero/H2s cut off).
        Neutralize it on mobile only — desktop untouched per owner rule. */
  body.home {
    display: block !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }

  /* 0b. Belt & braces — Elementor columns/wraps are display:flex.
        Flex items default to min-width:auto, which stops them
        shrinking and prevents text from wrapping on narrow screens. */
  body.home .elementor-column,
  body.home .elementor-widget-wrap,
  body.home .elementor-widget,
  body.home .elementor-container {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  /* 1. HERO HEADING — v1.2.6: comprehensive mobile refinement per
        owner brief. Balanced prominent size (not oversized), strong
        weight, left-aligned with CTA buttons, natural 3-line wrap,
        no overflow. Desktop untouched. */
  body.home .elementor-element-6b843931 {
    margin-bottom: 20px !important;
  }
  body.home .elementor-element-6b843931 .elementor-heading-title {
    font-size: clamp(42px, 12.5vw, 58px) !important;
    line-height: 1.12 !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
    overflow-wrap: break-word;
    word-break: normal !important;
    hyphens: none !important;
    max-width: 100% !important;
  }

  /* 2. SECTION HEADINGS — long H2s ("How Chemicals Are Used
        Across Industries" etc.) were cut off. Fluid scale for
        every Elementor heading on the homepage. */
  body.home .elementor-widget-heading .elementor-heading-title {
    font-size: clamp(24px, 6.4vw, 34px) !important;
    line-height: 1.25 !important;
    overflow-wrap: break-word;
  }

  /* 3. DIRECTORY CARDS — 3 cards rendered 2-across and overflowed.
        Single column with comfortable card padding. */
  body.home .chem-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
    padding: 0 4px;
  }
  body.home .directory-card { padding: 24px !important; }

  /* 4. FOOTER — Explore / Resources / Policies columns were cut
        off the right edge. Stack vertically with clear rhythm. */
  .cv-footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  /* 5. ABOUT — the 2-cell <table> squeezed text + image side by
        side. Reflow to a stacked block layout: text first, image
        below with breathing room. */
  .elementor-element-a4abe50 table,
  .elementor-element-a4abe50 tbody,
  .elementor-element-a4abe50 tr,
  .elementor-element-a4abe50 td {
    display: block !important;
    width: 100% !important;
    table-layout: auto !important;
  }
  .elementor-element-a4abe50 td { padding: 0 !important; border: 0 !important; }
  .elementor-element-a4abe50 td + td { margin-top: 28px; }
  .elementor-element-a4abe50 td img {
    width: 100% !important;
    height: auto !important;
    border-radius: 16px;
  }
  /* Tighter section rhythm on mobile (was 88px) */
  .elementor-element-a4abe50 > div { padding: 56px 0 !important; }

  /* 6. HERO BUTTONS — v1.0.4 stacked them full-width (second
        button was clipped). v1.2.6: owner wants both buttons on ONE
        LINE side-by-side like the reference. Compact sizing so they
        fit 390px: smaller padding + font, tight gap, no wrap. */
  body.home .elementor-element-f6b9ea4 {
    margin-top: 4px !important;
  }
  body.home .elementor-element-f6b9ea4 > div {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
  }
  body.home .elementor-element-f6b9ea4 a {
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    padding: 11px 14px !important;
    font-size: 11.5px !important;
    line-height: 1.2 !important;
    flex: 0 1 auto !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: inline-flex !important;
  }
  /* Teal (first) button gets slightly more room for longer text */
  body.home .elementor-element-f6b9ea4 > div > a:first-child {
    flex: 1 1 58% !important;
    max-width: 62% !important;
  }
  body.home .elementor-element-f6b9ea4 > div > a:last-child {
    flex: 1 1 42% !important;
    max-width: 42% !important;
  }
  body.home .elementor-element-f6b9ea4 a,
  body.home .elementor-element-f6b9ea4 a *,
  body.home .elementor-element-f6b9ea4 .elementor-button,
  body.home .elementor-element-f6b9ea4 .elementor-button * {
    white-space: nowrap !important;
    overflow-wrap: normal !important;
    word-break: keep-all !important;
  }
  body.home .elementor-element-f6b9ea4 a {
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
    white-space: nowrap !important;
    padding: 12px 10px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    display: flex !important;
  }

  /* 7. SECTION SIDE SPACING — the Directory ("Understand Chemicals
        in Detail"), Science, and Safety sections render with content
        touching / clipped at the left viewport edge on real phones.
        Guarantee comfortable left/right gutters for every section's
        content wrapper on mobile (including inner sections). */
  body.home .elementor-top-section .elementor-widget-wrap {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  /* 8. DIRECTORY FILTER PILLS — owner asked to remove the
        "All topics / Industrial / Laboratory..." chips on mobile. */
  body.home .chem-filter-row {
    display: none !important;
  }

  /* 9. SCIENCE CHECKLIST SPACING — owner flagged the gap between the
        intro paragraph and the checklist as too large on mobile.
        v1.2.6's ul-only fix was insufficient; the gap comes from
        Elementor widget-level spacing too. Tighten aggressively. */
  body.home .elementor-element-1f345dc5 {
    margin-bottom: 8px !important;
  }
  body.home .elementor-element-1f345dc5 p {
    margin-bottom: 0 !important;
  }
  body.home .elementor-element-2fe3ad69 {
    margin-top: 0 !important;
    margin-bottom: 8px !important;
  }
  body.home .elementor-element-2fe3ad69 ul {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
  }

  /* 10. BUTTON → IMAGE GAP — the flask image lives in a RIGHT COLUMN
        (1fbe91f7) inside the SAME science section, not a separate
        section. On mobile the columns stack; the gap is column
        padding, not section padding. Tighten it. */
  body.home .elementor-element-26b34dc6 {
    padding-bottom: 16px !important;
  }
  body.home .elementor-element-1fbe91f7 > .elementor-element-populated {
    padding-top: 8px !important;
    margin-top: 0 !important;
  }
  body.home .elementor-element-182b1a22 {
    margin-bottom: 8px !important;
  }
  body.home .elementor-element-23666e09 {
    padding-top: 16px !important;
  }
}
