/* Event dialog on calendar.html (imported events only). Tokens come from calendar.css :root;
   no new colours, fonts or radii. Loaded only when the page has an imported event. */
html { scrollbar-gutter: stable; }
html.event-dialog-open { overflow: hidden; }

.event-dialog {
  width: min(880px, calc(100% - 48px)); max-width: none;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  margin: auto; padding: 0; border: 0; border-radius: var(--r-lg);
  background: var(--bg); color: var(--ink); font-family: var(--font);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 24px 64px rgba(32, 32, 34, .24);
}
.event-dialog::backdrop { background: rgba(32, 32, 34, .6); }
.event-dialog[open] { animation: event-dialog-in .18s ease-out; }
.event-dialog[open]::backdrop { animation: event-dialog-fade .18s ease-out; }
@keyframes event-dialog-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes event-dialog-fade { from { opacity: 0; } }

.event-dialog__bar {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end;
  padding: 12px 12px 0; margin-bottom: -56px; pointer-events: none;
}
.event-dialog__close {
  pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: var(--bg); color: var(--ink); cursor: pointer;
  box-shadow: inset 0 0 0 1px #d5d5d5;
}
.event-dialog__close:hover { color: var(--blue-600); }
.event-dialog__sentinel { display: block; width: 0; height: 0; outline: 0; }

.event-dialog__article { display: block; }
.event-dialog__cover {
  display: block; width: 100%; height: clamp(200px, 30vw, 300px); object-fit: contain;
  background: var(--bg-soft); border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.event-dialog__info { padding: 28px 40px 8px; }
.event-dialog__type { font-size: 16px; font-weight: 500; line-height: 1.12; color: var(--blue-700); margin-bottom: 8px; }
.event-dialog__title { font-size: 32px; font-weight: 600; line-height: 1.3; color: var(--ink); overflow-wrap: anywhere; }
.event-dialog__when { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 16px; line-height: 1.3; }
.event-dialog__when img { flex: none; width: 15px; height: 15px; }
.event-dialog__facts { display: grid; gap: 12px; margin: 20px 0 0; }
.event-dialog__facts dt { font-size: 14px; line-height: 1.3; color: var(--gray-500); }
.event-dialog__facts dd { margin: 2px 0 0; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }

.event-dialog__description { margin-top: 24px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.event-dialog__description > :first-child { margin-top: 0; }
.event-dialog__description p { margin: 0 0 12px; }
.event-dialog__description ul, .event-dialog__description ol { margin: 0 0 12px; padding-left: 24px; }
.event-dialog__description ul { list-style: disc; }
.event-dialog__description ol { list-style: decimal; }
.event-dialog__description li { margin: 0 0 4px; padding-left: 2px; }
.event-dialog__description b, .event-dialog__description strong { font-weight: 600; }
.event-dialog__description i, .event-dialog__description em { font-style: italic; }
.event-dialog__description a { color: var(--blue-600); text-decoration: underline; text-underline-offset: 2px; }
.event-dialog__description a:hover { color: var(--blue-900); }

.event-dialog__form { margin-top: 24px; padding: 24px 32px 32px; border-top: 1px solid var(--line); }
.event-dialog__form .rft-inline { position: relative; width: 100%; }
.event-dialog__form .rft-frame { display: block; width: 100%; height: 600px; border: 0; background: transparent; transition: height .3s ease; }

@media (max-width: 640px) {
  .event-dialog {
    width: 100%; height: 100vh; height: 100dvh; max-height: none; border-radius: 0;
    box-shadow: none; animation-name: event-dialog-sheet;
  }
  .event-dialog__cover { height: auto; max-height: 240px; aspect-ratio: 361 / 215; border-radius: 0; }
  .event-dialog__info { padding: 20px 16px 4px; }
  .event-dialog__title { font-size: 24px; }
  .event-dialog__form { margin-top: 16px; padding: 16px 8px 24px; }
}
@keyframes event-dialog-sheet { from { opacity: 0; transform: translateY(24px); } }
@media (prefers-reduced-motion: reduce) {
  .event-dialog[open], .event-dialog[open]::backdrop { animation: none; }
  .event-dialog__form .rft-frame { transition: none; }
}
