.bye-overlay {
  --overlay-margin: 20px;

  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;

  backdrop-filter: blur(10px); /* Adjust blur radius as needed */
}

.bye-overlay:not(.hidden) ~ body,
.bye-overlay:not(.hidden) ~ html {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

.bye-overlay.hidden {
  display: none;
}

.bye-overlay__content {
  background: #000;
  padding: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
  position: relative;
  overflow-y: auto;
}

.node--type-overlay-content {
  height: 100%;
}

.bye-overlay__node-content {
  position: relative;
  z-index: 40;
  height: 100%;
  padding: 0;
}

.bye-overlay__node-content .node__title {
  display: none;
}

.bye-overlay__node-content .node__content {
  height: 100%;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.bye-overlay__node-content .node__content .field--name-body {
  margin: var(--overlay-margin) auto;
  display: flex;
  flex-direction: column;
  align-items: center;

  flex: 0 0 auto; /* don’t grow or shrink, size by content */
}

.bye-overlay__node-content .node__content .field--name-body h1 {
  font-size: 0;
  margin: 0;
  padding: 0;
}

.bye-overlay__node-content .node__content .field--name-body h1:before {
  content: "";
  display: block;
  background-image: url(../img/headline.svg);
  width: 400px;
  height: 80px;
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
}

.bye-overlay__node-content .node__content .field--name-body p {
  margin: 0;
  margin-bottom: 0.5em;
  line-height: 1.4em;
  font-size: 1.1rem;
  text-align: center;
}
.bye-overlay__node-content .node__content .field--name-body p.inline-para {
}

.bye-overlay__node-content .node__content .field--name-field-gallery {
  flex: 1 1 auto; /* grow to take leftover space */
  height: 300px;
}
.bye-overlay__node-content .node__content .field--name-field-credits {
  flex: 1 1 300px; /* grow, shrink, min 300px base */
  max-height: 300px;

  margin: var(--overlay-margin) auto;
}

.bye-overlay__node-content {
  color: #fff;
  padding: 0;
}

.bye-overlay__close {
  position: absolute;
  z-index: 900;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  color: #727272;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
}

.bye-overlay__zoom_close {
  position: absolute;
  z-index: 900;
  top: 0.5rem;
  right: 0.5rem;
  background: transparent;
  color: #727272;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  display: none; /* Standardmäßig ausgeblendet */
}

/* Gezoomter Zustand */
.bye-overlay__content.zoomed .field--name-field-gallery {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bye-overlay__content .slick-slide {
  cursor: pointer;

  &.slick-current {
    cursor: zoom-in;
  }
}

.bye-overlay__content.zoomed .slick-slider {
  height: 100vh;
  width: 100vw;
}

.bye-overlay__content.zoomed .slick-slide {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;
  transition: opacity 0.3s ease-in-out;
  opacity: 1;

  &.slick-current {
    opacity: 1;
  }
}

.bye-overlay__content.zoomed .slick-slide.slick-current img,
.bye-overlay__content.zoomed .slick-slide.slick-current video {
}

.bye-overlay__content.zoomed .bye-overlay__close {
  display: none;
}

.bye-overlay__content.zoomed .bye-overlay__zoom_close {
  display: block;
}

/* Alternative CSS-based scroll prevention */
body:has(.bye-overlay:not(.hidden)) {
  overflow: hidden !important;
  position: fixed !important;
  width: 100% !important;
}

.bye-overlay__content .field--name-field-credits {
  height: 150px; /* visible window height */

  position: relative;

  &:before {
    content: "";
    background: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%);
    width: 100%;
    height: 40px;
    position: absolute;
    z-index: 99;
    top: 0px;
    left: 0px;
  }

  &:after {
    content: "";
    background: linear-gradient(0deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
    width: 100%;
    height: 40px;
    position: absolute;
    z-index: 99;
    bottom: 0px;
    left: 0px;
  }

  .a-scrollcontainer {
    overflow-y: scroll;
    width: 100%;
    height: 100%;
  }
}

.bye-overlay__content .field--name-field-credits .a-list {
  list-style: none;
  padding: 0;
  margin: 0;
  /* Animation wird jetzt über JavaScript gesteuert */
}

.a-location,
.a-artform {
  font-family: "ABCDiatype";
  font-size: 0.9rem;
  opacity: 0.5;
}

.pipe {
  font-family: "ABCDiatype";
  font-size: 0.9rem;
  opacity: 0.5;
}

.field--name-field-credits .a-list li {
  paddin: 0;
  margin: 0;
  text-align: center;

  .a-name {
  }
}

/* Mobile Styles für horizontales Scrollen */
@media (max-width: 767px) {
  .bye-overlay {
    --overlay-margin: 20px;

    padding: 10px;
  }

  .bye-overlay__node-content .node__content .field--name-body h1:before {
    content: "";
    display: block;
    background-image: url(../img/headline.svg);
    width: 100%;
    height: 80px;
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
  }

  .bye-overlay__node-content .node__content .field--name-body {
    position: relative;

    margin: 5px 5px;
  }

  .bye-overlay__node-content .node__content .field--name-body p {
    line-height: 1.3em;
    font-size: 1rem;
  }

  .bye-overlay__node-content .node__content .field--name-field-credits {
    flex: unset;
    min-height: 0;
    overflow-y: hidden;
    width: 100%;
    height: auto;
    margin: 10px auto 5px auto;
  }

  .field--name-field-credits.mobile-scroll {
    white-space: nowrap;
  }

  .field--name-field-credits.mobile-scroll:before {
    background: linear-gradient(90deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 100%);
    width: 40px;
    height: 100%;
    top: 0px;
    left: 0px;
  }

  .field--name-field-credits.mobile-scroll:after {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 100%);
    width: 40px;
    height: 100%;
    top: 0px;
    right: 0px;
    left: unset;
  }

  .field--name-field-credits .a-list.mobile-scroll {
    display: inline-block;
    white-space: nowrap;
  }

  .field--name-field-credits .a-list.mobile-scroll li {
    display: inline-block;
    margin-right: 20px;
  }

  .field--name-field-credits .a-list.mobile-scroll li a {
    line-height: 100%;
  }
  .field--name-field-credits .a-list.mobile-scroll li a span {
    font-size: 0.8rem;
  }
  .field--name-field-credits .a-list.mobile-scroll li a span:first-child {
    display: block;
    margin-bottom: -10px;
    font-size: 1.1rem;
  }
}

/* Keyframes wurden entfernt, da Scroll jetzt über JavaScript gesteuert wird */

@media (max-width: 767px) {
  .obituary {
    display: grid;
    /* Individuelle Zeiten für jedes Element */

    --visible-1: 4s;
    --visible-1: 4s; /* Zeit, die Element 1 sichtbar ist */
    --visible-2: 5s; /* Zeit, die Element 2 sichtbar ist */
    --visible-3: 10s; /* Zeit, die Element 3 sichtbar ist */
    --visible-4: 3s; /* Zeit, die Element 4 sichtbar ist */
    --fade-time: 0.5s; /* Zeit für Ein-/Ausblenden */
    --pause: 0.5s; /* Pause zwischen Elementen */

    align-items: center;
    position: relative;
  }

  /* Alle Kinder überlagern sich im selben Bereich */
  .obituary p {
    grid-area: 1 / 1; /* Überlagerung */
    align-self: center;
    justify-self: center;
    width: 100%;
    display: block;
    opacity: 0; /* Standardmäßig ausgeblendet */
    margin: 0.5em 0 !important;
    --duration: 45s;
  }

  .obituary p:nth-child(1) {
    animation: fade1 var(--duration) infinite;
  }
  .obituary p:nth-child(2) {
    animation: fade2 var(--duration) infinite;
  }
  .obituary p:nth-child(3) {
    animation: fade3 var(--duration) infinite;
  }
  .obituary p:nth-child(4) {
    animation: fade4 var(--duration) infinite;
  }
  @keyframes fade1 {
    0% {
      opacity: 0;
    }
    4% {
      opacity: 1;
    }
    16% {
      opacity: 1;
    }
    20% {
      opacity: 0;
    }
  }
  @keyframes fade2 {
    22% {
      opacity: 0;
    }
    26% {
      opacity: 1;
    }
    41% {
      opacity: 1;
    }
    45% {
      opacity: 0;
    }
  }
  @keyframes fade3 {
    47% {
      opacity: 0;
    }
    51% {
      opacity: 1;
    }
    66% {
      opacity: 1;
    }
    70% {
      opacity: 0;
    }
  }
  @keyframes fade4 {
    72% {
      opacity: 0;
    }
    76% {
      opacity: 1;
    }
    91% {
      opacity: 1;
    }
    95% {
      opacity: 0;
    }
  }
}
