/* /profile/<id-or-name> - reuses .lb-error, .page-loader, .container etc.
   from leaderboards.css/site.css; this file is just the parts unique to
   the profile head and stat tiles. */

.profile-head {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  margin: var(--space-6) 0;
  flex-wrap: wrap;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-head-main { min-width: 0; }
.profile-head-main h1 { margin: 0 0 4px; word-break: break-word; }
.profile-id { color: var(--text-dim); font-size: var(--text-sm); }
.profile-since { margin: 6px 0 0; font-size: var(--text-sm); }

.profile-bio { margin: 10px 0 0; font-size: var(--text-sm); max-width: 56ch; white-space: pre-wrap; word-break: break-word; }

.profile-connections { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.profile-connection-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
}
.profile-connection-link:hover { border-color: var(--border-hi); background: var(--surface-alt); transform: translateY(-1px); }
.profile-connection-link svg { width: 14px; height: 14px; flex-shrink: 0; }
.profile-connection-link { transition: border-color 0.15s, background 0.15s, transform 0.15s; animation: pfFadeUp 0.25s var(--ease-out) backwards; }
.profile-connections .profile-connection-link:nth-child(1) { animation-delay: 0ms; }
.profile-connections .profile-connection-link:nth-child(2) { animation-delay: 40ms; }
.profile-connections .profile-connection-link:nth-child(3) { animation-delay: 80ms; }
.profile-connections .profile-connection-link:nth-child(4) { animation-delay: 120ms; }
.profile-connections .profile-connection-link:nth-child(5) { animation-delay: 160ms; }
.profile-connections .profile-connection-link:nth-child(n+6) { animation-delay: 200ms; }

@keyframes pfFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.profile-customise-btn { margin-top: 12px; animation: pfFadeUp 0.25s var(--ease-out); }

.pfc-bio-counter { margin: 4px 0 0; font-size: var(--text-xs); color: var(--text-dim); text-align: right; }

.pfc-conn-list { display: flex; flex-direction: column; gap: 2px; }
.pfc-conn-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  animation: pfcRowIn 0.22s var(--ease-out);
}
.pfc-conn-row:last-child { border-bottom: none; }
@keyframes pfcRowIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
.pfc-conn-icon { width: 22px; height: 22px; flex-shrink: 0; color: var(--text-dim); }
.pfc-conn-icon svg { width: 100%; height: 100%; }
.pfc-conn-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pfc-conn-label { font-size: var(--text-sm); font-weight: 600; flex-shrink: 0; width: 70px; }
.pfc-conn-value { flex: 1; min-width: 120px; }
.pfc-conn-visible {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
  cursor: pointer;
  white-space: nowrap;
}

/* Same switch component as the dashboard's module toggles, so this reads
   the same way anywhere a Supporter/profile setting is switched on or off. */
.pfc-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; }
.pfc-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.pfc-switch .pfc-switch-slider {
  position: absolute; inset: 0;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s var(--ease-out), border-color 0.2s var(--ease-out);
}
.pfc-switch .pfc-switch-slider::before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 2px; top: 2px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.22s var(--ease-out), background 0.2s var(--ease-out);
}
.pfc-switch input:checked + .pfc-switch-slider { border-color: var(--accent); }
.pfc-switch input:checked + .pfc-switch-slider::before { transform: translateX(16px); background: var(--accent); }
.pfc-switch input:focus-visible + .pfc-switch-slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.pfc-conn-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.pfc-conn-remove:hover { color: var(--danger, #e5484d); }

.pfc-add-section { margin-top: 16px; }
.pfc-add-title { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 8px; font-weight: 600; }
.pfc-add-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pfc-add-icon {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
  animation: pfcIconIn 0.22s var(--ease-out) backwards;
}
.pfc-add-icon svg { width: 18px; height: 18px; }
.pfc-add-icon:hover { border-color: var(--border-hi); color: var(--text); background: var(--surface-alt); transform: translateY(-2px); }
.pfc-add-icon:active { transform: translateY(0) scale(0.92); }
@keyframes pfcIconIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: none; }
}
.pfc-add-grid .pfc-add-icon:nth-child(1) { animation-delay: 0ms; }
.pfc-add-grid .pfc-add-icon:nth-child(2) { animation-delay: 30ms; }
.pfc-add-grid .pfc-add-icon:nth-child(3) { animation-delay: 60ms; }
.pfc-add-grid .pfc-add-icon:nth-child(4) { animation-delay: 90ms; }
.pfc-add-grid .pfc-add-icon:nth-child(5) { animation-delay: 120ms; }
.pfc-add-grid .pfc-add-icon:nth-child(6) { animation-delay: 150ms; }
.pfc-add-grid .pfc-add-icon:nth-child(7) { animation-delay: 180ms; }

@media (max-width: 480px) {
  .pfc-conn-row { flex-wrap: wrap; }
  .pfc-conn-main { flex-basis: 100%; order: 1; }
  .pfc-conn-visible { order: 2; }
}

.profile-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.profile-badge-wrap { position: relative; display: inline-flex; }
.profile-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
  animation: pfFadeUp 0.25s var(--ease-out) backwards;
}
.profile-badge-chip:hover,
.profile-badge-chip[aria-expanded="true"] { border-color: var(--border-hi); background: var(--surface-alt); transform: translateY(-1px); }
.profile-badge-chip:active { transform: translateY(0) scale(0.96); }
.profile-badge-chip svg { width: 12px; height: 12px; }
.profile-badges .profile-badge-wrap:nth-child(1) .profile-badge-chip { animation-delay: 0ms; }
.profile-badges .profile-badge-wrap:nth-child(2) .profile-badge-chip { animation-delay: 40ms; }
.profile-badges .profile-badge-wrap:nth-child(3) .profile-badge-chip { animation-delay: 80ms; }
.profile-badges .profile-badge-wrap:nth-child(n+4) .profile-badge-chip { animation-delay: 120ms; }

.profile-badge-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  width: 220px;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hi);
  background: var(--bg-subtle);
  box-shadow: var(--shadow-lg, 0 10px 30px rgba(0, 0, 0, 0.3));
  transform-origin: top left;
  animation: pfPopIn 0.14s ease-out;
}
@keyframes pfPopIn {
  from { opacity: 0; transform: scale(0.94) translateY(-2px); }
  to { opacity: 1; transform: none; }
}
.profile-badge-popover .badge-title { font-weight: 700; font-size: var(--text-sm); margin-bottom: 4px; }
.profile-badge-popover .badge-reason { margin: 0 0 6px; font-size: var(--text-xs); color: var(--text-muted); }
.profile-badge-popover .badge-date { margin: 0; font-size: var(--text-xs); color: var(--text-dim); }

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.profile-stat {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-5);
  text-align: center;
}
.profile-stat-value { display: block; font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 700; }
.profile-stat-label { display: block; color: var(--text-muted); font-size: var(--text-sm); margin-top: 4px; }

.profile-section-title { font-size: var(--text-md); margin: 0 0 var(--space-3); }
.profile-job {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.profile-job p { margin: 4px 0; }
.profile-job code { font-size: var(--text-sm); }

/* Sits in the top-right of .profile-head, next to the name/badges - not a
   separate section, so no card chrome of its own, just pushed to the far
   edge of that flex row. */
.profile-op-panel { margin-left: auto; flex-shrink: 0; text-align: right; align-self: flex-start; }
.profile-op-title { font-size: var(--text-sm); color: var(--text-muted); margin: 0 0 8px; }
.profile-op-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.profile-op-panel p.text-muted { font-size: var(--text-xs); margin: 0 0 8px; max-width: 220px; }

@media (max-width: 560px) {
  .profile-head { text-align: center; justify-content: center; }
  .profile-badges { justify-content: center; }
  .profile-bio { max-width: none; margin-left: auto; margin-right: auto; }
  .profile-connections { justify-content: center; }
  .profile-stats { grid-template-columns: 1fr; }
  .profile-op-panel { margin-left: 0; text-align: center; align-self: center; width: 100%; }
  .profile-op-actions { justify-content: center; flex-direction: column; }
  .profile-op-actions .btn { width: 100%; }
  .profile-op-panel p.text-muted { max-width: none; }
}
