/* ============================================================
   幻 · HUAN2022A — GitHub 活动中心 · 活动星图
   贡献热力图 + NOW 卡 + 最新信号
   零依赖：仅使用主站 style.css 的主题变量与 .glass/.section 体系
   ============================================================ */

/* ---------- 下部双列卡片布局 ---------- */
.act-duo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  margin-top: 22px;
  align-items: stretch;
}

/* ---------- 热力图卡片 ---------- */
.act-hm-card { padding: 20px 22px 16px; }

.act-hm-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
  font-family: var(--mono);
}
.act-hm-title { font-size: 11px; letter-spacing: 2.5px; color: var(--muted); }
.act-src {
  font-size: 10.5px; letter-spacing: 1px; color: var(--muted); white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px;
  transition: color .2s, border-color .2s;
}
.act-src.live { color: var(--green); border-color: rgba(43, 255, 136, .4); background: rgba(43, 255, 136, .05); }
.act-src.sim  { color: var(--violet); border-color: rgba(167, 139, 250, .4); background: rgba(167, 139, 250, .05); }

/* 横向滚动（移动端） */
.act-hm-scroll {
  overflow-x: auto; overflow-y: hidden; padding-bottom: 4px;
  -webkit-overflow-scrolling: touch; /* iOS 动量滚动（新版本默认开启，老版本兜底） */
  scrollbar-width: thin; scrollbar-color: rgba(0, 229, 255, .25) transparent;
}
.act-hm-scroll::-webkit-scrollbar { height: 6px; }
.act-hm-scroll::-webkit-scrollbar-track { background: transparent; }
.act-hm-scroll::-webkit-scrollbar-thumb { background: rgba(0, 229, 255, .22); border-radius: 3px; }

/* 网格度量：格子尺寸 / 间隙 / 星期标签列宽 / 标签右间距 */
.act-hm-box {
  --ac-size: 12px; --ac-gap: 3px; --ac-dw: 20px; --ac-dgm: 7px;
  position: relative;
  width: max-content;
  padding-bottom: 2px;
}

/* 月份标签行（与格子网格共用轨道尺寸，天然对齐） */
.act-months {
  display: grid;
  grid-template-columns: repeat(53, var(--ac-size));
  column-gap: var(--ac-gap);
  margin-left: calc(var(--ac-dw) + var(--ac-dgm));
  height: 15px; margin-bottom: 5px;
}
.act-months span {
  font-family: var(--mono); font-size: 9.5px; line-height: 15px;
  color: var(--muted); white-space: nowrap;
  opacity: 0; transition: opacity .6s ease;
}
.act-hm-box.on .act-months span { opacity: .9; }

/* 星期标签列（一二五） */
.act-hm-row { display: flex; align-items: flex-start; }
.act-dows {
  display: grid; grid-template-rows: repeat(7, var(--ac-size)); row-gap: var(--ac-gap);
  width: var(--ac-dw); margin-right: var(--ac-dgm); flex: none; user-select: none;
}
.act-dows span {
  font-family: var(--mono); font-size: 9px; line-height: var(--ac-size);
  color: var(--muted); text-align: right; opacity: .8;
}

/* 格子矩阵：行 = 星期（日→六），按列（周）自动填充 */
.act-cells {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--ac-size));
  grid-auto-columns: var(--ac-size);
  gap: var(--ac-gap);
}

/* 五级颜色：空=#0d1120，少→多 = 深青 → 亮青 → 亮粉 霓虹梯度 */
.act-cell {
  border-radius: 3px; background: #0d1120;
  box-shadow: inset 0 0 0 1px rgba(140, 160, 210, .06);
  opacity: 0; transform: scale(.3); user-select: none;
}
.act-cell.l1 { background: #093646; box-shadow: none; }
.act-cell.l2 { background: #0b7a92; box-shadow: none; }
.act-cell.l3 { background: #00e5ff; box-shadow: 0 0 6px rgba(0, 229, 255, .45); }
.act-cell.l4 { background: #ff2e88; box-shadow: 0 0 7px rgba(255, 46, 136, .55); }
.act-cell.act-void { visibility: hidden; }

/* 悬停描边仅限真正支持 hover 的设备（触屏点按后高亮会粘滞） */
@media (hover: hover) {
  .act-cell:not(.act-void):hover {
    box-shadow: 0 0 0 1px rgba(226, 232, 240, .65), 0 0 10px rgba(0, 229, 255, .3);
  }
}
.act-cell:focus-visible { outline: 1px solid var(--cyan); outline-offset: 1px; }

/* 按列波浪式渐显（延迟由 JS 写入 --cd） */
.act-hm-box.on .act-cell {
  opacity: 1; transform: none;
  transition: opacity .5s ease var(--cd, 0ms), transform .5s cubic-bezier(.22, .8, .3, 1) var(--cd, 0ms);
}

/* ---------- 悬停 tooltip ---------- */
.act-tip {
  position: absolute; z-index: 6;
  transform: translate(-50%, -100%);
  background: rgba(7, 10, 20, .96);
  border: 1px solid rgba(0, 229, 255, .4);
  color: var(--text); font-family: var(--mono); font-size: 11.5px; line-height: 1.5;
  padding: 4px 10px; border-radius: 7px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .16s ease;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55), 0 0 16px rgba(0, 229, 255, .14);
}
.act-tip.on { opacity: 1; }
.act-tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: rgba(0, 229, 255, .4);
}
.act-tip.under { transform: translate(-50%, 0); }
.act-tip.under::after {
  top: auto; bottom: 100%;
  border-top-color: transparent; border-bottom-color: rgba(0, 229, 255, .4);
}

/* ---------- 底部：总计数 + 图例（右下角） ---------- */
.act-hm-foot {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap; margin-top: 12px;
}
.act-total { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.act-total b { color: var(--cyan); font-size: 14.5px; text-shadow: 0 0 10px rgba(0, 229, 255, .35); }
.act-legend {
  display: flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 11px; color: var(--muted); user-select: none;
}
.act-lg { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.act-lg.l0 { background: #0d1120; box-shadow: inset 0 0 0 1px rgba(140, 160, 210, .08); }
.act-lg.l1 { background: #093646; }
.act-lg.l2 { background: #0b7a92; }
.act-lg.l3 { background: #00e5ff; }
.act-lg.l4 { background: #ff2e88; }

/* ---------- 双列卡片通用 ---------- */
.act-card { padding: 22px 22px 18px; display: flex; flex-direction: column; }
.act-card-h {
  display: flex; align-items: center; gap: 10px;
  font-size: 16.5px; font-weight: 700; letter-spacing: .5px; margin-bottom: 10px;
}
.act-h-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px;
  padding: 3px 8px; border-radius: 6px; border: 1px solid;
}
.act-t-now { color: var(--green); border-color: rgba(43, 255, 136, .4); background: rgba(43, 255, 136, .06); }
.act-t-sig { color: var(--pink); border-color: rgba(255, 46, 136, .4); background: rgba(255, 46, 136, .06); }
.act-card-more { margin-top: auto; padding-top: 12px; font-family: var(--mono); font-size: 12px; }
.act-card-more a { color: var(--muted); }
.act-card-more a:hover { color: var(--cyan); }

/* ---------- NOW 卡「正在聚焦」 ---------- */
.act-now-list, .act-sig-list { list-style: none; margin: 0; padding: 0; }
.act-now-row {
  display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
  padding: 10px 0; border-bottom: 1px dashed rgba(140, 160, 210, .14);
}
.act-now-row:last-child { border-bottom: none; }
.act-nd {
  flex: none; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 9px rgba(43, 255, 136, .75);
  animation: act-pulse 2.2s ease-in-out infinite;
}
@keyframes act-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.act-nt { flex: 1 1 160px; min-width: 0; font-family: var(--mono); }
.act-nk { color: var(--cyan); font-size: 13.5px; font-weight: 600; }
.act-ndsc { color: var(--muted); font-size: 12.3px; margin-left: 9px; }
.act-ns {
  flex: none; font-family: var(--mono); font-size: 10.5px; letter-spacing: 1px;
  border: 1px solid; border-radius: 999px; padding: 2.5px 10px;
}
.act-ns.s-going { color: var(--cyan); border-color: rgba(0, 229, 255, .4); }
.act-ns.s-always { color: var(--violet); border-color: rgba(167, 139, 250, .4); }
.act-ns.s-never { color: var(--pink); border-color: rgba(255, 46, 136, .4); }

/* ---------- 最近动态卡「最新信号」 ---------- */
.act-sig-row {
  display: flex; align-items: baseline; gap: 9px;
  padding: 8.5px 0; border-bottom: 1px dashed rgba(140, 160, 210, .14);
}
.act-sig-row:last-child { border-bottom: none; }
.act-sig-tag {
  flex: none; font-family: var(--mono); font-size: 9.5px; letter-spacing: 1px;
  color: var(--tc, var(--muted)); border: 1px solid; border-radius: 5px; padding: 1.5px 6px;
  opacity: .95;
}
.act-sig-main { flex: 1; min-width: 0; font-size: 13.3px; color: #c3cce0; overflow-wrap: anywhere; }
.act-sig-main a { font-family: var(--mono); font-size: 12.5px; }
.act-sig-time { flex: none; font-family: var(--mono); font-size: 11.3px; color: var(--muted); }
.act-sig-loading { font-family: var(--mono); font-size: 12.5px; color: var(--muted); padding: 10px 0; }

/* ---------- 入场动画（自带 IntersectionObserver，不用 .reveal） ---------- */
.act-fade { opacity: 0; transform: translateY(26px); }
#activity.act-go .act-fade {
  opacity: 1; transform: none;
  transition: opacity .7s ease var(--fd, 0ms), transform .7s cubic-bezier(.22, .8, .3, 1) var(--fd, 0ms);
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .act-duo { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .act-hm-card { padding: 16px 14px 13px; }
  .act-card { padding: 18px 16px 14px; }
  .act-sig-main { font-size: 12.8px; }
}

/* ---------- 动效降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  .act-fade, .act-cell, .act-months span { opacity: 1 !important; transform: none !important; transition: none !important; }
  .act-nd { animation: none !important; }
  .act-tip { transition: none !important; }
}
