/* Avatars et profil public */
.avatar { --size: 40px; flex: none; width: var(--size); height: var(--size); border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--hover); color: #fff; font-weight: 800; font-size: calc(var(--size) * 0.42); line-height: 1; user-select: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero.profile-hero.profile-head { display: block; padding: var(--hero-pad-top) var(--gutter) var(--sp-6); }
.profile-hero::after { display: none; }
.profile-hero .hero-inner { align-items: flex-end; }
.profile-hero .avatar { --size: clamp(150px, 16vw, 200px) !important; box-shadow: 0 14px 44px rgba(0, 0, 0, 0.5); }
.profile-hero .hero-title { font-size: clamp(34px, 5.4vw, 80px); }
.profile-hero .hero-text { gap: var(--sp-2); }
.profile-handle { margin: 0; font-size: var(--fs-caption); font-weight: 700; color: rgba(255, 255, 255, 0.85); }
.profile-counts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); font-size: var(--fs-caption); color: rgba(255, 255, 255, 0.85); }
.profile-counts b { color: #fff; }
.profile-counts .rel-badge { background: rgba(255, 255, 255, 0.18); color: #fff; }
.profile-actions { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }
.profile-action { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-6); font-size: var(--fs-body, 1rem); white-space: nowrap; }
.profile-none { margin: 0; color: var(--text-2); font-size: var(--fs-caption); }
.profile-none a { color: var(--text); text-decoration: underline; }
.profile-edit { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--sp-5); }
.follow-toggle { min-width: 130px; }

.mutual-row { display: flex; gap: var(--sp-4); overflow-x: auto; padding-bottom: var(--sp-2); scrollbar-width: none; }
.mutual-row::-webkit-scrollbar { display: none; }
.mutual-item { flex: none; width: 76px; display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); color: var(--text); text-decoration: none; text-align: center; }
.mutual-item:hover .avatar { filter: brightness(1.15); }
.mutual-item span { max-width: 100%; font-size: var(--fs-caption); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

html[data-backdrop] .profile-handle, html[data-backdrop] .profile-counts { color: var(--text-2); }
html[data-backdrop] .profile-counts b { color: var(--text); }
html[data-backdrop] .profile-counts .rel-badge { background: var(--hover); color: var(--text); }

@media (max-width: 767px) {
  .hero.profile-hero.profile-head { padding-bottom: var(--sp-5); }
  .profile-hero .hero-inner { align-items: center; text-align: center; }
  .profile-hero .avatar { --size: 128px !important; }
  .profile-hero .hero-text { align-items: center; }
  .profile-hero .hero-title { font-size: clamp(28px, 9vw, 40px); }
  .profile-counts { justify-content: center; }
  .profile-actions { justify-content: center; }
}

/* Page Amis */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.friends-searchbox { min-height: 56px; margin: var(--sp-2) 0 var(--sp-4); background: var(--hover); border: 1px solid transparent; transition: border-color 0.15s, background 0.15s; }
.friends-searchbox:focus-within { border-color: var(--accent); background: var(--active, var(--hover)); }
.friends-search { font-size: 1.05rem; }
.friends-tabs { display: flex; gap: var(--sp-2); margin: var(--sp-4) 0; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; }
.friends-tab { scroll-snap-align: start; }
.friends-tabs::-webkit-scrollbar { display: none; }
.friends-tab { flex: none; display: inline-flex; align-items: center; gap: var(--sp-2); min-height: 44px; padding: 0 var(--sp-4); border: 0; border-radius: var(--r-pill); background: var(--hover); color: var(--text); font: inherit; font-weight: 650; cursor: pointer; transition: background 0.15s; }
.friends-tab:hover { background: var(--active); }
.friends-tab[aria-selected="true"] { background: var(--text); color: var(--bg-2); }
.friends-tab .count { font-size: var(--fs-caption); opacity: 0.7; font-weight: 700; }
.friends-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 767px) {
  /* Rangée d'onglets de bord à bord, fondu à droite : on voit qu'elle défile */
  .friends-tabs { margin-inline: calc(var(--gutter, var(--sp-4)) * -1); padding-inline: var(--gutter, var(--sp-4)); scroll-padding-inline: var(--gutter, var(--sp-4));
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .friends-tabs.at-end { -webkit-mask-image: none; mask-image: none; }
  .friends-tab { min-height: 40px; padding: 0 var(--sp-3); font-size: var(--fs-caption); }
}
.friends-results { margin-bottom: var(--sp-2); }

.user-row { display: flex; align-items: center; gap: var(--sp-3); min-height: 60px; padding: var(--sp-1) var(--sp-3); border-radius: var(--r-md); transition: background 0.15s; }
.user-row:hover { background: var(--hover); }
.user-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--sp-3); min-height: 52px; color: var(--text); text-decoration: none; }
.user-link .row-main { display: flex; flex-direction: column; min-width: 0; }
.user-link .row-title, .user-link .row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-link .row-title { font-weight: 700; }
.user-link .row-sub { font-size: var(--fs-caption); color: var(--text-2); }
.user-row .row-end { flex: none; }
.user-action { min-width: 120px; }
.user-action.follow-toggle { min-width: 130px; }

.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: var(--sp-3); }
.friend-card { display: flex; flex-direction: column; align-items: center; gap: var(--sp-1); min-width: 0; padding: var(--sp-5) var(--sp-3); border-radius: var(--r-lg); background: var(--surface-2, var(--hover)); color: var(--text); text-align: center; text-decoration: none; transition: transform 0.2s, background 0.2s, box-shadow 0.2s; }
.friend-card:hover, .friend-card:focus-visible { background: var(--hover); transform: translateY(-4px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3); }
.friend-card .avatar { margin-bottom: var(--sp-2); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35); }
.friend-name { max-width: 100%; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-handle { max-width: 100%; font-size: var(--fs-caption); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friends-empty .empty-icon { width: 96px; height: 96px; background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.friends-empty .btn { margin-top: var(--sp-3); }

@media (max-width: 767px) {
  .friend-grid { grid-template-columns: 1fr; gap: 0; }
  .friend-card { flex-direction: row; gap: var(--sp-3); padding: var(--sp-2) var(--sp-3); min-height: 60px; background: none; text-align: left; box-shadow: none; }
  .friend-card:hover, .friend-card:focus-visible { transform: none; box-shadow: none; }
  .friend-card .avatar { --size: 44px !important; margin: 0; box-shadow: none; flex: none; }
  .friend-card { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; align-content: center; row-gap: 0; column-gap: var(--sp-3); align-items: center; }
  .friend-card .avatar { grid-row: 1 / 3; }
  .friend-name, .friend-handle { grid-column: 2; }
  .user-action { min-width: 0; padding: 0 var(--sp-3); font-size: var(--fs-caption); }
  .user-action.follow-toggle { min-width: 0; }
}
