/* ---- Private messages: reply-to context ---- */

.post[id^="message-"] {
    position: relative;
    scroll-margin-top: 96px;
}

/* Overlay instead of animating .post's own background: the post keeps its
   glass panel underneath, so removing the highlight fades out to the real
   background instead of snapping once the animation ends. */
.post[id^="message-"]::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: rgba(204, 0, 68, 0.16);
    box-shadow: inset 0 0 0 1px var(--accent-border), inset 3px 0 0 var(--accent-bright);
    opacity: 0;
    transition: opacity 0.5s ease;
}
.post[id^="message-"].is-reply-highlight::after {
    opacity: 1;
    transition: opacity 0.12s ease;
}

.post-reply-context {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid var(--line-soft);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
a.post-reply-context:hover {
    background: rgba(255, 255, 255, 0.055);
    color: var(--text);
}

/* Direct reply: show the parent message's content in full. Deeper replies use
   the compact one-line bar above instead. */
.post-reply-context--full {
    display: block;
    cursor: default;
}
.post-reply-head {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    text-decoration: none;
}
.post-reply-head:hover {
    color: var(--text);
}
.post-reply-head strong {
    color: var(--text);
    font-weight: 700;
}
.post-reply-body {
    margin-top: 8px;
    color: var(--muted-strong);
    font-size: 0.87rem;
    line-height: 1.55;
}
.post-reply-body > :first-child {
    margin-top: 0;
}
.post-reply-body > :last-child {
    margin-bottom: 0;
}
.post-reply-context.is-missing {
    border-left-color: var(--muted);
    font-style: italic;
}

.post-reply-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    flex-wrap: wrap;
}
.post-reply-label {
    color: var(--muted);
}
.post-reply-author {
    color: var(--text);
    font-weight: 700;
}
.post-reply-snippet {
    min-width: 0;
    flex: 1 1 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-strong);
}

.reply-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 12px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.4;
}
.reply-context[hidden] {
    display: none;
}
.reply-context-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.reply-context strong {
    color: #fff;
    font-weight: 800;
}
.reply-context-snippet {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted-strong);
    font-size: 0.75rem;
}
.reply-context-cancel {
    flex: none;
    padding: 4px 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--field);
    color: var(--muted-strong);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.reply-context-cancel:hover {
    background: var(--raised);
    border-color: var(--line);
    color: var(--text);
}

.message-reply-btn.is-active {
    color: var(--accent-bright);
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
