/* Profile view: header, counts, tabs, people lists, the follow button and the
   profile editor. Colours come from tokens.css only, so both themes follow. */

.profile-page {
  gap: var(--s-4);
}

/* --- Header ------------------------------------------------------------------------------- */
.profile-header {
  overflow: hidden;
}
.profile-header__banner {
  position: relative;
  height: 180px;
  background-color: var(--surface-2);
}
.profile-header__banner-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.profile-header__body {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  padding: 0 var(--s-5) var(--s-5);
  min-width: 0;
}
.profile-header__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: -56px;
}
.profile-header__avatar {
  display: inline-flex;
  flex: none;
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--surface);
  background: var(--surface);
}
.profile-header__avatar .avatar {
  border: 0;
}
.profile-header__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
  padding-bottom: var(--s-1);
}
.profile-header__identity {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-1);
  min-width: 0;
}
.profile-header__name {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.profile-header__nip05 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

/* The social distance, the signature of the profile. */
.profile-standing {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-1) 0 0;
  padding: 6px var(--s-3);
  border-radius: var(--radius-pill);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}
.profile-standing__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.profile-standing--0 {
  color: var(--hop-0);
  background: color-mix(in srgb, var(--hop-0) 13%, var(--surface));
}
.profile-standing--1 {
  color: var(--hop-1);
  background: color-mix(in srgb, var(--hop-1) 13%, var(--surface));
}
.profile-standing--2 {
  color: var(--hop-2);
  background: color-mix(in srgb, var(--hop-2) 13%, var(--surface));
}
.profile-standing--3 {
  color: var(--hop-3);
  background: color-mix(in srgb, var(--hop-3) 13%, var(--surface));
}
.profile-standing--outside {
  color: var(--text-muted);
  background: var(--surface-2);
}

.profile-header__about {
  font-size: 1rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  max-width: 62ch;
}
.profile-header__about .note-content__text {
  margin: 0;
}
.profile-header__about .note-content__text + .note-content__text {
  margin-top: var(--s-2);
}

.profile-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-4);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.profile-header__site {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-header__npub {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
}

/* The counts reserve their width, so that they do not move when they arrive. */
.profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.profile-stat {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.profile-stat__value {
  min-width: 3ch;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.profile-stat__label {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.profile-stat:hover .profile-stat__label,
.profile-stat:focus-visible .profile-stat__label {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.profile-stat:focus-visible {
  outline: none;
  border-radius: var(--radius-sm);
  box-shadow: var(--ring);
}

/* Reserves one line, so the header does not jump when the names arrive. */
.profile-header__via {
  min-height: 1.5em;
  margin: 0;
  font-size: 0.9375rem;
}
.profile-header__via-name {
  color: var(--text);
  font-weight: 600;
}

/* --- Tabs and panels ------------------------------------------------------------------------ */
.profile-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.people-list__heading {
  margin: var(--s-4) 0 0;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.people-list__heading:first-child {
  margin-top: 0;
}

/* --- Follow button ------------------------------------------------------------------------ */
.follow-button {
  min-width: 128px;
  justify-content: center;
}
.follow-button__off {
  display: none;
}
.follow-button--on:hover .follow-button__on,
.follow-button--on:focus-visible .follow-button__on {
  display: none;
}
.follow-button--on:hover .follow-button__off,
.follow-button--on:focus-visible .follow-button__off {
  display: inline;
}
.follow-button--on:hover,
.follow-button--on:focus-visible {
  color: var(--danger);
  border-color: var(--danger);
}

/* --- Edit profile ------------------------------------------------------------------------- */
.edit-profile {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.edit-profile__about {
  min-height: 96px;
  resize: vertical;
  font: inherit;
}
.edit-profile__actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-top: var(--s-2);
}
.image-field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: var(--s-4);
  align-items: start;
}
.image-field--banner {
  grid-template-columns: minmax(0, 1fr);
}
.image-field__preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
}
.image-field--banner .image-field__preview {
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 1;
  border-radius: var(--radius-sm);
}
.image-field__preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-field__controls {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  min-width: 0;
}
.image-field__buttons {
  flex-wrap: wrap;
}

/* --- Narrow screens --------------------------------------------------------------------------- */
@media (max-width: 699px) {
  .profile-header__banner {
    height: 128px;
  }
  .profile-header__body {
    padding: 0 var(--s-4) var(--s-4);
  }
  .profile-header__top {
    margin-top: -48px;
  }
  .profile-header__name {
    font-size: 1.5rem;
  }
  .profile-stats {
    gap: var(--s-2) var(--s-4);
  }
  .profile-page .tabs__tab {
    padding-inline: var(--s-3);
  }
  .image-field {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .image-field--banner {
    grid-template-columns: minmax(0, 1fr);
  }
  .image-field__preview {
    width: 56px;
    height: 56px;
  }
}
