/* ============================================================
   Leevis 个人主页 — 全局样式
   设计系统: UI/UX Pro Max §4-§7
   ============================================================ */

/* ----- CSS Reset ----- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ============================================================
   Design Tokens: Light Mode (default)
   ============================================================ */
:root {
  --surface-primary: #F5F0EB;
  --surface-card: #FAF8F5;
  --text-primary: #0F0F0F;
  --text-secondary: #5C5C5C;
  --text-tertiary: #8E8E8E;
  --border-subtle: rgba(0, 0, 0, 0.06);
  --accent: #6C4DF6;
  --accent-warm: #FF5C28;
  --brand-red: #FF2442;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.08);
  --space-4: 4px;  --space-8: 8px;  --space-12: 12px;
  --space-16: 16px; --space-20: 20px; --space-24: 24px;
  --space-32: 32px; --space-48: 48px; --space-64: 64px;
  --radius-sm: 8px; --radius-md: 10px; --radius-lg: 12px; --radius-xl: 16px;
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms; --duration-normal: 200ms; --duration-slow: 300ms;
  --nav-bg: rgba(250, 250, 250, 0.85);
  --accent-subtle: rgba(108, 77, 246, 0.08);
  color-scheme: light;
}

/* ============================================================
   Design Tokens: Dark Mode
   ============================================================ */
[data-theme="dark"] {
  --surface-primary: #0A0A0A;
  --surface-card: #141414;
  --text-primary: #F5F5F5;
  --text-secondary: #9E9E9E;
  --text-tertiary: #6E6E6E;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --accent: #8B6FFF;
  --accent-warm: #FF7845;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.2), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-card-hover: 0 2px 4px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.3);
  --nav-bg: rgba(10, 10, 10, 0.85);
  --accent-subtle: rgba(139, 111, 255, 0.12);
  color-scheme: dark;
}

/* ----- Theme Transition ----- */
body, header, section, footer, a, button, .tutorial-card, .stat-card, .nav {
  transition: background var(--duration-slow) var(--ease-out),
              color var(--duration-slow) var(--ease-out),
              border-color var(--duration-slow) var(--ease-out),
              box-shadow var(--duration-slow) var(--ease-out);
}

/* ============================================================
   Base
   ============================================================ */
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', 'PingFang SC', 'Noto Sans SC', -apple-system, sans-serif;
  font-size: 16px; font-weight: 400; line-height: 1.6;
  color: var(--text-primary); background: var(--surface-primary);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { line-height: 1.3; }
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; display: block; }
.container { max-width: 90vw; margin: 0 auto; padding: 0 24px; }
code {
  font-family: 'JetBrains Mono', 'Consolas', monospace;
  font-size: 13px;
}

/* ============================================================
   Page Layout (two-column)
   ============================================================ */
.page-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
  max-width: 90vw;
  margin: 0 auto;
  padding: 56px 24px 48px;
  align-items: start;
  min-height: calc(100vh - 56px);
}

.sidebar {
  padding-top: 32px;
}

.main-content {
  min-width: 0; /* prevent grid blowout */
  padding-top: 32px;
}

/* ----- Focus (UI/UX Pro Max §1) ----- */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* ----- Skip Link (§1) ----- */
.skip-link { position: absolute; top: -100%; left: 16px; background: var(--accent); color: #fff; padding: 8px 16px; border-radius: var(--radius-sm); z-index: 10000; font-size: 14px; }
.skip-link:focus { top: 8px; }

/* ----- Reduced Motion (§7) ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ----- Selection ----- */
::selection { background: var(--accent); color: #fff; }

/* ============================================================
   Nav Bar (fixed top)
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: 56px; display: flex; align-items: center;
  background: var(--nav-bg); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--duration-normal) var(--ease-out),
              background var(--duration-slow) var(--ease-out);
}
.nav.scrolled { border-bottom-color: var(--border-subtle); }
[data-theme="dark"] .nav { background: var(--nav-bg); }

.nav-inner {
  max-width: 90vw; width: 100%; margin: 0 auto;
  padding: 0 24px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo { font-size: 18px; font-weight: 600; color: var(--text-primary); display: flex; align-items: center; gap: var(--space-8); }
.nav-logo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.nav-actions { display: flex; align-items: center; gap: var(--space-12); }

.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out);
}
.nav-link:hover { color: var(--text-primary); }

/* ----- Theme Toggle Button ----- */
.theme-toggle {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--border-subtle); background: var(--surface-card);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-primary); font-size: 18px;
  transition: all var(--duration-fast) var(--ease-out);
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Section Common
   ============================================================ */
.section { padding: var(--space-48) 0; }
.section-title { font-size: 24px; font-weight: 600; text-align: center; margin-bottom: var(--space-8); }
.section-line {
  width: 24px; height: 2px; background: var(--accent); border-radius: 1px;
  margin: 0 auto var(--space-24);
}

/* ============================================================
   Hero
   ============================================================ */
.hero { padding: calc(56px + var(--space-64)) 0 var(--space-64); text-align: center; }
.hero-avatar {
  width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  margin: 0 auto var(--space-24);
  border: 2px solid var(--accent);
  box-shadow: 0 0 32px var(--accent-subtle);
}
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-name { font-size: 32px; font-weight: 700; margin-bottom: var(--space-8); }
.hero-role { font-size: 18px; color: var(--text-secondary); margin-bottom: var(--space-4); }
.hero-tagline { font-size: 18px; color: var(--text-secondary); margin-bottom: var(--space-32); }

.hero-cta { display: flex; gap: var(--space-12); justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-8);
  height: 48px; min-width: 160px; padding: 0 var(--space-24);
  font-size: 15px; font-weight: 600; font-family: inherit;
  border-radius: var(--radius-md); cursor: pointer; border: none;
  text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
  user-select: none; -webkit-user-select: none;
}
.btn-primary { background: var(--brand-red); color: #fff; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(255,36,66,0.3); }
.btn-secondary {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* ----- Scroll Indicator ----- */
.scroll-indicator {
  margin-top: var(--space-48); opacity: 0.3;
  animation: scroll-bounce 2s ease-in-out infinite;
}
.scroll-indicator svg { width: 24px; height: 24px; stroke: var(--text-primary); }
@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Sidebar adjustments */
.sidebar .hero {
  padding: 0;
  text-align: center;
}
.sidebar .hero-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-16);
}
.sidebar .hero-name {
  font-size: 24px;
  margin-bottom: var(--space-4);
}
.sidebar .hero-role {
  font-size: 15px;
  margin-bottom: var(--space-4);
}
.sidebar .hero-tagline {
  font-size: 15px;
  margin-bottom: var(--space-20);
}
.sidebar .hero-cta {
  justify-content: center;
}
.sidebar .hero-cta .btn {
  width: 100%;
  min-width: 0;
}
.sidebar .scroll-indicator {
  display: none;
}

/* ============================================================
   About
   ============================================================ */
.about-text { max-width: 560px; margin: 0 auto var(--space-32); text-align: center; font-size: 16px; color: var(--text-secondary); line-height: 1.7; }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-16); max-width: 600px; margin: 0 auto; }
.stat-card {
  background: var(--surface-card); border-radius: var(--radius-lg);
  padding: var(--space-20); text-align: center;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}
.stat-number { font-size: 28px; font-weight: 700; color: var(--accent); display: block; }
.stat-label { font-size: 14px; color: var(--text-tertiary); margin-top: var(--space-4); display: block; }

/* ============================================================
   Tutorials
   ============================================================ */
.tutorial-list { display: flex; flex-direction: column; gap: var(--space-20); }
.tutorial-card {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: var(--space-24); border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card); cursor: pointer; display: block;
  color: inherit; text-decoration: none;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}
.tutorial-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.tutorial-card-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center;
  justify-content: center; margin-bottom: var(--space-16);
  font-size: 0;
  flex-shrink: 0;
}
.tutorial-card-icon span {
  font-family: 'Inter','Microsoft YaHei',sans-serif;
  font-size: 15px; font-weight: 700; color: #fff;
  letter-spacing: 0.5px;
}
.tutorial-card-icon.cc { background: linear-gradient(135deg, #FF6B35, #7C5CFC); }
.tutorial-card-icon.mx { background: linear-gradient(135deg, #2ECC71, #1ABC9C); }
.tutorial-card-icon.bs { background: linear-gradient(135deg, #E74C3C, #F39C12); }
.tutorial-card-icon.hm { background: linear-gradient(135deg, #FF5C28, #6C4DF6); }
.tutorial-card-icon.lo { background: linear-gradient(135deg, #5BCFC5, #FF6B5B); }
.tutorial-card-icon.at { background: linear-gradient(135deg, #E8A838, #38BDF8); }
.tutorial-card-icon.sg { background: linear-gradient(135deg, #1E3A5F, #0EA5E9); }
.tutorial-card-icon.fk { background: linear-gradient(135deg, #d95d39, #f0784f); }
.tutorial-card h3 { font-size: 20px; font-weight: 600; margin-bottom: var(--space-8); }
.tutorial-card p { font-size: 14px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tutorial-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: var(--space-16); padding-top: var(--space-16);
  border-top: 1px solid var(--border-subtle);
}
.tutorial-card-meta-left { font-size: 14px; color: var(--text-tertiary); }
.tutorial-card-meta-right { font-size: 14px; color: var(--accent); font-weight: 500; }

[data-theme="dark"] .tutorial-card {
  background: var(--surface-card);
}

/* Placeholder card */
.tutorial-card-placeholder {
  background: transparent; border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-xl); padding: var(--space-32);
  text-align: center; color: var(--text-tertiary); font-size: 15px;
}

/* ============================================================
   CTA
   ============================================================ */
.cta-card {
  background: var(--surface-card); border-radius: var(--radius-xl);
  padding: var(--space-32); text-align: center;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}
.cta-card h2 { font-size: 20px; font-weight: 600; margin-bottom: var(--space-8); }
.cta-card p { font-size: 16px; color: var(--text-secondary); margin-bottom: var(--space-24); }

/* Sidebar section adjustments */
.sidebar .section {
  padding: var(--space-32) 0;
}
.sidebar .section-title {
  text-align: center;
  font-size: 20px;
}
.sidebar .section-line {
  margin: 0 auto var(--space-20);
}
.sidebar .about-text {
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
  max-width: none;
  margin-bottom: var(--space-16);
}
.sidebar .stats-row {
  grid-template-columns: repeat(3, 1fr);
  max-width: none;
  gap: var(--space-8);
}
.sidebar .stat-card {
  padding: var(--space-12);
}
.sidebar .stat-number {
  font-size: 22px;
}
.sidebar .stat-label {
  font-size: 12px;
}
.sidebar .cta-card {
  padding: var(--space-20);
  text-align: center;
}
.sidebar .cta-card h2 {
  font-size: 16px;
}
.sidebar .cta-card p {
  font-size: 14px;
  margin-bottom: var(--space-16);
}
.sidebar .cta-card .btn {
  width: 100%;
  min-width: 0;
}

/* Main content area (right side) */
.main-content .section {
  padding: 0;
}
.main-content .section-title {
  text-align: left;
  font-size: 24px;
}
.main-content .section-line {
  margin: 0 0 var(--space-24);
}

/* ============================================================
   Footer
   ============================================================ */
.footer { border-top: 1px solid var(--border-subtle); padding: var(--space-24) 0; text-align: center; }
.footer p { font-size: 14px; color: var(--text-tertiary); margin-bottom: var(--space-4); }

/* ============================================================
   Responsive (UI/UX Pro Max §5 mobile-first)
   ============================================================ */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  .nav-inner { padding: 0 16px; }
  .hero { padding: calc(56px + var(--space-48)) 0 var(--space-48); }
  .hero-name { font-size: 28px; }
  .hero-role, .hero-tagline { font-size: 16px; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: var(--space-8); }
  .stat-card { padding: var(--space-16); }
  .stat-number { font-size: 24px; }
  .section { padding: var(--space-32) 0; }
  .page-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 56px;
  }
  .sidebar {
    padding-top: 16px;
  }
  .sidebar .hero-cta {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .sidebar .hero-cta .btn {
    width: auto;
  }
  .sidebar .stats-row {
    grid-template-columns: repeat(3, 1fr);
  }
  .main-content {
    padding-top: 0;
  }
}

@media (max-width: 480px) {
  .hero-cta { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 260px; }
  .stats-row { grid-template-columns: 1fr; max-width: 200px; }
}

@media (min-width: 768px) {
  .tutorial-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-20); }
}
