/* ===== 全局样式 ===== */
:root {
  --primary: #3a7ca5;      /* 主色调：温柔的蓝色 */
  --secondary: #f9c74f;    /* 点缀色：温暖的黄色 */
  --light: #f8f9fa;
  --gray: #e9ecef;
  --dark: #2b2d42;
  --text: #4a4e69;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
  --radius: 12px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background-color: #fff;
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

/* ===== 导航栏 ===== */
header {
  background-color: rgba(255, 255, 255, 0.85);  /* 半透明白 */;
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0.8rem;
  padding: 0.8rem 0;
  background-image: url('../images/header.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  left: 0;
  right: 0;
}

/* ===== 占位符负责 sticky ===== */
#header-placeholder {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  min-height: 180px;      /* 给一个大概高度，防止加载闪烁 */
  display: block;
}

/* ===== 品牌行：Logo左，文字右 ===== */
.brand-row {
  display: flex;
  justify-content: flex-start;  /* 左右两端对齐 */
  align-items: center;            /* 垂直居中 */
  flex-wrap: wrap;               /* 手机版自动换行 */
  margin: 1rem 0;               /* 上下间距 */
}

.brand-text {
  display: flex;
  flex-direction: column;        /* 文字竖排 */
  align-items: flex-end;        /* 文字右对齐 */
  text-align: right;           /* 文字右对齐 */
}

.brand-text h1 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--primary);
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);  /* 白色文字阴影，提亮 */
}

.brand-text p {
  margin: 4px 0;
  font-size: 1rem;
  color: var(--dark);
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);  /* 白色文字阴影，提亮 */
}

.brand-text .tagline {
  font-size: 0.85rem;
  color: var(--text);
  opacity: 0.8;
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);  /* 白色文字阴影，提亮 */
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

/* ===== logo - 图片版 ===== */
.logo {
  display: inline-block;
  line-height: 1;
  text-decoration: none;
  background-color: rgba(255, 255, 255, 0.2);  /* 极淡的白色 */
  backdrop-filter: blur(4px);                   /* 轻微毛玻璃 */
  -webkit-backdrop-filter: blur(4px);
  border-radius: 12px;                          /* 圆角，更柔和 */
  padding: 0.3rem 0.8rem;                       /* 内边距，让logo有呼吸空间 */
  transition: all 0.2s ease;
}

.logo:hover {
  background-color: rgba(255, 255, 255, 0.3);   /* 悬停时稍微明显一点 */
  backdrop-filter: blur(6px);
}

.logo img {
  display: block;
  height: 120px;        /* 控制logo高度，宽度自动等比缩放 */
  width: auto;
  object-fit: contain;
}

.nav-links {
  display: flex;
  justify-content: flex-end;  /* ✅ 加上这一行，强制右对齐 */
  gap: 2rem;
  list-style: none;
  margin: 0;
  margin-left: auto;         /* ✅ 加上这一行——这才是真正的“推右神器” */
  padding-left: 0;
  padding-right: 0;          /* 可选，确保右侧无多余空白 */
  text-shadow: 0 1px 2px rgba(255,255,255,0.8);  /* 白色文字阴影，提亮 */
}

.nav-links a {
  text-decoration: none;
  color: var(--dark);
  font-weight: 500;
  transition: color 0.2s;
  padding: 0.5rem 0;
}

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

/* 📌 当前页面高亮 */
.nav-links a.active {
  color: var(--primary);
  border-bottom: 3px solid var(--secondary);
}

/* 下拉菜单（资源分享父级） */
.dropdown {
  position: relative;
  display: inline-block;
}

/* 一级链接样式 - 资源分享 */
.dropdown > a {
  display: inline-block;
  color: var(--dark);
  text-decoration: none;
  padding: 0.5rem 0;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: color 0.2s;
}

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

/* 当前页面高亮 - 父页面（资源分享） */
.dropdown > a.active {
  color: var(--primary);
  border-bottom-color: var(--secondary);
}

/* 下拉菜单容器 */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: white;
  box-shadow: var(--shadow);
  border-radius: 8px;
  padding: 0.75rem 0;
  min-width: 200px;
  list-style: none;
  z-index: 1000;
}

/* 悬停显示下拉菜单 */
.dropdown:hover .dropdown-menu {
  display: block;
}

/* 下拉菜单项 */
.dropdown-menu li {
  padding: 0;
}

.dropdown-menu a {
  display: block;
  padding: 0.6rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.dropdown-menu a:hover {
  background-color: var(--light);
  color: var(--primary);
}

/* 当前页面高亮 - 子页面（常用App/网站/好书/下载） */
.dropdown-menu a.active {
  background-color: var(--light);
  color: var(--primary);
  font-weight: 500;
  border-left: 4px solid var(--secondary);
}


/* ===== 面包屑导航 ===== */
.breadcrumb {
  background-color: var(--light);
  padding: 0.75rem 1.5rem;
  border-radius: 30px;
  margin: 2rem 0 1rem;
  font-size: 0.9rem;
}

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

.breadcrumb a:hover {
  text-decoration: underline;
}

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

.card {
  background: white;
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.08);
}

.card h3 {
  margin-bottom: 0.75rem;
  color: var(--dark);
}

.card p {
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.btn {
  display: inline-block;
  background-color: var(--primary);
  color: white;
  padding: 0.5rem 1.25rem;
  border-radius: 30px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.btn:hover {
  background-color: #2d5e7e;
}

/* ===== 页脚样式 ===== */
footer {
  background-color: white;
  margin-top: 4rem;
}

footer .container {
  padding: 1rem 0;
}

footer p {
  margin: 0;
  line-height: 1.6;
}

[id] {
    scroll-margin-top: 100px;
}


/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
  nav {
    flex-direction: column;
    gap: 1rem;
  }
  
  .nav-links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
  
  .dropdown-menu {
    position: static;
    box-shadow: none;
    padding-left: 1.5rem;
    min-width:100%;
    display: none;
  }
  
  .dropdown.active .dropdown-menu {
    display: block;
  }
  
  .dropdown > a {
    width: 100%;
  }
  
   footer {
    margin-top: 3rem;
  }
  
  footer p {
    font-size: 12px;
  }


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