
.topic-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 999; /* above everything */
}

.topic-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.topic-window {
  position: relative;
  box-sizing: border-box;
  background-color: #000000;
  color: #ffffff;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.9);

  width: min(100% - 1rem, 900px);
  max-width: 100%;
  max-height: 90vh;              /* more room so the top never cuts off */
  overflow-y: auto;
  padding: 48px 20px 20px;       /* 👈 extra TOP padding for the X button */

  transform-origin: top center;
  transform: translateY(0) scale(0.9);
  opacity: 0;
  transition:
    transform 0.45s cubic-bezier(0.19, 1, 0.22, 1),
    opacity 0.3s ease;
}

.topic-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* keep X button INSIDE the visible box */
.topic-close {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 10;                   /* ensure it stays above scrolling content */
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 1.8rem;
  cursor: pointer;
}

/* make the content inside a little softer */
.topic-window-content {
  margin-top: 12px;
}
/* Optional: slightly dim the background page when modal open */
body.modal-open {
  overflow: hidden;
}


@media (min-width: 1200px) {

.topic-window {
    width: 60%;
}

}