/* Wiederverwendbares Lesefenster (Modal) — Rahmen und Verhalten; die
   Gestaltung des Inhalts gehört der aufrufenden Fläche. */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(17, 17, 17, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: modal-overlay-in 180ms ease both;
}

.modal-dialog {
  position: relative;
  width: min(100%, 760px);
  max-height: min(86vh, 86dvh);
  overflow-y: auto;
  background: #fff;
  color: #111;
  border-radius: 18px;
  box-shadow: 0 40px 80px -32px rgba(0, 0, 0, 0.5);
  padding: clamp(28px, 5vw, 56px);
  animation: modal-dialog-in 220ms cubic-bezier(0.22, 0.8, 0.36, 1) both;
  outline: none;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(17, 17, 17, 0.16);
  border-radius: 999px;
  background: #fff;
  color: #111;
  cursor: pointer;
  transition:
    color 140ms ease,
    border-color 140ms ease,
    transform 140ms ease;
}

.modal-close:hover {
  color: #f08300;
  border-color: #f08300;
  transform: rotate(90deg);
}

.modal-close:focus-visible {
  outline: 2px solid #f08300;
  outline-offset: 2px;
}

@keyframes modal-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-dialog {
    animation: none;
  }

  .modal-close {
    transition: none;
  }
}

/* Mobil: volle Fläche, damit der Lesetext den Platz bekommt. */
@media (max-width: 640px) {
  .modal-overlay {
    padding: 0;
  }

  .modal-dialog {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    padding: 72px 20px 40px;
  }
}
