/* AIBuy profile polish v1 (2026-11-05) — frontend-only overlay, scoped to .user-profile-page + tiny tools-card footer fix.
   Flat, aligned grid; no height animations; respects prefers-reduced-motion. */

/* ---------- Desktop / shared ---------- */
.user-profile-page .user-profile-topline { padding: 0 28px; }
.user-profile-page .user-profile-social-stats { gap: 18px; }
.user-profile-page .user-profile-social-stats > *,
.user-profile-page .user-profile-social-stats button { font-size: 13px; }

/* Cover + avatar stacking: cover fixed per breakpoint, avatar cleanly above cover */
.user-profile-page .user-profile-cover { z-index: 0; }
.user-profile-page .user-profile-hero-content { position: relative; z-index: 1; padding: 0 28px 20px; }
.user-profile-page .user-profile-identity-top { align-items: flex-start; }
.user-profile-page .user-profile-avatar { z-index: 2; background: var(--card); }
.user-profile-page .user-profile-actions { margin-top: 16px; gap: 8px; }
.user-profile-page .user-profile-heading { margin-top: 10px; }
.user-profile-page .user-profile-name-line { align-items: center; }
.user-profile-page .user-profile-source-note { margin-top: 0; }

/* Stats: one flat row, 4 equal columns, number above label, all left edges on the same grid */
.user-profile-page .user-profile-stats { margin-top: 18px; padding-top: 16px; column-gap: 12px; }
.user-profile-page .user-profile-stats button,
.user-profile-page .user-profile-stats button:first-child {
  flex-direction: column; align-items: flex-start; justify-content: flex-start;
  gap: 2px; padding: 0; min-width: 0;
}
.user-profile-page .user-profile-stats strong { font-size: 20px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.user-profile-page .user-profile-stats span { font-size: 12px; line-height: 1.4; white-space: nowrap; }

/* Post list: tighter, consistent rhythm, readable meta sizes, flat dividers */
.user-profile-page .user-profile-posts { border-top-width: 8px; }
.user-profile-page .user-profile-posts-heading { padding: 18px 28px 4px; }
.user-profile-page .user-profile-posts-heading h2 { font-size: 18px; line-height: 1.4; }
.user-profile-page .user-profile-posts-heading > span { font-size: 12px; }
.user-profile-page .user-profile-post { gap: 12px; padding: 18px 28px; box-shadow: none; }
.user-profile-page .user-profile-post-avatar { width: 40px; height: 40px; flex-basis: 40px; }
.user-profile-page .user-profile-post-author { gap: 4px 10px; line-height: 1.5; }
.user-profile-page .user-profile-post-author strong { font-size: 14px; }
.user-profile-page .user-profile-post-author time { font-size: 12px; font-variant-numeric: tabular-nums; }
.user-profile-page .user-profile-post-kind { margin: 4px 0 4px; font-size: 12px; }
.user-profile-page .user-profile-post-body h3 { font-size: 16px; line-height: 1.6; }
.user-profile-page .user-profile-post-body > p { -webkit-line-clamp: 4; margin-top: 4px; font-size: 14px; line-height: 1.75; }
.user-profile-page .user-profile-record-open { margin-top: 8px; font-size: 13px; }

/* Discovery aside: top edge aligned with main column, flat panels matching main */
.user-profile-page .user-profile-discovery { padding-top: var(--profile-header-height, 56px); }
.user-profile-page .user-profile-discovery-section { margin-bottom: 16px; padding: 20px 24px; border-radius: 0; box-shadow: none; }
.user-profile-page .user-profile-discovery-heading { gap: 10px; }
.user-profile-page .user-profile-discovery-heading h2 { font-size: 18px; line-height: 1.4; }
.user-profile-page .user-profile-recommendation { padding: 16px 0; }
.user-profile-page .user-profile-recommendation-type { margin-bottom: 6px; }
.user-profile-page .user-profile-recommendation-foot { margin-top: 8px; }
.user-profile-page .user-profile-suggestion { padding-top: 16px; }
.user-profile-page .user-profile-footer { gap: 8px 16px; margin: 8px 24px 0; font-size: 13px; }

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .user-profile-page .user-profile-topline { padding: 0 16px; }
  .user-profile-page .user-profile-hero-content { padding: 0 16px 16px; }
  .user-profile-page .user-profile-actions { margin-top: 12px; }
  .user-profile-page .user-profile-stats { margin-top: 14px; padding-top: 14px; column-gap: 8px; }
  .user-profile-page .user-profile-stats strong { font-size: 18px; }
  .user-profile-page .user-profile-stats span { font-size: 12px; }
  .user-profile-page .user-profile-posts-heading { padding: 16px 16px 2px; }
  .user-profile-page .user-profile-posts-heading h2 { font-size: 17px; }
  .user-profile-page .user-profile-post { gap: 10px; padding: 14px 16px; }
  .user-profile-page .user-profile-post-avatar { width: 36px; height: 36px; flex-basis: 36px; }
  .user-profile-page .user-profile-post-body h3 { font-size: 15px; line-height: 1.55; }
  .user-profile-page .user-profile-post-body > p { font-size: 13px; line-height: 1.7; }
  /* aside becomes flush flat sections separated like the post list */
  .user-profile-page .user-profile-discovery { padding: 0; }
  .user-profile-page .user-profile-discovery-section { margin: 0; padding: 16px; border-top: 8px solid var(--paper); }
  .user-profile-page .user-profile-discovery-heading h2 { font-size: 17px; }
  .user-profile-page .user-profile-recommendation { padding: 14px 0; }
  .user-profile-page .user-profile-recommendation:last-child { padding-bottom: 14px; }
  .user-profile-page .user-profile-suggestion { padding-top: 14px; }
  .user-profile-page .user-profile-footer { margin: 16px 16px 0; }
}
@media (max-width: 380px) {
  .user-profile-page .user-profile-stats { column-gap: 4px; }
  .user-profile-page .user-profile-stats span { font-size: 11.5px; }
}

/* ---------- Tools cards (mobile): keep footer on one line so rows align ---------- */
@media (max-width: 500px) {
  .directory-card .directory-card-footer { flex-wrap: nowrap; gap: 4px; margin-top: auto; }
  .directory-card .directory-card-footer .directory-visits { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .directory-card .directory-card-footer .directory-card-action { flex: none; }
}

/* ---------- Motion: only transform/opacity; honour reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .user-profile-page *, .user-profile-page *::before, .user-profile-page *::after,
  .directory-card, .directory-card * { animation: none !important; transition: none !important; }
}
