/* ===== 全局变量（Fudan Blue Design System） ===== */
:root {
  --bg: #ffffff;
  --bg-soft: #f5f7fb;
  --bg-blur: rgba(255, 255, 255, 0.75);

  --text: #0b1f3a;        /* 带蓝调的深色 */
  --text-light: #4a5a70;
  --text-muted: #8a94a6;

  --border: rgba(0, 58, 143, 0.08);

  /* ===== 复旦蓝体系 ===== */
  --brand: #003a8f;       /* 主色 */
  --brand-2: #1d4ed8;     /* 次级（hover） */
  --brand-3: #93c5fd;     /* 弱提示 */

  --brand-light: #e6efff;
  --brand-soft: rgba(0, 58, 143, 0.08);

  --radius: 10px;
  --nav-height: 68px;

  /* Typography scale */
  --font-body: 1rem;
  --font-nav: 0.95rem;
}

/* ===== 基础与工程网格背景 ===== */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  overflow-x: hidden;

  font-family: Inter, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  color: var(--text);

  /* 核心改动：将 rgba 透明度调低至 0.015，实现更隐约的视觉效果 */
  background: 
    linear-gradient(rgba(0, 58, 143, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 58, 143, 0.015) 1px, transparent 1px),
    radial-gradient(circle at top right, #eef3ff 0%, #ffffff 40%);
  
  background-size: 40px 40px, 40px 40px, auto;
  background-attachment: fixed;

  -webkit-font-smoothing: antialiased;
}

/* ===== Navbar (左右拉满模式) ===== */
.nav-bar {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);

  display: flex;
  justify-content: space-between;
  align-items: center;

  /* 使用 vw 单位实现大屏下的自适应拉满 */
  padding: 0 5vw; 

  background: var(--bg-blur);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);

  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Logo（品牌锚点） */
.nav-left a {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  text-decoration: none;

  color: var(--brand); /* #003a8f (Fudan Blue) */
  font-weight: 700;
}

/* Nav 列表 */
.nav-right ul {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Nav 链接 */
.nav-right ul li a {
  font-size: var(--font-nav);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-light);
  padding: 8px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-right ul li a:hover {
  color: var(--brand);
  background: var(--brand-light);
}

.nav-right ul li a.active {
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 600;
}

/* ===== Hero (全屏居中) ===== */
.hero-container {
  width: 100%;
  box-sizing: border-box;
  min-height: calc(100vh - var(--nav-height));

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  /* Padding 保持与 Nav 一致的 5vw，形成视觉垂直对齐 */
  padding: 6vh 5vw 10vh 5vw; 
  text-align: center;
  padding-top: 10vh;
  padding-bottom: 20vh; 
}

/* 主标题 */
.main-title {
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 900;
  letter-spacing: -0.045em;
  line-height: 0.88;
  margin: 0;

  background: linear-gradient(
    135deg,
    var(--brand) 0%,
    var(--brand-2) 60%,
    var(--brand-3) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;

  text-shadow: 0 10px 30px rgba(0, 58, 143, 0.08);
}

/* tagline */
.tagline {
  font-size: clamp(1.35rem, 3.2vw, 2.2rem);
  margin-top: 1.2rem;
  color: var(--text-light);
  font-weight: 300;
  max-width: 820px;
  line-height: 1.55;
}

/* 防止语义断裂 */
.nowrap {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .nowrap { white-space: normal; }
  .nav-bar { padding: 0 20px; }
  .hero-container { padding: 6vh 20px 10vh 20px; }
}

/* Coming soon */
.coming-soon {
  font-size: clamp(1.2rem, 3vw, 1.8rem);
  color: var(--brand-3);
  margin: 2.2rem 0 3.5rem 0;
  font-weight: 300;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* 强调 */
.highlight {
  color: var(--brand);
  font-weight: 600;
}

/* ===== 其他内容区 ===== */
main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 40px 5vw; /* 这里的 5vw 保证了内容在宽屏下也有呼吸感 */
}

/* ===== 紧凑版列表样式：解决行距过宽问题 ===== */
main ul, 
.vp-doc ul {
  margin: 0.5rem 0 !important; /* 缩小列表整体的上下外边距 */
  padding-left: 1.5rem;
}

main li, 
.vp-doc li {
  /* 关键修改：将行高压低到 1.4 - 1.5 之间，这是最适合阅读的紧凑比例 */
  line-height: 1.5 !important; 
  
  /* 缩小项与项之间的间距 */
  margin-bottom: 0.3rem !important; 
  
  color: var(--text-light);
  font-size: 0.95rem; /* 稍微缩小字号，视觉上会更紧凑 */
}

p {
  line-height: 1.65;
  color: var(--text-light);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

a {
  color: var(--brand);
}

a:hover {
  opacity: 0.85;
}

hr {
  border: none;
  height: 1px;
  background-color: var(--border);
  margin: 24px 0;
}

/* ===== 现代化浅色代码展示卡片 ===== */
.code-preview.light-mode {
  margin-top: 3rem;
  width: 100%;
  max-width: 650px;
  
  /* 关键：使用极浅的背景色，增加通透感 */
  background: rgba(255, 255, 255, 0.6); 
  backdrop-filter: blur(8px); /* 磨砂玻璃效果，透出背后的网格线 */
  
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 15px 40px rgba(0, 58, 143, 0.06); /* 更柔和的投影 */
  text-align: left;
}

.code-header {
  background: rgba(0, 58, 143, 0.03); /* 带有淡淡品牌色的头部 */
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  border-bottom: 1px solid var(--border);
}

.dots {
  display: flex;
  gap: 6px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  opacity: 0.6; /* 调低按钮亮度，使其不刺眼 */
}
.red { background: #ff5f56; }
.yellow { background: #ffbd2e; }
.green { background: #27c93f; }

.code-title {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-left: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
}

.code-preview pre {
  margin: 0;
  padding: 24px;
  overflow-x: auto;
}

.code-preview code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text); /* 使用你定义的深蓝调黑 */
}

/* ===== Yian 代码高亮色值（现代化浅色调） ===== */
.yian-code {
  color: var(--text); /* 默认文字颜色 */
  font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.6;
}

/* 关键字 (如 from, import, return)：Fudan Blue 加粗 */
.hl-keyword {
  color: var(--brand); /* #003a8f */
  font-weight: 600;
}

/* 字符串 (如 "Hello...")：冷静的深绿色 */
.hl-string {
  color: #2a7e43; /* 冷绿，带一点蓝调 */
}

/* 函数名 (如 print, main)：现代化蓝紫色 */
.hl-function {
  color: #5c6bc0; /* 类似 --brand-2 的蓝紫调 */
  font-weight: 500;
}

/* 类型名 (如 i32)：深紫色 */
.hl-type {
  color: #673ab7; /* 经典类型色，带一点严谨感 */
  font-weight: 500;
}

/* 数字 (如 0)：橙色/棕色，增加辨识度 */
.hl-number {
  color: #a0522d; /* 琥珀色，不刺眼 */
}

/* 模块路径 (如 std.core.io)：中灰色，降权处理 */
.hl-module {
  color: var(--text-muted); /* #8a94a6 */
}

/* ===== Footer 备案样式 (极致极简) ===== */
/* ===== Footer 左右拉满样式 ===== */
.site-footer {
  display: flex;
  justify-content: space-between; /* 关键：左右对齐 */
  align-items: center;
  
  width: 100%;
  padding: 30px 5vw; /* 左右间距与 Nav 保持一致 */
  box-sizing: border-box;
  
  border-top: 1px solid var(--border); /* 可选：加一条极细的分割线 */
  margin-top: auto; /* 确保在内容少时依然沉底 */
}

.site-footer a, 
.site-footer span {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.7;
  letter-spacing: 0.02em;
}

.site-footer a {
  text-decoration: none;
  transition: color 0.2s;
}

.site-footer a:hover {
  color: var(--brand);
  opacity: 1;
}

/* 移动端适配：空间不足时改为堆叠居中 */
@media (max-width: 600px) {
  .site-footer {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }
}

/* 如果你的页面内容很少（比如 People 页面），确保 Footer 总是沉在底部 */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main, .hero-container {
  flex: 1; /* 自动撑开中间区域 */
}


/* ===== Responsive Fix Patch ===== */

/* 允许 flex 子元素收缩 */
.hero-container > *,
.nav-bar > * {
  min-width: 0;
}

/* nav 支持换行 */
.nav-bar {
  flex-wrap: wrap;
}

/* 文本兜底断行 */
.tagline {
  overflow-wrap: break-word;
}

/* 移动端修复 */
@media (max-width: 768px) {
  .nav-right ul {
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
  }

  body {
    background-attachment: scroll;
  }
}
