/**
 * 星图首屏（yf/star-map）。
 *
 * 只在页面里出现该区块时加载。所有规则都收在 .yf-star 之下，
 * 不污染主题其它页面。
 */

/* =========================================================
   1. 容器：整屏、黑底、竖向滚动承载
   ======================================================= */
.yf-star{
  position:relative;
  width:100%;
  height:100vh;
  height:100dvh;
  overflow:hidden;
  background:var(--ink);
  color:var(--paper);
  isolation:isolate;
  --star-pad:clamp(20px,4vw,56px);
  --p-70:rgba(244,242,236,.70);
  --p-55:rgba(244,242,236,.55);
  --p-38:rgba(244,242,236,.38);
  --s-line:rgba(244,242,236,.16);
  --s-line-2:rgba(244,242,236,.30);
  --s-glow:rgba(198,243,107,.14);
}
.yf-star a{color:inherit;text-decoration:none}
.yf-star h2,.yf-star p,.yf-star ul,.yf-star li{margin:0;padding:0}
.yf-star ul{list-style:none}

/* =========================================================
   2. 背景：星点 / 太阳光晕 / 暗角
   ======================================================= */
.star-sky,.star-glow,.star-vignette{position:absolute;inset:0;pointer-events:none}
.star-sky i{
  position:absolute;display:block;border-radius:50%;background:var(--paper);
  opacity:var(--o,.5);
  animation:star-twinkle var(--dur,6s) ease-in-out var(--del,0s) infinite alternate;
}
/* 星光缓慢随机明灭：每条星点的时长、延迟、基准亮度、暗到的深度都不同，
   叠在一起看就是"随机闪"，但全是 CSS，不占主线程 */
@keyframes star-twinkle{
  from{opacity:var(--o,.5)}
  to{opacity:calc(var(--o,.5) * var(--dip,.12))}
}
.star-glow{background:radial-gradient(circle at -6% 110%,rgba(198,243,107,.16) 0%,rgba(198,243,107,.04) 24%,transparent 54%)}
.star-vignette{background:radial-gradient(circle at 52% 44%,transparent 38%,rgba(17,19,24,.5) 100%)}

/* =========================================================
   3. 轨道：完整椭圆，圆心在视口外左下，只露右上 1/4 弧
   ======================================================= */
.star-system{
  position:absolute;inset:0;z-index:2;
  /* 左右边缘羽化：星球进出画面时"化"进边缘，而不是被硬切成半个圆 */
  -webkit-mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.55) 34px,#000 96px,#000 calc(100% - 96px),rgba(0,0,0,.55) calc(100% - 34px),transparent 100%);
  mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.55) 34px,#000 96px,#000 calc(100% - 96px),rgba(0,0,0,.55) calc(100% - 34px),transparent 100%);
}
.star-orbit{
  position:absolute;left:0;top:0;
  width:var(--dw);height:var(--dh);
  border:1px solid var(--s-line);border-radius:50%;
  transform:translate(-50%,-50%);pointer-events:none;
}
.star-orbit::after{
  content:"";position:absolute;inset:-1px;border-radius:50%;
  border:1px solid transparent;border-top-color:rgba(198,243,107,.20);
}

/* 无 JS / 编辑器预览：还原 0 秒那一帧（vw/vh 版本，与 JS 的 px 版本同解） */
.yf-star:not(.is-live) .star-orbit{
  width:calc(224vw * var(--k));
  height:calc(196vh * var(--k));
  left:-10vw;top:104vh;
}

/* =========================================================
   4. 星球：整颗球就是链接，栏目文字写在球内
   ======================================================= */
.star-planet{
  position:absolute;left:0;top:0;
  width:var(--s);height:var(--s);
  will-change:transform,opacity;
}
/* 不可见热区：小球径也保证 ≥44px 可点范围 */
.star-planet::before{
  content:"";position:absolute;left:50%;top:50%;
  width:max(44px,100%);height:max(44px,100%);
  transform:translate(-50%,-50%);
}
.yf-star:not(.is-live) .star-planet{
  --s:calc(clamp(84px,11.2vmin,132px) * var(--k));
  left:calc(-10vw + 112vw * var(--x));
  top:calc(104vh - 98vh * var(--y));
  transform:translate(-50%,-50%);
}

.star-body{
  position:absolute;inset:0;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  border:1px solid var(--s-line-2);
  background:radial-gradient(circle at 32% 28%,rgba(244,242,236,.15),rgba(17,19,24,.92) 62%);
  transition:transform .24s var(--ease),border-color .24s var(--ease),box-shadow .24s var(--ease);
}
.star-body::after{
  content:"";position:absolute;inset:-7px;border-radius:50%;
  border:1px solid transparent;transition:border-color .24s var(--ease);
}
.star-label{
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;
  max-width:86%;
  white-space:nowrap;pointer-events:none;
}
.star-label b{
  font-size:clamp(13px,1.2vw,18px);
  font-size:calc(clamp(13px,1.2vw,18px) * (0.74 + 0.26 * var(--k,1)));
  font-weight:600;letter-spacing:.02em;line-height:1.1;
}
.star-label em{
  font-family:var(--mono);font-size:clamp(6px,.58vw,8px);
  letter-spacing:.13em;text-transform:uppercase;color:var(--p-55);font-style:normal;
  max-width:100%;overflow:hidden;text-overflow:ellipsis;
}

/* 悬停 / 聚焦：与航线清单用同一套荧光绿描边 + 辉光 */
.star-planet:hover .star-body,.star-planet:focus-visible .star-body{
  transform:scale(1.06);border-color:var(--lime);
  box-shadow:0 0 0 1px rgba(198,243,107,.18),0 0 30px var(--s-glow);
  background:radial-gradient(circle at 32% 28%,rgba(198,243,107,.10),rgba(17,19,24,.94) 62%);
}
.star-planet:hover .star-body::after,.star-planet:focus-visible .star-body::after{border-color:rgba(198,243,107,.34)}
.star-planet:hover .star-label b,.star-planet:focus-visible .star-label b{text-decoration:underline;text-underline-offset:3px}
.star-planet:active .star-body{transform:scale(.96)}
.star-planet:focus-visible{outline:2px solid var(--lime);outline-offset:5px;border-radius:50%}

/* =========================================================
   5. 左下文字块：落在最内圈轨道以内，星球不可能压到
   ======================================================= */
.star-masthead{
  position:absolute;z-index:5;
  left:var(--star-pad);bottom:var(--star-pad);
  max-width:min(36vw,436px);
}
.star-brand{display:flex;align-items:baseline;gap:12px;flex-wrap:wrap;margin-bottom:clamp(18px,2.2vw,30px)}
.star-brand b{font-size:13px;font-weight:700;letter-spacing:.22em;text-transform:uppercase}
.star-brand span{font-family:var(--mono);font-size:9.5px;letter-spacing:.2em;color:var(--p-55);text-transform:uppercase}
.star-title{
  font-size:clamp(24px,2.7vw,52px);
  font-weight:600;letter-spacing:-.02em;line-height:1.28;
  color:var(--paper);
}
.star-title i{font-style:normal;color:var(--lime)}
.star-lead{margin-top:14px;font-size:12.5px;line-height:1.9;color:var(--p-70);max-width:29em}
.star-foot{
  display:flex;align-items:center;justify-content:space-between;gap:16px;
  margin-top:16px;padding-top:11px;border-top:1px solid var(--s-line);
  font-family:var(--mono);font-size:9px;letter-spacing:.14em;text-transform:uppercase;color:var(--p-38);
}
.star-scroll{display:inline-flex;align-items:center;gap:6px;color:var(--p-55);transition:color .2s var(--ease)}
.star-scroll span{display:inline-block;transition:transform .3s var(--ease)}
.star-scroll:hover,.star-scroll:focus-visible{color:var(--lime)}
.star-scroll:hover span,.star-scroll:focus-visible span{transform:translateY(3px)}
.star-scroll:focus-visible{outline:2px solid var(--lime);outline-offset:3px}

/* =========================================================
   6. 右上：航线清单 + 运行控制（悬停效果与星球同一套）
   ======================================================= */
.star-side{
  position:absolute;z-index:6;
  right:var(--star-pad);top:var(--star-pad);
  display:flex;flex-direction:column;align-items:flex-end;gap:20px;
}
.star-routes{width:min(214px,24vw);border-top:1px solid var(--s-line-2)}
.star-routes li{border-bottom:1px solid var(--s-line)}
.star-routes a{
  display:flex;align-items:center;gap:9px;padding:11px 2px;
  font-size:12.5px;
  transition:padding-left .24s var(--ease),color .24s var(--ease),box-shadow .24s var(--ease),background .24s var(--ease);
}
.star-routes a:hover,.star-routes a:focus-visible{
  padding-left:10px;color:var(--lime);
  background:rgba(198,243,107,.06);
  box-shadow:inset 0 0 0 1px rgba(198,243,107,.30),0 0 24px var(--s-glow);
}
.star-routes a:hover .no,.star-routes a:focus-visible .no{color:var(--lime)}
.star-routes a:focus-visible{outline:2px solid var(--lime);outline-offset:2px}
.star-routes .no{font-family:var(--mono);font-size:9px;letter-spacing:.16em;color:var(--p-55);transition:color .24s var(--ease)}
.star-routes .zh{flex:1}
.star-routes .short{display:none}
.star-routes .ar{color:var(--p-38);transition:transform .24s var(--ease),color .24s var(--ease)}
.star-routes a:hover .ar,.star-routes a:focus-visible .ar{transform:translateX(4px);color:var(--lime)}

.star-tools{
  display:flex;align-items:center;gap:10px;
  font-family:var(--mono);font-size:9px;letter-spacing:.16em;text-transform:uppercase;color:var(--p-55);
}
.star-tools button{
  font:inherit;letter-spacing:inherit;text-transform:inherit;
  background:transparent;color:var(--p-70);border:1px solid var(--s-line);
  padding:7px 11px;cursor:pointer;transition:color .2s,border-color .2s,background .2s,box-shadow .2s;
}
.star-tools button:hover{border-color:var(--lime);color:var(--lime);box-shadow:0 0 22px var(--s-glow)}
.star-tools button[aria-pressed="true"]{color:var(--ink);background:var(--lime);border-color:var(--lime)}
.star-tools button:focus-visible{outline:2px solid var(--lime);outline-offset:2px}

/* =========================================================
   7. 站点头部：星图在视野里时隐去，滚到第二屏再出现
   ======================================================= */
body.has-star-hero .site-header{
  opacity:0;visibility:hidden;transform:translateY(-8px);
  transition:opacity .35s var(--ease),transform .35s var(--ease),visibility .35s var(--ease);
}
body.has-star-hero.past-star .site-header{opacity:1;visibility:visible;transform:none}

/* =========================================================
   8. 断点：窄屏或矮屏（手机横屏）都走紧凑几何
   ======================================================= */
@media (max-width:1100px){
  .star-masthead{max-width:min(48vw,400px)}
  .star-routes{width:190px}
}
@media (max-width:767px),(max-height:560px){
  .yf-star{--star-pad:20px}
  .star-system{
    -webkit-mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.55) 18px,#000 58px,#000 calc(100% - 58px),rgba(0,0,0,.55) calc(100% - 18px),transparent 100%);
    mask-image:linear-gradient(to right,transparent 0,rgba(0,0,0,.55) 18px,#000 58px,#000 calc(100% - 58px),rgba(0,0,0,.55) calc(100% - 18px),transparent 100%);
  }
  /* 移动端：圆心更靠上、短轴压扁，弧线夹在标题与底部导航之间 */
  .yf-star:not(.is-live) .star-orbit{
    width:calc(212vw * var(--k));
    height:calc(124vh * var(--k));
    left:-8vw;top:84vh;
  }
  .yf-star:not(.is-live) .star-planet{
    --s:calc(clamp(46px,15vw,64px) * (0.5 + 0.5 * var(--k)));
    left:calc(-8vw + 106vw * var(--x));
    top:calc(84vh - 62vh * var(--y));
  }
  .star-brand{margin-bottom:14px}
  .star-masthead{
    left:var(--star-pad);right:var(--star-pad);top:var(--star-pad);bottom:auto;max-width:none;
  }
  .star-title{font-size:clamp(20px,5vw,26px)}
  .star-lead{display:none}
  .star-foot{margin-top:12px;padding-top:0;border-top:0;justify-content:flex-start}
  .star-foot-txt{display:none}
  .star-side{
    left:var(--star-pad);right:var(--star-pad);top:auto;bottom:calc(var(--star-pad) + 16px);
    align-items:stretch;gap:10px;
  }
  .star-routes{
    width:auto;display:flex;flex-wrap:wrap;gap:6px;border-top:0;
    background:rgba(17,19,24,.82);
    -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  }
  /* 条目多于 6 个时自动换到第二行；max-width 防止落单的那一格被拉成整行 */
  .star-routes li{
    border:1px solid var(--s-line);flex:1 1 0;min-width:44px;max-width:calc(25% - 5px);
    overflow:hidden;
    transition:border-color .24s var(--ease),box-shadow .24s var(--ease);
  }
  .star-routes a{padding:10px 4px;gap:0;font-size:10px;justify-content:center;white-space:nowrap}
  .star-routes a:hover,.star-routes a:focus-visible{padding-left:4px;background:transparent;box-shadow:none}
  .star-routes li:hover,.star-routes li:focus-within{border-color:var(--lime);box-shadow:0 0 24px var(--s-glow)}
  .star-routes .no,.star-routes .ar,.star-routes .long{display:none}
  .star-routes .short{display:flex;flex-direction:column;align-items:center;gap:2px;line-height:1.2;max-width:100%;overflow:hidden}
  .star-routes .short small{font-size:8.5px;color:var(--p-55);letter-spacing:.06em;max-width:100%;overflow:hidden;text-overflow:ellipsis}
  .star-tools{justify-content:flex-end}
  .star-label em{display:none}
  .star-label b{font-size:12px;font-size:calc(12px * (0.86 + 0.14 * var(--k,1)))}
}
@media (max-width:575px){
  .yf-star{--star-pad:16px}
  .star-label b{font-size:11.5px;font-size:calc(11.5px * (0.86 + 0.14 * var(--k,1)))}
  .star-tools{font-size:8px}
  .star-tools button{padding:5px 8px}
}
/* 360 以下的窄屏：间距收一点，六格才挤得进一行 */
@media (max-width:359px){
  .star-routes{gap:4px}
}

/* 横屏手机：底部导航吃掉近 1/4 屏高，把整条弧线抬到导航之上。
   抬高后星球只走 116~242px 这条带子，上沿 0~110px 是空的，
   所以文字块压成紧凑一行留在左上，正好落在带子上方。 */
@media (max-height:560px){
  .yf-star:not(.is-live) .star-orbit{
    height:calc(100vh * var(--k));
    top:62vh;
  }
  .yf-star:not(.is-live) .star-planet{
    top:calc(62vh - 50vh * var(--y));
  }
  .star-masthead{
    left:var(--star-pad);right:auto;top:var(--star-pad);bottom:auto;
    max-width:min(42vw,330px);
  }
  .star-brand{margin-bottom:6px}
  .star-brand span{display:none}
  .star-title{font-size:clamp(14px,1.9vw,18px);line-height:1.2}
  .star-foot{display:none}
}

@media (prefers-reduced-motion:reduce){
  .yf-star *,.yf-star *::before,.yf-star *::after{transition-duration:.001ms!important}
  .star-sky i{animation:none!important}
}
