/* 
 * EduAI Portal CSS - 版本 2.1.0
 * 修复响应式布局问题 - 2025-01-27
 * 包含强制水平布局规则和缓存优化
 */

/* CSS变量定义 - 减少重复值 */
:root {
  --primary-color: #007bff;
  --primary-hover: #0056d6;
  --secondary-color: #00b0ff;
  --accent-color: #f97316;
  --accent-hover: #ea580c;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-light: #ffffff;
  --bg-primary: #f8f9fa;
  --bg-white: #ffffff;
  --shadow-light: 0 2px 6px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 8px 20px rgba(0, 0, 0, 0.15);
  --shadow-heavy: 0 15px 35px rgba(0, 123, 255, 0.15);
  --border-radius: 16px;
  --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: var(--bg-primary);
  overflow-x: hidden;
  color: var(--text-primary);
}

html {
  scroll-behavior: smooth;
}

/* ===== 导航栏 ===== */
header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.navbar {
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  background: linear-gradient(90deg, rgba(0, 123, 255, 0.8), rgba(0, 180, 255, 0.7));
  transition: all 0.4s ease;
}

.navbar.scrolled {
  background: linear-gradient(90deg, rgba(0, 123, 255, 1), rgba(0, 150, 255, 1));
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.navbar-brand {
  font-weight: 600;
  letter-spacing: 1px;
  line-height: 1.2;
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 12px;
}

.navbar-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
}

.brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.brand-line-1 {
  font-size: 1rem;
  display: block;
}

.brand-line-2 {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
  display: block;
}

.nav-link {
  color: #fff !important;
  font-weight: 500;
  transition: all 0.3s ease;
}

.nav-link:hover {
  color: #ffe082 !important;
  text-decoration: none;
}

/* ===== Hero 区 ===== */
.hero {
  background: url('../images/hero-bg.jpg') no-repeat center/cover;
  height: 85vh;
  color: #fff;
  text-align: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* 粒子网络Canvas - 性能优化 */
#particleNetworkCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.9;
  will-change: transform; /* 提示浏览器优化 */
  transform: translateZ(0); /* 启用硬件加速 */
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
  padding: 20px;
}

/* 透明毛玻璃容器 */
.glass-container {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  padding: 40px 30px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  position: relative;
}

.hero h1 {
  font-size: 3.2rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  animation: slideInDown 1s ease-out;
  letter-spacing: 1.5px;
  line-height: 1.3;
  margin-bottom: 25px;
  opacity: 0;
  animation-fill-mode: forwards;
}

.hero p {
  font-size: 1.3rem;
  font-weight: 400;
  color: #ffffff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.8px;
  line-height: 1.7;
  margin-top: 20px;
  opacity: 0;
  animation: fadeInUp 1s ease-out 0.5s forwards;
}

.hero-subtitle {
  font-size: 1.1rem;
  margin-top: 15px;
  margin-bottom: 0;
  animation: fadeInUp 1s ease-out 0.8s forwards;
}


/* 合并的通用动画关键帧 - 性能优化 */
@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translate3d(0, -50px, 0); /* 使用3D变换启用硬件加速 */
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 30px, 0); /* 使用3D变换启用硬件加速 */
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}




.hero .btn {
  margin-top: 30px;
  font-size: 1.1rem;
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 600;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #ffffff;
  border: 2px solid rgba(249, 115, 22, 0.3);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 
    0 4px 15px rgba(249, 115, 22, 0.3),
    0 2px 8px rgba(251, 146, 60, 0.2);
}

.hero .btn:hover {
  transform: translate3d(0, -3px, 0); /* 使用3D变换 */
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #ffffff;
  border-color: rgba(249, 115, 22, 0.5);
  box-shadow: 
    0 8px 25px rgba(249, 115, 22, 0.4),
    0 4px 12px rgba(251, 146, 60, 0.3);
}

/* ===== 模块区 ===== */
main {
  padding-top: 100px;
}

/* 单行等宽布局 */
.single-row-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 40px 20px;
  overflow-x: auto;
}

/* 强制桌面端水平布局 - 最高优先级 */
@media screen and (min-width: 601px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
  }
  
  .module-item {
    flex: 1 !important;
    min-width: 220px !important;
    max-width: 250px !important;
  }
}

/* 覆盖Bootstrap的响应式断点 - 确保我们的样式优先级最高 */
@media (min-width: 576px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
  }
}

@media (min-width: 768px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
  }
}

@media (min-width: 992px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
  }
}

@media (min-width: 1200px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
  }
}

.single-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 20px;
  justify-content: center;
  align-items: stretch;
  min-width: 1200px; /* 确保有足够空间 */
}

.module-item {
  flex: 1;
  min-width: 220px;
  max-width: 250px;
  position: relative;
}

.uniform-card {
  width: 100%;
  height: 380px; /* 统一高度 */
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
}

.uniform-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.05), rgba(0, 180, 255, 0.02));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.uniform-card:hover::before {
  opacity: 1;
}

.uniform-card:hover {
  transform: translate3d(0, -8px, 0) scale(1.02); /* 使用3D变换 */
  box-shadow: 0 15px 35px rgba(0, 123, 255, 0.15);
  border-color: rgba(0, 123, 255, 0.2);
}

.uniform-card .card-img-top {
  height: 160px; /* 统一图片高度 */
  object-fit: cover;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
  width: 100%;
}

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

.uniform-card .card-body {
  position: relative;
  z-index: 2;
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.uniform-card .card-title {
  font-weight: 700;
  font-size: 1.2rem;
  color: #2c3e50;
  margin-bottom: 12px;
  line-height: 1.3;
}

.uniform-card .card-text {
  flex-grow: 1;
  color: #6c757d;
  line-height: 1.5;
  font-size: 0.9rem;
  margin-bottom: 15px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3; /* 标准属性 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.uniform-card .btn-module {
  margin-top: auto;
  width: 100%;
  padding: 10px 16px;
  font-size: 0.9rem;
}

/* 响应式优化 */
@media (max-width: 1200px) {
  .single-row {
    min-width: 1000px;
    gap: 15px;
  }
  
  .module-item {
    min-width: 200px;
    max-width: 220px;
  }
  
  .uniform-card {
    height: 360px;
  }
  
  .uniform-card .card-img-top {
    height: 140px;
  }
}

@media (max-width: 992px) {
  .single-row-container {
    padding: 30px 15px;
  }
  
  .single-row {
    min-width: 900px;
    gap: 12px;
  }
  
  .module-item {
    min-width: 180px;
    max-width: 200px;
  }
  
  .uniform-card {
    height: 340px;
  }
  
  .uniform-card .card-img-top {
    height: 120px;
  }
  
  .uniform-card .card-body {
    padding: 15px;
  }
  
  .uniform-card .card-title {
    font-size: 1.1rem;
  }
  
  .uniform-card .card-text {
    font-size: 0.85rem;
  }
}

/* 确保在中等屏幕尺寸下保持水平布局 */
@media (min-width: 601px) {
  .single-row {
    display: flex !important;
    flex-direction: row !important;
  }
}

@media (max-width: 600px) {
  .single-row {
    flex-direction: column !important;
    min-width: auto;
    gap: 15px;
  }
  
  .module-item {
    min-width: auto;
    max-width: 100%;
    width: 100%;
  }
  
  .uniform-card {
    height: 320px;
    max-width: 400px;
    margin: 0 auto;
  }
  
  .uniform-card .card-img-top {
    height: 120px;
  }
}

@media (max-width: 576px) {
  .single-row-container {
    padding: 20px 10px;
  }
  
  .uniform-card {
    height: 300px;
  }
  
  .uniform-card .card-img-top {
    height: 100px;
  }
  
  .uniform-card .card-body {
    padding: 12px;
  }
  
  .uniform-card .card-title {
    font-size: 1rem;
  }
  
  .uniform-card .card-text {
    font-size: 0.8rem;
  }
}

/* 统一卡片基础样式 - 合并重复代码 */
.module-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 400px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border: 2px solid transparent;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #ffffff, #f8f9fa);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  border-radius: 16px;
}

.module-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(0, 123, 255, 0.05), rgba(0, 180, 255, 0.02));
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.module-card:hover::before {
  opacity: 1;
}

.module-card:hover {
  transform: translate3d(0, -8px, 0) scale(1.02); /* 使用3D变换 */
  box-shadow: 0 15px 35px rgba(0, 123, 255, 0.15);
  border-color: rgba(0, 123, 255, 0.2);
  z-index: 10;
  position: relative;
}

.module-card .card-img-top {
  height: 180px;
  object-fit: cover;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
  width: 100%;
}

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

.module-card .card-body {
  position: relative;
  z-index: 2;
  padding: 20px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.module-card .card-title {
  font-weight: 700;
  font-size: 1.4rem;
  color: #2c3e50;
  margin-bottom: 12px;
  line-height: 1.3;
}

.module-card .card-text {
  flex-grow: 1;
  color: #6c757d;
  line-height: 1.6;
  font-size: 0.95rem;
  margin-bottom: 20px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3; /* 标准属性 */
  -webkit-box-orient: vertical;
  overflow: hidden;
}



.section {
  padding: 80px 0;
}

.section h2 {
  font-weight: 600;
  margin-bottom: 50px;
}

/* 优化标题样式 - 突出学问和矩阵的语义关联 */
.section-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 5px; /* 进一步增加字间距 */
  margin-bottom: 60px;
  position: relative;
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.title-line {
  display: block;
  position: relative;
  margin: 0 auto;
  text-align: center;
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.title-separator {
  display: none;
}

/* 高亮关键词 - 八种颜色方案 */
.highlight-word {
  position: relative;
  font-weight: 800;
  transition: all 0.3s ease;
}

/* 学可成矩 - 沉稳蓝系列 */
/* 学 - 学习、知识（深宝蓝色） */
.highlight-word:nth-child(1) {
  color: #003366;
  text-shadow: 0 2px 4px rgba(0, 51, 102, 0.3);
}

/* 可 - 能力、可能性（深宝蓝色变体） */
.highlight-word:nth-child(2) {
  color: #004080;
  text-shadow: 0 2px 4px rgba(0, 64, 128, 0.3);
}

/* 成 - 成就、完成（深宝蓝色变体） */
.highlight-word:nth-child(3) {
  color: #005099;
  text-shadow: 0 2px 4px rgba(0, 80, 153, 0.3);
}

/* 矩 - 规矩、标准（深宝蓝色变体） */
.highlight-word:nth-child(4) {
  color: #0060b3;
  text-shadow: 0 2px 4px rgba(0, 96, 179, 0.3);
}

/* 问以立阵 - 橙色系列 */
/* 问 - 探索、质疑（橙色） */
.title-line:last-child .highlight-word:nth-child(1) {
  color: #FF6600;
  text-shadow: 0 2px 4px rgba(255, 102, 0, 0.3);
}

/* 以 - 方法、手段（橙色变体） */
.title-line:last-child .highlight-word:nth-child(2) {
  color: #ff8533;
  text-shadow: 0 2px 4px rgba(255, 133, 51, 0.3);
}

/* 立 - 建立、确立（橙色变体） */
.title-line:last-child .highlight-word:nth-child(3) {
  color: #ff9933;
  text-shadow: 0 2px 4px rgba(255, 153, 51, 0.3);
}

/* 阵 - 阵型、体系（橙色变体） */
.title-line:last-child .highlight-word:nth-child(4) {
  color: #ffaa44;
  text-shadow: 0 2px 4px rgba(255, 170, 68, 0.3);
}

.highlight-word::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -4px;
  right: -4px;
  bottom: -2px;
  border-radius: 8px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* 学 - 悬停效果（沉稳蓝） */
.highlight-word:nth-child(1)::before {
  background: linear-gradient(135deg, rgba(0, 51, 102, 0.1), rgba(0, 64, 128, 0.1));
}

.highlight-word:nth-child(1):hover {
  color: #002244;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(0, 51, 102, 0.4);
}

/* 可 - 悬停效果（沉稳蓝） */
.highlight-word:nth-child(2)::before {
  background: linear-gradient(135deg, rgba(0, 64, 128, 0.1), rgba(0, 80, 153, 0.1));
}

.highlight-word:nth-child(2):hover {
  color: #003366;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(0, 64, 128, 0.4);
}

/* 成 - 悬停效果（沉稳蓝） */
.highlight-word:nth-child(3)::before {
  background: linear-gradient(135deg, rgba(0, 80, 153, 0.1), rgba(0, 96, 179, 0.1));
}

.highlight-word:nth-child(3):hover {
  color: #004080;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(0, 80, 153, 0.4);
}

/* 矩 - 悬停效果（沉稳蓝） */
.highlight-word:nth-child(4)::before {
  background: linear-gradient(135deg, rgba(0, 96, 179, 0.1), rgba(0, 112, 204, 0.1));
}

.highlight-word:nth-child(4):hover {
  color: #005099;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(0, 96, 179, 0.4);
}

/* 问 - 悬停效果（橙色） */
.title-line:last-child .highlight-word:nth-child(1)::before {
  background: linear-gradient(135deg, rgba(255, 102, 0, 0.1), rgba(255, 133, 51, 0.1));
}

.title-line:last-child .highlight-word:nth-child(1):hover {
  color: #e55a00;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(255, 102, 0, 0.4);
}

/* 以 - 悬停效果（橙色） */
.title-line:last-child .highlight-word:nth-child(2)::before {
  background: linear-gradient(135deg, rgba(255, 133, 51, 0.1), rgba(255, 153, 77, 0.1));
}

.title-line:last-child .highlight-word:nth-child(2):hover {
  color: #ff6600;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(255, 133, 51, 0.4);
}

/* 立 - 悬停效果（橙色） */
.title-line:last-child .highlight-word:nth-child(3)::before {
  background: linear-gradient(135deg, rgba(255, 153, 51, 0.1), rgba(255, 170, 68, 0.1));
}

.title-line:last-child .highlight-word:nth-child(3):hover {
  color: #ff8533;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(255, 153, 51, 0.4);
}

/* 阵 - 悬停效果（橙色） */
.title-line:last-child .highlight-word:nth-child(4)::before {
  background: linear-gradient(135deg, rgba(255, 170, 68, 0.1), rgba(255, 187, 85, 0.1));
}

.title-line:last-child .highlight-word:nth-child(4):hover {
  color: #ff9933;
  transform: scale(1.05);
  text-shadow: 0 4px 8px rgba(255, 170, 68, 0.4);
}

.highlight-word:hover::before {
  opacity: 1;
}

/* 移除所有连接线效果，保持简洁 */
.title-line .highlight-word::after {
  display: none;
}

/* 响应式优化 */
@media (max-width: 768px) {
  .section-title {
    font-size: 2rem;
    letter-spacing: 2px; /* 移动端适当减少字间距 */
  }
  
  .title-line {
    margin: 0 auto;
  }
}

@media (max-width: 480px) {
  .section-title {
    font-size: 1.6rem;
    letter-spacing: 1px; /* 小屏幕保持适中的字间距 */
  }
}

.card {
  border: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  background: #fff;
  opacity: 0;
  transform: translateY(30px);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s ease;
}


.card-img-top {
  object-fit: cover;
  filter: brightness(1.1);
}

.card-title {
  font-weight: 600;
}

/* 统一模块"打开项目"按钮样式，保证颜色一致和良好对比度 */
.btn-module {
  background-color: #007bff; /* 品牌蓝 */
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease, background-color 0.2s ease, transform 0.12s ease;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
}

.btn-module:hover,
.btn-module:focus {
  background-color: #0056d6;
  color: #fff;
  transform: translate3d(0, -2px, 0); /* 使用3D变换 */
  text-decoration: none;
  outline: none;
  box-shadow: 0 6px 18px rgba(0,123,255,0.18);
}


/* ===== 页脚 ===== */
footer {
  background: linear-gradient(90deg, #007bff, #00b0ff);
  color: #fff;
  text-align: center;
  padding: 25px 0;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
}

footer a {
  color: #ffe082;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}


@media (max-width: 768px) {
  .hero-content {
    padding: 15px;
  }
  
  .glass-container {
    padding: 30px 20px;
    border-radius: 15px;
  }
  
  .hero h1 {
    font-size: 2.2rem;
    letter-spacing: 1px;
    line-height: 1.4;
  }
  
  .hero p,
  .hero-subtitle {
    font-size: 1.1rem;
    letter-spacing: 0.5px;
    line-height: 1.6;
  }
  
  .section {
    padding: 60px 0;
  }
  
  .card {
    transform: none !important;
    opacity: 1 !important;
  }
  
  /* 移动端模块布局优化 */
}

@media (max-width: 480px) {
  .hero-content {
    padding: 10px;
  }
  
  .glass-container {
    padding: 25px 15px;
    border-radius: 12px;
  }
  
  .hero h1 {
    font-size: 1.8rem;
    letter-spacing: 0.5px;
    line-height: 1.3;
  }
  
  .hero p,
  .hero-subtitle {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    line-height: 1.5;
  }
  
  .hero .btn {
    font-size: 1rem;
    padding: 10px 24px;
  }
}
