/*
 * EGE-School pop-up (D44): the TutorOnline dialog opened by assets/js/popup.js.
 * Loaded only on pages that print the dialog. Tokens from base.css; the dialog is
 * .es-on-light, so focus rings keep the violet colour.
 */
.es-popup {
  width: min(560px, 100vw - 32px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 24px 28px 28px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 0;
  border-radius: var(--es-r-lg);
  background: var(--es-white);
  color: var(--es-ink);
  font-family: var(--es-font-text);
}

.es-popup::backdrop {
  background: color-mix(in srgb, var(--es-ink) 72%, transparent);
}

/* the page behind the dialog does not scroll */
html:has(.es-popup[open]) {
  overflow: hidden;
}

/* zero-height bar: the close button floats over the corner and stays while the dialog scrolls */
.es-popup__bar {
  position: sticky;
  top: 12px;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  height: 0;
  margin-top: -12px;
  margin-right: -12px;
  pointer-events: none;
}

.es-popup__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 2px solid var(--es-line);
  border-radius: var(--es-r-pill);
  background: var(--es-white);
  color: var(--es-ink);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}

.es-popup__close:hover {
  border-color: var(--es-ink);
  background: var(--es-line-2);
}

.es-popup__close:focus-visible {
  outline: 3px solid var(--es-link-h);
  outline-offset: 2px;
}

.es-popup__title {
  margin-top: 0;
  padding-right: 32px;
  font-family: var(--es-font-display);
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.es-popup__text {
  display: flex;
  flex-direction: column;
  gap: var(--es-s-2);
  margin-top: var(--es-s-3);
  color: var(--es-muted-2);
  font-size: 15px;
  line-height: 1.5;
}

.es-popup__text p:first-child {
  color: var(--es-ink);
}

.es-popup__form {
  margin-top: var(--es-s-4);
  max-width: 100%;
  overflow-x: auto;
}

.es-popup__form:empty {
  display: none;
}

.es-popup__note {
  margin-top: var(--es-s-4);
  color: var(--es-muted-2);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.es-popup__note a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .es-popup {
    padding: 20px 16px 20px;
    border-radius: var(--es-r-md);
  }

  .es-popup__bar {
    margin-top: -8px;
    margin-right: -4px;
  }
}
