.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
}

.modal[data-open='true'] {
  display: flex;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(13, 29, 61, 0.6);
  animation: modal-fade var(--transition-base);
}

.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-pop var(--transition-base);
}

.modal__close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--color-bg-muted);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: background-color var(--transition-fast);
}

.modal__close:hover {
  background-color: var(--color-border);
}

.modal__close svg {
  width: 16px;
  height: 16px;
}

@keyframes modal-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modal-pop {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal__backdrop,
  .modal__dialog {
    animation: none;
  }
}
