/* Forum: categories, thread lists, posts, the editor, attachments and the tool viewer.
   Colours are the site's variables (carvio.css), so dark mode comes for free. */

.forum-search input[type="search"] { width: 220px; }
@media (max-width: 760px) { .forum-search input[type="search"] { width: 100%; } }

/* Index: categories */
.forum-cols { display: grid; grid-template-columns: 1fr 280px; gap: 28px; align-items: start; }
@media (max-width: 900px) { .forum-cols { grid-template-columns: 1fr; } }
.category-list, .thread-list, .latest-list, .result-list { list-style: none; margin: 0; padding: 0; }
.category-list { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.category-row { display: grid; grid-template-columns: 1fr 110px 220px; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--panel-border); align-items: center; }
.category-row:last-child { border-bottom: 0; }
.category-row:hover { background: var(--hover-bg); }
.category-name { font-weight: 650; font-size: 1.05rem; color: var(--text); }
.category-name:hover { color: var(--accent); }
.category-counts { text-align: right; line-height: 1.35; }
.category-counts strong { color: var(--text); }
.category-last { line-height: 1.35; overflow: hidden; }
.category-last a { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .category-row { grid-template-columns: 1fr auto; } .category-last { display: none; } }
.forum-side h3 { margin-top: 4px; }
.latest-list li { padding: 8px 0; border-bottom: 1px solid var(--panel-border); }
.latest-list li:last-child { border-bottom: 0; }

/* Thread lists */
.thread-list { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.thread-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--panel-border); align-items: center; }
.thread-row:last-child { border-bottom: 0; }
.thread-row:hover { background: var(--hover-bg); }
.thread-row.is-pinned { background: color-mix(in srgb, var(--selection) 45%, transparent); }
.thread-thumb { display: block; width: 56px; height: 56px; }
.thread-thumb img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; border: 1px solid var(--panel-border); background: var(--preview-bg); }
.thread-thumb .avatar { width: 44px; height: 44px; margin: 6px; }
.thread-main { min-width: 0; }
.thread-title { font-weight: 600; font-size: 1.02rem; }
.thread-title a { color: var(--text); }
.thread-title a:hover { color: var(--accent); }
.thread-meta { margin-top: 2px; }
.thread-stats { display: flex; gap: 18px; text-align: center; }
.thread-stats div { display: flex; flex-direction: column; min-width: 52px; line-height: 1.2; }
.thread-stats strong { font-size: 1.05rem; }
@media (max-width: 640px) { .thread-row { grid-template-columns: 44px 1fr; } .thread-stats { display: none; } .thread-thumb, .thread-thumb img { width: 44px; height: 44px; } .thread-thumb .avatar { width: 36px; height: 36px; margin: 4px; } }

/* Thread page */
.thread-head { margin-bottom: 16px; }
.thread-head h1 { margin-bottom: 4px; }
.thread-head .badge { vertical-align: middle; font-size: .8rem; }
.modbar { background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 16px; }
.posts { display: flex; flex-direction: column; gap: 16px; }
.post { display: grid; grid-template-columns: 180px 1fr; background: var(--panel); border: 1px solid var(--panel-border); border-radius: 10px; overflow: hidden; }
.post:target { outline: 2px solid var(--accent); }
.post-author { padding: 16px; background: var(--header-bg); border-right: 1px solid var(--panel-border); display: flex; gap: 10px; align-items: flex-start; }
.post-author-name { font-weight: 650; color: var(--text); }
.post-machine { margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.post-main { padding: 14px 18px 10px; min-width: 0; }
.post-head { margin-bottom: 8px; }
.post-head a { color: var(--muted); }
.post-body { overflow-wrap: anywhere; }
.post-body > :last-child { margin-bottom: 0; }
.post-body img { max-width: 100%; height: auto; }
.post-attachments { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.post-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--panel-border); }
.post-actions .btn-ghost { color: var(--muted); }
.post-actions .btn-ghost:hover { color: var(--text); }
.post-actions .is-liked { color: var(--danger); }
.report summary { list-style: none; cursor: pointer; }
.report summary::-webkit-details-marker { display: none; }
.report[open] { flex-basis: 100%; }
.report form { margin-top: 6px; }
@media (max-width: 760px) {
  .post { grid-template-columns: 1fr; }
  .post-author { border-right: 0; border-bottom: 1px solid var(--panel-border); padding: 10px 14px; align-items: center; }
  .post-author .avatar { width: 30px; height: 30px; font-size: .9rem; }
  .post-author > div { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
  .post-machine { display: inline; }
}
.reply { margin-top: 24px; }
.reply h3 { margin-top: 0; }

/* Attachments */
.att-image { margin: 0; max-width: 360px; }
.att-image img { display: block; max-width: 100%; max-height: 320px; border-radius: var(--radius); border: 1px solid var(--panel-border); background: var(--preview-bg); }
.att-image figcaption { margin-top: 4px; }
.att-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--panel-border); border-radius: var(--radius); background: var(--control-bg); color: var(--text); }
.att-file:hover { border-color: var(--accent); text-decoration: none; }
.att-carvio { flex-basis: 100%; padding: 14px 16px; }
.att-carvio-head { display: flex; gap: 16px; align-items: flex-start; }
.att-preview { flex: none; width: 128px; height: 128px; border-radius: 8px; overflow: hidden; border: 1px solid var(--panel-border); background: var(--preview-bg); display: flex; align-items: center; justify-content: center; }
.att-preview img { width: 128px; height: 128px; object-fit: contain; display: block; }
.att-preview-none { background: var(--control-bg); }
.att-preview-none { color: var(--disabled); }
.att-carvio-body { min-width: 0; flex: 1; }
.att-carvio-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 2px; }
.att-tags { margin: 6px 0; }
.att-summary { width: auto; margin: 8px 0 0; font-size: .9rem; }
.att-summary th, .att-summary td { padding: 2px 10px 2px 0; border: 0; background: none; }
.att-summary th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.att-toolpaths, .att-notes { margin-top: 10px; }
.att-toolpaths summary, .att-notes summary { cursor: pointer; font-weight: 600; }
.att-toolpaths table { margin: 6px 0 0; }
.att-toolpaths tr.muted td { color: var(--muted); }
.att-tools { margin-top: 12px; }
@media (max-width: 560px) { .att-carvio-head { flex-direction: column; } }

/* Editor */
.editor { position: relative; border: 1px solid var(--control-border); border-radius: var(--radius); background: var(--control-bg); }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.editor-toolbar { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--panel-border); background: var(--header-bg); border-radius: var(--radius) var(--radius) 0 0; flex-wrap: wrap; }
.editor-toolbar .btn { padding: 3px 9px; }
.editor-toolbar .btn[aria-pressed="true"] { background: var(--selection); border-color: var(--accent); color: var(--accent); }
.editor-spacer { flex: 1; }
.editor textarea { border: 0; border-radius: 0; min-height: 200px; display: block; }
.editor textarea:focus { outline: none; }
.editor-preview { padding: 12px 14px; min-height: 200px; border-bottom: 1px solid var(--panel-border); }
.editor-preview:empty::before { content: 'Nothing to preview yet.'; color: var(--muted); }
.dropzone { padding: 10px 12px; border-top: 1px solid var(--panel-border); background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); }
.dropzone.is-over { background: var(--selection); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.dropzone-label { display: block; cursor: pointer; font-weight: 400; margin: 0; }
.dropzone-label span { display: block; }
.dropzone-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.dropzone-list li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; background: var(--hover-bg); font-size: .85rem; }
.dropzone-list li.is-bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.dropzone-list button { border: 0; background: none; color: inherit; cursor: pointer; font: inherit; padding: 0 2px; line-height: 1; }

/* Search and user pages */
.result-row { padding: 12px 0; border-bottom: 1px solid var(--panel-border); }
.result-title { font-weight: 600; font-size: 1.02rem; }
.result-excerpt { margin-top: 4px; color: var(--text); font-size: .95rem; }

/* Moderation */
.report-card { margin-bottom: 14px; }
.report-card.is-resolved { opacity: .7; }
.report-reason { margin: 8px 0; }
.report-card blockquote { margin: 0; }

/* Tool viewer (assets/js/tool-viewer.js) */
