/* ============================================================
   雨过天晴 · 个人作品集
   深蓝夜空科幻风：蓝调暗底（非纯黑）/ 冰青强调 / 星尘粒子 / 星球
   保留 HUD 细节：等宽标注、编号、角标、终端 mock
   零构建，特效库本地自托管（assets/js/vendor/）
   ============================================================ */

:root {
  --bg: #0a111f;
  --bg-raise: #0e1728;
  --surface: rgba(15, 24, 42, 0.88);
  --surface-solid: #0f192b;
  --line: rgba(130, 160, 205, 0.16);
  --line-strong: rgba(130, 160, 205, 0.32);
  --text: #dce6f4;
  --muted: #8391a8;
  --faint: #5b6a84;
  --accent: #4de3ff;
  --accent-ink: #051220;
  --accent-dim: rgba(77, 227, 255, 0.12);
  --accent-line: rgba(77, 227, 255, 0.4);
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  /* 动效令牌：全站统一的时长与缓动 */
  --dur-fast: 0.2s;
  --dur: 0.35s;
  --dur-slow: 0.7s;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* 详情页 ↔ 首页导航时的视图过渡（支持的浏览器自动启用） */
@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 顶部阅读进度线：颜色从雨蓝渐到晴金 */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 40;
  background: linear-gradient(90deg, #5b9dff, #4de3ff 45%, #ffc24b);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  pointer-events: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-thumb {
  background: #1d2a42;
  border-radius: 5px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.mono {
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

/* ---------- 背景层：网格 + 天光 + 星尘 + 星球 ---------- */

.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* 拂晓天光：随 --dawn 升起，地平线暖金向上过渡到天青，页面逐渐明亮 */
.bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 26% at 10% 106%, rgba(255, 202, 132, 0.4), transparent 70%),
    linear-gradient(
      to top,
      #a3c9e2 0%,
      #6d9cc2 14%,
      #35608b 36%,
      #16334f 60%,
      rgba(10, 17, 31, 0) 92%
    );
  opacity: var(--dawn, 0);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(130, 160, 205, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(130, 160, 205, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 78%);
  mask-image: radial-gradient(ellipse 120% 90% at 50% 0%, #000 35%, transparent 78%);
  opacity: calc(1 - var(--dawn, 0) * 0.6);
}

.bg-glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 42% at 50% -6%, rgba(77, 227, 255, 0.10), transparent 70%),
    radial-gradient(ellipse 40% 30% at 82% 42%, rgba(38, 108, 173, 0.08), transparent 72%);
}

.bg-stars {
  position: absolute;
  inset: 0;
  opacity: calc(1 - var(--dawn, 0) * 0.92);
}

/* 月亮：NASA 月球影像（近地面裁切），日出时渐变成太阳 */
.bg-planet {
  --planet-r: 14vw;
  position: absolute;
  right: 3vw;
  top: 2vw;
  width: 28vw;
  height: 28vw;
  border-radius: 50%;
  background:
    /* 左上光源高光 */
    radial-gradient(circle at 34% 30%, rgba(255, 255, 255, 0.20), transparent 46%),
    /* 球面边缘暗化，营造立体感 */
    radial-gradient(circle at 50% 50%, transparent 54%, rgba(9, 15, 29, 0.6) 96%),
    url("../images/moon.jpg") center / cover no-repeat;
  box-shadow:
    inset -1.5vw -1.8vw 4vw rgba(8, 16, 34, 0.4),
    0 0 70px rgba(178, 212, 248, 0.32);
  opacity: 0.98;
  will-change: transform;
  animation:
    planet-drift 30s ease-in-out infinite,
    planet-orbit 80s linear infinite;
}

/* 公转：椭圆轨道，右上 → 顶部 → 左侧 → 底部 → 回归 */
@keyframes planet-orbit {
  0%    { translate: 2vw 0vw; }
  12.5% { translate: -9vw -19vw; }
  25%   { translate: -37vw -27vw; }
  37.5% { translate: -62vw -13vw; }
  50%   { translate: -76vw 0vw; }
  62.5% { translate: -62vw 15vw; }
  75%   { translate: -37vw 26vw; }
  87.5% { translate: -9vw 19vw; }
  100%  { translate: 2vw 0vw; }
}

@keyframes planet-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  33%  { transform: translate3d(-2.6vw, 2vw, 0) scale(1.045); }
  66%  { transform: translate3d(1.4vw, -1.6vw, 0) scale(0.985); }
  100% { transform: translate3d(0, 0, 0) scale(1); }
}

/* 日面：随 --dawn 浮现，白热核心 + 分层色温，月转日 */
.bg-planet::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle at 44% 40%,
    #ffffff 0%,
    #fffbe8 22%,
    #ffedb0 42%,
    #ffc85e 62%,
    #ff9a2e 82%,
    rgba(255, 138, 26, 0.95) 100%
  );
  box-shadow:
    0 0 50px rgba(255, 226, 150, 0.85),
    0 0 130px rgba(255, 190, 100, 0.45),
    0 0 260px rgba(255, 160, 60, 0.22);
  opacity: var(--dawn, 0);
  animation: corona-pulse 7s ease-in-out infinite;
}

@keyframes corona-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02); }
}

/* 卫星：绕星球公转的小亮点 */
.bg-planet::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px;
  border-radius: 50%;
  background: #bfe9ff;
  box-shadow: 0 0 14px rgba(159, 220, 255, 0.95);
  animation: planet-orbit 18s linear infinite;
}

@keyframes planet-orbit {
  from { transform: rotate(0deg) translateX(calc(var(--planet-r) + 26px)) rotate(0deg); }
  to   { transform: rotate(360deg) translateX(calc(var(--planet-r) + 26px)) rotate(-360deg); }
}

@media (max-width: 760px) {
  .bg-planet {
    --planet-r: 22vw;
    right: 4vw;
    top: 4vw;
    width: 52vw;
    height: 52vw;
  }
}

/* ---------- 天气叙事：雨 / 云 / 闪电 / 日出 / 彩虹 ----------
   滚动驱动：--weather 0→1（雨停天晴），--dawn 0→1（日出拂晓）
   由 main.js 写在 :root 上 */

.bg-rain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: calc(1 - var(--weather, 0));
}

.bg-clouds {
  position: absolute;
  inset: 0;
  opacity: calc((1 - var(--weather, 0)) * 0.9);
}

.bg-clouds .cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(148, 170, 200, 0.13), rgba(148, 170, 200, 0.05) 55%, transparent 72%);
  animation: cloud-drift 70s linear infinite alternate;
}

.bg-clouds .c1 {
  width: 62vw;
  height: 30vw;
  left: -12vw;
  top: 4vw;
  /* 云开雾散：天越晴，云层向两侧退开 */
  translate: calc(var(--weather, 0) * -16vw) calc(var(--weather, 0) * 4vw);
}

.bg-clouds .c2 {
  width: 48vw;
  height: 26vw;
  right: -8vw;
  top: -6vw;
  animation-duration: 90s;
  animation-delay: -30s;
  translate: calc(var(--weather, 0) * 14vw) 0;
}

.bg-clouds .c3 {
  width: 40vw;
  height: 22vw;
  left: 28vw;
  top: 16vw;
  animation-duration: 80s;
  animation-delay: -55s;
  translate: calc(var(--weather, 0) * -6vw) calc(var(--weather, 0) * 9vw);
}

@keyframes cloud-drift {
  from { transform: translateX(-4vw); }
  to   { transform: translateX(6vw); }
}

.bg-lightning {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(205, 228, 255, 0.12), transparent 55%);
  mix-blend-mode: screen;
  opacity: 0;
}

.bg-sun {
  position: absolute;
  left: 2vw;
  bottom: -18vw;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  /* 日芒：缓慢旋转的放射光辐 */
  background: repeating-conic-gradient(
    from 0deg,
    rgba(255, 205, 130, 0.16) 0deg 5deg,
    transparent 5deg 11deg
  );
  -webkit-mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.9) 18%, rgba(0, 0, 0, 0.35) 46%, transparent 68%);
  mask-image: radial-gradient(circle, rgba(0, 0, 0, 0.9) 18%, rgba(0, 0, 0, 0.35) 46%, transparent 68%);
  transform: translateY(calc((1 - var(--dawn, 0)) * 26%));
  opacity: var(--dawn, 0);
  animation: sun-rays 150s linear infinite;
}

.bg-sun::before {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 208, 138, 0.42), rgba(255, 168, 88, 0.16) 48%, transparent 70%);
  box-shadow: 0 0 160px rgba(255, 186, 110, 0.25);
}

@keyframes sun-rays {
  to { rotate: 1turn; }
}

/* 星河：一条缓慢流动的微光带，让夜空不那么平 */
.bg::after {
  content: "";
  position: absolute;
  inset: -10%;
  background: linear-gradient(
    115deg,
    transparent 38%,
    rgba(140, 170, 220, 0.05) 47%,
    rgba(190, 210, 245, 0.09) 51%,
    rgba(140, 170, 220, 0.05) 55%,
    transparent 64%
  );
  opacity: calc((1 - var(--dawn, 0)) * 0.85);
  animation: milkyway-drift 160s ease-in-out infinite alternate;
}

@keyframes milkyway-drift {
  from { transform: translateX(-3vw); }
  to   { transform: translateX(4vw); }
}

.bg-rainbow {
  position: absolute;
  left: 30vw;
  bottom: -9vw;
  width: 44vw;
  height: 22vw;
  background: conic-gradient(
    from 270deg at 50% 100%,
    rgba(255, 106, 120, 0.75),
    rgba(255, 194, 75, 0.75),
    rgba(249, 248, 113, 0.75),
    rgba(94, 230, 165, 0.75),
    rgba(77, 227, 255, 0.75),
    rgba(91, 157, 255, 0.75),
    rgba(167, 139, 250, 0.75),
    rgba(255, 106, 120, 0.75)
  );
  -webkit-mask-image: radial-gradient(circle 22vw at 50% 100%, transparent 55.5%, #000 58%, #000 62%, transparent 64.5%);
  mask-image: radial-gradient(circle 22vw at 50% 100%, transparent 55.5%, #000 58%, #000 62%, transparent 64.5%);
  opacity: calc(var(--dawn, 0) * 0.7);
  transform: translateY(calc((1 - var(--dawn, 0)) * 30%));
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(10, 17, 31, 0.88);
  border-bottom: 1px solid var(--line);
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.topbar.scrolled {
  border-bottom-color: var(--line-strong);
}

.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 9px;
  height: 9px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(77, 227, 255, 0.8);
  transform: rotate(45deg);
}

.brand-name {
  font-size: 15px;
  font-weight: 600;
}

.brand-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  letter-spacing: 0.14em;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.nav {
  display: flex;
  gap: 30px;
  font-size: 14px;
}

.nav a {
  color: var(--muted);
  position: relative;
  transition: color 0.2s ease;
}

.nav a sup {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--accent);
  margin-left: 3px;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -6px;
  height: 1px;
  background: var(--accent);
  transition: right 0.25s ease;
}

.nav a:hover {
  color: var(--text);
}

.nav a:hover::after {
  right: 0;
}

/* 顶栏天气状态标：雨 → 多云 → 晴 */
.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 26, 46, 0.5);
}

.weather-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.weather-chip[data-w="rain"] .dot {
  background: #5b9dff;
  box-shadow: 0 0 8px rgba(91, 157, 255, 0.9);
}

.weather-chip[data-w="cloud"] .dot {
  background: #9fb0c8;
  box-shadow: 0 0 8px rgba(159, 176, 200, 0.7);
}

.weather-chip[data-w="clear"] .dot {
  background: #ffc24b;
  box-shadow: 0 0 8px rgba(255, 194, 75, 0.9);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 148px 28px 120px;
  text-align: left;
}

.hero-code {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(42px, 7.4vw, 84px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: 0.01em;
  /* 天体从文字后方经过时保证可读性 */
  text-shadow: 0 2px 40px rgba(4, 9, 20, 0.7);
}

.hero h1.long {
  font-size: clamp(34px, 5.2vw, 62px);
  line-height: 1.3;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
  text-shadow: 0 0 32px rgba(77, 227, 255, 0.35);
  transition: text-shadow 0.3s ease;
}

.cursor {
  display: inline-block;
  width: 0.5em;
  height: 0.14em;
  margin-left: 10px;
  vertical-align: baseline;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-sub {
  margin: 26px 0 0;
  max-width: 580px;
  font-size: 18px;
  color: var(--muted);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 26, 46, 0.5);
  font-size: 12px;
  color: var(--muted);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(77, 227, 255, 0.9);
  flex: 0 0 auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 40px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(77, 227, 255, 0.28);
}

.btn-arrow {
  transition: transform 0.2s ease;
}

.btn:hover .btn-arrow {
  transform: translateX(4px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  font-weight: 400;
  font-size: 13px;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--accent-line);
  box-shadow: none;
}

.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--faint);
}

.hero-scroll-line {
  width: 1px;
  height: 44px;
  background: linear-gradient(var(--accent), transparent);
  overflow: hidden;
  animation: scrolldrip 1.8s ease-in-out infinite;
}

@keyframes scrolldrip {
  0% { transform: scaleY(0); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: top; }
  56% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ---------- 区块公共 ---------- */

.works,
.about {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 28px;
}

.section-head {
  margin-bottom: 40px;
}

.section-code {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--p, var(--accent));
  letter-spacing: 0.22em;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 700;
}

.section-desc {
  margin: 10px 0 0;
  font-size: 16px;
  color: var(--muted);
}

/* ---------- 作品卡片 ---------- */

.works-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.work {
  position: relative;
  display: flex;
  flex-direction: column;
  --p: var(--accent);
  --p-soft: var(--accent-dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  will-change: transform;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

/* 每个项目的专属氛围色（首页卡片与详情页通用） */
.work[data-accent="chisha"], [data-accent="chisha"] { --p: #ff9440; --p-soft: rgba(255, 148, 64, 0.16); }
.work[data-accent="patrol"], [data-accent="patrol"] { --p: #ffc24b; --p-soft: rgba(255, 194, 75, 0.14); }
.work[data-accent="report"], [data-accent="report"] { --p: #5b9dff; --p-soft: rgba(91, 157, 255, 0.16); }
.work[data-accent="bench"],  [data-accent="bench"]  { --p: #4de3ff; --p-soft: rgba(77, 227, 255, 0.12); }
.work[data-accent="watcher"], [data-accent="watcher"] { --p: #a78bfa; --p-soft: rgba(167, 139, 250, 0.15); }
.work[data-accent="geo"],     [data-accent="geo"]     { --p: #5ee6a5; --p-soft: rgba(94, 230, 165, 0.14); }

.work:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--p) 55%, transparent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 34px -12px var(--p);
}

/* HUD 角标：悬停时左上 / 右下亮起 */
.work::before,
.work::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}

.work::before {
  top: 8px;
  left: 8px;
  border-top: 1px solid var(--p);
  border-left: 1px solid var(--p);
}

.work::after {
  bottom: 8px;
  right: 8px;
  border-bottom: 1px solid var(--p);
  border-right: 1px solid var(--p);
}

.work:hover::before,
.work:hover::after {
  opacity: 0.9;
}

.work-media {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  background:
    radial-gradient(ellipse 70% 60% at 50% 100%, var(--p-soft), transparent 70%),
    linear-gradient(180deg, #0a1220 0%, #070d18 100%);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.work-media-chisha img {
  height: 86%;
  width: auto;
  object-fit: contain;
  border-radius: 20px;
  border: 3px solid #1c2739;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 44px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s ease;
}

.work:hover .work-media-chisha img {
  transform: translateY(-5px);
}

.work-media-patrol::before,
.work-media-report::before {
  content: "";
  position: absolute;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(130, 160, 205, 0.10), transparent 65%);
}

.work-media-patrol img,
.work-media-report img {
  width: 116px;
  height: 116px;
  object-fit: contain;
  border-radius: 26px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 18px 44px -8px color-mix(in srgb, var(--p) 55%, transparent);
  transition: transform 0.35s ease;
}

.work:hover .work-media-patrol img,
.work:hover .work-media-report img {
  transform: scale(1.05);
}

/* ---------- 工作台终端 mock ---------- */

.work-media-workbench {
  padding: 30px 34px;
}

.workbench {
  width: 100%;
  height: 100%;
  background: #060b14;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.bench-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: #0a111e;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.bench-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22304a;
}

.bench-bar i:first-child { background: #743a3a; }
.bench-bar i:nth-child(2) { background: #7a6434; }
.bench-bar i:nth-child(3) { background: #376b44; }

.bench-bar-title {
  margin-left: 10px;
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.12em;
}

.bench-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding: 12px;
  min-height: 0;
}

.bench-side {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.bench-side span {
  height: 9px;
  border-radius: 3px;
  background: #101a2c;
  border: 1px solid rgba(130, 160, 205, 0.10);
}

.bench-side span:first-child {
  background: var(--accent-dim);
  border-color: var(--accent-line);
}

.bench-main {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-height: 0;
}

.bench-panel {
  position: relative;
  border: 1px solid rgba(130, 160, 205, 0.14);
  border-radius: 5px;
  background: #0a1120;
  padding: 9px 11px;
  min-height: 0;
  overflow: hidden;
}

.bench-panel b {
  font-size: 9px;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.2em;
}

.bench-wave {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 9px;
  height: 38%;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.bench-wave i {
  flex: 1;
  background: linear-gradient(180deg, var(--accent), rgba(77, 227, 255, 0.15));
  border-radius: 1px;
  animation: wave 1.6s ease-in-out infinite;
}

.bench-wave i:nth-child(1) { height: 40%; animation-delay: 0s; }
.bench-wave i:nth-child(2) { height: 70%; animation-delay: 0.15s; }
.bench-wave i:nth-child(3) { height: 55%; animation-delay: 0.3s; }
.bench-wave i:nth-child(4) { height: 90%; animation-delay: 0.45s; }
.bench-wave i:nth-child(5) { height: 60%; animation-delay: 0.6s; }
.bench-wave i:nth-child(6) { height: 80%; animation-delay: 0.75s; }
.bench-wave i:nth-child(7) { height: 45%; animation-delay: 0.9s; }
.bench-wave i:nth-child(8) { height: 65%; animation-delay: 1.05s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.45); }
}

.bench-panel-log span {
  display: block;
  height: 7px;
  border-radius: 3px;
  background: #101a2c;
  margin-top: 8px;
}

.bench-panel-log span:first-of-type { width: 82%; margin-top: 12px; }
.bench-panel-log span:nth-of-type(2) { width: 64%; }
.bench-panel-log span:nth-of-type(3) { width: 74%; background: var(--accent-dim); }

/* ---------- 守望工作台 mock ---------- */

.work-media-watcher {
  padding: 30px 34px;
}

.dash {
  position: relative;
  width: 100%;
  height: 100%;
  background: #060b14;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

/* 扫描线：贯穿全屏的 HUD 感 */
.dash::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--p, var(--accent)), transparent);
  opacity: 0;
  animation: dashscan 3.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes dashscan {
  0%   { top: 2%;   opacity: 0; }
  12%  { opacity: 0.6; }
  88%  { opacity: 0.6; }
  100% { top: 98%;  opacity: 0; }
}

.dash-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  background: #0a111e;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.dash-bar i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22304a;
}

.dash-bar i:first-child { background: #743a3a; }
.dash-bar i:nth-child(2) { background: #7a6434; }
.dash-bar i:nth-child(3) { background: #376b44; }

.dash-bar-title {
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--faint);
  letter-spacing: 0.12em;
}

.dash-body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  min-height: 0;
}

.dash-panel {
  position: relative;
  border: 1px solid rgba(130, 160, 205, 0.14);
  border-radius: 5px;
  background: #0a1120;
  padding: 9px 11px;
  min-height: 0;
  overflow: hidden;
}

.dash-panel b {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
  color: var(--p, var(--accent));
  letter-spacing: 0.2em;
}

/* 告警列表：每行一个等级色标 */
.dash-alerts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 11px;
}

.dash-alerts span {
  position: relative;
  display: block;
  height: 7px;
  border-radius: 3px;
  background: #101a2c;
}

.dash-alerts span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--p, var(--accent));
}

.dash-alerts span:nth-child(1) { width: 86%; }
.dash-alerts span:nth-child(2) { width: 68%; }
.dash-alerts span:nth-child(3) { width: 76%; }
.dash-alerts span:nth-child(4) { width: 54%; }

.dash-alerts span:nth-child(1)::before { background: #ff5f57; }
.dash-alerts span:nth-child(2)::before { background: #ffc24b; }
.dash-alerts span:nth-child(3)::before { background: var(--p, var(--accent)); }

/* 热点柱状图 */
.dash-bars {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 9px;
  height: 40%;
  display: flex;
  align-items: flex-end;
  gap: 4px;
}

.dash-bars i {
  flex: 1;
  background: linear-gradient(180deg, var(--p, var(--accent)), rgba(167, 139, 250, 0.12));
  border-radius: 1px;
  animation: wave 1.9s ease-in-out infinite;
}

.dash-bars i:nth-child(1) { height: 52%; animation-delay: 0s; }
.dash-bars i:nth-child(2) { height: 88%; animation-delay: 0.12s; }
.dash-bars i:nth-child(3) { height: 64%; animation-delay: 0.24s; }
.dash-bars i:nth-child(4) { height: 100%; animation-delay: 0.36s; }
.dash-bars i:nth-child(5) { height: 46%; animation-delay: 0.48s; }
.dash-bars i:nth-child(6) { height: 74%; animation-delay: 0.6s; }
.dash-bars i:nth-child(7) { height: 58%; animation-delay: 0.72s; }
.dash-bars i:nth-child(8) { height: 82%; animation-delay: 0.84s; }

/* ---------- 地理定位卡片图：统一浏览器窗口框 ---------- */

.work-media-geo {
  padding: 30px 34px;
}

.shot-browser {
  position: absolute;
  z-index: 2;
  left: 34px;
  right: 34px;
  top: 30px;
  height: 24px;
  border-radius: 9px 9px 0 0;
  background: linear-gradient(180deg, #17233a, #101a2c);
  border: 1px solid var(--line-strong);
  border-bottom: none;
}

.shot-browser::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3a4a66;
  box-shadow: 11px 0 0 #3a4a66, 22px 0 0 #3a4a66;
}

.work-media-geo img {
  position: relative;
  z-index: 1;
  margin-top: 24px;
  width: 100%;
  height: calc(100% - 24px);
  object-fit: contain;
  object-position: top;
  border: 1px solid var(--line-strong);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: #0c1424;
  filter: brightness(0.95);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
  transition: transform 0.35s ease;
}

.work:hover .work-media-geo img {
  transform: scale(1.03);
}

/* ---------- 卡片文字 ---------- */

.work-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 20px 20px 22px;
}

.work-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.work-title h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.work-no {
  font-size: 12px;
  color: var(--p);
  letter-spacing: 0.1em;
}

.work-kind {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  white-space: nowrap;
}

.work-body p {
  margin: 10px 0 16px;
  font-size: 13.5px;
  color: var(--muted);
}

.work-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 11px;
}

.work-stats li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.work-stats b {
  font-weight: 400;
  font-size: 14px;
  color: var(--p);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.work-stats span {
  color: var(--faint);
  letter-spacing: 0.05em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
  font-size: 11px;
}

.tags li {
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  letter-spacing: 0.06em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.work:hover .tags li {
  border-color: rgba(130, 160, 205, 0.24);
}

/* ---------- 卡片跳转详情页 ---------- */

.work-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--p);
  letter-spacing: 0.08em;
}

.work-more span {
  transition: transform 0.2s ease;
}

.work-more:hover span {
  transform: translateX(4px);
}

/* 让整张卡片都可点击 */
.work-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* ---------- 详情页 ---------- */

.detail-hero {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: 92px 28px 48px;
}

.back-link {
  display: inline-block;
  font-size: 12px;
  color: var(--faint);
  letter-spacing: 0.1em;
  margin-bottom: 30px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

.detail-code {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--p, var(--accent));
  letter-spacing: 0.22em;
}

.detail-hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 700;
  line-height: 1.15;
}

.detail-tagline {
  margin: 20px 0 0;
  max-width: 640px;
  font-size: 19px;
  color: var(--muted);
}

.detail-hero .hero-meta {
  margin-top: 28px;
}

.detail-section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 28px;
}

.container-narrow {
  max-width: 880px;
}

.detail-block h2 {
  margin: 0 0 14px;
  font-size: clamp(24px, 3vw, 30px);
  font-weight: 700;
}

.detail-block p {
  margin: 0;
  max-width: 720px;
  font-size: 16.5px;
  color: var(--muted);
}

.info-table {
  width: 100%;
  margin: 30px 0 0;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
}

.info-table tr {
  border-bottom: 1px solid var(--line);
}

.info-table th {
  width: 110px;
  padding: 14px 16px 14px 0;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  text-align: left;
  letter-spacing: 0.16em;
  vertical-align: top;
  white-space: nowrap;
}

.info-table td {
  padding: 14px 0;
  font-size: 14.5px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.feature-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px 24px 24px;
  transition: transform 0.25s ease, border-color 0.25s ease;
}

.feature-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--p, var(--accent)) 45%, transparent);
}

.feature-card b {
  font-size: 11px;
  font-weight: 400;
  color: var(--p, var(--accent));
  letter-spacing: 0.18em;
}

.feature-card h3 {
  margin: 10px 0 8px;
  font-size: 17px;
  font-weight: 600;
}

.feature-card p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 26px 0 0;
  padding: 0;
  list-style: none;
  font-size: 12px;
}

.tech-list li {
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  letter-spacing: 0.06em;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tech-list li:hover {
  border-color: var(--accent-line);
  color: var(--text);
}

.arch-box {
  margin-top: 24px;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-left: 2px solid var(--p, var(--accent));
  border-radius: 10px;
  padding: 22px 26px;
}

.arch-box p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.9;
}

.arch-box code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--p, var(--accent));
  background: rgba(130, 160, 205, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
}

/* 详情页界面截图 */
.detail-shot {
  margin: 30px 0 0;
}

.detail-shot img {
  display: block;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-raise);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5);
}

.detail-nav {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin: 16px auto 0;
  padding-bottom: 72px;
}

.detail-prev,
.detail-next {
  font-size: 13px;
  color: var(--muted);
  padding: 13px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  letter-spacing: 0.05em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.detail-prev:hover,
.detail-next:hover {
  color: var(--text);
  border-color: var(--accent-line);
}

.detail-next {
  color: var(--accent);
}

/* ---------- 关于 ---------- */

.about {
  padding-top: 40px;
  padding-bottom: 110px;
}

.about-wrap {
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  padding: 30px 32px;
}

.about-wrap p {
  margin: 0;
  font-size: 17px;
  color: var(--muted);
}

.tags-about {
  margin-top: 24px;
}

/* 收束句：天完全晴了才浮现（透明度由 JS 写入） */
.closing-line {
  margin: 30px auto 0;
  max-width: 720px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
  letter-spacing: 0.18em;
  opacity: 0;
}

/* 闪电劈下时标题的辉光（JS 随机加 .storm-flash） */
.hero h1.storm-flash em {
  text-shadow:
    0 0 18px rgba(170, 228, 255, 0.95),
    0 0 70px rgba(130, 205, 255, 0.55);
}

/* ---------- 页脚 ---------- */

.footer {
  border-top: 1px solid var(--line);
  padding: 22px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  max-width: 1120px;
  margin: 0 auto;
  font-size: 12px;
  letter-spacing: 0.08em;
  /* 天亮时文字自动转深色，保证亮背景上的可读性 */
  color: color-mix(in srgb, var(--faint), #1d3050 calc(var(--dawn, 0) * 100%));
}

.footer a {
  color: inherit;
  letter-spacing: 0.08em;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: var(--accent);
}

.footer-beian {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.footer-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-status .dot {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.8);
}

/* ---------- 入场动效 ---------- */

/* 仅在 JS 可用时隐藏，避免无 JS 环境看不到内容 */
.js .reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition-delay: var(--d, 0s);
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ---------- 响应式 ---------- */

@media (max-width: 1020px) {
  .works-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
  }
}

@media (max-width: 700px) {
  .works-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    padding: 0 18px;
  }

  .brand-code {
    display: none;
  }

  .hero {
    padding: 96px 20px 88px;
  }

  .hero h1 {
    font-size: clamp(34px, 9.6vw, 46px);
  }

  .hero h1.long {
    font-size: clamp(25px, 6.8vw, 34px);
  }

  .hero-sub {
    font-size: 16px;
  }

  .hero-scroll {
    display: none;
  }

  .works,
  .about {
    padding: 56px 18px;
  }

  .work-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .work-media-patrol img,
  .work-media-report img {
    width: 100px;
    height: 100px;
  }

  .work-media-workbench,
  .work-media-watcher {
    padding: 18px;
  }

  .bench-body {
    grid-template-columns: 44px 1fr;
    gap: 9px;
    padding: 9px;
  }

  .about-wrap {
    padding: 24px 20px;
  }

  .detail-hero {
    padding: 64px 20px 36px;
  }

  .detail-section {
    padding: 28px 20px;
  }

  .detail-tagline {
    font-size: 16.5px;
  }

  .info-table th {
    width: 84px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .arch-box {
    padding: 18px 18px;
  }

  .detail-nav {
    flex-direction: column;
    padding-bottom: 56px;
  }

  .detail-prev,
  .detail-next {
    text-align: center;
  }

  .footer {
    padding: 20px 18px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}

/* ---------- 降低动效 ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cursor,
  .hero-scroll-line,
  .bench-wave i,
  .dash-bars i,
  .dash::after,
  .bg-planet,
  .bg-planet::before,
  .bg-planet::after,
  .bg-clouds .cloud,
  .bg-lightning,
  .bg::after,
  .bg-sun {
    animation: none;
  }

  .bg-planet {
    translate: 0 0;
  }

  .bg-rain,
  .bg-lightning {
    display: none;
  }

  .work,
  .btn,
  .work-media img {
    transition: none;
  }
}
