/**
 * Styles for the shared ProfileView, loaded by the social profile page and by
 * the gym dashboard's member drawer.
 *
 * Kept apart from social.css on purpose: that file sets broad .btn, .field,
 * .row and .empty rules, which would leak into the Tailwind-styled dashboard and
 * break it. Everything here is scoped to .profile-* or .pill.
 *
 * Reads the same custom properties as the rest of the app, so it needs
 * brand.css loaded alongside it. Light mode comes from those tokens: lime as
 * text reads --lime-ink and lime as a line --lime-edge (social.css; both fall
 * back to --brand), and neon tints use brand.css's --neon-rgb.
 */

/* ================================================================== *
 * Profile
 * ================================================================== */

.profile-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.profile-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.profile-page .linkish {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.profile-page .linkish.danger {
  color: var(--warn);
}

.profile-header {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 1.25rem 1.25rem;
  overflow: hidden;
}

.profile-cover {
  height: 132px;
  margin: 0 -1.25rem;
  background-size: cover;
  background-position: center;
  background-color: var(--panel-2);
}
/* Sits under a real cover image and gives the header a neon horizon when there
   is none, so the avatar always has something to sit against. */
.profile-cover-fallback {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 132px;
  background:
    radial-gradient(
      120% 100% at 50% 100%,
      rgb(var(--neon-rgb) / 0.22),
      transparent 65%
    ),
    linear-gradient(to bottom, rgba(5, 5, 5, 0.1), rgba(5, 5, 5, 0.92));
  pointer-events: none;
}
/* Light, outside the social app (the dashboard's member drawer): fade to paper.
   The social app restyles the fallback itself in social.css. */
[data-theme="light"] body:not(.social-body) .profile-cover-fallback {
  background:
    radial-gradient(
      120% 100% at 50% 100%,
      rgb(var(--neon-rgb) / 0.22),
      transparent 65%
    ),
    linear-gradient(to bottom, rgba(243, 239, 229, 0.1), rgba(243, 239, 229, 0.92));
}
.profile-header:has(.profile-cover[style]) .profile-cover-fallback {
  display: none;
}

.profile-id {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  margin-top: -44px;
  flex-wrap: wrap;
}

.profile-avatar {
  width: 92px;
  height: 92px;
  flex: none;
  border-radius: 999px;
  overflow: hidden;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--line-2), 0 0 26px -6px rgb(var(--neon-rgb) / 0.6);
  background: var(--panel-2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.profile-avatar .placeholder {
  font-size: 2rem;
  font-weight: 700;
  color: var(--lime-ink, var(--brand));
}

.profile-names {
  flex: 1 1 200px;
  min-width: 0;
  padding-bottom: 0.2rem;
}
.profile-names h1 {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}
.profile-names p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}
.profile-title {
  color: var(--lime-ink, var(--brand));
  font-weight: 600;
}

.profile-self-tag {
  align-self: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

.profile-actions {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  padding-bottom: 0.2rem;
}

.profile-bio {
  position: relative;
  margin: 1rem 0 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.profile-facts {
  position: relative;
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.1rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.profile-facts li {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.profile-block {
  position: relative;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}
.profile-block-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--lime-ink, var(--brand));
}

.profile-credentials {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.86rem;
}
.profile-credentials li {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-dim);
}
.profile-credentials svg {
  color: var(--lime-ink, var(--brand));
  flex: none;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.5rem;
}
.profile-stat {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.profile-stat svg {
  color: var(--muted);
}
.profile-stat.neon {
  border-color: rgb(var(--neon-rgb) / 0.32);
  box-shadow: 0 0 22px -10px rgb(var(--neon-rgb) / 0.7);
}
.profile-stat.neon svg {
  color: var(--lime-ink, var(--brand));
}
.profile-stat-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.profile-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.profile-gyms {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.7rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  color: var(--text-dim);
}
.pill a {
  color: inherit;
  text-decoration: none;
}
.pill a:hover {
  color: var(--lime-ink, var(--brand));
}
.pill.neon {
  border-color: rgb(var(--neon-rgb) / 0.4);
  color: var(--lime-ink, var(--brand));
  box-shadow: 0 0 14px -4px rgb(var(--neon-rgb) / 0.7);
}
.pill.muted-pill {
  color: var(--faint);
}

.profile-counts {
  position: relative;
  display: flex;
  gap: 1.5rem;
  margin: 1.25rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--line);
}
.profile-counts div {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
}
.profile-counts dt {
  font-size: 0.78rem;
  color: var(--muted);
}
.profile-counts dd {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.profile-guard {
  position: relative;
  display: flex;
  gap: 1rem;
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.profile-post-community {
  margin: 0 0 0.4rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.profile-post-community a {
  color: var(--lime-ink, var(--brand));
  text-decoration: none;
}
.profile-post-community a:hover {
  text-shadow: 0 0 6px rgb(var(--neon-rgb) / 0.8);
}

.profile-editor {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 1.1rem;
  background: var(--panel);
  border: 1px solid rgb(var(--neon-rgb) / 0.28);
  border-radius: 14px;
}
.profile-editor .row {
  gap: 0.5rem;
}

/* Avatar and name are the affordance into a profile. */
.profile-link {
  display: inline-flex;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.profile-link:hover {
  transform: translateY(-1px);
}
.profile-link:hover .post-avatar {
  box-shadow: 0 0 0 1px rgb(var(--neon-rgb) / 0.5), 0 0 16px -4px rgb(var(--neon-rgb) / 0.8);
}
.profile-link.strong {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  border-radius: 6px;
}
.profile-link.strong:hover {
  color: var(--lime-ink, var(--brand));
  text-shadow: 0 0 6px rgb(var(--neon-rgb) / 0.8);
}
.post-avatar {
  transition: box-shadow 0.18s ease;
}

.profile-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Avatar and name are the affordance into a profile, from either app. */
.profile-link {
  display: inline-flex;
  border-radius: 999px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.profile-link:hover {
  transform: translateY(-1px);
}
.profile-link:hover .post-avatar {
  box-shadow: 0 0 0 1px rgb(var(--neon-rgb) / 0.5), 0 0 16px -4px rgb(var(--neon-rgb) / 0.8);
}
.profile-link.strong {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  border-radius: 6px;
}
.profile-link.strong:hover {
  color: var(--lime-ink, var(--brand));
  text-shadow: 0 0 6px rgb(var(--neon-rgb) / 0.8);
}

/* ================================================================== *
 * Followers / Following
 * ================================================================== */

.profile-tabs {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.8rem;
  border-bottom: 1px solid var(--line);
}

.profile-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.profile-tabs button:hover {
  color: var(--text);
}
.profile-tabs button.active {
  color: var(--lime-ink, var(--brand));
  border-bottom-color: var(--lime-edge, var(--brand));
  font-weight: 700;
}
.profile-tabs button:focus-visible {
  outline: 2px solid var(--lime-edge, var(--brand));
  outline-offset: -2px;
}

.connection-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.connection-list li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
}
.connection-list li + li {
  border-top: 1px solid var(--line);
}
.connection-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
.connection-meta strong {
  font-size: 0.88rem;
}
.connection-meta .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ================================================================== *
 * Phones
 *
 * The header is a cover with an avatar overlapping it; on a narrow
 * screen the desktop cover height and 92px avatar leave the name and
 * actions nowhere to go, so shrink both and let the actions wrap.
 * ================================================================== */

@media (max-width: 720px) {
  .profile-page {
    padding: 1rem 0.9rem 3rem;
  }

  .profile-header {
    padding: 0 1rem 1rem;
  }
  .profile-cover {
    height: 108px;
    margin: 0 -1rem;
  }
  .profile-cover-fallback {
    height: 108px;
  }

  .profile-avatar {
    width: 72px;
    height: 72px;
  }
  .profile-avatar .placeholder {
    font-size: 1.5rem;
  }
  .profile-id {
    margin-top: -36px;
    gap: 0.7rem;
  }
  .profile-names h1 {
    font-size: 1.15rem;
  }

  .profile-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .profile-counts {
    gap: 1rem;
    flex-wrap: wrap;
  }

  .profile-stats {
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  }

  .profile-tabs {
    overflow-x: auto;
    scrollbar-width: none;
  }
  .profile-tabs::-webkit-scrollbar {
    display: none;
  }
  .profile-tabs button {
    white-space: nowrap;
  }
}
