/* ---------------------------------------------------------------------------
   Communities directory — the /communities browse/search/featured page, the community tile, and the
   per-game communities section on a game's detail view. Backed by CommunitiesPage.razor,
   CommunityTile.razor. See docs/design/group.md.
   --------------------------------------------------------------------------- */

.communities-page { max-width: var(--content-max); margin-inline: auto; padding: 0.5rem clamp(1rem, 3vw, 2.5rem) calc(2rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: clamp(1.5rem, 3vw, 2.25rem); width: 100%; }
/* In the rail shape there is no top chrome bar over the content, so a flat half-rem lands the eyebrow ~8px
   from the top edge of the display and the page reads as if it had been scrolled slightly past its own top.
   Under the phone's top bar the half-rem is right, so the extra height is asked for at the rail's stop. */
@media (min-width: 56rem) {
    .communities-page { padding-top: clamp(1rem, 2.5vh, 2rem); }
}
.communities-page__head { display: flex; flex-direction: column; gap: 0.3rem; }
.communities-page__eyebrow { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-blue-ink); }
.communities-page__title { font-size: 1.75rem; font-weight: 700; }
.communities-page__sub { font-size: 0.9rem; color: var(--text-muted); }
.communities-page__tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; }
/* Starting a community sits beside the search it complements, and keeps its label on one line. */
.communities-page__create { flex: none; white-space: nowrap; }
/* Capped like the catalog's search (shell.css .landing__search): a field spanning a wide column reads as a
   form, not as a search bar over the directory — and it leaves the create action beside it rather than pushed
   to the far edge. */
.communities-search { flex: 1 1 auto; max-width: 34rem; position: relative; display: flex; align-items: center; }
.communities-search__icon { position: absolute; left: 0.7rem; font-size: 0.85rem; color: var(--text-muted); pointer-events: none; }
/* The icon sits inside the field's left inset, so the field's own padding clears it; the tap-target floor and
   the wider radius are this control's, and the rest is the .app-input recipe. Everything .app-input also sets
   is compounded with that class, because chrome.css loads after this sheet and would otherwise win it back. */
.communities-search__input { width: 100%; }
.communities-search__input.app-input { min-height: 2.75rem; padding-left: 1.9rem; border-radius: 0.7rem; }
/* The shelf sections reuse the shared .shelf chrome (head + title + grid); these grid rules size the
   community tiles, which are not .game-card-wrapper so .shelf__grid would give them no flex basis. */
/* The track floor is what decides how many communities share a row, and a community's name is the whole
   tile: a 12rem floor admits six tracks in the content column, every one of them landing near the floor with
   the name ellipsised, on a page with a wide empty gutter either side. 16rem gives four roomy tracks at
   desktop and five at tablet landscape, and full names at every width. */
.communities-featured__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.75rem; }
.communities-browse__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.75rem; }

/* One community browse tile. */
.community-tile {
    display: flex; flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 0.9rem;
    overflow: hidden;
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.community-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1); }
.community-tile__banner { position: relative; height: 4.5rem; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, hsl(var(--group-hue, 210) 55% 48%), hsl(var(--group-hue, 210) 60% 30%)); }
.community-tile__emblem { font-size: 1.6rem; font-weight: 700; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }
.community-tile__live { position: absolute; top: 0.4rem; right: 0.4rem; display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.1rem 0.4rem; border-radius: 9999px; background: rgba(0, 0, 0, 0.35); color: var(--text-on-accent); font-size: 0.68rem; font-weight: 600; }
.community-tile__live-dot { width: 0.4rem; height: 0.4rem; border-radius: 9999px; background: var(--accent-green); animation: group-pulse 1.8s ease-in-out infinite; }
.community-tile__body { display: flex; flex-direction: column; gap: 0.3rem; padding: 0.65rem 0.75rem 0.8rem; min-width: 0; }
.community-tile__name-row { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.community-tile__name { font-size: 0.95rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* The line is dot-separated; CommunityTile.razor binds the trailing "· playing" with a non-breaking space so
   a wrap cannot strand that one word on a row of its own. */
.community-tile__meta { font-size: 0.8rem; color: var(--text-muted); }
.community-tile__live-line { display: flex; align-items: center; gap: 0.3rem; min-width: 0; font-size: 0.78rem; color: var(--text-primary); }
.community-tile__live-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.community-tile__tags { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.community-tile__games { display: flex; flex-wrap: wrap; gap: 0.2rem; }
.community-tile__game { display: inline-flex; align-items: center; justify-content: center; width: 1.4rem; height: 1.4rem;
    border-radius: 0.4rem; background: var(--bg-hover); font-size: 0.85rem; }

/* Per-game communities section on a game's detail view. */
.gd-communities { display: flex; flex-direction: column; gap: 0.6rem; }
.gd-communities__row { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 0.75rem; }

@media (prefers-reduced-motion: reduce) {
    .community-tile__live-dot { animation: none; }
}
