/* CSS 變數 - 淺色模式 */
:root {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --text-primary: #2d3748;
  --text-secondary: #4a5568;
  --link-color: #2563eb;
  --link-hover: #1e40af;
  --border-color: #e2e8f0;
  --sidebar-bg: #ffffff;
}

/* 深色模式 */
[data-theme="dark"] {
  --bg-primary: #1a202c;
  --bg-secondary: #2d3748;
  --text-primary: #e2e8f0;
  --text-secondary: #cbd5e0;
  --link-color: #06b6d4;
  --link-hover: #22d3ee;
  --border-color: #4a5568;
  --sidebar-bg: #2d3748;
}

/* 🔥 防止閃爍：確保 html 元素立即使用正確背景色 */
html {
  background-color: var(--bg-primary);
}

/* 基礎樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  /* ❌ 已移除 transition，防止頁面切換時閃爍 */
}

/* 容器布局 */
.container {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 300px;
  background-color: var(--sidebar-bg);
  padding: 3rem 2rem;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border-color);
  /* ❌ 已移除 transition，防止頁面切換時閃爍 */
}

.profile-photo {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.5rem;
}

.profile-name {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.profile-bio {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* 導航 */
.nav-menu {
  list-style: none;
  margin-bottom: 2rem;
}

.nav-menu li {
  margin-bottom: 0.5rem;
}

.nav-menu a {
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-menu a:hover {
  color: var(--link-color);
}

/* 社交連結 */
.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-bottom: 2rem;
}

.social-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s ease;
}

.social-links a:hover {
  color: var(--link-color);
}

/* 主題切換按鈕 */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background-color: var(--bg-primary);
}

/* 主要內容區 */
.main-content {
  flex: 1;
  padding: 3rem;
  margin-left: 320px;
  display: flex;
  justify-content: center;
}

/* 文章內容樣式 */
.content {
  max-width: 750px;
  width: 100%;
}

.content h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 2.5rem;
  color: var(--text-primary);
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 3.5rem;
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.content p {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
  line-height: 1.7;
}

.content a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.content a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

.content ul {
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}

.content li {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
  line-height: 1.6;
}

/* 特殊區塊 */
.story-section {
  font-style: italic;
  margin-bottom: 4rem;
  padding: 2.5rem;
  background-color: var(--bg-secondary);
  border-radius: 8px;
  border-left: 4px solid var(--link-color);
}

.story-section p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.story-section p:last-child {
  margin-bottom: 0;
}

.about-section {
  margin-bottom: 4rem;
}

.about-section h2:first-child {
  margin-top: 0;
}

.current-work-section {
  margin-bottom: 4rem;
  padding: 2.5rem;
  background-color: var(--bg-secondary);
  border-radius: 8px;
}

.current-work-section h2:first-child {
  margin-top: 0;
}

.current-work-section p {
  margin-bottom: 1.5rem;
  line-height: 1.7;
}

.current-work-section p:last-child {
  margin-bottom: 0;
}

.questions-section {
  margin-bottom: 4rem;
}

.questions-section h2:first-child {
  margin-top: 0;
}

.questions-section h3 {
  margin-top: 2.5rem;
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 600;
  color: var(--text-secondary);
}

.questions-section ul {
  margin-top: 1.5rem;
  margin-bottom: 2rem;
}

/* 返回連結 */
.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--link-color);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover {
  text-decoration: underline;
}

/* Coming Soon 樣式 */
.coming-soon {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-secondary);
}

/* 響應式設計 */
@media (max-width: 968px) {
  .container {
    flex-direction: column;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
    padding: 2rem;
  }

  .main-content {
    margin-left: 0;
    max-width: 100%;
    padding: 2rem 1.5rem;
  }

  .profile-photo {
    width: 100px;
    height: 100px;
  }

  .profile-name {
    font-size: 1.25rem;
  }

  .social-links {
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 1.5rem 1rem;
  }

  .content h1 {
    font-size: 1.75rem;
  }

  .content h2 {
    font-size: 1.25rem;
  }

  .story-section,
  .current-work-section {
    padding: 1.5rem;
  }
}
