/* Site-wide responsive safety + mobile polish
   Loaded on every page after hero/footer CSS. */

html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
img,
svg,
video,
canvas {
  max-width: 100%;
}
iframe {
  max-width: 100%;
}

/* Sectors mark: logo-white.png is cropped to the 4-quadrant icon only.
   Global img max-width:100% would collapse the sprite crop. */
#sectors .aspect-\[79\/67\] > img {
  max-width: none !important;
  width: 442.97% !important;
  height: 100% !important;
  left: -1.17% !important;
}

/* Client logo marquee cells also need explicit widths to win over max-width:100% */
#sectors .animate-marquee img {
  max-width: none !important;
  height: auto !important;
}

/* Prevent long unbroken strings from blowing out columns.
   Use break-word (not anywhere) so display numerals like "01" stay on one line. */
main,
.uxp-footer,
.uxp-closing,
.uxp-hero,
.hp-page,
.sa-page,
.md-page,
.rsd-page,
.jop-page,
.ct-page {
  overflow-wrap: break-word;
  word-break: normal;
}

/* Container comfort on phones */
@media (max-width: 640px) {
  .container-site {
    padding-inline: 1.25rem !important;
  }

  /* Shared hero */
  .uxp-hero {
    padding: 112px 20px 40px;
  }
  .uxp-hero h1 {
    font-size: clamp(1.75rem, 8vw, 2.35rem);
    max-width: 100%;
  }
  .uxp-hero-inner {
    max-width: 100%;
    gap: 14px;
  }
  .uxp-hero-tagline,
  .uxp-hero-lead {
    font-size: 16px;
    line-height: 1.55;
    max-width: 100%;
  }
  .uxp-hero-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .uxp-hero-actions > * {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .uxp-hero-crumb {
    font-size: 12px;
    gap: 4px 6px;
  }

  /* Closing CTA */
  .uxp-closing-inner {
    padding: 0 20px;
  }
  .uxp-closing h2 {
    font-size: clamp(1.5rem, 6.5vw, 1.9rem);
  }
  .uxp-closing-lead {
    font-size: 15px;
    line-height: 1.65;
  }

  /* Footer */
  .uxp-footer-logo img {
    width: min(220px, 100%);
    height: auto;
  }
  .uxp-footer-navs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px 20px;
  }
  .uxp-footer-nav {
    min-width: 0;
    flex: none;
  }
  .uxp-footer-nav a,
  .uxp-footer-nav span {
    font-size: 14px;
    line-height: 1.45;
  }
  .uxp-footer-brand {
    gap: 28px;
  }
  .uxp-footer-legal {
    width: 100%;
  }
  .uxp-footer-legal li {
    margin-left: 0 !important;
  }
  .uxp-footer-legal-sep {
    display: none;
  }
  .uxp-footer-legal a {
    font-size: 13px;
  }
}

/* Extra-narrow phones */
@media (max-width: 380px) {
  .uxp-footer-navs {
    grid-template-columns: 1fr;
  }
  .hp-filters {
    grid-template-columns: 1fr !important;
  }
  .hp-filter:first-child {
    grid-column: auto !important;
  }
  .jop-country-row {
    grid-template-columns: 1fr !important;
  }
}

/* Tablet: keep hub filters usable */
@media (max-width: 900px) {
  .hp-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .hp-search {
    max-width: none;
    width: 100%;
  }
  .hp-band-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Detail pages: never keep fixed rails past tablet */
@media (max-width: 980px) {
  .sa-split--lead .sa-purpose,
  .sa-stage-title,
  .md-deliver-intro {
    flex: 1 1 auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  .sa-section,
  .md-section {
    padding-inline: 20px !important;
  }
  .sa-h-lead {
    font-size: clamp(1.5rem, 6vw, 2rem) !important;
  }
}

/* RS tabs: 5-up is unusable on phones — already 2-col at 900; tighten further */
@media (max-width: 540px) {
  .rs-tabs {
    grid-template-columns: 1fr !important;
  }
  .rs-tabs button:last-child {
    grid-column: auto !important;
  }
  .rs-directory-group ul {
    grid-template-columns: 1fr !important;
  }
  .rs-enquiry-actions {
    width: 100%;
  }
  .rs-enquiry-actions > a:first-child {
    width: 100%;
    box-sizing: border-box;
  }
}

/* Contact / Join */
@media (max-width: 640px) {
  .jop-shell,
  .ct-shell {
    padding-inline: 20px;
  }
  .jop-faq-q {
    font-size: 17px;
  }
  .jop-avail {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .ct-invite-row {
    flex-direction: column;
    align-items: stretch;
  }
  .ct-btn {
    width: 100%;
  }
}

/* Hub matrix tables: keep scroll inside section, never page-wide */
@media (max-width: 900px) {
  .hp-table-scroll {
    margin-inline: -4px;
    padding-inline: 4px;
    -webkit-overflow-scrolling: touch;
  }
}

/* Detail next/prev rows + related cards */
@media (max-width: 640px) {
  .md-next,
  .rsd-next,
  .sa-next {
    width: 100%;
  }
  .md-related,
  .rsd-related-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Touch targets */
@media (max-width: 767px) {
  .uxp-closing-btn,
  .jop-btn,
  .ct-btn,
  .hp-button,
  .uxp-hero-actions a {
    min-height: 44px;
  }

  /* Legacy Tailwind margin on inline CTAs — breaks narrow columns */
  a.ml-\[39px\],
  .cta-inline-btn {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
    justify-content: center;
  }
}
