/*
  FINAL RESPONSIVE LAYOUT PATCH
  Desktop (1024px and above): intentionally untouched.
  Tablet/mobile: genuine reflow; no scale(), zoom, or horizontal page scrolling.
*/
html, body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img, picture, video, canvas, svg, iframe {
  max-width: 100%;
}

@media (min-width: 768px) and (max-width: 1023px) {
  body { font-size: 15px; }

  header > div {
    height: auto !important;
    min-height: 72px;
    padding-top: .6rem !important;
    padding-bottom: .6rem !important;
  }

  header img[alt="East Coast Hospitals Logo"] {
    width: 13rem !important;
    height: 4.5rem !important;
  }

  header img[alt="NABH Entry Level Pre-Accredited"] {
    width: 3.25rem !important;
    height: 3.25rem !important;
    margin-left: .5rem !important;
    transform: none !important;
  }

  header nav {
    display: none !important;
  }

  .hero-image {
    min-height: 560px !important;
    background-size: contain !important;
    background-repeat: no-repeat !important;
    background-position: center bottom !important;
  }

  .hero-image > .relative.z-10 {
    min-height: 560px !important;
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .hero-content-shift {
    max-width: 42rem !important;
    transform: none !important;
  }

  .hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem) !important;
  }

  section:not(.hero-image) {
    padding-top: 4rem !important;
    padding-bottom: 4rem !important;
  }
}

@media (max-width: 767px) {
  html, body {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body {
    font-size: 15px !important;
    line-height: 1.55;
  }

  /* Header: compact, fully usable, without changing any existing links. */
  header {
    position: sticky;
    top: 0;
    width: 100%;
    max-width: 100%;
  }

  header > div {
    height: auto !important;
    min-height: 64px;
    width: 100% !important;
    max-width: 100% !important;
    padding: .5rem .75rem !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: .45rem !important;
    align-items: center !important;
  }

  header > div > div:first-child {
    min-width: 0 !important;
    max-width: 100% !important;
    flex: 1 1 auto !important;
  }

  header a {
    min-width: 0;
  }

  header img[alt="East Coast Hospitals Logo"] {
    width: 11rem !important;
    height: 3.6rem !important;
    max-width: 62vw !important;
    object-fit: contain !important;
  }

  header img[alt="NABH Entry Level Pre-Accredited"] {
    width: 2.9rem !important;
    height: 2.9rem !important;
    margin-left: .15rem !important;
    transform: none !important;
  }

  /* The original desktop nav remains the same; on mobile its existing links reflow
     into a compact navigation block instead of disappearing. */
  header nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100% !important;
    max-width: 100% !important;
    order: 3;
    transform: none !important;
    gap: .15rem .35rem !important;
    padding: .35rem 0 .15rem !important;
    font-size: .72rem !important;
    line-height: 1.2 !important;
    white-space: normal !important;
  }

  header nav a {
    min-width: 0 !important;
    padding: .38rem .3rem !important;
    text-align: center;
    border-radius: .5rem;
    overflow-wrap: anywhere;
  }

  header > div > div:last-child {
    display: flex !important;
    width: 100% !important;
    order: 4;
    justify-content: center;
  }

  header > div > div:last-child a {
    width: 100% !important;
    justify-content: center;
    padding: .6rem .8rem !important;
    font-size: .78rem !important;
  }

  /* Global mobile containment. */
  main, section, article, aside, footer, nav, div {
    min-width: 0;
  }

  section {
    max-width: 100% !important;
    overflow: hidden;
  }

  section:not(.hero-image) {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  section:not(.hero-image) > .max-w-7xl,
  section:not(.hero-image) > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Genuine single-column reflow for every existing responsive grid. */
  .grid {
    min-width: 0 !important;
  }

  .grid.lg\:grid-cols-\[1\.05fr_\.95fr\],
  .grid.lg\:grid-cols-\[\.9fr_1\.1fr\],
  .grid.lg\:grid-cols-\[\.9fr_1\.1fr\],
  .grid.lg\:grid-cols-\[1fr_auto\] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  /* Compact common section spacing without deleting content. */
  .gap-12, .gap-10, .gap-8, .gap-6 {
    gap: 1.25rem !important;
  }

  .gap-5, .gap-4 {
    gap: .8rem !important;
  }

  .p-8 { padding: 1.15rem !important; }
  .p-10 { padding: 1.35rem !important; }
  .p-14 { padding: 1.5rem !important; }

  /* Typography stays prominent but no longer behaves like desktop. */
  .hero-title {
    font-size: clamp(1.85rem, 9.5vw, 2.8rem) !important;
    line-height: 1.05 !important;
    letter-spacing: -.025em !important;
  }

  h2.font-serif {
    font-size: clamp(1.65rem, 7.2vw, 2.25rem) !important;
    line-height: 1.12 !important;
  }

  h3 {
    line-height: 1.2;
  }

  p {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Hero: show the full background composition rather than zooming/cropping it. */
  .hero-image {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
    background-size: 100% auto !important;
    background-repeat: no-repeat !important;
    background-position: center bottom !important;
  }

  .hero-image > .relative.z-10 {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 2rem .85rem 1rem !important;
    display: flex !important;
    align-items: flex-start !important;
  }

  .hero-content-shift {
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
  }

  .hero-glass {
    width: 100% !important;
    max-width: 100% !important;
    padding: .75rem !important;
  }

  .hero-glass .eyebrow {
    max-width: 100%;
    padding: .34rem .55rem !important;
    font-size: .56rem !important;
    letter-spacing: .11em !important;
  }

  .hero-glass p {
    max-width: 100% !important;
    margin-top: .65rem !important;
    font-size: .88rem !important;
  }

  .hero-glass .flex.flex-wrap {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: .55rem !important;
    margin-top: .9rem !important;
  }

  .hero-glass .flex.flex-wrap a {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: center !important;
    text-align: center;
    padding: .72rem .8rem !important;
    font-size: .78rem !important;
  }

  /* Hero statistics: stop absolute positioning from covering the mobile hero. */
  .hero-image > div.absolute.bottom-0 {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: .5rem !important;
  }

  .hero-image > div.absolute.bottom-0 > div {
    width: 100% !important;
    max-width: 100% !important;
    padding: .65rem .75rem !important;
    gap: .55rem !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .hero-image > div.absolute.bottom-0 > div > div {
    min-width: 0 !important;
    gap: .45rem !important;
  }

  .hero-image > div.absolute.bottom-0 .w-10 {
    width: 2rem !important;
    min-width: 2rem !important;
    height: 2rem !important;
    min-height: 2rem !important;
  }

  /* Cards, media and controls never exceed the viewport. */
  .feature-card,
  .trust-panel,
  form,
  input,
  select,
  textarea,
  button,
  a {
    max-width: 100% !important;
  }

  .feature-card {
    padding: 1rem !important;
  }

  .icon-orb {
    width: 3rem !important;
    height: 3rem !important;
    min-width: 3rem !important;
  }

  img, picture, video, canvas, iframe, svg {
    max-width: 100% !important;
  }

  img {
    height: auto;
  }

  /* Prevent transforms/absolute desktop positioning from pushing content sideways. */
  [style*="translateX"],
  .hero-content-shift {
    transform: none !important;
  }

  /* Floating WhatsApp control remains accessible without consuming excessive space. */
  body > a.fixed.bottom-6.right-6 {
    width: 2.9rem !important;
    height: 2.9rem !important;
    right: .75rem !important;
    bottom: .75rem !important;
    font-size: 1.35rem !important;
  }

  /* Footer stays compact and single-column. */
  .footer-main-grid {
    min-height: 0 !important;
    gap: 1.5rem !important;
  }

  .footer-main-grid .footer-left img {
    width: 12rem !important;
    height: auto !important;
  }
}

@media (max-width: 480px) {
  header img[alt="East Coast Hospitals Logo"] {
    width: 9.5rem !important;
    height: 3.15rem !important;
    max-width: 58vw !important;
  }

  header img[alt="NABH Entry Level Pre-Accredited"] {
    width: 2.45rem !important;
    height: 2.45rem !important;
  }

  header nav {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    font-size: .67rem !important;
  }

  section:not(.hero-image) {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .hero-image > .relative.z-10 {
    padding: 1.25rem .7rem .75rem !important;
  }

  .hero-title {
    font-size: clamp(1.72rem, 9.4vw, 2.35rem) !important;
  }

  .hero-glass p {
    font-size: .82rem !important;
  }

  .hero-image > div.absolute.bottom-0 > div {
    padding: .55rem .6rem !important;
    gap: .45rem !important;
  }

  .hero-image > div.absolute.bottom-0 .text-xs {
    font-size: .58rem !important;
  }
}
