/* ===========================================================================
   profile.css — a profile by its link (/?u=<publicId>), the owner's editor,
   and Home's Following row (profile.js).

   The page wears Home's clothes (`.home` for its tokens, the binder covers
   and the shelf tiles as Home and Shelves draw them) on a narrower measure,
   under a header of its own: the badge, the name, the few lines, and Follow.
   =========================================================================== */

.view-profile {
  height: calc(100vh - 52px - var(--pfbar-h, 0px));
  height: calc(100dvh - 52px - var(--pfbar-h, 0px));
  overflow-y: auto; overflow-x: hidden;
  background:
    radial-gradient(1000px 380px at 18% -160px, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(820px 360px at 90% -120px, color-mix(in srgb, var(--gold) 7%, transparent), transparent 72%),
    var(--bg);
}

.pf {
  --measure: 1080px;
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(20px, 4vw, 44px) var(--gut) calc(40px + env(safe-area-inset-bottom, 0px));
}

/* ------------------------------------------------------------- the badge */

.pf-avatar {
  --pf-hue: 210;
  display: grid; place-items: center; flex: none;
  width: 84px; height: 84px; border-radius: 26px;
  font-size: 30px; font-weight: 750; letter-spacing: -0.02em;
  color: #fff;
  background:
    radial-gradient(120% 90% at 20% 10%, hsl(var(--pf-hue) 70% 66% / .9), transparent 60%),
    linear-gradient(145deg, hsl(var(--pf-hue) 58% 46%), hsl(calc(var(--pf-hue) + 40) 52% 30%));
  box-shadow: 0 14px 30px -14px hsl(var(--pf-hue) 60% 30% / .8), inset 0 1px 0 rgba(255,255,255,.25);
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.pf-avatar.is-sm { width: 42px; height: 42px; border-radius: 13px; font-size: 15px; box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.pf-avatar.is-md { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }
/* A photo covers the initials (they stay beneath, for a photo that will not load). */
.pf-avatar { position: relative; overflow: hidden; }
.pf-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-avatar.has-photo { background: var(--bg-3); }
.pf-avatar.skeleton { background: none; box-shadow: none; }

/* ------------------------------------------------------------- the header */

.pf-hero {
  display: flex; align-items: flex-start; gap: 20px;
  padding: 22px;
  border-radius: calc(var(--radius) + 6px);
  background: var(--home-glass);
  border: 1px solid var(--home-glass-line);
  box-shadow: var(--glass-edge);
}
.pf-id { flex: 1; min-width: 0; }
.pf-name {
  margin: 2px 0 0;
  font-size: clamp(24px, 3.2vw, 32px); font-weight: 750; letter-spacing: -0.025em; line-height: 1.12;
  overflow-wrap: anywhere;
}
.pf-bio {
  margin: 8px 0 0; max-width: 62ch;
  color: var(--ink-2); font-size: 14.5px; line-height: 1.5;
  white-space: pre-line; overflow-wrap: anywhere;
}
.pf-counts { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
.pf-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; flex: none; }

/* Following, and Unfollow under the pointer. */
.pf-follow { min-width: 108px; justify-content: center; }
.pf-follow.is-following { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); color: var(--accent-text); }
.pf-follow-off { display: none; }
@media (hover: hover) {
  .pf-follow.is-following:hover { border-color: var(--danger, #e5484d); color: var(--danger, #e5484d); }
  .pf-follow.is-following:hover .pf-follow-on { display: none; }
  .pf-follow.is-following:hover .pf-follow-off { display: inline; }
}

/* ------------------------------------------------------------- the sections */

.pf-sec { margin-top: 34px; }
.pf-h2 { margin: 0 0 14px; font-size: 17px; font-weight: 700; letter-spacing: -0.015em; }

.pf-binders {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 26px 20px;
}
.pf-binders .home-bc { width: auto; }

.pf-empty, .pf-foot p { color: var(--ink-3); font-size: 13.5px; }
.pf-empty { margin: 34px 0 0; text-align: center; }
.pf-foot { margin-top: 40px; text-align: center; }

.pf-missing { max-width: 460px; margin: 12vh auto 0; text-align: center; }
.pf-missing h1 { font-size: 24px; letter-spacing: -0.02em; margin: 0 0 8px; }
.pf-missing p { color: var(--ink-2); margin: 0 0 18px; }

/* ------------------------------------------------------------- Home's row */

.pf-following {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px;
}
.pf-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: var(--radius); text-decoration: none; color: var(--ink);
  background: var(--home-glass);
  border: 1px solid var(--home-glass-line);
  transition: border-color var(--t-1) var(--ease-out), transform var(--t-1) var(--ease-out);
}
.pf-card:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
:root[data-motion="full"] .pf-card:hover { transform: translateY(-1px); }
.pf-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.pf-card-text { display: flex; flex-direction: column; min-width: 0; }
.pf-card-name, .pf-card-meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-card-name { font-size: 14px; }
.pf-card-meta { font-size: 12.5px; color: var(--ink-3); }

/* ------------------------------------------------------------- the editor */

/* 100%: the backdrop's own padding already keeps it off the edges (wider, it sat off-centre). */
.modal.modal-profile { width: min(560px, 100%); }
.pf-edit .form-row label { display: flex; justify-content: space-between; align-items: baseline; }
.pf-photo { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pf-photo-tools { min-width: 0; }
.pf-photo-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-photo .form-help { margin: 6px 0 0; }
.pf-left { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.pf-bio-input { resize: vertical; min-height: 72px; font: inherit; line-height: 1.45; }
.pf-edit .set-label { margin: 18px 0 6px; font-size: 13px; }

.pf-pick {
  list-style: none; margin: 8px 0 0; padding: 4px;
  max-height: 260px; overflow-y: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-2);
}
.pf-pick-row { display: flex; align-items: center; gap: 6px; border-radius: 8px; }
.pf-pick-row.is-on { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.pf-pick-main { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 8px; cursor: pointer; }
.pf-pick-main input { flex: none; accent-color: var(--accent); width: 16px; height: 16px; }
.pf-pick-kind {
  flex: none; font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); width: 44px;
}
.pf-pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-pick-order { display: flex; gap: 2px; padding-right: 4px; flex: none; }
.pf-move { width: 30px; height: 30px; padding: 0; justify-content: center; }
@media (pointer: coarse) {
  .pf-pick-order { gap: 6px; }
  .pf-move { width: 40px; height: 40px; }
}

.pf-link .form-help { margin: 8px 0 0; }
.pf-link-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pf-link-confirm {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 10px; padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger, #e5484d) 45%, var(--line));
  background: color-mix(in srgb, var(--danger, #e5484d) 8%, transparent);
}
.pf-link-confirm[hidden] { display: none; }
.pf-link-confirm p { flex: 1 1 100%; margin: 0; font-size: 13px; }

/* The account dialog's way here: a button dressed as the admin row. */
button.acct-profile { width: 100%; margin-top: 8px; font: inherit; text-align: left; cursor: pointer; }
.acct-admin + button.acct-profile { margin-top: 10px; }
.modal-body > button.acct-profile:first-child { margin-top: 0; }
.acct-profile + .set-label { margin-top: 18px; }

/* ------------------------------------------------------------- phones */

@media (max-width: 640px) {
  .pf-hero { flex-wrap: wrap; gap: 14px; padding: 16px; }
  .pf-avatar { width: 64px; height: 64px; border-radius: 20px; font-size: 24px; }
  .pf-id { flex-basis: calc(100% - 80px); }
  .pf-actions { flex-basis: 100%; justify-content: stretch; }
  .pf-actions .btn { flex: 1; justify-content: center; }
  .pf-binders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 16px; }
  .pf-sec { margin-top: 26px; }
  /* The dialog scrolls as a whole: no second scroller inside it, and names get the room. */
  .pf-pick { max-height: none; overflow: visible; }
  .pf-pick .lib-tag { display: none; }
}

/* ---- what is new since the follower last looked */
.pf-binders > li, .pf .shv-grid-cell { position: relative; }
.pf-updated {
  position: absolute; z-index: 4; top: -6px; left: -6px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 750; letter-spacing: .02em;
  color: var(--accent-ink); background: var(--accent-fill, var(--accent));
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.pf-card-new {
  flex: none; margin-left: auto;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap;
  color: var(--accent-text); background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

/* ---- want and trade lists */
.pf-h2-count {
  margin-left: 8px; padding: 1px 8px; border-radius: 999px; vertical-align: 2px;
  font-size: 12px; font-weight: 650; color: var(--ink-3); background: var(--bg-3);
}
.pf-match {
  margin: 22px 0 0; padding: 12px 14px; border-radius: var(--radius);
  font-size: 14px; color: var(--ink);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 38%, var(--line));
}
.pf-cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 16px 12px;
}
.pf-lc { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pf-lc-art {
  display: block; aspect-ratio: var(--card-ratio, .714); border-radius: 6px; overflow: hidden;
  background: var(--bg-3); box-shadow: 0 6px 14px rgba(0, 0, 0, .35);
}
.pf-lc-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pf-lc.is-match .pf-lc-art { box-shadow: 0 0 0 2px var(--gold), 0 6px 14px rgba(0, 0, 0, .35); }
.pf-lc-name { font-size: 12.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-lc-meta { display: flex; flex-wrap: wrap; gap: 4px; font-size: 11.5px; color: var(--ink-3); }
.pf-lc-label { padding: 0 6px; border-radius: 4px; background: var(--bg-3); color: var(--ink-2); font-weight: 650; }
.pf-lc-mark {
  align-self: flex-start;
  padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  font-size: 11px; font-weight: 700; color: #1d1405; background: var(--gold);
}
.pf-lc .pf-lc-mark { position: absolute; top: 6px; left: 6px; }
.pf-items { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pf-li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border-radius: var(--radius); background: var(--home-glass); border: 1px solid var(--home-glass-line);
}
.pf-li.is-match { border-color: color-mix(in srgb, var(--gold) 55%, var(--line)); }
.pf-li-thumb { flex: none; width: 40px; height: 40px; border-radius: 8px; object-fit: cover; background: var(--bg-3); }
.pf-li-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.pf-li-text b, .pf-li-text span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-li-text b { font-size: 13.5px; }
.pf-li-text span { font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) {
  .pf-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 10px; }
}

/* the editor's list switches */
.pf-switch { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.pf-switch input { flex: none; width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); }
.pf-switch > span { display: flex; flex-direction: column; gap: 2px; }
.pf-switch b { font-size: 13.5px; }
.pf-switch > span > span { font-size: 12px; color: var(--ink-3); line-height: 1.4; }

/* A profile's Spaces (profile.js spaceTile): the room's picture, its name and rank; it opens to visit. */
.pf-spaces { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 14px; }
.pf-spaces > li { position: relative; }
.pf-space {
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden; text-decoration: none; color: var(--ink);
  background: var(--glass); border: 1px solid var(--line-soft); box-shadow: var(--glass-edge), var(--shadow-1);
  transition: transform var(--t-2) var(--ease-out), box-shadow var(--t-2) var(--ease-out);
}
.pf-space:hover { transform: translateY(-3px); box-shadow: var(--glass-edge), var(--shadow-2); }
.pf-space-pic { display: block; aspect-ratio: 16 / 10; background: #0b0d14; }
.pf-space-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pf-space-blank { display: block; height: 100%; background: radial-gradient(80% 70% at 50% 40%, #243052, #0b0d14); }
.pf-space-body { display: grid; gap: 3px; padding: 12px 14px 14px; }
.pf-space-body strong { font-size: 15.5px; font-weight: 720; letter-spacing: -0.015em; }
.pf-space-meta { font-size: var(--fs-sm); color: var(--ink-3); }
.pf-space-stars { color: #f5c542; letter-spacing: 1px; margin-right: 6px; }
