/* Profile page rules move here as they are retired from legacy-pages.css. */

/* ── 代表作滚动容器：固定3列，刚好显示9个（3行），超出可滚动，隐藏滚动条 ── */
.profile-page__works-scroll {
  max-height: 390px; /* 3行卡片：3 × 120(min-height) + 2 × 10(gap) = 380px，留10px余量 */
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.profile-page__works-scroll::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Edge */
}

.profile-page__works-scroll .profile-page__list-grid {
  grid-template-columns: repeat(3, 1fr); /* 固定3列，刚好3×3=9个可见 */
}

/* Dashboard uses natural page scrolling instead of a nested works scroller. */
.profile-page--dashboard .profile-page__works-scroll {
  max-height: none;
  overflow: visible;
  scrollbar-width: auto;
}

.profile-page__interactive-card {
  cursor: pointer;
  user-select: none;
}

.profile-page__interactive-card:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 72%, transparent);
  outline-offset: 3px;
}

.profile-page__detail-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 32px);
  isolation: isolate;
  overscroll-behavior: contain;
}

.profile-page__detail-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.62);
  cursor: pointer;
}

.profile-page__detail-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  width: min(1080px, calc(100vw - 48px));
  max-height: min(820px, calc(100dvh - 48px));
  overflow: hidden;
  padding: clamp(16px, 2vw, 22px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    color-mix(in srgb, var(--bg-panel) 94%, #000);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.profile-page__detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding-bottom: 2px;
}

.profile-page__detail-head h2 {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--text);
  font-size: clamp(18px, 2vw, 25px);
  line-height: 1.25;
}

.profile-page__detail-eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.profile-page__detail-close {
  display: inline-grid;
  flex: 0 0 38px;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  cursor: pointer;
}

.profile-page__detail-close:hover,
.profile-page__detail-close:focus-visible {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  outline: none;
}

.profile-page__detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(300px, 0.78fr);
  gap: 18px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.profile-page__detail-preview {
  display: grid;
  place-items: center;
  align-self: stretch;
  min-height: min(500px, 54dvh);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(var(--accent-rgb), 0.055), transparent 58%),
    rgba(255, 255, 255, 0.024);
}

.profile-page__detail-media {
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(640px, 56dvh);
  object-fit: contain;
}

video.profile-page__detail-media {
  height: 100%;
  min-height: 320px;
  background: #050607;
}

.profile-page__detail-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-size: 13px;
}

.profile-page__detail-placeholder .anticon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 16px;
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
  font-size: 20px;
}

.profile-page__detail-info {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.profile-page__detail-info p {
  margin: 0;
  max-height: min(230px, 28dvh);
  overflow: auto;
  padding: 13px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
  scrollbar-gutter: stable;
}

.profile-page__detail-info dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.profile-page__detail-info dl div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.03);
}

.profile-page__detail-info dt {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 760;
}

.profile-page__detail-info dd {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-page__detail-notice {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(243, 170, 38, 0.28);
  border-radius: 999px;
  background: rgba(243, 170, 38, 0.08);
  color: var(--warning);
  font-size: 12px;
  line-height: 1.3;
}

.profile-page__detail-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  justify-content: stretch;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-page__detail-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
  border-radius: 12px;
  background: rgba(var(--accent-rgb), 0.11);
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}

.profile-page__detail-action--primary {
  justify-self: start;
  min-width: 132px;
}

.profile-page__detail-action--secondary,
.profile-page__detail-action--danger {
  min-width: 118px;
}

.profile-page__detail-action:hover,
.profile-page__detail-action:focus-visible {
  border-color: rgba(var(--accent-rgb), 0.54);
  background: rgba(var(--accent-rgb), 0.16);
  outline: none;
}

.profile-page__detail-action--danger {
  border-color: rgba(255, 90, 95, 0.24);
  background: rgba(255, 90, 95, 0.08);
  color: #ffadb0;
}

.profile-page__detail-action--danger:hover,
.profile-page__detail-action--danger:focus-visible {
  border-color: rgba(255, 90, 95, 0.42);
  background: rgba(255, 90, 95, 0.13);
}

.profile-page__detail-action:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (max-width: 760px) {
  .profile-page__detail-overlay {
    align-items: end;
    padding: 10px 10px 0;
  }

  .profile-page__detail-panel {
    width: 100%;
    max-height: calc(100dvh - 10px);
    padding: 16px;
    border-radius: 18px 18px 0 0;
  }

  .profile-page__detail-body {
    grid-template-columns: 1fr;
    gap: 14px;
    overflow: auto;
    padding-right: 0;
  }

  .profile-page__detail-preview {
    align-items: start;
    min-height: 260px;
    max-height: 42dvh;
    overflow: auto;
  }

  .profile-page__detail-media {
    width: 100%;
    height: auto;
    max-height: none;
  }

  video.profile-page__detail-media {
    align-self: center;
    height: auto;
    min-height: 220px;
    max-height: 42dvh;
  }

  .profile-page__detail-info {
    overflow: auto;
    padding-right: 0;
  }

  .profile-page__detail-info p {
    min-height: 96px;
    max-height: 30dvh;
  }

  .profile-page__detail-info dl {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
    gap: 8px;
  }

  .profile-page__detail-info dl div {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 8px 10px;
  }

  .profile-page__detail-info dt {
    display: none;
  }

  .profile-page__detail-info dd {
    min-width: 0;
    color: var(--text);
    font-weight: 800;
    text-align: left;
  }

  .profile-page__detail-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-page__detail-action--primary {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .profile-page__detail-action--secondary,
  .profile-page__detail-action--danger {
    min-width: 0;
  }
}

@media (max-width: 420px) {
  .profile-page__detail-overlay {
    padding: 0;
  }

  .profile-page__detail-panel {
    max-height: 94dvh;
    padding: 14px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 18px 18px 0 0;
  }

  .profile-page__detail-head {
    gap: 12px;
  }

  .profile-page__detail-head h2 {
    font-size: 18px;
  }

  .profile-page__detail-close {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }

  .profile-page__detail-info dl {
    gap: 8px;
  }

  .profile-page__detail-info p {
    min-height: 108px;
  }

  .profile-page__detail-preview {
    min-height: 240px;
    max-height: 40dvh;
  }

  .profile-page__detail-info dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-page__detail-actions {
    grid-template-columns: 1fr;
  }

  .profile-page__detail-action--primary {
    grid-column: auto;
  }

  .profile-page__detail-action {
    min-height: 42px;
  }
}
