/* =========================================================
   Shared modal behavior
========================================================= */

.preorder-modal[hidden],
.email-options-modal[hidden] {
  display: none;
}

.preorder-modal,
.email-options-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;

  display: grid;
  place-items: center;

  padding: 20px;
}

.email-options-modal {
  z-index: 1100;
}

.preorder-modal__backdrop,
.email-options-modal__backdrop {
  position: absolute;
  inset: 0;

  background: rgba(45, 35, 40, 0.6);
  backdrop-filter: blur(5px);
}


/* =========================================================
   Pre-order modal
========================================================= */

.preorder-modal__panel {
  position: relative;
  z-index: 1;

  width: min(100%, 500px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  padding: 36px 30px 30px;

  color: var(--color-text);
  background:
    linear-gradient(
      160deg,
      #fffdfc,
      #fdf4fb
    );

  border: 1px solid var(--color-purple-border);
  border-radius: var(--radius-large);

  text-align: center;

  box-shadow:
    0 35px 90px rgba(37, 27, 33, 0.3);

  animation: modal-enter 180ms ease-out;
}

.preorder-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 42px;
  height: 42px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: 0;

  color: var(--color-muted);
  background: var(--color-purple-soft);

  border: 0;
  border-radius: 50%;

  font-size: 1.1rem;
  cursor: pointer;

  transition:
    color var(--transition-fast),
    background var(--transition-fast),
    transform var(--transition-fast);
}

.preorder-modal__close:hover {
  color: var(--color-purple-dark);
  background: rgba(150, 87, 191, 0.2);
  transform: rotate(4deg);
}

.preorder-modal__close:focus-visible {
  outline: 3px solid rgba(150, 87, 191, 0.32);
  outline-offset: 3px;
}

.preorder-modal__icon {
  width: 64px;
  height: 64px;

  display: inline-flex;
  align-items: center;
  justify-content: center;

  margin-bottom: 10px;

  color: var(--color-white);
  background:
    linear-gradient(
      135deg,
      var(--color-purple),
      var(--color-purple-dark)
    );

  border-radius: 50%;

  font-size: 1.55rem;

  box-shadow:
    0 10px 24px rgba(90, 53, 110, 0.22);
}

.preorder-modal h2 {
  margin: 0 0 20px;

  color: var(--color-brown);

  font-family: var(--font-brand);
  font-size: clamp(3rem, 9vw, 4rem);
  font-weight: 400;
  line-height: 1;
}

.preorder-modal__content {
  color: var(--color-muted);
  font-size: 0.97rem;
  line-height: 1.65;
  text-align: left;
}

.preorder-modal__content p {
  margin-bottom: 15px;
}

.preorder-modal__content ul {
  margin: 0 0 20px;
  padding-left: 22px;
}

.preorder-modal__content li + li {
  margin-top: 7px;
}


/* =========================================================
   Email options modal
========================================================= */

.email-options-modal__panel {
  position: relative;
  z-index: 1;

  width: min(100%, 460px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;

  padding: 34px 28px 28px;

  color: var(--color-text);
  background:
    linear-gradient(
      160deg,
      var(--color-surface),
      var(--color-surface-soft)
    );

  border: 1px solid var(--color-purple-border);
  border-radius: var(--radius-large);

  text-align: center;

  box-shadow:
    0 35px 90px rgba(37, 27, 33, 0.32);

  animation: modal-enter 180ms ease-out;
}

.email-options-modal__close {
  position: absolute;
  top: 14px;
  right: 14px;

  width: 42px;
  height: 42px;

  display: grid;
  place-items: center;

  padding: 0;

  color: var(--color-muted);
  background: var(--color-purple-soft);

  border: 0;
  border-radius: 50%;

  font-size: 1.1rem;
  cursor: pointer;
}

.email-options-modal__close:hover {
  color: var(--color-purple-dark);
  background: rgba(150, 87, 191, 0.2);
}

.email-options-modal__close:focus-visible {
  outline: 3px solid rgba(150, 87, 191, 0.32);
  outline-offset: 3px;
}

.email-options-modal__icon {
  width: 62px;
  height: 62px;

  display: grid;
  place-items: center;

  margin: 0 auto 12px;

  color: var(--color-white);
  background:
    linear-gradient(
      135deg,
      var(--color-purple),
      var(--color-purple-dark)
    );

  border-radius: 50%;

  font-size: 1.4rem;
}

.email-options-modal h2 {
  margin: 0 0 8px;

  color: var(--color-brown);

  font-family: var(--font-brand);
  font-size: 3.4rem;
  font-weight: 400;
  line-height: 1;
}

.email-options-modal__panel > p {
  color: var(--color-muted);
}

.email-options {
  display: grid;
  gap: 12px;

  margin-top: 24px;
}

.email-options-status {
  min-height: 1.5em;
  margin: 18px 0 0;

  color: var(--color-purple-dark);
  font-size: 0.88rem;
  font-weight: 600;
}

.email-options-modal__fallback {
  margin: 8px 0 0;

  color: var(--color-muted);
  font-size: 0.84rem;
}


/* =========================================================
   Modal animation
========================================================= */

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
