/* Lesson discussion board (public/app/discussion.js). Uses the design tokens from styles.css. */

.discussion { margin-top: 3.5rem; padding-top: 2rem; border-top: 2px solid var(--ink); }
.disc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.disc-head h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 0.2rem; }
.disc-head p { margin: 0; font-size: 0.95rem; }
.disc-count { color: var(--fg-subtle); font-weight: 600; font-size: 1.1rem; }
.disc-sort-wrap { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 700; color: var(--fg-subtle); }
.disc-sort { width: auto; padding: 0.45rem 2rem 0.45rem 0.6rem; font-size: 0.9rem; }

/* Composer */
.disc-composer { border: 2px solid var(--border); background: #fff; padding: 0.9rem; margin-bottom: 1.5rem; }
.disc-composer:focus-within { border-color: var(--abyss); }
.disc-composer textarea { border: 0; padding: 0.4rem 0.2rem; min-height: 4.5rem; box-shadow: none; }
.disc-composer textarea:focus { box-shadow: none; }
.disc-composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 0.6rem; margin-top: 0.3rem; }
.disc-signin { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; background: var(--bg-alt); padding: 1rem 1.2rem; margin-bottom: 1.5rem; }
.disc-signin > .icon { font-size: 1.5rem; color: var(--surf); }
.disc-signin p { margin: 0; flex: 1 1 240px; }
.disc-empty { margin: 0.5rem 0 0; font-size: 0.92rem; }

/* "Pick your discussion username" dialog */
.username-status { display: flex; align-items: center; gap: 0.35rem; min-height: 1.4em; margin: 0; font-weight: 600; font-size: 0.9rem; }
.username-status.ok { color: var(--algae); }
.username-status.bad { color: var(--coral-deep); }

/* Comments */
.disc-list { display: grid; gap: 0.25rem; }
.disc-comment { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.5rem; padding: 0.6rem 0 0.2rem; }
.disc-list > .disc-comment { border-bottom: 1px solid var(--border); padding-bottom: 0.7rem; }
.disc-comment.flash > .disc-main { animation: disc-flash 2.4s ease; }
@keyframes disc-flash { 0%, 40% { background: var(--sun-tint); } 100% { background: transparent; } }
.disc-main { min-width: 0; }
.disc-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.45rem; font-size: 0.82rem; line-height: 1.5; }
.disc-collapse { background: none; border: 0; padding: 0 0.1rem; font: 600 0.78rem/1 var(--font-mono, monospace); color: var(--fg-subtle); cursor: pointer; }
.disc-collapse:hover { color: var(--abyss); }
.disc-author { font-weight: 700; color: var(--ink); }
.disc-team { background: var(--abyss); color: #fff; font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.15rem 0.4rem; }
.disc-flair { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.15rem 0.45rem; }
.flair-question { background: var(--surf-tint); color: var(--abyss); }
.flair-discussion { background: var(--sun-tint); color: var(--ink); }
.disc-removed-tag { background: var(--coral-wash); color: var(--coral-deep); font-size: 0.68rem; font-weight: 800; text-transform: uppercase; padding: 0.15rem 0.4rem; }
.disc-body { margin: 0.25rem 0 0.15rem; font-size: 0.97rem; line-height: 1.55; overflow-wrap: anywhere; }
.disc-body p { margin: 0 0 0.6em; }
.disc-body p:last-child { margin-bottom: 0; }
p.disc-body { font-style: italic; }

/* Votes */
.disc-votes { display: flex; flex-direction: column; align-items: center; gap: 0.05rem; padding-top: 0.05rem; }
.disc-vote { background: none; border: 0; padding: 0.15rem; cursor: pointer; color: var(--border-strong); font-size: 1.15rem; line-height: 0; border-radius: 3px; }
.disc-vote:hover { background: var(--bg-alt); color: var(--fg-subtle); }
.disc-vote.down .icon { transform: rotate(180deg); }
.disc-vote.up.on { color: var(--sun); }
.disc-vote.down.on { color: var(--surf-deep); }
.disc-score { font-weight: 800; font-size: 0.85rem; font-variant-numeric: tabular-nums; min-width: 1.5em; text-align: center; }
.disc-vote-spacer { width: 2.25rem; }

/* Actions, reply and edit forms */
.disc-actions { display: flex; flex-wrap: wrap; gap: 0.1rem 0.9rem; margin-top: 0.15rem; }
.disc-action { background: none; border: 0; padding: 0.2rem 0; font-size: 0.8rem; font-weight: 700; color: var(--fg-subtle); cursor: pointer; }
.disc-action:hover { color: var(--abyss); text-decoration: underline; }
.disc-action.danger:hover { color: var(--coral-deep); }
.disc-reply { display: grid; gap: 0.5rem; margin: 0.5rem 0 0.4rem; }
.disc-reply textarea { min-height: 4rem; }

/* Nested replies: a thread line on the left that collapses the thread when clicked */
.disc-children { position: relative; padding-left: 0.85rem; margin-top: 0.2rem; }
.disc-thread-line { position: absolute; left: -2.075rem; top: 0; bottom: 0.4rem; width: 0.9rem; background: none; border: 0; padding: 0; cursor: pointer; }
.disc-thread-line::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--border); transform: translateX(-50%); }
.disc-thread-line:hover::before, .disc-thread-line:focus-visible::before { background: var(--surf); }
.disc-comment.is-collapsed { padding-bottom: 0.3rem; }
.disc-comment.is-gone .disc-meta { opacity: 0.8; }

.disc-votes-inline { display: none; }

/* Phones: votes move inline with the actions, and each reply level indents only a little,
   so even the deepest thread keeps most of the width. */
@media (max-width: 560px) {
  .disc-comment { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .disc-comment > .disc-votes, .disc-vote-spacer { display: none; }
  .disc-votes-inline { display: inline-flex; flex-direction: row; align-items: center; gap: 0.1rem; margin-right: 0.5rem; padding: 0; }
  .disc-votes-inline .disc-vote { font-size: 1.1rem; padding: 0.3rem; }
  .disc-actions { align-items: center; }
  .disc-children { padding-left: 0.8rem; }
  .disc-thread-line { left: -0.05rem; width: 0.8rem; }
  .disc-head { align-items: flex-start; }
}

/* Bell in the header: replies to your posts */
.bell { position: relative; }
.bell-btn { position: relative; font-size: 1.15rem; padding: 0.5rem; }
.bell-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--coral); color: #fff; font: 800 0.66rem/18px var(--font-ui); text-align: center; box-shadow: 0 0 0 2px var(--abyss); }
.bell-panel { position: absolute; right: -48px; top: calc(100% + 10px); width: min(360px, calc(100vw - 24px)); background: #fff; color: var(--ink); border: 1px solid var(--border); box-shadow: var(--shadow); z-index: 55; }
.bell-head { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.bell-list li { border-bottom: 1px solid var(--border); }
.bell-list li:last-child { border-bottom: 0; }
.bell-list a { display: grid; gap: 0.2rem; padding: 0.75rem 1rem; color: var(--ink); text-decoration: none; font-size: 0.9rem; }
.bell-list a:hover { background: var(--bg-alt); }
.bell-list li.unread a { border-left: 4px solid var(--sun); background: #fffbea; }
.bell-excerpt { color: var(--fg-muted); font-size: 0.86rem; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.bell-meta { color: var(--fg-subtle); font-size: 0.78rem; }
.bell-empty { margin: 0; padding: 1rem; color: var(--fg-muted); font-size: 0.9rem; }
@media (max-width: 480px) { .bell-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; } }
/* One honest note per board that has example posts (the per-post "Example" label is admins only). */
.disc-example-note { display: flex; align-items: center; gap: 0.5rem; margin: 1.5rem 0 0; font-size: 0.85rem; color: var(--fg-subtle); }
.disc-example-note[hidden] { display: none; }
.disc-example-note .icon { flex: none; color: var(--surf); }
.disc-example { font: 700 0.62rem/1 var(--font-ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-subtle); border: 1px solid var(--border-strong); padding: 0.2rem 0.35rem; cursor: help; }
