/* ==========================================================
   news.css —— 新闻相关样式
   (1) 首页「最新动态」1×4 科技感动态标签
   (2) news.html 新闻列表页
   需在 style.css 之后加载(依赖其中的 CSS 变量与 .pagination 等)
========================================================== */

/* ==========================================================
   (1) 首页:最新动态
========================================================== */

/* 标题旁的 LIVE 徽标 */
.news-live{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-left:10px;
  padding:2px 9px 2px 8px;
  border-radius:999px;
  background:#0f2f2a;
  color:#74e7dc;
  font-size:10px;
  font-weight:800;
  letter-spacing:1.4px;
  vertical-align:middle;
}

.news-live i{
  width:6px;
  height:6px;
  border-radius:50%;
  background:#74e7dc;
  box-shadow:0 0 8px #74e7dc;
  animation:newsPulse 1.6s ease-in-out infinite;
}

.news-grid{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  gap:20px;
}

/* ---------- 单个动态标签 ---------- */
.news-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:8px;
  min-height:158px;
  padding:18px 20px 16px;
  border-radius:18px;
  overflow:hidden;
  text-align:left;
  text-decoration:none;
  color:#e8fffb;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(116,231,220,.16), transparent 55%),
    linear-gradient(145deg, #0b2622 0%, #12362f 60%, #0e443b 100%);
  border:1px solid rgba(116,231,220,.22);
  box-shadow:0 10px 28px rgba(10,40,35,.18);
  transition:transform .3s, border-color .3s, box-shadow .3s;
  animation:newsRise .6s ease backwards;              /* 只用 backwards,避免盖住 hover 的位移 */
  animation-delay:calc(var(--i, 0) * .09s);
}

/* 科技网格底纹 */
.news-card::before{
  content:"";
  position:absolute;
  inset:0;
  background-image:
    linear-gradient(rgba(116,231,220,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116,231,220,.07) 1px, transparent 1px);
  background-size:22px 22px;
  -webkit-mask-image:linear-gradient(180deg, #000 0%, transparent 85%);
          mask-image:linear-gradient(180deg, #000 0%, transparent 85%);
  pointer-events:none;
}

/* 顶部流光线 */
.news-card::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:2px;
  background:linear-gradient(90deg, transparent, #74e7dc, transparent);
  background-size:200% 100%;
  animation:newsSweep 3.2s linear infinite;
}

/* 缓慢下行的扫描光带 */
.news-scan{
  position:absolute;
  left:0;
  right:0;
  top:0;
  height:42%;
  background:linear-gradient(180deg, transparent, rgba(116,231,220,.11), transparent);
  transform:translateY(-130%);
  animation:newsScan 5.5s ease-in-out infinite;
  animation-delay:calc(var(--i, 0) * .7s);
  pointer-events:none;
}

/* 四角定位标记 */
.nc{
  position:absolute;
  width:12px;
  height:12px;
  opacity:.55;
  transition:width .3s, height .3s, opacity .3s;
  pointer-events:none;
}
.nc-tl{ top:8px;    left:8px;  border-top:2px solid #74e7dc;    border-left:2px solid #74e7dc; }
.nc-br{ bottom:8px; right:8px; border-bottom:2px solid #74e7dc; border-right:2px solid #74e7dc; }

.news-card:hover{
  transform:translateY(-6px);
  border-color:rgba(116,231,220,.7);
  box-shadow:
    0 0 0 1px rgba(116,231,220,.35),
    0 16px 40px rgba(22,125,109,.35),
    inset 0 0 30px rgba(116,231,220,.06);
}
.news-card:hover .nc{ width:20px; height:20px; opacity:1; }

/* 内容层需高于装饰层 */
.news-card-top,
.news-title,
.news-marquee,
.news-time{
  position:relative;
  z-index:1;
}

.news-card-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.news-idx{
  font-family:ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size:11px;
  letter-spacing:1.6px;
  color:#74e7dc;
  opacity:.85;
}
.news-idx b{ font-weight:800; }

.news-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:#74e7dc;
  box-shadow:0 0 10px #74e7dc;
  animation:newsPulse 1.6s ease-in-out infinite;
}

/* 第一行:标题 */
.news-title{
  margin:2px 0 0;
  font-size:17px;
  font-weight:800;
  line-height:1.35;
  color:#fff;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* 第二行:正文(单行,横向滚动) */
.news-marquee{
  container-type:inline-size;
  overflow:hidden;
  white-space:nowrap;
  font-size:13.5px;
  color:rgba(207,243,236,.8);
  -webkit-mask-image:linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
          mask-image:linear-gradient(90deg, transparent 0, #000 7%, #000 93%, transparent 100%);
}

.news-marquee-track{
  display:flex;
  width:max-content;
  animation:newsMarquee var(--dur, 14s) linear infinite;
  will-change:transform;
}

/* 两份相同文字首尾相接,位移 -50% 时正好无缝衔接;每份至少一屏宽 */
.news-marquee-track > span{
  flex:none;
  min-width:100cqw;
  padding-right:40px;
  box-sizing:border-box;
}

.news-card:hover .news-marquee-track{
  animation-play-state:paused;                         /* 悬停时暂停,便于阅读 */
}

/* 第三行:日期 + 时间 */
.news-time{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:auto;
  padding-top:2px;
  font-family:ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size:12px;
  color:#9fe9e0;
}
.news-time span:first-child::before{ content:"▸ "; color:#74e7dc; }
.news-time span + span{
  padding-left:10px;
  border-left:1px solid rgba(116,231,220,.3);
}

/* 没有数据时的占位标签 */
.news-card-empty{
  cursor:default;
  opacity:.72;
}
.news-card-empty:hover{
  transform:none;
  border-color:rgba(116,231,220,.22);
  box-shadow:0 10px 28px rgba(10,40,35,.18);
}
.news-card-empty .news-title{ color:rgba(232,255,251,.75); font-weight:700; }

/* ---------- 动画 ---------- */
@keyframes newsRise{
  from{ opacity:0; transform:translateY(16px); }
  to{   opacity:1; transform:none; }
}
@keyframes newsPulse{
  0%,100%{ opacity:1;  transform:scale(1); }
  50%{     opacity:.4; transform:scale(.7); }
}
@keyframes newsSweep{
  from{ background-position:200% 0; }
  to{   background-position:-200% 0; }
}
@keyframes newsScan{
  0%{   transform:translateY(-130%); }
  60%,100%{ transform:translateY(330%); }
}
@keyframes newsMarquee{
  from{ transform:translateX(0); }
  to{   transform:translateX(-50%); }
}

/* ---------- 响应式 ---------- */
@media (max-width:1100px){
  .news-grid{ grid-template-columns:repeat(2, 1fr); }
}
@media (max-width:760px){
  .news-grid{ grid-template-columns:1fr; gap:14px; }
  .news-card{ min-height:146px; }
}

/* ---------- 用户偏好:减少动态效果 ---------- */
@media (prefers-reduced-motion:reduce){
  .news-card,
  .news-card::after,
  .news-scan,
  .news-dot,
  .news-live i,
  .news-marquee-track{ animation:none; }

  .news-marquee-track{ display:block; width:auto; }
  .news-marquee-track > span:first-child{
    display:block; min-width:0; padding:0;
    overflow:hidden; text-overflow:ellipsis;
  }
  .news-marquee-track > span:nth-child(2){ display:none; }
}


/* ==========================================================
   (2) news.html 新闻列表页
========================================================== */

.news-page{
  max-width:920px;
  margin:0 auto;
  padding:44px 28px 90px;
}

.news-page-head{
  margin-bottom:26px;
}

.news-page-head h1{
  margin:6px 0;
  font-size:34px;
  line-height:1.25;
}

.news-page-head p{
  margin:0;
  color:var(--muted);
}

.news-meta{
  margin-top:8px;
  font-family:ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size:12px;
  color:var(--primary);
  min-height:18px;
}

.news-list{
  display:flex;
  flex-direction:column;
  gap:16px;
  transition:opacity .2s;
}
.news-list.is-loading{ opacity:.55; }

/* 单条新闻:标题 / 正文 / 日期+时间 */
.news-item{
  position:relative;
  padding:22px 26px 18px 30px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
  overflow:hidden;
  scroll-margin-top:110px;
  transition:transform .25s, box-shadow .25s, border-color .25s;
}

.news-item::before{
  content:"";
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  width:4px;
  background:linear-gradient(180deg, var(--primary), #74e7dc);
}

.news-item:hover{
  transform:translateY(-3px);
  border-color:var(--accent);
  box-shadow:var(--shadow);
}

.news-item-title{
  margin:0 0 10px;
  font-size:20px;
  line-height:1.4;
  color:var(--text);
}

.news-item-body{
  margin:0 0 14px;
  font-size:15.5px;
  line-height:1.85;
  color:#2f4a44;
  white-space:pre-wrap;                 /* 保留后台录入的换行 */
  word-break:break-word;
}

.news-item-time{
  display:flex;
  align-items:center;
  gap:12px;
  font-family:ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;
  font-size:13px;
  color:var(--primary);
}
.news-item-time .t{
  padding-left:12px;
  border-left:1px solid var(--border);
}

/* 从首页点进来时,高亮对应的那条 */
.news-item-hl{ animation:newsHl 2.4s ease; }
@keyframes newsHl{
  0%,100%{ box-shadow:0 0 0 0 rgba(22,125,109,0); }
  20%{     box-shadow:0 0 0 5px rgba(22,125,109,.32); }
}

.news-empty{
  padding:60px 20px;
  text-align:center;
  color:var(--muted);
  background:#fff;
  border:1px dashed var(--border);
  border-radius:18px;
}

/* 加载骨架屏 */
.news-skel{
  height:118px;
  border-radius:18px;
  background:linear-gradient(100deg, #eef3f1 30%, #f8fbfa 50%, #eef3f1 70%);
  background-size:200% 100%;
  animation:newsSkel 1.3s linear infinite;
}
@keyframes newsSkel{
  from{ background-position:200% 0; }
  to{   background-position:-200% 0; }
}

@media (max-width:760px){
  .news-page{ padding:28px 16px 60px; }
  .news-page-head h1{ font-size:26px; }
  .news-item{ padding:18px 18px 14px 22px; }
  .news-item-title{ font-size:18px; }
}
