/*
 * New Standard Hospital - responsive layout system
 * Scope: every public page. The rules are deliberately structural and
 * preserve each page's existing colours, typography and content.
 */

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

img,
video,
iframe {
  max-width: 100%;
}

/* Keep reading widths fluid without allowing legacy fixed-width blocks to
 * push past the viewport. */
.w1400,
.w1200,
.w1100,
.w1000 {
  box-sizing: border-box;
  width: 100%;
}

/* A page with an educational 3D banner already has a complete first content
 * section. Suppress a legacy menu banner if both are present. */
body:has(article > .nshHeroBanner) .subVisual {
  display: none;
}

article:has(> .nshHeroBanner) {
  display: grid;
  grid-template-columns: minmax(20px, 1fr) minmax(0, 610px) minmax(0, 750px) minmax(20px, 1fr);
  column-gap: clamp(28px, 4vw, 72px);
  align-items: center;
}

article:has(> .nshHeroBanner) > * {
  grid-column: 1 / -1;
  min-width: 0;
}

article:has(> .nshHeroBanner) > .nshHeroBanner {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
  width: 100%;
  max-width: 750px;
  margin: clamp(28px, 4vw, 56px) 0 !important;
  padding: 0 !important;
  border: 1px solid rgba(16, 40, 61, 0.08);
  border-radius: clamp(16px, 1.4vw, 24px) !important;
  background: #f2f7f6;
  box-shadow: 0 18px 48px rgba(16, 40, 61, 0.12) !important;
  overflow: hidden;
}

article:has(> .nshHeroBanner) > .nshHeroBanner img {
  display: block;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  margin: 0 !important;
  object-fit: contain !important;
  object-position: center !important;
  background: #f2f7f6;
}

article:has(> .nshHeroBanner) > section:first-of-type {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  width: 100%;
  max-width: 610px;
  margin: clamp(28px, 4vw, 56px) 0 !important;
  padding-right: 0;
}

article:has(> .nshHeroBanner) > section:first-of-type h1,
article:has(> .nshHeroBanner) > section:first-of-type h2:first-child {
  text-wrap: balance;
}

/* Several newer content pages already used a two-column copy + checklist
 * hero. Once the illustration occupies the article's second column, collapse
 * that nested grid so it cannot become an accidental cramped third column. */
@media screen and (min-width: 1181px) {
  article:has(> .nshHeroBanner) > section:first-of-type {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 22px !important;
  }

  article:has(> .nshHeroBanner) > section:first-of-type .nsh-hero-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 22px !important;
  }

  article:has(> .nshHeroBanner) > section:first-of-type h1 {
    font-size: clamp(34px, 3vw, 46px) !important;
  }
}

/* On mid-sized desktops, the circular floating menu obscures page content.
 * The persistent bottom action bar remains available on tablet/mobile. */
@media screen and (min-width: 1026px) and (max-width: 1440px) {
  .quick {
    display: none !important;
  }
}

@media screen and (min-width: 1441px) {
  .quick {
    right: 24px;
    bottom: 36px;
  }
}

/* Tablet: the image becomes the first visual anchor, followed by the title. */
@media screen and (min-width: 769px) and (max-width: 1180px) {
  article:has(> .nshHeroBanner) {
    grid-template-columns: minmax(24px, 1fr) minmax(0, 920px) minmax(24px, 1fr);
    row-gap: 0;
  }

  article:has(> .nshHeroBanner) > .nshHeroBanner {
    grid-column: 2;
    grid-row: 1;
    max-width: 920px;
    margin: 28px 0 14px !important;
  }

  article:has(> .nshHeroBanner) > section:first-of-type {
    grid-column: 2;
    grid-row: 2;
    max-width: 920px;
    margin: 14px 0 36px !important;
  }
}

/* Mobile: put the clinical title and summary before the image and always show
 * the entire illustration. */
@media screen and (max-width: 768px) {
  article:has(> .nshHeroBanner) {
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    column-gap: 0;
    row-gap: 0;
  }

  article:has(> .nshHeroBanner) > section:first-of-type {
    grid-column: 2;
    grid-row: 1;
    max-width: none;
    margin: 22px 0 14px !important;
    padding: 0 !important;
  }

  article:has(> .nshHeroBanner) > section:first-of-type h1 {
    font-size: clamp(28px, 7.2vw, 34px) !important;
  }

  /* The desktop summary panel repeats information available in the body and
   * pushes the lead illustration too far down on phones. Keep the clinical
   * title, summary and actions, then show the complete illustration. */
  article:has(> .nshHeroBanner) > section:first-of-type [class*="Hero__panel"],
  article:has(> .nshHeroBanner) > section:first-of-type [class*="hero__panel"] {
    display: none !important;
  }

  article:has(> .nshHeroBanner) > .nshHeroBanner {
    grid-column: 2;
    grid-row: 2;
    max-width: none;
    margin: 8px 0 26px !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 32px rgba(16, 40, 61, 0.11) !important;
  }

  article:has(> .nshHeroBanner) > .nshHeroBanner img {
    aspect-ratio: 16 / 9;
    object-fit: contain !important;
  }

  /* Legacy visual pages previously enlarged the image to 185%, which cropped
   * important anatomy on phones. Use a contained canvas instead. */
  .subVisual .subVisual__imgAr {
    height: clamp(270px, 72vw, 340px);
    background: #10283d;
    overflow: hidden;
  }

  .subVisual .subVisual__imgAr img,
  .subVisual--hero .subVisual__imgAr img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  .subVisual .textArea {
    top: 58%;
  }

  .subVisual .textArea .text1 {
    font-size: clamp(26px, 7.2vw, 34px);
    line-height: 1.22;
    text-wrap: balance;
  }

  .subVisual .textArea .text2 {
    max-width: 31rem;
    margin-right: auto;
    margin-left: auto;
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Shared subpage route back to the hospital home. The bridge sits outside the
 * page article so it cannot disturb the responsive hero grid. */
.nshSubpageHomeBridge {
  display: flex;
  justify-content: flex-end;
  width: min(1400px, calc(100% - 40px));
  margin: 20px auto 8px;
}

.nshSubpageHomeBridge--inline {
  justify-content: flex-start;
  width: 100%;
  margin: 18px 0 8px;
}

.nshSubpageHomeBridge--inline a {
  width: min(100%, 340px);
}

.nshSubpageHomeBridge--standalone {
  margin-top: 127px;
}

.nshSubpageHomeBridge a {
  display: inline-grid;
  grid-template-columns: 34px minmax(0, 1fr) 24px;
  gap: 12px;
  align-items: center;
  min-width: min(100%, 310px);
  min-height: 54px;
  padding: 9px 14px;
  border: 1px solid rgba(24, 74, 103, 0.18);
  border-radius: 15px;
  color: #173b55;
  background: #fff;
  box-shadow: 0 10px 28px rgba(16, 40, 61, 0.08);
  text-decoration: none;
}

.nshSubpageHomeBridge a:hover,
.nshSubpageHomeBridge a:focus-visible {
  border-color: #20a99a;
  box-shadow: 0 12px 32px rgba(32, 169, 154, 0.16);
  outline: 3px solid rgba(32, 169, 154, 0.18);
  outline-offset: 2px;
}

.nshSubpageHomeBridge__mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: #20a99a;
  font-size: 18px;
  font-weight: 900;
}

.nshSubpageHomeBridge strong,
.nshSubpageHomeBridge small {
  display: block;
  line-height: 1.35;
}

.nshSubpageHomeBridge strong {
  font-size: 15px;
}

.nshSubpageHomeBridge small {
  margin-top: 2px;
  color: #667984;
  font-size: 12px;
}

.nshSubpageHomeBridge__arrow {
  color: #168f83;
  font-size: 22px;
  font-weight: 800;
}

/* A visible action row accompanies each 3D medical rendering. */
.nshMedicalOriginalAction {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  line-height: 1.3;
  background: #f5faf9;
  border-top: 1px solid #dbeae7;
}

.nshMedicalOriginalAction__button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid #b7d9d4;
  border-radius: 999px;
  color: #153d5a;
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
}

.nshMedicalOriginalAction__button:hover,
.nshMedicalOriginalAction__button:focus-visible {
  color: #fff;
  background: #153d5a;
  border-color: #153d5a;
  outline: 3px solid rgba(32, 169, 154, 0.2);
  outline-offset: 2px;
}

body.nshMedicalLightboxOpen {
  overflow: hidden;
}

.nshMedicalLightbox[hidden] {
  display: none !important;
}

.nshMedicalLightbox {
  position: fixed;
  z-index: 2147483000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(7, 20, 30, 0.9);
  backdrop-filter: blur(8px);
}

.nshMedicalLightbox__panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(1500px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
}

.nshMedicalLightbox__header,
.nshMedicalLightbox__footer {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
}

.nshMedicalLightbox__header {
  border-bottom: 1px solid #dce8e7;
}

.nshMedicalLightbox__header strong {
  display: block;
  color: #153d5a;
  font-size: 17px;
}

.nshMedicalLightbox__caption {
  margin: 3px 0 0;
  color: #667984;
  font-size: 12px;
  line-height: 1.45;
}

.nshMedicalLightbox__close {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: #153d5a;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.nshMedicalLightbox__close:focus-visible,
.nshMedicalLightbox__original:focus-visible {
  outline: 3px solid #55d3c5;
  outline-offset: 3px;
}

.nshMedicalLightbox__canvas {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 14px;
  background: #0c1f2c;
}

.nshMedicalLightbox__image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(100vh - 190px);
  max-height: calc(100dvh - 190px);
  margin: auto;
  object-fit: contain;
}

.nshMedicalLightbox__footer {
  border-top: 1px solid #dce8e7;
  color: #667984;
  font-size: 13px;
}

.nshMedicalLightbox__original {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 10px 15px;
  border-radius: 999px;
  color: #fff;
  background: #168f83;
  font-weight: 700;
  text-decoration: none;
}

@media screen and (max-width: 768px) {
  .nshSubpageHomeBridge {
    width: calc(100% - 36px);
    margin: 14px auto 4px;
  }

  .nshSubpageHomeBridge--inline {
    width: 100%;
    margin: 14px 0 8px;
  }

  .nshSubpageHomeBridge--standalone {
    margin-top: 78px;
  }

  .nshSubpageHomeBridge a {
    width: 100%;
    min-width: 0;
  }

  .nshMedicalOriginalAction {
    justify-content: stretch;
    padding: 9px;
  }

  .nshMedicalOriginalAction__button {
    width: 100%;
    justify-content: center;
  }

  .nshMedicalLightbox {
    padding: 8px;
  }

  .nshMedicalLightbox__panel {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 15px;
  }

  .nshMedicalLightbox__header,
  .nshMedicalLightbox__footer {
    padding: 11px 12px;
  }

  .nshMedicalLightbox__header strong {
    font-size: 15px;
  }

  .nshMedicalLightbox__caption,
  .nshMedicalLightbox__footer span {
    display: none;
  }

  .nshMedicalLightbox__image {
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
  }

  .nshMedicalLightbox__original {
    width: 100%;
    justify-content: center;
  }
}
