/* ═══════════════════════════════════════════════════════════════════════════
   Somebody else's profile, and the follower lists.

   Loaded only by user.php, through $pageStyles. The follower modal styles live
   here as well rather than in app.css because the only page that opens one is
   this one; if the modal is ever added to the community feed, move the .fl-*
   block into app.css rather than loading this whole file there.

   Colour note: --primary (#00bcd4) is 2.30:1 on white and is decoration only.
   Anything carrying text uses --primary-ink. Every var() has a fallback, so a
   browser holding an older theme.css still renders readable controls rather
   than the same colour twice.
   ═══════════════════════════════════════════════════════════════════════════ */

.pubp { max-width: 940px; margin: 0 auto; padding: 26px 18px 60px; }

/* ── Identity card ───────────────────────────────────────────────────────── */

.pubp-head {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
  overflow: hidden;
}

.pubp-head-inner {
  display: flex; align-items: flex-start; gap: 18px;
  padding: 22px 22px 18px;
}

/* The avatar. A button when there is a story to watch, a plain box when there
   is not, so the two cannot be told apart until there is a reason to tap. */
.pubp-ava {
  flex: 0 0 auto; width: 86px; height: 86px; padding: 0;
  border: 0; background: none; border-radius: 50%; cursor: default;
  display: grid; place-items: center;
}
.pubp-ava.has-story { cursor: pointer; padding: 3px; background: var(--border, #e5e7eb); }
.pubp-ava.has-story.unseen {
  background: linear-gradient(135deg, #00bcd4, #7c3aed 60%, #f59e0b);
}
.pubp-ava-inner {
  position: relative; display: grid; place-items: center;
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  color: #fff; font-size: 2rem; font-weight: 800;
  box-shadow: inset 0 0 0 3px var(--surface, #fff);
}
.pubp-ava.has-story .pubp-ava-inner { box-shadow: inset 0 0 0 3px var(--surface, #fff); }
.pubp-ava-inner img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; border-radius: 50%;
}

/* min-width:0 or a long bio refuses to shrink and pushes the actions off the
   right edge of the phone. A flex item defaults to min-width:auto. */
.pubp-id { flex: 1 1 auto; min-width: 0; }

.pubp-name {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-display, inherit);
  font-size: clamp(1.25rem, 3.6vw, 1.6rem); font-weight: 800;
  color: var(--text, #1a1a2e); margin: 0 0 2px;
}
.pubp-badge-check { color: var(--primary-ink, #00838f); font-size: .9rem; }
.pubp-badge-pro {
  background: #f59e0b; color: #fff; font-size: .6rem; font-weight: 800;
  padding: 2px 7px; border-radius: 50px; letter-spacing: .04em;
}

.pubp-handle {
  font-size: .86rem; color: var(--text-muted, #6b7280); margin: 0 0 8px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pubp-followsyou {
  background: var(--surface-alt, #f4f6f9); color: var(--text-muted, #6b7280);
  border: 1px solid var(--border, #e5e7eb);
  font-size: .66rem; font-weight: 700; padding: 2px 8px; border-radius: 50px;
}

.pubp-bio {
  font-size: .9rem; line-height: 1.55; color: var(--text, #1a1a2e);
  margin: 0 0 10px; overflow-wrap: break-word;
}

.pubp-facts {
  display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0;
  font-size: .78rem; color: var(--text-muted, #6b7280);
}
.pubp-facts i { margin-right: 4px; opacity: .8; }

.pubp-actions { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.pubp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 16px; border-radius: 50px; white-space: nowrap;
  border: 1.5px solid var(--border, #e5e7eb); background: var(--surface, #fff);
  color: var(--text, #1a1a2e); font-size: .8rem; font-weight: 700;
  text-decoration: none; cursor: pointer; font-family: inherit;
  transition: border-color .15s, background .15s;
}
.pubp-btn:hover { border-color: var(--primary, #00bcd4); }
.pubp-btn-primary {
  background: var(--primary, #00bcd4); border-color: var(--primary, #00bcd4); color: #fff;
}
.pubp-btn-primary:hover { filter: brightness(.94); }
/* The shared pill from app.css, widened to line up with the buttons above it. */
.pubp-follow { justify-content: center; padding: 8px 16px; font-size: .8rem; }

/* ── The four numbers ────────────────────────────────────────────────────── */

.pubp-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border, #e5e7eb);
  background: var(--surface-alt, #f4f6f9);
}
.pubp-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 12px 6px; border: 0; background: none; font-family: inherit;
  border-right: 1px solid var(--border, #e5e7eb);
}
.pubp-stat:last-child { border-right: 0; }
.pubp-stat b { font-size: 1.05rem; font-weight: 800; color: var(--text, #1a1a2e); }
.pubp-stat span {
  font-size: .72rem; color: var(--text-muted, #6b7280);
  display: inline-flex; align-items: center; gap: 4px;
}
.pubp-stat-btn { cursor: pointer; transition: background .15s; }
.pubp-stat-btn:hover { background: var(--surface, #fff); }
.pubp-stat-btn:hover b { color: var(--primary-ink, #00838f); }
.pubp-stat.is-locked { cursor: default; }
.pubp-stat.is-locked i { font-size: .62rem; opacity: .7; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */

.pubp-tabs { display: flex; gap: 6px; margin: 22px 0 16px; }
.pubp-tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: 50px; text-decoration: none;
  font-size: .84rem; font-weight: 700;
  color: var(--text-muted, #6b7280);
  border: 1.5px solid transparent;
}
.pubp-tab:hover { background: var(--surface-alt, #f4f6f9); }
.pubp-tab.active {
  background: var(--surface, #fff); color: var(--primary-ink, #00838f);
  border-color: var(--border, #e5e7eb);
}
.pubp-tab-n {
  background: var(--surface-alt, #f4f6f9); color: var(--text-muted, #6b7280);
  font-size: .68rem; font-weight: 800; padding: 1px 7px; border-radius: 50px;
}

/* ── Projects ────────────────────────────────────────────────────────────── */

.pubp-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.pubp-card {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; text-decoration: none; transition: border-color .15s, transform .15s;
}
.pubp-card:hover { border-color: var(--primary, #00bcd4); transform: translateY(-2px); }
.pubp-card-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--surface-alt, #f4f6f9); color: var(--primary-ink, #00838f);
}
.pubp-card-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pubp-card-body strong {
  font-size: .88rem; color: var(--text, #1a1a2e);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pubp-card-body small { font-size: .72rem; color: var(--text-muted, #6b7280); }

/* ── Posts ───────────────────────────────────────────────────────────────── */

.pubp-posts { display: flex; flex-direction: column; gap: 12px; }
.pubp-post {
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 14px 16px;
}
.pubp-post-proj {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 8px;
  font-size: .82rem; font-weight: 700; text-decoration: none;
  color: var(--primary-ink, #00838f);
}
.pubp-post-text {
  font-size: .88rem; line-height: 1.55; color: var(--text, #1a1a2e);
  margin: 0 0 10px; overflow-wrap: anywhere;
}
.pubp-post-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  font-size: .75rem; color: var(--text-muted, #6b7280);
}
.pubp-post-foot a {
  margin-left: auto; text-decoration: none; font-weight: 700;
  color: var(--primary-ink, #00838f);
}

.pubp-empty {
  grid-column: 1 / -1; text-align: center; padding: 36px 20px;
  background: var(--surface, #fff); border: 1px dashed var(--border, #e5e7eb);
  border-radius: 12px; color: var(--text-muted, #6b7280); font-size: .88rem;
}
.pubp-empty i { display: block; font-size: 1.6rem; margin-bottom: 10px; opacity: .5; }

.pubp-private {
  margin-top: 22px; text-align: center; padding: 44px 24px;
  background: var(--surface, #fff); border: 1px solid var(--border, #e5e7eb);
  border-radius: 16px;
}
.pubp-private i { font-size: 1.9rem; color: var(--text-muted, #6b7280); opacity: .55; }
.pubp-private h2 {
  font-size: 1.1rem; font-weight: 800; margin: 12px 0 6px; color: var(--text, #1a1a2e);
}
.pubp-private p {
  font-size: .88rem; color: var(--text-muted, #6b7280); margin: 0 auto; max-width: 420px;
}

/* ═══ The follower list ═══════════════════════════════════════════════════ */

#followList {
  position: fixed; inset: 0; z-index: 9400; display: none;
  background: rgba(8, 12, 18, .6);
  align-items: center; justify-content: center; padding: 20px;
}
#followList.open { display: flex; }

.fl-panel {
  width: 100%; max-width: 420px; max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--surface, #fff); border-radius: 16px; overflow: hidden;
  border: 1px solid var(--border, #e5e7eb);
}
.fl-head {
  display: flex; align-items: center; border-bottom: 1px solid var(--border, #e5e7eb);
}
.fl-tab {
  flex: 1 1 0; min-width: 0; padding: 14px 8px;
  border: 0; background: none; cursor: pointer; font-family: inherit;
  font-size: .84rem; font-weight: 700; color: var(--text-muted, #6b7280);
  border-bottom: 2px solid transparent;
}
.fl-tab.active { color: var(--primary-ink, #00838f); border-bottom-color: var(--primary, #00bcd4); }
.fl-close {
  flex: 0 0 auto; width: 44px; border: 0; background: none; cursor: pointer;
  font-size: 1.5rem; line-height: 1; color: var(--text-muted, #6b7280);
}

.fl-body { overflow-y: auto; padding: 6px 0; }
.fl-msg {
  text-align: center; padding: 34px 20px; margin: 0;
  font-size: .86rem; color: var(--text-muted, #6b7280);
}
.fl-msg i { margin-right: 6px; }

.fl-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px;
}
.fl-who {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 auto; min-width: 0; text-decoration: none;
}
.fl-ava {
  position: relative; flex: 0 0 auto; width: 40px; height: 40px;
  border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: .95rem;
}
.fl-ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fl-text { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.fl-text strong {
  font-size: .85rem; color: var(--text, #1a1a2e);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.fl-text small {
  flex: 1 0 100%; font-size: .73rem; color: var(--text-muted, #6b7280);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fl-check { color: var(--primary-ink, #00838f); font-size: .72rem; }
.fl-pro {
  background: #f59e0b; color: #fff; font-size: .56rem; font-weight: 800;
  padding: 1px 6px; border-radius: 50px;
}

/* ── THINGS A FINGER HAS TO HIT ──────────────────────────────────────────────
   The width clause is deliberate and must stay. Headless Chrome reports
   pointer: fine, so a rule written on the pointer alone cannot be tested at
   all, and an untestable rule is one that quietly stops being true. */
@media (max-width: 900px) and (pointer: coarse), (max-width: 640px) {
  .pubp-btn,
  .pubp-tab,
  .fl-tab,
  .fl-close    { min-height: 44px; }
  .pubp-stat   { min-height: 56px; }
  .pubp-card   { min-height: 56px; }
  .pubp-post-foot a { min-height: 44px; display: inline-flex; align-items: center; }
}

/* ── Phones ──────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .pubp { padding: 16px 14px 48px; }
  .pubp-head-inner { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
  .pubp-id { width: 100%; }
  .pubp-name, .pubp-handle, .pubp-facts { justify-content: center; }
  .pubp-actions { flex-direction: row; width: 100%; }
  .pubp-actions > * { flex: 1 1 0; min-width: 0; }
  .pubp-ava { width: 76px; height: 76px; }
  .pubp-ava-inner { font-size: 1.7rem; }
  .fl-panel { max-height: 84vh; }
}

/* Somebody who has asked their system to stop animation gets none of this.
   Duration rather than `animation: none`, which can leave a thing frozen on
   its first frame instead of its last. */
@media (prefers-reduced-motion: reduce) {
  .pubp-card { transition-duration: .01ms; }
}

/* Five numbers instead of four, on your own profile only, where Friends is
   added. The grid is fixed rather than auto-fit so the cells stay equal and
   the dividers between them line up. */
.pubp-stats.has-friends { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 420px) {
  /* Five cells at 360px leaves about 68 each, which "Followers" fits only by
     dropping a size. Below that the row wraps instead of squeezing. */
  .pubp-stats.has-friends { grid-template-columns: repeat(3, 1fr); }
  .pubp-stats.has-friends .pubp-stat:nth-child(3n) { border-right: 0; }
  .pubp-stats.has-friends .pubp-stat:nth-child(-n+3) { border-bottom: 1px solid var(--border, #e5e7eb); }
}

/* Three tabs in the follower panel now, not two. Each is flex:1 so they share
   the width, and the labels are short enough to survive it at 320px. */
.fl-tab { font-size: .8rem; padding-left: 4px; padding-right: 4px; }
@media (max-width: 380px) { .fl-tab { font-size: .72rem; } }
