/**
 * 1. Make the dialog container, and its child overlay spread across
 *    the entire window.
 */
.dialog-container,
.dialog-overlay {
  position: fixed; /* 1 */
  top: 0; /* 1 */
  right: 0; /* 1 */
  bottom: 0; /* 1 */
  left: 0; /* 1 */
}

/**
  * 1. Make sure the dialog container and all its descendants sits on
  *    top of the rest of the page.
  * 2. Make the dialog container a flex container to easily center the
  *    dialog.
  */
.dialog-container {
  z-index: 2; /* 1 */
  display: flex; /* 2 */
}

/**
  * 1. Make sure the dialog container and all its descendants are not
  *    visible and not focusable when it is hidden.
  */
.dialog-container[aria-hidden='true'] {
  display: none; /* 1 */
}

/**
  * 1. Make the overlay look like an overlay.
  */
.dialog-overlay {
  background-color: rgb(43 46 56 / 0.9); /* 1 */
  animation: fade-in 200ms both;
}

/**
  * 1. Vertically and horizontally center the dialog in the page.
  * 2. Make sure the dialog sits on top of the overlay.
  * 3. Make sure the dialog has an opaque background.
  */
.dialog-content {
  margin: auto; /* 1 */
  z-index: 2; /* 2 */
  position: relative; /* 2 */
  background-color: white; /* 3 */

  animation: fade-in 400ms 200ms both, slide-up 400ms 200ms both;
  padding: 1em;
  max-width: 90%;
  width: 600px;
  border-radius: 5px;
}

@media screen and (min-width: 700px) {
  .dialog-content {
    padding: 2em;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes slide-up {
  from {
    transform: translateY(10%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .dialog-overlay,
  .dialog-content {
    animation: none;
  }
}

.dialog-content h1 {
  margin: 0;
  font-size: 1.25em;
}

.dialog-close {
  position: absolute;
  top: 0.5em;
  right: 0.5em;
  border: 0;
  padding: 0.25em;
  background-color: transparent;
  font-size: 1.5em;
  width: 1.5em;
  height: 1.5em;
  text-align: center;
  cursor: pointer;
  transition: 0.15s;
  border-radius: 50%;
}

.dialog-close:hover {
  background-color: rgb(50 50 0 / 0.15);
}

@media screen and (min-width: 700px) {
  .dialog-close {
    top: 1em;
    right: 1em;
  }
}

* {
  box-sizing: border-box;
}

body {
  font: 125% / 1.5 -apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial,
    sans-serif;
  padding: 2em 0;
}

h1 {
  font-size: 1.6em;
  line-height: 1.1;
}

h1 span {
  color: #e50050;
}

h1,
h2 {
  font-family: 'ESPI Slab', sans-serif;
  margin-bottom: 0;
}

.link-like,
a {
  color: #2984c2;
}

.link-like:hover,
.link-like:active,
a:hover,
a:active {
  color: #e50050;
}

/* -------------------------------------------------------------------------- *\
 * Helpers
 * -------------------------------------------------------------------------- */

.link-like {
  background-color: transparent;
  text-decoration: underline;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

/* -------------------------------------------------------------------------- *\
 * Layout
 * -------------------------------------------------------------------------- */

main {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1em;
}

footer {
  border-top: 1px solid silver;
  padding: 20px 0;
}

/* -------------------------------------------------------------------------- *\
 * Form styling
 * -------------------------------------------------------------------------- */

form {
  margin-top: 2em;
}

@media screen and (min-width: 700px) {
  form {
    display: flex;
    flex-wrap: wrap;
  }
}

form label {
  font-weight: bold;
  margin: 5px 10px 5px 0;
  vertical-align: middle;
  flex: 1 0 100%;
}

form input {
  font: inherit;
  padding: 0.25em;
  border: 1px solid #81c784;
  width: 100%;
  margin: 0.25em 0 1em;
}

@media screen and (min-width: 700px) {
  form input {
    flex: 1;
    border-right: 0;
    width: auto;
    margin: 0;
  }
}

form button {
  background-color: #81c784;
  color: white;
  border: 0;
  font-family: inherit;
  font-size: inherit;
  padding: 8px 15px;
  cursor: pointer;
  transition: 0.15s;
  display: inline-block;
}

form button:hover,
form button:active {
  background-color: #66bb6a;
}
