/* Community and profile · page geometry and shared controls */
.cp-wrap {
  width: calc(100% - clamp(40px, 11vw, 168px));
  max-width: 1320px;
  margin: auto;
  padding: clamp(45px, 6vw, 85px) 0 85px;
  min-height: 70vh;
}
.cp-heading {
  margin-bottom: 28px;
}
.cp-heading h1 {
  font-size: clamp(42px, 5.4vw, 78px);
  letter-spacing: -0.052em;
  line-height: 1.03;
  margin-bottom: 14px;
}
.cp-heading p,
.cp-modal > div > p {
  color: var(--muted);
  max-width: 640px;
}
.cp-heading-row,
.cp-actions,
.cp-card-top,
.cp-card-footer,
.cp-photo-row,
.cp-composer,
.cp-member-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cp-heading-row,
.cp-card-footer {
  justify-content: space-between;
}
.cp-heading-row {
  align-items: end;
}
.cp-action,
.cp-secondary,
.cp-tabs button {
  border: 1px solid var(--green);
  border-radius: 7px;
  padding: 11px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.4;
  transition:
    background 0.15s,
    transform 0.15s;
}
.cp-action {
  background: var(--green);
  color: #fff;
}
.cp-secondary,
.cp-tabs button {
  background: #fbfaf6;
  color: var(--green);
  border-color: var(--line);
}
.cp-action:hover,
.cp-secondary:hover {
  transform: translateY(-1px);
}
.cp-action:disabled,
.cp-secondary:disabled {
  opacity: 0.55;
}
.cp-actions svg,
.cp-tabs svg {
  width: 18px;
  height: 18px;
}
.cp-actions {
  flex-wrap: wrap;
}
.cp-actions a,
.cp-link {
  font-size: 14px;
  font-weight: 600;
}
.cp-form [hidden],
.cp-dialog [hidden],
.cp-actions [hidden] {
  display: none;
}
.cp-profile {
  max-width: 850px;
}
.cp-preview,
#cp-notice:not(:empty) {
  color: #59645a;
  font-size: 13px;
  margin-bottom: 16px;
}
.cp-preview {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}
/* Directory · primary category tabs, secondary topics and group cards */
.cp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  border-block: 1px solid var(--line);
  padding: 15px 0;
  margin-top: 22px;
}
.cp-tabs button {
  border-color: transparent;
  background: transparent;
}
.cp-tabs button[aria-pressed="true"] {
  background: var(--green);
  color: white;
}
.cp-tabs button[aria-pressed="false"]:hover {
  background: #e9eee4;
}
.cp-filters:not(:empty) {
  margin: 20px 0 0;
}
.cp-filters label {
  font-size: 14px;
  color: var(--muted);
}
.cp-filters select {
  width: auto;
  margin-left: 6px;
  min-height: 38px;
}
.cp-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}
.cp-group {
  display: flex;
  align-items: start;
  flex-direction: column;
  text-align: left;
  min-width: 0;
  background: #fffef9;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 22px;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}
.cp-group:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px #24433713;
}
.cp-card-top {
  margin-bottom: 20px;
  font-size: 12px;
  font-weight: 650;
}
.cp-icon {
  border-radius: 9px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: #e2eadc;
  color: #315d46;
}
.cp-icon svg {
  width: 23px;
  height: 23px;
}
.cp-sport {
  background: #f7e8cc;
  color: #8a6328;
}
.cp-free-time {
  background: #eae2f0;
  color: #735985;
}
.cp-travel {
  background: #dce8ef;
  color: #42647b;
}
.cp-group strong {
  font: 500 28px/1.15 var(--serif);
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}
.cp-group-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  margin: 8px 0 20px;
  overflow-wrap: anywhere;
}
.cp-card-footer {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  width: 100%;
  margin-top: auto;
  font-size: 13px;
}
.cp-card-footer span:last-child {
  font-size: 18px;
}
.cp-empty {
  color: var(--muted);
  grid-column: 1/-1;
}
/* Dialogs and profile editor */
.cp-dialog {
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: min(560px, calc(100% - 28px));
  max-height: 90dvh;
  box-shadow: 0 28px 65px #10251b33;
}
.cp-dialog::backdrop {
  background: #1a302b77;
}
.cp-dialog[open] {
  animation: cp-in 0.18s ease-out;
}
@keyframes cp-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.cp-modal {
  position: relative;
  padding: 28px;
}
.cp-modal h2,
.cp-paper h2 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.045em;
  margin-bottom: 16px;
}
.cp-modal h2 {
  padding-right: 34px;
}
.cp-modal > div > p {
  margin-bottom: 16px;
}
.cp-close {
  position: absolute;
  right: 17px;
  top: 16px;
  border: 0;
  border-radius: 50%;
  width: 33px;
  height: 33px;
  background: #e9ede4;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}
.cp-paper {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(20px, 4vw, 38px);
  background: #fffef9;
}
.cp-form {
  display: grid;
  gap: 17px;
}
.cp-form label {
  display: grid;
  gap: 7px;
  font-weight: 650;
  font-size: 14px;
}
.cp-form input,
.cp-form select,
.cp-form textarea,
.cp-filters select,
.cp-composer input {
  border: 1px solid #bdc8bd;
  border-radius: 6px;
  background: #fffefa;
  color: var(--ink);
  padding: 10px 12px;
  max-width: 100%;
}
.cp-form input,
.cp-form select,
.cp-composer input {
  min-height: 43px;
}
.cp-form input,
.cp-form select,
.cp-form textarea {
  width: 100%;
}
.cp-form textarea {
  resize: vertical;
}
.cp-form button {
  justify-self: start;
}
.cp-form-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}
.cp-form output,
.cp-status {
  display: block;
  font-size: 14px;
}
.cp-form output:empty,
.cp-status:empty {
  display: none;
}
.cp-photo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #e4eadb;
  color: #6f8a72;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 39px;
}
.cp-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cp-photo-row {
  gap: 18px;
}
.cp-photo-row label {
  min-width: 0;
}
.cp-link {
  border: 0;
  padding: 15px 0 0;
  background: none;
  color: var(--green);
  text-decoration: underline;
}
/* Conversations · author menu supports click, long press and right click */
.cp-inbox {
  display: grid;
  gap: 9px;
}
.cp-chat-meta {
  font-size: 13px;
  color: var(--muted);
  margin: -8px 0 15px;
}
.cp-history {
  height: clamp(160px, 40dvh, 400px);
  overflow: auto;
  padding: 10px 4px 10px 0;
  border-block: 1px solid var(--line);
  overscroll-behavior: contain;
}
.cp-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0;
}
.cp-user-avatar {
  border-radius: 50%;
  background: #e4ebdf;
  font-size: 12px;
  font-weight: 700;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
}
.cp-message > div:last-child {
  min-width: 0;
}
.cp-message header {
  font-size: 13px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.cp-message time {
  font-size: 11px;
  color: var(--muted);
}
.cp-author {
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--green);
  font-weight: 700;
}
.cp-author:hover {
  text-decoration: underline;
}
.cp-message p {
  font-size: 14px;
  margin-top: 2px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.cp-mine .cp-user-avatar {
  background: var(--green);
  color: white;
}
.cp-member-actions {
  flex-wrap: wrap;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cp-member-actions > span {
  font-weight: 600;
}
.cp-composer {
  margin-top: 16px;
}
.cp-composer input {
  min-width: 0;
  flex: 1;
}
.cp-status {
  padding-top: 8px;
}
.cp-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
@media (max-width: 900px) {
  .cp-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cp-heading-row {
    align-items: start;
    flex-direction: column;
  }
}
@media (max-width: 580px) {
  .cp-groups {
    grid-template-columns: 1fr;
  }
  .cp-wrap {
    padding: 35px 0 55px;
  }
  .cp-tabs {
    gap: 3px;
  }
  .cp-tabs button {
    padding: 8px;
    font-size: 13px;
  }
  .cp-modal {
    padding: 21px;
  }
  .cp-form-columns {
    grid-template-columns: 1fr;
  }
  .cp-photo-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .cp-group {
    padding: 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .cp-dialog[open] {
    animation: none;
  }
  .cp-wrap *,
  .cp-dialog * {
    transition: none;
  }
}
