
/* 
整体样式设置
设置全局字体、盒模型，确保元素在各个屏幕尺寸上都能正确显示。
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 
主体背景颜色采用深蓝色渐变，避免纯白色，提高视觉层次感。
*/
body {
  font-family: 'Roboto', sans-serif;
  background: linear-gradient(135deg, #0D47A1, #1976D2);
  color: #333333;
  line-height: 1.6;
  padding: 20px;
}

/* 
导航栏样式
固定在顶部，使用深蓝色背景，文字为白色，包含多级菜单。
*/
.navbar {
  position: fixed;
  top: 0;
  width: 100%;
  background: #0D47A1;
  padding: 15px 0;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar ul {
  display: flex;
  justify-content: center;
  list-style: none;
}

.navbar li {
  position: relative;
  margin: 0 20px;
}

.navbar a {
  color: #FFFFFF;
  text-decoration: none;
  font-size: 16px;
  transition: color 0.3s;
}

.navbar a:hover {
  color: #FFAB00;
}

/* 
多级菜单样式
子菜单在父菜单悬停时显示，使用深蓝色背景和圆角。
*/
.navbar li ul {
  display: none;
  position: absolute;
  top: 45px;
  left: 0;
  background: #1976D2;
  list-style: none;
  padding: 10px 0;
  border-radius: 4px;
  min-width: 150px;
}

.navbar li:hover ul {
  display: block;
}

.navbar li ul li {
  margin: 0;
  padding: 10px 20px;
}

.navbar li ul li a:hover {
  color: #FFAB00;
}

/* 
主体内容区
设置导航栏下方的主要内容区域，采用适当的上边距以避免被固定导航栏遮挡。
*/
.main-content {
  max-width: 1200px;
  margin: 100px auto 0 auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* 
标题样式
不同层级的标题使用不同的字体大小和颜色，增强层次感。
*/
h2, h3, h4 {
  color: #0D47A1;
  margin-bottom: 15px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

h4 {
  font-size: 18px;
}

/* 
段落样式
段落之间留有适当的间距，提高可读性。
*/
p {
  margin-bottom: 15px;
  font-size: 16px;
}

/* 
代码块样式
使用深灰背景和浅色字体，带有圆角和内边距，代码语法高亮明显。
*/
pre {
  background: #f5f5f5;
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 15px;
}

code {
  font-family: 'Courier New', Courier, monospace;
  color: #D32F2F;
}

/* 
按钮样式
主按钮使用橙色，带有阴影和过渡效果，悬停时颜色加深。
*/
.button {
  background: #FFAB00;
  color: #FFFFFF;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: background 0.3s, box-shadow 0.3s;
}

.button:hover {
  background: #FFC107;
  box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

/* 
图片样式
限制图片最大宽度，添加圆角和阴影，悬停时稍作放大。
*/
img {
  max-width: 650px;
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
}

img:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 12px rgba(0,0,0,0.2);
}

/* 
响应式布局
使用媒体查询优化不同设备上的显示效果，确保无水平滚动条。
*/
@media (max-width: 768px) {
  .navbar ul {
    flex-direction: column;
    align-items: center;
  }

  .navbar li {
    margin: 10px 0;
  }

  .main-content {
    padding: 10px;
  }

  h2 {
    font-size: 22px;
  }

  h3 {
    font-size: 18px;
  }

  h4 {
    font-size: 16px;
  }

  p {
    font-size: 15px;
  }

  .button {
    width: 100%;
    text-align: center;
  }
}

/* 
代码示例块样式
为文章中的代码示例添加独特的背景和边框，方便区分正文内容。
*/
.code-block {
  background: #212121;
  color: #EEEEEE;
  padding: 15px;
  border-radius: 6px;
  font-family: 'Courier New', Courier, monospace;
  overflow-x: auto;
  margin-bottom: 15px;
}

.code-block code {
  color: #81D4FA;
}

/* 
强调文字样式
使用加粗字体和不同颜色突出重要信息。
*/
strong {
  color: #0D47A1;
}

/* 
折叠区域样式
次要信息默认隐藏，用户点击后展开显示。
*/
.collapsible {
  background-color: #1976D2;
  color: white;
  cursor: pointer;
  padding: 10px;
  width: 100%;
  border: none;
  text-align: left;
  outline: none;
  font-size: 16px;
  border-radius: 4px;
  margin-bottom: 10px;
  transition: background 0.3s;
}

.collapsible:hover {
  background-color: #0D47A1;
}

.content {
  padding: 0 15px;
  display: none;
  overflow: hidden;
  background-color: #f1f1f1;
  border-radius: 4px;
  margin-bottom: 15px;
}

.content p {
  font-size: 14px;
  color: #333333;
}

/* 
加载动画样式
简单的旋转动画，用于页面加载时显示。
*/
.loader {
  border: 8px solid #f3f3f3;
  border-top: 8px solid #1976D2;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  animation: spin 1s linear infinite;
  margin: 100px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 
推荐卡片样式
用于展示个性化推荐内容，带有悬停效果。
*/
.recommendation-card {
  background: #FFFFFF;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  margin-bottom: 20px;
}

.recommendation-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.recommendation-card .content {
  padding: 15px;
}

.recommendation-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 12px 20px rgba(0,0,0,0.2);
}

/* 
响应式图片布局
确保在小屏设备上图片排列合理，不会过窄。
*/
@media (max-width: 500px) {
  .article-content {
    padding: 10px;
  }
}

