/* Plugin SDK neutral primitives + back-compat aliases.
 *
 * Linked by public pages (PUBLIC_STYLESHEETS in crowberry/ssr/layout.py) and by the admin
 * shell (crowberry/frontend/index.html). */

/* ---- Plugin SDK neutral primitives ---------------------------------------
 *
 * Use these from any plugin instead of plugin-specific classes when you
 * want the styling to track core. Plugins keep their own classes for
 * domain-specific layout in plugin CSS; the
 * neutral utility classes below cover the patterns that show up in every
 * plugin (rendered Markdown body, empty-state callout).
 *
 * - ``.cb-prose``: rendered-Markdown body.
 * - ``.cb-empty``: muted empty-state placeholder.
 */

.cb-prose {
  word-wrap: break-word;
}
.cb-prose p:first-child {
  margin-top: 0;
}
.cb-prose p:last-child {
  margin-bottom: 0;
}
.cb-prose p:empty,
.cb-prose-body p:empty,
.page-body p:empty,
.multi-intro p:empty {
  display: none;
  margin: 0;
}
.cb-prose p:has(> br:only-child),
.cb-prose-body p:has(> br:only-child),
.page-body p:has(> br:only-child),
.multi-intro p:has(> br:only-child) {
  display: none;
  margin: 0;
}
.cb-prose pre {
  background: var(--bg-elev-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
}
.cb-prose code {
  font-family: var(--font-mono);
  background: var(--bg-elev-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.cb-prose pre code {
  padding: 0;
  background: transparent;
}
.cb-prose img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

.cb-empty {
  color: var(--text-muted);
  padding: 32px;
  text-align: center;
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Generic progress goal bar (donations, fundraisers, …) */
.cb-progress-goal-track {
  height: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  overflow: hidden;
}
.cb-progress-goal-fill {
  height: 100%;
  background: var(--accent, #4f5fdc);
  border-radius: var(--radius-sm);
  transition: width 0.2s ease;
}
.cb-progress-goal-label {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}
.cb-link-button-list {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cb-prose-body {
  word-wrap: break-word;
}
.cb-prose-body p:first-child {
  margin-top: 0;
}
.cb-prose-body p:last-child {
  margin-bottom: 0;
}
.cb-prose-body pre {
  background: var(--bg-elev-2);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
}
.cb-prose-body code {
  font-family: var(--font-mono);
  background: var(--bg-elev-2);
  padding: 1px 5px;
  border-radius: 4px;
}
.cb-prose-body pre code {
  padding: 0;
  background: transparent;
}
.cb-prose-body img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}
/* ---- Shared content cards & tags ---- */

.cb-content-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

.cb-content-card--featured {
  border-color: var(--accent);
}

.cb-content-card h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.25rem;
}

.cb-content-card h2 a {
  color: inherit;
  text-decoration: none;
}

.cb-content-card h2 a:hover {
  text-decoration: underline;
}

.cb-content-card-meta,
motion.cb-content-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: var(--space-2);
}

.cb-content-card-body {
  margin-top: var(--space-2);
}

.cb-cover {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}

.cb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: var(--space-2) 0;
}

.cb-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elev-2);
  color: var(--text-muted);
}

.cb-tag-link {
  text-decoration: none;
  color: inherit;
}

.cb-tag-link:hover .cb-tag {
  background: var(--accent-muted);
  color: var(--text);
}

.stats-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
}
.stats-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.stats-tile {
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.stats-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.2;
}
.stats-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: var(--space-1);
}

.stats-counter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: stretch;
  justify-content: flex-start;
}

.stats-counter-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 6rem;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}

.stats-counter-item .stats-value {
  font-size: 1.5rem;
}

.stats-counter-item .stats-label {
  margin-top: var(--space-1);
}
