/* ============================================================
   Legendary Herald (Package A, Feature 4) — top-center toasts.
   All animations are opacity/transform-only (project constraint).
   #herald-container is its OWN element — never reuse Play.cshtml's
   #toast-container.
   ============================================================ */

/* Descent Phase B1 VP1-fix fix round 1, Ruling R-VP1-2 (M3): the herald never covers the navigation or a modal. z 990 keeps it under the
   dropdowns (1000), Bootstrap's modals (1050+) and the site's own (the marketplace's 1000, the chests' 9999); below xl it sits under the
   navbar (in the page's flow, its bottom at 72 px); on the Game layout under its header, and under its modals (--z-modal 300). It moves
   down by the ticker's strip while that shows (ticker.css). Docked in the dungeon, dungeon.css places it. */
#herald-container {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 990;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: min(440px, 94vw);
    pointer-events: none;
}

#herald-container .hidden {
    display: none;
}

body.ticker-on #herald-container { top: 36px; }

@media (max-width: 1199.98px) {
    #herald-container { top: 80px; }
    body.ticker-on #herald-container { top: 104px; }
}

.game-body:not(.dungeon-active) #herald-container {
    top: calc(var(--header-height, 50px) + 8px);
    z-index: 250;
}

.game-body.ticker-on:not(.dungeon-active):has(#view-mainmenu.active, #view-character.active, #view-modeselect.active, #view-season.active) #herald-container {
    top: calc(var(--header-height, 50px) + 32px);
}

body.modal-open #herald-container { display: none; }

/* Ruling R-VP1-3 (VP1-fix fix round 2): no herald during combat. Solo and Raid fight in the Game layout's combat view (herald.js drops what
   arrives there; this hides a toast that was up before); a dungeon run hides its docked herald in dungeon.css */
.game-body:has(#view-combat.active) #herald-container { display: none; }

/* the close control: a 28 px mark with a 44 px hit area, at the head's end */
.herald-close {
    position: relative;
    flex: none;
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    margin: -6px -8px -6px auto;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9fb4c8;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}

.herald-close::after {
    content: '';
    position: absolute;
    inset: -8px;
}

.herald-close:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.herald-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.herald-collapse-count:not(.hidden) ~ .herald-close { margin-left: 6px; }

.herald-toast {
    pointer-events: auto;
    cursor: pointer;
    width: 100%;
    background: rgba(15, 18, 32, 0.96);
    border: 1px solid #ff6b35;
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    color: #e8e8ef;
    font-size: 0.85rem;
    animation: herald-in 0.25s ease;
}

.herald-toast.herald-leaving {
    opacity: 0;
    transition: opacity 0.25s ease;
}

@keyframes herald-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.herald-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.herald-kind {
    font-weight: 700;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
}

.herald-kind-legendary .herald-kind { color: #ff6b35; }
.herald-kind-transcendent .herald-kind { color: #ffd43b; }
.herald-kind-godroll .herald-kind { color: #a855f7; }
.herald-kind-enhance .herald-kind { color: #03c3ec; }

/* Transcendent glow: opacity-only animation on a pseudo-element */
.herald-toast.herald-kind-transcendent {
    border-color: #ffd43b !important;
    position: relative;
}

.herald-toast.herald-kind-transcendent::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 12px;
    box-shadow: 0 0 18px 4px rgba(255, 212, 59, 0.45);
    animation: herald-glow 1.6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes herald-glow {
    0%, 100% { opacity: 0.25; }
    50% { opacity: 1; }
}

/* Honest-labeling ribbons (spec-blocking): never presented as organic luck */
.herald-ribbon {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 1px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.herald-ribbon-streak {
    background: rgba(255, 107, 53, 0.18);
    color: #ff9f43;
    border: 1px solid rgba(255, 159, 67, 0.5);
}

.herald-ribbon-pity {
    background: rgba(3, 195, 236, 0.15);
    color: #03c3ec;
    border: 1px solid rgba(3, 195, 236, 0.5);
}

/* Descent B2 Task 10: a Veiled Broker pull (ItemDropSource.Gamble), the Broker's violet; about 7:1 on the toast (herald-broker.test.js) */
.herald-ribbon-broker {
    background: rgba(167, 139, 250, 0.16);
    color: #c4b5fd;
    border: 1px solid rgba(167, 139, 250, 0.5);
}

.herald-collapse-count {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    padding: 0 8px;
    font-weight: 700;
    font-size: 0.72rem;
}

.herald-body {
    line-height: 1.35;
}

.herald-player { font-weight: 600; }
.herald-item { font-weight: 700; }

.herald-quality {
    margin-left: 6px;
    color: #9fb4c8;
    font-size: 0.75rem;
}

/* Task 19b: a v2 herald says its rarity in words beside the name (the colour is the rarity token, era-items.css: never colour alone) */
.herald-rarity {
    margin-left: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Task 19b: a v2 herald's card is the shared item card (EraItems), inside the popover */
.herald-card .ei-card { margin: 0; max-width: 100%; }

/* Click-through stat card (rendered from the captured payload) */
.herald-card {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.herald-card-name { font-weight: 700; font-size: 0.9rem; }
.herald-card-meta { color: #9fb4c8; font-size: 0.72rem; margin-bottom: 4px; }
.herald-card-prop { font-size: 0.78rem; color: #c9d6e3; }
.herald-card-quality { margin-top: 6px; font-size: 0.75rem; color: #9fb4c8; }
.herald-transcendent-text { color: #ffd43b; font-weight: 700; }
.herald-card-source { font-size: 0.7rem; color: #7c8ba1; margin-top: 2px; }

.herald-card-profile {
    display: inline-block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #03c3ec;
    text-decoration: none;
}

.herald-card-profile:hover {
    text-decoration: underline;
}

@media (max-width: 480px) {
    .herald-toast {
        font-size: 0.78rem;
        padding: 8px 10px;
    }
}
