/* Design 003 page layout: Community (#/talk). Layout only: grid, flex, gaps, order, sticky. No colours, borders, radii, shadows or fonts. */
.fm-community { max-width: var(--fm-page-max); }
.fm-community .ch-lead { margin: 0 0 var(--fm-space-3); }
.fm-community__grid {
  display: grid; align-items: start; gap: var(--fm-space-4) var(--fm-space-5);
  grid-template-columns: var(--fm-rail-left) minmax(0, 1fr) var(--fm-rail-right);
  grid-template-areas: "rooms head rail" "rooms ask rail" "rooms hello rail" "rooms stream rail";
  grid-template-rows: auto auto auto 1fr;
}
.fm-community .ch-rooms { grid-area: rooms; position: sticky; top: var(--fm-space-4); max-height: calc(100vh - var(--fm-space-6)); overflow-y: auto; }
.fm-community .fm-community__head { grid-area: head; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--fm-space-3); min-width: 0; }
.fm-community .fm-community__head .fm-page__title { margin: 0; }
.fm-community .ch-ask { grid-area: ask; min-width: 0; }
.fm-community .ch-hello-slot { grid-area: hello; }
.fm-community .ch-hello-slot:empty { display: none; }
.fm-community .ch-stream { grid-area: stream; min-width: 0; display: flex; flex-direction: column; gap: var(--fm-space-3); }
.fm-community .ch-rail { grid-area: rail; position: sticky; top: var(--fm-space-4); min-width: 0; }
.fm-community .ch-card-host { display: flex; flex-direction: column; gap: var(--fm-space-3); }
.fm-community .ch-ask-form { display: flex; flex-direction: column; gap: var(--fm-space-3); }
.fm-community .ch-gate-host { display: flex; flex-direction: column; gap: var(--fm-space-2); }
.fm-community .ch-gate-host:empty, .fm-community .ch-ack-host:empty { display: none; }
.fm-community .ch-picker { display: flex; flex-wrap: wrap; align-items: center; gap: var(--fm-space-2); }
.fm-community .ch-check { display: flex; align-items: flex-start; gap: var(--fm-space-2); min-height: var(--fm-tap-min); }
.fm-community .ch-ask[hidden], .fm-community .ch-picker[hidden], .fm-community .ch-follow-empty[hidden] { display: none; }
.fm-community .ch-rooms-body { display: block; }
.fm-community .ch-more > summary { min-height: var(--fm-tap-min); display: flex; align-items: center; cursor: pointer; }
body.fd-design .fm-community .fm-post[data-vote="none"] { grid-template-columns: minmax(0, 1fr); }
.fm-community .ch-chips { margin: 0; }
.fm-community .ch-unanswered-acts { margin-top: var(--fm-space-2); }
.fm-community .fm-spaces__group > ul { display: block; }

@media (max-width: 1024px) {
  /* Spaces become a scrolling row of chips above the feed; the right rail stacks below. */
  .fm-community__grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "rooms" "head" "ask" "hello" "stream" "rail";
    grid-template-rows: auto;
  }
  .fm-community .ch-rooms { position: static; max-height: none; overflow: visible; }
  .fm-community .ch-rail { position: static; }
  .fm-community .ch-rooms-body { display: flex; gap: var(--fm-space-2); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: var(--fm-space-1); }
  .fm-community .fm-spaces__group, .fm-community .fm-spaces__group > ul, .fm-community .fm-spaces__group > ul > li, .fm-community .ch-more { display: contents; }
  .fm-community .fm-spaces__group-title, .fm-community .ch-more > summary, .fm-community .ch-new-note, .fm-community .ch-group > .ch-note { display: none; }
  body.fd-design .fm-community .fm-space { flex: none; width: auto; max-width: 70vw; white-space: nowrap; }
}

@media (max-width: 480px) {
  /* Single column. The composer is a bottom sheet opened by the New post button. */
  /* body.fd-design prefix: the library's card display rule (.fm-card) must not re-show the composer at rest. */
  body.fd-design .fm-community .ch-ask:not([data-open="true"]) { display: none; }
  body.fd-design .fm-community .ch-ask[data-open="true"] {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 100; /* above the tab bar (90), below the shell sheets (110): Post must be reachable */
    max-height: 85vh; overflow-y: auto; padding-bottom: calc(var(--fm-space-4) + env(safe-area-inset-bottom, 0px));
  }
  body.fd-design .fm-community .fm-fab { display: inline-flex; }
  /* Room for the last card's actions above the button and the tab bar. */
  .fm-community .ch-rail { padding-bottom: calc(var(--fm-space-8) + var(--fm-space-8)); }
  body.fd-design .fm-community .fm-post { gap: var(--fm-space-2); padding: var(--fm-space-3); }
}
