/* ==========================================================================
   Reset / 字体 / 背景纹理 / 焦点 / 无障碍降级
   ========================================================================== */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../assets/fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Manrope';
  src: url('../assets/fonts/manrope-var.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  /* 点阵网格，极淡 */
  background-image: radial-gradient(circle at 1px 1px, rgba(76, 194, 255, .05) 1px, transparent 0);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* CRT 扫描线 —— 极淡，不影响可读性 */
.scanlines {
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  background: repeating-linear-gradient(to bottom,
    rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,.16) 3px, rgba(0,0,0,0) 4px);
  opacity: .35;
}
/* 顶部微弱绿光 */
.bg-glow {
  position: fixed; z-index: -1; pointer-events: none;
  top: -34vh; left: 0; right: 0; margin-inline: auto;
  width: min(1100px, 100vw); height: 76vh;
  background: radial-gradient(ellipse at center, var(--green-glow), transparent 66%);
}

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--edge); }

/* 通用排版工具 */
.mono { font-family: var(--font-mono); }
.dim { color: var(--fg-3); }
.dim-2 { color: var(--fg-2); }
.hl { color: var(--green); }
.amber { color: var(--amber); }

::selection { background: var(--green); color: var(--bg); }

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

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 0;
}

/* 终端方块光标 */
.cursor {
  display: inline-block;
  width: .58em; height: 1.02em;
  background: var(--green);
  vertical-align: -.14em;
  box-shadow: 0 0 12px var(--green-glow);
  animation: blink var(--blink) steps(1) infinite;
}
@keyframes blink { 0%, 48% { opacity: 1; } 50%, 100% { opacity: 0; } }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--line-hi); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* 跳转链接 */
.skip-link {
  position: fixed; left: 8px; top: -60px; z-index: 10000;
  background: var(--green); color: var(--bg);
  padding: 8px 14px; font-family: var(--font-mono); font-weight: 700;
  transition: top var(--dur-base);
}
.skip-link:focus { top: 8px; }

/* 入场动画 —— 纯 CSS 自动播放，不依赖 JS。
   默认 opacity:1，保证禁用 JS / 阅读模式 / 首帧任何环境内容都可见；
   animation 仅做视觉增强，backwards 让延迟期停在首帧，播完回到默认可见态。 */
.reveal { opacity: 1; animation: revealIn .55s var(--ease) backwards; }
@keyframes revealIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 无障碍降级 ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (prefers-reduced-transparency: reduce) {
  .scanlines, .bg-glow { display: none; }
}
@media (prefers-contrast: more) {
  :root {
    --fg-2: #b9c4bc; --fg-3: #98a49b; --line: #4a574e;
    --green: #a6ffd0; --amber: #ffd97a;
  }
  .scanlines { display: none; }
}
