/* =====================================================================
   Profile: Follow button, follower counts & follow lists
   ===================================================================== */

/* =====================================================================
   Follow Button
   ===================================================================== */

follow-button {
  display: inline-flex;
  flex-shrink: 0;
}

.profile-top follow-button {
  margin-left: auto;
}

/* Message: a round icon button before Follow, which then sits right next to it */
.profile-message {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border-subtle, #edebe6);
  border-radius: 50%;
  background: #ffffff;
  color: var(--text-main, #16181b);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.profile-message:hover {
  background-color: var(--surface-hover, #f7f6f2);
  border-color: #ded9cf;
  color: var(--accent, #4f46e5);
}

.profile-message:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 2px;
}

.profile-top .profile-message + follow-button {
  margin-left: 8px;
}

.follow-btn {
  min-width: 108px;                             /* "Following" ↔ "Unfollow" without a jump */
  padding: 7px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  background-color: var(--accent, #4f46e5);
  color: #ffffff;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
  transition: background-color 0.15s ease, color 0.15s ease,
              border-color 0.15s ease, box-shadow 0.15s ease;
}

.follow-btn:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 2px;
}

.follow-btn:disabled {
  cursor: progress;
  opacity: 0.75;
}

/* Following: quiet outline */
follow-button[following="true"] .follow-btn {
  background-color: #ffffff;
  color: var(--text-main, #16181b);
  border-color: var(--border-subtle, #edebe6);
  box-shadow: none;
}

/* Labels: one visible at a time */
.follow-label { display: none; }

follow-button:not([following="true"]) .follow-label-follow,
follow-button[following="true"] .follow-label-following {
  display: inline;
}

/* Hover to unfollow (pointer devices only, not right after following) */
@media (hover: hover) {
  .follow-btn:not(:disabled):hover {
    filter: brightness(1.04);
  }

  follow-button[following="true"]:not(.just-toggled) .follow-btn:hover {
    filter: none;
    background-color: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
  }

  follow-button[following="true"]:not(.just-toggled) .follow-btn:hover .follow-label-following {
    display: none;
  }

  follow-button[following="true"]:not(.just-toggled) .follow-btn:hover .follow-label-unfollow {
    display: inline;
  }
}

/* =====================================================================
   Counts (open the lists)
   ===================================================================== */

.profile-follow-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0 -8px;
  padding: 0;
  list-style: none;
}

.profile-count-link {
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-muted, #656f77);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.profile-count-link strong {
  margin-right: 4px;
  color: var(--text-main, #16181b);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.profile-count-link:hover {
  background-color: var(--surface-hover, #f7f6f2);
}

.profile-count-link:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 1px;
}

/* =====================================================================
   Follow List Panel (takes the profile's place while open)
   ===================================================================== */

feed-profile.follow-list-open > :not(follow-list-panel) {
  display: none !important;
}

follow-list-panel:not([hidden]) {
  display: block;
  min-height: 100%;
  background: var(--surface, #ffffff);
  animation: fadeIn 0.2s ease;
}

.follow-list-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px 6px;
  background: var(--surface, #ffffff);
}

.follow-list-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-main, #16181b);
  cursor: pointer;
  transition: background-color 0.12s ease;
}

.follow-list-close svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.follow-list-close:hover {
  background-color: var(--surface-hover, #f7f6f2);
}

.follow-list-close:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 2px;
}

.follow-list-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.follow-list-title strong {
  overflow: hidden;
  color: var(--text-main, #16181b);
  font-size: 1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.follow-list-title span {
  color: var(--text-muted, #656f77);
  font-size: 0.82rem;
}

/* Tabs */
.follow-list-tabs {
  position: sticky;
  top: 50px;
  z-index: 4;
  display: flex;
  border-bottom: 1px solid var(--border-subtle, #edebe6);
  background: var(--surface, #ffffff);
}

.follow-list-tabs button {
  position: relative;
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: none;
  color: var(--text-muted, #656f77);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, background-color 0.12s ease;
}

.follow-list-tabs button:hover {
  background-color: var(--surface-hover, #f7f6f2);
}

.follow-list-tabs button[aria-selected="true"] {
  color: var(--text-main, #16181b);
}

.follow-list-tabs button[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  width: 48px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent, #4f46e5);
  transform: translateX(-50%);
}

/* =====================================================================
   Rows
   ===================================================================== */

.follow-list {
  margin: 0;
  padding: 6px 0 24px;
  list-style: none;
}

.follow-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 16px;
  transition: background-color 0.12s ease;
}

.follow-row:hover {
  background-color: var(--surface-hover, #f7f6f2);
}

.follow-row.is-removing {
  animation: followRowOut 0.3s ease forwards;
  pointer-events: none;
}

.follow-row-link {
  display: flex;
  flex: 1;
  gap: 12px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.follow-row-avatar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 1px solid var(--border-subtle, #edebe6);
  border-radius: 50%;
  object-fit: cover;
  background: #f7f6f2;
}

.follow-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.follow-row-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.follow-row-nickname {
  overflow: hidden;
  color: var(--text-main, #16181b);
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.follow-row-link:hover .follow-row-nickname {
  text-decoration: underline;
}

.follow-row-badge {
  padding: 1px 7px;
  border-radius: 6px;
  background: #f2f0eb;
  color: var(--text-muted, #656f77);
  font-size: 0.72rem;
  font-weight: 600;
}

.follow-row-handle {
  color: var(--text-muted, #656f77);
  font-size: 0.85rem;
}

.follow-row-bio {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--text-main, #16181b);
  font-size: 0.88rem;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.follow-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding-top: 4px;
}

.follow-row-actions .follow-btn {
  min-width: 96px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* Remove follower: quiet until asked to confirm */
.follow-remove {
  padding: 6px 12px;
  border: 1px solid var(--border-subtle, #edebe6);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted, #656f77);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

.follow-remove:hover {
  color: var(--text-main, #16181b);
  border-color: #ded9cf;
}

.follow-remove.is-confirming {
  background-color: rgba(239, 68, 68, 0.06);
  border-color: rgba(239, 68, 68, 0.35);
  color: #ef4444;
}

.follow-remove:disabled {
  cursor: progress;
  opacity: 0.6;
}

.follow-remove:focus-visible {
  outline: 2px solid var(--accent, #4f46e5);
  outline-offset: 2px;
}

/* =====================================================================
   Loading, more, empty, error
   ===================================================================== */

.follow-list-loading,
.follow-list-more {
  display: flex;
  justify-content: center;
  padding: 18px 0;
}

.follow-list-loading::after,
.follow-list-more.is-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-subtle, #edebe6);
  border-top-color: var(--accent, #4f46e5);
  border-radius: 50%;
  animation: followSpin 0.8s linear infinite;
}

.follow-list-more:not(.is-loading) {
  min-height: 1px;
  padding: 0;
}

.follow-list-empty {
  padding: 40px 24px;
  color: var(--text-muted, #656f77);
  font-size: 0.92rem;
  text-align: center;
}

.follow-list-error {
  display: flex;
  justify-content: center;
  padding: 18px 0;
}

.follow-list-error button {
  padding: 6px 14px;
  border: 1px solid var(--border-subtle, #edebe6);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-muted, #656f77);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.follow-list-error button:hover {
  color: var(--accent, #4f46e5);
  border-color: rgba(79, 70, 229, 0.3);
}

/* =====================================================================
   Animations & Media Queries
   ===================================================================== */

@keyframes followSpin {
  to { transform: rotate(360deg); }
}

@keyframes followRowOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-8px); }
}

@media (max-width: 600px) {
  .follow-row { padding: 10px 12px; }
  .follow-row-actions .follow-btn { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .follow-btn,
  .profile-message,
  .profile-count-link,
  .follow-row,
  .follow-remove { transition: none; }

  follow-list-panel:not([hidden]),
  .follow-row.is-removing { animation: none; }

  .follow-row.is-removing { opacity: 0; }
}

/* =====================================================================
   Home timeline: Following with nothing to show yet (TimelineSort.js)
   ===================================================================== */

.timeline-empty {
  max-width: 34ch;
  margin: 40px auto;
  padding: 0 16px;
  color: var(--text-muted, #656f77);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}