/* ═══════════════════════════════════════════════════════════════════
   Q&A — the board, a question, and the composer.

   Tokens, sections, buttons and cards come from signal.css. What is here
   is the furniture a question board needs and the system does not have:
   a vote column, an answer with an accepted state, inline comments, and
   a composer that works with a thumb.
   ═══════════════════════════════════════════════════════════════════ */

/* ═══ Board header ═══ */
.qa-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; justify-content: space-between; margin-bottom: 1.5rem; }
.qa-search { flex: 1 1 18rem; position: relative; display: flex; }
.qa-search input { width: 100%; padding: .85rem 1rem .85rem 2.6rem; border-radius: 999px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--ink); font: 400 .92rem/1 var(--body); outline: none; transition: border-color .2s, box-shadow .2s; }
.qa-search input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, .15); }
.qa-search input::placeholder { color: var(--dim); }
.qa-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--dim); pointer-events: none; }
.qa-sorts { display: flex; gap: .3rem; padding: .25rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); }
.qa-sort { padding: .5rem .9rem; border-radius: 999px; color: var(--muted); font: 600 .72rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; white-space: nowrap; transition: color .2s, background .2s; }
.qa-sort:hover { color: var(--ink); }
.qa-sort.is-active { color: var(--green); background: rgba(52, 211, 153, .12); }

/* ═══ Question list ═══ */
.qa-list { display: grid; gap: .8rem; }
.qa-card { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.2rem; padding: 1.2rem 1.4rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); transition: border-color .25s, transform .25s; }
.qa-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.qa-card.is-answered { border-left: 2px solid rgba(52, 211, 153, .55); }
.qa-stats { display: grid; gap: .55rem; align-content: start; text-align: center; }
.qa-stat b { display: block; font-family: var(--display); font-size: 1.25rem; font-weight: 800; line-height: 1; color: var(--ink); }
.qa-stat span { display: block; margin-top: .2rem; color: var(--dim); font: 600 .54rem/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.qa-stat-answers { padding: .35rem .2rem; border-radius: .5rem; }
.qa-stat-answers.is-accepted { background: rgba(52, 211, 153, .12); border: 1px solid rgba(52, 211, 153, .35); }
.qa-stat-answers.is-accepted b { color: var(--green); }
.qa-stat-answers.is-accepted span { color: var(--green); }
.qa-card h2 { font-size: 1.15rem; font-weight: 700; line-height: 1.3; letter-spacing: -.01em; }
.qa-card h2 a { color: var(--ink); text-decoration: none; }
.qa-card h2 a:hover { color: var(--green-2); }
.qa-excerpt { margin-top: .5rem; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.qa-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-top: .9rem; color: var(--dim); font-size: .78rem; }
.qa-meta a { color: var(--muted); text-decoration: none; }
.qa-meta a:hover { color: var(--green-2); }
.qa-tags { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .8rem; }
.qa-tag { padding: .25rem .6rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font: 500 .72rem/1.4 var(--body); text-decoration: none; transition: color .2s, border-color .2s; }
.qa-tag:hover { color: var(--green); border-color: rgba(52, 211, 153, .45); }
.qa-avatar { width: 1.4rem; height: 1.4rem; border-radius: 999px; object-fit: cover; background: linear-gradient(135deg, var(--green), #0ea5e9); display: inline-grid; place-items: center; color: #04110c; font: 700 .62rem/1 var(--body); }

/* ═══ Pagination ═══ */
.qa-pages { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 2rem; color: var(--dim); font: 600 .7rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.qa-pages a { color: var(--muted); text-decoration: none; padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--line); }
.qa-pages a:hover { color: var(--ink); border-color: var(--line-2); }

/* ═══ Detail ═══ */
.qa-detail { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; gap: clamp(1.5rem, 3vw, 2.5rem); align-items: start; }
.qa-post { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 1.2rem; padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.qa-post + .qa-post { margin-top: 1rem; }
.qa-post.is-accepted { border-color: rgba(52, 211, 153, .5); background: linear-gradient(160deg, rgba(52, 211, 153, .07), var(--panel) 55%); }

.qa-votes { display: grid; gap: .3rem; justify-items: center; align-content: start; }
.qa-vote { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: .7rem; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s, background .2s; }
.qa-vote:hover:not(:disabled) { color: var(--green); border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .08); }
.qa-vote:disabled { opacity: .4; cursor: not-allowed; }
.qa-vote.is-on { color: var(--green); border-color: rgba(52, 211, 153, .6); background: rgba(52, 211, 153, .14); }
.qa-vote.is-on-down { color: #fb7185; border-color: rgba(251, 113, 133, .6); background: rgba(251, 113, 133, .12); }
.qa-score { font-family: var(--display); font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.qa-accepted-mark { width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border-radius: 999px; background: rgba(52, 211, 153, .16); border: 1px solid rgba(52, 211, 153, .5); color: var(--green); }

.qa-body { color: var(--ink); font-size: 1rem; line-height: 1.7; overflow-wrap: anywhere; }
.qa-body p { margin: 0 0 1rem; }
.qa-body p:last-child { margin-bottom: 0; }
.qa-body ul, .qa-body ol { margin: 0 0 1rem 1.2rem; display: grid; gap: .3rem; }
.qa-body a { color: var(--green-2); text-decoration: underline; text-underline-offset: 3px; }
.qa-body code { padding: .15rem .35rem; border-radius: .3rem; background: rgba(255, 255, 255, .07); font: 400 .86em/1.4 var(--mono); }
.qa-body pre { margin: 0 0 1rem; padding: 1rem; border-radius: .8rem; border: 1px solid var(--line); background: #060b12; overflow-x: auto; }
.qa-body pre code { padding: 0; background: none; font-size: .82rem; line-height: 1.6; }
.qa-body blockquote { margin: 0 0 1rem; padding-left: 1rem; border-left: 2px solid var(--line-2); color: var(--muted); }
.qa-body img { max-width: 100%; height: auto; border-radius: .6rem; }

.qa-byline { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--dim); font-size: .8rem; }
.qa-byline a { color: var(--green-2); text-decoration: none; font-weight: 600; }
.qa-byline .qa-avatar { width: 1.8rem; height: 1.8rem; font-size: .72rem; }
.qa-rank { padding: .15rem .45rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font: 600 .58rem/1.5 var(--mono); letter-spacing: .1em; text-transform: uppercase; }

.qa-comments { margin-top: 1rem; padding-top: .8rem; border-top: 1px dashed var(--line); display: grid; gap: .5rem; }
.qa-comment { color: var(--muted); font-size: .84rem; line-height: 1.55; }
.qa-comment b { color: var(--green-2); font-weight: 600; }

/* The accepted answer is the point of the page, so it is named rather than
   left to be noticed. */
.qa-answers-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .8rem; margin: 2.5rem 0 1rem; }
.qa-answers-head h2 { font-size: clamp(1.3rem, 2.2vw, 1.8rem); }
.qa-accepted-flag { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border-radius: 999px; background: rgba(52, 211, 153, .14); border: 1px solid rgba(52, 211, 153, .4); color: var(--green); font: 600 .6rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }

/* ═══ Composer ═══ */
.qa-composer { margin-top: 2rem; padding: 1.4rem; border: 1px solid var(--line-2); border-radius: var(--r); background: linear-gradient(160deg, var(--panel-2), var(--panel)); }
.qa-composer h2 { font-size: 1.25rem; margin-bottom: .3rem; }
.qa-composer p.qa-hint { color: var(--muted); font-size: .88rem; line-height: 1.55; margin-bottom: 1rem; }
.qa-field { display: grid; gap: .45rem; margin-bottom: 1rem; }
.qa-field label { color: var(--dim); font: 600 .58rem/1 var(--mono); letter-spacing: .18em; text-transform: uppercase; }
.qa-field input[type="text"], .qa-field textarea, .qa-composer textarea {
    width: 100%; padding: .9rem 1rem; border-radius: .9rem; border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, .03); color: var(--ink);
    font: 400 .95rem/1.6 var(--body); outline: none; resize: vertical;
    transition: border-color .2s, box-shadow .2s;
}
.qa-field textarea, .qa-composer textarea { min-height: 9rem; font-family: var(--mono); font-size: .88rem; }
.qa-field input:focus, .qa-field textarea:focus, .qa-composer textarea:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(52, 211, 153, .15); }
.qa-field .helptext, .qa-field small { color: var(--dim); font-size: .76rem; line-height: 1.5; }
.qa-field .errorlist { margin: 0; padding: 0; list-style: none; color: #fb7185; font-size: .8rem; }
.qa-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
.qa-draft { color: var(--dim); font-size: .76rem; }

.qa-signin { margin-top: 2rem; padding: 1.4rem; border: 1px dashed var(--line-2); border-radius: var(--r); text-align: center; color: var(--muted); }
.qa-signin p { margin-bottom: .9rem; font-size: .92rem; }

/* ═══ Sidebar ═══ */
.qa-side { display: grid; gap: 1rem; position: sticky; top: 6rem; }
.qa-side-card { padding: 1.1rem 1.2rem; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.qa-side-card h2 { margin-bottom: .9rem; color: var(--dim); font: 600 .6rem/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.qa-side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.qa-side-list a { color: var(--ink); font-size: .88rem; line-height: 1.45; text-decoration: none; }
.qa-side-list a:hover { color: var(--green-2); }
.qa-side-list span { display: block; margin-top: .2rem; color: var(--dim); font: 600 .56rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; }

.qa-empty { padding: clamp(2rem, 5vw, 3.5rem); border: 1px dashed var(--line-2); border-radius: var(--r); text-align: center; color: var(--muted); }
.qa-empty strong { display: block; margin-bottom: .5rem; font-family: var(--display); font-size: 1.2rem; color: var(--ink); }

/* ═══ Guidelines ═══ */
.qa-guide { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .55rem; }
.qa-guide li { position: relative; padding-left: 1.1rem; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.qa-guide li::before { content: ''; position: absolute; left: 0; top: .6rem; width: .3rem; height: .3rem; border-radius: 50%; background: var(--green); }

@media (max-width: 980px) {
    .qa-detail { grid-template-columns: minmax(0, 1fr); }
    .qa-side { position: static; }
}
@media (max-width: 640px) {
    .qa-card { grid-template-columns: minmax(0, 1fr); gap: .8rem; }
    /* The stats become a row above the title rather than a column beside it. */
    .qa-stats { display: flex; gap: 1.2rem; text-align: left; }
    .qa-stat b { display: inline; font-size: 1rem; }
    .qa-stat span { display: inline; margin-left: .3rem; }
    .qa-stat-answers { padding: 0; border: 0; background: none; }
    .qa-post { grid-template-columns: minmax(0, 1fr); }
    .qa-votes { grid-auto-flow: column; justify-content: start; align-items: center; gap: .6rem; }
    .qa-bar { flex-direction: column; align-items: stretch; }
    .qa-sorts { overflow-x: auto; }
}

/* ── Anonymous answers ── */
.qa-avatar-anon { background: linear-gradient(135deg, var(--dim), var(--line-2)); color: var(--ink); }
.qa-rank-anon { color: var(--dim); border-style: dashed; }
.qa-held { margin-bottom: .8rem; padding: .6rem .8rem; border-radius: .6rem; border: 1px solid rgba(252, 211, 77, .4); background: rgba(252, 211, 77, .08); color: #fde68a; font-size: .82rem; line-height: 1.5; }

/* ── Duplicate hints while typing a title ── */
.qa-similar { margin-top: .8rem; padding: .9rem 1rem; border-radius: .9rem; border: 1px solid rgba(252, 211, 77, .35); background: rgba(252, 211, 77, .06); }
.qa-similar[hidden] { display: none; }
.qa-similar-head { margin: 0 0 .6rem; color: #fde68a; font-size: .82rem; line-height: 1.5; }
.qa-similar-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.qa-similar-list a { color: var(--ink); font-size: .88rem; line-height: 1.4; text-decoration: none; }
.qa-similar-list a:hover { color: var(--green-2); text-decoration: underline; text-underline-offset: 3px; }
.qa-similar-list span { margin-left: .4rem; color: var(--dim); font: 600 .58rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.qa-similar-list .is-accepted { color: var(--green); }

/* ── Freshness ──
   An answer about software is a claim about a version, and the claim ages
   even when the text does not. */
.qa-fresh { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; padding: .55rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); font-size: .78rem; }
.qa-fresh-dot { width: .5rem; height: .5rem; border-radius: 50%; flex: none; }
.qa-fresh[data-freshness="fresh"] { border-color: rgba(52, 211, 153, .4); }
.qa-fresh[data-freshness="fresh"] .qa-fresh-dot { background: var(--green); box-shadow: 0 0 0 3px rgba(52, 211, 153, .18); }
.qa-fresh[data-freshness="fresh"] .qa-fresh-label { color: var(--green-2); }
.qa-fresh[data-freshness="aging"] { border-color: rgba(252, 211, 77, .35); }
.qa-fresh[data-freshness="aging"] .qa-fresh-dot { background: #fcd34d; }
.qa-fresh[data-freshness="aging"] .qa-fresh-label { color: #fde68a; }
.qa-fresh[data-freshness="stale"] { border-color: rgba(251, 113, 133, .35); }
.qa-fresh[data-freshness="stale"] .qa-fresh-dot { background: #fb7185; }
.qa-fresh[data-freshness="stale"] .qa-fresh-label { color: #ffd7dd; }
.qa-fresh-label { color: var(--muted); }
.qa-fresh-btn { margin-left: auto; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); font: 600 .68rem/1 var(--mono); letter-spacing: .08em; cursor: pointer; white-space: nowrap; transition: color .2s, border-color .2s, background .2s; }
.qa-fresh-btn:hover { color: var(--green); border-color: rgba(52, 211, 153, .5); background: rgba(52, 211, 153, .08); }
.qa-fresh-btn[data-confirmed="true"] { color: var(--green); border-color: rgba(52, 211, 153, .55); background: rgba(52, 211, 153, .12); }
.qa-fresh-btn:disabled { opacity: .5; cursor: wait; }
@media (max-width: 640px) { .qa-fresh-btn { margin-left: 0; } }
