/* ============================================
   Neo-Ancient Theme — 赛博古风
   赛博朋克 × 中国古风 融合设计
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  /* 主色调 — 墨黑基底 */
  --cyber-bg-primary: #080810;
  --cyber-bg-secondary: #0d0d1a;
  --cyber-bg-tertiary: #12122a;
  --cyber-bg-card: rgba(13, 13, 26, 0.85);

  /* 霓虹色系 */
  --cyber-cyan: #00f0ff;
  --cyber-cyan-dim: rgba(0, 240, 255, 0.15);
  --cyber-pink: #ff00ff;
  --cyber-pink-dim: rgba(255, 0, 255, 0.15);
  --cyber-gold: #d4a017;
  --cyber-gold-dim: rgba(212, 160, 23, 0.15);
  --cyber-jade: #00ff88;
  --cyber-vermilion: #c41e3a;

  /* 文字色 */
  --cyber-text: #d0d0e0;
  --cyber-text-dim: #7878a0;
  --cyber-text-muted: #505070;

  /* 边框和发光 */
  --cyber-border: rgba(0, 240, 255, 0.12);
  --cyber-border-bright: rgba(0, 240, 255, 0.30);
  --cyber-glow-cyan: 0 0 15px rgba(0, 240, 255, 0.4), 0 0 30px rgba(0, 240, 255, 0.15);
  --cyber-glow-gold: 0 0 15px rgba(212, 160, 23, 0.3);
  --cyber-glow-pink: 0 0 15px rgba(255, 0, 255, 0.3);

  /* 字体 */
  --font-serif: 'Noto Serif SC', 'SimSun', 'STSong', serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;
  --font-decorative: 'Ma Shan Zheng', cursive;

  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--cyber-bg-primary);
  color: var(--cyber-text);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--font-mono); }

/* ---- Scanlines Overlay ---- */
.scanlines {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.03) 2px,
    rgba(0, 0, 0, 0.03) 4px
  );
}

/* ---- Grid Background ---- */
.cyber-grid {
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  background-position: center center;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 30%, transparent 70%);
}

/* ---- Header ---- */
.cyber-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(8, 8, 16, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--cyber-border);
}

.site-title { font-family: var(--font-decorative); font-size: 1.5rem; }
.site-subtitle { font-family: var(--font-serif); letter-spacing: 0.1em; }

/* ---- Navigation ---- */
.cyber-btn {
  display: inline-flex; align-items: center;
  background: transparent;
  border: 1px solid var(--cyber-border);
  color: var(--cyber-text-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  transition: all 0.3s ease;
  cursor: pointer;
}
.cyber-btn:hover {
  border-color: var(--cyber-cyan);
  color: var(--cyber-cyan);
  box-shadow: var(--cyber-glow-cyan);
}
.cyber-btn.active {
  border-color: var(--cyber-cyan);
  color: var(--cyber-cyan);
  background: var(--cyber-cyan-dim);
}

/* ---- Cards ---- */
.cyber-card {
  position: relative;
  background: var(--cyber-bg-card);
  border: 1px solid var(--cyber-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  overflow: hidden;
}
.cyber-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyber-cyan), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.cyber-card:hover {
  border-color: var(--cyber-border-bright);
  box-shadow: var(--cyber-glow-cyan);
  transform: translateY(-2px);
}
.cyber-card:hover::before { opacity: 1; }
.cyber-card:hover .card-glow {
  opacity: 1;
}

.card-glow {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(0, 240, 255, 0.06), transparent 70%);
  opacity: 0; transition: opacity 0.4s ease; pointer-events: none;
}

/* ---- Gradient Text ---- */
.cyber-gradient-text {
  background: linear-gradient(135deg, var(--cyber-cyan), var(--cyber-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Links ---- */
.cyber-link {
  color: var(--cyber-cyan);
  transition: color 0.2s;
}
.cyber-link:hover { color: var(--cyber-gold); text-shadow: var(--cyber-glow-cyan); }

.cyber-link-title {
  color: var(--cyber-text);
  transition: all 0.3s;
}
.cyber-link-title:hover {
  background: linear-gradient(135deg, var(--cyber-cyan), var(--cyber-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Tags ---- */
.cyber-tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 0.75rem; font-family: var(--font-mono);
  color: var(--cyber-cyan);
  border: 1px solid var(--cyber-cyan-dim);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}
.cyber-tag:hover {
  background: var(--cyber-cyan-dim);
  border-color: var(--cyber-cyan);
  box-shadow: var(--cyber-glow-cyan);
}

/* ---- Social Links ---- */
.cyber-social-link {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--cyber-border);
  border-radius: 50%;
  color: var(--cyber-text-dim);
  transition: all 0.3s;
}
.cyber-social-link:hover {
  border-color: var(--cyber-cyan);
  color: var(--cyber-cyan);
  box-shadow: var(--cyber-glow-cyan);
}

/* ---- Section Title ---- */
.cyber-section-title {
  position: relative;
  padding-bottom: 0.5rem;
}
.year-line {
  height: 1px;
  background: linear-gradient(90deg, var(--cyber-cyan), transparent);
}

/* ---- Hero Section ---- */
.hero-decoration {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
}
.hero-line {
  display: block; width: 60px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyber-cyan), transparent);
}
.hero-diamond {
  font-size: 1.2rem;
  color: var(--cyber-cyan);
  animation: diamond-pulse 3s ease-in-out infinite;
}
@keyframes diamond-pulse {
  0%, 100% { opacity: 0.3; text-shadow: none; }
  50% { opacity: 1; text-shadow: var(--cyber-glow-cyan); }
}
.hero-subtitle {
  font-family: var(--font-mono);
  animation: subtitle-flicker 5s linear infinite;
}
@keyframes subtitle-flicker {
  0%, 100% { opacity: 0.7; }
  92% { opacity: 0.7; }
  93% { opacity: 0.3; }
  94% { opacity: 0.8; }
  95% { opacity: 0.4; }
  96% { opacity: 0.7; }
}

/* ---- Post List ---- */
.post-list .cyber-card { padding: 1.5rem; }

/* ---- Post Content (Prose) ---- */
.cyber-prose {
  font-size: 1.05rem; line-height: 1.9;
}
.cyber-prose h1 { font-size: 2rem; font-weight: 900; color: var(--cyber-gold); margin: 2rem 0 1rem; font-family: var(--font-decorative); }
.cyber-prose h2 { font-size: 1.6rem; font-weight: 700; color: var(--cyber-cyan); margin: 1.8rem 0 0.8rem; border-left: 3px solid var(--cyber-cyan); padding-left: 0.8rem; }
.cyber-prose h3 { font-size: 1.3rem; font-weight: 700; color: var(--cyber-text); margin: 1.5rem 0 0.6rem; }
.cyber-prose h4 { font-size: 1.1rem; font-weight: 700; color: var(--cyber-text-dim); margin: 1.2rem 0 0.5rem; }
.cyber-prose p { margin-bottom: 1.2rem; }
.cyber-prose a { color: var(--cyber-cyan); border-bottom: 1px dotted var(--cyber-cyan-dim); transition: all 0.2s; }
.cyber-prose a:hover { color: var(--cyber-gold); border-color: var(--cyber-gold); }
.cyber-prose strong { color: var(--cyber-gold); }
.cyber-prose em { color: var(--cyber-cyan); font-style: italic; }
.cyber-prose blockquote {
  border-left: 4px solid var(--cyber-gold);
  margin: 1.5rem 0; padding: 1rem 1.5rem;
  background: var(--cyber-gold-dim);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic; color: var(--cyber-text-dim);
}
.cyber-prose blockquote p:last-child { margin-bottom: 0; }
.cyber-prose ul, .cyber-prose ol { margin: 1rem 0; padding-left: 1.5rem; }
.cyber-prose li { margin-bottom: 0.3rem; }
.cyber-prose li::marker { color: var(--cyber-cyan); }
.cyber-prose hr {
  border: none; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyber-border), transparent);
  margin: 2rem 0;
}
.cyber-prose img {
  border-radius: var(--radius-md);
  border: 1px solid var(--cyber-border);
  max-width: 100%;
}
.cyber-prose code {
  background: var(--cyber-bg-tertiary);
  border: 1px solid var(--cyber-border);
  border-radius: var(--radius-sm);
  padding: 0.15em 0.4em;
  font-size: 0.88em;
  color: var(--cyber-cyan);
}
.cyber-prose pre {
  background: var(--cyber-bg-secondary);
  border: 1px solid var(--cyber-border);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.5rem;
  margin: 1.5rem 0;
  overflow-x: auto;
  position: relative;
}
.cyber-prose pre::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyber-cyan), transparent);
}
.cyber-prose pre code {
  background: none; border: none; padding: 0; font-size: 0.88rem;
  color: var(--cyber-jade);
}
.cyber-prose table {
  width: 100%; border-collapse: collapse; margin: 1.5rem 0;
  font-size: 0.9rem;
}
.cyber-prose th {
  background: var(--cyber-bg-tertiary);
  border: 1px solid var(--cyber-border);
  padding: 0.6rem 1rem;
  color: var(--cyber-cyan);
  font-family: var(--font-mono);
  text-align: left;
}
.cyber-prose td {
  border: 1px solid var(--cyber-border);
  padding: 0.5rem 1rem;
}

/* ---- TOC ---- */
.toc ol, .toc ul { list-style: none; padding-left: 0.5rem; }
.toc li { margin: 0.3rem 0; }
.toc a { color: var(--cyber-text-dim); font-size: 0.85rem; transition: color 0.2s; }
.toc a:hover { color: var(--cyber-cyan); }
.toc ol ol, .toc ul ul { padding-left: 1rem; }

/* ---- Pagination ---- */
.pagination .cyber-btn { min-width: 40px; text-align: center; }

/* ---- Footer ---- */
.cyber-footer { }
.fill-cyber-bg-secondary { fill: var(--cyber-bg-secondary); }
.fill-cyber-bg-tertiary { fill: var(--cyber-bg-tertiary); }
.stroke-cyber-cyan\/20 { stroke: rgba(0, 240, 255, 0.20); }
.stroke-cyber-gold\/20 { stroke: rgba(212, 160, 23, 0.15); }

/* ---- Neon Flicker (optional, controlled by JS) ---- */
.neon-flicker { animation: neon-flicker 3s linear infinite; }
@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% { opacity: 1; }
  20%, 24%, 55% { opacity: 0.3; }
}

/* ---- Scroll Reveal ---- */
.scroll-hidden { opacity: 0; transform: translateY(30px); transition: all 0.6s ease; }
.scroll-revealed { opacity: 1; transform: translateY(0); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .cyber-nav .nav-list {
    position: fixed; top: 58px; left: 0; right: 0; bottom: 0;
    background: rgba(8, 8, 16, 0.95);
    flex-direction: column; align-items: center; justify-content: center;
    gap: 1.5rem; display: none;
  }
  .cyber-nav.open .nav-list { display: flex; }
  .cyber-nav .nav-link { font-size: 1.2rem; }
  .hero-subtitle { font-size: 0.7rem; }
  .cyber-prose { font-size: 1rem; }
}

@media (max-width: 640px) {
  .index-container, .post-container, .archive-container,
  .category-container, .tag-container, .page-container { padding: 1rem; }
  .cyber-card { padding: 1rem !important; }
  .post-title { font-size: 1.4rem !important; }
  .cyber-prose h1 { font-size: 1.5rem; }
  .cyber-prose h2 { font-size: 1.3rem; }
  .cyber-prose h3 { font-size: 1.1rem; }
}

/* ---- Utility: Colors ---- */
.text-cyber-cyan { color: var(--cyber-cyan); }
.text-cyber-cyan\/60 { color: rgba(0, 240, 255, 0.6); }
.text-cyber-cyan\/40 { color: rgba(0, 240, 255, 0.4); }
.text-cyber-gold { color: var(--cyber-gold); }
.text-cyber-gold\/60 { color: rgba(212, 160, 23, 0.6); }
.text-cyber-gray { color: var(--cyber-text-dim); }
.text-cyber-gray\/40 { color: rgba(120, 120, 160, 0.4); }
.text-cyber-gray\/60 { color: rgba(120, 120, 160, 0.6); }
.text-cyber-gray\/70 { color: rgba(120, 120, 160, 0.7); }
.border-cyber-cyan\/10 { border-color: rgba(0, 240, 255, 0.10); }
.border-cyber-cyan\/30 { border-color: rgba(0, 240, 255, 0.30); }
.bg-cyber-bg-secondary { background: var(--cyber-bg-secondary); }
.bg-cyber-bg-tertiary { background: var(--cyber-bg-tertiary); }

/* ---- Utility: Layout ---- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

/* ---- Utility: Spacing ---- */
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }
.mt-auto { margin-top: auto; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.ml-1 { margin-left: 0.25rem; }
.ml-auto { margin-left: auto; }
.mr-2 { margin-right: 0.5rem; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.p-0 { padding: 0; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }
.py-20 { padding-top: 5rem; padding-bottom: 5rem; }
.pt-4 { padding-top: 1rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-8 { padding-bottom: 2rem; }
.pl-4 { padding-left: 1rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* ---- Utility: Sizing ---- */
.w-10 { width: 2.5rem; }
.w-32 { width: 8rem; }
.w-48 { width: 12rem; }
.w-72 { width: 18rem; }
.w-full { width: 100%; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.min-h-screen { min-height: 100vh; }
.shrink-0 { flex-shrink: 0; }

/* ---- Utility: Typography ---- */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.text-6xl { font-size: 3.75rem; }
.font-bold { font-weight: 700; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-mono { font-family: var(--font-mono); }
.leading-tight { line-height: 1.25; }
.leading-relaxed { line-height: 1.625; }
.leading-normal { line-height: 1.5; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }
.italic { font-style: italic; }
.no-underline { text-decoration: none; }
.whitespace-nowrap { white-space: nowrap; }

/* ---- Utility: Position & Z-Index ---- */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed { position: fixed; }
.sticky { position: sticky; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0 { top: 0; }
.top-full { top: 100%; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.z-0 { z-index: 0; }
.z-10 { z-index: 10; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }
.pointer-events-none { pointer-events: none; }

/* ---- Utility: Display & Visibility ---- */
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }
.list-none { list-style: none; }

/* ---- Utility: Overflow ---- */
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.overflow-y-auto { overflow-y: auto; }

/* ---- Utility: Borders ---- */
.border { border: 1px solid var(--cyber-border); }
.border-t { border-top: 1px solid var(--cyber-border); }
.border-b { border-bottom: 1px solid var(--cyber-border); }
.rounded { border-radius: var(--radius-sm); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

/* ---- Utility: Transitions ---- */
.transition-all { transition: all 0.3s ease; }
.duration-300 { transition-duration: 0.3s; }

/* ---- Utility: Line Clamp ---- */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Utility: Canvas ---- */
#particles-canvas { pointer-events: none; }

/* ---- Responsive Grid ---- */
@media (min-width: 640px) {
  .sm\:flex-row { flex-direction: row; }
  .sm\:items-center { align-items: center; }
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:block { display: block; }
  .sm\:hidden { display: none; }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:hidden { display: none; }
}

/* ---- Focus state ---- */
.focus\:w-48:focus { width: 12rem; }
