/* Spenden-Popup
   Overlay that hosts the FundraisingBox form (spenden.html) in a dialog so the
   donation flow stays on the current page instead of sending people to a
   separate site. The form itself, including the mandatory FundraisingBox logo,
   is rendered unchanged inside spenden.html. */

.fb-donate {
  width: min(760px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 48px);
  padding: 0;
  border: none;
  border-radius: 20px;
  color: var(--site-ink, #183450);
  background: var(--site-white, #fff);
  box-shadow: 0 30px 90px rgba(22, 45, 66, .28);
  overflow: hidden;
}

.fb-donate::backdrop {
  background: rgba(16, 33, 48, .55);
  backdrop-filter: blur(3px);
}

.fb-donate__inner {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

/* The header carries a photo banner, picked at random per page load and handed
   to CSS as --fb-donate-banner by the script. */
/* Sits inside .fb-donate__body so it scrolls away with the form. */
.fb-donate__head {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 380px;
  padding: 24px 24px 22px;
  background: var(--site-ink, #183450);
  overflow: hidden;
}

.fb-donate__banner {
  position: absolute;
  inset: 0;
  background-image: var(--fb-donate-banner);
  background-position: 50% 42%;
  background-size: cover;
  background-repeat: no-repeat;
}

.fb-donate__headline {
  position: relative;
  padding-right: 48px;
}

.fb-donate__title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--site-white, #fff);
  font-family: "IBM Plex Sans", Lato, sans-serif;
  font-size: clamp(21px, 3vw, 26px);
  font-weight: 700;
  line-height: 1.15;
  /* No scrim behind the photo, so the type carries its own contrast. */
  text-shadow: 0 1px 3px rgba(11, 25, 39, .55), 0 2px 18px rgba(11, 25, 39, .45);
}

.fb-donate__mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  filter: drop-shadow(0 1px 3px rgba(11, 25, 39, .55));
}

.fb-donate__close {
  position: absolute;
  z-index: 5;
  top: 14px;
  /* Clear of the form area's scrollbar, whose width the script measures. */
  right: calc(14px + var(--fb-donate-sbw, 0px));
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 999px;
  color: var(--site-ink, #183450);
  background: rgba(255, 255, 255, .92);
  appearance: none;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}

/* An SVG cross rather than a text glyph: U+00D7 is centred on the font's math
   axis, not the button box, so it always sits a shade high. */
.fb-donate__close svg {
  width: 15px;
  height: 15px;
}

.fb-donate__close:hover {
  color: var(--site-white, #fff);
  background: var(--site-ink, #183450);
}

.fb-donate__close:focus-visible {
  outline: 2px solid var(--site-teal, #4f8581);
  outline-offset: 2px;
}

.fb-donate__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Anchors the loading overlay to the form area only, so it never covers the
   banner above it. */
.fb-donate__form {
  position: relative;
  min-height: 260px;
}

.fb-donate__frame {
  display: block;
  width: 100%;
  /* Replaced with the measured content height once the form has rendered. */
  height: 620px;
  border: 0;
}

.fb-donate__loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #6b7c88;
  background: var(--site-white, #fff);
  font-family: "IBM Plex Sans", Lato, sans-serif;
  font-size: 14px;
}

.fb-donate[data-state="ready"] .fb-donate__loader {
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.fb-donate__spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(24, 52, 80, .18);
  border-top-color: var(--site-teal, #4f8581);
  border-radius: 50%;
  animation: fb-donate-spin .8s linear infinite;
}

@keyframes fb-donate-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .fb-donate__spinner { animation-duration: 2.4s; }
}

.fb-donate__foot {
  flex: 0 0 auto;
  padding: 14px 24px 18px;
  border-top: 1px solid var(--site-line, rgba(24, 52, 80, .12));
  background: #fbfbf9;
}

.fb-donate__note {
  margin: 0;
  color: #5d6f7c;
  font-family: "IBM Plex Sans", Lato, sans-serif;
  font-size: 12.5px;
  line-height: 1.5;
}

.fb-donate__note a {
  color: var(--site-teal, #4f8581);
  text-decoration: underline;
}

/* Keep the page behind the dialog from scrolling on iOS, where the native
   dialog scroll lock is not reliable. */
body.fb-donate-open {
  overflow: hidden;
}

@media (max-width: 767px) {
  .fb-donate {
    width: 100vw;
    max-width: 100vw;
    max-height: 100dvh;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
  }

  .fb-donate__inner { max-height: 100dvh; height: 100dvh; }
  .fb-donate__head { min-height: 300px; padding: 18px 16px 18px; }
  .fb-donate__mark { width: 28px; height: 28px; }
  .fb-donate__title { gap: 10px; }
  .fb-donate__foot { padding: 12px 16px 16px; }
}

/* ---------------------------------------------------------------------------
   Embedded mode for spenden.html
   spenden.html keeps working as a standalone page; when it is loaded inside the
   popup it drops the full-bleed background and centres the seals under the
   form. html.fb-embed is set by the inline script in spenden.html.
   --------------------------------------------------------------------------- */

html.fb-embed,
html.fb-embed body.body-donation {
  margin: 0;
  padding: 0;
  background-image: none;
  background-color: var(--site-white, #fff);
}

html.fb-embed body.body-donation {
  min-height: 0;
  padding: 4px 12px 16px;
}

html.fb-embed .div-block-spenden {
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 10px;
}

/* ---------------------------------------------------------------------------
   Standalone spende.html / spenden.html
   The Webflow rules size the photo as a 60% body background and push the page
   down with percentage margins, so the image and the form never line up. Here
   the page is one centred column: banner on top, form directly beneath it, both
   the same width — matching the popup.
   --------------------------------------------------------------------------- */

html:not(.fb-embed) body.body-donation {
  box-sizing: border-box;
  max-width: 820px;
  min-height: 0;
  margin: 0 auto;
  padding: 0 0 48px;
  background-color: var(--site-white, #fff);
  background-image: none;
}

html:not(.fb-embed) body.body-donation::before {
  content: "";
  display: block;
  height: clamp(200px, 32vw, 380px);
  margin-bottom: 24px;
  background-image: url("../images/donationbanner/mann_kind.jpg");
  background-position: 50% 42%;
  background-repeat: no-repeat;
  background-size: cover;
}

/* The form and the FundraisingBox logo sit in the same gutter as the banner. */
html:not(.fb-embed) body.body-donation > #fbIframeDiv,
html:not(.fb-embed) body.body-donation > a {
  padding-inline: 16px;
}

html:not(.fb-embed) body.body-donation > a {
  display: inline-block;
  margin-top: 8px;
}

@media (max-width: 767px) {
  html:not(.fb-embed) body.body-donation::before {
    margin-bottom: 18px;
  }
}

/* ---------------------------------------------------------------------------
   Spenden trigger in the main navigation
   --------------------------------------------------------------------------- */

body.site-shell > .navbar .nav-link-2.mitmachen-small[data-fb-donate] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 21px;
  font-size: 15px;
}

/* The mark is an outline drawing, so it needs size and stroke weight to stay
   readable at nav scale — below ~18px the heart and palm merge into a blob. */
.nav-heart {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

@media (max-width: 991px) {
  /* In the open mobile menu the button is full width, so centre icon + label. */
  body.site-shell > .navbar .nav-menu.site-menu-open .nav-link-2.mitmachen-small[data-fb-donate] {
    justify-content: center;
  }
}
