/* mcres/static/css/pages/author/detail.css
   作者详情页（author/detail.html）专属样式。

   · 变量与基础排版全部复用 /static/css/pages/resource/detail/detail.css 的
     `.d2-root` 作用域，本文件只补作者页独有的区块，所有规则同样限定在
     `.d2-root` 下，避免与站点全局类名（.card / .pagination 等）互相污染。
   · 主题色取 base/variables.css 的 `--color-user`（作者＝站内用户域），
     与资源页的 theme-resourcepack / theme-shaderpack / theme-map 并列。 */

.d2-root.theme-author {
  --green: var(--color-user, #c084fc);
  --green-soft: rgba(192, 132, 252, 0.12);
  --green-line: rgba(192, 132, 252, 0.38);
  --green-hover: #d0a6fd;
}

/* ---------- 页面背景 ----------
   站内背景路由铺满**整页**（与 profile / 认证页同一约定），而不是只铺首屏
   卡片：首屏继续用 .hero 的 --panel-hi 面板色承载头像与文字，
   页面底色由 body 上的背景图提供。遮罩取 .72/.86 —— 面包屑这类直接压在
   图上的小字仍可读，同时背景照片在全页可辨。 */
body.d2-page.author-page {
  background-image:
    linear-gradient(160deg, rgba(9, 11, 16, 0.72), rgba(9, 11, 16, 0.86)),
    url('/background');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ---------- 首屏 ----------
   三栏同资源详情页：头像(media) | 信息(info) | 右侧栏(side)。
   作品数与三个操作按钮都落在 side，右侧不再留大片空白。 */
.d2-root .author-hero {
  grid-template-columns: 200px minmax(0, 1fr) 258px;
}

/* 右侧栏：作品数在上、按钮在下，按钮等宽（.hero-side .cta-row .btn{width:100%}
   由资源详情页提供），从顶部依次排布而不是撑到两端。 */
.d2-root .author-hero .hero-side {
  justify-content: flex-start;
  gap: 14px;
}

/* 头像 1:1：覆盖 .hero-media 的 16/10（否则 200px 宽的容器只有 125px 高，
   头像会被裁成横条）。 */
.d2-root .author-avatar {
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
}

.d2-root .author-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border: none;
  border-radius: 12px;
  background: var(--bg-deep);
}

.d2-root .author-avatar img.is-broken {
  display: none;
}

.d2-root .avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  font-size: 54px;
  color: var(--dim);
}

.d2-root .badge-team {
  background: var(--green);
  color: #1a1024;
}

.d2-root .badge-personal {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  color: var(--muted);
}

.d2-root .author-user {
  font-size: 13.5px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 7px;
}

.d2-root .author-user a {
  color: var(--green);
}

.d2-root .author-bio {
  max-width: 78ch;
}

/* ---------- 外部链接 ----------
   英雄区与关联资源之间的独立卡片：圆形图标 + 名称（上下排），整体暗色调。
   图标本体沿用资源详情页那套（edit.json 的 sites 名→slug + /static/img/sites/
   <slug>.svg），并用与详情页相同的 `brightness(0) invert(1)` 统一染成白色，
   所以这里只给每个 slug 配一个品牌色圆底。 */
.d2-root .author-links-card {
  margin-bottom: 26px;
}

.d2-root .ext-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  align-items: flex-start;
}

.d2-root .ext-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 76px;
  text-align: center;
}

.d2-root .ext-ico {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--hairline);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.d2-root .ext-link .site-ico {
  width: 22px;
  height: 22px;
  border-radius: 0;
  filter: brightness(0) invert(1);
}

.d2-root .ext-name {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-word;
}

.d2-root .ext-link:hover .ext-ico {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.d2-root .ext-link:hover .ext-name {
  color: var(--green);
}

/* 站点品牌色圆底（slug 来自 edit.json；未收录的一律 _default 紫） */
.d2-root .ext-link[data-slug="github"] .ext-ico {
  background: #181717;
  border-color: #2f343b;
}
.d2-root .ext-link[data-slug="bilibili"] .ext-ico {
  background: #00a1d6;
  border-color: #00a1d6;
}
.d2-root .ext-link[data-slug="modrinth"] .ext-ico {
  background: #00af5c;
  border-color: #00af5c;
}
.d2-root .ext-link[data-slug="curseforge"] .ext-ico {
  background: #f16436;
  border-color: #f16436;
}
.d2-root .ext-link[data-slug="discord"] .ext-ico {
  background: #5865f2;
  border-color: #5865f2;
}
.d2-root .ext-link[data-slug="gitee"] .ext-ico {
  background: #c71d23;
  border-color: #c71d23;
}
.d2-root .ext-link[data-slug="gitlab"] .ext-ico {
  background: #fc6d26;
  border-color: #fc6d26;
}
.d2-root .ext-link[data-slug="sourceforge"] .ext-ico {
  background: #ff6600;
  border-color: #ff6600;
}
.d2-root .ext-link[data-slug="spigotmc"] .ext-ico {
  background: #ed8106;
  border-color: #ed8106;
}
.d2-root .ext-link[data-slug="baidu"] .ext-ico {
  background: #2932e1;
  border-color: #2932e1;
}
.d2-root .ext-link[data-slug="_default"] .ext-ico {
  background: #946ce6;
  border-color: #946ce6;
}

/* ---------- 关联资源 ---------- */
.d2-root .author-resources {
  margin-bottom: 26px;
}

.d2-root .res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* 关联资源卡片：四类资源（资源包 / 光影包 / 地图 / 光影包预设）统一为
   16:10 封面 + 下方文字，封面无图时用类型图标占位。 */
.d2-root .res-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  transition:
    border-color 0.15s,
    transform 0.15s;
}

.d2-root .res-card:hover {
  border-color: var(--green);
  transform: translateY(-3px);
}

.d2-root .res-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  color: var(--dim);
  font-size: 28px;
}

.d2-root .res-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.d2-root .res-body {
  min-width: 0;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.d2-root .res-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d2-root .res-meta {
  font-size: 12px;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.d2-root .res-meta i {
  font-size: 11px;
  opacity: 0.75;
}

.d2-root .res-empty {
  padding: 26px 0;
  text-align: center;
  color: var(--dim);
  font-size: 13.5px;
}

.d2-root .res-empty i {
  display: block;
  font-size: 30px;
  opacity: 0.4;
  margin-bottom: 8px;
}

/* ---------- 分页（服务端渲染，profile/home.html 同款结构） ---------- */
.d2-root .pagination-wrapper {
  margin-top: 20px;
  display: flex;
  justify-content: center;
}

.d2-root .pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.d2-root .pagination a,
.d2-root .pagination .active,
.d2-root .pagination .ellipsis {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.d2-root .pagination a:hover {
  border-color: var(--green);
  color: var(--green);
}

.d2-root .pagination .active {
  background: var(--green-soft);
  border-color: var(--green-line);
  color: var(--green);
  font-weight: 700;
}

.d2-root .pagination .ellipsis {
  border-color: transparent;
  background: none;
}

/* ---------- 团队成员 ---------- */
/* 卡片位置在「外部链接」与「关联资源」之间，与相邻卡片保持同一间距 */
.d2-root .author-members {
  margin-bottom: 26px;
}

.d2-root .member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.d2-root .member-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.d2-root .member-card:hover {
  border-color: var(--green);
}

.d2-root .member-avatar {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-deep);
  display: grid;
  place-items: center;
  color: var(--dim);
}

.d2-root .member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.d2-root .member-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.d2-root .member-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d2-root .member-roles {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.d2-root .member-roles .chip {
  font-size: 11.5px;
  padding: 2px 8px;
}

/* 没填职位的成员：占位说明，避免与有职位的卡片高度不齐 */
.d2-root .member-roles.none {
  font-size: 12px;
  color: var(--dim);
}

/* 三栏在窄屏收成两栏：右侧栏落到下一行并横排（作品数在左、按钮在右）。
   资源详情页同名媒体查询里的 .hero 列/区定义被本文件的 .author-hero 覆盖，
   所以这里要自己写全。 */
@media (max-width: 1180px) {
  .d2-root .author-hero {
    grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
    grid-template-areas:
      "media info"
      "side side";
  }

  .d2-root .author-hero .hero-side {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .d2-root .author-hero .hero-side .cta-row {
    margin-top: 0;
  }

  .d2-root .author-hero .hero-side .cta-row .btn {
    width: auto;
  }
}

@media (max-width: 760px) {
  .d2-root .author-hero {
    grid-template-columns: 1fr;
    grid-template-areas:
      "media"
      "info"
      "side";
  }

  /* 头像容器收窄到 140px 后仍是 1:1；图/占位块由 100% 撑满，不再单独设宽高 */
  .d2-root .author-avatar {
    width: 140px;
  }

  /* 单列时右侧栏改回竖排，按钮铺满 */
  .d2-root .author-hero .hero-side {
    flex-direction: column;
    align-items: stretch;
  }

  .d2-root .author-hero .hero-side .cta-row .btn {
    width: 100%;
  }
}
