/* ============================================
   Modal - Unfolding Animation
   savage.design
   ============================================ */

#modal-container {
  position: fixed;
  display: table;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  transform: scale(0);
  z-index: 200;
}

#modal-container.one {
  transform: scaleY(.01) scaleX(0);
  animation: unfoldIn 1s cubic-bezier(0.165, 0.840, 0.440, 1.000) forwards;
}

#modal-container.one .modal-background .modal {
  transform: scale(0);
  animation: zoomIn .5s .8s cubic-bezier(0.165, 0.840, 0.440, 1.000) forwards;
}

#modal-container.one.out {
  transform: scale(1);
  animation: unfoldOut 1s .3s cubic-bezier(0.165, 0.840, 0.440, 1.000) forwards;
}

#modal-container.one.out .modal-background .modal {
  animation: zoomOut .5s cubic-bezier(0.165, 0.840, 0.440, 1.000) forwards;
}

.modal-background {
  display: table-cell;
  background: rgba(0, 0, 0, .8);
  text-align: center;
  vertical-align: middle;
  cursor: none;
}

.modal {
  background: var(--color-white);
  padding: 3rem;
  display: inline-block;
  border-radius: 3px;
  font-weight: 300;
  position: relative;
  max-width: 90%;
  width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  cursor: auto;
}

.modal h2 {
  font-family: var(--font-primary);
  font-size: var(--h3-size);
  line-height: var(--h3-line-height);
  color: var(--color-black);
  margin-bottom: 1.5rem;
  font-weight: 800;
}

.modal p {
  font-family: var(--font-secondary);
  font-size: var(--p-size);
  line-height: var(--p-line-height);
  color: var(--color-black);
  margin-bottom: 1rem;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: none;
  color: var(--color-grey-1);
  padding: 0.5rem;
  transition: color 300ms ease;
}

.modal-close:hover {
  color: var(--color-black);
}

/* Form Styles */
.modal-form {
  margin-top: 2rem;
}

.form-group {
  margin-bottom: 1.5rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-family: var(--font-secondary);
  font-size: var(--p-sm-size);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-black);
  margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-secondary);
  font-size: var(--p-size);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 3px;
  background: var(--color-white);
  color: var(--color-black);
  transition: border-color 300ms ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Animations */
@keyframes unfoldIn {
  0% {
    transform: scaleY(.005) scaleX(0);
  }
  50% {
    transform: scaleY(.005) scaleX(1);
  }
  100% {
    transform: scaleY(1) scaleX(1);
  }
}

@keyframes unfoldOut {
  0% {
    transform: scaleY(1) scaleX(1);
  }
  50% {
    transform: scaleY(.005) scaleX(1);
  }
  100% {
    transform: scaleY(.005) scaleX(0);
  }
}

@keyframes zoomIn {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes zoomOut {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(0);
  }
}

/* Responsive */
@media (max-width: 799px) {
  .modal {
    padding: 2rem;
    width: 90%;
  }

  .modal h2 {
    font-size: var(--h4-size);
    line-height: var(--h4-line-height);
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .cta-button,
  .form-actions .sec-button {
    width: 100%;
    text-align: center;
  }
}

