/* Forum, threads, search and member profiles */
.community-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.community-hero h1 {
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

.community-hero p {
  max-width: 49em;
  margin: 8px 0 0;
  color: var(--text-2);
  font-size: 15px;
}

.community-forum-hero .btn {
  align-self: center;
  flex: none;
  color: var(--accent);
  background: var(--surface);
}

.community-section {
  margin: 0 0 24px;
}

.community-section-title {
  margin-bottom: 12px;
}

.community-section-title h2,
.community-panel-title h2 {
  font-size: 18px;
  letter-spacing: -.02em;
}

.community-boards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(216px, 100%), 1fr));
  gap: 14px;
}

.community-board {
  display: flex;
  min-width: 0;
  min-height: 150px;
  flex-direction: column;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color .16s, background .16s;
}

.community-board:hover {
  border-color: var(--line-strong);
  background: var(--bg-hover);
  color: var(--text);
}

.community-board-top,
.community-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  flex-wrap: wrap;
}

.community-symbol {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
}

.community-symbol[data-tone="1"] {
  background: color-mix(in srgb, #7959e4 13%, var(--surface));
  color: #6540c7;
}

.community-symbol[data-tone="2"] {
  background: color-mix(in srgb, #0a93a6 13%, var(--surface));
  color: #087080;
}

:root[data-theme="dark"] .community-symbol[data-tone="1"] { color: #c9b7ff }
:root[data-theme="dark"] .community-symbol[data-tone="2"] { color: #97dee7 }

.community-count {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}

.community-board h3 {
  margin-top: 14px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.community-board p {
  margin: 6px 0 14px;
  color: var(--text-2);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.community-board-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.community-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.community-panel-title {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.community-panel-title h2 {
  display: flex;
  gap: 8px;
  align-items: center;
}

.community-panel-title h2 svg {
  flex: none;
  color: var(--accent);
}

.community-panel .empty,
.community-boards > .empty {
  padding: 24px 20px;
}

.community-panel .empty-hint:empty,
.community-boards .empty-hint:empty {
  display: none;
}

.community-feed .entry {
  align-items: center;
  padding: 15px 20px;
  color: var(--text);
}

.community-feed .entry:last-child,
.community-project-line:last-child {
  border-radius: 0 0 15px 15px;
}

.community-feed .entry:focus-visible {
  outline-offset: -3px;
}

.community-feed .entry-meta {
  font-size: 12px;
  overflow-wrap: anywhere;
}

.community-feed .entry-board {
  border-radius: 6px;
  font-size: 11px;
}

.community-feed .entry-title {
  font-size: 16px;
  overflow-wrap: anywhere;
}

.community-feed .entry:hover .entry-title {
  color: var(--accent);
}

.community-feed .entry-excerpt {
  font-size: 13.5px;
  overflow-wrap: anywhere;
}

.community-feed .entry-marks {
  flex-wrap: wrap;
  justify-content: flex-end;
  padding: 0;
}

.community-feed .mark {
  font-size: 12px;
}

.community-feed .mark-pin,
.community-feed .mark-lock {
  display: inline-block;
  border-radius: 6px;
  vertical-align: 1px;
  font-size: 11px;
}

.community-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.community-breadcrumb a {
  color: var(--accent);
}

.community-breadcrumb a:hover {
  text-decoration: underline;
}

.community-board-hero,
.community-profile {
  justify-content: flex-start;
}

.community-board-hero > .community-symbol {
  width: 62px;
  height: 62px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.community-board-hero > .community-symbol svg {
  width: 27px;
  height: 27px;
}

.community-inline-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--text-2);
  background: var(--bg-soft);
}

.community-inline-action .btn {
  flex: none;
  align-self: center;
}

.community-composer {
  margin: 0 0 20px;
  padding: 0 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.community-composer > summary {
  min-height: 52px;
  padding: 10px 0;
  color: var(--accent);
  font-size: 14px;
  font-weight: 650;
}

.community-composer[open] > summary {
  border-bottom: 1px solid var(--line);
}

.community-composer .stack {
  max-width: 720px;
}

.community-thread {
  width: min(100%, 960px);
  margin-inline: auto;
}

.community-topic {
  display: block;
  margin-bottom: 16px;
}

.community-topic h1 {
  font-size: clamp(26px, 3.2vw, 39px);
}

.community-topic-meta,
.community-profile-meta,
.community-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  color: var(--text-2);
  font-size: 13px;
}

.community-topic-meta > span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.community-topic-meta svg {
  color: var(--accent);
}

.community-tools {
  gap: 8px;
  margin-top: 16px;
}

.community-tools .btn {
  background: var(--surface);
}

.community-posts {
  display: grid;
  gap: 12px;
}

.community-post {
  scroll-margin-top: calc(var(--header-height, 68px) + 16px);
}

.community-post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 22px;
  border-bottom: 1px solid var(--line);
}

.community-post-avatar,
.community-profile-avatar {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.community-post-header > div {
  min-width: 0;
  margin-right: auto;
  overflow-wrap: anywhere;
}

.community-post-header time {
  display: block;
  color: var(--text-2);
  font-size: 12px;
}

.community-post .prose {
  max-width: 71ch;
  padding: 22px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.community-post .prose > :last-child {
  margin-bottom: 0;
}

.community-reply {
  margin-top: 16px;
}

.community-reply .composer-form,
.community-reply > .community-inline-action,
.community-reply-note {
  margin: 16px;
}

.community-reply-note {
  color: var(--text-2);
}

.community-search-hero {
  align-items: flex-start;
  flex-direction: column;
}

.community-search {
  display: flex;
  width: min(100%, 720px);
  align-items: stretch;
  gap: 10px;
}

.community-search .btn {
  align-self: stretch;
  flex: none;
}

.community-search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 46px;
  flex: 1;
  padding-inline: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
}

.community-search-field:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.community-search-field svg {
  flex: none;
}

.community-search-field input {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

.community-search-field input::placeholder {
  color: var(--text-3);
}

.community-results {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.community-project-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
}

.community-project-line:last-child {
  border-bottom: 0;
}

.community-project-line:hover {
  background: var(--bg-hover);
  color: var(--accent);
}

.community-project-line:focus-visible {
  outline-offset: -3px;
}

.community-project-line strong,
.community-project-line > span:nth-child(2) > span {
  display: block;
  overflow-wrap: anywhere;
}

.community-project-line > span:nth-child(2) > span {
  color: var(--text-2);
  font-size: 12px;
}

.community-project-line > svg {
  color: var(--accent);
}

.community-profile-avatar {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  background: var(--primary-gradient);
  color: #fff;
  font-size: 32px;
}

.community-profile-meta {
  margin-top: 8px;
  overflow-wrap: anywhere;
}

.community-profile { flex-wrap: wrap }
body[data-page="profile"] .shell { max-width: 1050px }
.profile-settings-link { margin-inline-start: auto; white-space: nowrap }
.profile-activity {
  --activity-cell: clamp(10px, 1.12vw, 14px);
  --activity-gap: 3px;
  --activity-missing: var(--line-strong);
  --activity-0: var(--bg-soft);
  --activity-1: #ade1cb;
  --activity-2: #66c39d;
  --activity-3: #2a936d;
  --activity-4: #175c45;
  min-width: 0;
  margin-bottom: 18px;
  padding: 20px;
}
.profile-activity[data-metric="desk"] {
  --activity-1: #cddaff;
  --activity-2: #91affc;
  --activity-3: #566fe2;
  --activity-4: #3d48a8;
}
:root[data-theme="dark"] .profile-activity {
  --activity-1: #1d493b;
  --activity-2: #2f7359;
  --activity-3: #4fa47e;
  --activity-4: #8ddcba;
}
:root[data-theme="dark"] .profile-activity[data-metric="desk"] {
  --activity-1: #2b3b68;
  --activity-2: #425c9e;
  --activity-3: #6783dc;
  --activity-4: #a4b9ff;
}
.profile-activity-head,
.profile-activity-summary,
.profile-activity-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.profile-activity-head h2 { margin: 0; font-size: 19px }
.profile-activity-tabs {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
}
.profile-activity-tabs a {
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-2);
  font-size: 13px;
}
.profile-activity-tabs [aria-current] {
  background: var(--surface);
  color: var(--accent);
  font-weight: 650;
}
.profile-activity-summary { margin-top: 14px }
.profile-activity-summary > span,
.profile-activity-months,
.profile-activity-weekdays,
.profile-activity-footer,
.profile-activity-note { color: var(--text-2); font-size: 12px }
.profile-activity-chart {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.profile-activity-weekdays {
  display: grid;
  grid-template-rows: repeat(7, var(--activity-cell));
  gap: var(--activity-gap);
  padding-top: 20px;
  line-height: var(--activity-cell);
  font-size: 10px;
}
.profile-activity-weekdays > :nth-child(2) { grid-row: 3 }
.profile-activity-weekdays > :nth-child(3) { grid-row: 5 }
.profile-activity-scroll { overflow-x: auto; max-width: 100%; padding: 0 2px 5px }
.profile-activity-grid { width: max-content }
.profile-activity-months,
.profile-activity-days {
  display: grid;
  grid-template-columns: repeat(var(--activity-weeks), var(--activity-cell));
  gap: var(--activity-gap);
}
.profile-activity-months { height: 20px; align-items: start; white-space: nowrap; font-size: 11px }
.profile-activity-days { grid-template-rows: repeat(7, var(--activity-cell)) }
.profile-activity-cell,
.profile-activity-legend i {
  display: inline-block;
  width: var(--activity-cell);
  height: var(--activity-cell);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0;
  background: var(--activity-0);
}
.profile-activity [data-level="1"] { background: var(--activity-1); border-color: transparent }
.profile-activity [data-level="2"] { background: var(--activity-2); border-color: transparent }
.profile-activity [data-level="3"] { background: var(--activity-3); border-color: transparent }
.profile-activity [data-level="4"] { background: var(--activity-4); border-color: transparent }
.profile-activity [data-level="unknown"] {
  background: repeating-linear-gradient(135deg, var(--activity-0) 0 2px, var(--activity-missing) 2px 3px, var(--activity-0) 3px 5px);
}
.profile-activity-cell[aria-pressed="true"],
.profile-activity-cell:focus-visible { outline: 1px solid var(--accent); outline-offset: 1px }
.profile-activity-cell { cursor: pointer }
.profile-activity-footer { margin-top: 7px }
.profile-activity-footer p { margin: 0; color: var(--text) }
.profile-activity-legend,
.profile-activity-missing { display: inline-flex; align-items: center; gap: 4px }
.profile-activity-missing { margin-inline-end: 8px }
.profile-activity-note { margin: 10px 0 0 }
body[data-page="profile-settings"] .shell { max-width: 800px }
.profile-settings-form { padding: clamp(16px, 3vw, 24px) }
.profile-username-form { margin-bottom: 16px }
.profile-username-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  max-inline-size: 470px;
  margin-top: 16px;
}
.profile-username-field {
  display: flex;
  align-items: center;
  min-inline-size: 0;
  min-block-size: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface);
}
.profile-username-field span {
  padding-inline-start: 12px;
  color: var(--text-2);
  font: 500 14px var(--mono);
}
.profile-username-field input {
  min-inline-size: 0;
  inline-size: 100%;
  min-block-size: 42px;
  padding: 0 12px 0 7px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: 500 16px var(--mono);
}
.profile-username-field:has(input[aria-invalid]) { border-color: var(--red) }
.profile-username-field:focus-within { outline: 2px solid var(--accent); outline-offset: 2px }
.profile-username-field input:focus { outline: none }
.profile-username-row .btn { min-block-size: 44px }
.profile-username-note,
.profile-username-error { margin: 8px 0 0; color: var(--text-2); font-size: 13px }
.profile-username-error { color: var(--red) }
@media (max-width: 420px) {
  .profile-username-row { grid-template-columns: minmax(0, 1fr) }
  .profile-username-row .btn { justify-self: start }
}

.profile-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px 20px;
}

.profile-settings-copy h2 { font-size: 16px }
.profile-settings-copy p { margin: 5px 0 0; color: var(--text-2); font-size: 14px }
.profile-settings-copy .profile-settings-note { color: var(--text-3) }
.profile-settings-row:has(input:enabled) label { cursor: pointer }

.profile-settings-control {
  position: relative;
  display: grid;
  place-items: center;
  inline-size: 48px;
  block-size: 44px;
}

.profile-settings-control input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.profile-settings-track {
  position: relative;
  inline-size: 42px;
  block-size: 24px;
  border: 1px solid color-mix(in srgb, var(--line-strong), var(--text-2) 48%);
  border-radius: var(--pill);
  background: var(--bg-soft);
}

.profile-settings-track::before {
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  inline-size: 16px;
  block-size: 16px;
  border-radius: 50%;
  background: var(--text-2);
  content: "";
}

.profile-settings-control input:checked + .profile-settings-track {
  border-color: var(--accent);
  background: var(--accent);
}

.profile-settings-control input:checked + .profile-settings-track::before {
  inset-inline-start: calc(100% - 19px);
  background: var(--surface);
}

.profile-settings-control input:focus-visible + .profile-settings-track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.profile-settings-control input:disabled { cursor: not-allowed }
.profile-settings-control input:disabled + .profile-settings-track { opacity: .55 }

.profile-settings-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.profile-settings-actions .btn { min-block-size: 44px }

@media (forced-colors: active) {
  .profile-settings-control input {
    position: static;
    width: 20px;
    height: 20px;
    opacity: 1;
  }

  .profile-settings-track { display: none }
}

@media (max-width: 1060px) {
  .community-results {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 600px) {
  .community-hero {
    margin-bottom: 18px;
    padding: 20px;
    border-radius: 16px;
  }

  .community-forum-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .community-forum-hero .btn {
    align-self: flex-start;
  }

  .community-section {
    margin-bottom: 18px;
  }

  .community-board {
    min-height: auto;
    padding: 16px;
  }

  .community-panel-title,
  .community-feed .entry,
  .community-post-header,
  .community-post .prose {
    padding-inline: 16px;
  }

  .community-feed .entry-marks {
    justify-content: flex-start;
  }

  .community-profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 17px;
    font-size: 24px;
  }

  .community-profile {
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }

  .community-profile > div { flex: 1; min-width: 0 }
  .profile-activity { padding: 15px }
  .profile-activity-head { align-items: flex-start }
}

.community-linked-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.community-linked-context a:not(.btn) { color: var(--accent); font-weight: 650 }

.community-composer .stack select {
  appearance: none;
  width: 100%;
  min-height: 44px;
  padding: 8px 38px 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d675f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E") right 12px center / 16px 16px no-repeat;
  font: 14px var(--font-sans);
}

:root[data-theme="dark"] .community-composer .stack select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c2ccc3' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
}
