/* Staging overrides: restore page title spacing so hero/title is visible below transparent header */
:root {
  --sm-header-offset: 140px;
}

/*
 * Defensive: Some staging Helix "Custom CSS" snippets mistakenly use
 * `body.sticky-header #sp-header { background:#fff; position:fixed; }`.
 * Since `sticky-header` is a persistent body class (feature-flag), that
 * forces a white/fixed header even at the top of the page.
 *
 * Keep the default (transparent/absolute) header until the template applies
 * its scroll-state class (`#sp-header.menu-fixed`).
 */
body.sticky-header:not(.no-page-title):not(.solid-header) #sp-header:not(.menu-fixed) {
  position: absolute !important;
  background: transparent !important;
  box-shadow: none !important;
}

html,
body {
  scroll-padding-top: var(--sm-header-offset);
}

:target {
  scroll-margin-top: var(--sm-header-offset);
}

body:not(.header-sticky) .sp-page-title {
  padding-top: 120px !important;
  padding-bottom: 160px !important;
  min-height: 520px !important;
}

body:not(.header-sticky) .sp-page-title h2 {
  letter-spacing: -2px !important;
  width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  position: relative;
  margin-bottom: 32px !important;
}

.view-article .sp-page-title h2 {
  font-size: calc(16px + 4vw) !important;
  line-height: 1.05 !important;
}

body:not(.header-sticky) .article-details-wrap {
  margin-top: 100px !important;
}

/* Adjust Contents slider anchor offset for sticky header */
.article-details-wrap .article-content h3[id],
.article-details-wrap .article-content h2[id],
.article-details-wrap .article-content h4[id] {
  scroll-margin-top: var(--sm-header-offset);
}

/* Semantic section spacing for migrated article content */
.article-details-wrap [itemprop="articleBody"] .sm-article-section-heading,
.article-details-wrap [itemprop="articleBody"] .sm-article-subheading {
	clear: both;
	color: inherit;
	font-family: inherit;
	font-size: 1em;
	font-weight: 700;
	line-height: 1.5;
	scroll-margin-top: var(--sm-header-offset);
}

.article-details-wrap [itemprop="articleBody"] .sm-article-section-heading {
	margin: 2.5rem 0 1rem;
	text-decoration: underline;
}

.article-details-wrap [itemprop="articleBody"] .sm-article-subheading {
	margin: 1.75rem 0 0.75rem;
}

.article-details-wrap [itemprop="articleBody"] a.sm-article-lightbox {
  cursor: zoom-in;
  display: inline-block;
  max-width: 100%;
}

.article-details-wrap [itemprop="articleBody"] a.sm-article-lightbox:focus {
  outline: 3px solid rgba(0, 167, 167, 0.45);
  outline-offset: 4px;
}

.article-details-wrap [itemprop="articleBody"] a.sm-article-lightbox img {
  display: block;
}

.mfp-figure::after {
  background: #111827;
}

.mfp-title {
  line-height: 1.5;
  padding-right: 48px;
}

.sm-subject-article-icon {
  aspect-ratio: 1 / 1;
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 200px;
  width: 100%;
}

.sm-contributor-card {
  min-height: 330px;
}

.sm-contributor-photo,
.sm-contributor-bio-photo {
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.sm-contributor-photo {
  height: 200px;
  width: 200px;
}

.sm-contributor-bio-photo {
  height: min(450px, 80vw);
  max-width: 450px;
  width: min(450px, 80vw);
}

/* Allow mobile off-canvas to scroll while locking the page behind it */
.offcanvas-menu-init.offcanvas {
  overflow: hidden;
}

.offcanvas-menu-init.offcanvas .offcanvas-menu {
  max-height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.offcanvas-menu-init.offcanvas .offcanvas-inner {
  padding-bottom: 40px;
}

/* Off-canvas (hamburger) search: remove excess spacing under the search box */
.offcanvas-menu .offcanvas-inner .sp-module.sm-offcanvas-search-module {
  margin-bottom: 20px !important;
  padding-bottom: 0 !important;
}

.offcanvas-menu .offcanvas-inner .sp-module.sm-offcanvas-search-module .search {
  margin-top: 0 !important;
}

.offcanvas-menu .offcanvas-inner .sp-module.sm-offcanvas-search-module form,
.offcanvas-menu .offcanvas-inner .sp-module.sm-offcanvas-search-module input {
  margin-bottom: 0 !important;
}

/* Cross-site switch button (SimpleMed → SimpleMed+) */
.smplus-side-switch {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000000;
  width: 30px;
  height: 48px;
  border-radius: 0 24px 24px 0;
  background: #00a7a7;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.75);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.smplus-side-switch:hover,
.smplus-side-switch:focus {
  background: #008c8c;
  color: #fff;
  text-decoration: none;
}

.smplus-side-switch:focus {
  outline: 2px solid rgba(255, 255, 255, 0.9);
  outline-offset: 1px;
}

@media (max-width: 767px) {
  .smplus-side-switch {
    top: auto;
    bottom: 96px;
    left: 0;
    transform: none;
  }
}

/* Article Quiz CTA (SimpleMed+ embed) */
.article-details-wrap iframe.smp-cta-iframe,
.article-details-wrap iframe[data-src*="plus.simplemed.co.uk/embed/cta"],
.article-details-wrap iframe[src*="plus.simplemed.co.uk/embed/cta"] {
  width: 100% !important;
  max-width: none !important;
  border: 0 !important;
  display: block;
  margin: 0 !important;
  height: 220px;
  min-height: 160px;
  max-height: none;
  overflow: hidden;
}

.article-details-wrap .smp-cta-wrap {
  position: relative;
  margin: 14px 0 24px;
}

.article-details-wrap .smp-cta-fallback {
  margin: 10px 0 0;
  text-align: center;
  line-height: 1.4;
}

.article-details-wrap .smp-cta-fallback-link {
  display: inline-block;
  color: #00a7a7;
  font-size: 12px;
  font-weight: 600;
  text-decoration: underline;
}

.article-details-wrap .smp-cta-fallback-link:hover,
.article-details-wrap .smp-cta-fallback-link:focus {
  color: #008c8c;
  text-decoration: underline;
}

.article-details-wrap .smp-cta-fallback-link:focus {
  outline: 2px solid rgba(0, 140, 140, 0.3);
  outline-offset: 2px;
}

.article-details-wrap .smp-cta-ready .smp-cta-fallback {
  display: none;
}

/* Homepage Metrics (SimpleMed+ embed) */
.smp-home-metrics {
  width: 100%;
}

.smp-metrics-frame {
  width: 100%;
  display: block;
  border: 0;
  height: 220px;
  overflow: hidden;
}

@media (max-width: 639px) {
  .smp-metrics-frame {
    height: 920px;
  }
}

/* SimpleMed+ homepage promotion */
.sm-plus-home-promo {
  background: #fff;
  font-size: 1.12rem;
  padding: 74px 24px;
}

.sm-plus-home-promo__inner {
  align-items: center;
  background: #fff;
  border: 1px solid #dfe7ed;
  border-radius: 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  display: flex;
  gap: 34px;
  margin: 0 auto;
  max-width: 1120px;
  padding: 34px 40px;
  text-align: left;
}

.sm-plus-home-promo__logo {
  flex: 0 0 auto;
  height: auto;
  max-width: 185px;
  width: 22%;
}

.sm-plus-home-promo__eyebrow {
  color: #00a7a7;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  margin: 0 0 10px;
}

.sm-plus-home-promo h2 {
  color: #111827;
  font-size: clamp(1.65rem, 2.7vw, 2.45rem);
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 10px;
}

.sm-plus-home-promo__copy {
  flex: 1 1 auto;
  min-width: 0;
}

.sm-plus-home-promo__text {
  color: #6b7280;
  font-size: 1.15rem;
  line-height: 1.55;
  margin: 0;
}

.sm-plus-home-promo__cta {
  background: #12c8be;
  border: 2px solid #12c8be;
  border-radius: 14px;
  box-shadow: 0 16px 28px rgba(18, 200, 190, 0.22);
  color: #fff;
  display: inline-block;
  flex: 0 0 auto;
  font-size: 1.16rem;
  font-weight: 800;
  min-width: 190px;
  padding: 17px 30px;
  text-align: center;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.sm-plus-home-promo__cta:hover,
.sm-plus-home-promo__cta:focus {
  background: #0fb2aa;
  border-color: #0fb2aa;
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
}

.sm-plus-home-promo__cta:focus-visible {
  outline: 3px solid rgba(18, 200, 190, 0.35);
  outline-offset: 4px;
}

@media (max-width: 767px) {
  .sm-plus-home-promo {
    padding: 48px 18px;
  }

  .sm-plus-home-promo__inner {
    align-items: stretch;
    flex-direction: column;
    gap: 22px;
    padding: 28px 24px;
    text-align: center;
  }

  .sm-plus-home-promo__logo {
    margin: 0 auto;
    max-width: 180px;
    width: 58%;
  }

  .sm-plus-home-promo__eyebrow {
    font-size: 1.32rem;
  }

  .sm-plus-home-promo h2 {
    font-size: 1.8rem;
  }

  .sm-plus-home-promo__cta {
    min-width: 0;
    width: 100%;
  }
}

/* Contact Us (SP Page Builder Ajax Contact): improve typed text contrast */
.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group input:not(.sppb-form-check-input),
.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group textarea {
  color: #111827 !important;
}

.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group input:not(.sppb-form-check-input)::placeholder,
.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group textarea::placeholder {
  color: #9ca3af !important;
  opacity: 1;
}

.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group input:not(.sppb-form-check-input):focus,
.sppb-addon-ajax-contact .sppb-ajaxt-contact-form .sppb-form-group textarea:focus {
  outline: 2px solid rgba(0, 167, 167, 0.35);
  outline-offset: 1px;
}
