/* ========================================
   糖心手工DIY与创意工坊 - 主样式表
   彩虹渐变+白底缤纷创意风格
   ======================================== */

:root {
  --primary: #FF6B6B;
  --secondary: #4ECDC4;
  --bg: #FFFFFF;
  --card: #F8F9FA;
  --accent: #45B7D1;
  --text: #2D3436;
  --radius: 16px;
  --shadow: 0 4px 20px rgba(255, 107, 107, 0.1);
  --gradient-rainbow: linear-gradient(135deg, #FF6B6B, #4ECDC4, #45B7D1, #96CEB4, #FFEAA7);
  --gradient-warm: linear-gradient(135deg, #FF6B6B, #FFEAA7);
  --gradient-cool: linear-gradient(135deg, #4ECDC4, #45B7D1);
  --gradient-nature: linear-gradient(135deg, #96CEB4, #4ECDC4);
  --font-title: 'Microsoft YaHei', '微软雅黑', sans-serif;
  --font-body: 'PingFang SC', '苹方', 'Hiragino Sans GB', sans-serif;
  --font-mono: 'Courier New', monospace;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --max-width: 1200px;
}

/* 重置样式 */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--secondary);
}

/* 容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* ========== 导航栏 ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid transparent;
  border-image: var(--gradient-rainbow) 1;
  padding: 12px 0;
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

.site-logo {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 700;
  background: var(--gradient-rainbow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 24px;
}

.nav-menu a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-menu a:hover {
  background: var(--card);
  color: var(--primary);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: var(--transition);
}

/* ========== 首屏英雄区 ========== */
.hero-section {
  padding: 80px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: conic-gradient(from 0deg, rgba(255,107,107,0.05), rgba(78,205,196,0.05), rgba(69,183,209,0.05), rgba(150,206,180,0.05), rgba(255,234,167,0.05), rgba(255,107,107,0.05));
  animation: rotate-bg 30s linear infinite;
}

@keyframes rotate-bg {
  to { transform: rotate(360deg); }
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-title {
  font-family: var(--font-title);
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 16px;
  background: var(--gradient-rainbow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.2rem;
  color: #636e72;
  max-width: 700px;
  margin: 0 auto 32px;
  line-height: 1.8;
}

.hero-image {
  max-width: 800px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

/* ========== 通用卡片 ========== */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid rgba(0,0,0,0.03);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(255,107,107,0.15);
}

.card-image {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.card-desc {
  font-size: 0.9rem;
  color: #636e72;
  line-height: 1.6;
}

/* ========== 栏目网格 ========== */
.section-title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 12px;
  position: relative;
}

.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--gradient-rainbow);
  border-radius: 2px;
  margin: 12px auto 0;
}

.section-subtitle {
  text-align: center;
  color: #636e72;
  margin-bottom: 40px;
  font-size: 1rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

/* ========== 教程卡片 ========== */
.tutorial-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: 1px solid rgba(0,0,0,0.03);
}

.tutorial-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 40px rgba(78,205,196,0.2);
}

.tutorial-card .card-image img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
}

.tutorial-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  flex-wrap: wrap;
}

.tutorial-meta .badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-difficulty {
  background: rgba(255,107,107,0.1);
  color: var(--primary);
}

.badge-time {
  background: rgba(78,205,196,0.1);
  color: var(--secondary);
}

.badge-materials {
  background: rgba(69,183,209,0.1);
  color: var(--accent);
}

.tutorial-card .card-body {
  padding: 0 20px 20px;
}

/* ========== 难度星级 ========== */
.difficulty-stars {
  display: inline-flex;
  gap: 2px;
}

.difficulty-stars .star {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.difficulty-stars .star.filled {
  color: #FFEAA7;
}

.difficulty-stars .star.empty {
  color: #dfe6e9;
}

/* ========== 步骤流程 ========== */
.steps-flow {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  padding-left: 40px;
}

.steps-flow::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--gradient-rainbow);
  border-radius: 2px;
}

.step-item {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  opacity: 0;
  transform: translateX(20px);
  animation: step-appear 0.5s ease forwards;
}

.step-item:nth-child(1) { animation-delay: 0.1s; }
.step-item:nth-child(2) { animation-delay: 0.2s; }
.step-item:nth-child(3) { animation-delay: 0.3s; }
.step-item:nth-child(4) { animation-delay: 0.4s; }
.step-item:nth-child(5) { animation-delay: 0.5s; }

@keyframes step-appear {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.step-number {
  position: absolute;
  left: -40px;
  top: 24px;
  width: 30px;
  height: 30px;
  background: var(--gradient-rainbow);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
}

.step-time {
  font-size: 0.8rem;
  color: var(--secondary);
  margin-top: 8px;
}

/* ========== 材料清单 ========== */
.materials-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
}

.materials-list table {
  width: 100%;
  border-collapse: collapse;
}

.materials-list th,
.materials-list td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 0.9rem;
}

.materials-list th {
  font-weight: 700;
  color: var(--text);
  background: rgba(78,205,196,0.05);
}

.materials-list .price {
  color: var(--primary);
  font-weight: 700;
  font-family: var(--font-mono);
}

/* ========== 作品展示瀑布流 ========== */
.masonry-grid {
  columns: 3;
  column-gap: 20px;
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.masonry-item:hover {
  transform: scale(1.02);
}

.masonry-item img {
  width: 100%;
  display: block;
}

.masonry-item .item-info {
  padding: 12px 16px;
  background: var(--bg);
}

/* ========== Before/After 对比 ========== */
.before-after {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  cursor: col-resize;
}

.before-after img {
  width: 100%;
  display: block;
}

.before-after .after-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  overflow: hidden;
}

.before-after .slider-handle {
  position: absolute;
  top: 0;
  left: 50%;
  width: 4px;
  height: 100%;
  background: white;
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  cursor: col-resize;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background: var(--gradient-rainbow);
  color: white;
  box-shadow: 0 4px 15px rgba(255,107,107,0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255,107,107,0.4);
  color: white;
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 2px solid rgba(0,0,0,0.05);
}

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

/* ========== 面包屑 ========== */
.breadcrumb {
  padding: 16px 0;
  font-size: 0.85rem;
  color: #636e72;
}

.breadcrumb a {
  color: #636e72;
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb .separator {
  margin: 0 8px;
}

/* ========== 页脚 ========== */
.site-footer {
  background: var(--text);
  color: rgba(255,255,255,0.8);
  padding: 60px 0 30px;
  margin-top: 80px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 0.9rem;
  line-height: 1.8;
  color: rgba(255,255,255,0.6);
}

.footer-title {
  font-weight: 700;
  color: white;
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 10px;
}

.footer-links a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--secondary);
}

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.4);
}

/* ========== FAQ ========== */
.faq-section {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  border-bottom: 1px solid rgba(0,0,0,0.05);
  padding: 20px 0;
}

.faq-question {
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-answer {
  margin-top: 12px;
  color: #636e72;
  line-height: 1.8;
  font-size: 0.95rem;
  display: none;
}

.faq-item.active .faq-answer {
  display: block;
}

/* ========== 搜索页 ========== */
.search-box {
  max-width: 600px;
  margin: 0 auto 40px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 16px 24px;
  padding-right: 50px;
  border: 2px solid var(--card);
  border-radius: 30px;
  font-size: 1rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(255,107,107,0.1);
}

.search-box button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: none;
  background: var(--gradient-rainbow);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  font-size: 1.1rem;
}

/* ========== 页面区块间距 ========== */
.section {
  padding: 60px 0;
}

.section-alt {
  background: var(--card);
  padding: 60px 0;
}

/* ========== 标签 ========== */
.tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,107,107,0.08);
  color: var(--primary);
  margin: 2px 4px;
}

.tag-green {
  background: rgba(150,206,180,0.15);
  color: #00b894;
}

.tag-blue {
  background: rgba(69,183,209,0.15);
  color: var(--accent);
}

/* ========== 动画 ========== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce-check {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.3); }
}

@keyframes confetti {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(-100px) rotate(720deg); opacity: 0; }
}

.animate-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== 404页面 ========== */
.error-page {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

.error-code {
  font-size: 8rem;
  font-weight: 900;
  background: var(--gradient-rainbow);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    gap: 8px;
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .masonry-grid {
    columns: 1;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .steps-flow {
    padding-left: 30px;
  }

  .section {
    padding: 40px 0;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .masonry-grid {
    columns: 2;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== 挑战赛模块 ========== */
.challenge-banner {
  background: var(--gradient-rainbow);
  border-radius: var(--radius);
  padding: 40px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.challenge-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: pulse-bg 4s ease-in-out infinite;
}

@keyframes pulse-bg {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.challenge-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 12px;
  position: relative;
}

.challenge-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 20px;
  position: relative;
}

.challenge-stat {
  text-align: center;
}

.challenge-stat .number {
  font-size: 2rem;
  font-weight: 800;
}

.challenge-stat .label {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ========== 工坊卡片 ========== */
.workshop-card {
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.workshop-card:hover {
  transform: translateY(-4px);
}

.workshop-header {
  padding: 20px;
  background: var(--gradient-cool);
  color: white;
}

.workshop-body {
  padding: 20px;
}

/* ========== 工具推荐 ========== */
.tool-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: var(--transition);
}

.tool-item:hover {
  background: rgba(78,205,196,0.05);
  border-color: var(--secondary);
}

.tool-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ========== 下载页 ========== */
.app-features {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin: 40px 0;
}

.app-feature-item {
  display: flex;
  gap: 16px;
  padding: 20px;
  background: var(--card);
  border-radius: var(--radius);
}

.app-feature-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-rainbow);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.2rem;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .app-features {
    grid-template-columns: 1fr;
  }
}
