/* =========================================================
   pet.css —— 宝宝系统（07）
   左侧立绘 + 右侧属性（五边形战力分布）
   依赖：styles.css / home-v3.css 的 .radar-* 图形基座
   ========================================================= */

.pets { background: transparent; }

.pet-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, 0.94fr);
  gap: 54px;
  align-items: center;
}

/* —— 立绘 ——
   两张素材构图不同（一张竖图 607×694、一张横图 1145×799），
   contain 到同一个框里横的会明显小一圈，所以横的那张单独放大 14%。
   放大后左右各溢出 7%，立绘列与右栏之间有 54 的间距，压不到文字。 */
.pet-art {
  position: relative;
  /* 100svh − 顶栏 140 − 底栏 28 − 栏目行 65 = 可用高度；236 = 140+28+68，留一点余量 */
  height: min(608px, calc(100svh - 236px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-halo {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 48% 44%, rgba(126, 160, 196, .15), rgba(126, 160, 196, .035) 44%, transparent 68%);
  pointer-events: none;
}

/* 落地的接触影，别让龙整条浮在空中 */
.pet-art::after {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 9%;
  height: 46px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, .62), transparent 72%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}

/* 切换条压在图下沿，垫一层渐隐，免得立绘下沿（爪子 / 法杖）从字里穿过去 */
.pet-art::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 88px;
  z-index: 2;
  background: linear-gradient(180deg, transparent, rgba(8, 10, 12, .58) 55%, rgba(8, 10, 12, .9));
  pointer-events: none;
}

.pet-portrait {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  /* 三张立绘统一 1024×1024，尺寸一致不用单独缩放。
     opacity 为 0 的元素照样算 overflow，所以这里同时切 visibility ——
     visibility 可过渡，淡出期间仍按 visible 渲染，不会闪。 */
  visibility: hidden;
  transition: opacity .42s ease, visibility .42s;
  pointer-events: none;
}

.pet-portrait.active { opacity: 1; visibility: visible; }
/* 三张新立绘统一 1024×1024、主体占 92%，不需要再按图单独缩放 */

/* —— 切换 —— */
.pet-switch {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  gap: 2px;
}

.pet-tab {
  appearance: none;
  background: none;
  border: 0;
  border-top: 1px solid rgba(196, 176, 137, .18);
  color: #7B8280;
  font: inherit;
  padding: 9px 16px 3px;
  display: flex;
  align-items: baseline;
  gap: 9px;
  cursor: pointer;
  transition: color .2s, border-color .2s;
}

.pet-tab b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: .04em;
  color: #8E877C;
  transition: color .2s;
}

.pet-tab span { font-size: 14px; letter-spacing: .1em; }

.pet-tab:hover { color: #E9E4D9; }
.pet-tab.active { color: #F1ECE2; border-top-color: #A52833; }
.pet-tab.active b { color: #D1434E; }
.pet-tab:focus-visible { outline: 1px solid rgba(211, 67, 78, .6); outline-offset: 2px; }

/* —— 右侧属性 —— */
.pet-detail {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pet-detail .eyebrow { margin: 0 0 12px; }

.pet-detail h3 {
  margin: 0 0 10px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.pet-detail h3 span {
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: .06em;
  color: #F1ECE2;
}

.pet-detail h3 em {
  font-style: normal;
  font-size: 11.5px;
  letter-spacing: .3em;
  color: #867F74;
}

.pet-role {
  margin: 0 0 14px;
  font-size: 12.5px;
  letter-spacing: .18em;
  color: #BBA174;
}

.pet-desc {
  margin: 0 0 20px;
  font-size: 15px;
  line-height: 1.95;
  color: #B2AEA4;
  max-width: 40em;
}

.pet-radar {
  margin: 0 0 22px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 8px 18px;
  align-items: center;
}

.pet-radar .radar-chart {
  display: block;
  width: 100%;
  height: auto;
}

.pet-traits {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.pet-traits li {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
  padding: 10px 0;
  border-top: 1px solid rgba(196, 176, 137, .12);
}

.pet-traits li:last-child { border-bottom: 1px solid rgba(196, 176, 137, .12); }

.pet-traits b {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: .1em;
  color: #E9E4D9;
}

.pet-traits span {
  font-size: 13px;
  line-height: 1.7;
  color: #A29E95;
}

/* deck.css 在 1024–1499 里把 .deck .radar-labels 藏掉了（职业详情栏只剩 350px 放不下）。
   宝宝屏这块有 240px，标签放得下 —— 用 id 抬一级特异性把它抢回来。
   legend 同区间被压到 112px，这里一并放开。 */
@media (min-width: 1024px) {
  #pets .pet-radar .radar-labels { display: block; }
  #pets .pet-radar .radar-legend { width: 148px; }
  /* 同区间里 .deck .radar-plot 被放大到 1.34 倍（职业屏详情栏窄，靠放大填满），
     但五边形的轴标签在另一个 <g> 里不跟着走，一放就全挤到图形上。宝宝屏这里恢复原大。 */
  #pets .pet-radar .radar-plot { transform: none; }
}

/* 五维数值不只是重复雷达上的字：每行底下压一条细的进度，看精确值也看差距 */
#pets .pet-radar .radar-legend li {
  position: relative;
  padding-bottom: 8px;
}

#pets .pet-radar .radar-legend li::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 100%;
  background: rgba(196, 176, 137, .14);
}

#pets .pet-radar .radar-legend li::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: calc(var(--v, 0) * 1%);
  background: linear-gradient(90deg, rgba(165, 40, 51, .35), #C03B47);
  z-index: 1;
}

/* —— 1024–1199：右栏只剩 380 出头，雷达让出一点 —— */
@media (min-width: 1024px) and (max-width: 1199px) {
  /* 立绘让一点宽度给右栏：380 宽时技能行普遍折两行，
     军团这种五条内容直接顶出视口；让到 1.12fr 后行文回到一至两行。 */
  .pet-stage { grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr); gap: 40px; }
  .pet-radar { grid-template-columns: 196px minmax(0, 1fr); gap: 8px 14px; }
  /* 立绘列收窄后 4 列标签每格只剩 82，内边距吃掉 26 就把「奇美拉」截成省略号。
     下面还有一条 max-height:840 的 .pet-tab 内边距在后面，所以这里用 id 抬特异性。 */
  #pets .pet-tab { padding: 8px 7px 2px; gap: 4px; }
  #pets .pet-tab span { font-size: 13.5px; letter-spacing: .04em; }
}

/* —— 矮屏（1366×768 / 1024×700）：右栏要在一屏里收完 —— */
@media (min-width: 1024px) and (max-height: 840px) {
  .pet-detail h3 span { font-size: 29px; }
  .pet-detail h3 { margin-bottom: 7px; }
  .pet-role { margin-bottom: 10px; }
  .pet-desc { margin-bottom: 12px; font-size: 14px; line-height: 1.85; }
  .pet-radar { margin-bottom: 12px; grid-template-columns: 200px minmax(0, 1fr); }
  .pet-traits li { padding: 7px 0; }
  .pet-traits span { font-size: 12.5px; line-height: 1.6; }
  .pet-tab { padding: 8px 13px 2px; }
}

/* —— 720 上下（1024×700 这类）：右栏 488 高会顶出视口 21px ——
   再收一档，把雷达缩到 180、行距压到 6，右栏落到 410 以内。 */
@media (min-width: 1024px) and (max-height: 760px) {
  .pet-detail .eyebrow { margin-bottom: 6px; }
  .pet-detail h3 { margin-bottom: 5px; }
  .pet-detail h3 span { font-size: 26px; }
  .pet-role { margin-bottom: 8px; font-size: 12px; }
  .pet-desc { margin-bottom: 9px; font-size: 13.5px; line-height: 1.75; }
  .pet-radar { margin-bottom: 9px; grid-template-columns: 168px minmax(0, 1fr); }
  .pet-traits li { padding: 5px 0; }
}

/* —— <1024：回到纵向流式 —— */
@media (max-width: 1023px) {
  .pet-stage { grid-template-columns: 1fr; gap: 26px; }
  .pet-art { height: 340px; }
  /* 窄屏图缩到 340 之后龙尾会压到切换条上，给底部让出 40。
     不能用 height:auto —— img 是替换元素，绝对定位 + 四边约束时高度会按原图比例换算成 446，
     直接把下面的文字盖掉。按 calc 写死。 */
  .pet-portrait { inset: 0; height: calc(100% - 40px); }
  .pet-switch { left: 50%; transform: translateX(-50%); }
  .pet-detail h3 span { font-size: 27px; }
  .pet-radar { grid-template-columns: 186px minmax(0, 1fr); gap: 8px 16px; }
  .pet-radar .radar-labels { display: none; }
  .pet-radar .radar-plot { transform: scale(1.28); }
}

@media (max-width: 560px) {
  .pet-art { height: 280px; }
  .pet-radar { grid-template-columns: 140px minmax(0, 1fr); }
  .pet-traits li { grid-template-columns: 56px minmax(0, 1fr); gap: 12px; }
  /* 三个标签在 390 下会各自折行（「01 金 / 骸」），收内距 + 禁止断行 */
  .pet-switch { max-width: 100%; white-space: nowrap; }
  .pet-tab { padding: 8px 10px 3px; gap: 6px; }
  .pet-tab span { white-space: nowrap; }
}

/* =========================================================
   V2 —— 随行兽扩到九只（r50）
   九只在一行里排不下（三只已经占掉半条），改成索引网格：
   桌面 5 列 × 2 行，窄屏 3 列 × 3 行。
   立绘框整体让出 --pet-tabs 的高度，脚爪 / 尾巴不再被标签压住。
   ========================================================= */
.pet-art {
  /* 标签条实测 71（两行各 34.5 + 2 缝），留 74 免得贴住脚爪 */
  --pet-tabs: 74px;
  height: min(640px, calc(100svh - 236px));
}

/* 这里不能用 height:auto —— img 是替换元素，auto 会按原图 1:1 比例把高度算回 555，
   把 top/bottom 的约束整个丢掉，立绘下沿反而压到标签上。按 calc 写死。 */
.pet-portrait {
  inset: 0 0 var(--pet-tabs) 0;
  height: calc(100% - var(--pet-tabs));
}

.pet-switch {
  left: 0;
  right: 0;
  bottom: 0;
  transform: none;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 2px;
}

.pet-tab {
  min-width: 0;
  padding: 8px 8px 3px;
  gap: 5px;
}

.pet-tab b { flex: none; }

/* 列宽被 5 等分后字可能顶出去：宁可省略号，不要横向溢出。
   r62 起名字换成游戏内的全名（最长「黄金骷髅战士」6 字），
   所以字号收到 11.5、字距收到 .03em、内边距再收 1px —— 实测 1440 下 6 字刚好不省略。 */
.pet-tab span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  letter-spacing: .03em;
}

/* 渐隐与接触影跟着标签条一起下移 */
.pet-art::before { height: calc(var(--pet-tabs) + 30px); }
.pet-art::after { bottom: calc(var(--pet-tabs) + 4px); }

/* 1200–1399：还是 5 列，但每格只有 90–102，6 字要再挤一点才不省略 */
@media (min-width: 1200px) and (max-width: 1399px) {
  #pets .pet-tab { padding: 8px 5px 3px; gap: 4px; }
  #pets .pet-tab b { font-size: 10.5px; }
  #pets .pet-tab span { font-size: 12.5px; letter-spacing: 0; }
}

/* 1024–1199：立绘列只剩 342，4 列每格 77–88 装不下「黄金骷髅战士」，
   退成 3 列 × 4 行（十只 → 3/3/3/1），标签条从 108 抬到 146 —— 立绘跟着短 38。 */
@media (min-width: 1024px) and (max-width: 1199px) {
  .pet-art { --pet-tabs: 134px; }
  .pet-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  /* 前面 263 行那条 #pets 选择器带 id，这里不加 #pets 会被它盖掉 */
  #pets .pet-tab { padding: 7px 4px 3px; gap: 3px; }
  #pets .pet-tab b { font-size: 10.5px; }
  #pets .pet-tab span { font-size: 13px; letter-spacing: 0; }
  /* 图例写死 148 时右栏只有 303，会顶出去 26px，正好压到右侧导航标签的「宝宝系统」上；
     基样式是 justify-self:start，width:auto 会缩成内容宽（实测 50），必须写 100% 才吃满列宽 */
  #pets .pet-radar .radar-legend { width: 100%; }
}

@media (max-width: 1023px) {
  /* 标签条吃掉一截高度，立绘框补回来，否则 340 的框只剩 272 给图 */
  .pet-art { height: 400px; }
}

@media (max-width: 560px) {
  /* 390 下 4 列每格只有 82，同样装不下 6 字：改成 3 列 × 4 行 */
  .pet-art { height: 462px; --pet-tabs: 132px; }
  .pet-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pet-tab { padding: 7px 6px 2px; gap: 4px; }
  .pet-tab b { font-size: 10.5px; }
  .pet-tab span { font-size: 13.5px; letter-spacing: .02em; }
}

/* =========================================================
   V3 —— 技能表接游戏数据（r53）
   行结构：普攻 / 技能 / 基础。技能名最长 5 字（大型精灵球），
   b 列从 62 放宽到 76 并不许折行，否则会被挤成两行。
   亡灵军团是四具合一，技能行变四条，行高另收一档。
   ========================================================= */
.pet-traits li { grid-template-columns: 76px minmax(0, 1fr); gap: 14px; }
.pet-traits b { font-size: 14px; white-space: nowrap; }

/* 军团四行的「技能名 · 描述」前缀 */
.pet-traits em { font-style: normal; color: #C8BFA9; margin-right: 4px; }
.pet-traits em::after { content: "·"; margin-left: 5px; color: #6E6A62; }

/* 基础属性那一行压一档，别和技能抢注意力 */
.pet-traits li.is-base span { color: #8B857A; letter-spacing: .02em; }
.pet-traits li.is-base b { color: #9A9284; }

.pet-traits.is-four li { padding: 6px 0; }
.pet-traits.is-four span { font-size: 12.5px; line-height: 1.6; }

/* r63：备注挪到介绍段正下方后压在暗底上，原 #837D72 太灰，提一档暖灰 */
.pet-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.7; color: #9C9488; }

/* 军团是五条内容（四具 + 基础）+ 一行备注，在 1440×900 刚好，
   但 1366×768 / 1280×720 会把面板顶出视口底部（实测 +13 / +33）。
   小于 860 高时收行高，只在四行态生效，其余九只不动。 */
@media (min-width: 1024px) and (max-height: 860px) {
  .pet-traits.is-four b { line-height: 1.45; }
  .pet-traits.is-four li { padding: 3px 0; }
  .pet-traits.is-four span { font-size: 12px; line-height: 1.5; }
  .pet-note { margin-top: 7px; font-size: 11.5px; line-height: 1.55; }
}

/* 1024×700 是最挤的一档：右栏只有 362 宽、五条内容，压完还剩 2px 余量，
   再让一行行距与备注间距，留出可以喘气的一条缝。 */
@media (min-width: 1024px) and (max-width: 1199px) and (max-height: 760px) {
  .pet-traits.is-four li { padding: 2px 0; }
  /* r63：备注从技能表下方移到介绍段下方，这档会顶出 2px，
     把备注上间距再收 2px 补回来。 */
  .pet-note { margin-top: 3px; }
  .pet-radar { margin-bottom: 9px; }
  .pet-desc { margin-bottom: 10px; }
}
