/* ============================================================
   Spiracle KB — Single topic page styles (page-specific)
   Shared design system lives in base.css.
   ============================================================ */

/* ---------- Page header (breadcrumb + meta strip) ---------- */
body.spirale-topic .page-head {
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(900px 300px at 50% -80px, rgba(99, 102, 241, .08), transparent 60%),
    var(--bg);
  padding: 28px 0 0;
}
body.spirale-topic .crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-3);
}
body.spirale-topic .crumbs a { color: var(--ink-2); font-weight: 500; padding: 4px 8px; border-radius: 6px; transition: background .15s, color .15s; }
body.spirale-topic .crumbs a:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topic .crumbs .sep { color: #CBD2DD; }
body.spirale-topic .crumbs .current { color: var(--ink); font-weight: 600; padding: 4px 8px; }

body.spirale-topic .topic-header { padding: 22px 0 28px; }
body.spirale-topic .topic-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
body.spirale-topic .tag {
  font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 5px;
}
body.spirale-topic .tag.brand { background: var(--brand-soft); color: var(--brand-ink); border-color: #DDE1FF; }
body.spirale-topic .tag.amber { background: var(--amber-soft); color: var(--amber); border-color: #FED7AA; }
body.spirale-topic .tag .dot { width: 5px; height: 5px; border-radius: 999px; background: currentColor; opacity: .7; }

body.spirale-topic .topic-title {
  font-size: clamp(26px, 3.6vw, 36px);
  line-height: 1.15; letter-spacing: -0.025em;
  font-weight: 800; margin: 0 0 14px; color: var(--ink);
}
body.spirale-topic .topic-meta {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--ink-3);
}
body.spirale-topic .topic-meta .who { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-weight: 500; }
body.spirale-topic .topic-meta .who .av {
  width: 24px; height: 24px; border-radius: 7px;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
  color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center;
}
body.spirale-topic .topic-meta .who.staff .av { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
body.spirale-topic .topic-meta .sep { color: #CBD2DD; }
body.spirale-topic .topic-meta b { color: var(--ink); font-weight: 600; }
body.spirale-topic .topic-meta .stat-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--ink-2);
}
body.spirale-topic .topic-meta .stat-chip svg { color: var(--ink-3); }

/* ---------- Layout: main + sidebar ---------- */
body.spirale-topic .topic-layout {
  display: grid; grid-template-columns: 1fr 320px;
  gap: 28px; padding: 32px 0 64px;
}

/* ---------- Posts ---------- */
body.spirale-topic .posts { display: flex; flex-direction: column; gap: 16px; }
body.spirale-topic .post {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
body.spirale-topic .post:hover { border-color: #D8DBE5; box-shadow: var(--shadow); }
body.spirale-topic .post.is-op { border-color: #DDE1FF; box-shadow: 0 4px 14px -4px rgba(79, 70, 229, .14); }
body.spirale-topic .post.is-op .post-head { background: linear-gradient(180deg, #F5F6FF, #fff); border-bottom-color: #E4E7FF; }

body.spirale-topic .post-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
body.spirale-topic .post-av {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px; flex: none;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
}
body.spirale-topic .post-av.staff { background: linear-gradient(135deg, #4F46E5, #7C3AED); }
body.spirale-topic .post-av.op { background: linear-gradient(135deg, #10B981, #06B6D4); }
body.spirale-topic .post-id { flex: 1; min-width: 0; }
body.spirale-topic .post-id .name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
body.spirale-topic .post-id .name { font-size: 14.5px; font-weight: 700; color: var(--ink); letter-spacing: -0.005em; }
body.spirale-topic .post-id .name a { color: inherit; }
body.spirale-topic .post-id .name a:hover { color: var(--brand); }
body.spirale-topic .role {
  font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 999px;
  letter-spacing: .04em; text-transform: uppercase;
}
body.spirale-topic .role.op { background: var(--emerald-soft); color: var(--emerald); }
body.spirale-topic .role.staff { background: var(--brand-soft); color: var(--brand-ink); }
body.spirale-topic .role.member { background: var(--surface-2); color: var(--ink-3); }
body.spirale-topic .post-id .meta {
  font-size: 12.5px; color: var(--ink-3); margin-top: 2px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
body.spirale-topic .post-id .meta a { color: var(--ink-2); font-weight: 500; }
body.spirale-topic .post-id .meta a:hover { color: var(--brand); }
body.spirale-topic .post-id .meta .sep { color: #CBD2DD; }
body.spirale-topic .post-num {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px; color: var(--ink-3);
  padding: 4px 8px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  flex: none;
}

body.spirale-topic .post-body {
  padding: 18px 20px 20px;
  font-size: 14.5px; color: var(--ink); line-height: 1.7;
}
body.spirale-topic .post-body p { margin: 0 0 12px; }
body.spirale-topic .post-body p:last-child { margin-bottom: 0; }
body.spirale-topic .post-body ul,
body.spirale-topic .post-body ol { margin: 0 0 12px; padding-left: 22px; }
body.spirale-topic .post-body img { height: auto; border-radius: 8px; margin: 8px 0; }
body.spirale-topic .post-body a { color: var(--brand); text-decoration: none; }
body.spirale-topic .post-body a:hover { text-decoration: underline; }
body.spirale-topic .post-body blockquote {
  margin: 0 0 12px; padding: 10px 14px;
  border-left: 3px solid var(--line-strong); background: var(--surface-2);
  border-radius: 0 8px 8px 0; color: var(--ink-2);
}
body.spirale-topic .post-body code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12.5px; background: var(--surface-2);
  padding: 1px 6px; border-radius: 4px; color: var(--ink);
}
body.spirale-topic .post-body pre {
  background: #0F172A; color: #E2E8F0; padding: 14px 16px;
  border-radius: 10px; overflow-x: auto; margin: 0 0 12px;
}
body.spirale-topic .post-body pre code { background: none; padding: 0; color: inherit; font-size: 12.5px; }
body.spirale-topic .post-body .private-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--amber-soft); border: 1px solid #FED7AA;
  border-radius: 10px; font-size: 12.5px; color: var(--amber); font-weight: 500;
}
body.spirale-topic .post-body .private-banner svg { flex: none; }

body.spirale-topic .post-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #FAFAFC; border-top: 1px solid var(--line);
  gap: 10px; flex-wrap: wrap;
}
body.spirale-topic .post-foot .left { display: flex; align-items: center; gap: 4px; }
body.spirale-topic .post-foot .act {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-2);
  transition: background .12s, color .12s;
}
body.spirale-topic .post-foot .act:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topic .post-foot .act svg { color: var(--ink-3); }
body.spirale-topic .post-foot .act:hover svg { color: var(--ink-2); }
body.spirale-topic .post-foot .act.is-up { color: var(--brand); }
body.spirale-topic .post-foot .act.is-up svg { color: var(--brand); }
body.spirale-topic .post-foot .right { display: flex; align-items: center; gap: 4px; }
body.spirale-topic .post-foot .share-btn {
  width: 30px; height: 30px; border-radius: 8px;
  display: grid; place-items: center; color: var(--ink-3);
  transition: background .12s, color .12s;
}
body.spirale-topic .post-foot .share-btn:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- Reply form ---------- */
body.spirale-topic .reply-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  margin-top: 4px;
}
body.spirale-topic .reply-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #FAFAFC, #fff);
}
body.spirale-topic .reply-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 3px; }
body.spirale-topic .reply-head p { margin: 0; font-size: 13px; color: var(--ink-2); }
body.spirale-topic .reply-head .replying-to {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 8px; padding: 5px 10px;
  background: var(--brand-soft); border: 1px solid #DDE1FF;
  border-radius: 8px; font-size: 12px; color: var(--brand-ink); font-weight: 500;
}

body.spirale-topic .reply-body { padding: 22px; }
body.spirale-topic .field { margin-bottom: 16px; }
body.spirale-topic .field > label {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 6px;
}
body.spirale-topic .field > label .req { color: #DC2626; font-weight: 700; }
body.spirale-topic .field > label .hint { color: var(--ink-3); font-weight: 500; font-size: 12px; margin-left: auto; }
body.spirale-topic .field input[type="text"],
body.spirale-topic .field input[type="email"],
body.spirale-topic .field input[type="url"],
body.spirale-topic .field textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
body.spirale-topic .field input:focus,
body.spirale-topic .field textarea:focus {
  outline: 0; border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .14);
}
body.spirale-topic .field textarea { min-height: 140px; resize: vertical; line-height: 1.6; }
body.spirale-topic .field .row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
@media (max-width: 720px) { body.spirale-topic .field .row3 { grid-template-columns: 1fr; } }

body.spirale-topic .editor-bar {
  display: flex; gap: 2px; padding: 6px; border: 1px solid var(--line-strong);
  border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2);
}
body.spirale-topic .editor-bar button {
  width: 30px; height: 30px; border-radius: 6px; color: var(--ink-2);
  display: grid; place-items: center; transition: background .12s, color .12s;
}
body.spirale-topic .editor-bar button:hover { background: var(--surface); color: var(--ink); }
body.spirale-topic .editor-bar .sep { width: 1px; background: var(--line); margin: 4px 4px; }
body.spirale-topic .editor-bar + textarea { border-top-left-radius: 0; border-top-right-radius: 0; }

body.spirale-topic .reply-foot {
  padding: 14px 22px; border-top: 1px solid var(--line); background: #FAFAFC;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
body.spirale-topic .checkbox { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--ink-2); }
body.spirale-topic .checkbox input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--brand); flex: none; }
body.spirale-topic .checkbox a { color: var(--brand); font-weight: 500; }

/* Private replies plugin checkbox (rendered via bbp_theme_before_reply_form_submit_wrapper) */
body.spirale-topic form.reply-body p:has( #bbp_private_reply ) {
	display: flex; align-items: flex-start; gap: 9px; margin: 0 0 14px;
	font-size: 13px; color: var(--ink-2);
}
body.spirale-topic form.reply-body #bbp_private_reply {
	width: 16px; height: 16px; margin: 2px 0 0; flex: none; accent-color: var(--brand);margin-left: 5px;
}
body.spirale-topic form.reply-body label[for="bbp_private_reply"] {
	font-weight: 500; color: var(--ink-2);
}
body.spirale-topic .reply-foot .hint { font-size: 12px; color: var(--ink-3); }

body.spirale-topic .reply-msg { padding: 10px 22px; font-size: 13px; }
body.spirale-topic .reply-msg.is-error { color: #DC2626; }
body.spirale-topic .closed-notice {
  background: var(--amber-soft); border: 1px solid #FED7AA; color: var(--amber);
  padding: 14px 22px; font-size: 13px; font-weight: 500; border-radius: 0;
}

/* ---------- Sidebar ---------- */
body.spirale-topic .sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; align-self: start; }
body.spirale-topic .side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
body.spirale-topic .side-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-3);
  background: #FAFAFC;
}
body.spirale-topic .side-body { padding: 6px 0; }
body.spirale-topic .side-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 18px; font-size: 13px;
}
body.spirale-topic .side-row .k { color: var(--ink-2); }
body.spirale-topic .side-row .v { color: var(--ink); font-weight: 600; }
body.spirale-topic .side-row .v.link { color: var(--brand); }
body.spirale-topic .side-row .v.link:hover { color: var(--brand-ink); text-decoration: underline; }

body.spirale-topic .side-actions { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
body.spirale-topic .side-actions .btn { width: 100%; justify-content: flex-start; height: 36px; padding: 0 12px; font-size: 13px; }
body.spirale-topic .side-actions .btn-ghost { color: var(--ink-2); }
body.spirale-topic .side-actions .btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topic .side-actions .btn.is-on { color: var(--brand-ink); background: var(--brand-soft); }

/* related topics */
body.spirale-topic .related-item {
  display: block; padding: 11px 18px; border-bottom: 1px solid var(--line);
  transition: background .12s;
}
body.spirale-topic .related-item:last-child { border-bottom: 0; }
body.spirale-topic .related-item:hover { background: #FAFAFC; }
body.spirale-topic .related-item .rt-title {
  font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.4;
  margin: 0 0 4px; letter-spacing: -0.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
body.spirale-topic .related-item:hover .rt-title { color: var(--brand); }
body.spirale-topic .related-item .rt-meta { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
body.spirale-topic .related-item .rt-meta .sep { color: #CBD2DD; }
body.spirale-topic .related-item .rt-meta .pill {
  font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
  background: var(--emerald-soft); color: var(--emerald);
}
body.spirale-topic .related-item .rt-meta .pill.open { background: var(--surface-2); color: var(--ink-3); }

body.spirale-topic .side-cta {
  background: linear-gradient(135deg, #4F46E5 0%, #7C3AED 100%);
  color: #fff; padding: 18px; border-radius: var(--radius);
  position: relative; overflow: hidden;
}
body.spirale-topic .side-cta::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(300px 120px at 100% 0%, rgba(255,255,255,.18), transparent 60%);
  pointer-events: none;
}
body.spirale-topic .side-cta h4 { font-size: 15px; font-weight: 700; margin: 0 0 4px; position: relative; }
body.spirale-topic .side-cta p { font-size: 12.5px; margin: 0 0 12px; color: #C7D2FE; position: relative; }
body.spirale-topic .side-cta .btn { width: 100%; justify-content: center; background: #fff; color: var(--brand-ink); position: relative; }
body.spirale-topic .side-cta .btn:hover { background: #F5F6FF; }

/* ---------- Pagination ---------- */
body.spirale-topic .pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: #FAFAFC; border-top: 1px solid var(--line);
  font-size: 13px; color: var(--ink-3); gap: 12px;
}
body.spirale-topic .pagination .pages { display: flex; gap: 4px; flex-wrap: wrap; }
body.spirale-topic .pagination .page-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .12s, color .12s;
}
body.spirale-topic .pagination .page-btn:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topic .pagination .page-btn.is-active { background: var(--ink); color: #fff; }

/* bbPress pagination links inside the bar */
body.spirale-topic .pagination .pages a,
body.spirale-topic .pagination .pages span.page-numbers {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px;
  display: inline-grid; place-items: center;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: background .12s, color .12s;
}
body.spirale-topic .pagination .pages a:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topic .pagination .pages span.current { background: var(--ink); color: #fff; }
body.spirale-topic .pagination .pages a.prev,
body.spirale-topic .pagination .pages a.next { color: var(--ink-3); }

/* ---------- Topic responsive ---------- */
@media (max-width: 960px) {
  body.spirale-topic .topic-layout { grid-template-columns: 1fr; }
  body.spirale-topic .sidebar { position: static; order: 2; }
}
@media (max-width: 720px) {
  body.spirale-topic .post-head { flex-wrap: wrap; }
  body.spirale-topic .post-foot { flex-direction: column; align-items: stretch; }
  body.spirale-topic .post-foot .left, body.spirale-topic .post-foot .right { justify-content: space-between; }
}
