/**
 * DevCraft Studio - Magazine 风格首页
 */

/* ==================== 容器布局 ==================== */
.magazine-home {
  /* max-width: var(--nav-width); */
  margin: 0 auto;
  padding: 0 var(--gap);
}

/* ==================== Hero Banner ==================== */
.hero-banner {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: calc(var(--gap) * 2);
  align-items: center;
  min-height: 580px;
  padding: calc(var(--gap) * 3) 20px;
  position: relative;
  overflow: hidden;
}

.hero-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: -20%;
  width: 500px;
  height: 500px;
  background: var(--gradient-radial);
  border-radius: 50%;
  opacity: 0.6;
  z-index: -1;
}

.hero-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-full);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  width: fit-content;
}

.hero-badge svg {
  color: var(--accent);
}

.hero-title {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
  color: var(--primary);
  margin: 0;
  letter-spacing: var(--tracking-tight);
}

.hero-description {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--secondary);
  max-width: 600px;
  margin: 0;
}

.hero-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  gap: calc(var(--gap) * 1.5);
  padding-top: var(--gap);
  border-top: 1px solid var(--border);
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-value {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  color: var(--accent);
  line-height: 1;
}

.stat-label {
  font-size: var(--text-sm);
  color: #999;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.hero-visual {
  position: relative;
  height: 400px;
}

.hero-decoration {
  position: relative;
  width: 100%;
  height: 100%;
}

.floating-shape {
  position: absolute;
  border-radius: var(--radius-lg);
  animation: float 6s ease-in-out infinite;
}

.shape-1 {
  width: 200px;
  height: 200px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(14, 165, 233, 0.2));
  top: 20%;
  left: 10%;
  animation-delay: 0s;
}

.shape-2 {
  width: 150px;
  height: 150px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.15), rgba(59, 130, 246, 0.15));
  bottom: 15%;
  right: 15%;
  border-radius: 50%;
  animation-delay: 2s;
}

.shape-3 {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(14, 165, 233, 0.1));
  top: 50%;
  right: 5%;
  animation-delay: 4s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(5deg);
  }
}

/* ==================== Section 通用样式 ==================== */
.featured-section,
.articles-section,
.topics-section,
.cta-section {
  padding: calc(var(--gap) * 1.5) 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: calc(var(--gap) * 2);
}

.section-badge {
  display: inline-block;
  padding: 4px 0;
  background: var(--code-bg);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.section-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: var(--primary);
  margin: 0 0 8px 0;
}

.section-description {
  font-size: var(--text-lg);
  color: var(--secondary);
  margin: 0;
}

.view-all-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  text-decoration: none;
  transition: all 0.2s ease;
}

.view-all-link:hover {
  gap: 12px;
  color: var(--accent-2);
}

.view-all-link svg {
  transition: transform 0.2s ease;
}

.view-all-link:hover svg {
  transform: translateX(4px);
}

/* ==================== Glassmorphism 卡片基础 ==================== */
.glass-card {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(10px) saturate(180%);
  -webkit-backdrop-filter: blur(10px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.glass-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .glass-card {
  background: rgba(26, 16, 53, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* ==================== Featured Article ==================== */
.featured-article {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: calc(var(--gap) * 2);
  padding: calc(var(--gap) * 2);
  align-items: center;
}

.featured-content {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: var(--secondary);
}

.article-tag {
  padding: 4px 10px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: var(--font-medium);
}

.article-title {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  margin: 0;
  line-height: var(--leading-tight);
}

.article-title a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.article-title a:hover {
  color: var(--accent);
}

.article-excerpt {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--content);
  margin: 0;
}

.article-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--gap);
  border-top: 1px solid var(--border);
}

.read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: var(--font-semibold);
  text-decoration: none;
  transition: gap 0.2s ease;
}

.read-more:hover {
  gap: 12px;
}

.reading-time {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--secondary);
  font-size: var(--text-sm);
}

.featured-image {
  height: 100%;
  min-height: 300px;
  border-radius: var(--radius);
  overflow: hidden;
}

.featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==================== Articles Grid - 瀑布流布局 ==================== */
.articles-grid {
  column-count: 3; /* 3列瀑布流 */
  column-gap: var(--gap);
}

/* 卡片作为整体，不被分割到不同列 */
.article-card {
  display: inline-block; /* 改为 inline-block 以支持 column 布局 */
  width: 100%; /* 占满列宽 */
  margin-bottom: var(--gap); /* 卡片之间的垂直间距 */
  break-inside: avoid; /* 防止卡片被分割到不同列 */
  padding: 0;
}

.card-image {
  width: 100%;
  height: 200px;
  overflow: hidden;
}

.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-card:hover .card-image img {
  transform: scale(1.05);
}

.card-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: var(--gap);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-xs);
  color: var(--secondary);
}

.card-tag {
  padding: 3px 8px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--accent);
  border-radius: var(--radius-sm);
  font-weight: var(--font-medium);
}

.card-title {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  margin: 0;
  line-height: var(--leading-tight);
}

.card-title a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-title a:hover {
  color: var(--accent);
}

.card-excerpt {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--secondary);
  margin: 0;
  /* 移除 flex: 1，让摘要不再被拉伸 */
}

.card-link {
  color: var(--accent);
  font-weight: var(--font-semibold);
  text-decoration: none;
  font-size: var(--text-sm);
  /* 移除 margin-top: auto，避免拉伸卡片高度 */
}

.card-link:hover {
  color: var(--accent-2);
}

/* ==================== Topics Grid ==================== */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--gap);
}

.topic-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px calc(var(--gap) * 0.8);
  text-decoration: none;
}

.topic-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-primary);
  border-radius: var(--radius);
  color: white;
}

.topic-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.topic-name {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--primary);
  margin: 0;
}

.topic-count {
  font-size: var(--text-sm);
  color: var(--secondary);
}

.topic-arrow {
  font-size: var(--text-2xl);
  color: var(--tertiary);
  transition: all 0.2s ease;
}

.topic-card:hover .topic-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ==================== CTA Section ==================== */
.cta-section {
  padding: calc(var(--gap) * 4) 0;
}

.cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--gap));
  background: var(--gradient-primary);
  border: none;
}

[data-theme="dark"] .cta-card {
  background: var(--gradient-primary);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.cta-content {
  max-width: 600px;
}

.cta-title {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  color: white;
  margin: 0;
}

.cta-description {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.9);
  margin: 0;
}

.cta-actions {
  display: flex;
  gap: 16px;
}

/* ==================== 按钮系统 ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  min-height: 48px; /* 确保最小高度一致 */
  border-radius: var(--radius);
  font-weight: var(--font-semibold);
  font-size: var(--text-base);
  line-height: 1.5;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  box-sizing: border-box; /* 确保padding计算一致 */
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-secondary:hover {
  background: var(--primary);
  color: white;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 1024px) {
  .hero-banner {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: calc(var(--gap) * 2) 20px;
  }

  .hero-visual {
    display: none;
  }

  .featured-article {
    grid-template-columns: 1fr;
    padding: var(--gap);
  }

  .featured-image {
    order: -1;
    min-height: 250px;
  }

  .articles-grid {
    column-count: 2; /* 平板改为2列 */
  }

  .topics-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .magazine-home {
    padding: 0 ;
  }

  .hero-banner {
    padding: calc(var(--gap) * 1.5) 0;
  }

  .hero-banner::before {
    display: none; /* 移动端隐藏背景装饰 */
  }

  .hero-title {
    font-size: 2rem;
    line-height: 1.2;
  }

  .hero-description {
    font-size: var(--text-base);
  }

  .hero-stats {
    gap: var(--gap);
    flex-wrap: wrap;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .section-title {
    font-size: var(--text-2xl);
  }

  .section-description {
    font-size: var(--text-base);
  }

  .articles-grid {
    column-count: 1; /* 移动端改为1列 */
  }

  .topics-grid {
    grid-template-columns: 1fr;
    gap: var(--gap);
  }

  .article-card,
  .topic-card {
    margin: 0;
  }

  .cta-card {
    flex-direction: column;
    align-items: flex-start;
    gap: calc(var(--gap) * 1.5);
    padding: calc(var(--gap) * 1.5);
  }

  .cta-title {
    font-size: var(--text-2xl);
  }

  .cta-description {
    font-size: var(--text-base);
  }

  .cta-actions {
    width: 100%;
    flex-direction: column;
  }

  .cta-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .floating-shape {
    display: none; /* 移动端隐藏浮动装饰 */
  }

  .featured-section,
  .articles-section,
  .topics-section,
  .cta-section {
    padding: calc(var(--gap) * 2) 0;
  }
}

@media (max-width: 480px) {
  .hero-banner {
    padding: var(--gap) 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-badge {
    font-size: var(--text-xs);
    padding: 6px 12px;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .btn {
    width: 100%;
    justify-content: center;
    padding: 12px 20px;
    font-size: var(--text-sm);
  }

  .hero-stats {
    flex-wrap: wrap;
    gap: 16px;
  }

  .stat-value {
    font-size: var(--text-xl);
  }

  .stat-label {
    font-size: var(--text-xs);
  }

  .section-title {
    font-size: var(--text-xl);
  }

  .section-badge {
    font-size: 10px;
  }

  .article-title {
    font-size: var(--text-xl);
  }

  .card-title {
    font-size: var(--text-lg);
  }

  .topic-card {
    padding: var(--gap);
  }

  .topic-icon {
    width: 40px;
    height: 40px;
  }

  .topic-name {
    font-size: var(--text-base);
  }

  .cta-title {
    font-size: var(--text-xl);
  }

  .cta-description {
    font-size: var(--text-sm);
  }
}
