/*
 * Member profile page (users#show).
 *
 * Shares its tokens (--cm-*), page wrapper (.cm-page / .cm-container) and the
 * community handoff's rules with community.css:
 *   - No shadows anywhere. Elevation is border + background only.
 *   - No transitions. Hover states change instantly.
 *   - Secondary text is #666666 so it clears WCAG AA on the cream ground.
 * Values below are the design handoff's, px for px.
 */

/* Tokens (--pf-*) and the listing card are in listing_card.css. */

.pf-page ::selection { background: var(--cm-blue-light); }

.pf-page a { text-decoration: none; }

/* --------------------------------------------------------------- sponsored */

/* main supplies the handoff's 20px under the header. */
.pf-sponsored { padding-top: 0; }

/* ------------------------------------------------------------ profile card */

.pf-card {
  margin-top: 16px;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  border-radius: 14px;
  /* Not overflow:hidden — the ⋯ menu has to be able to hang outside the card. */
}

/* Stands in for overflow:hidden on the bottom band's corners. */
.pf-card > :last-child { border-radius: 0 0 13px 13px; }

.pf-identity {
  padding: 20px 20px 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px 20px;
  align-items: flex-start;
}

.cm-avatar.pf-avatar { border-radius: 14px; }

/* The photo opens large (users/profile/_card): a plain button around it, and
   a native popover centered over a dark backdrop. */
.pf-avatar-open {
  display: block;
  flex: none;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 14px;
  cursor: zoom-in;
}

.pf-avatar-open > .cm-avatar { display: block; }

.pf-avatar-open:focus-visible {
  outline: 2px solid var(--cm-blue);
  outline-offset: 3px;
}

/* Popovers center themselves with margin: auto, which Tailwind's reset zeroes. */
.pf-photo {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  overflow: visible;
  max-width: min(600px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
}

.pf-photo::backdrop { background: rgba(20, 20, 20, 0.8); }

.pf-photo__img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 32px);
  width: auto;
  height: auto;
  border-radius: 16px;
  object-fit: contain;
}

.pf-photo__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 0;
  background: rgba(20, 20, 20, 0.6);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pf-photo__close:hover { background: rgba(20, 20, 20, 0.85); }

.pf-info {
  flex: 1 1 300px;
  min-width: 0;
}

.pf-namerow {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.pf-name {
  margin: 0;
  font-size: clamp(24px, 3.6vw, 30px);
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1.1;
  color: var(--cm-ink);
  min-width: 0;
  overflow-wrap: break-word;
}

/* Colours come from User#seller_reputation, inline, so each tier keeps its own. */
.pf-rep {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
}

.pf-rep:hover span:last-child { text-decoration: underline; text-underline-offset: 2px; }

.pf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-top: 7px;
  font-size: 13px;
  color: var(--cm-ink-muted);
}

.pf-meta__place {
  display: flex;
  align-items: center;
  gap: 5px;
}

.pf-meta__link {
  font-weight: 600;
  color: var(--cm-link);
}

.pf-meta__link:hover { color: var(--pf-link-hover); }

.pf-bio {
  margin: 12px 0 0;
  max-width: 62ch;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--cm-ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.pf-actions {
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pf-follow-wrap { display: contents; }

.pf-follow {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--cm-surface);
  border: 1.5px solid var(--cm-ink);
  font-size: 14px;
  font-weight: 700;
  color: var(--cm-ink);
  text-align: left;
  cursor: pointer;
}

.pf-follow--on {
  background: var(--cm-ground);
  border-color: var(--cm-border);
  font-weight: 600;
  color: var(--cm-ink-muted);
}

/* ------------------------------------------------------------------ ⋯ menu */

.pf-menu { position: relative; }

.pf-menu__button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--cm-surface);
  border: 1.5px solid var(--cm-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.pf-menu__button:hover { border-color: var(--cm-ink); }

.pf-menu__list {
  position: absolute;
  right: 0;
  top: 46px;
  z-index: 20;
  min-width: 170px;
  background: var(--cm-surface);
  border: 2px solid var(--cm-ink);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pf-menu__list[hidden] { display: none; }

/* On a phone the actions wrap under the name, flush left, so a right-anchored
   menu would hang off the screen. */
@media (max-width: 639px) {
  .pf-menu__list { right: auto; left: 0; }
}

.pf-menu__item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cm-ink);
  cursor: pointer;
  white-space: nowrap;
}

.pf-menu__item:hover { background: var(--cm-ground); color: var(--cm-ink); }

.pf-menu__item--danger { color: var(--pf-danger); }
.pf-menu__item--danger:hover { background: var(--pf-danger-soft); color: var(--pf-danger); }

/* ---------------------------------------------------------------- stat row */

/* Four across, or two by two on a phone. Fixed column counts rather than the
   handoff's auto-fit: auto-fit can leave a row of three over a row of one, and the
   dividers can't tell which cell starts a row. */
.pf-stats {
  border-top: 1px solid var(--cm-divider);
  background: var(--pf-surface-warm);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.pf-stat {
  display: block;
  padding: 14px 20px;
  color: inherit;
  min-width: 0;
}

.pf-stat + .pf-stat { border-left: 1px solid var(--cm-divider); }

@media (max-width: 639px) {
  .pf-stats { grid-template-columns: repeat(2, 1fr); }
  .pf-stat:nth-child(3) { border-left: 0; }
  .pf-stat:nth-child(n + 3) { border-top: 1px solid var(--cm-divider); }
}

.pf-stat__value {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  line-height: 1;
  color: var(--cm-ink);
}

.pf-stat__label {
  display: block;
  margin-top: 6px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--cm-ink-muted);
}

/* ------------------------------------------------------------- trust strip */

.pf-trust {
  border-top: 1px solid var(--cm-divider);
  padding: 11px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--cm-ink-muted);
}

.pf-trust__item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pf-trust__spacer { flex: 1; }

.pf-trust__admin {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.pf-trust__state {
  font-weight: 600;
  color: var(--cm-ink);
}

.pf-trust__warn { color: var(--pf-danger); font-weight: 600; }

.pf-textbutton {
  background: none;
  border: 0;
  padding: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--cm-link);
  cursor: pointer;
  text-align: left;
}

.pf-textbutton:hover { color: var(--pf-link-hover); }

/* ------------------------------------------------------------------ panels */

.pf-panel {
  margin-top: 16px;
  border-radius: 14px;
  padding: 18px;
}

.pf-panel--listings {
  background: var(--cm-band-warm);
  border: 1px solid var(--cm-border-band);
}

.pf-panel--reviews {
  background: var(--cm-surface);
  border: 1px solid var(--cm-border);
  scroll-margin-top: 150px;
}

#listings { scroll-margin-top: 150px; }

.pf-panel__title {
  margin: 0;
  flex: 1;
  min-width: 160px;
  font-size: 19px;
  font-weight: 700;
  color: var(--cm-ink);
}

.pf-divider { height: 1px; margin: 16px 0; background: var(--cm-divider); }
.pf-divider--band { background: var(--cm-border-band); }

.pf-showmore {
  width: 100%;
  margin-top: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--cm-surface);
  border: 1px solid var(--cm-border-band);
  font-size: 13px;
  font-weight: 700;
  color: var(--cm-ink);
  text-align: left;
  cursor: pointer;
}

.pf-showmore:hover { background: var(--cm-blue-light); }
.pf-showmore:disabled { cursor: progress; }
.pf-showmore--reviews { border-color: var(--cm-border); }

/* ----------------------------------------------------------------- reviews */

.pf-reviews__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.pf-starchip {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  background: var(--cm-yellow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pf-reviews__summary {
  font-size: 13px;
  font-weight: 700;
  color: var(--cm-ink);
}

.pf-reviews {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 10px;
}

.pf-review {
  border: 1px solid var(--cm-border);
  border-radius: 12px;
  padding: 14px;
  background: var(--pf-surface-warm);
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.pf-review[hidden] { display: none; }

.pf-review__top {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pf-review__avatar { display: flex; flex: none; }

.pf-review__who {
  flex: 1;
  min-width: 0;
}

.pf-review__name {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--cm-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-page .pf-review__name:hover { color: var(--cm-link); }

.pf-review__age {
  display: block;
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--cm-ink-muted);
}

.pf-review__stars {
  display: flex;
  gap: 1px;
  flex: none;
}

.pf-review__text {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--cm-ink);
  text-wrap: pretty;
  overflow-wrap: break-word;
}

.pf-review__item {
  margin: auto 0 0;
  font-size: 12px;
  color: var(--cm-ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pf-review__item a { font-weight: 600; color: var(--cm-link); }
.pf-review__item a:hover { color: var(--pf-link-hover); }
