body.community-page {
  --community-canvas: #f7f5ee;
  --community-paper: #fffefa;
  --community-ink: #142035;
  --community-muted: #555c66;
  --community-indigo: #383db0;
  --community-rule: #d8d6ce;
  --community-strong-rule: #8c9097;
  --community-hover: #ececf8;
  --community-error: #7d241c;
  --community-error-tint: #fff0ea;
  background: var(--community-canvas);
  color: var(--community-ink);
}

.community-page :focus-visible { outline-color: var(--community-indigo); }
.community-page ::selection { background: #dcdcfa; color: var(--community-ink); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

#identity {
  display: flex;
  align-items: center;
  gap: .45rem;
}

#community-actor {
  min-height: 44px;
  border: 1px solid var(--community-rule);
  padding: .25rem .4rem;
  background: var(--community-paper);
  color: var(--community-ink);
  font-size: .82rem;
  font-weight: 700;
}

main.community {
  padding-top: clamp(1rem, 2.6vw, 2.25rem);
  --conversation-padding: clamp(1.25rem, 3vw, 2.75rem);
}

.community-masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  column-gap: 1.5rem;
  border-bottom: 1px solid var(--community-rule);
}

.community-masthead h1 {
  margin-bottom: .55rem;
  font: 650 clamp(2.1rem, 4.2vw, 3.8rem)/1.05 var(--serif);
  letter-spacing: -.035em;
}

.community-sections {
  display: flex;
  gap: 0 clamp(.9rem, 2.6vw, 1.75rem);
  flex-wrap: wrap;
}

.community-sections a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: .12rem;
  border-bottom: 2px solid transparent;
  color: var(--community-muted);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}

.community-sections a:hover,
.community-sections a[aria-current="page"] { color: var(--community-indigo); }

.community-sections a[aria-current="page"] { border-color: currentColor; }

.community time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.community-page :is(.community-primary, .community-secondary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 6px;
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.25;
}

.community-primary {
  border-color: var(--community-indigo);
  background: var(--community-indigo);
  color: white;
}

.community-page .community-primary:hover:enabled {
  border-color: #2e328b;
  background: #2e328b;
}

.community-secondary {
  border-color: var(--community-strong-rule);
  background: var(--community-paper);
  color: var(--community-ink);
}

.community-page .community-secondary:hover:enabled {
  border-color: var(--community-indigo);
  background: var(--community-hover);
  color: var(--community-indigo);
}

.example-note,
.community-meta {
  color: var(--community-muted);
  font-size: .875rem;
}

.example-note { margin-block: .7rem 1rem; }

.community-feedback {
  margin: .75rem 0;
  padding: .6rem .9rem;
  border: 1px solid var(--community-rule);
  background: var(--community-paper);
  color: var(--community-ink);
  font-size: .875rem;
}

.community-feedback.is-error,
#dialog-error {
  border-color: #b45042;
  background: var(--community-error-tint);
  color: var(--community-error);
}

.community .community-layout {
  display: grid;
  grid-template-columns: minmax(16rem, 28%) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  margin-top: 0;
  border: 1px solid var(--community-rule);
  background: var(--community-paper);
}

.community-rooms {
  min-width: 0;
  border-inline-end: 1px solid var(--community-rule);
  background: var(--community-canvas);
}

.rooms-head {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--community-rule);
}

.community-page :is(#rooms-title, #dialog-title) {
  font: 650 clamp(1.18rem, 2vw, 1.45rem)/1.2 var(--serif);
  letter-spacing: -.025em;
}

.community-meta { margin-top: .22rem; }

#room-count { font-size: .76rem; }
#new-room { padding-inline: .62rem; font-size: .75rem; }

.community .room-list {
  display: grid;
  align-content: start;
  max-block-size: 29rem;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--community-strong-rule) transparent;
}

.community .room-list .room-card,
.community .member-card {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  min-width: 0;
  min-height: 44px;
  padding: .78rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--community-rule);
  border-radius: 0;
  background: transparent;
  color: var(--community-ink);
  text-align: left;
}

.community .room-card:hover:enabled,
.community .member-card:hover:enabled,
.community .room-list .room-card[aria-pressed="true"] {
  background: var(--community-hover);
}

.room-card:focus-visible,
.member-card:focus-visible,
.community-messages:focus-visible {
  outline-offset: -3px;
}

.room-copy,
.member-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: .2rem;
  overflow-wrap: anywhere;
}

.room-name,
.member-card strong {
  color: var(--community-ink);
  font-size: .9rem;
  line-height: 1.3;
}

.room-card[aria-pressed="true"] .room-name { color: var(--community-indigo); }

.room-description,
.room-meta,
.member-context {
  color: var(--community-muted);
  font-size: .77rem;
  line-height: 1.45;
}

.room-meta,
.member-context { font-size: .72rem; }

.community-avatar {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  flex: none;
  border-radius: 50%;
  background: #e2e2f5;
  color: var(--community-ink);
  font-size: .78rem;
  font-weight: 700;
}

.avatar-0 { background: #e9edd9; }
.avatar-2 { background: #f3e5d7; }

.community .conversation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-block-size: 27rem;
  border-radius: 0;
  background: var(--community-paper);
  box-shadow: none;
}

.community .conversation-head {
  padding: 1.4rem var(--conversation-padding) 1.1rem;
  border-bottom: 1px solid var(--community-rule);
  overflow-wrap: anywhere;
}

.community-page :is(#conversation-title, #posts-title, #members-title) {
  font: 650 clamp(1.75rem, 3.2vw, 2.85rem)/1.08 var(--serif);
  letter-spacing: -.035em;
}

.conversation-head .community-meta { margin-top: .5rem; }

.community .community-messages {
  flex: 1 1 auto;
  min-block-size: 0;
  max-block-size: min(44vh, 26rem);
  margin: 0;
  padding: 0 var(--conversation-padding);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--community-strong-rule) transparent;
  scrollbar-width: thin;
  list-style: none;
}

.community-messages:empty { display: none; }

.message-row {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding-block: .85rem;
}

.message-row + .message-row { border-top: 1px solid var(--community-rule); }
.message-copy { min-width: 0; }

.message-byline,
.post-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .55rem;
  color: var(--community-muted);
  font-size: .75rem;
  overflow-wrap: anywhere;
}

.message-byline strong {
  color: var(--community-ink);
  font-size: .85rem;
}

.message-text,
.post-body {
  max-width: 70ch;
  margin-top: .22rem;
  font-size: .925rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.conversation-empty,
.message-signin {
  padding: .9rem var(--conversation-padding);
  color: var(--community-muted);
  font-size: .86rem;
}

.conversation-empty { flex: 1; }

.message-signin,
.message-form {
  margin-top: auto;
  border-top: 1px solid var(--community-rule);
  background: var(--community-canvas);
}

.message-signin a { color: var(--community-indigo); }

.message-form {
  padding: .85rem var(--conversation-padding);
}

.message-entry {
  display: flex;
  gap: .6rem;
  align-items: flex-end;
}

#message-error { margin-top: 0; }

.message-form textarea,
.community-field :is(input, textarea) {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: .5rem .65rem;
  border: 1px solid var(--community-strong-rule);
  border-radius: 5px;
  background: var(--community-paper);
  color: var(--community-ink);
  caret-color: var(--community-indigo);
  font-size: 1rem;
}

.message-form textarea::placeholder { color: var(--community-muted); }
.message-form textarea { resize: vertical; }

.community .community-bottom > section {
  min-width: 0;
  padding: clamp(.95rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem);
  border: 1px solid var(--community-rule);
  border-radius: 0;
  background: var(--community-paper);
  box-shadow: none;
}

.community-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: .75rem;
}

.community-section-head > button { flex: none; }

.community-posts,
.member-list { margin-top: 1.25rem; }

.community .member-card {
  width: 100%;
  padding-inline: .25rem;
  border-top: 1px solid var(--community-rule);
  border-bottom: 0;
}

.community .member-card:last-child { border-bottom: 1px solid var(--community-rule); }
.member-copy .community-meta { max-width: 65ch; }

.community-post,
.community-empty {
  padding: .75rem 0 1.15rem;
  border-top: 1px solid var(--community-rule);
  overflow-wrap: anywhere;
}

.community-post h3 {
  margin-top: .4rem;
  font: 650 clamp(1.3rem, 2.5vw, 1.85rem)/1.2 var(--serif);
  letter-spacing: -.025em;
}

.post-byline { align-items: center; }

.post-author {
  min-height: 44px;
  max-width: 100%;
  padding: .15rem .1rem;
  border: 0;
  background: transparent;
  color: var(--community-indigo);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: .2em;
}

.community .post-author:hover:enabled { background: var(--community-hover); }

.content-example {
  color: var(--community-muted);
  font-size: .68rem;
}

.content-example::before {
  content: "";
  display: inline-block;
  margin-inline-end: .35rem;
  width: .65em;
  border-bottom: 1px solid var(--community-strong-rule);
  vertical-align: middle;
}

.clear-member { margin-top: .8rem; }

#community-dialog {
  width: min(480px, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
  padding: 0;
  border: 1px solid var(--community-rule);
  border-radius: 10px;
  background: var(--community-paper);
  color: var(--community-ink);
}

#community-dialog::backdrop { background: #14203588; }

.dialog-inner { padding: clamp(1rem, 4vw, 1.6rem); }
.dialog-inner .community-section-head { flex-wrap: nowrap; align-items: center; }
.dialog-close { min-width: 44px; padding: 0; }

#dialog-error {
  margin-top: .7rem;
  padding: .5rem .65rem;
  border-width: 1px;
  border-style: solid;
  font-size: .86rem;
}

#community-form {
  display: grid;
  gap: .8rem;
  justify-items: start;
  margin-top: 1rem;
}

.community-field {
  display: grid;
  width: 100%;
  gap: .25rem;
}

.community-field label {
  font-size: .85rem;
  font-weight: 700;
}

@media (max-width: 700px) {
  main.community { --conversation-padding: .85rem; }
  .community-masthead { display: block; }
  .community-masthead h1 { margin-bottom: .24rem; }
  .example-note { margin-block: .6rem .7rem; font-size: .79rem; }

  .community .community-layout { grid-template-columns: minmax(0, 1fr); }
  .community-rooms {
    border-inline-end: 0;
    border-bottom: 1px solid var(--community-rule);
  }

  .rooms-head {
    padding: .45rem .65rem;
    border-bottom: 0;
  }

  .community .room-list {
    grid-auto-flow: column;
    grid-auto-columns: min(71%, 16rem);
    align-items: stretch;
    gap: .4rem;
    max-block-size: none;
    padding: .2rem .65rem .55rem;
    margin: 0;
    scroll-padding-inline: .65rem;
    scroll-snap-type: x proximity;
  }

  .community .room-list .room-card {
    padding: .5rem .65rem;
    border: 1px solid var(--community-rule);
    border-radius: 5px;
    background: var(--community-paper);
    scroll-snap-align: start;
  }

  .community .room-list .room-card:is(:hover:enabled, [aria-pressed="true"]) {
    border-color: var(--community-indigo);
    background: var(--community-hover);
  }

  .room-description { display: none; }
  .community .conversation { min-block-size: 18rem; }
  .community .conversation-head { padding-block: .95rem .8rem; }
  .community .community-messages { max-block-size: min(48vh, 24rem); }

  #identity { gap: .25rem; }
}

@media (max-width: 355px) {
  .community-page .edition-row { flex-wrap: wrap; gap: 0; padding-block: .25rem; }
}
