/* The toast: one component, centred under the work column, every page (sys_design-system.md §11d). JS/core/toast.js
   owns behaviour and writes --toast-cx/--toast-span; this file owns place and look, separate so mobile.html skips the
   Suite shell. Tokens read the Suite `--a-*` value first, then CSS/tokens.css. `--z-alert` keeps a toast above a scrim. */
/* Fallback shadow, themed, for pages without the Suite token layer (mobile.html). */
:root{ --toast-shadow:0 14px 40px rgba(0,0,0,.45); }
:root.theme-light, body.theme-light{ --toast-shadow:0 14px 40px rgba(19,32,54,.18); }
/* The one positioned box. Width is the widest card (max-content), never the space right of `left`,
   which would halve it; the cap keeps the stack inside the work column with a 16px gutter. */
.a-toasts{
  position:fixed; z-index:var(--z-alert);
  left:var(--toast-cx, 50vw);
  bottom:calc(var(--a-6, 24px) + env(safe-area-inset-bottom, 0px));
  transform:translateX(-50%);
  width:max-content;
  max-width:min(560px, calc(var(--toast-span, 100vw) - 2 * var(--a-4, 16px)));
  /* A lone card keeps a readable width: a percentage min-width on the card resolves against this
     shrink-to-fit box and collapses to nothing, so the floor lives here. */
  min-width:min(320px, calc(var(--toast-span, 100vw) - 2 * var(--a-4, 16px)));
  display:flex; flex-direction:column; align-items:stretch; gap:var(--a-2, 8px);
  pointer-events:none;
}
.a-toasts:empty{ display:none; }
/* The card: a kind stripe (--toast-k) and a tinted glyph disc (--toast-kw); `position:relative` only
   anchors the countdown bar. */
.a-toast{
  --toast-k:var(--a-line-strong, var(--border-strong));
  --toast-kw:var(--a-blue-soft, var(--accent-soft));
  pointer-events:auto; box-sizing:border-box; position:relative; overflow:hidden;
  min-width:0; max-width:100%; min-height:48px;
  display:flex; align-items:center; gap:var(--a-3, 12px);
  padding:10px 8px 10px 12px; border-radius:var(--a-r, 9px);
  font-family:var(--a-body, var(--app-font, system-ui, sans-serif)); font-size:var(--a-fs-14); font-weight:400; line-height:var(--a-lh-ui);
  color:var(--a-text, var(--text));
  background:var(--a-float, var(--panel-2));
  border:1px solid var(--a-line-strong, var(--border-strong));
  border-left:4px solid var(--toast-k);
  box-shadow:var(--a-shadow, var(--toast-shadow));
  overflow-wrap:anywhere;
  animation:a-toast-in var(--dur-quick, 460ms) var(--ease-out, ease-out);
}
.a-toast.ok{ --toast-k:var(--green-text); --toast-kw:var(--green-soft); }
.a-toast.warn{ --toast-k:var(--warn-text); --toast-kw:var(--panel-2); --toast-kw:color-mix(in srgb, var(--warn-text) 14%, transparent); }
.a-toast.err{ --toast-k:var(--red-text); --toast-kw:var(--red-soft); }
.a-toast.undo, .a-toast.restore{ --toast-k:var(--accent); --toast-kw:var(--accent-soft); }
/* The undo card (role class `undo-toast`, set by undo-toast.js) is never squeezed by the stack: its button must stay whole. */
.undo-toast{ flex:0 0 auto; }
/* Held (hovered or focused): the countdown is frozen and the edge says so. */
.a-toast[data-held]{ border-color:var(--a-blue, var(--accent)); border-left-color:var(--toast-k); }
/* The glyph is drawn here, so the card's text is only its sentence (and the action's label). */
.a-toast-glyph{
  flex:0 0 26px; width:26px; height:26px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:var(--toast-kw); color:var(--toast-k);
  font-size:var(--a-fs-14); font-weight:700; line-height:var(--a-lh-ctl);
}
.a-toast-glyph::before{ content:"i"; font-style:normal; font-family:inherit; }
.a-toast.undo .a-toast-glyph, .a-toast.restore .a-toast-glyph{ color:var(--accent-text); } /* 3:1 on the wash, both themes */
.a-toast:not(.ok):not(.warn):not(.err):not(.undo):not(.restore) .a-toast-glyph{ color:var(--a-dim, var(--text-dim)); }
.a-toast.ok .a-toast-glyph::before{ content:"\2713"; font-style:normal; font-family:inherit; }
.a-toast.warn .a-toast-glyph::before{ content:"!"; font-style:normal; font-family:inherit; }
.a-toast.err .a-toast-glyph::before{ content:"\2715"; font-style:normal; font-family:inherit; }
.a-toast.undo .a-toast-glyph::before, .a-toast.restore .a-toast-glyph::before{ content:"\21B6"; font-style:normal; font-family:inherit; }
/* Three lines, then an ellipsis; the whole sentence is in `title` and is what a screen reader hears. */
.a-toast-text{
  flex:1 1 auto; min-width:0;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden;
}
/* The action is the card's one primary button (the Suite's `.a-btn.primary`, 32px) — the brightest thing on it. */
.a-toast-btn{
  flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center;
  height:var(--a-ctl, 32px); padding:0 12px; border:0; border-radius:var(--a-r-sm, 6px);
  background:var(--a-blue-fill, var(--accent-fill)); color:#fff;
  font-family:inherit; font-size:var(--a-fs-ctl); font-weight:var(--a-fw-ctl); line-height:var(--a-lh-ctl); white-space:nowrap; cursor:pointer;
  transition:filter var(--dur-micro, 140ms) linear;
}
.a-toast-btn:hover{ filter:brightness(1.08); }
.a-toast-key{
  flex:0 0 auto; font-family:var(--a-mono, ui-monospace, monospace); font-size:var(--a-fs-11); font-weight:400; line-height:var(--a-lh-tight);
  color:var(--a-faint, var(--text-faint));
}
.a-toast-key::before{ content:attr(data-key); }
/* Dismiss, on every card: a 24px target, drawn × so it adds nothing to the card's text. */
.a-toast-x{
  flex:0 0 24px; width:24px; height:24px; padding:0; border:0; border-radius:var(--a-r-sm, 6px);
  background:transparent; color:var(--a-faint, var(--text-faint)); cursor:pointer;
  font-family:inherit; font-size:var(--a-fs-18); line-height:var(--a-lh-ctl);
  transition:background-color var(--dur-micro, 140ms) linear, color var(--dur-micro, 140ms) linear;
}
.a-toast-x::before{ content:"\00D7"; }
.a-toast-x:hover{ background:var(--a-raised, var(--panel)); color:var(--a-text, var(--text)); }
/* The countdown: drains over the window JS sets (--toast-ms), frozen with the timer while held. */
.a-toast-bar{
  position:absolute; left:0; right:0; bottom:0; height:3px;
  background:var(--accent); transform-origin:left center;
  animation:a-toast-drain var(--toast-ms, 6000ms) linear forwards;
}
.a-toast[data-held] .a-toast-bar{ animation-play-state:paused; }
/* A card leaving: an inert copy JS places over the card it replaces, removed when this ends. */
.a-toast.a-toast-leaving{
  position:fixed; z-index:var(--z-alert); margin:0; pointer-events:none;
  animation:a-toast-out var(--dur-exit, 430ms) var(--ease-in, ease-in) forwards;
}
.a-toast-leaving .a-toast-bar{ animation:none; }
/* Rises 12px over --dur-quick: a card arriving (§2b). Leaves faster, dropping 6px. */
@keyframes a-toast-in{ from{ opacity:0; transform:translateY(12px); } }
@keyframes a-toast-out{ to{ opacity:0; transform:translateY(6px); } }
@keyframes a-toast-drain{ from{ transform:scaleX(1); } to{ transform:scaleX(0); } }
/* Reduced motion: no travel; the bar steps once a second. The state change itself is unchanged. */
@media (prefers-reduced-motion: reduce){
  .a-toast{ animation:none; }
  .a-toast-bar{ animation-timing-function:steps(var(--toast-steps, 6), end); }
}
/* A PHONE: the full bottom edge inside the 16px gutter, centred by construction. mobile.html is
   always the phone layout, at any width, so its <html> carries `data-toast-phone` and gets the same rule. */
:root[data-toast-phone] .a-toasts{
  left:calc(var(--a-4, 16px) + env(safe-area-inset-left, 0px));
  right:calc(var(--a-4, 16px) + env(safe-area-inset-right, 0px));
  bottom:calc(var(--a-4, 16px) + env(safe-area-inset-bottom, 0px));
  transform:none; width:auto; max-width:none; min-width:0; align-items:stretch;
}
:root[data-toast-phone] .a-toast-key{ display:none; }
@media (max-width:560px){
  .a-toasts{
    left:calc(var(--a-4, 16px) + env(safe-area-inset-left, 0px));
    right:calc(var(--a-4, 16px) + env(safe-area-inset-right, 0px));
    bottom:calc(var(--a-4, 16px) + env(safe-area-inset-bottom, 0px));
    transform:none; width:auto; max-width:none; min-width:0; align-items:stretch;
  }
  /* No keyboard on a phone: the shortcut hint goes. */
  .a-toast-key{ display:none; }
}
/* Off the printed page — the region, and the status slot by its own role class, because print
   packets name `#altStatus`/`.a-status` and a page can print before the slot is moved in. */
@media print{
  .a-toasts, .a-status, .a-toast-leaving{ display:none !important; }
}
