/* ============================================================
   Infoabend-Popup – bewirbt den gratis Kinderwunsch-Infoabend.
   Erscheint pro Besucher max. 1× alle 3 Tage (Logik in
   shared/js/infoabend-popup.js). Wird nur geladen, wenn
   $site['infoabend_popup'] gesetzt ist.
   2-spaltiges Layout (Foto | Inhalt), mobil gestapelt.
   ============================================================ */

.ia-popup {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  padding: 20px;
  /* Sicherheitsnetz: passt die Karte nicht in den Viewport, scrollt das Overlay.
     margin:auto an der Karte zentriert bei Platz und rückt sie sonst nach oben,
     sodass nichts unerreichbar wird. */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.ia-popup[hidden] { display: none; }

.ia-popup__backdrop {
  /* fixed statt absolute: deckt den Viewport auch beim Scrollen des Overlays */
  position: fixed;
  inset: 0;
  background: rgba(16, 42, 48, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s var(--ease, ease);
}
.ia-popup.is-open .ia-popup__backdrop { opacity: 1; }

.ia-popup__card {
  position: relative;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr); /* Zeile darf schrumpfen -> Body kann scrollen */
  width: min(860px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  background: var(--white, #fff);
  border-radius: var(--radius-lg, 24px);
  box-shadow: var(--shadow-xl, 0 18px 48px rgba(16, 42, 48, 0.22));
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.25s var(--ease, ease), transform 0.32s var(--ease-spring, cubic-bezier(0.16, 1, 0.3, 1));
}
.ia-popup.is-open .ia-popup__card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Foto-Spalte */
.ia-popup__media {
  position: relative;
  min-height: 420px;
  background-size: cover;
  background-position: center;
  background-color: var(--teal-tint, #e6f3f4);
}
.ia-popup__media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(16, 42, 48, 0) 55%, rgba(16, 42, 48, 0.34) 100%);
}

.ia-popup__badge {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--gradient-primary, linear-gradient(120deg, #0a8ea0, #0c6b78));
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 8px 15px;
  border-radius: var(--radius-pill, 999px);
  box-shadow: 0 4px 12px rgba(16, 42, 48, 0.22);
}
.ia-popup__badge svg { width: 15px; height: 15px; flex: none; }

/* Inhalt-Spalte */
.ia-popup__body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0; /* sonst verhindert min-height:auto das Scrollen im Grid */
  padding: clamp(26px, 3vw, 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.ia-popup__close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft, #f4f6f5);
  color: var(--ink-mid, #45525a);
  cursor: pointer;
  transition: background 0.15s var(--ease, ease), color 0.15s var(--ease, ease);
}
.ia-popup__close:hover { background: var(--border, #e2e6e7); color: var(--ink, #14150f); }
.ia-popup__close svg { width: 18px; height: 18px; }

.ia-popup__title {
  padding-right: 26px; /* Platz fuer den Schliessen-Button */
  font-family: var(--font-display, inherit);
  font-size: clamp(22px, 2.6vw, 29px);
  line-height: 1.18;
  color: var(--ink, #14150f);
  margin: 0 0 12px;
}

.ia-popup__text {
  color: var(--ink-mid, #45525a);
  font-size: 16px;
  line-height: 1.6;
  margin: 0 0 20px;
}
.ia-popup__text strong { color: var(--ink, #14150f); font-weight: 700; }

.ia-popup__list {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
}
.ia-popup__list li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink, #23261f);
  margin: 0 0 11px;
}
.ia-popup__list li:last-child { margin-bottom: 0; }
.ia-popup__list li svg {
  width: 19px;
  height: 19px;
  flex: none;
  color: var(--teal, #0a8ea0);
}

/* Nächste Termine (per JS befüllt) */
.ia-popup__dates {
  margin: 0 0 22px;
}
.ia-popup__dates[hidden] { display: none; }
.ia-popup__dates-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft, #7a8890);
  margin: 0 0 9px;
}
.ia-popup__dates-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
}
.ia-popup__dates-list li {
  background: var(--bg-soft, #f4f6f5);
  border: 1px solid var(--border-soft, #eceff0);
  border-radius: var(--radius-pill, 999px);
  padding: 6px 13px;
  font-size: 13px;
  color: var(--ink-mid, #45525a);
}
.ia-popup__dates-list strong { color: var(--teal-deep, #0c6b78); font-weight: 700; }

.ia-popup__actions {
  margin-top: auto;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}
.ia-popup__actions .btn { justify-content: center; }

.ia-popup__later {
  border: none;
  background: none;
  color: var(--ink-soft, #7a8890);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 4px;
}
.ia-popup__later:hover { color: var(--ink-mid, #45525a); text-decoration: underline; }

/* Scroll-Lock solange offen */
.ia-popup-lock, .ia-popup-lock body { overflow: hidden; }

/* Mobil: gestapelt, kompaktere Typo/Abstände; die Karte darf wachsen –
   gescrollt wird dann das Overlay (siehe .ia-popup overflow-y). */
@media (max-width: 720px) {
  .ia-popup { padding: 10px; }

  .ia-popup__card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    max-height: none;
  }
  .ia-popup__body { overflow: visible; padding: 20px 18px 22px; }

  .ia-popup__media { min-height: 132px; }
  .ia-popup__badge { font-size: 11px; padding: 6px 12px; gap: 6px; top: 14px; left: 14px; }
  .ia-popup__badge svg { width: 13px; height: 13px; }

  .ia-popup__close { width: 34px; height: 34px; top: 12px; right: 12px; background: rgba(255, 255, 255, 0.9); box-shadow: 0 2px 8px rgba(16, 42, 48, 0.18); }
  .ia-popup__close svg { width: 16px; height: 16px; }

  .ia-popup__title { font-size: 20px; margin-bottom: 8px; padding-right: 40px; }
  .ia-popup__text { font-size: 14px; line-height: 1.5; margin-bottom: 13px; }

  .ia-popup__list { margin-bottom: 14px; }
  .ia-popup__list li { font-size: 13px; gap: 9px; margin-bottom: 8px; }
  .ia-popup__list li svg { width: 17px; height: 17px; }

  .ia-popup__dates { margin-bottom: 14px; }
  .ia-popup__dates-label { font-size: 11px; margin-bottom: 6px; }
  .ia-popup__dates-list { gap: 6px; }
  .ia-popup__dates-list li { font-size: 11px; padding: 5px 11px; }

  .ia-popup__actions { gap: 8px 12px; }
  .ia-popup__actions .btn { width: 100%; font-size: 14px; padding: 12px 20px; }
  .ia-popup__later { font-size: 12px; }
}

/* Sehr niedrige Viewports (Landscape-Handy): Foto weiter reduzieren */
@media (max-width: 720px) and (max-height: 520px) {
  .ia-popup__media { min-height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
  .ia-popup__backdrop, .ia-popup__card { transition: none; }
}
