dialog,
::backdrop {
  opacity: 0;
}

dialog {
  transition: opacity 1s, display 1s allow-discrete, overlay 1s allow-discrete;
}

::backdrop {
  background: var(--peach-950);
}

[open] {
  opacity: 1;

  &::backdrop {
    opacity: 0.5;
  }
}

@starting-style {
  [open],
  [open]::backdrop {
    opacity: 0;
  }
}

dialog {
  background: var(--peach-100);
  border: none;
  border-radius: 1rem;
  box-sizing: border-box;
  padding: 0.75rem;
  width: 327px;
  height: 320px;
  overflow: hidden;
  transform: translateY(0%);

  #first,
  #second {
    display: flex;
    flex-direction: column;
    align-items: center;

    &[hidden=true] {
      display: none;
    }
  }

  #first {
    opacity: 1;
  }

  #second {
    opacity: 0;
  }

  .hide {
    animation: slide-out;
    animation-duration: 200ms;
    animation-fill-mode: forwards;
  }

  .show {
    animation: slide-in;
    animation-duration: 200ms;
    animation-delay: 200ms;
    animation-fill-mode: forwards;
  }

  .modal__title {
    text-align: center;
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
    font-family: "LoraBold", sans-serif;
    color: var(--grey-900);
    text-shadow: none;
    font-size: 1.5rem;
  }

  .modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    width: 1.5rem;
    background: var(--grey-600);
    border: 0;
    color: var(--peach-100);
    line-height: 1.5rem;
    border-radius: 0.5rem;
    margin: 0;
    padding: 0;

    &:hover {
      cursor: pointer;
      background: var(--grey-500);

      &:active {
        background: var(--grey-800);
      }
    }

    &::before {
      content: "\2715";
    }
  }

  h3 {
    font-family: "LoraBold";
    font-size: 1rem;
    color: var(--grey-900);
    margin-bottom: 0.5rem;
    overflow: hidden;
    max-width: 100%;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  p {
    text-align: center;
    line-height: 150%;
    font-size: 0.875rem;
    color: var(--grey-800);
    margin: 0;
  }

  #signature {
    margin-top: 1rem;
  }

  form {
    display: flex;
    align-items: start;
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
    gap: 0.5rem;

    #signup_email {
      font-family: "LoraRegular", serif;
      padding: 0.5rem;
      font-size: 0.875rem;
      border-radius: 0.5rem;
      border: 1px solid #BDBDBD;
      box-shadow: inset 0 2px 0 rgba(0,0,0,0.16);
      width: 190px;
    }

    #form-errors {
      position: absolute;
      bottom: 0.15rem;
      width: 300px;
      font-size: 0.75rem;
      color: var(--red-500);
    }
  }
}

@keyframes slide-out {
  from {
    opacity: 1;
    transform: translateX(0%);
  }
  to {
    opacity: 0;
    transform: translateX(-10%);
  }
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(10%);
  }
  to {
    opacity: 1;
    transform: translateX(0%);
  }
}
