/* Stack: notifications that sit behind each other and fan out when you hover. */

.stack {
  position: fixed;
  right: var(--sk-inset);
  bottom: var(--sk-inset);
  z-index: 50;
  box-sizing: border-box;
  width: min(var(--sk-width), calc(100vw - 2 * var(--sk-inset)));
  display: flex;
  flex-direction: column;
  gap: var(--sk-gap);
  font-family: var(--sk-font);
  font-size: 14px;
  color: var(--sk-ink);
}

.stack:focus { outline: none; }

/* Header: count and "Clear all". Shows while the stack is open. */
.stack__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
  font-size: 13px;
  color: var(--sk-muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--sk-fade) linear;
}

.stack[data-open="true"] .stack__head { opacity: 1; pointer-events: auto; }

.stack__clear {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--sk-accent-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.stack__clear[hidden] { display: none; }

/* The list. Its height and every card's place are set by stack.js. */
.stack__list {
  position: relative;
  height: var(--sk-list-height, 0px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.stack--ready .stack__list { transition: height var(--sk-duration) var(--sk-ease); }

.stack__toast {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  background: var(--sk-surface);
  border-radius: var(--sk-radius);
  box-shadow: var(--sk-shadow);
  transform-origin: 50% 100%;
  transform: translate(var(--sk-x, 0px), var(--sk-y, 0px)) scale(var(--sk-scale, 1));
  opacity: var(--sk-opacity, 1);
  z-index: var(--sk-z, 1);
}

.stack--ready .stack__toast {
  transition:
    transform var(--sk-duration) var(--sk-ease) var(--sk-delay, 0ms),
    opacity var(--sk-duration) var(--sk-ease) var(--sk-delay, 0ms);
}

.stack__icon {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.stack__icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.stack__toast[data-tone="success"] .stack__icon { background: var(--sk-success-soft); color: var(--sk-success); }
.stack__toast[data-tone="success"] .stack__icon svg { stroke-width: 2; }
.stack__toast[data-tone="info"] .stack__icon { background: var(--sk-info-soft); color: var(--sk-info); }
.stack__toast[data-tone="accent"] .stack__icon { background: var(--sk-accent-soft); color: var(--sk-accent-text); }
.stack__toast[data-tone="person"] .stack__icon { background: var(--sk-avatar); color: var(--sk-ink); border-radius: 50%; }

.stack__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stack__row { display: flex; justify-content: space-between; gap: 8px; }

.stack__title { margin: 0; font-weight: 600; }

.stack__time { flex: none; font-size: 12px; color: var(--sk-muted); }

.stack__message { margin: 0; color: var(--sk-muted); overflow-wrap: anywhere; }

.stack__dismiss {
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px 0 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sk-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.stack__dismiss svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

.stack__dismiss:hover { color: var(--sk-ink); background: var(--sk-bg); }

.stack__clear:focus-visible,
.stack__dismiss:focus-visible {
  outline: 2px solid var(--sk-focus);
  outline-offset: 2px;
}

.stack__live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Reduced motion: nothing moves. The cards behind the front one fade in where they belong. */
@media (prefers-reduced-motion: reduce) {
  .stack--ready .stack__list { transition: none; }
  .stack--ready .stack__toast { transition: opacity var(--sk-fade) linear; }
}
