/* Modals, toasts and the command palette. */

.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
}
.modal::backdrop { background: rgb(0 0 0 / 0.6); backdrop-filter: blur(2px); }

.modal__panel {
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modal-in var(--duration) var(--ease-out);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.modal__header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-thin);
}
.modal__title { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.modal__body { padding: var(--space-5); max-height: 60vh; overflow-y: auto; }
.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-5);
  border-top: var(--border-thin);
  background: var(--c-surface-sunken);
}
.modal--wide { max-width: min(880px, calc(100vw - 2rem)); }

.toasts {
  position: fixed;
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: 380px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--c-surface-raised);
  border: 1px solid var(--c-border-strong);
  border-left-width: 3px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: var(--text-sm);
  pointer-events: auto;
  animation: toast-in var(--duration) var(--ease-out);
}
.toast--ok     { border-left-color: var(--c-ok); }
.toast--warn   { border-left-color: var(--c-warn); }
.toast--danger { border-left-color: var(--c-danger); }
.toast--info   { border-left-color: var(--c-info); }
.toast[data-leaving="true"] { animation: toast-out var(--duration) var(--ease) forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* Command palette: keyboard-first navigation across every feature. */
.palette { max-width: min(620px, calc(100vw - 2rem)); }
.palette__input {
  width: 100%;
  padding: var(--space-4) var(--space-5);
  font: inherit;
  font-size: var(--text-lg);
  color: var(--c-text);
  background: transparent;
  border: none;
  border-bottom: var(--border-thin);
}
.palette__input:focus { outline: none; }
.palette__list { list-style: none; margin: 0; padding: var(--space-2); max-height: 50vh; overflow-y: auto; }
.palette__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: var(--text-sm);
}
.palette__item[aria-selected="true"] { background: var(--c-accent-sunken); color: var(--c-accent); }
.palette__hint { margin-left: auto; font-size: var(--text-xs); color: var(--c-text-subtle); }

kbd {
  padding: 1px var(--space-1);
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--c-surface-sunken);
  border: 1px solid var(--c-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
}
