/* ============================================================
   wh.css — wanghao.games Design System v3
   Aurora + Glassmorphism, unified across all pages
   Light/Dark theme support with design tokens
   ============================================================ */

/* ── Design Tokens ────────────────────────────────────────── */
:root {
  /* Spacing scale */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 2rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  
  /* Typography scale */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
  
  /* Border radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.15);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.2);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 30px rgba(94,220,130,0.15);
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  
  /* Layout */
  --nav-h: 64px;
  --max-w: 1100px;
  --transition: 0.22s cubic-bezier(.4,0,.2,1);
}

/* ── Dark Theme (default) ─────────────────────────────────── */
[data-theme="dark"],
:root:not([data-theme="light"]) {
  --bg-primary: #0a0a1a;
  --bg-secondary: rgba(255,255,255,0.05);
  --bg-secondary-hover: rgba(255,255,255,0.09);
  --bg-card: rgba(255,255,255,0.06);
  --bg-card-hover: rgba(255,255,255,0.10);
  --text-primary: #f0f0f8;
  --text-secondary: rgba(240,240,248,0.60);
  --text-muted: rgba(240,240,248,0.38);
  --border-color: rgba(255,255,255,0.10);
  --border-hover: rgba(255,255,255,0.22);
  --accent: #7c6aff;
  --accent2: #a78bfa;
  --accent3: #38bdf8;
  --green: #34d399;
  --yellow: #fbbf24;
  --red: #f87171;
  
  /* Aurora colors for dark theme — more visible */
  --aurora-1: #7c6aff;
  --aurora-2: #38bdf8;
  --aurora-3: #a78bfa;
  --aurora-opacity: 0.30;
  
  /* Nav scrolled background */
  --nav-bg: rgba(10,10,26,0.80);
}

/* ── Light Theme ──────────────────────────────────────────── */
[data-theme="light"] {
  --bg-primary: #f0f2f8;
  --bg-secondary: rgba(255,255,255,0.55);
  --bg-secondary-hover: rgba(255,255,255,0.75);
  --bg-card: rgba(255,255,255,0.65);
  --bg-card-hover: rgba(255,255,255,0.85);
  --text-primary: #1a1a2e;
  --text-secondary: #4a4a6a;
  --text-muted: #8888aa;
  --border-color: rgba(255,255,255,0.85);
  --border-hover: rgba(124,106,255,0.30);
  --accent: #6366f1;
  --accent2: #8b5cf6;
  --accent3: #0ea5e9;
  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  
  /* Aurora colors for light theme — vivid pastels */
  --aurora-1: #a78bfa;
  --aurora-2: #67e8f9;
  --aurora-3: #c084fc;
  --aurora-opacity: 0.40;
  
  /* Nav scrolled background */
  --nav-bg: rgba(240,242,248,0.72);
}

/* ── Reset ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}
/* Subtle noise texture overlay for depth */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme="light"] body::before {
  opacity: 0.012;
}
/* Light theme: soft gradient background for depth */
[data-theme="light"] body {
  background: linear-gradient(160deg, #eef0fa 0%, #f0f2f8 30%, #e8edf8 60%, #f2eef9 100%);
  background-attachment: fixed;
}
/* Light theme: extra aurora blob coverage for mid/lower page */
[data-theme="light"] .aurora-blob:nth-child(1) {
  width: 900px; height: 900px;
  top: -200px; left: -150px;
  opacity: 0.45;
}
[data-theme="light"] .aurora-blob:nth-child(2) {
  width: 800px; height: 800px;
  top: 30%; right: -200px;
  opacity: 0.35;
}
[data-theme="light"] .aurora-blob:nth-child(3) {
  width: 750px; height: 750px;
  bottom: -100px; left: 20%;
  opacity: 0.38;
}
/* Light theme: stronger card glass effect */
[data-theme="light"] .card,
[data-theme="light"] .stat-card,
[data-theme="light"] .project-card,
[data-theme="light"] .blog-card,
[data-theme="light"] .game-card,
[data-theme="light"] .tl-content,
[data-theme="light"] .contact-channel,
[data-theme="light"] .contact-form-wrap,
[data-theme="light"] .post-item {
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: 
    0 4px 24px rgba(124,106,255,0.08),
    0 1px 4px rgba(0,0,0,0.05),
    inset 0 1px 0 rgba(255,255,255,0.9);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}
[data-theme="light"] .card:hover,
[data-theme="light"] .stat-card:hover,
[data-theme="light"] .project-card:hover,
[data-theme="light"] .blog-card:hover,
[data-theme="light"] .game-card:hover,
[data-theme="light"] .tl-content:hover,
[data-theme="light"] .contact-channel:hover,
[data-theme="light"] .post-item:hover {
  background: rgba(255,255,255,0.78);
  border-color: rgba(124,106,255,0.30);
  box-shadow:
    0 12px 40px rgba(124,106,255,0.12),
    0 4px 12px rgba(0,0,0,0.06),
    inset 0 1px 0 rgba(255,255,255,1);
  transform: translateY(-3px);
}
/* Light theme: nav glass */
[data-theme="light"] .nav.scrolled {
  background: rgba(240,242,248,0.72);
  border-color: rgba(255,255,255,0.80);
  box-shadow: 0 4px 24px rgba(124,106,255,0.06);
}
/* Light theme: buttons refinement */
[data-theme="light"] .btn-primary {
  box-shadow: 0 4px 20px rgba(99,102,241,0.30);
}
[data-theme="light"] .btn-primary:hover {
  box-shadow: 0 8px 32px rgba(99,102,241,0.40);
}
[data-theme="light"] .btn-ghost {
  background: rgba(255,255,255,0.65);
  border-color: rgba(124,106,255,0.20);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="light"] .btn-ghost:hover {
  background: rgba(255,255,255,0.85);
  border-color: rgba(124,106,255,0.40);
  box-shadow: 0 4px 16px rgba(124,106,255,0.10);
}
/* Light theme: section title subtle gradient */
[data-theme="light"] .section-title {
  background: linear-gradient(135deg, #1a1a2e 0%, #4338ca 60%, #6366f1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Light theme: badges more vivid */
[data-theme="light"] .badge-product {
  background: rgba(99,102,241,0.12);
  border-color: rgba(99,102,241,0.35);
  color: #4f46e5;
}
[data-theme="light"] .badge-ai {
  background: rgba(14,165,233,0.10);
  border-color: rgba(14,165,233,0.35);
  color: #0284c7;
}
[data-theme="light"] .badge-game {
  background: rgba(16,185,129,0.10);
  border-color: rgba(16,185,129,0.35);
  color: #059669;
}
[data-theme="light"] .badge-tool {
  background: rgba(245,158,11,0.10);
  border-color: rgba(245,158,11,0.35);
  color: #d97706;
}
/* Light theme: hero sub text stronger */
[data-theme="light"] .hero-sub {
  color: #3d3d5c;
}
/* Light theme: card link color */
[data-theme="light"] .card-link {
  color: #6366f1;
}
[data-theme="light"] .card-link:hover {
  color: #4338ca;
}
/* Light theme: stat number color pop */
[data-theme="light"] .stat-num {
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
/* Light theme: footer refinement */
[data-theme="light"] .footer {
  border-color: rgba(124,106,255,0.15);
}
[data-theme="light"] .footer-social a {
  background: rgba(255,255,255,0.65);
  border: 1px solid rgba(124,106,255,0.12);
  box-shadow: 0 2px 8px rgba(124,106,255,0.06);
}
[data-theme="light"] .footer-social a:hover {
  background: rgba(255,255,255,0.85);
  border-color: rgba(124,106,255,0.30);
  box-shadow: 0 4px 16px rgba(124,106,255,0.12);
}
/* Light theme: filter button active */
[data-theme="light"] .filter-btn.active {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-color: transparent;
  box-shadow: 0 4px 16px rgba(99,102,241,0.30);
}
/* Light theme: stack tags */
[data-theme="light"] .stack-tag {
  background: rgba(255,255,255,0.70);
  border-color: rgba(124,106,255,0.15);
}
/* Light theme: arch diagram */
[data-theme="light"] .arch-diagram {
  background: rgba(255,255,255,0.55);
  border-color: rgba(255,255,255,0.9);
  box-shadow: 0 4px 24px rgba(124,106,255,0.06);
}
[data-theme="light"] .arch-box {
  background: rgba(255,255,255,0.70);
  border-color: rgba(124,106,255,0.12);
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ── Aurora Background ───────────────────────────────────── */
.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.aurora-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: var(--aurora-opacity);
  animation: aurora-drift 18s ease-in-out infinite alternate;
}
.aurora-blob:nth-child(1) {
  width: 800px; height: 800px;
  background: radial-gradient(circle, var(--aurora-1) 0%, transparent 65%);
  top: -250px; left: -200px;
  animation-duration: 20s;
}
.aurora-blob:nth-child(2) {
  width: 700px; height: 700px;
  background: radial-gradient(circle, var(--aurora-2) 0%, transparent 65%);
  top: 25%; right: -250px;
  animation-duration: 25s;
  animation-delay: -8s;
}
.aurora-blob:nth-child(3) {
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--aurora-3) 0%, transparent 65%);
  bottom: -150px; left: 25%;
  animation-duration: 22s;
  animation-delay: -4s;
}
@keyframes aurora-drift {
  0%   { transform: translate(0,0) scale(1); }
  33%  { transform: translate(60px,-40px) scale(1.08); }
  66%  { transform: translate(-40px,60px) scale(0.95); }
  100% { transform: translate(30px,30px) scale(1.05); }
}

/* ── Nav ─────────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-lg);
  transition: background var(--transition), backdrop-filter var(--transition), border-color var(--transition);
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-color: var(--border-color);
}
.nav-logo {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  flex-shrink: 0;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-links a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-secondary); }
.nav-links a.active {
  color: var(--text-primary);
  background: var(--bg-secondary);
  position: relative;
}
.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

/* Theme Toggle Button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
  margin-right: var(--space-sm);
}
.theme-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
}
/* Show sun icon in dark mode (to switch to light) */
.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ── Main layout ─────────────────────────────────────────── */
main {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: calc(var(--nav-h) + 3rem) var(--space-lg) 4rem;
}

/* ── Fade-up animation ───────────────────────────────────── */
.fade-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.fade-up.visible {
  opacity: 1;
  transform: none;
}

/* ── Hero (index) ────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: var(--space-2xl) 0 var(--space-2xl);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  width: 100%;
}

/* Hero floating animation — applied to inner content only */
.hero-float .hero-eyebrow,
.hero-float .hero-name-large,
.hero-float .hero-sub,
.hero-float .hero-cta {
  animation: hero-float 6s ease-in-out infinite;
}
@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.hero-eyebrow {
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 1.2rem;
}

/* Large gradient name with aurora gradient animation */
.hero-name-large {
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, 
    #fff 0%, 
    var(--accent2) 25%, 
    var(--accent3) 50%, 
    var(--accent) 75%,
    #fff 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
  animation: gradient-shift 8s ease infinite;
}
[data-theme="light"] .hero-name-large {
  background: linear-gradient(135deg, 
    #2d1b69 0%, 
    #6366f1 25%, 
    #0ea5e9 50%, 
    #8b5cf6 75%,
    #2d1b69 100%
  );
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Keep original hero-title for backward compatibility */
.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #fff 30%, var(--accent2) 70%, var(--accent3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 1.5rem;
}
[data-theme="light"] .hero-title {
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent2) 70%, var(--accent3) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2.5rem;
  line-height: 1.75;
}
.hero-cta {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* Scroll indicator */
.scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  animation: scroll-bounce 2s ease-in-out infinite;
  opacity: 0.6;
  transition: opacity var(--transition);
}
.scroll-indicator:hover {
  opacity: 1;
}
@keyframes scroll-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(8px); }
}

/* ── Page hero (inner pages) ─────────────────────────────── */
.page-hero {
  padding: 3rem 0 2.5rem;
}
.page-title {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent2) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-md);
}
.page-sub {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  line-height: 1.75;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px rgba(124,106,255,0.35);
}
.btn-primary:hover {
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 10px 35px rgba(124,106,255,0.5);
}
.btn-ghost {
  border: 1px solid var(--border-hover);
  color: var(--text-primary);
  background: var(--bg-secondary);
}
.btn-ghost:hover {
  background: var(--bg-secondary-hover);
  border-color: var(--accent2);
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 24px rgba(124,106,255,0.12);
}

/* ── Section ─────────────────────────────────────────────── */
.section {
  margin-bottom: var(--space-2xl);
}
.section-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  color: var(--text-primary);
}

/* ── Stats row ───────────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-2xl);
  padding-top: var(--space-lg);
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem 2.75rem;
  text-align: center;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-6px) scale(1.04);
  box-shadow: 0 12px 36px rgba(124,106,255,0.15);
}
.stat-num {
  font-size: var(--text-4xl);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent2), var(--accent3));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: var(--text-sm); color: var(--text-secondary); margin-top: 0.25rem; }

/* ── Card grid ───────────────────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2rem;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), background var(--transition), box-shadow 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
/* Card tilt handled via .fade-up.visible rules in stagger section */
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-6px) rotate(0deg) scale(1.02);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 40px rgba(124,106,255,0.15);
}
.card-icon { font-size: 2rem; margin-bottom: var(--space-md); }
.card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: var(--space-sm); }
.card p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; }
.card-featured { border-color: rgba(124,106,255,0.25); }
.card-featured:hover { border-color: var(--accent2); }
.card-tag {
  display: inline-block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: 0.75rem;
}
.card-link {
  display: inline-block;
  margin-top: var(--space-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent2);
  transition: color var(--transition);
}
.card-link:hover { color: var(--accent3); }

/* ── Post list ───────────────────────────────────────────── */
.post-list { display: flex; flex-direction: column; gap: var(--space-sm); }
.post-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: border-color var(--transition), background var(--transition), transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow var(--transition);
  gap: var(--space-md);
}
.post-item:hover { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateX(6px); box-shadow: 0 4px 20px rgba(124,106,255,0.08); }
.post-title { font-size: 0.95rem; font-weight: 500; }
.post-date { font-size: var(--text-xs); color: var(--text-muted); flex-shrink: 0; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.badge-product { background: rgba(124,106,255,0.15); border-color: rgba(124,106,255,0.3); color: var(--accent2); }
.badge-ai      { background: rgba(56,189,248,0.12); border-color: rgba(56,189,248,0.3); color: var(--accent3); }
.badge-game    { background: rgba(52,211,153,0.12); border-color: rgba(52,211,153,0.3); color: var(--green); }
.badge-tool    { background: rgba(251,191,36,0.12); border-color: rgba(251,191,36,0.3); color: var(--yellow); }

/* ── Timeline ────────────────────────────────────────────── */
.timeline { position: relative; padding-left: var(--space-lg); }
.timeline::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), transparent);
}
.tl-item {
  position: relative;
  margin-bottom: 3rem;
}
.tl-dot {
  position: absolute;
  left: -2.45rem;
  top: 0.35rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 12px rgba(167,139,250,0.6);
}
.tl-content {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition);
}
.tl-content:hover { border-color: var(--border-hover); }
.tl-year {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent2);
  margin-bottom: var(--space-sm);
}
.tl-content h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: var(--space-sm); }
.tl-content p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; margin-bottom: var(--space-md); }
.tl-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ── Filter tabs ─────────────────────────────────────────── */
.filter-tabs, .blog-categories {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}
.filter-btn {
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-secondary);
  transition: all var(--transition);
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Projects grid ───────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
/* Card tilt handled via .fade-up.visible rules below */
.project-card:hover { border-color: var(--border-hover); transform: translateY(-6px) rotate(0deg) scale(1.02); box-shadow: 0 12px 40px rgba(124,106,255,0.12); }
.project-header { display: flex; justify-content: space-between; align-items: flex-start; }
.project-icon { font-size: 2rem; }
.project-meta { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.project-card h3 { font-size: 1.05rem; font-weight: 700; }
.project-card p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; flex: 1; }
.project-stack { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.stack-tag {
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.project-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.project-status { font-size: var(--text-xs); font-weight: 600; }
.status-live  { color: var(--green); }
.status-wip   { color: var(--yellow); }
.status-past  { color: var(--text-muted); }

/* ── Blog list ───────────────────────────────────────────── */
.blog-list { display: flex; flex-direction: column; gap: 1.25rem; }
.blog-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition);
}
.blog-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.blog-card-meta { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: 0.75rem; flex-wrap: wrap; }
.blog-date { font-size: var(--text-xs); color: var(--text-muted); margin-left: auto; }
.blog-card-title { font-size: 1.2rem; font-weight: 700; margin-bottom: var(--space-sm); line-height: 1.35; }
.blog-card-excerpt { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; margin-bottom: var(--space-md); }

/* ── Games grid ──────────────────────────────────────────── */
.games-grid { display: flex; flex-direction: column; gap: 1.5rem; }
.game-card {
  display: flex;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition), transform var(--transition);
}
.game-card:hover { border-color: var(--border-hover); transform: translateY(-2px); }
.game-cover {
  width: 180px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a0533, #0d1f4a);
  display: flex;
  align-items: center;
  justify-content: center;
}
.game-cover-placeholder { background: linear-gradient(135deg, #1a0533, #0d1f4a); }
.game-cover-icon { font-size: 3rem; }
.game-info { padding: 1.5rem; flex: 1; }
.game-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.game-info h3 { font-size: 1.1rem; font-weight: 700; }
.game-info p { font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.65; margin-bottom: var(--space-md); }

/* ── Link AI architecture ────────────────────────────────── */
.arch-diagram {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  max-width: 720px;
  margin: 0 auto;
}
.arch-layer { margin-bottom: var(--space-sm); }
.arch-label {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.arch-boxes { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.arch-box {
  padding: 0.45rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.arch-box-primary {
  background: rgba(124,106,255,0.15);
  border-color: rgba(124,106,255,0.4);
  color: var(--accent2);
  font-weight: 700;
}
.arch-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 1.2rem;
  margin: var(--space-sm) 0;
}

/* ── Contact ─────────────────────────────────────────────── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
}
.contact-info h2 { font-size: var(--text-3xl); font-weight: 700; margin-bottom: var(--space-md); }
.contact-channels { display: flex; flex-direction: column; gap: 0.75rem; }
.contact-channel {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: border-color var(--transition), background var(--transition);
}
.contact-channel:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.channel-icon { font-size: 1.5rem; }
.channel-label { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.channel-value { font-size: 0.95rem; font-weight: 500; }
.contact-form-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.contact-form { display: flex; flex-direction: column; gap: 1.25rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: var(--text-sm); font-weight: 600; color: var(--text-secondary); }
.form-group input,
.form-group textarea {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition);
  resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent2);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

/* ── Form success ───────────────────────────────────────── */
.form-success {
  text-align: center;
  padding: var(--space-lg);
}
.form-success h3 { font-size: 1.2rem; font-weight: 700; }

/* ── Footer ──────────────────────────────────────────────── */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem var(--space-lg);
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.footer a { color: var(--text-muted); transition: color var(--transition); }
.footer a:hover { color: var(--text-secondary); }
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.footer-social {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}
.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  transition: background var(--transition), color var(--transition);
}
.footer-social a:hover {
  background: var(--bg-secondary-hover);
  color: var(--text-primary);
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 1.25rem; }
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-h); left: 0; right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--space-md);
    border-bottom: 1px solid var(--border-color);
    gap: 0.25rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.75rem 1rem; }
  /* hide active underline on mobile — doesn't look right in vertical layout */
  .nav-links a.active::after { display: none; }
  .nav-toggle { display: flex; }
  
  /* Show theme toggle in mobile menu */
  .theme-toggle { margin-right: 0; }

  main { padding: calc(var(--nav-h) + 2rem) 1.25rem 3rem; }
  .hero { padding: 3rem 0 2rem; }
  .card-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .game-card { flex-direction: column; }
  .game-cover { width: 100%; height: 160px; }
  .stats-row { gap: var(--space-md); }
  .stat-card { padding: 1.25rem 1.75rem; }
  /* Mobile: reduce blur for performance */
  .aurora-blob { filter: blur(60px); }
  .card, .stat-card, .project-card, .blog-card, .game-card,
  .tl-content, .contact-channel, .contact-form-wrap, .post-item {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}

/* ── Staggered entrance animation ────────────────────────── */
.fade-up .card,
.fade-up .stat-card,
.fade-up .project-card,
.fade-up .blog-card,
.fade-up .game-card,
.fade-up .post-item,
.fade-up .tl-item,
.fade-up .contact-channel {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-up.visible .card,
.fade-up.visible .stat-card,
.fade-up.visible .project-card,
.fade-up.visible .blog-card,
.fade-up.visible .game-card,
.fade-up.visible .post-item,
.fade-up.visible .tl-item,
.fade-up.visible .contact-channel {
  opacity: 1;
  transform: translateY(0);
}
/* Tilt applied via transition end-state: combine translateY(0) + rotate */
.fade-up.visible .card:nth-child(odd) { transform: translateY(0) rotate(-0.5deg); }
.fade-up.visible .card:nth-child(even) { transform: translateY(0) rotate(0.5deg); }
.fade-up.visible .project-card:nth-child(odd) { transform: translateY(0) rotate(-0.4deg); }
.fade-up.visible .project-card:nth-child(even) { transform: translateY(0) rotate(0.4deg); }
/* Stagger delays via nth-child */
.fade-up.visible .card:nth-child(1),
.fade-up.visible .stat-card:nth-child(1),
.fade-up.visible .project-card:nth-child(1),
.fade-up.visible .blog-card:nth-child(1),
.fade-up.visible .post-item:nth-child(1),
.fade-up.visible .tl-item:nth-child(1) { transition-delay: 0ms; }
.fade-up.visible .card:nth-child(2),
.fade-up.visible .stat-card:nth-child(2),
.fade-up.visible .project-card:nth-child(2),
.fade-up.visible .blog-card:nth-child(2),
.fade-up.visible .post-item:nth-child(2),
.fade-up.visible .tl-item:nth-child(2) { transition-delay: 80ms; }
.fade-up.visible .card:nth-child(3),
.fade-up.visible .stat-card:nth-child(3),
.fade-up.visible .project-card:nth-child(3),
.fade-up.visible .blog-card:nth-child(3),
.fade-up.visible .post-item:nth-child(3),
.fade-up.visible .tl-item:nth-child(3) { transition-delay: 160ms; }
.fade-up.visible .card:nth-child(4),
.fade-up.visible .stat-card:nth-child(4),
.fade-up.visible .project-card:nth-child(4),
.fade-up.visible .blog-card:nth-child(4),
.fade-up.visible .post-item:nth-child(4),
.fade-up.visible .tl-item:nth-child(4) { transition-delay: 240ms; }
.fade-up.visible .card:nth-child(5),
.fade-up.visible .blog-card:nth-child(5),
.fade-up.visible .tl-item:nth-child(5) { transition-delay: 320ms; }
.fade-up.visible .card:nth-child(6),
.fade-up.visible .blog-card:nth-child(6),
.fade-up.visible .tl-item:nth-child(6) { transition-delay: 400ms; }

/* ── Clickable card style ────────────────────────────────── */
a.card-clickable {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
}
a.card-clickable .card-link {
  margin-top: auto;
}

/* ── Contact page layout (2-col) ─────────────────────────── */
.contact-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 3rem;
  align-items: start;
}
@media (max-width: 768px) {
  .contact-layout { grid-template-columns: 1fr; }
}
.contact-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}
.contact-item:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.contact-icon { font-size: 1.5rem; }
.contact-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.contact-value {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  transition: color var(--transition);
}
.contact-value:hover { color: var(--accent2); }
.contact-channels {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* ── Theme transition: all children ──────────────────────── */
*, *::before, *::after {
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}
/* Exclude elements where transition causes jank */
.aurora-blob, .aurora-blob * { transition: none !important; }
canvas { transition: none !important; }

/* ── Performance: will-change for animated aurora ────────── */
.aurora-blob {
  will-change: transform;
}

/* ── Spritesheet preload hint (added via HTML) ───────────── */

/* ── Hero Decorative Floating Symbols ────────────────────── */
.hero-deco {
  position: absolute;
  pointer-events: none;
  font-size: 2rem;
  opacity: 0.35;
  animation: deco-float 6s ease-in-out infinite;
  color: var(--accent2);
  text-shadow: 0 0 20px rgba(167,139,250,0.4);
  z-index: 0;
}
.hero-deco:nth-child(1) {
  top: 8%; left: 12%;
  font-size: 2.5rem;
  animation-duration: 7s;
  color: var(--accent3);
}
.hero-deco:nth-child(2) {
  top: 18%; right: 14%;
  font-size: 1.8rem;
  animation-duration: 5s;
  animation-delay: -2s;
}
.hero-deco:nth-child(3) {
  bottom: 22%; left: 8%;
  font-size: 1.5rem;
  animation-duration: 8s;
  animation-delay: -4s;
  color: var(--accent);
}
.hero-deco:nth-child(4) {
  bottom: 30%; right: 10%;
  font-size: 2rem;
  animation-duration: 6s;
  animation-delay: -1s;
}
.hero-deco:nth-child(5) {
  top: 45%; left: 5%;
  font-size: 1.3rem;
  animation-duration: 9s;
  animation-delay: -3s;
  color: var(--green);
}
@keyframes deco-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(5deg); }
  50% { transform: translateY(-6px) rotate(-3deg); }
  75% { transform: translateY(-15px) rotate(2deg); }
}
[data-theme="light"] .hero-deco {
  opacity: 0.25;
  text-shadow: 0 0 12px rgba(99,102,241,0.3);
}
@media (max-width: 768px) {
  .hero-deco { font-size: 1.2rem !important; opacity: 0.2; }
}

/* ── Card icon bounce on hover ───────────────────────────── */
.card:hover .card-icon {
  animation: icon-bounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes icon-bounce {
  0% { transform: scale(1); }
  40% { transform: scale(1.25) rotate(-5deg); }
  70% { transform: scale(0.95) rotate(3deg); }
  100% { transform: scale(1) rotate(0deg); }
}

/* ── Stat number count-up glow on hover ──────────────────── */
.stat-card:hover .stat-num {
  text-shadow: 0 0 20px rgba(167,139,250,0.4);
}

/* ── Print: hide decorative elements ─────────────────────── */
@media print {
  .aurora, #pixel-sprite-canvas, .pixel-sprites-canvas, .hero-deco { display: none !important; }
  .nav { position: static; }
  body::before { display: none; }
}

/* ── Game cover gradient improvements ────────────────────── */
.game-cover-placeholder {
  background: linear-gradient(135deg, #2d1b69 0%, #1e3a5f 50%, #0d1f4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.game-cover-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 40%, rgba(124,106,255,0.3) 0%, transparent 60%);
}
.game-cover-icon {
  font-size: 3.5rem;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.3));
}

/* ── Filmstrip: Life Moments ─────────────────────────────── */
.filmstrip-section {
  overflow: hidden;
  position: relative;
  padding: var(--space-xl) 0 var(--space-lg);
}
.filmstrip-section .section-title {
  padding: 0 2rem;
}
.filmstrip-section .section-sub {
  padding: 0 2rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.filmstrip-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  /* Fade edges */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}
.filmstrip-track {
  display: flex;
  gap: 1rem;
  width: max-content;
  animation: filmstrip-scroll 60s linear infinite;
}
.filmstrip-track:hover {
  animation-play-state: paused;
}
@keyframes filmstrip-scroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.filmstrip-item {
  flex-shrink: 0;
  width: 280px;
  height: 200px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
  transition: border-color var(--transition), transform 0.3s ease;
}
.filmstrip-item:hover {
  border-color: var(--border-hover);
  transform: scale(1.03);
}
.filmstrip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.filmstrip-cta {
  text-align: center;
  margin-top: 1.5rem;
  padding: 0 2rem;
}
.filmstrip-cta a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition);
}
.filmstrip-cta a:hover {
  color: var(--accent2);
}
.filmstrip-cta .xhs-icon {
  width: 18px;
  height: 18px;
}
@media (max-width: 768px) {
  .filmstrip-item { width: 220px; height: 160px; }
  .filmstrip-track { gap: 0.75rem; }
}
