/* Keep the identity rows at their content height, centered beside the avatar. */
#view-profile #accountProfileBanner,
#accountCardPreview {
  grid-template-rows: minmax(0, 1fr) auto auto auto minmax(0, 1fr);
  align-content: stretch;
  row-gap: 3px;
}

#view-profile #accountProfileBanner > .profile-avatar[data-avatar-surface],
#accountCardPreview > .account-avatar-action {
  grid-row: 1 / 6;
  margin: 0;
}

#accountProfileBanner > .account-profile-customize {
  grid-row: 1 / 6;
}

#accountProfileBanner > #accountProfileBio,
#accountCardPreview > #accountBioEditor {
  grid-row: 2;
}

#accountProfileBanner > #profileName,
#accountCardPreview > #accountPreviewName {
  grid-row: 3;
  min-inline-size: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#accountProfileBanner > p:not(#accountProfileBio),
#accountCardPreview > small {
  grid-row: 4;
}

#view-profile #accountProfileBanner > p {
  line-height: 1.5;
}

#accountCardPreview > #accountBioEditor {
  grid-column: 2 !important;
  margin: 0;
}

#accountBioEditor[data-dirty="false"]:not(:focus-within) > .account-bio-field {
  padding-inline-start: 0;
  border-inline-start-color: transparent;
}

@media (max-width: 760px) {
  #view-profile #accountProfileBanner {
    grid-template-columns: 72px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto auto auto minmax(0, 1fr) auto;
    gap: 3px 16px;
    padding: 20px 22px;
  }

  #view-profile #accountProfileBanner > .profile-avatar[data-avatar-surface] {
    width: 72px;
    height: 72px;
  }

  #accountProfileBanner > .account-profile-customize {
    grid-row: 6;
    margin-block-start: 6px;
  }

  #accountCardPreview {
    grid-template-columns: 84px minmax(0, 1fr);
    column-gap: 18px;
    padding: 24px 22px;
  }
}

@media (max-width: 420px) {
  #accountCardPreview {
    grid-template-columns: 72px minmax(0, 1fr);
    column-gap: 16px;
  }

  #accountCardPreview .account-avatar-action,
  #accountCardPreview .account-avatar-preview {
    width: 72px;
    height: 72px;
  }

  /* Override the old full-width bio row in the narrow preview. */
  #accountCardPreview > #accountBioEditor {
    grid-row: 2 !important;
    width: min(100%, var(--account-bio-width, 240px));
  }

  #accountCardPreview > #accountBioEditor:is(:focus-within, [data-dirty="true"]) {
    width: min(100%, 440px);
  }
}

@media (max-width: 899px) {
  #accountPreviewColumn[data-pinned="true"] > #accountCardPreview {
    grid-template-columns: 60px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 2px;
    padding: 14px 18px;
  }

  #accountPreviewColumn[data-pinned="true"] .account-avatar-action,
  #accountPreviewColumn[data-pinned="true"] .account-avatar-preview {
    width: 60px;
    height: 60px;
  }

  #accountPreviewColumn[data-pinned="true"] #accountBioEditor {
    grid-row: 2 !important;
  }
}
