.community-app .community-profile-hero {
  --header-gutter: clamp(16px, 3.3vw, 34px);
  --header-avatar: clamp(96px, 9vw, 116px);
  --header-surface: var(--header-theme-dark, #2b1d30);
  --header-action-surface: #28212f;
  --header-text: #fcf3fa;
  --header-muted: #c2b2c7;
  --header-line: #dfbbe12b;
  --header-accent: #f2a5c7;
  --header-tab-active: #e959a022;
  position: relative;
  container: profile-header / inline-size;
  display: block;
  padding: 0;
  background: var(--header-surface);
  color: var(--header-text);
  border: 1px solid var(--header-line);
  border-radius: 21px;
  box-shadow: 0 18px 44px #08050e37;
}

body.community-app #community-main[data-community-surface="profile"] .profile-reference .community-profile-hero {
  margin-top: 8px;
}

html[data-theme="light"] .community-app .community-profile-hero {
  --header-surface: var(--header-theme-light, #fffafd);
  --header-action-surface: #f7edf5;
  --header-text: #372137;
  --header-muted: #6d576f;
  --header-line: #6e3b662b;
  --header-accent: #9d225c;
  --header-tab-active: #f7e6ef;
  background: var(--header-surface);
}

.community-profile-hero[data-banner="velvet"] {
  --header-theme-dark: #382135;
  --header-theme-light: #faedf4;
}

.community-profile-hero[data-banner="midnight"] {
  --header-theme-dark: #232640;
  --header-theme-light: #eef1fa;
}

.community-profile-hero[data-banner="champagne"] {
  --header-theme-dark: #392922;
  --header-theme-light: #fbf0e5;
}

.community-profile-hero[data-banner="aurora"] {
  --header-theme-dark: #25353b;
  --header-theme-light: #edf5f2;
}

.community-profile-hero > .profile-social-cover {
  --cover-padding: clamp(18px, 2.4cqi, 28px);
  --cover-gap: clamp(12px, 1.8cqi, 20px);
  position: relative;
  display: grid;
  grid-template-areas: "avatar counts" "details details";
  grid-template-columns: minmax(var(--header-avatar), 1fr) fit-content(65%);
  grid-template-rows: 1fr auto;
  gap: var(--cover-gap);
  min-block-size: clamp(280px, 28cqi, 360px);
  height: auto;
  padding: var(--cover-padding) var(--header-gutter);
  overflow: visible;
  background: transparent;
}

.community-profile-hero > .profile-social-cover::before,
.community-profile-hero > .profile-social-cover::after {
  content: none;
}

.community-profile-hero .profile-banner-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: 20px;
  pointer-events: none;
}

.community-profile-hero .profile-banner-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.community-profile-hero .profile-banner-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, color-mix(in srgb, var(--header-surface) 85%, transparent),
      color-mix(in srgb, var(--header-surface) 70%, transparent) 25%, transparent 52%),
    linear-gradient(to top, color-mix(in srgb, var(--header-surface) 92%, transparent), transparent 33%);
}

.community-profile-hero .profile-banner-image ~ :is(.profile-social-avatar, .profile-banner-counts, .profile-v4-header) {
  position: relative;
  z-index: 1;
}

.profile-banner-form {
  display: grid;
  gap: 12px;
}

.profile-banner-form p,
.profile-banner-form .actions { margin: 0; }
.profile-banner-form .profile-banner-feedback:empty { display: none; }
.profile-banner-form input[type="file"] { max-width: 100%; min-width: 0; }

.profile-banner-preview {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 1;
  object-fit: cover;
  border-radius: 10px;
  background: var(--community-soft, #221e29);
}

.community-profile-hero .profile-banner-counts {
  grid-area: counts;
  place-self: start end;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.community-profile-hero :is(.profile-followers-count, .profile-friends-count) {
  padding: 6px 9px;
  border: 1px solid #f5d2e24d;
  border-radius: 999px;
  background: #28192b;
  color: #fff3fa;
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.community-profile-hero > .profile-social-cover > .profile-v4-header {
  position: relative;
  display: grid;
  grid-area: details;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 1.8cqi, 24px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--header-text);
  box-shadow: none;
}

.community-profile-hero .profile-v4-header:has(details[open]) { z-index: 2; }

.community-profile-hero .profile-banner-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) fit-content(48%);
  align-items: end;
  gap: 8px 16px;
}

.community-profile-hero .profile-social-avatar,
.community-profile-hero .limited-profile-avatar {
  position: relative;
  display: grid;
  grid-area: avatar;
  place-self: end start;
  place-items: center;
  width: var(--header-avatar);
  height: var(--header-avatar);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 5px solid var(--header-surface);
  border-radius: 50%;
  background: linear-gradient(140deg, #714163, #322440 78%);
  color: #fff1fa;
  box-shadow: 0 10px 26px #0c081051;
}

.community-profile-hero :is(.profile-social-avatar, .limited-profile-avatar) :is(img, .name-avatar) {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  font-size: clamp(1.75rem, 3.5vw, 2.7rem);
}

.community-profile-hero #community-profile-heading {
  margin: 0;
  color: var(--header-text);
  font-size: clamp(1.7rem, 4.4cqi, 3.25rem);
  font-weight: 740;
  line-height: 1.05;
  letter-spacing: -.043em;
  overflow-wrap: anywhere;
}

.community-profile-hero .profile-v4-badges { gap: 6px; margin-top: 10px; }
.community-profile-hero .profile-v4-meta { color: var(--header-muted); }

html[data-theme="light"] .community-profile-hero .profile-v4-badge.is-gold { color: #724f1e; }
html[data-theme="light"] .community-profile-hero .profile-v4-badge.is-chatter { color: #67407b; }
html[data-theme="light"] .community-profile-hero .profile-v4-badge.is-advertiser { color: #79492d; }

.community-app .community-profile-hero .profile-v4-actions {
  position: relative;
  display: flex;
  grid-column: -2 / -1;
  justify-content: flex-end;
  width: auto;
  max-width: none;
  min-width: 0;
  gap: 7px;
  margin: 0;
}

.community-profile-hero .profile-v4-actions > .profile-more { position: relative; margin: 0; }
.community-profile-hero .profile-story-state { flex-basis: 100%; text-align: end; color: var(--header-accent); }

.community-app .community-profile-hero :is(.profile-v4-actions .button, .profile-edit-summary) {
  width: auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: .8125rem;
  font-weight: 680;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.community-profile-hero .profile-v4-actions .button--ghost,
.community-profile-hero .profile-v4-more-summary {
  background: var(--header-action-surface);
  color: var(--header-text);
  border-color: var(--header-line);
}

.community-profile-hero :is(.profile-v4-actions .button--primary, .profile-edit-summary) {
  background: linear-gradient(135deg, #ad326b, #892858);
  color: #fff;
  border-color: #e5a1be60;
}

.community-profile-hero :is(.profile-v4-actions .button--primary, .profile-edit-summary):hover:not(:disabled) {
  background: linear-gradient(135deg, #bc3674, #9d2f65);
}

.community-app .community-profile-hero .profile-v4-actions .profile-action-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 44px;
  inline-size: 44px;
  min-inline-size: 44px;
  block-size: 44px;
  padding: 0;
}

.community-profile-hero .profile-action-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.community-profile-hero .profile-action-icon[data-icon="following"] svg { fill: currentColor; }
.community-profile-hero .profile-action-icon[data-icon="more"] svg { stroke-width: 2.8; }
.community-profile-hero .profile-action-icon:hover:not(:disabled) { border-color: var(--header-accent); }

.community-profile-hero :is(.profile-header-more-options, .profile-edit-options) {
  position: absolute;
  z-index: 12;
  inset: calc(100% + 7px) 0 auto auto;
  display: grid;
  gap: 4px;
  min-width: 0;
  width: min(245px, 80cqi);
  max-width: none;
  padding: 6px;
  border: 1px solid var(--header-line);
  border-radius: 12px;
  background: var(--header-surface);
  box-shadow: 0 12px 28px #09060d62;
}

.community-app .community-profile-hero :is(.profile-header-more-options, .profile-edit-options) .button {
  justify-content: flex-start;
  width: 100%;
  text-align: start;
}

.community-profile-hero .profile-banner-footer > .profile-social-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: 0;
}

.community-profile-hero .profile-social-tab {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 8px 19px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--header-muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.community-profile-hero .profile-social-tab:is(:hover, [aria-selected="true"]) {
  color: var(--header-accent);
  background: var(--header-tab-active);
}

.community-profile-hero .profile-social-tab[aria-selected="true"] {
  border-color: var(--header-line);
  font-weight: 730;
}

.community-profile-hero .profile-social-tab[aria-selected="true"]::after { content: none; }

.community-profile-hero .profile-banner-image ~ .profile-v4-header .profile-social-tab {
  background-color: color-mix(in srgb, var(--header-surface) 90%, transparent);
}

.community-profile-hero .profile-banner-image ~ .profile-v4-header .profile-social-tab:is(:hover, [aria-selected="true"]) {
  background-color: color-mix(in srgb, var(--header-accent) 15%, var(--header-surface));
}

@media (forced-colors: active) {
  .community-profile-hero .profile-social-tab[aria-selected="true"] { border-color: Highlight; }
}

.community-profile-hero :is(button, summary):focus-visible {
  outline: 2px solid var(--header-accent);
  outline-offset: 3px;
}

.community-profile-hero .limited-profile-info { min-width: 0; }
.community-profile-hero .limited-profile-info .privacy-badge { margin-top: 10px; }
.community-profile-hero .limited-profile-info p {
  max-width: 64ch;
  margin: 10px 0 0;
  color: var(--header-muted);
  line-height: 1.6;
}

@container profile-header (max-width: 740px) {
  .community-profile-hero .profile-banner-footer { grid-template-columns: minmax(0, 1fr); }

  .community-profile-hero .profile-v4-actions > :is(.profile-edit-menu, .profile-more) { position: static; }
}

@container profile-header (max-width: 540px) {
  .community-profile-hero > .profile-social-cover {
    --header-avatar: clamp(79px, 23cqi, 106px);
  }

  .community-profile-hero .profile-social-avatar,
  .community-profile-hero .limited-profile-avatar {
    border-width: 4px;
  }

  .community-profile-hero .profile-banner-footer > .profile-social-tabs { gap: 3px; }

  .community-profile-hero .profile-social-tab {
    flex: 1 1 auto;
    padding-inline: 6px;
    font-size: .8125rem;
  }
}

@container profile-header (max-width: 340px) {
  .community-profile-hero .profile-banner-footer > .profile-social-tabs:has(#profile-tab-friends) {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
