/* ==========================================================================
   Stellion — profil (le mien, celui d'un ami) et « Modifier le profil »
   Maquettes : Profil, ProfilAmi, ModifierProfil.
   ========================================================================== */

/* Affiché par le JS (style.display = 'flex'), par-dessus la vue en cours, à droite de la
   colonne des nexus sur ordinateur, en plein écran sur mobile */
.st-profile {
  position: absolute;
  top: 0;
  left: var(--side-w);
  right: 0;
  bottom: 0;
  z-index: 100;
  min-width: 0;
  display: none;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
}

/* Barre posée sur la bannière : @pseudo et paramètres (moi), retour (quelqu'un d'autre) */
.st-profile__bar {
  position: absolute;
  top: calc(var(--space-2) + env(safe-area-inset-top, 0px));
  left: 6px;
  right: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.st-profile__round,
.st-profile__account {
  margin: 0;
  border: 0;
  background: var(--media-scrim);
  color: var(--on-media);
  box-shadow: none;
  font: inherit;
  letter-spacing: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-profile__round:hover,
.st-profile__account:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-profile__round {
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border-radius: var(--radius-full);
}

.st-profile__account {
  width: auto;
  min-height: 40px;
  padding: 0 10px 0 var(--space-3);
  border-radius: var(--radius-md);
  gap: 6px;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
}

#profile-settings-btn {
  margin-left: auto;
}

/* Moi : pas de retour ; quelqu'un d'autre : ni compte ni paramètres */
.st-profile.is-me .st-profile__back,
.st-profile:not(.is-me) .st-profile__account,
.st-profile:not(.is-me) #profile-settings-btn {
  display: none;
}

/* Bannière : image (--banner) ou dégradé doux du vert */
.st-profile__banner {
  height: 132px;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface-2));
}

.st-profile__banner.has-image {
  background: var(--banner) center / cover no-repeat;
}

.st-profile__content {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 var(--space-4) calc(var(--nav-space) + var(--space-6));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.st-profile__top {
  margin-top: -44px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
}

.st-profile__avatar > .st-avatar {
  --avatar-size: var(--avatar-xl);
  --avatar-ring: var(--bg);
  box-shadow: 0 0 0 4px var(--bg);
  font-size: var(--text-3xl);
}

.st-profile__btns {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.st-profile__btns[hidden] {
  display: none;
}

.st-profile__btns .st-btn {
  min-height: 40px;
}

.st-profile__share {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-strong);
}

.st-profile__names {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.st-profile__name {
  margin: 0;
  font-size: 22px; /* entre --text-2xl et --text-3xl, valeur de la maquette Profil */
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
}

.st-profile__handle {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.st-profile__note,
.st-profile__bio {
  margin: 0;
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  overflow-wrap: anywhere;
}

.st-profile__note {
  color: var(--text-muted);
}

.st-profile__note[hidden],
.st-profile__bio:empty {
  display: none;
}

.st-profile__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.st-profile__meta > span,
.st-profile__meta > a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.st-profile__meta > a {
  color: var(--accent-text);
  text-decoration: none;
}

.st-profile__meta [hidden],
.st-profile__meta > span:empty {
  display: none;
}

.st-profile__karma {
  width: auto;
  height: 24px;
  margin: 0;
  border: 0;
  box-shadow: none;
  cursor: pointer;
  position: relative;
}

.st-profile__karma::after {
  content: "";
  position: absolute;
  inset: -10px 0;
}

.st-profile__karma:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-profile__stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
}

.st-profile__stats > button {
  width: auto;
  min-height: var(--tap-min);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--text-md);
  letter-spacing: 0;
  cursor: pointer;
}

.st-profile__stats > button:hover {
  color: var(--text);
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-profile__stats strong {
  color: var(--text);
  font-weight: var(--weight-bold);
}

/* Onglets en icônes */
.st-profile__tabs {
  margin: var(--space-1) calc(var(--space-4) * -1) 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.st-profile__tabs[hidden] {
  display: none;
}

.st-profile__tabs > button {
  width: auto;
  height: 48px;
  margin: 0 0 -1px;
  padding: 0;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.st-profile__tabs > button:hover {
  color: var(--text);
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-profile__tabs > button[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.st-profile__feed {
  margin: 0 calc(var(--space-4) * -1);
}

.st-profile__feed[hidden],
.st-profile__list[hidden] {
  display: none;
}

.st-profile__list-head {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.st-profile__list-head > h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

/* ---------- Modifier le profil ---------- */

.st-editprofile .st-dialog__head {
  padding-left: var(--space-2);
}

.st-editprofile__title {
  text-align: center;
  font-size: var(--text-lg);
}

.st-editprofile__media {
  position: relative;
  margin-bottom: var(--space-8);
}

.st-editprofile__banner,
.st-editprofile__avatar {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: var(--surface-2) center / cover no-repeat;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.st-editprofile__banner:hover,
.st-editprofile__avatar:hover {
  filter: none;
  transform: none;
  box-shadow: none;
}

.st-editprofile__banner {
  width: 100%;
  height: 110px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-editprofile__cam {
  width: var(--tap-min);
  height: var(--tap-min);
  border-radius: var(--radius-full);
  background: var(--media-scrim);
  color: var(--on-media);
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-editprofile__avatar {
  position: absolute;
  left: var(--space-4);
  bottom: calc(var(--space-8) * -1);
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  box-shadow: 0 0 0 4px var(--surface);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  display: flex;
  align-items: center;
  justify-content: center;
}

.st-editprofile__colors {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.st-editprofile__more > summary {
  min-height: var(--tap-min);
  display: flex;
  align-items: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-muted);
  cursor: pointer;
}

.st-editprofile__more[open] {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .st-profile {
    position: fixed;
    left: 0;
    z-index: 350;
  }
}
