/**
 * modules/kb_core/assets/kb.css
 *
 * Every selector is prefixed `kb-`; nothing here redefines a shared structural
 * class (panel, card, table, btn, pill, field, flash).
 *
 * Defined here rather than as Tailwind utilities for the same reason the wiki
 * keeps its own: comment bodies render through the Markdown renderer, which
 * emits class names from PHP at render time, and the panels have to look right
 * on an install where nobody has rebuilt assets/css/app.css.
 *
 * Light only, per AGENTS.md rule 5.
 */

/* ═══ Discussion ═════════════════════════════════════════════════════════ */

.kb-comment-list,
.kb-comment-replies {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.kb-comment {
    padding: 0.75rem 0;
    border-top: 1px solid hsl(var(--border));
}

.kb-comment-list > .kb-comment:first-child {
    border-top: 0;
}

.kb-comment-replies {
    margin: 0.5rem 0 0 1rem;
    padding-left: 0.75rem;
    border-left: 2px solid hsl(var(--border));
}

.kb-comment-meta {
    margin: 0 0 0.25rem;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

.kb-comment-meta strong {
    color: hsl(var(--foreground));
    font-weight: 600;
}

.kb-comment-edited {
    font-style: italic;
}

/* A removed comment leaves a marker only where a reply still hangs off it —
   dropping the row entirely would silently reparent the replies and make a
   conversation read as if those people had spoken unprompted. */
.kb-comment-removed {
    margin: 0;
    font-size: 0.8125rem;
    font-style: italic;
    color: hsl(var(--muted-foreground));
}

/* The rendered body carries .wiki-prose too, which supplies the typography and
   the measure. This only limits how much vertical room one comment may take
   before it starts scrolling, so a pasted log cannot bury the reply box. */
.kb-comment-body {
    max-height: 32rem;
    overflow-y: auto;
}

.kb-comment-actions,
.kb-comment-reply-box {
    margin-top: 0.5rem;
}

.kb-comment-actions summary,
.kb-comment-reply-box summary {
    cursor: pointer;
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
}

.kb-comment-actions summary:hover,
.kb-comment-reply-box summary:hover {
    color: hsl(var(--foreground));
}

.kb-comment-form {
    margin-top: 0.5rem;
}

.kb-comment-new {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid hsl(var(--border));
}

.kb-comment-input {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--input));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
}

.kb-comment-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.kb-comment-input:focus-visible {
    outline: 2px solid hsl(var(--ring));
    outline-offset: -1px;
}

.kb-comment-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

/* ═══ Attachments ════════════════════════════════════════ */

.kb-file-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.kb-file {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.625rem 0;
    border-top: 1px solid hsl(var(--border));
}

.kb-file-list > .kb-file:first-child {
    border-top: 0;
}

.kb-file-name {
    display: inline-flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    text-decoration: none;
    word-break: break-word;
}

.kb-file-name:hover {
    color: hsl(var(--primary));
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* The extension as a chip rather than an icon set: it is the one thing that
   tells someone what they are about to download, and it needs no assets. */
.kb-file-ext {
    flex: none;
    padding: 0.0625rem 0.375rem;
    border-radius: calc(var(--radius) - 4px);
    background: hsl(var(--muted));
    color: hsl(var(--muted-foreground));
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.kb-file-meta,
.kb-file-caption,
.kb-file-help {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

.kb-file-caption {
    flex-basis: 100%;
}

.kb-file-remove {
    margin-left: auto;
}

.kb-file-upload {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kb-file-input {
    font-size: 0.8125rem;
}

.kb-file-help {
    margin: 0;
}

/* ═══ Stewardship ═══════════════════════════════════════ */

.kb-steward-badge {
    flex: none;
    padding: 0.125rem 0.5rem;
    border: 1px solid transparent;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Deliberately not a red/green traffic light. "Changed since review" is
   information, not a failure — an edit revoking a review into an alarm state
   is how a badge becomes noise nobody reads within a month. */
.kb-steward-fresh {
    background: hsl(142 70% 96%);
    border-color: hsl(142 40% 82%);
    color: hsl(142 45% 26%);
}

.kb-steward-changed,
.kb-steward-overdue {
    background: hsl(38 92% 96%);
    border-color: hsl(38 60% 80%);
    color: hsl(30 60% 30%);
}

.kb-steward-unowned,
.kb-steward-unreviewed,
.kb-steward-unversioned {
    background: hsl(var(--muted));
    border-color: hsl(var(--border));
    color: hsl(var(--muted-foreground));
}

.kb-steward-form {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid hsl(var(--border));
}

.kb-steward-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.kb-steward-label {
    flex: none;
    min-width: 7rem;
    font-size: 0.8125rem;
    font-weight: 500;
}

/* display:block, not the flex the shared field helpers use — a <select> with
   display:flex loses its native chevron and reads as a plain box. Same trap
   documented in docs/NOTES.md for .note-select. */
.kb-steward-select {
    display: block;
    width: auto;
    min-width: 12rem;
}

.kb-steward-days {
    width: 6rem;
}

/* ═══ Needs review (dashboard) ═══════════════════════════════════════════ */

.kb-review-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.kb-review-item {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
}

.kb-review-item a {
    font-size: 0.875rem;
    font-weight: 500;
    color: hsl(var(--foreground));
    text-decoration: none;
}

.kb-review-item a:hover {
    color: hsl(var(--primary));
    text-decoration: underline;
    text-underline-offset: 2px;
}

.kb-review-detail {
    flex-basis: 100%;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* ═══ Buttons ════════════════════════════════════════════════════════════ */

.kb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: 0.375rem 0.875rem;
    border: 1px solid hsl(var(--border));
    border-radius: calc(var(--radius) - 2px);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.kb-btn:hover {
    background: hsl(var(--muted) / 0.6);
}

.kb-btn-primary {
    border-color: transparent;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.kb-btn-primary:hover {
    background: hsl(var(--primary) / 0.9);
}

.kb-btn-quiet {
    border-color: transparent;
    background: none;
    color: hsl(var(--muted-foreground));
}

.kb-btn-quiet:hover {
    background: hsl(var(--destructive) / 0.1);
    color: hsl(var(--destructive));
}

/* ═══ Utility ════════════════════════════════════════════════════════════ */

.kb-visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

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