/* StreamGrid public Community shell.
 * Public Communities and public Profiles share the same expression-space
 * rhythm: 1200px outer canvas, natural document scrolling, matched header/nav
 * proportions, and themed panel surfaces. Communities retain their own art,
 * accent, membership actions, custom pages, and narrower 960px conversation
 * role inside that shared public language.
 */

.sg-public-community {
  --sg-community-canvas: 1200px;
  --sg-community-content: 960px;
  --sg-community-gap: 18px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: clamp(14px, 2vw, 28px) clamp(12px, 2.5vw, 32px) 48px;
}

.sg-public-community-container {
  width: 100%;
  max-width: var(--sg-community-canvas);
  min-width: 0;
  margin: 0 auto;
}

/* Header geometry intentionally mirrors public Profile while preserving the
 * richer Community identity block and membership controls. */
.sg-public-community-header {
  --sg-community-header-height: clamp(285px, 30vw, 350px);
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 14px;
}

.sg-community-header-depth--compact { --sg-community-header-height: clamp(220px, 24vw, 270px); }
.sg-community-header-depth--standard { --sg-community-header-height: clamp(285px, 30vw, 350px); }
.sg-community-header-depth--showcase { --sg-community-header-height: clamp(350px, 38vw, 460px); }

.sg-public-community-header__art {
  position: relative;
  min-height: var(--sg-community-header-height);
  padding: clamp(20px, 3vw, 34px);
  display: flex;
  align-items: center;
  background: var(--sg-community-header-image, var(--header-image)) var(--sg-community-header-position, center center) / cover no-repeat;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0,0,0,.28);
  isolation: isolate;
}

.sg-public-community-header__art::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to bottom, rgba(0,0,0,.06), rgba(0,0,0,.20) 60%, rgba(0,0,0,.34));
  pointer-events: none;
}

.sg-public-community-identity,
.sg-public-community-actions {
  position: relative;
  z-index: 1;
}

.sg-public-community-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  max-width: min(820px, calc(100% - 16px));
}

.sg-public-community-avatar {
  width: 156px;
  height: 156px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 50%;
  border: 4px solid var(--sg-accent);
  background: color-mix(in srgb, var(--sg-surface) 82%, black 18%);
  box-shadow: 0 9px 28px rgba(0,0,0,.38);
}

.sg-public-community-identity__copy {
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px 12px;
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-surface) 64%, transparent);
  border: 1px solid color-mix(in srgb, var(--sg-accent) 72%, var(--sg-border));
  border-radius: min(var(--sg-radius), 14px);
  backdrop-filter: blur(min(var(--sg-blur), 14px));
  box-shadow: 0 5px 18px rgba(0,0,0,.18);
  text-shadow: 0 2px 8px rgba(0,0,0,.5);
}

.sg-public-community-kicker {
  display: block;
  margin-bottom: 4px;
  color: color-mix(in srgb, var(--sg-accent) 82%, white 18%);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sg-public-community-identity h1 {
  margin: 0;
  color: var(--sg-text);
  font-size: clamp(1.45rem, 2.5vw, 1.95rem);
  font-weight: 760;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.sg-public-community-member-count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
  color: color-mix(in srgb, var(--sg-text) 78%, transparent);
  font-size: .86rem;
  font-weight: 700;
  text-shadow: none;
}

.sg-public-community-description {
  max-width: 72ch;
  margin: 9px 0 0;
  color: color-mix(in srgb, var(--sg-text) 90%, transparent);
  font-size: .94rem;
  line-height: 1.5;
  text-shadow: none;
}

/* Pass 20T: three controlled header compositions share the same identity,
 * actions, and metadata. Layout changes presentation only; they do not fork
 * Community content or authorization. */
.sg-community-header-layout--centered .sg-public-community-header__art {
  justify-content: center;
}
.sg-community-header-layout--centered .sg-public-community-identity {
  flex-direction: column;
  justify-content: center;
  text-align: center;
  max-width: min(720px, calc(100% - 32px));
  margin-inline: auto;
}
.sg-community-header-layout--centered .sg-public-community-avatar {
  width: 132px;
  height: 132px;
}
.sg-community-header-layout--centered .sg-public-community-identity__copy {
  width: min(680px, 100%);
  box-sizing: border-box;
}
.sg-community-header-layout--centered .sg-public-community-member-count {
  justify-content: center;
}

.sg-community-header-layout--cinematic .sg-public-community-header__art {
  align-items: flex-end;
  padding-top: clamp(84px, 9vw, 112px);
}
.sg-community-header-layout--cinematic .sg-public-community-header__art::before {
  background: linear-gradient(to bottom, rgba(0,0,0,.02), rgba(0,0,0,.08) 42%, rgba(0,0,0,.72));
}
.sg-community-header-layout--cinematic .sg-public-community-identity {
  align-items: flex-end;
  max-width: min(940px, calc(100% - 16px));
}
.sg-community-header-layout--cinematic .sg-public-community-avatar {
  width: 112px;
  height: 112px;
  border-width: 3px;
}
.sg-community-header-layout--cinematic .sg-public-community-identity__copy {
  padding: 9px 13px 10px;
  background: color-mix(in srgb, var(--sg-surface) 42%, transparent);
  border-color: color-mix(in srgb, var(--sg-accent) 52%, transparent);
  backdrop-filter: blur(min(var(--sg-blur), 10px));
}
.sg-community-header-layout--cinematic .sg-public-community-identity h1 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
}
.sg-community-header-layout--cinematic .sg-public-community-description {
  max-width: 82ch;
}

.sg-public-community-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  max-width: min(660px, calc(100% - 32px));
}

.sg-public-community-actions form {
  margin: 0;
}

.sg-community-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--sg-accent);
  border-radius: min(var(--sg-radius), 10px);
  background: color-mix(in srgb, var(--sg-surface) 76%, black 10%);
  color: var(--sg-text) !important;
  font: inherit;
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none !important;
  cursor: pointer;
  backdrop-filter: blur(min(var(--sg-blur), 12px));
  box-shadow: 0 3px 12px rgba(0,0,0,.18);
}

.sg-community-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--sg-accent) 28%, var(--sg-surface));
}

.sg-community-action--primary {
  background: color-mix(in srgb, var(--sg-accent) 28%, var(--sg-surface));
}

.sg-community-action--danger {
  border-color: color-mix(in srgb, #ef5350 72%, var(--sg-border));
  background: color-mix(in srgb, #a71919 44%, var(--sg-surface));
}

.sg-community-action:disabled {
  opacity: .58;
  cursor: not-allowed;
}

/* Community-created pages are navigation inside one public expression space,
 * so this surface intentionally matches public Profile navigation dimensions. */
.sg-public-community-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  background: color-mix(in srgb, var(--sg-surface) 88%, transparent);
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  backdrop-filter: blur(var(--sg-blur)) saturate(118%);
}

.sg-public-community-nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--sg-border);
  border-radius: min(var(--sg-radius), 10px);
  color: var(--sg-text) !important;
  background: color-mix(in srgb, var(--sg-surface) 82%, transparent);
  text-decoration: none !important;
  font-weight: 700;
}

.sg-public-community-nav__link:hover,
.sg-public-community-nav__link.is-active {
  border-color: var(--sg-accent);
  background: color-mix(in srgb, var(--sg-accent) 18%, var(--sg-surface));
  color: var(--sg-text) !important;
}

.sg-public-community-content {
  width: 100%;
  min-width: 0;
  margin-top: var(--sg-community-gap);
}

/* Conversation-heavy Community destinations retain a narrower reading role,
 * but their surfaces use the same public panel treatment as Profile content. */
.sg-public-community-feed .stream-container,
.sg-public-community-thread .stream-container {
  width: 100%;
  max-width: var(--sg-community-content) !important;
  min-width: 0;
  margin: 0 auto var(--sg-community-gap) !important;
  padding: clamp(18px, 2.2vw, 26px) !important;
  box-sizing: border-box;
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-surface) 94%, transparent) !important;
  border: 1px solid var(--sg-border) !important;
  border-radius: var(--sg-radius) !important;
  box-shadow: 0 7px 24px rgba(0,0,0,.24) !important;
  backdrop-filter: blur(var(--sg-blur)) saturate(112%);
}

.sg-public-community-feed .stream-container:last-child,
.sg-public-community-thread .stream-container:last-child {
  margin-bottom: 0 !important;
}

.sg-public-community .post {
  min-width: 0;
}

.sg-public-community .post-content,
.sg-public-community .reply-body,
.sg-public-community-page-content {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sg-public-community .post-content img,
.sg-public-community .post-content iframe,
.sg-public-community .post-content video,
.sg-public-community .attached-image,
.sg-public-community .attached-gif,
.sg-public-community-page-content img,
.sg-public-community-page-content iframe,
.sg-public-community-page-content video {
  max-width: 100%;
  height: auto;
}

.sg-public-community .post-content iframe,
.sg-public-community-page-content iframe {
  width: min(100%, 720px);
  aspect-ratio: 16 / 9;
  border: 0;
}

.sg-public-community .activity-form-controls.sg-community-composer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sg-community-composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.sg-community-composer-actions .file-input-label,
.sg-community-composer-actions button {
  margin: 0 !important;
}

.sg-community-file-indicator {
  width: 100%;
  margin-top: 2px;
  color: color-mix(in srgb, var(--sg-text) 72%, transparent);
  font-size: .9rem;
}

.sg-community-gif-preview {
  margin-top: 10px;
}

.sg-public-community-thread-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 16px;
}

.sg-public-community-thread-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid color-mix(in srgb, var(--sg-accent) 65%, var(--sg-border));
  border-radius: min(var(--sg-radius), 10px);
  color: var(--sg-text) !important;
  background: color-mix(in srgb, var(--sg-accent) 16%, var(--sg-surface));
  text-decoration: none !important;
  font-weight: 700;
}

.sg-public-community-thread-back:hover {
  background: color-mix(in srgb, var(--sg-accent) 24%, var(--sg-surface));
}

.sg-public-community-thread .like-btn {
  color: var(--sg-muted);
  cursor: pointer;
}

.sg-public-community-thread .like-btn.liked {
  color: #ef5350;
}

.sg-public-community-thread .reply {
  position: relative;
  padding-left: 25px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.sg-public-community-thread .collapse-toggle {
  background: none;
  border: 0;
  color: var(--sg-accent);
  cursor: pointer;
  margin-left: 5px;
}

.sg-public-community-thread .reply-line {
  position: absolute;
  left: 5px;
  top: 10px;
  width: 3px;
  height: calc(100% - 10px);
  background: color-mix(in srgb, var(--sg-text) 20%, transparent);
  transition: background .2s;
  cursor: pointer;
}

.sg-public-community-thread .reply-line:hover {
  background: var(--sg-accent);
}

/* Custom Community Pages use the same broad public-panel role as member Pages. */
.sg-public-community-page-panel {
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: clamp(18px, 2.2vw, 26px);
  box-sizing: border-box;
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-surface) 94%, transparent);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  box-shadow: 0 7px 24px rgba(0,0,0,.24);
  backdrop-filter: blur(var(--sg-blur)) saturate(112%);
  text-align: left;
}

.sg-public-community-page-panel h2 {
  margin: 0 0 16px;
  color: var(--sg-text);
  text-align: left;
}

.sg-public-community-page-content {
  color: var(--sg-text);
  line-height: 1.65;
}

.sg-public-community-page-content > :first-child {
  margin-top: 0;
}

.sg-public-community-page-content > :last-child {
  margin-bottom: 0;
}

/* Missing Community pages stay in the ordinary viewer/site appearance rather
 * than impersonating a Community theme that does not exist. */
.sg-community-not-found-page .sg-public-community-container {
  display: grid;
  gap: var(--sg-community-gap);
}

.sg-community-empty-state,
.sg-community-discovery-panel {
  padding: clamp(20px, 3vw, 30px);
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-surface) 94%, transparent);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  box-shadow: 0 7px 24px rgba(0,0,0,.24);
  backdrop-filter: blur(var(--sg-blur)) saturate(112%);
}

.sg-community-empty-state {
  text-align: center;
}

.sg-community-empty-state h2,
.sg-community-discovery-panel h3 {
  margin-top: 0;
  color: var(--sg-text);
}

.sg-community-empty-state p {
  color: color-mix(in srgb, var(--sg-text) 76%, transparent);
}

.sg-community-empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.sg-community-empty-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--sg-accent);
  border-radius: min(var(--sg-radius), 10px);
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-accent) 20%, var(--sg-surface));
  text-decoration: none;
  font-weight: 700;
}

.sg-community-empty-actions .btn:hover {
  background: color-mix(in srgb, var(--sg-accent) 30%, var(--sg-surface));
}

.sg-community-discovery-panel > h3 {
  margin-bottom: 18px;
  text-align: left;
}

.sg-community-discovery-panel .group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.sg-community-discovery-panel .group-card {
  position: relative;
  min-width: 0;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--sg-border);
  border-radius: min(var(--sg-radius), 14px);
  background: color-mix(in srgb, var(--sg-surface) 88%, transparent);
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.sg-community-discovery-panel .group-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--sg-accent) 60%, var(--sg-border));
  box-shadow: 0 8px 22px rgba(0,0,0,.28);
}

.sg-community-discovery-panel .group-card .card-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
}

.sg-community-discovery-panel .group-card .header {
  position: relative;
  z-index: 2;
  height: 100px;
  background-size: cover;
  background-position: center;
}

.sg-community-discovery-panel .group-card .header .view-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 8px 11px;
  border: 1px solid color-mix(in srgb, var(--sg-accent) 65%, white 12%);
  border-radius: 7px;
  color: #fff;
  background: color-mix(in srgb, var(--sg-accent) 76%, transparent);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 700;
}

.sg-community-discovery-panel .group-card .avatar {
  position: absolute;
  top: 60px;
  left: 20px;
  z-index: 3;
  width: 60px;
  height: 60px;
  object-fit: cover;
  border: 3px solid color-mix(in srgb, var(--sg-accent) 75%, white 25%);
  border-radius: 50%;
  background: var(--sg-surface);
}

.sg-community-discovery-panel .group-card .content {
  position: relative;
  z-index: 3;
  padding: 30px 18px 18px;
}

.sg-community-discovery-panel .group-card .text-box {
  min-height: 150px;
  padding: 12px;
  color: #fff;
  background: rgba(0,0,0,.62);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px;
  backdrop-filter: blur(8px);
}

.sg-community-discovery-panel .group-card .name {
  font-size: 1.08rem;
  font-weight: 800;
}

.sg-community-discovery-panel .group-card .description {
  margin-top: 6px;
  color: rgba(255,255,255,.82);
  font-size: .9rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .sg-public-community {
    --sg-community-gap: 14px;
    padding-inline: 20px;
  }

  .sg-community-header-depth--compact { --sg-community-header-height: 240px; }
  .sg-community-header-depth--standard { --sg-community-header-height: 285px; }
  .sg-community-header-depth--showcase { --sg-community-header-height: 360px; }

  .sg-public-community-avatar {
    width: 132px;
    height: 132px;
  }
}

@media (max-width: 700px) {
  .sg-public-community {
    padding: 12px 12px 36px;
  }

  .sg-community-header-depth--compact { --sg-community-header-height: 230px; }
  .sg-community-header-depth--standard { --sg-community-header-height: 270px; }
  .sg-community-header-depth--showcase { --sg-community-header-height: 320px; }

  .sg-public-community-header__art {
    padding: 90px 14px 18px;
    align-items: flex-end;
  }

  .sg-public-community-actions {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
    justify-content: center;
  }

  .sg-public-community-identity {
    width: 100%;
    max-width: 100%;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 11px;
  }

  .sg-public-community-avatar {
    width: 116px;
    height: 116px;
  }

  .sg-public-community-identity__copy {
    width: min(100%, 620px);
    box-sizing: border-box;
  }

  .sg-public-community-member-count {
    justify-content: center;
  }

  .sg-community-header-layout--cinematic .sg-public-community-header__art {
    padding-top: 90px;
  }
  .sg-community-header-layout--cinematic .sg-public-community-identity {
    align-items: center;
    max-width: 100%;
  }
  .sg-community-header-layout--cinematic .sg-public-community-avatar {
    width: 106px;
    height: 106px;
  }
  .sg-community-header-layout--cinematic .sg-public-community-identity__copy {
    width: min(100%, 620px);
  }

  .sg-public-community-nav {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .sg-public-community-nav__link {
    flex: 0 0 auto;
  }

  .sg-public-community-feed .stream-container,
  .sg-public-community-thread .stream-container,
  .sg-public-community-page-panel {
    padding: 17px !important;
  }

  .sg-community-composer-actions {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .sg-public-community-header__art {
    padding-left: 12px;
    padding-right: 12px;
  }

  .sg-public-community-actions {
    align-items: stretch;
  }

  .sg-public-community-actions form,
  .sg-public-community-actions .sg-community-action {
    flex: 1 1 auto;
  }

  .sg-public-community-actions form .sg-community-action {
    width: 100%;
  }

  .sg-community-discovery-panel .group-grid {
    grid-template-columns: 1fr;
  }
}


/* Pass 18: hidden-post review state for authorized Community managers. */
.sg-community-hidden-review {
  display:flex;align-items:flex-start;gap:10px;margin:0 0 14px;padding:11px 12px;
  border:1px solid color-mix(in srgb,var(--sg-ui-accent,#44d6a8) 36%,rgba(255,255,255,.16));
  border-radius:10px;background:rgba(0,0,0,.24);
}
.sg-community-hidden-review > i { margin-top:2px;color:var(--sg-ui-accent,#44d6a8); }
.sg-community-hidden-review strong,.sg-community-hidden-review span { display:block; }
.sg-community-hidden-review span { margin-top:3px;opacity:.76;font-size:.84rem;line-height:1.45; }

/* Pass 20H-S: Community composer parity with the main stream. */
.sg-public-community .sg-community-composer #postContent {
  overflow-y: hidden;
  resize: none;
}

.sg-public-community .sg-community-composer .drop-zone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border: 2px dashed color-mix(in srgb, var(--sg-border, #666) 80%, transparent);
  border-radius: 6px;
  font-weight: 600;
  font-size: .9rem;
  color: var(--sg-text-muted, #ccc);
  cursor: pointer;
  user-select: none;
  transition: background .2s, border-color .2s, color .2s;
}

.sg-public-community .sg-community-composer .drop-zone.dragover {
  background: color-mix(in srgb, var(--sg-accent, #0ad) 14%, transparent);
  border-color: var(--sg-accent, #0ad);
  color: var(--sg-text, #fff);
}

.sg-public-community .sg-community-composer #sizeIndicatorWrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
  font-size: .8rem;
  margin: 0 4px;
}

.sg-public-community .sg-community-composer #sizeIndicatorBar {
  flex: 1;
  min-width: 90px;
  height: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: color-mix(in srgb, var(--sg-text, #fff) 18%, transparent);
}

.sg-public-community .sg-community-composer #sizeIndicatorFill {
  width: 0;
  height: 100%;
  background: var(--sg-accent, #1a8);
  transition: width .2s;
}

.sg-public-community .sg-community-composer #sizeIndicatorWrapper.error #sizeIndicatorFill {
  background: #e33;
}

.sg-public-community .sg-community-composer #sizeIndicatorWrapper.error #sizeIndicatorText {
  color: #e66;
}

.sg-public-community .sg-community-composer #imagePreview,
.sg-public-community .sg-community-composer #postGifPreview,
.sg-public-community .sg-community-composer #fileIndicator {
  flex: 0 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.sg-public-community .media-preview-wrapper {
  position: relative;
  display: inline-block;
}

.sg-public-community .media-preview-wrapper img {
  width: 120px;
  height: 120px;
  max-width: 120px;
  max-height: 120px;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  box-shadow: 0 0 5px rgba(0,0,0,.35);
}

.sg-public-community .media-preview-wrapper .remove-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 3;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #d66a22;
  color: #fff;
  cursor: pointer;
  line-height: 22px;
}

.sg-public-community .media-preview-wrapper.ghost {
  opacity: .4;
}

/* Group posts now use the same ordered multi-image layout as the main feed. */
.sg-public-community .post-gallery {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  overflow: hidden;
  border-radius: 8px;
}

.sg-public-community .post-gallery a,
.sg-public-community .post-gallery img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.sg-public-community .post-gallery img {
  display: block;
  object-fit: cover;
  max-height: 420px;
}

.sg-public-community .post-gallery.image-count-1 { grid-template-columns: 1fr; }
.sg-public-community .post-gallery.image-count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sg-public-community .post-gallery.image-count-3,
.sg-public-community .post-gallery.image-count-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.sg-public-community .post-gallery.image-count-5 {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  min-height: 300px;
}

.sg-public-community .post-gallery.image-count-5 > a {
  overflow: hidden;
}

.sg-public-community .post-gallery.image-count-5 .small-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 620px) {
  .sg-public-community .sg-community-composer #sizeIndicatorWrapper {
    flex: 1 1 100%;
    width: 100%;
  }
  .sg-public-community .post-gallery.image-count-5 {
    min-height: 220px;
  }
}

/* Pass 20S: shared contextual Community panel.
 * Popup / Left / Right are presentations of one component. The Community
 * default is resolved server-side before paint; signed-in viewers may persist
 * one override per Community. Narrow layouts always present the popup without
 * overwriting the saved desktop choice.
 */
.sg-community-drawer-launcher {
  position: fixed;
  right: 20px;
  bottom: 82px;
  z-index: 9998;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--sg-border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--sg-accent) 72%, var(--sg-surface));
  color: var(--sg-text);
  box-shadow: 0 8px 28px var(--sg-glass);
  cursor: pointer;
  font-size: 1.05rem;
}

.sg-community-drawer-launcher:hover,
.sg-community-drawer-launcher:focus-visible,
.sg-community-drawer-shell.is-open .sg-community-drawer-launcher {
  outline: none;
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sg-accent) 22%, transparent), 0 8px 28px var(--sg-glass);
}

.sg-community-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10020;
  background: rgba(0,0,0,.48);
  backdrop-filter: blur(2px);
}

.sg-community-drawer {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 10021;
  width: min(390px, calc(100vw - 28px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  color: var(--sg-text);
  background: color-mix(in srgb, var(--sg-surface) 97%, black 3%);
  border: 1px solid var(--sg-border);
  border-radius: var(--sg-radius);
  box-shadow: 0 24px 70px rgba(0,0,0,.48), 0 0 28px color-mix(in srgb, var(--sg-accent) 12%, transparent);
  backdrop-filter: blur(var(--sg-blur)) saturate(118%);
  transform: translateX(calc(100% + 34px));
  opacity: 0;
  pointer-events: none;
  transition: transform .22s ease, opacity .18s ease;
  overflow: hidden;
}

.sg-community-drawer-shell.is-open .sg-community-drawer {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

html.sg-community-drawer-open { overflow: hidden; }

.sg-community-drawer__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--sg-border);
  background: color-mix(in srgb, var(--sg-accent) 10%, var(--sg-surface));
}

.sg-community-drawer__identity {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 11px;
  align-items: center;
  min-width: 0;
}

.sg-community-drawer__avatar {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--sg-accent);
}

.sg-community-drawer__identity strong,
.sg-community-drawer__identity small,
.sg-community-drawer__kicker { display: block; }
.sg-community-drawer__identity strong { overflow-wrap: anywhere; }
.sg-community-drawer__identity small {
  margin-top: 3px;
  color: color-mix(in srgb, var(--sg-text) 68%, transparent);
  line-height: 1.35;
}
.sg-community-drawer__kicker {
  margin-bottom: 3px;
  color: var(--sg-accent);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.sg-community-drawer__close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--sg-border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--sg-surface) 84%, transparent);
  color: var(--sg-text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.sg-community-drawer__body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 14px;
}

.sg-community-drawer__footer {
  min-width: 0;
  padding: 0 14px 14px;
  border-top: 1px solid color-mix(in srgb, var(--sg-border) 78%, transparent);
  background: color-mix(in srgb, var(--sg-surface) 96%, black 4%);
}

.sg-community-drawer__footer .sg-community-drawer__section {
  margin-top: 14px;
}

.sg-community-drawer__section {
  padding: 13px;
  border: 1px solid var(--sg-border);
  border-radius: min(var(--sg-radius), 12px);
  background: color-mix(in srgb, var(--sg-surface) 90%, transparent);
}
.sg-community-drawer__section + .sg-community-drawer__section { margin-top: 12px; }
.sg-community-drawer__section p {
  margin: 7px 0 0;
  color: color-mix(in srgb, var(--sg-text) 80%, transparent);
  line-height: 1.5;
}
.sg-community-drawer__section-title {
  display: block;
  color: color-mix(in srgb, var(--sg-accent) 80%, white 20%);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.sg-community-drawer__nav {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}
.sg-community-drawer__nav a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--sg-border) 88%, transparent);
  border-radius: min(var(--sg-radius), 10px);
  color: var(--sg-text) !important;
  background: color-mix(in srgb, var(--sg-surface) 82%, transparent);
  text-decoration: none !important;
}
.sg-community-drawer__nav a:hover,
.sg-community-drawer__nav a:focus-visible {
  border-color: var(--sg-accent);
  background: color-mix(in srgb, var(--sg-accent) 16%, var(--sg-surface));
  outline: none;
}
.sg-community-drawer__nav i { color: var(--sg-accent); text-align: center; }
.sg-community-drawer__future { opacity: .86; }

.sg-community-drawer__layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.sg-community-drawer__layout button {
  min-width: 0;
  min-height: 40px;
  display: grid;
  grid-template-columns: auto minmax(0, auto);
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border: 1px solid color-mix(in srgb, var(--sg-border) 88%, transparent);
  border-radius: min(var(--sg-radius), 10px);
  background: color-mix(in srgb, var(--sg-surface) 82%, transparent);
  color: var(--sg-text);
  font: inherit;
  font-size: .78rem;
  font-weight: 750;
  cursor: pointer;
}

.sg-community-drawer__layout button:hover,
.sg-community-drawer__layout button:focus-visible,
.sg-community-drawer__layout button.is-active {
  border-color: var(--sg-accent);
  background: color-mix(in srgb, var(--sg-accent) 18%, var(--sg-surface));
  outline: none;
}

.sg-community-drawer__layout button.is-active {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sg-accent) 36%, transparent);
}

.sg-community-drawer__layout button:disabled {
  opacity: .66;
  cursor: progress;
}

.sg-community-drawer__layout-help {
  margin-top: 8px !important;
  font-size: .76rem;
}

@media (max-width: 700px) {
  .sg-community-drawer-launcher {
    right: 12px;
    bottom: 74px;
  }
  .sg-community-drawer {
    top: 8px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}

@media (min-width: 960px) {
  html.sg-community-panel-left .sg-public-community-container,
  html.sg-community-panel-right .sg-public-community-container {
    display: grid;
    grid-template-columns: minmax(250px, 290px) minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: var(--sg-community-gap);
    row-gap: var(--sg-community-gap);
    align-items: start;
  }

  html.sg-community-panel-right .sg-public-community-container {
    grid-template-columns: minmax(0, 1fr) minmax(250px, 290px);
  }

  html.sg-community-panel-left .sg-public-community-header,
  html.sg-community-panel-right .sg-public-community-header {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  html.sg-community-panel-left .sg-community-drawer-shell,
  html.sg-community-panel-right .sg-community-drawer-shell {
    position: sticky;
    top: var(--sg-community-sticky-top, 78px);
    z-index: 18;
    grid-row: 2;
    align-self: start;
    min-width: 0;
    max-height: calc(100dvh - var(--sg-community-sticky-top, 78px) - 14px);
  }

  html.sg-community-panel-left .sg-community-drawer-shell { grid-column: 1; }
  html.sg-community-panel-right .sg-community-drawer-shell { grid-column: 2; }

  html.sg-community-panel-left .sg-public-community-content,
  html.sg-community-panel-right .sg-public-community-content {
    grid-row: 2;
    min-width: 0;
    margin-top: 0;
  }

  html.sg-community-panel-left .sg-public-community-content { grid-column: 2; }
  html.sg-community-panel-right .sg-public-community-content { grid-column: 1; }

  html.sg-community-panel-left .sg-community-drawer-launcher,
  html.sg-community-panel-right .sg-community-drawer-launcher,
  html.sg-community-panel-left .sg-community-drawer-backdrop,
  html.sg-community-panel-right .sg-community-drawer-backdrop,
  html.sg-community-panel-left .sg-community-drawer__close,
  html.sg-community-panel-right .sg-community-drawer__close {
    display: none !important;
  }

  html.sg-community-panel-left .sg-community-drawer,
  html.sg-community-panel-right .sg-community-drawer {
    position: static;
    inset: auto;
    width: 100%;
    max-height: calc(100dvh - var(--sg-community-sticky-top, 78px) - 14px);
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: 0 10px 34px rgba(0,0,0,.32), 0 0 22px color-mix(in srgb, var(--sg-accent) 10%, transparent);
  }

  html.sg-community-panel-left.sg-community-drawer-open,
  html.sg-community-panel-right.sg-community-drawer-open {
    overflow: auto;
  }
}

@media (max-width: 959px) {
  /* A desktop rail preference stays saved, but the narrow interaction is the
   * accessible popup. The preference itself is never overwritten here. */
  html.sg-community-panel-left .sg-community-drawer-launcher,
  html.sg-community-panel-right .sg-community-drawer-launcher {
    display: grid;
  }
}

/* Pass 20U: authorized manager preview banner for Community Pages. */
.sg-community-page-preview-banner {
  display:flex;
  align-items:center;
  gap:9px;
  margin:-4px 0 18px;
  padding:10px 12px;
  border:1px solid color-mix(in srgb,var(--sg-accent) 58%,var(--sg-border));
  border-radius:min(var(--sg-radius),10px);
  color:var(--sg-text);
  background:color-mix(in srgb,var(--sg-accent) 12%,var(--sg-surface));
  font-size:.9rem;
}
.sg-community-page-preview-banner > i { color:var(--sg-accent); }
.sg-community-page-preview-banner > span { min-width:0; flex:1; }
.sg-community-page-preview-banner > a { color:var(--sg-accent); font-weight:700; white-space:nowrap; }
@media (max-width:640px) {
  .sg-community-page-preview-banner { align-items:flex-start; flex-wrap:wrap; }
  .sg-community-page-preview-banner > span { flex-basis:calc(100% - 30px); }
  .sg-community-page-preview-banner > a { margin-left:30px; }
}

/* Pass 20V.1: Community Navigation Studio core -------------------------- */
.sg-public-community-nav { position: relative; }
.sg-public-community-nav__group {
  position: relative;
  flex: 0 0 auto;
}
.sg-public-community-nav__group > summary {
  cursor: pointer;
  list-style: none;
  gap: 8px;
  user-select: none;
}
.sg-public-community-nav__group > summary::-webkit-details-marker { display: none; }
.sg-public-community-nav__group > summary i {
  font-size: .72em;
  opacity: .72;
  transition: transform .16s ease;
}
.sg-public-community-nav__group[open] > summary i { transform: rotate(180deg); }
.sg-public-community-nav__submenu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  left: 0;
  display: grid;
  min-width: 210px;
  max-width: min(340px, 78vw);
  gap: 5px;
  padding: 7px;
  border: 1px solid var(--sg-border);
  border-radius: min(var(--sg-radius), 12px);
  background: color-mix(in srgb, var(--sg-surface) 96%, #000 4%);
  box-shadow: 0 16px 34px rgba(0,0,0,.34);
  backdrop-filter: blur(var(--sg-blur)) saturate(118%);
}
.sg-public-community-nav__sublink {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--sg-text) !important;
  text-decoration: none !important;
  font-weight: 700;
}
.sg-public-community-nav__sublink:hover,
.sg-public-community-nav__sublink:focus-visible,
.sg-public-community-nav__sublink.is-active {
  border-color: color-mix(in srgb, var(--sg-accent) 76%, var(--sg-border));
  background: color-mix(in srgb, var(--sg-accent) 16%, var(--sg-surface));
  outline: none;
}
.sg-community-drawer__nav-group {
  border: 1px solid color-mix(in srgb, var(--sg-border) 88%, transparent);
  border-radius: min(var(--sg-radius), 10px);
  background: color-mix(in srgb, var(--sg-surface) 82%, transparent);
  overflow: hidden;
}
.sg-community-drawer__nav-group > summary {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 40px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}
.sg-community-drawer__nav-group > summary::-webkit-details-marker { display:none; }
.sg-community-drawer__nav-group > summary:hover,
.sg-community-drawer__nav-group > summary:focus-visible {
  background: color-mix(in srgb, var(--sg-accent) 16%, var(--sg-surface));
  outline: none;
}
.sg-community-drawer__nav-chevron {
  font-size: .72em;
  opacity: .72;
  transition: transform .16s ease;
}
.sg-community-drawer__nav-group[open] .sg-community-drawer__nav-chevron { transform: rotate(180deg); }
.sg-community-drawer__nav-children {
  display: grid;
  gap: 5px;
  padding: 0 7px 7px 28px;
}
.sg-community-drawer__nav-children a {
  min-height: 36px;
  background: color-mix(in srgb, var(--sg-surface) 72%, transparent);
}
@media (max-width: 760px) {
  .sg-public-community-nav { flex-wrap: wrap; overflow: visible; }
  .sg-public-community-nav__submenu { left: auto; right: 0; }
}
@media (max-width: 480px) {
  .sg-public-community-nav__group { position: static; }
  .sg-public-community-nav__submenu { left: 8px; right: 8px; max-width: none; }
}


/* Pass 20V.2: external destinations + bounded dropdown polish. */
.sg-public-community-nav__link,
.sg-public-community-nav__sublink { gap: 7px; }
.sg-public-community-nav__external-icon {
  flex: 0 0 auto;
  font-size: .72em;
  opacity: .68;
}
.sg-public-community-nav__submenu {
  max-height: min(60dvh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.sg-community-drawer__nav a > i.fa-arrow-up-right-from-square { font-size: .82em; opacity: .82; }
@media (max-width: 480px) {
  .sg-public-community-nav__submenu { max-height: min(55dvh, 360px); }
}
