@import url('https://fonts.googleapis.com/css2?family=Karla:wght@300;400;500;600;700&family=Playfair+Display+SC:wght@400;700&display=swap');

/* ── 变量 ── */
:root {
  --c-bg: #0d0d0d;
  --c-primary: #8000ff;
  --c-accent: #ff00ff;
  --c-text: #e0d0ff;
  --c-muted: #7a6a8a;
  --c-border: rgba(128, 0, 255, 0.3);
  --c-card: rgba(128, 0, 255, 0.07);
  --font-head: 'Playfair Display SC', Georgia, serif;
  --font-body: 'Karla', system-ui, sans-serif;
  --nav-h: 64px;
  --radius: 10px;
  --glow-p: 0 0 8px rgba(128,0,255,0.8), 0 0 20px rgba(128,0,255,0.4);
  --glow-a: 0 0 8px rgba(255,0,255,0.8), 0 0 20px rgba(255,0,255,0.4);
}

/* ── 重置 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--c-bg);
  color: var(--c-text);
}
body { min-height: 100vh; overflow-x: hidden; }

/* ── 扫描线 & 点阵 ── */
.scanlines {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.18) 3px,
    rgba(0,0,0,0.18) 4px
  );
  mix-blend-mode: overlay;
}
.dot-grid {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, rgba(128,0,255,0.15) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── 全局字体 ── */
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  background-color: var(--c-bg);
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; color: #fff; }

/* ── 公共工具 ── */
a { color: var(--c-accent); text-decoration: none; transition: color .2s; }
a:hover { color: #fff; }
img { max-width: 100%; height: auto; display: block; }

/* ── 霓虹文字 ── */
.neon-p { text-shadow: var(--glow-p); }
.neon-a { text-shadow: var(--glow-a); }

/* ════════════════════════════
   HEADER / NAV
════════════════════════════ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(13,13,13,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  height: 100%;
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.25rem;
}

/* 品牌图标角落 */
.logo-link {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  border: 1px solid var(--c-primary);
  border-radius: 8px;
  color: #fff;
  transition: box-shadow .25s;
}
.logo-link:hover { box-shadow: var(--glow-p); }
.logo-mark { width: 36px; height: 36px; object-fit: contain; }
.logo-text-mark {
  font-family: var(--font-head);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-accent);
  text-shadow: var(--glow-a);
  line-height: 1;
}

/* HUD 胶囊导航 */
.hud-nav { flex: 1; overflow: hidden; }
.hud-nav ol {
  list-style: none;
  display: flex; align-items: center; gap: .35rem;
  flex-wrap: nowrap; overflow-x: auto;
  scrollbar-width: none;
  padding: .25rem 0;
}
.hud-nav ol::-webkit-scrollbar { display: none; }
.hud-nav li { flex-shrink: 0; }

.nav-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px;
  padding: 0 .9rem;
  border: 1px solid var(--c-border);
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: .8rem;
  font-weight: 600;
  color: var(--c-text);
  letter-spacing: .04em;
  transition: border-color .2s, box-shadow .2s, color .2s, background .2s;
  white-space: nowrap;
}
.nav-pill:hover, .nav-pill:focus-visible {
  border-color: var(--c-primary);
  color: #fff;
  background: rgba(128,0,255,0.15);
  box-shadow: var(--glow-p);
  outline: none;
}

/* 主 CTA 按钮 */
.cta-btn {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px;
  padding: 0 1.2rem;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .06em;
  white-space: nowrap;
}
.neon-btn {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  color: #fff;
  border: none;
  box-shadow: var(--glow-p);
  transition: box-shadow .25s, opacity .2s;
}
.neon-btn:hover { opacity: .88; box-shadow: var(--glow-a); color: #fff; }

/* ════════════════════════════
   HERO
════════════════════════════ */
.hero-section {
  position: relative;
  min-height: 45vh;
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: calc(var(--nav-h) + 3rem) 2rem 3rem;
  overflow: hidden;
  scroll-margin-top: var(--nav-h);
}
.hero-inner {
  position: relative; z-index: 2;
  max-width: 680px;
  text-align: right;
}
.hero-eyebrow {
  margin-bottom: .75rem;
}
.glitch-tag {
  display: inline-block;
  font-family: monospace;
  font-size: .7rem;
  letter-spacing: .18em;
  color: var(--c-accent);
  text-shadow: var(--glow-a);
  border: 1px solid var(--c-accent);
  padding: .25rem .7rem;
  border-radius: 4px;
  text-transform: uppercase;
}
.hero-title {
  font-size: clamp(2.4rem, 7vw, 5.5rem);
  color: #fff;
  text-shadow: 0 0 30px rgba(128,0,255,0.6), 0 0 60px rgba(255,0,255,0.3);
  line-height: 1.1;
  margin-bottom: 1rem;
  word-break: break-word;
}
.hero-sub {
  font-size: 1rem;
  color: var(--c-muted);
  line-height: 1.7;
  margin-bottom: .75rem;
}
.pub-date {
  display: inline-block;
  font-size: .78rem;
  color: var(--c-muted);
  font-family: monospace;
  letter-spacing: .06em;
}

/* 网格装饰线 */
.hero-grid-deco { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.grid-line { position: absolute; background: var(--c-border); }
.grid-line.v1 { width: 1px; top: 0; bottom: 0; left: 25%; }
.grid-line.v2 { width: 1px; top: 0; bottom: 0; left: 60%; }
.grid-line.h1l { height: 1px; left: 0; right: 0; bottom: 30%; }

/* ════════════════════════════
   GLITCH 动效
════════════════════════════ */
@keyframes glitch-skew {
  0%   { transform: skewX(0deg); }
  20%  { transform: skewX(-2deg); }
  40%  { transform: skewX(1.5deg); }
  60%  { transform: skewX(0deg); }
  80%  { transform: skewX(-1deg); }
  100% { transform: skewX(0deg); }
}
@keyframes glitch-clip1 {
  0%   { clip-path: inset(10% 0 85% 0); transform: translate(-3px, 0); }
  25%  { clip-path: inset(40% 0 45% 0); transform: translate(3px, 0); }
  50%  { clip-path: inset(70% 0 10% 0); transform: translate(-2px, 0); }
  75%  { clip-path: inset(25% 0 65% 0); transform: translate(2px, 0); }
  100% { clip-path: inset(10% 0 85% 0); transform: translate(-3px, 0); }
}
@keyframes glitch-clip2 {
  0%   { clip-path: inset(55% 0 30% 0); transform: translate(3px, 0); color: var(--c-accent); }
  33%  { clip-path: inset(15% 0 70% 0); transform: translate(-3px, 0); color: var(--c-primary); }
  66%  { clip-path: inset(80% 0 5%  0); transform: translate(2px, 0); color: var(--c-accent); }
  100% { clip-path: inset(55% 0 30% 0); transform: translate(3px, 0); color: var(--c-accent); }
}

.glitch-text {
  position: relative;
  animation: glitch-skew 4s infinite linear;
}
.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  font: inherit; color: inherit;
  pointer-events: none;
}
.glitch-text::before {
  animation: glitch-clip1 3s infinite steps(1);
  color: var(--c-primary);
  text-shadow: 2px 0 var(--c-primary);
}
.glitch-text::after {
  animation: glitch-clip2 2.5s infinite steps(1) .5s;
}

@media (prefers-reduced-motion: reduce) {
  .glitch-text, .glitch-text::before, .glitch-text::after { animation: none; }
  .glitch-text::before, .glitch-text::after { display: none; }
  html { scroll-behavior: auto; }
}

/* ════════════════════════════
   MAIN LAYOUT  (div 含 aside + section)
════════════════════════════ */
main {
  position: relative; z-index: 1;
  padding-top: 0;
}
main > div {
  max-width: 1280px; margin: 0 auto;
  padding: 0 1.25rem 4rem;
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: auto auto;
  grid-template-areas:
    "hero   hero"
    "aside  content";
  gap: 0 2rem;
}

.hero-section   { grid-area: hero; }
.sidebar-left   { grid-area: aside; }
.content-section { grid-area: content; }

/* ── Aside 左侧栏 ── */
.sidebar-left {
  position: sticky; top: calc(var(--nav-h) + 1.5rem);
  align-self: start;
  height: max-content;
  padding: 1.25rem 1rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  background: var(--c-card);
}
.aside-eyebrow {
  display: block;
  font-family: monospace;
  font-size: .65rem;
  letter-spacing: .16em;
  color: var(--c-primary);
  text-shadow: var(--glow-p);
  text-transform: uppercase;
  margin-bottom: .75rem;
}
.aside-index { list-style: none; }
.aside-index li { margin-bottom: .35rem; }
.aside-link {
  display: flex; align-items: center; gap: .5rem;
  min-height: 40px;
  padding: .25rem .4rem;
  border-radius: 6px;
  font-size: .82rem;
  color: var(--c-text);
  transition: background .2s, color .2s;
}
.aside-link:hover {
  background: rgba(128,0,255,0.18);
  color: #fff;
}
.idx-num {
  font-family: monospace;
  font-size: .68rem;
  color: var(--c-primary);
  min-width: 1.8em;
  flex-shrink: 0;
}
.aside-pulse {
  margin-top: 1rem;
  display: flex; align-items: center; gap: .5rem;
}
.pulse-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: var(--glow-a);
  animation: pulse-anim 2s infinite;
}
@keyframes pulse-anim {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .4; transform: scale(.6); }
}
@media (prefers-reduced-motion: reduce) {
  .pulse-dot { animation: none; }
}
.pulse-label {
  font-family: monospace;
  font-size: .65rem;
  color: var(--c-accent);
  letter-spacing: .1em;
}

/* ════════════════════════════
   PAGE CONTENT
════════════════════════════ */
.content-section {
  padding-top: 2.5rem;
  min-width: 0;
}
.page-content { scroll-margin-top: var(--nav-h); }

/* section 内容区通用样式 */
.page-content section {
  scroll-margin-top: calc(var(--nav-h) + 1rem);
  padding: 3rem 0;
  border-bottom: 1px solid var(--c-border);
}
.page-content section:last-child { border-bottom: none; }

/* h2 装饰（small 紧邻 h2 前） */
.page-content small { display: block; }
.page-content h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: #fff;
  text-shadow: 0 0 12px rgba(128,0,255,0.5);
  margin-bottom: 1rem;
}
.page-content h3 {
  font-size: 1.15rem;
  color: var(--c-accent);
  margin: 1.5rem 0 .6rem;
}
.page-content p { margin-bottom: 1rem; font-size: 1rem; line-height: 1.75; }
.page-content ul, .page-content ol {
  padding-left: 1.5rem; margin-bottom: 1rem;
}
.page-content li { margin-bottom: .4rem; }
.page-content a { color: var(--c-accent); border-bottom: 1px solid transparent; transition: border-color .2s; }
.page-content a:hover { border-color: var(--c-accent); }
.page-content img { border-radius: var(--radius); margin: 1.25rem 0; }
.page-content blockquote {
  border-left: 3px solid var(--c-primary);
  padding: .75rem 1.25rem;
  margin: 1.25rem 0;
  background: var(--c-card);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--c-muted);
}

/* ── 卡片（正文内子卡片） ── */
.page-content .card {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 4px 24px rgba(128,0,255,0.12);
  transition: box-shadow .25s, transform .25s;
}
.page-content .card:hover {
  box-shadow: 0 8px 32px rgba(128,0,255,0.25);
  transform: translateY(-2px);
}

/* ════════════════════════════
   FOOTER
════════════════════════════ */
.site-footer {
  position: relative; z-index: 1;
  border-top: 1px solid var(--c-border);
  padding: 1.75rem 1.25rem;
  max-width: 1280px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: .75rem;
}
.footer-copy {
  font-size: .875rem;
  color: var(--c-muted);
}
.neon-brand {
  color: var(--c-accent);
  text-shadow: var(--glow-a);
  font-weight: 700;
}
.footer-legal {
  font-size: .78rem;
  color: var(--c-muted);
}
.footer-link {
  color: var(--c-primary);
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 .25rem;
}
.footer-link:hover { color: var(--c-accent); }

/* ════════════════════════════
   MOBILE ≤ 768px
════════════════════════════ */
@media (max-width: 768px) {
  main > div {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hero"
      "content"
      "aside";
  }
  .sidebar-left {
    position: static;
    margin-top: 2rem;
  }
  .hero-section {
    min-height: 40vh;
    justify-content: flex-start;
    padding: calc(var(--nav-h) + 2rem) 1.25rem 2rem;
  }
  .hero-inner { text-align: left; max-width: 100%; }
  .hero-title { font-size: clamp(2rem, 10vw, 3.2rem); }

  /* 导航在小屏溢出滚动，pill 保持最低高度 */
  .nav-pill { font-size: .72rem; padding: 0 .65rem; min-height: 40px; }
  .cta-btn  { font-size: .75rem; padding: 0 .8rem; min-height: 40px; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }
}

@media (max-width: 480px) {
  .header-inner { gap: .5rem; padding: 0 .75rem; }
  .logo-link { width: 40px; height: 40px; }
  .hud-nav ol { gap: .25rem; }
  .nav-pill { padding: 0 .55rem; font-size: .68rem; }
}

/* ════════════════════════════
   STAGGER 动效（原生 JS 触发）
════════════════════════════ */
.stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s ease, transform .5s ease;
}
.stagger-item.visible {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .stagger-item { opacity: 1; transform: none; transition: none; }
}
