body {
  /* Do not set font-family here — it overrides Webflow page fonts (e.g. Lato)
     when this stylesheet is linked on the parent page. */
  /* Lets the Webflow page background show around/behind the embed */
  background-color: transparent;
}
.container {
  width: 100%;
  margin: 0 auto;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  position: relative;
  box-sizing: border-box;
}
@media (min-width: 768px) {
  .container {
    width: 430px;
  }
}

/* Homepage form: keep email/password/CTA shell ≤320px on narrow phones */
@media (max-width: 459px) {
  #keycloak-create-account-wrapper[data-form-style='homepage'] {
    max-width: 320px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
  }
}
#keycloak-create-account-wrapper {
  border: none;
  border-radius: 0;
  overflow: visible;
  position: relative;
}

/* Iframe element only — not Keycloak form internals */
#keycloak-create-account-wrapper iframe {
  border: none;
  border-radius: 0;
  overflow: hidden;
}

/* Email verification success message styles */
.email-verified-message {
  display: none;
  padding: 30px;
  text-align: center;
}

.email-verified-message.show {
  display: block;
}

.email-verified-message p {
  margin-bottom: 20px;
  font-size: 16px;
  color: #333;
}

.email-verified-message .login-button {
  display: inline-block;
  padding: 12px 24px;
  background-color: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s;
}

.email-verified-message .login-button:hover {
  background-color: #0056b3;
}

/* Fallback message styles (when Flagsmith flag is disabled) */
.fallback-message {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 30px;
  text-align: center;
  align-items: center;
  justify-content: center;
}

.fallback-message.show {
  display: flex;
}

.fallback-message p {
  margin: 0;
  font-size: 16px;
  color: #666;
  line-height: 1.6;
}

/* Loading state styles */
#keycloak-create-account-wrapper[data-loading='true']::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#keycloak-create-account-wrapper[data-loading='true']::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 11;
  width: 40px;
  height: 40px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #007bff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  100% {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

/*
 * reCAPTCHA / tall-theme overlay (body.keycloak-create-account-overlay).
 * Keeps the embed above hero trust badges and USP art on Endowus pages.
 */
body.keycloak-create-account-overlay .banner-form-wrap,
body.keycloak-create-account-overlay .keycloak-form-container,
body.keycloak-create-account-overlay .div--keycloak-container--left,
body.keycloak-create-account-overlay .div--keycloak-gateway-wrapper,
body.keycloak-create-account-overlay .div--keycloak,
body.keycloak-create-account-overlay .section--header__su-form-wrap,
body.keycloak-create-account-overlay #keycloak-create-account-wrapper {
  position: relative;
  z-index: 2147483644;
}

body.keycloak-create-account-overlay #keycloak-create-account-wrapper[data-overlay-active='true'] {
  z-index: 2147483645;
  isolation: isolate;
}

body.keycloak-create-account-overlay .header-home__frs-banner,
body.keycloak-create-account-overlay .navbar.w-nav,
body.keycloak-create-account-overlay #endowus-nav-menu,
body.keycloak-create-account-overlay .w-nav-overlay,
body.keycloak-create-account-overlay [id^='w-nav-overlay-'] {
  z-index: 2147483647 !important;
  pointer-events: auto !important;
}

/*
 * Product sticky bars are siblings of the lifted hero — keep them above the
 * embed (2147483644+) so scroll-up does not paint the form over the bars.
 * The portfolio dropdown (Flagship / CashUp / …) hangs below the first bar;
 * give that bar a higher band than the OVERVIEW / PERFORMANCE tab bar so the
 * menu is not covered by the grey strip beneath it.
 */
body.keycloak-create-account-overlay
  .section-hero--breadcrumb-content-wrap.element-hidden.incomeup,
body.keycloak-create-account-overlay
  .section-hero--breadcrumb-content-wrap.element-hidden.flagship {
  /* Below site header (3647) so locale / nav dropdowns are not clipped */
  z-index: 2147483646 !important;
  pointer-events: auto !important;
}

body.keycloak-create-account-overlay
  .section-hero--breadcrumb-content-wrap.element-hidden.model-port {
  z-index: 2147483645 !important;
  pointer-events: auto !important;
}

/*
 * HK MAA modals default to z-index ~1100. Lift when open — Webflow toggles inline
 * style between `display: none` (closed) and `display: flex` (open).
 * The modal sits after the header in the DOM (wins the 2147483647 tie) and the
 * product bars are below it (3646 / 3645). Do not sink the header while it is
 * open: anything under 2147483644 drops beneath the lifted hero and overlaps it.
 */
body.keycloak-create-account-overlay
  .maa-modal--wrapper[style*='display: flex'],
body.keycloak-create-account-overlay
  .maa-modal--wrapper[style*='display:flex'],
body.keycloak-create-account-overlay
  .maa-historical-performance-disclaimer-modal-wrapper[style*='display: flex'],
body.keycloak-create-account-overlay
  .maa-historical-performance-disclaimer-modal-wrapper[style*='display:flex'] {
  z-index: 2147483647 !important;
  pointer-events: auto !important;
}

/*
 * Lock page scroll while an MAA modal is open so only the modal scrolls.
 * Set on <html>: the embed forces `overflow: visible` on body.
 */
html:has(.maa-modal--wrapper[style*='display: flex']),
html:has(.maa-modal--wrapper[style*='display:flex']),
html:has(
    .maa-historical-performance-disclaimer-modal-wrapper[style*='display: flex']
  ),
html:has(
    .maa-historical-performance-disclaimer-modal-wrapper[style*='display:flex']
  ) {
  overflow: hidden !important;
}

.maa-modal--wrapper,
.maa-modal,
.maa-historical-performance-disclaimer-modal-wrapper {
  overscroll-behavior: contain;
}

body.keycloak-create-account-overlay .goals-usps,
body.keycloak-create-account-overlay .div-block-1591,
body.keycloak-create-account-overlay .homepage-usp,
body.keycloak-create-account-overlay .banner-slider-wrap .image-855,
body.keycloak-create-account-overlay .section--header__award-list,
body.keycloak-create-account-overlay .section--header__award-wrap,
body.keycloak-create-account-overlay .section--header__partner-list,
body.keycloak-create-account-overlay .section--header__licence-wrap {
  z-index: 1 !important;
  pointer-events: none;
}
