/**
 * DX 글쓴이 프로필 — assets/profile.css
 * dx_head 로 게시글 보기 화면에서만 로드
 *
 * 색: 테마 변수(--bg-card / --border / --text-main / --text-muted / --p) → 다크모드 자동
 * 강조: 회원 레벨 색(--dxap-lv, 레벨 설정의 color) — 링·칩·경험치 바에만 사용
 * 숫자: --font-head(Space Grotesk) + tabular-nums
 */

.dxap {
  --dxap-bg:    var(--bg-card, #fff);
  --dxap-line:  var(--border, #e2e8f0);
  --dxap-ink:   var(--text-main, #1e293b);
  --dxap-mute:  var(--text-muted, #64748b);
  --dxap-num:   var(--font-head, 'Space Grotesk', system-ui, sans-serif);
  --dxap-tint:  rgba(100, 116, 139, .12);
  --dxap-p-pct: calc(var(--dxap-p, 0) * 1%);

  position: relative;
  margin: 0 0 16px;
  background: var(--dxap-bg);
  border: 1px solid var(--dxap-line);
  border-radius: 16px;
  color: var(--dxap-ink);
  overflow: hidden;
}
@supports (color: color-mix(in srgb, red 10%, transparent)) {
  .dxap { --dxap-tint: color-mix(in srgb, var(--dxap-lv) 13%, transparent); }
}
.dxap[hidden] { display: none; }

/* ── 본체 ───────────────────────────────────────── */
.dxap-main {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 22px;
  padding: 26px 28px 24px;
}

/* 아바타 + 링 */
.dxap-avatar {
  position: relative;
  width: 88px;
  height: 88px;
}
.dxap-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.dxap-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.dxap-ring-track { stroke: var(--dxap-line); }
.dxap-ring-bar {
  stroke: var(--dxap-lv);
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 1.1s cubic-bezier(.2, .8, .2, 1);
}
.dxap.is-in .dxap-ring-bar { stroke-dashoffset: calc(100 - var(--dxap-p, 0)); }

.dxap-face {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--dxap-tint);
}
.dxap-avatar.no-ring .dxap-face { inset: 4px; }
.dxap-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dxap-initial {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--dxap-lv);
  line-height: 1;
}
.dxap-lvicon {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  line-height: 1;
  background: var(--dxap-bg);
  border: 1px solid var(--dxap-line);
}

/* 헤더: 이름 + 레벨 칩 / 버튼 */
.dxap-body { min-width: 0; }
.dxap-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}
.dxap-who {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  padding-top: 4px;
}
.dxap-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: var(--dxap-ink);
  word-break: keep-all;
}
.dxap-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 4px;
  border-radius: 999px;
  background: var(--dxap-tint);
  color: var(--dxap-ink);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}
.dxap-chip-lv {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--dxap-lv);
  color: var(--dxap-lv-ink, #fff);
  font-family: var(--dxap-num);
  font-size: .72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.dxap-actions { display: flex; gap: 6px; flex-shrink: 0; }
.dxap-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--dxap-line);
  border-radius: 10px;
  background: transparent;
  color: var(--dxap-ink);
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s, background-color .15s;
}
.dxap-btn i { font-size: .85rem; color: var(--dxap-mute); transition: color .15s; }
.dxap-btn:hover { border-color: var(--p, #3b82f6); color: var(--p, #3b82f6); }
.dxap-btn:hover i { color: inherit; }
.dxap-btn:focus-visible,
.dxap a:focus-visible {
  outline: 2px solid var(--p, #3b82f6);
  outline-offset: 2px;
}

/* 소개 · 메타 */
.dxap-bio {
  margin: 10px 0 0;
  max-width: 62ch;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--dxap-ink);
  opacity: .88;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
.dxap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 10px 0 0;
  font-size: .78rem;
  color: var(--dxap-mute);
}
.dxap-meta i { margin-right: 5px; font-size: .75rem; opacity: .8; }
.dxap-dim { color: var(--dxap-mute); opacity: .8; }

/* 통계 — 큰 숫자 + 작은 라벨, 세로 구분선 */
.dxap-stats {
  display: flex;
  flex-wrap: wrap;
  margin: 18px 0 0;
  padding: 0;
}
.dxap-stats > div {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  padding: 0 22px;
  border-left: 1px solid var(--dxap-line);
}
.dxap-stats > div:first-child { padding-left: 0; border-left: 0; }
.dxap-stats dt {
  font-size: .74rem;
  color: var(--dxap-mute);
}
.dxap-stats dd {
  margin: 0;
  font-family: var(--dxap-num);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  color: var(--dxap-ink);
}

/* 경험치 트랙 */
.dxap-exp { margin-top: 16px; max-width: 520px; }
.dxap-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--dxap-line);
  overflow: hidden;
}
.dxap-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: var(--dxap-lv);
  transition: width 1.1s cubic-bezier(.2, .8, .2, 1);
}
.dxap.is-in .dxap-fill { width: var(--dxap-p-pct); }
.dxap-exp-note {
  margin: 7px 0 0;
  font-size: .78rem;
  color: var(--dxap-mute);
}
.dxap-exp-note b { color: var(--dxap-ink); font-weight: 700; }
.dxap-exp-note .dxap-dim {
  margin-left: 6px;
  font-family: var(--dxap-num);
  font-variant-numeric: tabular-nums;
}

/* ── 하단: 다른 글 + 링크 ─────────────────────────── */
.dxap-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 28px;
  padding: 18px 28px 20px;
  border-top: 1px solid var(--dxap-line);
}
.dxap-recent { flex: 1; min-width: 0; }
.dxap-sub {
  margin: 0 0 8px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--dxap-mute);
}
.dxap-recent ul { list-style: none; margin: 0; padding: 0; }
.dxap-recent a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
  gap: 12px;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  color: var(--dxap-ink);
  text-decoration: none;
  transition: background-color .12s;
}
.dxap-recent a:hover { background: var(--hover-row, rgba(100, 116, 139, .08)); }
.dxap-rt {
  font-size: .88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dxap-rb {
  font-size: .74rem;
  color: var(--dxap-mute);
  white-space: nowrap;
}
.dxap-recent time {
  font-family: var(--dxap-num);
  font-size: .76rem;
  color: var(--dxap-mute);
  font-variant-numeric: tabular-nums;
}

.dxap-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.dxap-links a {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--dxap-line);
  color: var(--dxap-mute);
  font-size: .9rem;
  text-decoration: none;
  transition: color .15s, border-color .15s;
}
.dxap-links a:hover { color: var(--dxap-lv); border-color: var(--dxap-lv); }
.dxap-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── 모바일: 아바타 + 이름 한 줄, 나머지는 카드 전체 폭 ── */
@media (max-width: 640px) {
  .dxap-main {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 14px;
    padding: 20px 18px 18px;
  }
  .dxap-body,
  .dxap-head { display: contents; }
  .dxap-avatar { grid-column: 1; grid-row: 1; width: 64px; height: 64px; }
  .dxap-face { inset: 7px; }
  .dxap-lvicon { width: 24px; height: 24px; font-size: 12px; }
  .dxap-initial { font-size: 1.25rem; }
  .dxap-who {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding-top: 0;
  }
  .dxap-name { font-size: 1.1rem; }
  .dxap-bio, .dxap-meta, .dxap-stats, .dxap-exp, .dxap-actions { grid-column: 1 / -1; margin-top: 0; }
  .dxap-stats {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    padding: 14px 0;
    border-top: 1px solid var(--dxap-line);
    border-bottom: 1px solid var(--dxap-line);
  }
  .dxap-stats > div { padding: 0 0 0 10px; min-width: 0; }
  .dxap-stats dd { font-size: clamp(.9rem, 4vw, 1.1rem); letter-spacing: -.02em; }
  .dxap-exp { max-width: none; }
  .dxap-actions { order: 9; }
  .dxap-btn { flex: 1; justify-content: center; }
  .dxap-foot {
    flex-direction: column;
    align-items: stretch;
    padding: 16px 18px 18px;
  }
  .dxap-rb { display: none; }
}

/* 모션 줄이기 */
@media (prefers-reduced-motion: reduce) {
  .dxap-ring-bar, .dxap-fill { transition: none; }
}

/* JS 가 숨기는 요소 (display 지정보다 우선) */
.dxap-actions[hidden],
.dxap-btn[hidden] { display: none; }
