/* MidPoint — responsive layer for the fixed-1440 page templates.

   SELECTOR RULE: React normalises inline styles before they reach the DOM
   attribute — `padding:120px 48px` is written out as `padding: 120px 48px`, and
   `0` becomes `0px`. Any `[style*="…"]` selector here MUST use that normalised
   spaced form or it silently matches nothing. Grid stacking does not use
   substring matching at all: site.js tags every inline grid with
   data-cols="N" and the rules below target that.

   Breakpoints: 1180 tablet · 1024 touch-nav · 767 phone.
   The 1024 value is duplicated as MQ in site.js — keep them in sync. */

html,body{max-width:100%}
img,image-slot,video{max-width:100%}

/* ---------------- TABLET  (≤1180px) ---------------- */
@media (max-width:1180px){
  body{overflow-x:hidden}

  /* A hardcoded px width from a direct edit must never out-size the viewport. */
  section :not([data-fixed-width]),footer :not([data-fixed-width]){max-width:100%!important}

  /* Utility bar */
  div[style*="padding: 12px 48px"]{flex-wrap:wrap!important;gap:6px 20px!important;padding:10px 20px!important;font-size:13px!important}

  /* Header shell + nav */
  div[style*="padding: 0px 48px"]{padding:0 20px!important}
  div[style*="padding: 20px 32px"]{flex-wrap:wrap!important;gap:12px!important;padding:16px 20px!important;justify-content:center!important}
  nav{flex-wrap:wrap!important;justify-content:center!important;gap:2px!important}
  nav a{font-size:14px!important;padding:10px!important;min-height:44px!important;display:flex!important;align-items:center!important}

  /* Section gutters */
  section,footer{padding-left:32px!important;padding-right:32px!important}

  /* Grid stacking by authored column count (data-cols from site.js) */
  [data-cols="3"],[data-cols="4"],[data-cols="5"],[data-cols="6"]{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  [data-cols="2"]{grid-template-columns:minmax(0,1fr)!important;gap:48px!important}

  h1{font-size:44px!important}
  h2{font-size:36px!important}

  /* Team bio modal: once the two-column layout stacks, the portrait column has
     no height cap and renders at its full intrinsic ratio, pushing the name and
     bio out of the modal's scroll viewport. Cap it so the text is visible on
     open. Matches both the compiled page (data-if) and the source template. */
  [data-if="modalOpen"] img,[style*="max-width: 880px"] img{max-height:220px!important;object-fit:cover!important}
  [data-if="modalOpen"] [style*="min-height: 360px"],[style*="max-width: 880px"] [style*="min-height: 360px"]{min-height:0!important}
}

/* --------- TOUCH NAV  (≤1024px: phones + every iPad size) ---------
   Above 767px the desktop nav still fits, but its Loan Programs dropdown is
   hover-driven and hover does not exist on a tablet — so the panel from
   site.js takes over for the whole touch range. */
@media (max-width:1024px){
  nav:not(#mp-mnav-panel){display:none!important}
  #mp-mnav-panel a{min-height:52px}
  /* Reserve a gutter so the fixed 52px toggle cannot cover the utility bar. */
  div[style*="padding: 12px 48px"]{padding-right:74px!important}
}

/* ---------------- MOBILE  (≤767px) ---------------- */
@media (max-width:767px){
  div[style*="padding: 12px 48px"]{justify-content:center!important;text-align:center!important;font-size:12px!important}
  div[style*="padding: 12px 48px"] > div{flex-wrap:wrap!important;justify-content:center!important;gap:4px 16px!important}

  /* Every tap target clears 44px */
  /* a.mp-btn-card is here because the product cards' "Find Out More" controls
     were <button> elements until they had real destinations to link to. Without
     it they drop to 43px and fall under the minimum tap target this rule exists
     to guarantee. Scoped to that one class rather than all .mp-btn anchors —
     plenty of those existed already and are deliberately shorter. */
  button,a[href^="tel:"],a[href^="mailto:"],a.mp-btn-card{min-height:44px}
  /* Browsers give <button> a border-box default, so min-height there is the
     whole control. An <a> is content-box, where the same min-height would add
     to the 14px padding and make the card CTA 72px instead of 44px. */
  a.mp-btn-card{box-sizing:border-box}

  /* Button rows are authored flex-nowrap with justify-content:space-between,
     which squeezes controls until their labels wrap to 4-5 lines. Let the rows
     wrap and stop controls shrinking below their intrinsic width. */
  div[style*="display: flex"]{flex-wrap:wrap!important}
  button,a[style*="display: inline-flex"]{flex:0 0 auto!important}
  [style*="padding-left: 48px"]{padding-left:20px!important}

  section,footer{padding-left:20px!important;padding-right:20px!important}
  section[style*="padding: 120px"]{padding-top:64px!important;padding-bottom:64px!important}
  section[style*="padding: 96px"]{padding-top:56px!important;padding-bottom:56px!important}
  section[style*="padding: 88px"],section[style*="padding: 80px"]{padding-top:56px!important;padding-bottom:56px!important}
  section[style*="padding: 0px 96px 120px"],section[style*="padding: 0px 48px 120px"]{padding-top:0!important;padding-bottom:64px!important}

  /* Everything collapses to one column */
  [data-cols]{grid-template-columns:minmax(0,1fr)!important;gap:20px!important}

  /* Inner padding on cards / panels / CTA boxes */
  [style*="padding: 88px 72px"],[style*="padding: 80px 72px"],[style*="padding: 72px 64px"],
  [style*="padding: 72px 56px"],[style*="padding: 64px 72px"],[style*="padding: 64px 56px"],
  [style*="padding: 52px 44px"],[style*="padding: 48px 44px"],[style*="padding: 44px 40px"]{padding:36px 22px!important}
  [style*="padding: 36px 32px"],[style*="padding: 32px 28px"]{padding:26px 20px!important}

  /* Type scale */
  h1{font-size:32px!important;line-height:1.16!important}
  h2{font-size:26px!important;line-height:1.22!important}
  h3{font-size:19px!important}
  h1 br,h2 br{display:none}
  p{font-size:15px!important}

  /* Oversized display numbers */
  [style*="font-size: 64px"]{font-size:36px!important}
  [style*="font-size: 58px"],[style*="font-size: 60px"]{font-size:32px!important}
  [style*="font-size: 48px"],[style*="font-size: 46px"],[style*="font-size: 44px"]{font-size:28px!important}
  [style*="font-size: 34px"],[style*="font-size: 36px"]{font-size:24px!important}
  [style*="font-size: 32px"],[style*="font-size: 30px"]{font-size:22px!important}
  [style*="font-size: 26px"]{font-size:19px!important}

  /* Fixed image heights */
  [style*="height: 520px"],[style*="height: 480px"],[style*="height: 460px"],
  [style*="height: 440px"],[style*="height: 420px"]{height:240px!important}
  [style*="height: 360px"],[style*="height: 300px"]{height:200px!important}
  [style*="height: 280px"],[style*="height: 260px"],[style*="height: 240px"],
  [style*="height: 220px"],[style*="height: 200px"]{height:180px!important}
  [style*="min-height: 360px"]{min-height:200px!important}

  /* Corner ticks would sit off-canvas at this size */
  [style*="width: 6px"][style*="height: 6px"],
  [style*="width: 8px"][style*="height: 8px"]{display:none!important}

  [style*="gap: 48px"]{gap:24px!important;flex-wrap:wrap!important}
  [style*="max-width: 880px"]{max-height:88vh!important}
  [style*="min-height: 320px"]{min-height:0!important}
}
