/* PragmaClin site: tablet and phone layout.
   The page markup uses inline desktop styles, so these rules override them with !important. */

img { max-width: 100%; }

/* Even line breaks everywhere: headings split into balanced lines, body text avoids one-word last lines */
h1, h2, h3, h4 { text-wrap: balance !important; }
p, li, .pc-frame-cap { text-wrap: pretty; }
.pc-menu-btn { display: none; }

/* ---------- Tablet and below ---------- */
@media (max-width: 1100px) {
  [data-screen-label] { min-width: 0 !important; overflow-x: hidden; }

  /* nav: collapse links behind a menu button */
  nav[style] { padding: 0 24px !important; height: 68px !important; }
  .pc-menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--pc-gray-200);
    background: #fff; cursor: pointer; padding: 0;
  }
  .pc-menu-btn span, .pc-menu-btn span::before, .pc-menu-btn span::after {
    display: block; width: 20px; height: 2px; background: var(--pc-gray-900); position: relative; content: "";
  }
  .pc-menu-btn span::before { position: absolute; top: -6px; }
  .pc-menu-btn span::after { position: absolute; top: 6px; }
  nav[style] > div {
    display: none !important;
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column !important; align-items: stretch !important; gap: 0 !important;
    background: #fff; border-bottom: 1px solid var(--pc-gray-200);
    padding: 8px 24px 20px; box-shadow: 0 12px 24px rgba(0,0,0,.08);
  }
  nav[style].is-open > div { display: flex !important; }
  nav[style] > div > a { padding: 14px 0 !important; border-bottom: 1px solid var(--pc-gray-100) !important; font-size: 16px !important; }
  nav[style] > div > a:last-child { margin-top: 12px; padding: 14px 24px !important; text-align: center; border-bottom: 0 !important; }

  /* split layouts with a fixed-width side stack */
  [style*="grid-template-columns: 1fr 620px"],
  [style*="grid-template-columns: 1fr 560px"],
  [style*="grid-template-columns: 560px 1fr"],
  [style*="grid-template-columns: 1fr 520px"],
  [style*="grid-template-columns: 1fr 480px"],
  [style*="grid-template-columns: 480px 1fr"],
  [style*="grid-template-columns: 1.4fr 1fr"] { grid-template-columns: 1fr !important; gap: 40px !important; }

  [style*="grid-template-columns: repeat(4, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }
  [style*="grid-template-columns: repeat(6, 1fr)"] { grid-template-columns: repeat(3, 1fr) !important; }
  [style*="grid-template-columns: 1.4fr 1fr 1fr"] { grid-template-columns: 1fr 1fr !important; }

  /* fixed-size picture boxes become fluid */
  [role="img"][style*="width:"], .pc-steps-view, .pc-phones {
    width: 100% !important; max-width: 640px; height: auto !important; aspect-ratio: 13 / 12; margin: 0 auto;
  }
  .pc-steps-view { aspect-ratio: 520 / 560; }

  /* section padding */
  [style*="padding: 96px 64px"] { padding: 72px 32px !important; }
  [style*="padding: 88px 64px"] { padding: 64px 32px !important; }
  [style*="padding: 80px 64px"] { padding: 64px 32px !important; }
  [style*="padding: 72px 64px"] { padding-left: 32px !important; padding-right: 32px !important; }
  [style*="padding: 0px 64px"] { padding-left: 32px !important; padding-right: 32px !important; }
  [style*="padding: 96px 64px 56px"] { padding: 72px 32px 40px !important; }
  [style*="padding: 0px 64px 96px"] { padding: 0 32px 72px !important; }
  [style*="padding: 64px; display: grid"] { padding: 40px !important; }

  [style*="justify-content: space-between"] { flex-wrap: wrap; }

  /* end-to-end workflow */
  .pc-flow-line { display: none !important; }

  /* About footer uses its own padding */
  [style*="padding: 56px 64px 32px"] { padding: 48px 32px 28px !important; }
}

/* Small tablets: three-across text cards get too narrow, so stack them */
@media (max-width: 900px) {
  [style*="grid-template-columns: repeat(3, 1fr)"]:has(h3) { grid-template-columns: 1fr !important; }
}

/* ---------- Phones ---------- */
@media (max-width: 720px) {
  nav[style] { padding: 0 16px !important; }
  nav[style] > div { padding: 8px 16px 20px; }
  nav[style] img { height: 30px !important; }

  [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  /* keep logo walls and stat bands two-up */
  [style*="grid-template-columns: repeat(4, 1fr)"],
  [style*="grid-template-columns: repeat(6, 1fr)"] { grid-template-columns: repeat(2, 1fr) !important; }

  /* text cards with headings go one per row */
  [style*="grid-template-columns: repeat(4, 1fr)"]:has(h3) { grid-template-columns: 1fr !important; }
  /* team: two per row with shorter photo panels */
  [style*="grid-template-columns"]:has(img[src*="assets/team/"]) { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  [style*="height: 280px"]:has(img[src*="assets/team/"]) { height: 170px !important; }
  [style*="grid-template-columns"]:has(img[src*="assets/team/"]) h3 { font-size: 16px !important; }
  [style*="grid-template-columns"]:has(img[src*="assets/team/"]) [style*="padding: 24px 28px 28px"] { padding: 14px 14px 16px !important; }
  [style*="grid-template-columns"]:has(img[src*="assets/team/"]) p { font-size: 13px !important; }


  [style*="padding: 96px 64px"], [style*="padding: 88px 64px"], [style*="padding: 80px 64px"],
  [style*="padding: 96px 64px 56px"] { padding: 56px 16px !important; }
  [style*="padding: 72px 64px"], [style*="padding: 0px 64px"] { padding-left: 16px !important; padding-right: 16px !important; }
  [style*="padding: 0px 64px 96px"] { padding: 0 16px 56px !important; }
  [style*="padding: 64px; display: grid"] { padding: 28px !important; }
  [style*="padding: 48px 64px"] { padding: 32px 16px !important; }
  [style*="padding: 48px;"], [style*="padding: 44px;"] { padding: 24px !important; }
  [style*="padding: 36px;"], [style*="padding: 32px;"] { padding: 24px !important; }

  /* type scale */
  h1 { font-size: 36px !important; line-height: 1.12 !important; }
  h2 { font-size: 28px !important; line-height: 1.2 !important; }
  h3 { font-size: 19px !important; }
  [style*="500 44px"], [style*="500 40px"] { font-size: 32px !important; }
  [style*="400 19px"], [style*="400 18px"] { font-size: 17px !important; }
  [style*="90px"][style*="DM Sans"] { font-size: 64px !important; }

  /* rows of buttons and chips wrap; big gaps shrink */
  [style*="display: flex"][style*="gap: 16px"] { flex-wrap: wrap; }
  [style*="display: flex"][style*="gap: 80px"],
  [style*="display: flex"][style*="gap: 64px"],
  [style*="display: flex"][style*="gap: 48px"] { flex-wrap: wrap; gap: 28px !important; }
  [style*="justify-content: space-between"] { flex-direction: column; align-items: flex-start !important; }
  nav[style] { flex-direction: row !important; align-items: center !important; }

  /* numbered steps and logo cells */
  .pc-step { padding: 18px 12px !important; gap: 16px !important; }
  [style*="height: 112px"] { height: 88px !important; padding: 14px !important; }
  .pc-frame-cap { font-size: 13px; padding: 12px 14px; }

  /* end-to-end workflow: one step per row */
  .pc-flow { grid-template-columns: 1fr !important; }
  .pc-flow-card { padding: 22px 20px !important; }
  .pc-flow-card > div:first-child { flex-direction: row !important; align-items: center !important; }

  [style*="padding: 56px 64px 32px"] { padding: 40px 16px 24px !important; }

  /* careers card */
  .pc-careers { padding: 28px 22px !important; }
  .pc-careers p { font-size: 20px !important; }
  .pc-careers > div { min-width: 0 !important; width: 100%; }

  /* forms: give the embedded Tally form room so Submit is never hidden */
  .pc-attio-form iframe { height: 1080px !important; }
}
