/* Störer — LIVE stylesheet (included via page.typoscript includeCSS.50)
   Source of truth: this file only. Not built from assets/Scss.
   Rules of thumb:
   - Only ONE viewport image visible (desktop XOR mobile)
   - Only ONE state visible (closed flag XOR open panel)
   - Closed panel must NOT occupy layout space
*/

:root {
  --stoerer-z: 999;
  --stoerer-navy: #002345;
  --stoerer-cyan: #31adc5;
  --stoerer-yellow: #f7b700;
  --stoerer-transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.35s ease;
}

.stoerer {
  position: fixed;
  z-index: var(--stoerer-z);
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.stoerer.is-ready {
  opacity: 1;
  visibility: visible;
  pointer-events: none; /* children re-enable */
}

.stoerer[hidden] {
  display: none !important;
}

/* —— Viewport image exclusivity (highest priority) —— */
.stoerer .stoerer__img--desktop,
.stoerer .stoerer__img--mobile {
  display: none !important;
}

@media (max-width: 575.98px) {
  .stoerer .stoerer__img--mobile {
    display: block !important;
  }
}

@media (min-width: 576px) {
  .stoerer .stoerer__img--desktop {
    display: block !important;
  }
}

/* —— State exclusivity: closed = flag only; open/closing = panel —— */
/* Hide closed panel with transform (not opacity:0) so first open slide is visible */
.stoerer:not(.stoerer--open):not(.stoerer--closing) .stoerer__panel {
  position: absolute !important;
  pointer-events: none !important;
  /* keep in paint tree at off-screen transform — opacity:0 hid the first slide */
  opacity: 1;
  visibility: visible;
}

/* Fade flag — hide only while fully open; redeploy as soon as closing starts.
   Keep flag in normal flow (no position swap) so host height stays stable — no Y jump. */
.stoerer__flag {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  z-index: 0;
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease;
}

.stoerer--open .stoerer__flag {
  pointer-events: none !important;
}

.stoerer--open:not(.stoerer--closing) .stoerer__flag {
  opacity: 0 !important;
  visibility: hidden;
}

/* Closing: flag fades back in while panel exits */
.stoerer--closing .stoerer__flag {
  opacity: 1 !important;
  visibility: visible;
}

.stoerer--open .stoerer__panel,
.stoerer--closing .stoerer__panel {
  opacity: 1 !important;
  visibility: visible;
  pointer-events: auto !important;
}

.stoerer--closing .stoerer__panel {
  pointer-events: none !important;
  /* Clip protruding confetti so ribbons don’t lag outside the card */
  overflow: hidden !important;
}

.stoerer__close,
.stoerer__cta {
  pointer-events: auto;
}

/* —— Desktop: fixed right (≥576px, includes 576–767) —— */
@media (min-width: 576px) {
  .stoerer {
    right: 0;
    top: 38%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    overflow: visible;
  }

  .stoerer--mobile-only {
    display: none !important;
  }

  .stoerer:not(.stoerer--open):not(.stoerer--closing) .stoerer__panel {
    right: 0;
    top: 50%;
    /* Always absolute + Y-centered so open/close never changes host height */
    transform: translateY(-50%) translateX(110%);
  }

  .stoerer--open .stoerer__panel {
    right: 0;
    top: 50%;
    position: absolute !important;
    transform: translateY(-50%) translateX(0);
  }

  /* Close: slide left → right (mirror of open) */
  .stoerer--closing .stoerer__panel {
    right: 0;
    top: 50%;
    position: absolute !important;
    transform: translateY(-50%) translateX(110%);
  }

  .stoerer__panel {
    z-index: 1;
    position: absolute;
    right: 0;
    top: 50%;
    background: #fff;
    width: 320px;
    max-width: min(320px, 34vw);
    padding: 32px 32px 40px 52px;
    box-shadow: 0 12px 40px rgba(0, 35, 69, 0.16);
    transition: var(--stoerer-transition);
    overflow: visible;
    transform: translateY(-50%) translateX(110%);
  }

  .stoerer__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .stoerer__logo--open .stoerer__img--desktop {
    width: 100%;
    max-width: 200px;
    height: auto;
  }

  .stoerer__content {
    width: 100%;
    text-align: left;
  }

  .stoerer__headline,
  .stoerer__text p,
  .stoerer__cta {
    font-size: 13px;
    line-height: 18px;
    margin: 0;
  }

  .stoerer__headline {
    font-weight: 500;
    color: var(--stoerer-navy);
    text-transform: none !important;
  }

  .stoerer__text {
    margin-bottom: 16px;
  }

  .stoerer__text p {
    font-weight: 400;
  }

  .stoerer__cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    background: var(--stoerer-navy);
    color: #fff !important;
    font-weight: 600;
    text-decoration: none;
  }

  .stoerer__cta:hover,
  .stoerer__cta:focus {
    background: var(--stoerer-cyan);
    color: #fff !important;
  }

  /* Closed flag — stays in flow (sizes host); fade only, no Y transform */
  .stoerer__flag {
    background: #fff;
    border: 0;
    padding: 20px 60px 20px 24px;
    cursor: pointer;
    line-height: 0;
    box-shadow: 0 6px 24px rgba(0, 35, 69, 0.12);
  }

  .stoerer__logo--closed .stoerer__img--desktop {
    width: 65px;
    height: auto;
  }

  /* Anniversary ribbons — transparent assets; match XD open-state placement */
  .stoerer__confetti--tl {
    /* "7" ribbon — mid-left edge, below close X (XD) */
    top: 38%;
    left: -45px;
    width: 72px;
    transform: translateY(-50%);
    z-index: 4;
  }

  .stoerer__confetti--br {
    /* zigzag ribbon — protrudes past bottom-right corner (XD) */
    bottom: -26px;
    right: -24px;
    width: 148px;
    z-index: 0;
  }
}

/* —— Mobile: bottom bar (≤575px) —— */
@media (max-width: 575.98px) {
  .stoerer {
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    transform: none;
    display: block;
    height: 0;
    overflow: visible !important;
    /* Keep content above iOS home indicator */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .stoerer--desktop-only {
    display: none !important;
  }

  .stoerer:not(.stoerer--open):not(.stoerer--closing) .stoerer__panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    /* vh-based: % of self breaks when confetti changes panel height on open */
    transform: translateY(100%);
  }

  .stoerer--open .stoerer__panel {
    transform: translateY(0);
    bottom: 0;
  }

  /* Close: slide up → down (mirror of open) */
  .stoerer--closing .stoerer__panel {
    transform: translateY(100%);
  }

  .stoerer__panel {
    z-index: 1;
    background: #fff;
    width: 100%;
    /* Keep absolute for open+closed so transform animates (relative swap was freezing open off-screen) */
    position: absolute !important;
    left: 0;
    right: 0;
    bottom: 0;
    /* Anniversary OFF: keep bottom clearance so copy clears Cookiebot (~52px widget) */
    padding: 50px 24px 65px 50px;
    box-shadow: 0 -6px 28px rgba(0, 35, 69, 0.14);
    transition: var(--stoerer-transition);
    overflow: visible !important;
  }

  .stoerer--open .stoerer__panel,
  .stoerer--closing .stoerer__panel {
    position: absolute !important;
  }

  .stoerer--anniversary.stoerer--open .stoerer__panel,
  .stoerer--anniversary.stoerer--closing .stoerer__panel {
    /* Extra inset so protruding ribbons don’t cover copy / CTA */
    padding: 60px 30px 100px 30px;
  }

  .stoerer__inner {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Client Point 1: clear space between logo graphic and body text */
    gap: 28px;
    padding-top: 4px;
  }

  .stoerer__logo--open {
    flex: 0 0 auto;
  }

  .stoerer__logo--open .stoerer__img--mobile {
    width: auto;
    max-width: 220px;
    height: auto;
    margin-bottom: 0;
  }

  /* Design one-to-one:
     Line 1: 130 Jahre alt und trotzdem
     Line 2: Startup?! Wie das zusammenpasst:
     CTA stays to the right */
  .stoerer__content {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px 14px;
    width: 100%;
  }

  .stoerer__content-inner {
    flex: 0 1 auto;
    /* Between "…trotzdem" (~138px) and "…Startup?!" (~189px); ≥ line2 (~181px) */
    max-width: 185px;
    display: block;
    font-size: 11px;
    line-height: 15px;
    color: var(--stoerer-navy);
    font-weight: 500;
  }

  .stoerer__headline {
    display: inline;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    color: inherit;
    text-transform: initial;
  }

  .stoerer__text {
    display: inline;
    margin: 0;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    color: inherit;
    margin-left: 4px;
  }

  .stoerer__text p {
    display: inline;
    margin: 0;
  }

  .stoerer__cta {
    flex: 0 0 auto;
    align-self: center;
    font-size: 11px;
    line-height: 15px;
    background: var(--stoerer-navy);
    color: #fff !important;
    padding: 5px 8px;
    white-space: nowrap;
    text-transform: uppercase;
  }

  .stoerer__cta:hover,
  .stoerer__cta:focus {
    background: var(--stoerer-cyan);
    color: #fff !important;
    outline: none;
  }

  .stoerer__flag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: #fff;
    border: 0;
    padding: 14px 56px calc(14px + env(safe-area-inset-bottom, 0px));
    cursor: pointer;
    line-height: 0;
    box-shadow: 0 -4px 18px rgba(0, 35, 69, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
    transform: none;
  }

  .stoerer__logo--closed .stoerer__img--mobile {
    width: 100%;
    max-width: 96px;
    height: auto;
  }

  /* Ribbons protrude past card edges; panel is lifted so BR stays on-screen */
  .stoerer__confetti--tl {
    top: -70px;
    right: 1%;
    left: auto;
    width: 230px;
    z-index: 4;
  }

  .stoerer__confetti--br {
    bottom: -30px;
    left: 10%;
    right: auto;
    width: 215px;
    z-index: 0;
  }
}

/* Shared controls */
.stoerer__close {
  position: absolute;
  top: 15px;
  left: 20px;
  z-index: 3;
  width: 15px;
  height: 15px;
  border: 0;
  background: transparent;
  color: #555;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.stoerer__close:hover,
.stoerer__close:focus {
  color: var(--stoerer-navy);
  outline: none;
}

/* Anniversary ribbons: visible only while fully open (instant hide on close) */
.stoerer__confetti {
  display: none !important;
  position: absolute;
  z-index: 2;
  pointer-events: none;
  line-height: 0;
}

.stoerer--anniversary.stoerer--open:not(.stoerer--closing) .stoerer__confetti {
  display: block !important;
}

.stoerer__confetti img {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
}

/* contact-form coexistence */
@media (min-width: 576px) {
  body:has(.stoerer.is-ready) .contact-form {
    bottom: 30px;
  }
}

@media (max-width: 575.98px) {
  body:has(.stoerer.is-ready:not(.stoerer--open):not(.stoerer--closing)) .contact-form {
    bottom: 84px;
  }

  body:has(.stoerer.stoerer--open) .contact-form,
  body:has(.stoerer.stoerer--closing) .contact-form {
    bottom: 200px;
  }
}
