/* Publication layout for /community and single spaces.
   Replaces the plugin's dark SaaS stylesheet. */

.ch-hub,
.csc-page {
  --ink: #f5f5f7;
  --ink2: #ffffff;
  --ink3: #f5f5f7;
  --ink4: #eeeeef;
  --ghost: rgba(29, 29, 31, 0.04);
  --ghost2: rgba(29, 29, 31, 0.06);
  --wire: #d2d2d7;
  --wire2: #d2d2d7;
  --snow: #1d1d1f;
  --mist: #6e6e73;
  --fog: #86868b;
  --spark: #1d1d1f;
  --spark2: #424245;
  --green: #248a3d;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  font-family: var(--font);
  min-height: 0;
  padding-bottom: 96px;
  overflow-x: hidden;
  max-width: 100%;
}

body:has(.ch-hub),
body:has(.csc-page) {
  background: #f5f5f7;
}

.ch-hub-hero {
  background: #fff;
  border-bottom: 1px solid #d2d2d7;
  padding: 28px 16px 0;
}

.ch-hub-hero-inner,
.ch-hub-nav-inner,
.ch-hub-body,
.csc-identity,
.csc-tabs-inner,
.csc-body {
  width: 100%;
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
  box-sizing: border-box;
}

.ch-hub-eyebrow,
.ch-section-label,
.csc-namespace,
.csc-composer-title,
.ch-sidebar-head,
.csc-panel-head {
  color: #6e6e73;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ch-hub-hero-title,
.csc-name {
  margin: 8px 0 10px;
  font-family: var(--display);
  font-size: clamp(1.7rem, 6vw, 2.6rem);
  font-weight: 650;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: #1d1d1f;
}

.ch-hub-hero-sub {
  max-width: 36rem;
  margin: 0 0 20px;
  color: #6e6e73;
  font-size: 1rem;
  line-height: 1.5;
}

.ch-hub-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.ch-hub-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid #d2d2d7;
}

.ch-hub-stat {
  padding: 14px 24px 14px 0;
}

.ch-hub-stat strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 650;
  letter-spacing: -0.03em;
  color: #1d1d1f;
}

.ch-hub-stat small {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #86868b;
}

.ch-hub-nav,
.csc-tabs {
  position: sticky;
  top: 52px;
  z-index: 20;
  background: rgba(251, 251, 253, 0.94);
  border-bottom: 1px solid #d2d2d7;
  backdrop-filter: saturate(180%) blur(16px);
}

.ch-hub-nav-inner,
.csc-tabs-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding-top: 0;
  padding-bottom: 0;
  -webkit-overflow-scrolling: touch;
}

.ch-hub-nav-tab,
.csc-tab {
  flex: 0 0 auto;
  padding: 14px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #6e6e73;
  font: 600 13px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}

.ch-hub-nav-tab.is-active,
.csc-tab.is-active {
  color: #1d1d1f;
  border-bottom-color: #1d1d1f;
}

.ch-hub-nav-search {
  margin-left: auto;
  display: none;
}

.ch-hub-body,
.csc-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  padding-top: 20px;
  padding-bottom: 80px;
  align-items: start;
}

.ch-section-hd {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.ch-card,
.ch-sidebar-card,
.csc-sidebar-card,
.csc-card,
.csc-composer-trigger,
.csc-composer,
.csc-gate {
  background: #fff;
  border: 1px solid #d2d2d7;
  border-radius: 16px;
  overflow: hidden;
  min-width: 0;
}

.ch-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}

.ch-card-cover,
.ch-card-cover-gradient {
  height: 72px;
  background: #1d1d1f center / cover no-repeat;
}

.ch-card-body {
  padding: 0 14px 14px;
}

.ch-card-avatar-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: -18px;
  margin-bottom: 10px;
}

.ch-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 3px solid #fff;
  object-fit: cover;
  background: #1d1d1f;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.ch-card-name,
.csc-post-link {
  display: block;
  color: #1d1d1f;
  font-weight: 650;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.ch-card-desc,
.csc-post-excerpt,
.ch-feed-preview {
  margin: 4px 0 10px;
  color: #6e6e73;
  font-size: 0.86rem;
  line-height: 1.5;
}

.ch-card-footer,
.csc-post-foot {
  display: flex;
  gap: 12px;
  color: #86868b;
  font-size: 12px;
}

.ch-btn,
.csc-btn,
.ch-card-join-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 980px;
  background: #1d1d1f;
  color: #fff;
  font: 600 13px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

.ch-btn--outline,
.csc-btn--outline,
.csc-btn--leave,
.ch-btn--ghost {
  background: #f5f5f7;
  color: #1d1d1f;
}

.ch-btn--joined,
.csc-btn--joined,
.ch-card-join-sm[data-joined="1"] {
  background: #f5f5f7;
  color: #1d1d1f;
}

.ch-btn--sm,
.csc-btn--sm {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.ch-btn--full,
.csc-btn--full {
  width: 100%;
}

.ch-card-join-sm {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.ch-feed,
.csc-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ch-feed-item,
.csc-card {
  padding: 16px;
}

.ch-empty,
.csc-empty {
  padding: 40px 16px;
  text-align: center;
  color: #6e6e73;
}

.ch-create-field {
  margin-bottom: 12px;
}

.ch-create-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #6e6e73;
}

.ch-create-field input,
.ch-create-field textarea,
.csc-composer input,
.csc-composer-textarea {
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #d2d2d7;
  border-radius: 10px;
  background: #fff;
  color: #1d1d1f;
  font: 16px/1.4 var(--font);
}

.csc-cover {
  display: none;
  height: 96px;
  overflow: hidden;
  background: #1d1d1f;
}

.csc-cover.has-banner {
  display: block;
}

.csc-cover-img {
  width: 100%;
  height: 96px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.csc-identity {
  margin-top: 16px;
}

.csc-page:has(.csc-cover.has-banner) .csc-identity {
  margin-top: 12px;
}

.csc-identity-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #d2d2d7;
}

.csc-avatar {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: #1d1d1f;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  flex: 0 0 auto;
}

.csc-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.csc-identity-info {
  flex: 1 1 180px;
  min-width: 0;
}

.csc-name {
  margin: 2px 0 8px;
  font-size: clamp(1.4rem, 5vw, 2rem);
  overflow-wrap: anywhere;
  white-space: normal;
}

.csc-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: #6e6e73;
  font-size: 13px;
}

.csc-identity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.csc-panel {
  display: none;
}

.csc-panel.is-active {
  display: block;
}

.csc-composer {
  display: none;
  padding: 16px;
  margin-bottom: 14px;
}

.csc-composer.is-open {
  display: block;
}

.csc-composer-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  cursor: text;
}

.csc-composer-trigger-avatar,
.csc-composer-trigger-avatar img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  flex: 0 0 auto;
}

.csc-composer-trigger-input {
  flex: 1;
  min-width: 0;
  color: #86868b;
  font-size: 0.9rem;
}

.csc-composer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.csc-composer-close {
  border: 0;
  background: none;
  color: #6e6e73;
  font-size: 1.1rem;
  cursor: pointer;
}

.csc-composer-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.csc-composer-char {
  margin-right: auto;
  color: #86868b;
  font-size: 12px;
}

.csc-gate {
  padding: 18px;
  margin-bottom: 14px;
  text-align: center;
  color: #6e6e73;
}

.csc-sidebar-card {
  margin-bottom: 14px;
}

.csc-panel-head,
.ch-sidebar-head {
  padding: 12px 16px;
  border-bottom: 1px solid #d2d2d7;
}

.csc-panel-body,
.ch-sidebar-body {
  padding: 16px;
}

.csc-about-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.csc-about-stat strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 650;
}

.csc-about-stat small {
  color: #86868b;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.csc-mod-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.csc-mod-name {
  font-weight: 650;
  font-size: 0.88rem;
}

.csc-mod-role {
  color: #86868b;
  font-size: 12px;
}

.ch-mini-community {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid #d2d2d7;
}

.ch-mini-name {
  color: #1d1d1f;
  font-weight: 650;
  font-size: 0.88rem;
}

.ch-mini-count {
  color: #86868b;
  font-size: 12px;
}

@media (min-width: 700px) {
  .ch-hub,
  .csc-page {
    padding-bottom: 48px;
  }

  .ch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ch-hub-nav-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #fff;
    border: 1px solid #d2d2d7;
    border-radius: 10px;
  }

  .ch-hub-nav-search input {
    border: 0;
    outline: none;
    width: 160px;
    font: 14px/1.2 var(--font);
    background: transparent;
    color: #1d1d1f;
  }

  .csc-avatar {
    width: 72px;
    height: 72px;
    border-radius: 16px;
  }
}

@media (min-width: 960px) {
  .ch-hub-body,
  .csc-body {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 28px;
  }
}
