.communities-main {
  width: 100%;
  max-width: 1040px;
}

.community-associations {
  min-width: 0;
  padding: 12px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
}

.community-associations[hidden] {
  display: none;
}

.association-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  overflow-wrap: anywhere;
}

.association-row > div {
  min-width: 0;
}

.association-row button {
  flex-shrink: 0;
  padding: 8px;
}

.community-title-row,
.community-actions,
.community-filters,
.community-member-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.community-title-row {
  justify-content: space-between;
}

.community-title-row h1 {
  margin: 0;
  font-size: 1.5rem;
}

.community-title-row p,
.community-note {
  color: #666;
  font-size: 0.9rem;
}

.community-filters {
  align-items: flex-end;
}

.community-form {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  background: white;
  color: black;
}

.community-form label,
.community-filters label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
}

.community-form input,
.community-form textarea,
.community-form select,
.community-filters input,
.community-filters select {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 9px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: white;
  color: black;
  font: inherit;
  font-weight: 400;
}

.community-form textarea {
  height: 100px;
}

.community-form > button {
  justify-self: end;
}

.community-form input[type='color'] {
  padding: 2px;
  height: 36px;
  width: 80px;
}

.community-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.community-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  color: inherit;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.community-card:hover {
  border-color: #999;
}

.community-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}

.community-card h3 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.community-card p {
  margin: 6px 0 0;
  color: #666;
  font-size: 0.9rem;
}

.community-card .community-card-description {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.community-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
  padding: 20px;
  min-height: calc(100vh - 65px);
  background: var(--community-background, white);
  color: var(--community-text, black);
}

/* Links take the community's text color, as weak as the sitewide black so buttons keep theirs. */
:where(.community-layout) a {
  color: var(--community-text, black);
}

main.community-main {
  width: 100%;
  max-width: 680px;
  min-width: 0;
  padding: 0;
  gap: 0;
}

.community-right {
  min-width: 0;
}

.community-panel,
.community-header {
  border: 1px solid #e3e3e3;
  border-radius: 3px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}

.community-panel {
  padding: 14px;
}

.community-panel h2 {
  font-size: 1rem;
  margin: 0 0 10px;
}

.community-panel p {
  white-space: pre-wrap;
}

.community-panel a,
.community-header a {
  color: inherit;
}

.community-banner {
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 3px 3px 0 0;
  background: #f2f2f2;
}

.community-header-info {
  padding: 16px;
}

.community-header h1 {
  font-size: 1.5rem;
  margin: 0 0 6px;
}

.community-header .community-avatar {
  width: 72px;
  height: 72px;
}

.community-header .community-title-row {
  justify-content: flex-start;
  align-items: flex-start;
}

.community-actions {
  margin-top: 16px;
}

.community-actions .button-secondary[aria-pressed='true'] {
  background: black;
  color: white;
}

.community-member-row {
  padding: 10px 0;
  border-bottom: 1px solid #e3e3e3;
}

.community-member-row > div:first-child {
  flex: 1;
  min-width: 150px;
}

.community-pinned {
  font-size: 0.8rem;
  font-weight: 700;
  margin: 8px 0;
}

.community-layout .post {
  background: transparent;
  color: inherit;
}

.community-layout .timeline-name,
.community-layout .post-content,
.community-layout .post-actions {
  color: inherit;
}

.community-layout .community-note,
.community-layout .username,
.community-layout time {
  color: inherit;
  opacity: 0.75;
}

.community-panel ol {
  padding-left: 20px;
}

.community-panel li {
  margin: 8px 0;
  white-space: pre-wrap;
}

.community-event {
  padding: 12px 0;
  border-top: 1px solid #e3e3e3;
}

.community-event h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1150px) {
  .community-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-right {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  .community-form input,
  .community-form textarea,
  .community-form select,
  .community-filters input,
  .community-filters select {
    font-size: 16px;
  }

  .community-layout {
    padding: 16px 10px;
  }

  .community-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .community-title-row > div {
    min-width: 0;
  }
}

/* No status yet: no blank space above the lists. */
#communityStatus:empty {
  display: none;
}

.community-start {
  margin: 0 0 4px;
}

/* members box: owner, moderators, then members, with search (scripts/communities.js) */
.community-people-search input {
  box-sizing: border-box;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 3px;
  font: inherit;
}

.community-person {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  color: inherit;
  text-decoration: none;
}

.community-person img {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.community-person img.pfp-square {
  border-radius: 3px;
}

.community-person > span:not(.community-role) {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.community-role {
  margin-left: auto;
  padding: 1px 6px;
  border: 1px solid #999;
  border-radius: 3px;
  color: #555;
  font-size: 0.75rem;
}

.community-role-owner {
  border-color: black;
  background: black;
  color: white;
}

/* reports about this community's posts, in the manage panel */
.community-report {
  padding: 10px 0;
  border-top: 1px solid #e3e3e3;
}

.community-report p {
  margin: 0 0 6px;
}

.community-report-reason {
  font-style: italic;
}

.community-report blockquote {
  margin: 0 0 8px;
  padding: 6px 10px;
  border-left: 3px solid #e3e3e3;
  color: #555;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.community-report .community-actions {
  align-items: center;
}

.community-danger {
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid #e3e3e3;
}

.community-danger [data-action='delete-community'] {
  border-color: #c62828;
  color: #c62828;
}
