/* =============================================================================
   ANNOUNCEMENT CARDS
   -----------------------------------------------------------------------------
   The toast system LAB DMT works in, carried across to domainchaos.com. LAB DMT
   is a standalone file and keeps its own inline copy; labs.llc extracted it so
   audio.html and chess.html could share one. This is that extraction, with one
   change of polarity described below — it is a port of the behaviour, not a
   refactor of it.

   Set as the rest of the site is: hairline card, eyebrow label, value
   underneath. The one departure is a shadow. A floating layer has to separate
   itself from whatever it is covering, and on paper a border alone does not do
   that.

   WHY A CARD AND NOT A LINE OF TEXT. This page answers every input by changing
   something on screen, and most of those changes are one word inside a dense
   strip — a set that lights, a slider that ticks over, a status chip that
   rewrites itself faster than you can read it. The card says what the control
   was and what value it arrived at, which is the part the screen does not say.

   OFF BY DEFAULT. The results themselves are enough for most people, and a page
   that narrates itself uninvited is a page that is talking over you. The
   exceptions are marked `always` at the call site: outcomes with no other
   surface anywhere on the page — a WHOIS lookup that could not reach the
   registry, a batch that was cancelled — where silence would be a bug rather
   than calm.

   Bottom-right on a desktop, so it never sits over the results column; hugging
   the right along the bottom on a phone, where there is no side to spare.

   THE TOKENS. Every value below is a --tst-* custom property so the two
   editions can repoint them without a second copy of the layout.

   THE POLARITY IS THE OTHER WAY ROUND HERE. In the labs tree the dark set is
   the default and html[data-edition="paper"] overrides it, because those pages
   are dark documents with a paper edition generated from them. On this site the
   paper edition is the source and the canonical one, so the default set below
   is the paper set and html[data-dark] does the overriding — the same rule the
   rest of this build follows, which is that the override sheet is the one that
   answers for the derived edition and never for the source.
   ========================================================================== */

:root {
    --tst-bg:        #ffffff;
    --tst-line:      rgba(30, 38, 43, .16);
    --tst-line-soft: rgba(30, 38, 43, .07);
    --tst-ink:       #1E262B;
    --tst-dim:       rgba(30, 38, 43, .60);
    --tst-faint:     rgba(30, 38, 43, .42);
    --tst-accent:    #C2410C;
    /* The only elevation shadow the paper edition allows, because a floating
       layer that does not separate from what it covers is unreadable at any ink
       weight. */
    --tst-shadow:    0 10px 30px rgba(30, 38, 43, .13), 0 2px 6px rgba(30, 38, 43, .07);
    --tst-mono:      ui-monospace, SFMono-Regular, Menlo, Consolas, 'Roboto Mono', monospace;
    --tst-ease:      cubic-bezier(.22, .61, .36, 1);
}

/* Above the menu, which is 200. A card raised while the panel is open — the
   edition switch records a choice, a copy succeeds — belongs on top of it. */
#toast-host {
    position: fixed; right: 22px; bottom: 22px; z-index: 9999;
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
    pointer-events: none;
    max-width: min(340px, calc(100vw - 44px));
}
.toast {
    pointer-events: auto;
    background: var(--tst-bg);
    border: 1px solid var(--tst-line);
    /* Square the corners the way every other box on a paper page is squared;
       the dark edition takes them back out to 12px. */
    border-radius: 5px;
    box-shadow: var(--tst-shadow);
    padding: 11px 14px;
    min-width: 172px; max-width: 100%;
    /* THE RESTING STATE IS VISIBLE, and the entrance is the exception. It was
       the other way round — opacity:0 with an .is-in class fading it up — which
       makes a card's visibility depend on a transition actually running. CSS
       transitions do not tick in a hidden or backgrounded tab, so a card raised
       while the reader was in another tab was appended at opacity 0, sat there
       invisible, and was swept by its own timer having never been painted. A
       batch of twenty-five WHOIS lookups finishing while you are reading
       something else is exactly that case. Now the worst a stalled transition
       can do is skip the fade. */
    opacity: 1; transform: none;
    transition: opacity .22s var(--tst-ease), transform .22s var(--tst-ease);
}
.toast.is-new { opacity: 0; transform: translateY(6px); transition: none; }
.toast.is-out { opacity: 0; transform: translateY(-4px); }

.toast__k {
    display: flex; align-items: center; gap: .5rem;
    font-size: .55rem; font-weight: 700; letter-spacing: .17em;
    text-transform: uppercase; color: var(--tst-dim);
}
/* The rule before the label is the same mark the section eyebrows use across
   the site; it is what makes a floating card read as part of the page. */
.toast__k::before {
    content: ''; width: 12px; height: 1px; background: var(--tst-accent); flex: 0 0 auto;
}
.toast__v {
    margin-top: .3rem;
    font-size: .84rem; font-weight: 500; letter-spacing: -.015em;
    color: var(--tst-ink); line-height: 1.35;
}
/* A figure inside a sentence stays monospaced and lines up — counts, lengths,
   response times, how many of twenty-five came back free. */
.toast__v em {
    font-style: normal; font-family: var(--tst-mono); font-size: .78rem;
    font-variant-numeric: tabular-nums; color: var(--tst-dim);
}

/* The one state worth flagging in colour: something that is still running
   whether or not the tab is being watched. A batch of lookups is exactly it. */
.toast.is-live { border-color: var(--tst-accent); }
.toast.is-live .toast__k { color: var(--tst-accent); }

/* THE GROUPED CARD. One press that changes four things is one card with four
   lines, not four cards — a list reads in a single glance and takes about a
   third of the room the stack did. */
.toast__list { margin: .35rem 0 0; padding: 0; list-style: none; }
.toast__list li {
    display: grid; grid-template-columns: 74px 1fr; gap: .55rem;
    align-items: baseline; padding: 2px 0;
}
.toast__list li + li { border-top: 1px solid var(--tst-line-soft); }
.toast__list b {
    font-size: .5rem; font-weight: 700; letter-spacing: .13em;
    text-transform: uppercase; color: var(--tst-faint);
}
.toast__list span {
    font-size: .76rem; font-weight: 500; color: var(--tst-ink);
    line-height: 1.3; letter-spacing: -.01em;
}
.toast__list em {
    font-style: normal; font-family: var(--tst-mono); font-size: .7rem;
    font-variant-numeric: tabular-nums; color: var(--tst-dim);
}
.toast--group .toast__v { margin-top: 0; }

@media (max-width: 720px) {
    /* Along the bottom, but only as much of it as is needed: the cards hug the
       right so the left of the results column stays visible behind them, and
       the stack can never grow past 42% of the screen. */
    #toast-host {
        left: auto; right: 10px; bottom: 10px;
        max-width: min(300px, calc(100vw - 20px));
        gap: 6px; max-height: 42vh; overflow: hidden;
    }
    .toast { min-width: 0; padding: 9px 11px; border-radius: 5px; }
    .toast__v { font-size: .78rem; }
    .toast__list li { grid-template-columns: 64px 1fr; gap: .45rem; }
}

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

/* -----------------------------------------------------------------------------
   THE DARK EDITION
   Same layout, re-polarised. These are the values LAB DMT itself runs at, which
   is where this component started — the paper set above is the port and this is
   the original. R2 applies to the shadow as much as to the washes: a drop
   shadow on paper is a soft grey at 13%, and the same shadow on the deep ground
   is invisible, so the dark card leans on a heavier black and its own hairline
   rather than on separation by shade alone.
   -------------------------------------------------------------------------- */
html[data-dark] {
    --tst-bg:        #14161a;
    --tst-line:      rgba(255, 255, 255, .15);
    --tst-line-soft: rgba(255, 255, 255, .08);
    --tst-ink:       #e9ebee;
    --tst-dim:       rgba(233, 235, 238, .58);
    --tst-faint:     rgba(233, 235, 238, .34);
    --tst-accent:    #ff8800;
    --tst-shadow:    0 12px 34px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .40);
}
html[data-dark] .toast { border-radius: 12px; }
@media (max-width: 720px) { html[data-dark] .toast { border-radius: 10px; } }
