.community-sheet {
  position: fixed;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  width: min(100%, var(--app-max-width));
  max-width: var(--app-max-width);
  max-height: min(80svh, 42rem);
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.community-sheet::backdrop {
  background: rgb(23 20 25 / 52%);
  backdrop-filter: blur(3px);
}

.community-sheet[open] {
  animation: community-sheet-enter 240ms var(--ease-out) both;
}

.community-sheet__surface {
  max-height: min(80svh, 42rem);
  padding: 0.55rem 1rem calc(1rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 1.25rem 1.25rem 0 0;
  background: var(--surface);
  box-shadow: 0 -12px 36px rgb(23 20 25 / 15%);
  overscroll-behavior: contain;
}

.community-sheet__handle {
  display: block;
  width: 2.5rem;
  height: 0.24rem;
  margin: 0 auto 0.55rem;
  border-radius: 999px;
  background: var(--line-strong);
}

.community-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.community-sheet__eyebrow {
  color: var(--brand-pink-700);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.community-sheet__header h2 {
  margin-top: 0.2rem;
  color: var(--charcoal-950);
  font-size: 1.35rem;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.community-sheet__description {
  max-width: 20rem;
  margin-top: 0.55rem;
  color: var(--ink-subtle);
  font-size: 0.75rem;
  line-height: 1.5;
}

.community-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.community-option {
  display: grid;
  width: 100%;
  min-height: 4.8rem;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.community-option:hover {
  border-color: var(--brand-pink-200);
  background: var(--brand-pink-050);
}

.community-option:active {
  transform: scale(0.992);
}

.community-option[aria-current="true"] {
  border-color: var(--brand-pink-300);
  background: var(--brand-pink-050);
}

.community-option__logo {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface-soft);
  object-fit: cover;
}

.community-option__copy {
  display: grid;
  min-width: 0;
  gap: 0.28rem;
}

.community-option__copy strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--charcoal-900);
  font-size: 0.8rem;
  font-weight: 770;
  letter-spacing: -0.012em;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.community-option__details {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 0.25rem;
  color: var(--ink-muted);
  font-size: 0.65rem;
  font-weight: 630;
  line-height: 1.35;
}

.community-option__trailing {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 0.45rem;
}

.context-badge {
  display: inline-flex;
  min-height: 1.45rem;
  align-items: center;
  justify-content: center;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 790;
  line-height: 1;
  white-space: nowrap;
}

.context-badge--member {
  background: var(--brand-pink-100);
  color: var(--brand-pink-700);
}

.context-badge--visitor {
  border: 1px solid var(--line);
  background: var(--surface-neutral);
  color: var(--charcoal-600);
}

.community-option__selected {
  display: grid;
  width: 1.3rem;
  height: 1.3rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-pink-600);
  color: white;
}

.community-option__selected svg {
  width: 0.78rem;
  height: 0.78rem;
}

@keyframes community-sheet-enter {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 480px) {
  .community-sheet {
    bottom: 1.5rem;
    width: min(calc(100% - 3rem), var(--app-max-width));
    margin-bottom: 0;
  }

  .community-sheet__surface {
    border-bottom: 1px solid var(--line);
    border-radius: 1.25rem;
  }
}

@media (max-width: 350px) {
  .community-sheet__surface {
    padding-right: 0.75rem;
    padding-left: 0.75rem;
  }

  .community-option {
    gap: 0.55rem;
    padding: 0.6rem;
  }

  .community-option__logo {
    width: 2.5rem;
    height: 2.5rem;
  }
}
