/*
 * Things that float above the page: popovers, toasts, the command palette
 * and the one modal. Each enters from where it belongs (a popover from its
 * button, a toast from the bottom edge) and leaves faster than it came.
 */

/* ── Popovers ───────────────────────────────────────────────────────────── */

.v-pop-wrap { position: relative; }
.v-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 300px;
  max-height: min(480px, 70vh);
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--r-3);
  background: var(--raise);
  box-shadow: var(--pop-shadow);
  transform-origin: top right;
  animation: dk-pop-in 0.16s var(--e-out);
}
.v-pop-left { left: 0; right: auto; transform-origin: top left; }
@keyframes dk-pop-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } }
.v-pop-head { padding: 8px 10px 6px; color: var(--ink-3); font-size: var(--t-12); font-weight: 550; }
.v-pop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: var(--r-2);
  color: var(--ink);
  font-size: var(--t-14);
  text-align: left;
  text-decoration: none;
}
.v-pop-item .ic { width: 16px; height: 16px; color: var(--ink-3); }
.v-pop-item:hover,
.v-pop-item[aria-checked="true"] { background: var(--raise-2); text-decoration: none; }
.v-pop-empty { padding: 8px 10px 10px; color: var(--ink-3); font-size: var(--t-13); line-height: 1.5; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */

.dk-toasts {
  position: fixed;
  bottom: var(--s-5);
  left: 50%;
  z-index: 90;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: var(--s-2);
  width: min(440px, calc(100vw - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}
.dk-toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  max-width: 100%;
  min-height: 44px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--r-3);
  background: #1b1c21;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 16px 40px -10px rgba(0, 0, 0, 0.55);
  color: #ededf0;
  font-size: var(--t-14);
  pointer-events: auto;
  transition: opacity 0.2s var(--e-out), transform 0.2s var(--e-out);
  @starting-style { opacity: 0; transform: translateY(12px) scale(0.98); }
}
.dk-toast[data-leaving] { opacity: 0; transform: translateY(6px) scale(0.98); transition-duration: 0.14s; }
.dk-toast-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--g-400); }
.dk-toast[data-tone="bad"] .dk-toast-dot { background: #f0584c; }
.dk-toast-text { flex: 1; min-width: 0; line-height: 1.4; }
.dk-toast-act {
  flex: none;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: var(--t-13);
  font-weight: 600;
}
.dk-toast-act:hover { background: rgba(255, 255, 255, 0.16); }

/* ── The command palette ────────────────────────────────────────────────── */

.dk-palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh var(--s-4) var(--s-4);
  background: rgba(8, 9, 12, 0.42);
  opacity: 1;
  transition: opacity 0.15s var(--e-out);
  @starting-style { opacity: 0; }
}
.dk-palette[data-leaving] { opacity: 0; transition-duration: 0.12s; }
.dk-pal-box {
  display: flex;
  flex-direction: column;
  width: min(580px, 100%);
  max-height: 64vh;
  overflow: hidden;
  border-radius: var(--r-4);
  background: var(--raise);
  box-shadow: var(--pop-shadow);
  transform-origin: top center;
  transition: transform 0.18s var(--e-out);
  @starting-style { transform: scale(0.97) translateY(-6px); }
}
.dk-pal-in {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 6px 6px 0;
  padding: 0 var(--s-4);
  border-radius: 14px;
  background: var(--raise-2);
  color: var(--ink-3);
}
.dk-pal-in input {
  flex: 1;
  height: 52px;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: var(--t-16);
  outline: 0;
}
.dk-pal-in input::placeholder { color: var(--ink-4); }
.dk-pal-list { overflow-y: auto; padding: 6px; }
.dk-pal-group { padding: 10px 10px 4px; color: var(--ink-4); font-size: var(--t-12); font-weight: 550; }
.dk-pal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--r-2);
  color: var(--ink);
  font-size: var(--t-14);
  text-align: left;
}
.dk-pal-item .ic { width: 16px; height: 16px; color: var(--ink-3); }
.dk-pal-item[aria-selected="true"] { background: var(--raise-2); }
.dk-pal-item[aria-selected="true"] .ic { color: var(--accent); }
.dk-pal-hint { margin-left: auto; color: var(--ink-4); font-size: var(--t-12); }
.dk-pal-none { padding: var(--s-6) var(--s-4); color: var(--ink-3); text-align: center; }
.dk-pal-foot {
  display: flex;
  gap: var(--s-4);
  padding: 10px var(--s-4);
  color: var(--ink-4);
  font-size: var(--t-12);
}
.dk-pal-foot span { display: inline-flex; align-items: center; gap: 6px; }
