/* KTS UEpp App-Hinweis: header badges + popup */

/* --- Header badges --- */
.kts-uepp-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin: 0 14px 0 6px;
}
.kts-uepp-badges__label {
  font-size: 13px;
  line-height: 1.2;
  color: #5a5a5a;
  white-space: nowrap;
}
.kts-uepp-badges__link {
  display: block;
  line-height: 0;
  border-radius: 6px;
  transition: opacity .15s ease;
}
.kts-uepp-badges__link:hover { opacity: .85; }
.kts-uepp-badges__link:focus-visible { outline: 2px solid #1f8f9e; outline-offset: 2px; }
.kts-uepp-badges__link img { display: block; height: 30px; width: auto; max-width: none; }
/* iOS/iPadOS: only App Store, Android: only Google Play (any width); desktop: both */
.kts-uepp--ios .kts-uepp-badges__link--android,
.kts-uepp--android .kts-uepp-badges__link--ios { display: none; }
/* keep the theme meta link on one line next to the badges */
.kts-uepp-has-badges .metanav__link { white-space: nowrap; }

/* Stacked header (theme switches at 1300px): badges sit in the row with "Weitere Bereiche" */
@media (max-width: 1300px) {
  /* #header: beat theme rules like ".page-template-page-slim .header .header__right > * { display:none }" */
  #header .header__right.kts-uepp-has-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }
  #header .header__right.kts-uepp-has-badges > .header__extra-logos-wrap { flex: 1 1 auto; min-width: 0; }
  #header .header__right > .kts-uepp-badges { display: flex; margin: 0; }
  .kts-uepp-badges__label { display: none; }
  .kts-uepp-badges__link img { height: 30px; }
}

/* Phones: JS moves the badges into the logo row (between logo and ship);
   only the badge for the visitor's platform fits there, unknown platform = hidden */
@media (max-width: 767px) {
  #header .header__left > .kts-uepp-badges { display: flex; align-self: center; margin: 0 4px; }
  /* theme margin-right 35px on the logo leaves no room for the badge */
  #header .header__left.kts-uepp-has-badge > .header__logolink { margin-right: 8px; }
  html:not(.kts-uepp--ios):not(.kts-uepp--android) .kts-uepp-badges { display: none !important; }
  .kts-uepp-badges__label { display: none; }
  .kts-uepp-badges__link img { height: 24px; }
}
@media (min-width: 375px) and (max-width: 767px) {
  #header .header__left.kts-uepp-has-badge > .header__logolink { flex-shrink: 0; } /* keep KTS logo at full size */
  #header .header__left > .kts-uepp-badges { flex-shrink: 0; }
}

/* --- Popup --- */
.kts-uepp-popup[hidden] { display: none !important; }
.kts-uepp-popup {
  position: fixed;
  inset: 0;
  z-index: 99990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity .3s ease;
}
.kts-uepp-popup.is-open { opacity: 1; }
.kts-uepp-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 45, .72);
}
.kts-uepp-popup__box {
  position: relative;
  /* fit width and height of the viewport, image ratio 1200:1310 */
  width: min(520px, 100%, calc((100vh - 32px) * 1200 / 1310));
  width: min(520px, 100%, calc((100dvh - 32px) * 1200 / 1310));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
  background: #0b2c6b;
  transform: translateY(12px) scale(.98);
  transition: transform .3s ease;
}
.kts-uepp-popup.is-open .kts-uepp-popup__box { transform: none; }
.kts-uepp-popup__link { display: block; line-height: 0; border-radius: 12px; overflow: hidden; }
.kts-uepp-popup__link:focus-visible { outline: 3px solid #ffd400; outline-offset: 3px; }
.kts-uepp-popup__link img { display: block; width: 100%; height: auto; max-width: none; }
.kts-uepp-popup__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}
.kts-uepp-popup__close:hover { background: rgba(0, 0, 0, .8); }
.kts-uepp-popup__close:focus-visible { outline: 3px solid #ffd400; outline-offset: 2px; }
html.kts-uepp-noscroll { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .kts-uepp-popup, .kts-uepp-popup__box { transition: none; }
}
