/**
 * NableU maintainer note
 * Purpose: Presents the authenticated Community text wall with explicit audience, resilient forms, readable latest-first posts, and narrow-screen/high-contrast support.
 */

.community-live-band,
.community-composer-panel {
  display: grid;
  align-items: flex-start;
  gap: 20px;
  padding: 22px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: var(--bg-panel);
}

.community-live-band {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-width: 2px;
  border-color: var(--accent);
}

.community-live-band > div,
.community-composer-panel > div {
  min-width: 0;
}

.community-live-band h2,
.community-composer-panel h2 {
  margin-bottom: 8px;
}

.community-composer-panel {
  max-width: 840px;
  border-left: 5px solid var(--accent);
}

.community-composer,
.community-edit-form,
.community-feed-list {
  display: grid;
  gap: 14px;
}

.community-composer textarea,
.community-edit-form textarea,
.community-post-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.community-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--text-muted);
}

.community-primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.community-audience-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border-medium);
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--secondary-surface);
}

.community-draft-reminder {
  max-width: 840px;
}

.community-composer-meta p,
.community-composer-meta output,
.community-edit-form output {
  margin: 0;
}

.community-audience-confirmation {
  padding: 14px;
  border: 1px solid var(--border-medium);
  border-left: 5px solid var(--warning);
  border-radius: 12px;
  background: var(--secondary-surface);
}

.community-real-layout {
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
}

.community-feed-list {
  margin-top: 16px;
}

.community-real-post header {
  grid-template-columns: 48px minmax(0, 1fr) auto;
}

.community-author-mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--border-medium);
  border-radius: 50%;
  color: var(--text-main);
  background: var(--secondary-surface);
  font-weight: 800;
}

.community-post-body {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
}

.community-real-post footer .control-group {
  flex: 0 0 auto;
}

.community-load-more {
  justify-self: center;
  margin-top: 18px;
}

.community-hub-card article {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.community-locality-settings {
  overflow: clip;
  border: 1px solid var(--border-medium);
  border-radius: 18px;
  background: var(--bg-card);
}

.community-locality-settings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
  list-style: none;
}

.community-locality-settings > summary::-webkit-details-marker {
  display: none;
}

.community-locality-settings > summary span:first-child {
  display: grid;
  gap: 4px;
}

.community-locality-settings > summary small {
  color: var(--text-muted);
}

.community-locality-settings[open] > summary {
  border-bottom: 1px solid var(--line);
}

:root[data-theme="high-contrast"] .community-live-band,
:root[data-theme="high-contrast"] .community-composer-panel,
:root[data-theme="high-contrast"] .community-audience-confirmation,
:root[data-theme="high-contrast"] .community-audience-summary,
:root[data-theme="high-contrast"] .community-real-post,
:root[data-theme="high-contrast"] .community-locality-settings {
  border-color: #ffffff;
}

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

  .community-primary-actions {
    justify-content: flex-start;
  }

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

  .community-real-layout .community-context {
    position: static;
  }
}

@media (max-width: 640px) {
  .community-composer-meta,
  .community-audience-summary,
  .community-real-post footer,
  .community-locality-settings > summary {
    align-items: stretch;
    flex-direction: column;
  }

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

  .community-primary-actions button {
    width: 100%;
  }

  .community-real-post header {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .community-author-mark {
    width: 42px;
    height: 42px;
  }

  .community-real-post header .status {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .community-real-post footer .control-group,
  .community-real-post footer .control-group button,
  .community-composer .control-group,
  .community-composer .control-group button {
    width: 100%;
  }
}
