/**
 * Popup (Beitragstyp "fb_popup", siehe inc/popup.php)
 * Gestaltung angelehnt an das S18-Popup "Aktuelle Verkehrsinformation" (#s18-him-modal).
 */

.fb-popup {
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  overflow: visible;
}

.fb-popup[open] {
  animation: fb-popup-in 0.3s ease;
}

.fb-popup::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

/* Seite im Hintergrund nicht scrollen, solange das Popup offen ist. */
html:has(.fb-popup[open]) {
  overflow: hidden;
}

.fb-popup__content {
  position: relative;
  box-sizing: border-box;
  max-height: 80vh;
  overflow-y: auto;
  padding: 20px 25px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.fb-popup__close {
  position: absolute;
  top: 10px;
  right: 15px;
  padding: 0;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: 28px;
  font-weight: bold;
  line-height: 1;
  color: #333;
  cursor: pointer;
  transition: color 0.2s;
}

.fb-popup__close:hover,
.fb-popup__close:focus-visible {
  color: #000;
}

/* Bild oben im Popup, randlos bis an die Kanten der weissen Box. */
.fb-popup__image {
  margin: -20px -25px 16px;
}

.fb-popup__image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 40vh;
  object-fit: cover;
  border-radius: 12px 12px 0 0;
}

/* Kreuz auf hellem Kreis, damit es auf jedem Bild lesbar bleibt. */
.fb-popup--has-image .fb-popup__close {
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.fb-popup__title {
  margin-top: 0;
  padding-right: 30px; /* Platz für das Schliessen-Kreuz */
}

.fb-popup__text {
  color: #333;
}

.fb-popup__text > :first-child {
  margin-top: 0;
}

.fb-popup__link {
  margin: 8px 0;
}

.fb-popup__link a {
  color: #CC2D25;
  font-weight: 600;
  text-decoration: none;
  transition: text-decoration 0.2s;
}

.fb-popup__link a:hover,
.fb-popup__link a:focus-visible {
  text-decoration: underline;
}

@keyframes fb-popup-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fb-popup[open] {
    animation: none;
  }
}
