/*
  Styles for the accessible Modal component. MIT licensed.
  Custom properties, system fonts, visible focus, reduced-motion respected.
*/
.modal-overlay {
  --modal-bg: #ffffff;
  --modal-ink: #0f172a;
  --modal-muted: #64748b;
  --modal-border: #e2e8f0;
  --modal-accent: #4f46e5;
  --modal-font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  z-index: 1000;
  animation: modal-fade 0.18s ease-out;
}

.modal-dialog {
  background: var(--modal-bg);
  color: var(--modal-ink);
  font-family: var(--modal-font);
  width: min(500px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
  animation: modal-rise 0.18s ease-out;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--modal-border);
}

.modal-title {
  margin: 0;
  font-size: 1.15rem;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--modal-muted);
  font-size: 1.6rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--modal-border);
  color: var(--modal-ink);
}

.modal-body {
  padding: 1.25rem;
  line-height: 1.5;
}

.modal-dialog:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid var(--modal-accent);
  outline-offset: 2px;
}

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

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

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  .modal-dialog {
    animation: none;
  }
}
