html:has(.preact-modal dialog[open]) {
  overflow: hidden;
}

.preact-modal {
  dialog {
    overscroll-behavior: none;
    overflow-y: auto;
    position: fixed;
    width: calc(100vw - 48px);
    max-width: 950px;
    max-height: 500px;
    padding: 0;
    border: 1px solid var(--dark-color);
    margin: auto;

    &::backdrop {
      background-color: rgba(0, 0, 0, 0.3);
    }

    .modal-content {
      box-sizing: border-box;
      overflow-y: auto;
      overscroll-behavior: none;
      width: 100%;
      max-height: calc(100svh - (2 * var(--header-height)) - 48px);
      padding-bottom: 50px;

      @media (min-width: 1024px) {
        padding-top: 0;
      }
    }

    @media (min-width: 1024px) {
      width: calc(100vw - 64px);
      max-height: 600px;
    }

    .close-button {
      position: absolute;
      top: 0;
      right: 0;
      width: 44px;
      height: 44px;
      margin: 0;
      border: none;
      border-radius: 0;
      padding: 0;
      background-color: transparent;
      color: var(--tertiary-white);
      line-height: 0;

      .icon.icon-close {
        content: '';
        width: 24px;
        height: 24px;
      }

      &::before,
      &::after {
        content: '';
        box-sizing: border-box;
        display: block;
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%) rotate(45deg);
        width: 24px;
        height: 2px;
        border-radius: 2px;
        background-color: currentcolor;
      }

      &::after {
        transform: translate(-50%, -50%) rotate(-45deg);
      }
    }
  }
}
