

/*
 * `/u/:handle` profile page.
 *
 * Layout: name h1 (ink) → handle line (with optional ElementsBadge)
 * → meta strip (karma · joined) → flat tab strip → posts/comments
 * pane. Comments + posts share the same row anatomy: title h3 →
 * meta line → content, mirroring the feed.
 */

.profile-shell {
  max-width: 48rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 5rem;
}

/* ─── Header ────────────────────────────────────────────────────── */

.profile-header {
  padding: 0.5rem 0 1rem;
}

.profile-name {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: var(--font-bold);
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}

.profile-handle {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--ink-dim);
  margin-top: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.profile-meta {
  margin-top: 1rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.profile-meta .dot             { color: var(--ink-faint); }
.profile-meta .profile-karma b { color: var(--ink); font-weight: var(--font-semibold); }

/* ─── Tabs ──────────────────────────────────────────────────────── */
/* Flat — color + weight only, no underline rule. The bottom border
   on the strip carries the visual line; the active tab is just
   the bolder/inkier text. The count sits right next to the label
   with a `·` separator inserted via ::before so the spacing reads
   as "Posts · 39", tight rather than spaced. */

.profile-tabs {
  display: flex;
  align-items: center;
  /* 24px between tabs — gives each label its own breathing room
     so the tabs read as DISTINCT clickable items rather than a
     smashed run of words. */
  gap: 1.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--rule-soft);
}

.profile-tab {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: var(--font-medium);
  color: var(--ink-soft);
  /* Padding extends below the text — the bottom border on the
     active tab paints AT this padding's edge so the active state
     reads as a visible underline beneath the label. */
  padding: 0.625rem 0.125rem;
  margin-bottom: -1px;
  cursor: pointer;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition:
    color var(--duration-fast) var(--ease-out),
    border-bottom-color var(--duration-fast) var(--ease-out);
}
.profile-tab:hover {
  color: var(--ink);
  border-bottom-color: var(--rule);
}
.profile-tab.is-active {
  color: var(--ink);
  font-weight: var(--font-semibold);
  /* Accent-blue underline tells the user which tab is active and
     that the row is a tab strip. */
  border-bottom-color: var(--accent);
}
.profile-tab .tab-count {
  font-size: 0.75rem;
  color: var(--ink-dim);
  font-weight: var(--font-regular);
  font-variant-numeric: tabular-nums;
}

/* ─── Pane ──────────────────────────────────────────────────────── */

.profile-pane { padding-top: 0.25rem; }

.profile-empty {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  padding: 1.25rem 0;
}

/* ─── Posts list ────────────────────────────────────────────────── */
/* Per-user post list — author is implied by the page so the byline
   only carries kind + time. Title first (matches feed-row pattern),
   meta underneath, stats at the bottom. */

.profile-posts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-post {
  /* Matches feed-row vertical rhythm — 8px outer padding,
     border-bottom rule. Keeps the user profile feed visually
     identical to /feed and /home. */
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.profile-post:last-child { border-bottom: none; }

.profile-post-title {
  font-family: var(--font-sans);
  /* Match .feed-title — 16px / 500 / 1.35. */
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 4px;
}
.profile-post-title a         { color: inherit; text-decoration: none; }
.profile-post-title a:hover   { color: var(--accent); }

.profile-post-byline {
  font-family: var(--font-sans);
  /* Match .post-byline — 14px / 1.5 / ink-dim. */
  font-size: 14px;
  color: var(--ink-dim);
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.profile-post-byline .kind { font-weight: var(--font-medium); }
/* Canonical kind palette (Tailwind 600). */
.profile-post-byline .kind.eyebrow--show     { color: var(--kind-show);     }
.profile-post-byline .kind.eyebrow--ask      { color: var(--kind-ask);      }
.profile-post-byline .kind.eyebrow--announce { color: var(--kind-announce); }
.profile-post-byline .kind.eyebrow--discuss  { color: var(--kind-discuss);  }
.profile-post-byline .kind.eyebrow--teach    { color: var(--kind-teach);    }
.profile-post-byline .kind.eyebrow--course   { color: var(--kind-course);   }
.profile-post-byline .kind.eyebrow--guide    { color: var(--kind-guide);    }
.profile-post-byline .kind.eyebrow--video    { color: var(--kind-video);    }

.profile-post-stats {
  font-family: var(--font-sans);
  /* Match the action-row on feed: 12px / ink-soft / tabular nums. */
  font-size: 12px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.profile-post-stats .points { color: var(--ink-soft); font-weight: var(--font-regular); }
.profile-post-stats .sep    { color: var(--ink-dim); margin: 0 4px; }

/* ─── Comments list ─────────────────────────────────────────────── */
/* Per-user comment list — same anatomy as a feed row: post title
   (deep-links to the comment), meta strip, then the comment body
   rendered as full HTML via .cmt-body (imported above). The user
   already knows these are comments from the tab — no need to wrap
   the post title with "on" or add a kind chip. */

.profile-comments {
  list-style: none;
  margin: 0;
  padding: 0;
}

.profile-comment {
  /* Mirror the canonical .cmt anatomy: 8px padding + faint divider
     so each profile-comment reads with the same density as a real
     comment thread. */
  padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.profile-comment:last-child { border-bottom: none; }

/* Post title above the comment body — match feed-title typography
   so the row reads as a "post + comment excerpt" pair consistent
   with other surfaces. */
.profile-comment-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.35;
  color: var(--ink);
  margin: 0 0 4px;
}
.profile-comment-title a       { color: inherit; text-decoration: none; }
.profile-comment-title a:hover { color: var(--accent); }

/* Match the real .cmt-meta — same 12px / ink-dim / sans typography
   the comment template uses for "handle · ago" lines. */
.profile-comment-meta {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink-dim);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 6px;
  line-height: 1;
}
.profile-comment-meta .sep    { color: var(--ink-dim); }
.profile-comment-meta .points { color: var(--ink-soft); font-weight: var(--font-regular); }

/* Excerpt — match .cmt-body typography (14px / 1.55 / ink). 2-line
   clamp since the profile view shows just a snippet. */
.profile-comment-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  text-decoration: none;
  white-space: pre-line;
  word-wrap: break-word;
}
.profile-comment-excerpt:hover { color: var(--accent); }

/* ─── Issues pane (issues filed by this user) ────────────────────── */

.profile-issues {
  list-style: none;
  margin: 0;
  padding: 0;
}
.profile-issue {
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.profile-issue:last-child { border-bottom: none; }

.profile-issue-title {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: var(--font-medium);
  margin: 0 0 0.25rem;
  line-height: 1.35;
}
.profile-issue-title a       { color: var(--ink); text-decoration: none; }
.profile-issue-title a:hover { color: var(--accent); }

.profile-issue-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.4375rem;
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.profile-issue-meta .kind     { font-weight: var(--font-medium); }
.profile-issue-meta .sep      { color: var(--ink-faint); }
.profile-issue-meta .ago      { color: var(--ink-dim); }
.profile-issue-meta .points,
.profile-issue-meta .comments { color: var(--ink-soft); }
.profile-issue-closed         { color: var(--ink-dim); }

/* ─── Mobile ────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .profile-shell { padding: 1.25rem 1rem 4rem; }
  .profile-name  { font-size: 1.5rem; }
  .profile-tabs  { gap: 1rem; }
}

/* ─── Draft + edit affordances (owner-only) ─────────────────────── */

.profile-draft-chip {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: var(--font-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-dim);
  border: 1px solid var(--rule);
  padding: 0.0625rem 0.375rem;
  border-radius: var(--radius-xs);
  background: var(--bg-soft);
}

.profile-post.is-draft .profile-post-title a,
.profile-course.is-draft .profile-course-title a {
  color: var(--ink-soft);
}

/* Inline "edit / delete" actions on the byline, owner-only. The
   actions group sits on the right edge opposite the kind/eyebrow. */
.profile-row-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: baseline;
  gap: 0.625rem;
}

.profile-row-edit,
.profile-row-delete {
  font-family: var(--font-sans);
  font-size: 0.78125rem;
  font-weight: var(--font-regular);
  color: var(--ink-soft);
  text-decoration: none;
  /* Cancel framework `<button>` defaults — these render as plain
     inline text links, not chrome'd buttons. Without these explicit
     resets the framework's button.css `height: 44px` and
     `border: 1px solid var(--rule)` kicked in and the Delete looked
     like a boxed button. */
  display: inline;
  height: auto;
  min-height: 0;
  line-height: inherit;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}
.profile-row-edit:hover,
.profile-row-delete:hover {
  background: transparent;
  border-color: transparent;
  transform: none;
  text-decoration: underline;
}
.profile-row-edit:hover  { color: var(--accent); }
.profile-row-delete:hover { color: var(--red); }
.profile-row-edit:focus,
.profile-row-delete:focus,
.profile-row-edit:focus-visible,
.profile-row-delete:focus-visible {
  outline: none;
  box-shadow: none;
}

.profile-post-byline,
.profile-course-byline {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ─── Courses pane ───────────────────────────────────────────── */

/* Course list rows — same shape as the canonical list view used by
   /issues + the feed: a thin rule between rows, generous vertical
   padding, title at the standard 0.9375rem size (NOT a heading).
   Removes the previous "card stack" feel that read as a page-level
   stack of mini-articles. */
.profile-courses {
  list-style: none;
  margin: 0;
  padding: 0;
  /* No border-top — the .profile-tabs strip above already carries
     the divider; doubling them up reads as a broken page (the user
     called it out on the courses tab specifically). Match
     .profile-posts and .profile-comments which also rely on the
     tab strip's bottom rule. */
}
.profile-course {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--rule-soft);
}
.profile-course:last-child { border-bottom: none; }
.profile-course-title {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: var(--font-medium);
  line-height: 1.35;
  margin: 0;
}
.profile-course-title a {
  color: var(--ink);
  text-decoration: none;
}
.profile-course-title a:hover { color: var(--accent); }
.profile-course-desc {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin: 0.125rem 0 0;
  line-height: 1.5;
}
.profile-course-stats {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  color: var(--ink-soft);
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}
.profile-course-stats .sep { color: var(--ink-faint); }

/* Inline delete-failure banner. Mounted directly under the tab strip,
   shown only when a delete rpc reports !ok. Quiet red, no chrome —
   reads like a flash, not a modal. */
.profile-delete-error {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: #b42318;
  background: #fef3f2;
  border: 1px solid #fecdca;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin: 0 0 1rem;
}
