/* ========================================
   我的英语学习日记 - 主样式文件
   ======================================== */

/* CSS Variables - 设计系统 */
:root {
  /* 主色调 - 深邃书卷蓝 */
  --primary-dark: #1a365d;
  --primary: #2c5282;
  --primary-light: #4299e1;
  
  /* 点缀色 - 温暖橙 */
  --accent: #ed8936;
  --accent-light: #f6ad55;
  --accent-dark: #c05621;
  
  /* 背景色 */
  --bg-cream: #faf8f5;
  --bg-warm: #f7f3ed;
  --bg-card: #ffffff;
  
  /* 文字色 */
  --text-dark: #1a202c;
  --text-body: #4a5568;
  --text-light: #718096;
  --text-muted: #a0aec0;
  
  /* 装饰色 */
  --border-light: #e2e8f0;
  --shadow-color: rgba(26, 54, 93, 0.1);
  
  /* 渐变 */
  --gradient-hero: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #4299e1 100%);
  --gradient-card: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(26,54,93,0.02) 100%);
  --gradient-accent: linear-gradient(135deg, #ed8936 0%, #f6ad55 100%);
  
  /* 间距 */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* 阴影 */
  --shadow-sm: 0 1px 3px rgba(26, 54, 93, 0.08);
  --shadow-md: 0 4px 12px rgba(26, 54, 93, 0.1);
  --shadow-lg: 0 8px 30px rgba(26, 54, 93, 0.12);
  --shadow-xl: 0 20px 50px rgba(26, 54, 93, 0.15);
  
  /* 过渡 */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  
  /* 字体 */
  --font-display: 'Playfair Display', 'Noto Serif SC', serif;
  --font-body: 'Source Sans Pro', 'Noto Sans SC', sans-serif;
  --font-mono: 'Fira Code', monospace;
}

/* ========================================
   Reset & Base Styles
   ======================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-body);
  background-color: var(--bg-cream);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 背景装饰 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(66, 153, 225, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(237, 137, 54, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(26, 54, 93, 0.02) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent);
}

/* ========================================
   Typography
   ======================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-dark);
  line-height: 1.3;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: var(--space-md);
}

/* ========================================
   Layout Components
   ======================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 800px;
}

/* ========================================
   Header & Navigation
   ======================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-light);
  transition: all var(--transition-normal);
}

.header.scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 70px;
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-dark);
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-hero);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.nav-link {
  font-weight: 500;
  color: var(--text-body);
  position: relative;
  padding: var(--space-sm) 0;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-accent);
  transition: width var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-link:hover {
  color: var(--primary);
}

/* Mobile Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.menu-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text-dark);
  transition: all var(--transition-fast);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
  padding: calc(70px + var(--space-3xl)) 0 var(--space-3xl);
  background: var(--gradient-hero);
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 80%;
  height: 200%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: float 20s ease-in-out infinite;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(to top, var(--bg-cream), transparent);
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero h1 {
  color: white;
  margin-bottom: var(--space-lg);
  animation: fadeInUp 0.8s ease forwards;
}

.hero-subtitle {
  font-size: 1.25rem;
  opacity: 0.9;
  margin-bottom: var(--space-xl);
  animation: fadeInUp 0.8s ease 0.2s forwards;
  opacity: 0;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-2xl);
  animation: fadeInUp 0.8s ease 0.4s forwards;
  opacity: 0;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-label {
  font-size: 0.875rem;
  opacity: 0.8;
}

/* ========================================
   Article Cards Grid
   ======================================== */
.articles-section {
  padding: var(--space-3xl) 0;
  position: relative;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.section-title {
  margin-bottom: var(--space-sm);
}

.section-subtitle {
  color: var(--text-light);
  font-size: 1.125rem;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-xl);
}

/* Article Card */
.article-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  position: relative;
  display: flex;
  flex-direction: column;
}

.article-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition-normal);
}

.article-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.article-card:hover::before {
  transform: scaleX(1);
}

.card-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.article-card:hover .card-image img {
  transform: scale(1.05);
}

.card-number {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  width: 40px;
  height: 40px;
  background: var(--gradient-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.875rem;
  box-shadow: var(--shadow-md);
}

.card-category {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  background: rgba(255, 255, 255, 0.95);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.card-content {
  padding: var(--space-lg);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-date {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.card-title {
  font-size: 1.25rem;
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.card-title a {
  color: var(--text-dark);
}

.card-title a:hover {
  color: var(--primary);
}

.card-excerpt {
  color: var(--text-light);
  font-size: 0.9375rem;
  line-height: 1.6;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border-light);
}

.read-more {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  transition: gap var(--transition-fast);
}

.read-more:hover {
  gap: var(--space-sm);
  color: var(--accent-dark);
}

.read-time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ========================================
   Article Detail Page
   ======================================== */
.article-hero {
  padding: calc(70px + var(--space-2xl)) 0 var(--space-2xl);
  background: var(--gradient-hero);
  color: white;
  position: relative;
}

.article-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: linear-gradient(to top, var(--bg-cream), transparent);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
}

.article-category {
  background: rgba(255, 255, 255, 0.2);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.article-date {
  opacity: 0.9;
  font-size: 0.9375rem;
}

.article-title {
  color: white;
  margin-bottom: var(--space-md);
  max-width: 800px;
}

.article-intro {
  font-size: 1.125rem;
  opacity: 0.9;
  max-width: 700px;
  line-height: 1.8;
}

/* Article Content */
.article-content {
  padding: var(--space-3xl) 0;
}

.article-body {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-3xl);
  box-shadow: var(--shadow-md);
  margin-top: -60px;
  position: relative;
  z-index: 1;
}

.article-content .container-narrow {
  position: relative;
}

.article-body h2 {
  margin-top: var(--space-2xl);
  margin-bottom: var(--space-lg);
  padding-bottom: var(--space-sm);
  border-bottom: 2px solid var(--border-light);
}

.article-body h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.article-body p {
  margin-bottom: var(--space-lg);
}

.article-body ul, .article-body ol {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-xl);
}

.article-body li {
  margin-bottom: var(--space-sm);
}

.article-body blockquote {
  margin: var(--space-xl) 0;
  padding: var(--space-lg) var(--space-xl);
  background: var(--bg-warm);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--text-body);
}

.article-body img {
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
  box-shadow: var(--shadow-md);
}

.image-placeholder {
  border-radius: var(--radius-md);
  margin: var(--space-xl) 0;
  box-shadow: var(--shadow-md);
}

.article-body .image-caption {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: calc(-1 * var(--space-md));
  margin-bottom: var(--space-xl);
}

/* English Word Highlight */
.english-word {
  background: linear-gradient(120deg, rgba(237, 137, 54, 0.2) 0%, rgba(246, 173, 85, 0.2) 100%);
  padding: 0.1em 0.3em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.95em;
}

.vocabulary-box {
  background: var(--bg-warm);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-xl) 0;
  border: 1px solid var(--border-light);
}

.vocabulary-box h4 {
  color: var(--primary);
  margin-bottom: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.vocabulary-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

.vocab-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.vocab-word {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--primary);
}

.vocab-meaning {
  font-size: 0.875rem;
  color: var(--text-light);
}

/* Back Button */
.back-button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-sm) var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-body);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-xl);
  margin-top: 0;
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 2;
}

.back-button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: translateX(-4px);
  box-shadow: var(--shadow-md);
}

.back-button::before {
  content: '←';
  font-size: 1.125rem;
  line-height: 1;
  transition: transform var(--transition-fast);
  display: inline-block;
}

.back-button:hover::before {
  transform: translateX(-2px);
}

/* Article Navigation */
.article-nav {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border-light);
}

.nav-prev, .nav-next {
  flex: 1;
  max-width: 45%;
}

.nav-next {
  text-align: right;
}

.nav-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.nav-title {
  font-weight: 600;
  color: var(--text-dark);
  transition: color var(--transition-fast);
}

.nav-title:hover {
  color: var(--accent);
}

/* ========================================
   Footer
   ======================================== */
.footer {
  background: var(--primary-dark);
  color: white;
  padding: var(--space-2xl) 0;
  margin-top: var(--space-3xl);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-logo {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.footer-text {
  opacity: 0.8;
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--accent-light);
}

.footer-beian {
  text-align: center;
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.875rem;
}

.footer-beian a {
  color: rgba(255, 255, 255, 0.7);
  transition: color var(--transition-fast);
}

.footer-beian a:hover {
  color: var(--accent-light);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Staggered Animation for Cards */
.article-card {
  opacity: 0;
  animation: fadeInUp 0.6s ease forwards;
}

.article-card:nth-child(1) { animation-delay: 0.1s; }
.article-card:nth-child(2) { animation-delay: 0.2s; }
.article-card:nth-child(3) { animation-delay: 0.3s; }
.article-card:nth-child(4) { animation-delay: 0.4s; }
.article-card:nth-child(5) { animation-delay: 0.5s; }
.article-card:nth-child(6) { animation-delay: 0.6s; }
.article-card:nth-child(7) { animation-delay: 0.7s; }
.article-card:nth-child(8) { animation-delay: 0.8s; }
.article-card:nth-child(9) { animation-delay: 0.9s; }

/* ========================================
   Responsive Design
   ======================================== */
@media (max-width: 768px) {
  :root {
    --space-2xl: 2rem;
    --space-3xl: 2.5rem;
  }
  
  .header-inner {
    height: 60px;
  }
  
  .nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-md);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
  }
  
  .nav.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .hero-stats {
    flex-direction: column;
    gap: var(--space-lg);
  }
  
  .articles-grid {
    grid-template-columns: 1fr;
  }
  
  .article-body {
    padding: var(--space-lg);
    margin-left: calc(-1 * var(--space-lg));
    margin-right: calc(-1 * var(--space-lg));
    border-radius: 0;
  }
  
  .back-button {
    font-size: 0.875rem;
    padding: var(--space-xs) var(--space-md);
  }
  
  .article-nav {
    flex-direction: column;
  }
  
  .nav-prev, .nav-next {
    max-width: 100%;
    text-align: left;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .card-image {
    height: 160px;
  }
  
  .vocabulary-list {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--space-md); }
.mt-2 { margin-top: var(--space-xl); }
.mt-3 { margin-top: var(--space-2xl); }

.mb-1 { margin-bottom: var(--space-md); }
.mb-2 { margin-bottom: var(--space-xl); }
.mb-3 { margin-bottom: var(--space-2xl); }

.hidden { display: none; }
.visible { display: block; }

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: var(--space-xl);
  right: var(--space-xl);
  width: 50px;
  height: 50px;
  background: var(--gradient-accent);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all var(--transition-normal);
  z-index: 999;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
}

/* Loading State */
.loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}




