/* ========================================
   山梨字幕组网站CSS - 完整修复版
   Author: Lingma AI Assistant
   Version: 1.2 (修复轮播区域和整体布局)
======================================== */

/* 导入变量和基础样式 */
:root {
  --primary-color: #ff6b9d;
  --primary-dark: #ff528a;
  --bg-color: #ffffff;
  --text-color: #333333;
  --border-color: rgba(255, 107, 157, 0.2);
  --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 4px 16px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 8px 32px rgba(0, 0, 0, 0.2);
  --radius-small: 8px;
  --radius-large: 20px;
  --radius-full: 50%;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --logo-border-radius: 12px;
  /* 液态玻璃效果变量 */
  --glass-blur: 12px;
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 导入自定义变量 */
@import url('./custom_vars.css');
@import url('./glass_vars.css');

/* 基础重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  padding-top: 100px; /* 为固定导航栏留出空间 */
}

/* 悬浮导航栏 - 液态玻璃效果 */
.navbar-floating {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 1200px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: 50px;
  padding: 0 var(--spacing-lg);
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 0 rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  /* 防止子元素变换影响布局 */
  contain: layout style;
}

/* 深色主题适配 */
html[data-theme="dark"] .navbar-floating {
  background: rgba(30, 30, 30, 0.72);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.05),
    inset 0 -2px 0 rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Logo容器 */
.logo-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-md); /* 增加logo和菜单按钮之间的间距 */
}

.logo-img {
  height: 35px;
  width: auto;
  border-radius: var(--logo-border-radius, 0px);
  transition: all 0.3s ease;
}

.logo-text {
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  transition: all 0.3s ease;
}

.logo-text:hover {
  transform: scale(1.05);
}

/* 菜单按钮 */
.menu-btn {
  display: flex; /* 默认显示菜单按钮 */
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-color);
  padding: var(--spacing-sm);
  border-radius: var(--radius-small);
  margin-right: var(--spacing-sm);
  transition: all 0.3s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  position: relative;
  z-index: 1001;
}

.menu-btn:hover {
  background: var(--border-color);
  color: var(--primary-color);
  transform: scale(1.1);
}

.menu-btn.active {
  background: var(--primary-color);
  color: white;
  transform: rotate(90deg);
}

/* 导航链接 */
.nav-links {
  display: flex;
  gap: var(--spacing-lg);
  margin-right: var(--spacing-lg);
}

/* 桌面端导航链接样式 */
@media (min-width: 769px) {
  .nav-links {
    display: flex !important; /* 桌面端始终显示 */
    position: static !important; /* 使用静态定位 */
    opacity: 1 !important; /* 始终可见 */
    transform: none !important; /* 无变换 */
    background: transparent !important; /* 透明背景 */
    box-shadow: none !important; /* 无阴影 */
    border: none !important; /* 无边框 */
    padding: 0 !important; /* 无内边距 */
    width: auto !important; /* 自适应宽度 */
    max-width: none !important; /* 无最大宽度限制 */
    flex-direction: row !important; /* 水平排列 */
  }
  
  .nav-links .nav-link {
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    border-radius: var(--radius-large);
    text-align: center;
    font-size: 1rem;
    opacity: 1;
    transform: none;
    transition: all 0.3s ease;
  }
  
  /* 桌面端不应用移动端的active样式 */
  .nav-links.active {
    display: flex !important;
    opacity: 1 !important;
    transform: none !important;
    background: transparent !important;
  }
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-large);
  transition: all 0.3s ease;
  position: relative;
}

.nav-link:hover {
  background: rgba(255, 107, 157, 0.1);
  color: var(--primary-color);
  transform: translateY(-2px);
}

.nav-link.active {
  background: var(--primary-color);
  color: white;
}

/* 右侧按钮 */
.nav-buttons {
  display: flex;
  gap: var(--spacing-sm);
}

.nav-icon-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.nav-icon-btn:hover {
  background: var(--border-color);
  transform: scale(1.1);
}

/* 轮播区域样式 */
.hero-section {
  position: relative;
  height: 80vh;
  min-height: 500px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin-top: 20px;
}

.hero-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  /* 液态玻璃效果 */
  backdrop-filter: blur(var(--glass-blur, 0px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 0px));
  background: var(--glass-bg, transparent);
  border: var(--glass-border, none);
}

/* .hero-overlay 已删除 - 移除了图片上的叠色效果 */

.hero-content {
  text-align: center;
  color: white;
  padding: var(--spacing-xl);
  max-width: 800px;
  z-index: 1;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: var(--spacing-lg);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
  line-height: 1.2;
  animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
  font-size: 1.5rem;
  margin-bottom: var(--spacing-xl);
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
  opacity: 0.9;
  animation: fadeInUp 1s ease-out 0.3s both;
}

/* CTA按钮样式 */
.cta-buttons {
  display: flex;
  gap: var(--spacing-lg);
  justify-content: center;
  flex-wrap: wrap;
  animation: fadeInUp 1s ease-out 0.6s both;
}

.cta-btn {
  display: inline-block;
  padding: var(--spacing-md) var(--spacing-xl);
  border-radius: var(--radius-large);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  min-width: 150px;
  text-align: center;
}

.btn-primary {
  background: white;
  color: var(--primary-color);
  border-color: white;
}

.btn-primary:hover {
  background: transparent;
  color: white;
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  background: transparent;
  color: white;
  border-color: white;
}

.btn-secondary:hover {
  background: white;
  color: var(--primary-color);
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* 简介框样式 */
.intro-box {
  background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
  padding: var(--spacing-xl);
  margin: var(--spacing-xl) auto;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-medium);
  max-width: 800px;
  text-align: center;
  border: 1px solid var(--border-color);
}

.intro-text {
  font-size: 1.3rem;
  color: var(--text-color);
  line-height: 1.8;
}

/* 社交账号区域 */
.social-section {
  padding: var(--spacing-xl) var(--spacing-lg);
  text-align: center;
}

.section-title {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: var(--spacing-lg);
  font-weight: 700;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: var(--spacing-xl);
  flex-wrap: wrap;
}

.social-icon {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--border-color);
}

.social-icon:hover {
  transform: translateY(-5px) scale(1.1);
  box-shadow: var(--shadow-heavy);
  border-color: var(--primary-color);
}

.social-icon img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* 文章区域 */
.articles-section {
  padding: var(--spacing-xl) var(--spacing-lg);
  max-width: 1200px;
  margin: 0 auto;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--spacing-lg);
}

.article-card {
  background: white;
  border-radius: var(--radius-large);
  overflow: hidden;
  box-shadow: var(--shadow-light);
  transition: all 0.3s ease;
  border: 1px solid var(--border-color);
}

.article-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-heavy);
}

.article-cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

.article-content {
  padding: var(--spacing-lg);
}

.article-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: var(--spacing-sm);
  color: var(--text-color);
}

.article-date {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: var(--spacing-sm);
}

.article-excerpt {
  color: #555;
  line-height: 1.6;
  margin-bottom: var(--spacing-md);
}

.read-more {
  display: inline-block;
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
}

.read-more:hover {
  color: var(--primary-dark);
  transform: translateX(5px);
}

/* 底部样式 */
.footer {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: black;
  text-align: center;
  padding: var(--spacing-lg);
  margin-top: var(--spacing-xl);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1),
              inset 0 2px 0 rgba(255, 255, 255, 0.3),
              inset 0 -2px 0 rgba(0, 0, 0, 0.1);
}

.footer p {
  margin: var(--spacing-sm) 0;
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.3s ease;
}

.footer a:hover {
  color: white;
  text-decoration: underline;
}

/* 动画定义 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 移动端菜单样式 */
@media (max-width: 768px) {
  .menu-btn {
    display: flex;
  }
  
  /* 防止菜单激活时页面滚动和地址栏变化 */
  body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
  }
  
  /* 确保菜单容器不影响视口 */
  .nav-links {
    /* 已经设置为fixed定位 */
  }
  
  .nav-links {
    display: none;
    position: fixed; /* 改为fixed定位避免影响页面流 */
    top: 90px; /* 固定距离顶部的位置 */
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    width: 95%;
    max-width: 350px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--spacing-md);
    border-radius: var(--radius-large);
    box-shadow: var(--shadow-heavy);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    /* 防止触发浏览器地址栏变化 */
    will-change: transform, opacity;
    contain: layout style;
  }
  
  html[data-theme="dark"] .nav-links {
    background: rgba(30, 30, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .nav-links.active {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    padding: 20px !important;
    flex-direction: column !important;
    align-items: center !important;
    z-index: 1000 !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
  }
  
  /* 菜单项动画 */
  .nav-links .nav-link {
    padding: var(--spacing-lg);
    margin: var(--spacing-xs) 0;
    border-radius: var(--radius-small);
    text-align: center;
    font-size: 1.1rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease 0.1s;
  }
  
  .nav-links.active .nav-link {
    opacity: 1 !important;
    transform: translateY(0) !important;
    display: block !important;
    width: 100% !important;
    text-align: center !important;
    padding: 15px 20px !important;
    margin: 5px 0 !important;
    font-size: 1.1rem !important;
  }
  
  .nav-links.active .nav-link:nth-child(1) { transition-delay: 0.1s; }
  .nav-links.active .nav-link:nth-child(2) { transition-delay: 0.15s; }
  .nav-links.active .nav-link:nth-child(3) { transition-delay: 0.2s; }
  .nav-links.active .nav-link:nth-child(4) { transition-delay: 0.25s; }
  .nav-links.active .nav-link:nth-child(5) { transition-delay: 0.3s; }
  
  .nav-link:hover {
    background: rgba(255, 107, 157, 0.15);
    transform: translateX(5px);
  }
  
  .nav-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    background: rgba(255, 107, 157, 0.2);
  }
  
  .nav-link.active {
    background: var(--primary-color);
    color: white;
    transform: scale(1.02);
  }
  
  /* 菜单按钮焦点样式 */
  .menu-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    background: rgba(255, 107, 157, 0.1);
  }
  
  .menu-btn.active {
    background: var(--primary-color);
    color: white;
    transform: rotate(90deg);
  }
  
  /* 调整导航栏在移动端的样式 */
  .navbar-floating {
    width: 95%;
    height: 65px; /* 从50px放大到65px */
    padding: 0 var(--spacing-md);
  }

  .logo-img {
    height: 35px; /* 从30px放大到35px */
  }
  
  .logo-text {
    font-size: 1.3rem; /* 从1.2rem放大到1.3rem */
  }

  .nav-icon-btn {
    width: 32px;
    height: 32px;
  }
  
  .theme-toggle {
    border: none !important;
    border-radius: 50% !important;
    width: 40px !important;
    height: 40px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  .nav-buttons {
    gap: var(--spacing-xs);
  }
  
  /* 轮播区域移动端适配 */
  .hero-section {
    height: 70vh;
    min-height: 400px;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.2rem;
  }
  
  .cta-buttons {
    flex-direction: row; /* 改为水平排列 */
    gap: var(--spacing-md);
    justify-content: center; /* 居中对齐 */
  }
  
  .cta-btn {
    width: auto; /* 改为自动宽度 */
    max-width: none; /* 移除最大宽度限制 */
    min-width: 140px; /* 设置最小宽度确保可点击 */
  }
  
  /* 其他区域移动端适配 */
  .social-icons {
    gap: var(--spacing-lg);
  }
  
  .social-icon {
    width: 70px;
    height: 70px;
  }
  
  .social-icon img {
    width: 35px;
    height: 35px;
  }
  
  .articles-grid {
    grid-template-columns: 1fr;
  }
}

/* 小屏幕适配 */
@media (max-width: 480px) {
  .navbar-floating {
    width: 98%;
    height: 60px; /* 从45px放大到60px */
    padding: 0 var(--spacing-sm);
  }
  
  .logo-text {
    font-size: 1rem;
  }
  
  .menu-btn {
    width: 35px;
    height: 35px;
    font-size: 1.3rem;
  }
  
  .nav-links {
    width: 98%;
    max-width: 300px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1rem;
  }
  
  .section-title {
    font-size: 2rem;
  }
  
  /* 放大CTA按钮在小屏幕上的尺寸 */
  .cta-buttons {
    gap: var(--spacing-md);
  }
  
  .cta-btn {
    padding: 16px 24px; /* 增大内边距 */
    font-size: 1.3rem; /* 增大字体 */
    min-width: 180px; /* 增小最小宽度 */
    font-weight: 700; /* 加粗字体 */
  }
}

/* 可访问性增强 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 双按钮布局样式 */
.dual-layout {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
  width: 100%;
}

.btn-white {
  background: white;
  color: var(--primary-color);
  border: 2px solid white;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-white:hover {
  background: #f8f9fa;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* 响应式调整 */
@media (max-width: 768px) {
  .dual-layout {
    gap: 12px;
  }
  
  .btn-white, .btn-glass {
    width: 44%;
    min-width: 100px;
    padding: 10px 12px;
    font-size: 13px;
  }
}

/* 小屏幕优化 */
@media (max-width: 480px) {
  .dual-layout {
    gap: 8px;
  }
  
  .btn-white, .btn-glass {
    width: 43%;
    min-width: 85px;
    padding: 8px 10px;
    font-size: 12px;
  }
}

/* 超小屏幕极限优化 */
@media (max-width: 320px) {
  .dual-layout {
    gap: 6px;
  }
  
  .btn-white, .btn-glass {
    width: 42%;
    min-width: 75px;
    padding: 6px 8px;
    font-size: 11px;
  }
  
  /* 超小屏幕下进一步放大CTA按钮 */
  .cta-btn {
    padding: 18px 28px; /* 进一步增大 */
    font-size: 1.4rem; /* 进一步增大字体 */
    min-width: 200px; /* 进一步增大最小宽度 */
  }
  
  /* 超小屏幕下最大化导航栏 */
  .navbar-floating {
    height: 65px; /* 保持与768px以下相同的高度 */
    width: 99%;
  }
  
  .logo-img {
    height: 38px; /* 进一步放大logo */
  }
  
  .logo-text {
    font-size: 1.4rem; /* 进一步放大文字 */
  }
}

/* 深色模式样式 */
[data-theme="dark"] {
  --bg-color: #1a1a1a;
  --text-color: #ffffff;
  --border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] body {
  background-color: #1a1a1a;
  color: #ffffff;
}

[data-theme="dark"] .navbar-floating {
  background: rgba(30, 30, 30, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle {
  background: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2) !important;
}

[data-theme="dark"] .menu-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-theme="dark"] .menu-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .nav-icon-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-theme="dark"] .nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .footer {
  background: rgba(30, 30, 30, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 高对比度模式 */
@media (prefers-contrast: high) {
  :root {
    --border-color: #666666;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  
  .navbar-floating {
    border: 2px solid var(--border-color);
  }
}