/* Scholars Post: formatting, @mentions, polls, cited papers and project milestones (includes/features.php). Uses the colours of styles.css. */

/* ---- headings, quotes and code in posts ---- */
.post-body h2, .post-body h3, .post-body h4, .rte-editor h2, .rte-editor h3, .rte-editor h4 { margin: 12px 0 6px; line-height: 1.3; color: var(--ink); font-weight: 700; }
.post-body h2, .rte-editor h2 { font-size: 1.2em; }
.post-body h3, .rte-editor h3 { font-size: 1.08em; }
.post-body h4, .rte-editor h4 { font-size: 1em; }
.post-body blockquote, .rte-editor blockquote { margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--primary); background: var(--surface-soft); color: var(--ink-soft); border-radius: 0 6px 6px 0; }
.post-body blockquote p, .rte-editor blockquote p { margin: 0; }
.post-body code, .rte-editor code, .bubble-text code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); border: 1px solid var(--line); }
.post-body pre, .rte-editor pre { margin: 8px 0; padding: 10px 12px; overflow-x: auto; border-radius: 8px; background: var(--surface-soft); border: 1px solid var(--line); }
.post-body pre code, .rte-editor pre code { padding: 0; border: 0; background: none; }
.post-body a.mention, .rte-editor a.mention, .bubble-text a.mention { text-decoration: none; font-weight: 600; color: var(--primary); background: var(--primary-soft); padding: 0 4px; border-radius: 4px; }
.rte { position: relative; }
.rte-tip { display: block; margin-top: 4px; }
.rte-tip code { font-size: 11.5px; padding: 0 4px; border-radius: 4px; background: var(--surface-soft); border: 1px solid var(--line); }
.rte-mentions { top: 44px; bottom: auto; max-height: 150px; }
.mention-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }

/* ---- compose: poll and citation builders ---- */
.compose-extras { display: flex; flex-wrap: wrap; gap: 8px; margin: 2px 0 12px; }
.extra-box { margin: 0 0 14px; padding: 12px 14px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-soft); min-width: 0; }
.extra-box legend { padding: 0 6px; font-weight: 700; font-size: 14px; color: var(--ink); }
.extra-box legend em { font-weight: 400; color: var(--muted); font-style: normal; }
.poll-opts { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.poll-opt-row { display: flex; gap: 6px; align-items: center; }
.poll-opt-row input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.poll-settings { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 10px 0 6px; font-size: 14px; }
.poll-check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; }
.poll-check input { width: 16px; height: 16px; accent-color: var(--primary); }
.poll-days { display: inline-flex; gap: 8px; align-items: center; }
.poll-days select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.link-btn.danger { color: var(--danger); }
.cite-picked { list-style: decimal; margin: 0 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.cite-picked:empty { display: none; }
.cite-picked li > span, .cite-picked li { min-width: 0; }
.cite-picked li { position: relative; padding-right: 30px; }
.cite-picked li strong { display: block; font-size: 14px; line-height: 1.35; }
.cite-picked li small, .cite-hit small { display: block; color: var(--muted); font-size: 12px; }
.cite-picked .icon-btn { position: absolute; right: 0; top: 0; }
#citeSearch { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.cite-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; max-height: 240px; overflow-y: auto; }
.cite-hit { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.cite-hit:hover, .cite-hit:focus-visible { border-color: var(--primary); background: var(--primary-soft); }
.cite-hit strong { display: block; font-size: 14px; line-height: 1.35; }

/* ---- a poll (posts and project chats) ---- */
.poll { margin: 10px 0 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-align: left; }
.bubble .poll { margin: 6px 0 2px; min-width: min(320px, 70vw); }
.poll.is-busy { opacity: .6; pointer-events: none; }
.poll-q { font-weight: 700; color: var(--ink); line-height: 1.35; display: flex; gap: 8px; align-items: baseline; }
.poll-q i { color: var(--primary); }
.poll-hint { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.poll-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 8px; }
.poll-opt { display: flex; gap: 8px; align-items: center; width: 100%; padding: 9px 12px; border: 1px solid var(--primary); border-radius: 999px; background: transparent; color: var(--primary); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
button.poll-opt:hover:not([disabled]) { background: var(--primary-soft); }
.poll-opt[disabled], .poll-opt-multi input[disabled] + span { opacity: .6; cursor: default; }
.poll-opt-multi { border-radius: 10px; cursor: pointer; }
.poll-opt-multi input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.poll-res { position: relative; display: flex; justify-content: space-between; gap: 10px; padding: 8px 12px; border-radius: 8px; background: var(--surface-soft); overflow: hidden; }
.poll-bar { position: absolute; inset: 0 auto 0 0; background: var(--primary-soft); border-radius: 8px; transition: width .4s ease; }
.poll-res > span, .poll-res > b { position: relative; }
.poll-res.is-mine .poll-lbl { font-weight: 700; color: var(--ink); }
.poll-res .poll-lbl i { color: var(--primary); }
.poll-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; color: var(--muted); }
.poll-foot small { margin-right: auto; }
.poll.is-closed .poll-q i { color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .poll-bar { transition: none; } }

/* ---- cited papers ---- */
.cite-list { list-style: none; margin: 10px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: cite; }
.cite-card { counter-increment: cite; position: relative; padding: 10px 14px 10px 40px; border: 1px solid var(--line); border-left: 3px solid var(--secondary, var(--primary)); border-radius: var(--radius-sm); background: var(--surface-soft); display: flex; flex-direction: column; gap: 3px; text-align: left; }
.cite-card::before { content: "[" counter(cite) "]"; position: absolute; left: 12px; top: 10px; font-weight: 700; font-size: 13px; color: var(--muted); }
.cite-kicker { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cite-title { font-weight: 700; color: var(--ink); line-height: 1.35; text-decoration: none; }
a.cite-title:hover { text-decoration: underline; }
.cite-meta { font-size: 13px; color: var(--ink-soft); }
.cite-acts { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.cite-acts a { color: var(--primary); text-decoration: none; overflow-wrap: anywhere; }
.cite-acts a:hover { text-decoration: underline; }

/* ---- project chat: mentions and polls ---- */
.chat-composer { position: relative; }
.chat-mentions { bottom: calc(100% + 4px); }
.msg.mentions-me .bubble { box-shadow: inset 3px 0 0 var(--accent, var(--primary)); }

/* ---- project milestones ---- */
.ms-progress { height: 6px; border-radius: 999px; background: var(--surface-soft); border: 1px solid var(--line); overflow: hidden; margin: 2px 0 12px; }
.ms-progress span { display: block; height: 100%; background: var(--success, var(--primary)); border-radius: 999px; transition: width .4s ease; }
.ms-list { list-style: none; margin: 0; padding: 0; position: relative; }
.ms-list li { position: relative; display: flex; gap: 10px; padding: 0 0 12px; }
.ms-list li:not(:last-child)::before { content: ""; position: absolute; left: 9px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.ms-list li.ms-done:not(:last-child)::before { background: var(--success, var(--primary)); }
.ms-dot { flex: none; width: 20px; height: 20px; display: grid; place-items: center; font-size: 15px; color: var(--muted-light, var(--muted)); background: var(--surface); position: relative; z-index: 1; }
.ms-done .ms-dot { color: var(--success, var(--primary)); }
.ms-in_progress .ms-dot { color: var(--accent, var(--primary)); }
.ms-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.ms-body strong { font-size: 14px; color: var(--ink); }
.ms-planned .ms-body strong { color: var(--ink-soft); font-weight: 600; }
.ms-list li.is-current .ms-body strong::after { content: "Now"; margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 10.5px; font-weight: 700; color: var(--primary); background: var(--primary-soft); vertical-align: 1px; }
.ms-body small { color: var(--muted); font-size: 12px; }
.ms-note { font-style: italic; }
.ms-edit { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.ms-edit select, .ms-edit input { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; font-size: 12.5px; max-width: 100%; }
.ms-list li.is-busy { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .ms-progress span { transition: none; } }
