/* Toasts: short confirmations after a save or send (design pack part 7, switch [ui] toasts, default off).
   Markup: app/templates/_toasts.html (notice, toasts). Script: toast.js (timers, window.toast). Docs: docs/ui-switches.md.
   Glow family: a card with a 1px top hairline and a tint of the kind's colour, never a left stripe, no blur.
   Colours come from the site's own tokens (admin: --card --ink --muted --hairline; public: --surface --ink --ink-soft
   --border) with the amarbaro dark values as the last fallback. Only transform and opacity move, inside the
   no-preference query; the final state is visible without JS. */
.toasts {
  --t-card: var(--card, var(--surface, #0E131B));
  --t-ink: var(--ink, #E6EAF0);
  --t-mut: var(--muted, var(--ink-soft, #8A94A3));
  --t-line: var(--hairline, var(--border, #1C2430));
  --t-mono: var(--stat-mono, 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  position: fixed;
  z-index: 80;
  right: 24px;
  bottom: calc(24px + var(--lift, 0px)); /* --lift: the open consent card's height, set by toast.js */
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(400px, calc(100vw - 32px));
  pointer-events: none; /* the region never blocks the page; each toast takes pointer events back */
}
.toast {
  --c: var(--stat-olive, #9DAE51);
  position: relative;
  pointer-events: auto;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  grid-template-areas: "ic msg x" ". act x";
  column-gap: 12px;
  align-items: start;
  box-sizing: border-box;
  padding: 12px 12px 12px 16px;
  color: var(--t-ink);
  font: 400 14px/1.45 var(--font-body, Inter, system-ui, sans-serif);
  background: linear-gradient(180deg, color-mix(in oklab, var(--c) 10%, var(--t-card)), var(--t-card) 60%);
  border: 1px solid var(--t-line);
  border-radius: 12px;
}
.toast::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c), transparent);
}
.toast[data-kind="success"] { --c: var(--stat-olive, #9DAE51); }
.toast[data-kind="info"] { --c: var(--stat-blue, #4FA3D9); }
.toast[data-kind="warn"] { --c: var(--stat-gold, #C9A445); }
.toast[data-kind="error"] { --c: var(--danger, #F0705C); }

.toast__ic {
  grid-area: ic;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  color: color-mix(in srgb, var(--c) 50%, var(--t-ink)); /* accent pulled toward the text colour keeps 4.5:1 on a light card */
}
.toast__msg { grid-area: msg; min-width: 0; padding: 2px 0; overflow-wrap: anywhere; }
.toast__title { display: block; font-weight: 650; color: var(--t-ink); }
.toast__text { display: block; color: var(--t-mut); }
.toast__text--solo { color: var(--t-ink); }
.toast__act {
  grid-area: act;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: 600 13px/1 var(--t-mono);
  color: color-mix(in srgb, var(--c) 50%, var(--t-ink));
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast__x {
  grid-area: x;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -12px -12px -12px 0;
  padding: 0;
  color: var(--t-mut);
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.toast__x[hidden] { display: none; }
.toast__x svg { width: 16px; height: 16px; }
.toast__x:hover { color: var(--t-ink); }
.toast__x:focus-visible,
.toast__act:focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px color-mix(in oklab, var(--c) 24%, transparent);
}

@media (max-width: 640px) {
  .toasts { right: 16px; left: 16px; bottom: calc(16px + var(--lift, 0px)); width: auto; }
}
@media (forced-colors: active) {
  .toast { border: 1px solid CanvasText; background: Canvas; }
}

@media (prefers-reduced-motion: no-preference) {
  .toast {
    transition: opacity var(--m-base, 200ms) var(--m-out, cubic-bezier(.23, 1, .32, 1)), transform var(--m-base, 200ms) var(--m-out, cubic-bezier(.23, 1, .32, 1));
  }
  @starting-style {
    .toast { opacity: 0; transform: translateY(8px); }
  }
  .toast[data-leaving] {
    opacity: 0;
    transform: translateY(4px);
    transition-duration: var(--m-fast, 150ms);
  }
}
