.template-slide {
  --template-quote-block-inset: 9.5rem;
  --slide-feature-edge-color: #fff;
}

.fullpage-slide.template-slide .inner {
  overflow-x: hidden;
}

.template-slide .bg {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
}

.fullpage-slide.template-slide .bg.slide-feature-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--slide-feature-edge-rail);
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
  column-gap: 0;
  padding-top: var(--glass-nav-safe-top);
  padding-bottom: 0;
  padding-left: 0;
  padding-right: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

.fullpage-slide.template-slide .bg.slide-feature-layout .slide-feature-body {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  min-height: 0;
  width: 100%;
  padding-inline: 0;
  box-sizing: border-box;
}

.fullpage-slide.template-slide .bg.slide-feature-layout .slide-feature-edge-slot--next {
  grid-column: 2;
  grid-row: 1;
  margin-right: 0;
}

@media (min-width: 1080px) {
  /* Match statistik edge slides (viewport-centered rail); only when JS sees no overflow */
  .fullpage-slide.template-slide:not(.template-slide--slide-content-overflow)
    .bg.slide-feature-layout
    .slide-feature-edge--next {
    position: fixed;
    top: 50%;
    right: calc(var(--slide-feature-edge-viewport-inset) + env(safe-area-inset-right, 0px));
    z-index: 5;
    transform: translateY(-50%);
  }
}

.fullpage-slide.template-slide .fullpage-scroll-main .template-layout {
  flex: 1 1 auto;
  min-height: 0;
}

.template-slide .template-layout {
  --template-sidebar-lead: 2.5rem;
  display: grid;
  grid-template-columns: clamp(5.25rem, 9vmin + 2.5rem, 7.6875rem) minmax(0, 1fr);
  align-items: stretch;
  column-gap: 2.5rem;
  padding: 2rem;
  padding-left: calc(2rem + var(--template-sidebar-lead));
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.template-sidebar-column {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  width: 100%;
  min-height: 0;
  min-width: 0;
}

.template-sidebar {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.template-sidebar__items {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  gap: clamp(1.25rem, 4vmin + 0.75rem, 3.8125rem);
}

.template-sidebar__items > li {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  width: 100%;
  cursor: pointer;
}

.template-sidebar__slot {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.375rem, 1vmin + 0.2rem, 0.625rem);
  min-height: 0;
  width: 100%;
}

.template-sidebar__icon {
  display: flex;
  width: clamp(3rem, calc(2.85rem + 0.12vmin), 3.5rem);
  height: clamp(3rem, calc(2.85rem + 0.12vmin), 3.5rem);
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}

.template-sidebar__icon img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.template-sidebar__label {
  color: #fff;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: clamp(0.75rem, 0.4vmin + 0.68rem, 1rem);
  line-height: 1;
}

.template-main {
  display: flex;
  grid-column: 2;
  align-self: stretch;
  gap: 2.5rem;
  min-width: 0;
  min-height: 0;
  margin-block: var(--template-quote-block-inset);
}

.template-rule {
  width: 6px;
  border-radius: 3rem;
  background: #fff;
}

.template-main .slide-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  padding: 0;
  padding-right: clamp(2rem, 18vw, 25.8rem);
  text-align: left;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: break-word;
  box-sizing: border-box;
}

.template-main .slide-content-prose {
  min-width: 0;
  max-width: 100%;
}

.template-main .section-heading,
.template-main .slide-content p {
  color: #fff;
  font-family: "Source Sans Pro", sans-serif;
  font-style: normal;
  line-height: normal;
}

.template-main .slide-content p {
  font-size: clamp(0.9rem, 2vmin + 0.75vw, 1.5rem);
  font-weight: 400;
}

.template-slide .template-main .slide-content .section-heading {
  font-family: "Source Sans Pro", sans-serif;
  font-size: clamp(1.2rem, 3.5vmin + 2vw, 4.375rem);
  font-style: normal;
  font-weight: 600;
  line-height: 1.06;
  color: #fff;
  text-shadow: none;
  margin-bottom: clamp(0.65rem, 2.5dvh, 2.5rem);
  max-width: 100%;
  overflow-wrap: break-word;
}

/* .template-main .slide-content p {
  font-size: clamp(1rem, 1.75vw, 1.5rem);
  line-height: 1.35;
  margin: 0;
} */

.template-sidebar-lightbox-fade {
  position: fixed;
  inset: 0;
  z-index: 1399;
  background: rgba(0, 0, 0, 0.5);
}

.template-sidebar-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  pointer-events: none;
}

.template-sidebar-lightbox__surface {
  position: relative;
  pointer-events: auto;
  width: 80vw;
  height: 80vh;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  border-radius: 32px;
  background: var(--bg-primary);
  overflow: hidden;
}

@media (max-width: 36rem), (max-height: 36rem) {
  .template-sidebar-lightbox__surface {
    width: min(94vw, calc(100vw - 1rem));
    height: min(88dvh, calc(100vh - 2rem));
    max-width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 0.5rem);
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 1rem);
  }
}

.template-sidebar-lightbox__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border: none;
  padding: 0;
  background: transparent;
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.template-sidebar-lightbox__inner {
  width: 100%;
  height: 100%;
  overflow: auto;
}

.template-sidebar-lightbox__inner:has(
    .template-sidebar-jahresverlauf,
    .template-sidebar-organigram,
    .map-interactive
  ) {
  overflow: hidden;
}

.template-sidebar-jahresverlauf {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 12px 16px 16px;
  overflow: hidden;
  background: var(--Rose-4, #c4727a);
}

.template-sidebar-jahresverlauf__scroll {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
}

.template-sidebar-jahresverlauf__ticker {
  display: block;
  height: 100%;
  width: auto;
  max-width: none;
  pointer-events: none;
}

.template-sidebar-organigram {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  padding: 1rem;
  overflow: hidden;
  background-color: var(--bg-service);
}

.template-sidebar-organigram__viewport {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: contain;
}

.template-sidebar-organigram__img {
  display: block;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  height: auto;
  aspect-ratio: auto;
  object-fit: contain;
  pointer-events: none;
}

.template-sidebar-lightbox__inner > .fullpage-slide {
  position: relative;
  visibility: visible;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  z-index: auto;
  scroll-snap-align: none;
}

#template-sidebar-lightbox-inner .map-popup {
  visibility: hidden;
  opacity: 0;
}

#template-sidebar-lightbox-inner .map-hotspot-wrap:hover .map-popup,
#template-sidebar-lightbox-inner .map-hotspot-wrap:focus-within .map-popup {
  visibility: visible;
  opacity: 1;
}

@media (max-width: 1079px) {
  #template-sidebar-lightbox-inner > .fullpage-slide {
    background-color: #7f5d87 !important;
  }

  #template-sidebar-lightbox-inner .slide-svg--map-full {
    display: none;
  }

  #template-sidebar-lightbox-inner .slide-svg--map-compact {
    display: block;
    top: 1rem;
    left: 1rem;
    width: calc(100% - 2rem);
    height: calc(100% - 2rem);
  }

  #template-sidebar-lightbox-inner .map-hotspots,
  #template-sidebar-lightbox-inner .map-tooltip-legend {
    display: none;
  }
}

.template-sidebar-popup-placeholder {
  display: flex;
  height: 100%;
  min-height: 12rem;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 2rem;
  color: #fff;
  font-family: 'Source Sans Pro', sans-serif;
  font-size: clamp(1.25rem, 3vw, 2rem);
  font-weight: 600;
  text-align: center;
}

@media (max-width: 1079px) {
  .template-slide {
    --template-quote-safe-top: calc(env(safe-area-inset-top, 0px) + 3rem);
    --template-quote-block-inset: clamp(1rem, 4vmin, 2.75rem);
  }

  .template-slide .bg {
    padding-top: var(--template-quote-safe-top);
  }

  .fullpage-slide.template-slide .bg.slide-feature-layout {
    padding-top: var(--template-quote-safe-top);
    grid-template-rows: auto;
    height: auto;
    min-height: min(100%, max-content);
    padding-bottom: max(
      clamp(0.75rem, 2vmin, 2rem),
      calc(var(--fullpage-next-reserve) + clamp(0.35rem, 1.5vmin, 0.75rem))
    );
  }

  .fullpage-slide.template-slide:has(.bg.slide-feature-layout) .inner {
    overflow-y: auto;
    overflow-anchor: none;
    -webkit-overflow-scrolling: touch;
  }

  .template-slide .template-layout {
    --template-sidebar-lead: 0;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.75rem;
    padding: 0.375rem clamp(1rem, 4vw, 2rem) 1rem;
  }

  .template-sidebar-column {
    grid-column: 1;
    width: 100%;
    align-items: center;
  }

  .template-sidebar {
    flex: 0 0 auto;
    width: 100%;
    align-items: center;
    justify-content: center;
    padding-bottom: 0;
    margin-top: clamp(1rem, 4vmin, 2.25rem);
  }

  .template-sidebar__items {
    flex: 0 0 auto;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    align-content: center;
    width: fit-content;
    max-width: 100%;
    margin-inline: auto;
    gap: clamp(0.5rem, 3.5vw, 1.25rem);
  }

  .template-sidebar__items > li {
    flex: 0 1 auto;
    width: auto;
  }

  .template-sidebar__label {
    text-align: center;
  }

  .template-sidebar__icon {
    width: clamp(1.75rem, 5vw + 0.75rem, 2.5rem);
    height: clamp(1.75rem, 5vw + 0.75rem, 2.5rem);
  }

  .template-main {
    grid-column: 1;
    flex-direction: column;
  }

  .template-main .slide-content {
    padding-right: 0;
  }

  .template-rule {
    display: none;
  }
}

@media (min-width: 1080px) {
  .fullpage-slide.template-slide .bg.slide-feature-layout .template-layout {
    flex: 1 1 auto;
    min-height: 0;
    max-height: 100%;
    width: 100%;
  }
}

@media (min-width: 1080px) and (max-height: 800px) {
  .template-slide .template-layout {
    column-gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    padding-left: calc(1.5rem + var(--template-sidebar-lead));
  }
}

@media (max-height: 720px) {
  .template-slide {
    --template-quote-block-inset: clamp(0.75rem, 5dvh, 4rem);
  }

  .fullpage-slide.template-slide .inner {
    overflow-y: auto;
    overflow-anchor: none;
    -webkit-overflow-scrolling: touch;
  }

  .fullpage-slide.template-slide .bg {
    position: relative;
    min-height: 100%;
    height: auto;
    padding-bottom: max(
      clamp(1.5rem, 4vw, 3rem),
      calc(var(--fullpage-next-reserve) + clamp(0.35rem, 1.5vmin, 0.75rem))
    );
    box-sizing: border-box;
  }

  .fullpage-slide.template-slide .bg.slide-feature-layout {
    height: auto;
    min-height: 100%;
  }
}
