/* ============================================================
   Astra Origins — Individual member profile · page styles
   Shared shell lives in cosmos.css. Loaded globally in master so
   author-click pane swaps stay styled.
   ============================================================ */

.t-tn.is-on { background: oklch(from var(--accent) l c h / 0.18); color: var(--accent); }

/* ── Back arrow ───────────────────────────────────────── */
.pf-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-weight: 800; color: var(--ink-2);
  letter-spacing: 0.1em;
  padding: 4px 8px; border-radius: 6px;
  margin-bottom: 12px;
  text-decoration: none;
  cursor: pointer;
}
.pf-back:hover { background: var(--surface-2); color: var(--ink); }

/* ── Profile banner ───────────────────────────────────── */
/* overflow is visible so the Share popover can escape the banner box;
   the cover + stats round their own corners to keep the card shape. */
.pf-banner { position: relative; overflow: visible; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 16px; background: var(--surface); }
.pf-cover { position: relative; height: 150px; overflow: hidden; border-radius: 14px 14px 0 0;
  background: radial-gradient(ellipse at 80% 20%, oklch(0.42 0.16 290 / 0.85), transparent 55%), radial-gradient(ellipse at 15% 90%, oklch(0.4 0.16 220 / 0.8), transparent 55%), linear-gradient(135deg, oklch(0.16 0.06 265), oklch(0.07 0.03 250)); }
.pf-cover-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }
.pf-cover-stars { position: absolute; inset: 0; z-index: 2;
  background-image: radial-gradient(1px 1px at 12% 26%, white 50%, transparent 51%), radial-gradient(1.5px 1.5px at 30% 60%, white 50%, transparent 51%), radial-gradient(1px 1px at 48% 30%, white 50%, transparent 51%), radial-gradient(2px 2px at 68% 54%, white 50%, transparent 51%), radial-gradient(1px 1px at 84% 28%, white 50%, transparent 51%), radial-gradient(1.5px 1.5px at 92% 72%, white 50%, transparent 51%); opacity: 0.6; }
.pf-cover-img ~ .pf-cover-stars, .pf-cover-img ~ .pf-cover-aurora, .pf-cover-img ~ .pf-cover-orbit { opacity: 0.25; }
.pf-cover-aurora { position: absolute; inset: 0; z-index: 2; background: linear-gradient(115deg, transparent 30%, oklch(0.7 0.2 160 / 0.18) 45%, oklch(0.6 0.2 280 / 0.18) 60%, transparent 75%); filter: blur(8px); }
.pf-cover-orbit { position: absolute; right: 8%; top: 50%; transform: translateY(-50%); z-index: 2; width: 180px; height: 180px; border-radius: 50%; border: 1px dashed oklch(0.8 0.05 250 / 0.25); }
.pf-cover-orbit::after { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%; background: oklch(0.85 0.14 80); box-shadow: 0 0 10px oklch(0.85 0.14 80); }
/* ── Image action dropdowns (view / upload) ───────────── */
.pf-image-actions { position: relative; }

.pf-cover-actions { position: absolute; top: 12px; right: 12px; z-index: 8; }
.pf-cover-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px;
  background: oklch(0.12 0.02 265 / 0.6);
  color: #fff;
  font-size: 9px; font-weight: 800; letter-spacing: 0.1em;
  border: 1px solid oklch(1 0 0 / 0.2);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.pf-cover-trigger:hover { background: oklch(0.12 0.02 265 / 0.85); }
.pf-cover-trigger .bi { font-size: 12px; }
.pf-image-chev { font-size: 8px !important; opacity: 0.85; }

.pf-avatar-trigger.is-uploading, .pf-cover-trigger.is-uploading { opacity: 0.65; cursor: wait; }
.pf-avatar-trigger.is-uploading .bi, .pf-cover-trigger.is-uploading .bi { animation: pf-spin 0.8s linear infinite; }

.pf-image-menu {
  position: absolute;
  top: calc(100% + 6px); right: 0;
  min-width: 200px;
  list-style: none; padding: 4px; margin: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px oklch(0 0 0 / 0.18);
  z-index: 30;
}
.pf-image-menu-profile { right: auto; left: 0; min-width: 210px; }
.pf-image-menu li { list-style: none; }
.pf-image-menu button {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 10px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  font-size: 12px; font-weight: 600;
  color: var(--ink-2);
  text-align: left;
}
.pf-image-menu button:hover { background: var(--surface-2); color: var(--ink); }
.pf-image-menu button .bi { font-size: 13px; color: var(--ink-3); }
.pf-image-menu button:hover .bi { color: var(--accent); }

.pf-id { display: flex; gap: 18px; padding: 0 22px; margin-top: -42px; position: relative; z-index: 3; }
.pf-avatar { position: relative; width: 104px; height: 104px; flex-shrink: 0; border-radius: 24px; display: grid; place-items: center; border: 4px solid var(--surface); box-shadow: 0 10px 28px oklch(0 0 0 / 0.25); overflow: hidden; }
.pf-avatar-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pf-avatar-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 32px; font-weight: 700; color: white; }
.pf-avatar-ring { position: absolute; inset: -8px; border-radius: 30px; border: 1px solid oklch(0.6 0.18 265 / 0.4); }
.pf-avatar-wrap { position: relative; flex-shrink: 0; align-self: flex-start; }
.pf-avatar-actions { position: absolute; right: -2px; bottom: -2px; z-index: 6; }
.pf-avatar-trigger {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: oklch(0.12 0.02 265 / 0.78);
  color: #fff;
  border: 1px solid oklch(1 0 0 / 0.25);
  cursor: pointer; font-size: 13px;
  box-shadow: 0 4px 12px oklch(0 0 0 / 0.18);
}
.pf-avatar-trigger:hover { background: var(--accent); }
.pf-id-main { padding-top: 48px; min-width: 0; }
.pf-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pf-name { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.pf-verified { font-size: 18px; }
.pf-tier { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; color: var(--accent); padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.pf-handle { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; margin-top: 5px; }
.pf-bio { font-size: 13px; line-height: 1.6; color: var(--ink-2); margin: 10px 0 12px; max-width: 64ch; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.pf-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 10px; font-weight: 800; letter-spacing: 0.1em; color: var(--ink-2); cursor: pointer; text-decoration: none; }
.pf-btn:hover { background: var(--surface-3); color: var(--ink); }
.pf-btn-primary { background: var(--accent); border-color: var(--accent); color: white; }
.pf-btn-primary:hover { background: oklch(from var(--accent) calc(l - 0.05) c h); color: white; }

.pf-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); background: var(--line); border-radius: 0 0 13px 13px; overflow: hidden; }
.pf-stat { background: var(--surface); padding: 14px 10px; text-align: center; }
.pf-stat-n { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.pf-stat-l { font-size: 8px; color: var(--ink-3); letter-spacing: 0.12em; margin-top: 3px; font-weight: 700; }

/* ── Section header ───────────────────────────────────── */
.pf-sh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.pf-sh-h { font-size: 15px; font-weight: 800; letter-spacing: -0.005em; }
.pf-sh-meta { font-size: 9px; color: var(--ink-3); letter-spacing: 0.14em; font-weight: 700; }

/* ── Progress bar (shared) ────────────────────────────── */
.pf-bar { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.pf-bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, oklch(0.55 0.18 265), oklch(0.65 0.18 200)); }

/* ── Explorer rank ────────────────────────────────────── */
.pf-rank { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.pf-rank-badge { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; color: white; font-size: 26px; background: linear-gradient(135deg, oklch(0.55 0.18 265), oklch(0.3 0.12 255)); }
.pf-rank-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pf-rank-title { font-size: 15px; font-weight: 800; }
.pf-rank-next { font-size: 9px; color: var(--ink-3); letter-spacing: 0.1em; }
.pf-rank-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pf-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; color: var(--ink-2); padding: 4px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.pf-chip .bi { font-size: 10px; color: var(--accent); }

/* ── Affinity ─────────────────────────────────────────── */
.pf-affinity { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.pf-aff-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.pf-aff-label { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.pf-aff-label .bi { color: var(--accent); }
.pf-aff-pct { font-size: 10px; color: var(--ink-3); font-weight: 700; }

/* ── About me (favorites grid) ────────────────────────── */
.pf-about { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pf-fact { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; transition: border-color 0.15s, transform 0.15s; }
.pf-fact:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.pf-fact-wide { grid-column: 1 / -1; }
.pf-fact-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; color: var(--accent); background: var(--accent-soft); }
.pf-fact-k { font-size: 8px; color: var(--ink-3); letter-spacing: 0.12em; font-weight: 700; }
.pf-fact-v { font-size: 14px; font-weight: 700; letter-spacing: -0.005em; margin-top: 3px; }

/* ── Logbook ──────────────────────────────────────────── */
.pf-log { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pf-log-item { display: grid; grid-template-columns: 38px 1fr; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.pf-log-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: white; font-size: 16px; }
.pf-log-title { font-size: 13px; color: var(--ink); }
.pf-log-title strong { font-weight: 800; }
.pf-log-meta { font-size: 8px; color: var(--ink-3); letter-spacing: 0.12em; margin-top: 3px; font-weight: 700; }

/* ── Content cross-section ────────────────────────────── */
.pf-ctabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.pf-ctab { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 11px; font-weight: 700; color: var(--ink-2); cursor: pointer; }
.pf-ctab .bi { font-size: 13px; }
.pf-ctab .ct { font-size: 9px; color: var(--ink-3); letter-spacing: 0.04em; }
.pf-ctab:hover { background: var(--surface-2); color: var(--ink); }
.pf-ctab.is-on { background: var(--ink); color: white; border-color: var(--ink); }
.pf-ctab.is-on .ct { color: oklch(0.78 0.005 240); }

/* Layout is applied per active tab (set by profile.js) so each tab matches
   its source section. Base is layout-neutral; the modifier classes below and
   the reused section grids (.ap-gallery.is-grid / .ev-grid / .ih-grid) own it. */
.pf-content { min-height: 60px; }
.pf-content.is-loading { opacity: 0.5; pointer-events: none; }

/* Social Feed tab — vertical stack like the main feed; cards at 70% width,
   left-aligned. */
.pf-lay-feed { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.pf-lay-feed > .f-post,
.pf-lay-feed > .f-post-skel { width: 70%; }
@media (max-width: 768px) { .pf-lay-feed > .f-post, .pf-lay-feed > .f-post-skel { width: 100%; } }

/* Mixed "All" tab — responsive grid; full-width feed posts span the row. */
.pf-lay-all { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: start; }
.pf-lay-all > .f-post { grid-column: 1 / -1; }

.pf-cc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.pf-cc:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: 0 10px 24px oklch(0 0 0 / 0.08); }
.pf-cc-thumb { position: relative; height: 96px; overflow: hidden; }
.pf-cc-stars { position: absolute; inset: 0; background-image: radial-gradient(1px 1px at 18% 30%, white 50%, transparent 51%), radial-gradient(1px 1px at 44% 62%, white 50%, transparent 51%), radial-gradient(1.5px 1.5px at 72% 38%, white 50%, transparent 51%), radial-gradient(1px 1px at 88% 70%, white 50%, transparent 51%); opacity: 0.6; }
.pf-cc-tag { position: absolute; top: 8px; left: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 5px; font-size: 8px; font-weight: 800; letter-spacing: 0.12em; color: white; background: oklch(0 0 0 / 0.5); backdrop-filter: blur(4px); padding: 3px 8px; border-radius: 5px; }
.pf-cc-tag .bi { font-size: 9px; }
.pf-cc-body { padding: 11px 13px; }
.pf-cc-title { font-size: 12.5px; font-weight: 700; line-height: 1.35; letter-spacing: -0.005em; }
.pf-cc-meta { font-size: 8px; color: var(--ink-3); letter-spacing: 0.1em; margin-top: 6px; font-weight: 700; }
.pf-cc[hidden] { display: none; }
.pf-empty { grid-column: 1 / -1; text-align: center; color: var(--ink-3); font-size: 11px; letter-spacing: 0.1em; padding: 30px 0; display: flex; align-items: center; justify-content: center; gap: 8px; }

.pf-content-loader { display: grid; place-items: center; padding: 14px 0; }
.pf-content-loader[hidden] { display: none; }
.pf-spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: pf-spin 0.8s linear infinite; }
@keyframes pf-spin { to { transform: rotate(360deg); } }

/* ── Badges ───────────────────────────────────────────── */
.pf-badges { display: grid; grid-template-columns: repeat(8, 1fr); gap: 10px; }
.pf-badge { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.pf-badge-ic { width: 100%; aspect-ratio: 1; max-width: 60px; border-radius: 16px; display: grid; place-items: center; color: white; font-size: 22px; box-shadow: 0 6px 16px oklch(0 0 0 / 0.12); background: linear-gradient(135deg, oklch(0.5 0.12 250), oklch(0.28 0.06 250)); }
.pf-badge-l { font-size: 7px; color: var(--ink-2); letter-spacing: 0.08em; font-weight: 800; }
.pf-badge-locked .pf-badge-ic { background: var(--surface-3); color: var(--ink-3); box-shadow: none; }
.pf-badge-locked .pf-badge-l { color: var(--ink-3); }

/* ── About Me empty state (owner only) ────────────────── */
.pf-about-empty { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; padding: 16px; border: 1px dashed var(--line); border-radius: 12px; color: var(--ink-2); font-size: 11px; letter-spacing: 0.04em; background: var(--surface-2); }
.pf-about-empty .bi { color: var(--accent); }
.pf-about-empty strong { color: var(--ink); }

/* ── Edit-profile modal ───────────────────────────────── */
.pf-edit-modal { position: fixed; inset: 0; z-index: 1085; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pf-edit-modal[hidden] { display: none; }
.pf-edit-backdrop { position: absolute; inset: 0; background: oklch(0.06 0.02 250 / 0.78); backdrop-filter: blur(6px); }
.pf-edit-dialog { position: relative; width: min(680px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 64px oklch(0 0 0 / 0.4); }
.pf-edit-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.pf-edit-title { margin: 0; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; color: var(--ink); }
.pf-edit-close { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); cursor: pointer; }
.pf-edit-close:hover { background: var(--accent-soft); color: var(--accent); }
.pf-edit-body { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 22px; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent; }
/* Custom scrollbar — edit-profile modal (WebKit/Chromium) */
.pf-edit-body::-webkit-scrollbar { width: 10px; }
.pf-edit-body::-webkit-scrollbar-track { background: transparent; margin: 8px 0; }
.pf-edit-body::-webkit-scrollbar-thumb { background: var(--surface-3); border: 3px solid var(--surface); border-radius: 999px; }
.pf-edit-body::-webkit-scrollbar-thumb:hover { background: var(--accent-line); }
.pf-edit-section { display: flex; flex-direction: column; gap: 12px; }
.pf-edit-sec-h { margin: 0; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; color: var(--ink-2); text-transform: uppercase; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pf-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pf-edit-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pf-edit-field-wide { grid-column: 1 / -1; }
.pf-edit-label { display: inline-flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 800; letter-spacing: 0.08em; color: var(--ink-2); }
.pf-edit-label .bi { color: var(--accent); font-size: 12px; }
.pf-edit-input { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-family: inherit; }
.pf-edit-input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.pf-edit-textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.pf-edit-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--surface); }
@media (max-width: 768px) { .pf-edit-grid { grid-template-columns: 1fr; } }

/* ── Image viewer (full-size, chromeless) ─────────────── */
.pf-img-viewer { position: fixed; inset: 0; z-index: 1080; display: flex; align-items: center; justify-content: center; padding: 24px; }
.pf-img-viewer[hidden] { display: none; }
.pf-img-viewer-backdrop { position: absolute; inset: 0; background: oklch(0.05 0.015 250 / 0.88); backdrop-filter: blur(8px); cursor: zoom-out; }
.pf-img-viewer-close { position: absolute; top: 18px; right: 18px; z-index: 2; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: oklch(0.12 0.02 265 / 0.6); border: 1px solid oklch(1 0 0 / 0.25); color: #fff; cursor: pointer; font-size: 17px; backdrop-filter: blur(6px); }
.pf-img-viewer-close:hover { background: oklch(0.12 0.02 265 / 0.92); }
.pf-img-viewer-stage { position: relative; z-index: 1; display: grid; place-items: center; max-width: 100%; max-height: 100%; }
.pf-img-viewer-stage img { max-width: 95vw; max-height: 92vh; object-fit: contain; display: block; border-radius: 8px; box-shadow: 0 24px 64px oklch(0 0 0 / 0.5); }
.pf-img-viewer-placeholder { color: oklch(0.85 0.005 240); font-size: 11px; letter-spacing: 0.18em; font-weight: 800; opacity: 0.7; }

/* ── Toast (upload feedback) ──────────────────────────── */
.pf-toast { position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 1090; padding: 12px 18px; border-radius: 8px; font-size: 10px; font-weight: 800; letter-spacing: 0.12em; background: var(--ink); color: white; box-shadow: 0 12px 32px oklch(0 0 0 / 0.2); pointer-events: none; }
.pf-toast[hidden] { display: none; }
.pf-toast.is-error { background: oklch(0.45 0.18 25); }
.pf-toast.is-success { background: oklch(0.5 0.16 145); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
  .pf-stats { grid-template-columns: repeat(3, 1fr); }
  .pf-affinity { grid-template-columns: 1fr; }
  .pf-badges { grid-template-columns: repeat(4, 1fr); }
  .pf-lay-all { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .pf-id { flex-direction: column; gap: 0; margin-top: -50px; }
  .pf-id-main { padding-top: 12px; }
  .pf-about { grid-template-columns: 1fr; }
  .pf-stats { grid-template-columns: repeat(2, 1fr); }
  .pf-rank { grid-template-columns: 1fr; text-align: center; }
  .pf-rank-badge { margin: 0 auto; }
  .pf-badges { grid-template-columns: repeat(3, 1fr); }
  .pf-name { font-size: 20px; }
  .pf-lay-all { grid-template-columns: 1fr; }
}
