You now know how to design a modal system.
Architecture: ModalProvider + Portal rendering + stacked modals.
Focus: Trap inside modal. Restore to trigger on close.
Keyboard: Escape closes. Tab cycles within. Enter activates.
Accessibility: role="dialog", aria-modal, aria-labelledby.
Stacking: Track modal stack. Close topmost on Escape.
Animation: Fade/scale in. Wait for exit animation before unmount.
Interview tip: Lead with accessibility. Focus management is the most overlooked aspect.