/* AhxToast - Figma "Toast" (AutoHX-Design node 40:96). Behaviour and API in
   public/scripts/lib/toast.js. Colours come from design-tokens.css only, so
   body.dark repaints the toast without a block of its own here. */

.ahx-toast-stack {
  position: fixed;
  top: var(--space-base);
  right: var(--space-base);
  z-index: 10000; /* above Fomantic dimmers/modals (1000-ish) */
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  max-width: calc(100vw - 2 * var(--space-base));
  pointer-events: none;
}

.ahx-toast {
  --ahx-toast-bg: var(--secondary-50);
  --ahx-toast-border: var(--secondary-200);
  --ahx-toast-action: var(--secondary-600);

  box-sizing: border-box;
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  width: 360px;
  max-width: 100%;
  padding: var(--space-base);
  background: var(--ahx-toast-bg);
  border: var(--space-px) solid var(--ahx-toast-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-family: var(--body-body-2-fontfamily), "Poppins", sans-serif;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ahx-toast.is-visible {
  opacity: 1;
  transform: none;
}

.ahx-toast--success {
  --ahx-toast-bg: var(--success-50);
  --ahx-toast-border: var(--success-200);
  --ahx-toast-action: var(--success-600);
}

.ahx-toast--warning {
  --ahx-toast-bg: var(--warning-50);
  --ahx-toast-border: var(--warning-200);
  --ahx-toast-action: var(--warning-600);
}

.ahx-toast--error {
  --ahx-toast-bg: var(--danger-50);
  --ahx-toast-border: var(--danger-200);
  --ahx-toast-action: var(--danger-600);
}

.ahx-toast__icon {
  flex-shrink: 0;
  display: block;
  width: var(--size-xl);
  height: var(--size-xl);
}

.ahx-toast__content {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-xs);
  word-break: break-word;
}

.ahx-toast__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs2);
  width: 100%;
}

/* Set on the <p>s themselves, not inherited from .ahx-toast__text: the
   global `p { line-height: 2 }` in public/styles/main.css targets them
   directly and would beat any inherited value. */
.ahx-toast__title,
.ahx-toast__description {
  margin: 0;
  font-size: var(--body-body-2-fontsize);
  line-height: var(--body-body-2-lineheight);
  letter-spacing: var(--body-body-2-letterspacing);
}

.ahx-toast__title {
  font-weight: var(--weights-medium);
  color: var(--color-text);
}

.ahx-toast__description {
  font-weight: var(--weights-regular);
  color: var(--color-text-secondary);
}

.ahx-toast__action {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
  font-size: var(--caption-caption-1-fontsize);
  line-height: var(--caption-caption-1-lineheight);
  letter-spacing: var(--caption-caption-1-letterspacing);
  font-weight: var(--weights-medium);
  color: var(--ahx-toast-action);
}

.ahx-toast__action:hover {
  text-decoration: underline;
}

.ahx-toast__close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--size-lg);
  height: var(--size-lg);
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
}

.ahx-toast__close img {
  display: block;
  width: var(--size-lg);
  height: var(--size-lg);
}

/* close.svg is painted black; flip it so it stays visible on dark surfaces */
body.dark .ahx-toast__close img {
  filter: invert(1);
}

.ahx-toast__action:focus-visible,
.ahx-toast__close:focus-visible {
  outline: 2px solid var(--ahx-toast-action);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .ahx-toast {
    transition: none;
  }
}
