.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  font-size: 1em;
  width: 45em;
  max-width: calc(100% - 2em);
  min-width: 10em;
  transform: translate(-50%, -50%);
  opacity: 0;
  perspective: 1000px;
  transition: opacity var(--layout-timing-extra-fast);
  z-index: var(--z-index-modal);
}

.modal-large {
  width: 65em;
  max-width: calc(100% - 2em);
}

.modal-small {
  width: 30em;
}

.modal-wrapper {
  background-color: rgb(var(--theme-color-01));
  border-radius: var(--theme-radius);
  box-shadow: var(--layout-shadow-large);
  position: relative;
  max-height: calc(100vh - 2em);
  overflow-y: auto;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  justify-items: stretch;
  align-items: stretch;
  transition: opacity var(--layout-timing-extra-fast);
}

.modal-wrapper .container {
  max-width: 100%;
}

.modal-body {
  border-radius: var(--theme-radius) var(--theme-radius) 0 0;
  padding: 2em;
  overflow-y: auto;
  box-sizing: border-box;
  z-index: 1;
  position: relative;
}

.modal-heading {
  overflow-x: hidden;
}

.modal-heading:focus {
  outline: none;
}

.modal-controls {
  background-color: rgb(var(--theme-color-01));
  border-radius: 0 0 var(--theme-radius) var(--theme-radius);
  position: relative;
  z-index: 2;
  display: flex;
}

.modal-button {
  background-color: transparent;
  margin: 0;
  padding-top: 1.5em;
  padding-bottom: 1.5em;
  flex-basis: 50%;
}

.modal-button:after {
  background-color: transparent;
}

.modal-controls .modal-button:first-child,
.modal-controls .modal-button:first-child:after {
  border-radius: 0 0 0 var(--theme-radius);
}

.modal-controls .modal-button:last-child,
.modal-controls .modal-button:last-child:after {
  border-radius: 0 0 var(--theme-radius) 0
}
