/* 坤沙 Blog - 主样式文件 */
/* 优化后的 CSS，使用 CSS 变量统一管理主题 */

:root {
  /* 主题色 */
  --primary-color: #ff69b4;
  --primary-light: #ff87c8;
  --primary-dark: #ff4da6;
  
  /* 背景色 */
  --bg-gradient: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  --bg-card: #ffffff;
  --bg-overlay: rgba(0, 0, 0, 0.7);
  
  /* 文字色 */
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  
  /* 边框与阴影 */
  --border-radius: 15px;
  --border-radius-sm: 10px;
  --shadow-sm: 0 5px 15px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 10px 50px rgba(0, 0, 0, 0.3);
  
  /* 间距 */
  --spacing-sm: 10px;
  --spacing-md: 20px;
  --spacing-lg: 40px;
  
  /* 动画 */
  --transition-fast: 0.2s ease;
  --transition-normal: 0.3s ease;
}

/* 暗色主题支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-card: #1a1a1a;
    --text-primary: #f0f0f0;
    --text-secondary: #cccccc;
    --text-muted: #888888;
  }
}

/* ========== 基础重置 ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Microsoft YaHei', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  line-height: 1.6;
}

/* ========== 导航栏 ========== */
.nav {
  background: rgba(255, 105, 180, 0.95);
  padding: 15px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

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

.nav-logo {
  color: white;
  font-size: 1.8em;
  font-weight: bold;
  text-decoration: none;
  transition: transform var(--transition-fast);
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-links a {
  color: white;
  text-decoration: none;
  font-size: 1.1em;
  transition: opacity var(--transition-normal);
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: white;
  transition: width var(--transition-normal);
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-links a:hover {
  opacity: 0.8;
}

/* 移动端菜单按钮 */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5em;
  color: white;
  cursor: pointer;
  padding: 10px;
}

/* ========== 个人简介 ========== */
.profile {
  background: var(--bg-card);
  max-width: 900px;
  margin: var(--spacing-lg) auto;
  border-radius: var(--border-radius);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  display: flex;
  gap: var(--spacing-lg);
  align-items: center;
  animation: fadeInUp 0.6s ease;
}

.profile-img {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 5px solid var(--primary-color);
  transition: transform var(--transition-normal);
}

.profile-img:hover {
  transform: scale(1.05);
}

.profile-info h1 {
  color: var(--primary-color);
  font-size: 2.5em;
  margin-bottom: 15px;
}

.profile-info p {
  color: var(--text-secondary);
  line-height: 1.8;
  font-size: 1.1em;
  margin-bottom: 10px;
}

.profile-tags {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  flex-wrap: wrap;
}

.tag {
  background: #ffecd2;
  color: var(--primary-color);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 0.9em;
  transition: transform var(--transition-fast);
}

.tag:hover {
  transform: translateY(-2px);
}

/* ========== 容器与板块 ========== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md) var(--spacing-lg);
}

.section-title {
  text-align: center;
  color: var(--primary-color);
  font-size: 2em;
  margin: 50px 0 30px;
  position: relative;
  animation: fadeIn 0.8s ease;
}

.section-title::after {
  content: '';
  display: block;
  width: 100px;
  height: 4px;
  background: var(--primary-color);
  margin: 15px auto 0;
  border-radius: 2px;
}

/* ========== 卡片网格 ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  animation: fadeInUp 0.6s ease;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.card.media-card {
  cursor: pointer;
  position: relative;
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform var(--transition-normal);
}

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

.card-content {
  padding: 25px;
}

.card-title {
  color: var(--text-primary);
  font-size: 1.3em;
  margin-bottom: 10px;
}

.card-meta {
  color: var(--text-muted);
  font-size: 0.9em;
  margin-bottom: 15px;
}

.card-text {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 15px;
}

.card-actions {
  display: flex;
  gap: 15px;
  color: var(--text-muted);
  font-size: 0.9em;
}

.card-actions span {
  cursor: pointer;
  transition: color var(--transition-normal);
}

.card-actions span:hover {
  color: var(--primary-color);
}

/* ========== 技术卡片 ========== */
.tech-card {
  border-left: 4px solid var(--primary-color);
}

.tech-card .card-title {
  color: var(--primary-color);
}

/* ========== 媒体卡片播放按钮 ========== */
.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 105, 180, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.5em;
  cursor: pointer;
  transition: transform var(--transition-normal), background var(--transition-normal);
  z-index: 10;
}

.play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: var(--primary-color);
}

/* ========== 按钮 ========== */
.btn {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
  color: white;
  padding: 12px 30px;
  border-radius: 25px;
  text-decoration: none;
  margin-top: 15px;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer;
  border: none;
  font-size: 1em;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: scale(0.98);
}

/* ========== 播放器 ========== */
.video-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-overlay);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.video-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.music-player,
.video-player {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  background: var(--bg-card);
  border-radius: var(--border-radius);
  padding: 25px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  transition: transform var(--transition-normal);
  max-width: 500px;
  width: 85%;
  max-height: 80vh;
  overflow-y: auto;
}

.video-player {
  max-width: 900px;
}

.music-player.active,
.video-player.active {
  transform: translate(-50%, -50%) scale(1);
}

.player-header,
.video-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-md);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  padding-bottom: 15px;
  border-bottom: 2px solid #ffecd2;
}

.player-title,
.video-title {
  color: var(--primary-color);
  font-size: 1.3em;
  font-weight: bold;
}

.player-close,
.video-close {
  background: none;
  border: none;
  font-size: 1.5em;
  color: var(--text-muted);
  cursor: pointer;
  padding: 5px;
  transition: color var(--transition-normal);
}

.player-close:hover,
.video-close:hover {
  color: var(--primary-color);
}

/* ========== 歌曲列表 ========== */
.song-list {
  max-height: 250px;
  overflow-y: auto;
}

.song-item {
  display: flex;
  align-items: center;
  padding: 12px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
  background: #ffecd2;
  cursor: pointer;
  transition: background var(--transition-normal);
}

.song-item:hover {
  background: #ffd6e8;
}

.song-item.playing {
  background: var(--primary-color);
  color: white;
}

.song-icon {
  font-size: 1.5em;
  margin-right: 15px;
}

.song-info {
  flex: 1;
}

.song-name {
  font-weight: bold;
  margin-bottom: 3px;
}

.song-artist {
  font-size: 0.9em;
  color: var(--text-secondary);
}

.song-item.playing .song-artist {
  color: rgba(255, 255, 255, 0.8);
}

/* ========== 视频容器 ========== */
.video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--border-radius);
  overflow: hidden;
  background: #000;
}

.video-container iframe,
.video-container video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--border-radius);
}

/* ========== 照片墙 ========== */
.gallery-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.gallery-content {
  text-align: center;
  max-width: 90%;
}

.gallery-content img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: var(--border-radius-sm);
}

.gallery-title {
  color: white;
  font-size: 1.5em;
  margin-top: var(--spacing-md);
}

.gallery-close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 3em;
  color: white;
  cursor: pointer;
  z-index: 2001;
  transition: color var(--transition-normal);
}

.gallery-close:hover {
  color: var(--primary-color);
}

/* ========== 页脚 ========== */
.footer {
  background: rgba(255, 105, 180, 0.9);
  color: white;
  text-align: center;
  padding: 30px;
  margin-top: var(--spacing-lg);
}

/* ========== 动画 ========== */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
  .profile {
    flex-direction: column;
    text-align: center;
    padding: var(--spacing-md);
  }

  .profile-img {
    width: 150px;
    height: 150px;
  }

  .profile-info h1 {
    font-size: 1.8em;
  }

  .nav-links {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(255, 105, 180, 0.98);
    flex-direction: column;
    padding: var(--spacing-md);
    gap: 15px;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform var(--transition-normal), opacity var(--transition-normal);
  }

  .nav-links.active {
    transform: translateY(0);
    opacity: 1;
  }

  .nav-toggle {
    display: block;
  }

  .grid {
    grid-template-columns: 1fr;
  }

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

/* ========== 滚动条美化 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1.5em;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-normal), visibility var(--transition-normal), transform var(--transition-normal);
  box-shadow: var(--shadow-md);
  z-index: 99;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
  background: var(--primary-dark);
}

/* ========== 加载动画 ========== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
