/* community.mss.gs: a community's own page (/{name}/{server guid}) and the
   list of them (/), internal/pages/communitychannel/server_render.go.
   Every community gets its own colour from its guid (--cs-h, a hue), so no
   two pages look alike; a community with a picture also lends it to the
   banner, blurred. Rounded squares throughout, like the apps. */

.cs,
.cs-dir-card {
  --cs-c1: hsl(var(--cs-h, 150) 42% 34%);
  --cs-c2: hsl(calc(var(--cs-h, 150) + 38) 48% 22%);
  --cs-ink: hsl(var(--cs-h, 150) 45% 26%);
  --cs-tint: hsl(var(--cs-h, 150) 35% 45% / 0.08);
  --cs-tint-line: hsl(var(--cs-h, 150) 35% 35% / 0.14);
  --cs-paper: #fffdf6;
}

.cs {
  max-width: 1120px;
  margin: 0 auto;
  padding: 104px 20px 72px;
}

/* ---- Breadcrumb ---- */
.cs-crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px 4px;
  font-size: 13.5px;
  color: var(--w-mut);
}
.cs-crumbs a {
  color: var(--w-mut);
  font-weight: 600;
  text-decoration: none;
}
.cs-crumbs a:hover { color: var(--w-ink); }
.cs-crumbs i { font-size: 10px; opacity: 0.55; }
.cs-crumbs span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Hero ---- */
.cs-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border-radius: 28px;
  background: var(--cs-paper);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset, 0 18px 50px rgba(31, 35, 33, 0.1);
}
.cs-banner {
  position: relative;
  height: 210px;
  overflow: hidden;
  background:
    radial-gradient(120% 140% at 12% 0%, hsl(var(--cs-h) 60% 58% / 0.85), transparent 55%),
    radial-gradient(90% 130% at 88% 20%, hsl(calc(var(--cs-h) + 70) 62% 62% / 0.6), transparent 60%),
    linear-gradient(135deg, var(--cs-c1), var(--cs-c2));
}
.cs-banner img {
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  object-fit: cover;
  filter: blur(56px) saturate(1.6);
  opacity: 0.7;
}
/* A fine dot grid that fades out: texture, not pattern. */
.cs-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1.5px);
  background-size: 18px 18px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}
/* The picture rides up into the banner; the name and the buttons start
   just below it. */
.cs-head {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 26px;
  align-items: start;
  margin-top: -62px;
  padding: 0 34px;
}
.cs-icon {
  display: grid;
  place-items: center;
  width: 124px;
  height: 124px;
  overflow: hidden;
  border-radius: 30px;
  background: linear-gradient(135deg, var(--cs-c1), var(--cs-c2));
  box-shadow: 0 0 0 6px var(--cs-paper), 0 14px 34px rgba(0, 0, 0, 0.2);
}
.cs-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-icon.is-letter,
.cs-dir-icon.is-letter {
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
}
.cs-icon.is-letter { font-size: 56px; }
.cs-id {
  min-width: 0;
  padding-top: 80px;
}
.cs-eyebrow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--cs-ink);
}
.cs-eyebrow > i { font-size: 12px; }
.cs-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(47, 110, 72, 0.1);
  color: var(--green-700);
}
.cs-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2fbf5b;
  animation: csPulse 2.2s ease-out infinite;
}
@keyframes csPulse {
  0% { box-shadow: 0 0 0 0 rgba(47, 191, 91, 0.55); }
  70% { box-shadow: 0 0 0 9px rgba(47, 191, 91, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 191, 91, 0); }
}
.cs-name {
  margin: 0;
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.04;
  color: var(--w-ink);
  overflow-wrap: anywhere;
}
.cs-verified {
  font-size: 0.5em;
  vertical-align: 0.4em;
  color: #2f86d6;
}
.cs-desc {
  max-width: 46rem;
  margin: 12px 0 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--w-ink3);
  overflow-wrap: anywhere;
}
.cs-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 230px;
  padding-top: 80px;
}
.cs-cta .btn-f-primary {
  background: var(--cs-c1);
  box-shadow: 0 6px 18px hsl(var(--cs-h) 45% 25% / 0.3);
}
.cs-cta .btn-f-primary:hover {
  background: var(--cs-c2);
  box-shadow: 0 10px 26px hsl(var(--cs-h) 45% 20% / 0.35);
}
.cs-cta-note {
  margin: 2px 0 0;
  font-size: 12.5px;
  text-align: center;
  color: var(--w-mut);
}
.cs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 28px 34px 32px;
  padding: 0;
  list-style: none;
}
.cs-stats li {
  padding: 14px 16px;
  border: 1px solid var(--cs-tint-line);
  border-radius: 14px;
  background: var(--cs-tint);
}
.cs-stats b {
  display: block;
  font-family: var(--font-display);
  font-size: 27px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--w-ink);
}
.cs-stats span {
  font-size: 13px;
  color: var(--w-mut);
}

/* ---- Body ---- */
.cs-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
  margin-top: 32px;
}
.cs-section { margin: 0 0 32px; }
.cs-section-head h2 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 25px;
  color: var(--w-ink);
}
.cs-section-head h2 i {
  font-size: 17px;
  color: var(--cs-ink);
}
.cs-section-head p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--w-mut);
}
.cs-section-head { margin-bottom: 14px; }

/* What people talk about */
.cs-topics {
  display: grid;
  gap: 14px;
}
.cs-topic-card {
  padding: 20px 22px;
  border: 1px solid var(--w-line);
  border-radius: 18px;
  background: var(--cs-paper);
  box-shadow: 0 6px 22px rgba(31, 35, 33, 0.06);
}
.cs-topic-card header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 10px;
}
.cs-chan-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--cs-tint);
  color: var(--cs-ink);
  font-weight: 700;
  text-decoration: none;
}
.cs-chan-link:hover { color: var(--w-ink); }
.cs-chan-link i { font-size: 12px; }
.cs-updated {
  font-size: 12.5px;
  color: var(--w-mut);
}
.cs-summary {
  margin: 0 0 14px;
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--w-ink2);
}
.cs-topic-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cs-topic-list li {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--cs-tint);
}
.cs-topic-list b {
  display: block;
  margin-bottom: 3px;
  font-size: 14.5px;
  color: var(--w-ink);
}
.cs-topic-list span {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--w-ink3);
}

/* Latest on the web: the app's own dark window, without a name in it. */
.cs-window {
  overflow: hidden;
  border-radius: 18px;
  background: var(--app-chat);
  box-shadow: 0 20px 48px rgba(18, 22, 20, 0.22);
}
.cs-window-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--app-border);
  background: var(--app-frame);
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 600;
}
.cs-dots { display: flex; gap: 6px; }
.cs-dots i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #505259;
}
.cs-window-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-msgs {
  margin: 0;
  padding: 8px 0;
  list-style: none;
}
.cs-msg {
  display: flex;
  gap: 12px;
  padding: 9px 18px;
}
.cs-msg:hover { background: var(--app-hover); }
.cs-msg-av {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4b4d55, #393a40);
}
.cs-msg > div { min-width: 0; }
.cs-msg-meta {
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--text-time);
}
.cs-msg-meta a {
  color: var(--text-mid);
  font-weight: 600;
  text-decoration: none;
}
.cs-msg-meta a:hover { color: var(--text-hi); }
.cs-msg-text {
  margin: 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text-hi);
  overflow-wrap: anywhere;
}
.cs-msg-text a { color: #7cc4ff; }
.cs-window-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px;
  border-top: 1px solid var(--app-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-hi);
  font-weight: 600;
  text-decoration: none;
}
.cs-window-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.cs-window-link i { font-size: 12px; }
.cs-anon {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 4px 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--w-mut);
}

/* A community without channels on the web */
.cs-quiet {
  padding: 40px 28px;
  border: 1px dashed var(--w-dash);
  border-radius: 20px;
  background: var(--cs-paper);
  text-align: center;
}
.cs-quiet-icon {
  margin-bottom: 10px;
  font-size: 26px;
  color: var(--cs-ink);
}
.cs-quiet h2 {
  margin: 0 0 6px;
  font-size: 22px;
  color: var(--w-ink);
}
.cs-quiet p {
  max-width: 28rem;
  margin: 0 auto;
  line-height: 1.5;
  color: var(--w-ink3);
}

/* ---- Side ---- */
.cs-side {
  position: sticky;
  top: 96px;
  display: grid;
  gap: 18px;
}
.cs-card {
  padding: 20px;
  border: 1px solid var(--w-line);
  border-radius: 20px;
  background: var(--cs-paper);
  box-shadow: 0 6px 22px rgba(31, 35, 33, 0.05);
}
.cs-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 18px;
  color: var(--w-ink);
  overflow-wrap: anywhere;
}
.cs-card h2 i {
  font-size: 15px;
  color: var(--cs-ink);
}
.cs-chans {
  display: grid;
  gap: 2px;
  max-height: 520px;
  margin: 0 0 12px;
  padding: 0;
  overflow: auto;
  list-style: none;
}
.cs-chan-cat {
  margin: 10px 0 4px 10px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--w-mut);
}
.cs-chan-cat:first-child { margin-top: 0; }
.cs-chan-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 14.5px;
  color: var(--w-ink2);
}
.cs-chan-row > i {
  width: 16px;
  font-size: 13px;
  text-align: center;
  color: var(--w-mut2);
}
.cs-chan-row span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-chan-row.is-web { background: var(--cs-tint); }
.cs-web-badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 7px;
  background: rgba(47, 110, 72, 0.12);
  color: var(--green-700);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.cs-web-badge:hover { background: rgba(47, 110, 72, 0.2); }
.cs-muted {
  margin: 0;
  font-size: 13px;
  color: var(--w-mut);
}
.cs-about p {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--w-ink3);
}
.cs-about a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  text-decoration: none;
}
.cs-about a i { font-size: 11px; }

/* ---- The list of communities ---- */
.cs-dir-hero {
  max-width: 720px;
  margin: 0 auto 36px;
  text-align: center;
}
.cs-dir-hero .cs-eyebrow {
  justify-content: center;
  color: var(--green-700);
}
.cs-dir-hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02;
  color: var(--w-ink);
}
.cs-dir-lede {
  max-width: 36rem;
  margin: 14px auto 24px;
  font-size: 18px;
  line-height: 1.55;
  color: var(--w-ink3);
}
.cs-search {
  gap: 10px;
  max-width: 520px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 14px;
  color: var(--w-mut);
}
.cs-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--w-ink);
}
.cs-search:focus-within { box-shadow: 0 0 0 3px var(--w-focus); }
.cs-dir-count {
  margin: 12px 0 0;
  font-size: 13.5px;
  color: var(--w-mut);
}
.cs-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.cs-dir-grid li[hidden] { display: none; }
.cs-dir-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border: 1px solid var(--w-line);
  border-radius: 20px;
  background: var(--cs-paper);
  box-shadow: 0 6px 20px rgba(31, 35, 33, 0.06);
  color: inherit;
  text-decoration: none;
  transition: transform 0.25s var(--ease-standard), box-shadow 0.25s var(--ease-standard);
}
.cs-dir-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(31, 35, 33, 0.12);
  color: inherit;
}
.cs-dir-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--w-focus);
}
.cs-dir-banner {
  position: relative;
  display: block;
  height: 86px;
  overflow: hidden;
  background:
    radial-gradient(120% 160% at 10% 0%, hsl(var(--cs-h) 60% 58% / 0.85), transparent 60%),
    linear-gradient(135deg, var(--cs-c1), var(--cs-c2));
}
.cs-dir-banner img {
  position: absolute;
  top: -60%;
  left: -20%;
  width: 140%;
  height: 220%;
  object-fit: cover;
  filter: blur(36px) saturate(1.6);
  opacity: 0.7;
}
.cs-dir-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: -34px 0 0 18px;
  overflow: hidden;
  border-radius: 17px;
  background: linear-gradient(135deg, var(--cs-c1), var(--cs-c2));
  box-shadow: 0 0 0 4px var(--cs-paper), 0 6px 16px rgba(0, 0, 0, 0.16);
}
.cs-dir-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cs-dir-icon.is-letter { font-size: 28px; }
.cs-dir-name {
  display: block;
  margin: 12px 18px 3px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--w-ink);
  overflow-wrap: anywhere;
}
.cs-dir-members {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 18px;
  font-size: 13px;
  color: var(--w-mut);
}
.cs-dir-members i { font-size: 11px; }
.cs-dir-members:last-child { margin-bottom: 18px; }
.cs-dir-desc {
  display: -webkit-box;
  margin: 10px 18px 18px;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.45;
  color: var(--w-ink3);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.cs-dir-none {
  margin: 30px 0;
  text-align: center;
  color: var(--w-mut);
}
.cs-dir-create {
  margin-top: 40px;
  text-align: center;
}

/* ---- Smaller screens ---- */
@media (max-width: 920px) {
  .cs-grid { grid-template-columns: minmax(0, 1fr); }
  .cs-side { position: static; }
  .cs-head { grid-template-columns: auto minmax(0, 1fr); }
  .cs-cta {
    grid-column: 1 / -1;
    flex-flow: row wrap;
    min-width: 0;
    padding-top: 4px;
  }
  .cs-cta .btn-f { flex: 1 1 220px; }
  .cs-cta-note {
    width: 100%;
    text-align: left;
  }
}
@media (max-width: 600px) {
  .cs { padding: 88px 16px 56px; }
  .cs-hero { border-radius: 22px; }
  .cs-banner { height: 140px; }
  .cs-head {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    margin-top: -50px;
    padding: 0 18px;
  }
  .cs-icon {
    width: 96px;
    height: 96px;
    border-radius: 24px;
  }
  .cs-icon.is-letter { font-size: 44px; }
  .cs-id { padding-top: 0; }
  .cs-cta { padding-top: 0; }
  .cs-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 20px 18px 22px;
  }
  .cs-stats b { font-size: 23px; }
  .cs-msg { padding: 9px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .cs-live i { animation: none; }
  .cs-dir-card,
  .cs-dir-card:hover {
    transform: none;
    transition: none;
  }
}

/* Emoji in a channel or category name, as Twemoji the size of the letters
   around them (internal/usertext Name): the box is there before the picture,
   so nothing moves when it loads. */
.cs .ut-emoji {
  display: inline-block;
  width: 1.2em;
  height: 1.2em;
  margin: 0 .05em;
  vertical-align: -.22em;
}
