/* ============================================================
   Spiracle KB — Topic archive ( /?post_type=topic ) styles
   Self-contained: shared design tokens live in base.css.
   Accent: brand indigo (global, neutral across free/premium).
   ============================================================ */

/* ---------- Accent tokens ---------- */
body.spirale-topics {
  --accent: var(--brand);
  --accent-2: #7C3AED;
  --accent-soft: var(--brand-soft);
  --accent-ink: var(--brand-ink);
  --accent-hover: #4338CA;
  --accent-rgb: 79, 70, 229;
}

/* ---------- Hero (page head) ---------- */
body.spirale-topics .topics-hero {
  position: relative; overflow: hidden;
  padding: 36px 0 32px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1000px 360px at 50% -120px, rgba(var(--accent-rgb), .12), transparent 60%),
    radial-gradient(800px 320px at 100% 0%, rgba(124, 58, 237, .08), transparent 60%),
    var(--bg);
}
body.spirale-topics .topics-hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(15,23,42,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.035) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 80%);
          mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 80%);
  pointer-events: none;
}
body.spirale-topics .topics-hero-inner { position: relative; }

body.spirale-topics .crumbs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-3); margin-bottom: 18px;
}
body.spirale-topics .crumbs a { color: var(--ink-2); font-weight: 500; padding: 4px 8px; border-radius: 6px; transition: background .15s, color .15s; }
body.spirale-topics .crumbs a:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topics .crumbs .sep { color: #CBD2DD; }
body.spirale-topics .crumbs .current { color: var(--ink); font-weight: 600; padding: 4px 8px; }

body.spirale-topics .topics-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
body.spirale-topics .topics-hero-left { flex: 1; min-width: 280px; }
body.spirale-topics .topics-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--accent); font-size: 12.5px; font-weight: 600;
  box-shadow: var(--shadow-sm); margin-bottom: 16px;
}
body.spirale-topics .topics-badge .star { color: var(--accent); }
body.spirale-topics .topics-badge .live-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--emerald); box-shadow: 0 0 0 3px rgba(5,150,105,.18); margin-left: 4px; }

body.spirale-topics .topics-hero h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.1; letter-spacing: -0.025em;
  font-weight: 800; margin: 0 0 10px; color: var(--ink);
}
body.spirale-topics .topics-hero .lead { color: var(--ink-2); font-size: 16px; max-width: 620px; margin: 0 0 18px; }

body.spirale-topics .topics-stats {
  display: flex; gap: 22px; flex-wrap: wrap;
  font-size: 13px; color: var(--ink-3);
}
body.spirale-topics .topics-stats .s { display: inline-flex; align-items: center; gap: 6px; }
body.spirale-topics .topics-stats .s b { color: var(--ink); font-weight: 700; font-size: 14px; }
body.spirale-topics .topics-stats .s svg { color: var(--ink-3); }

body.spirale-topics .topics-hero-right { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
@media (max-width: 720px) { body.spirale-topics .topics-hero-right { align-items: stretch; width: 100%; } }

/* ---------- Section heads ---------- */
body.spirale-topics .topics-main { padding: 40px 0 64px; }
body.spirale-topics .sec-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 16px; flex-wrap: wrap; }
body.spirale-topics .sec-kicker { font-size: 12.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
body.spirale-topics .sec-title { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 4px; color: var(--ink); }
body.spirale-topics .sec-sub { color: var(--ink-2); font-size: 14px; margin: 0; }
body.spirale-topics .sec-sub b { color: var(--ink); font-weight: 700; }

/* ---------- Topic list ---------- */
body.spirale-topics .topics-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
body.spirale-topics .topics-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #FAFAFC, #fff); flex-wrap: wrap;
}
body.spirale-topics .tabs { display: flex; gap: 4px; flex-wrap: wrap; }
body.spirale-topics .tab {
  padding: 7px 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: all .15s; cursor: pointer; border: 0; background: transparent;
}
body.spirale-topics .tab:hover { background: var(--surface-2); color: var(--ink); }
body.spirale-topics .tab.is-active { background: var(--accent); color: #fff; }
body.spirale-topics .tab .count { margin-left: 5px; font-size: 11px; font-weight: 500; opacity: .8; }

body.spirale-topics .mini-search {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; padding: 5px 10px;
  transition: border-color .15s;
}
body.spirale-topics .mini-search:focus-within { border-color: var(--accent); }
body.spirale-topics .mini-search svg { color: var(--ink-3); flex: none; }
body.spirale-topics .mini-search input {
  border: 0; outline: none; background: transparent;
  font-size: 13px; color: var(--ink); padding: 2px 0; width: 190px;
}
body.spirale-topics .mini-search input::placeholder { color: var(--ink-3); }
@media (max-width: 560px) { body.spirale-topics .mini-search input { width: 130px; } }

body.spirale-topics .topic-list { list-style: none; padding: 0; margin: 0; }
body.spirale-topics .topic {
  display: grid; grid-template-columns: 36px 1fr auto auto; gap: 16px;
  align-items: center; padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  transition: background .15s;
}
body.spirale-topics .topic:last-child { border-bottom: 0; }
body.spirale-topics .topic:hover { background: #FAFAFC; }
body.spirale-topics .avatar {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #F59E0B, #EF4444);
}
body.spirale-topics .avatar.a2 { background: linear-gradient(135deg, #6366F1, #8B5CF6); }
body.spirale-topics .avatar.a3 { background: linear-gradient(135deg, #10B981, #06B6D4); }
body.spirale-topics .avatar.a4 { background: linear-gradient(135deg, #EC4899, #8B5CF6); }
body.spirale-topics .avatar.a5 { background: linear-gradient(135deg, #3B82F6, #06B6D4); }
body.spirale-topics .avatar.staff { background: linear-gradient(135deg, #4F46E5, #7C3AED); }

body.spirale-topics .topic-main { min-width: 0; }
body.spirale-topics .topic-title {
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  margin: 0 0 4px; letter-spacing: -0.005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
body.spirale-topics .topic-title a:hover { color: var(--accent); }
body.spirale-topics .topic-meta {
  font-size: 12.5px; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
body.spirale-topics .topic-meta a { color: var(--ink-2); font-weight: 500; }
body.spirale-topics .topic-meta a:hover { color: var(--accent); }
body.spirale-topics .topic-meta .sep { color: #CBD2DD; }
body.spirale-topics .pill {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2);
}
body.spirale-topics .pill.solved { background: var(--emerald-soft); color: var(--emerald); border-color: #A7F3D0; }
body.spirale-topics .pill.hot { background: #FEF2F2; color: #DC2626; border-color: #FECACA; }
body.spirale-topics .pill.staff { background: var(--brand-soft); color: var(--brand-ink); border-color: #DDE1FF; }
body.spirale-topics .pill.pro { background: var(--amber-soft); color: var(--amber); border-color: #FDE4C9; }
body.spirale-topics .pill.free { background: var(--brand-soft); color: var(--brand-ink); border-color: #DDE1FF; }

body.spirale-topics .topic-stats { text-align: right; min-width: 70px; }
body.spirale-topics .topic-stats .n { font-size: 15px; font-weight: 700; color: var(--ink); }
body.spirale-topics .topic-stats .l { font-size: 11.5px; color: var(--ink-3); }
body.spirale-topics .topic-time { font-size: 12.5px; color: var(--ink-3); min-width: 70px; text-align: right; }

body.spirale-topics .empty-state {
  padding: 40px 24px; text-align: center; color: var(--ink-3); font-size: 14px;
}

@media (max-width: 720px) {
  body.spirale-topics .topic { grid-template-columns: 32px 1fr; }
  body.spirale-topics .topic-stats, body.spirale-topics .topic-time { display: none; }
}

/* ---------- Pagination ---------- */
body.spirale-topics .pagination {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 24px; justify-content: center;
}
body.spirale-topics .pagination .page-numbers {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--surface);
  transition: all .15s; text-decoration: none;
}
body.spirale-topics .pagination .page-numbers:hover { border-color: #CBD2DD; color: var(--ink); transform: translateY(-1px); }
body.spirale-topics .pagination .page-numbers.current {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 6px 16px -4px rgba(var(--accent-rgb), .42);
}
body.spirale-topics .pagination .page-numbers.dots { border-color: transparent; background: transparent; color: var(--ink-3); }
body.spirale-topics .pagination .page-numbers.prev,
body.spirale-topics .pagination .page-numbers.next { padding: 0 12px; }
body.spirale-topics .pagination .page-numbers svg { display: block; }

/* ---------- Layout: main + sidebar ---------- */
body.spirale-topics .layout { display: grid; grid-template-columns: 1fr 320px; gap: 28px; align-items: start; }
body.spirale-topics .sidebar { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }
body.spirale-topics .side-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
}
body.spirale-topics .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;
  display: flex; align-items: center; gap: 8px;
}
body.spirale-topics .side-head svg { color: var(--accent); }
body.spirale-topics .side-body { padding: 6px 0; }
body.spirale-topics .side-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 18px; font-size: 13px; transition: background .15s;
}
body.spirale-topics .side-row:hover { background: #FAFAFC; }
body.spirale-topics .side-row .k { color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; }
body.spirale-topics .side-row .v { color: var(--ink); font-weight: 600; }
body.spirale-topics .side-row .v.link { color: var(--accent); }
body.spirale-topics .side-row .v.link:hover { color: var(--accent-ink); text-decoration: underline; }

body.spirale-topics .swatch {
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-grid; place-items: center;
  font-size: 10px; font-weight: 700; flex: none;
}
body.spirale-topics .swatch.free { background: var(--brand-soft); color: var(--brand-ink); }
body.spirale-topics .swatch.pro { background: var(--amber-soft); color: var(--amber); }

body.spirale-topics .side-cta {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff; padding: 18px; border-radius: var(--radius);
  position: relative; overflow: hidden;
}
body.spirale-topics .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-topics .side-cta h4 { font-size: 15px; font-weight: 700; margin: 0 0 4px; position: relative; }
body.spirale-topics .side-cta p { font-size: 12.5px; margin: 0 0 12px; color: rgba(255,255,255,.85); position: relative; }
body.spirale-topics .side-cta .btn { width: 100%; justify-content: center; background: #fff; color: var(--accent-ink); position: relative; }
body.spirale-topics .side-cta .btn:hover { background: #fff7; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  body.spirale-topics .layout { grid-template-columns: 1fr; }
  body.spirale-topics .sidebar { position: static; order: 2; }
}
@media (max-width: 720px) {
  body.spirale-topics .topics-hero { padding: 28px 0 24px; }
  body.spirale-topics .topics-main { padding: 32px 0 56px; }
}
