/* ============================================================
   浅の小站 — 全站共享基础层（site-base）
   Apple Liquid Glass × Japanese Aesthetic
   ------------------------------------------------------------
   职责（唯一所有者）：
     reset / body / 背景层 / 遮罩层 / 氛围光 / 和纸噪点
     顶部导航（含 active 状态）/ 页脚 / 访问徽章 / 动态签名
     页面标题对（.page-title / .page-subtitle）
     章节标题公共部（.section-title + 蓝竖线 ::before）
   加载顺序：tokens.css → site-base.css → <page>.css
   页面 CSS 只负责各自独有内容；差异通过 modifier 表达，不重写基础段。
   ============================================================ */

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

/* ── Body ── */
body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg-color);
  letter-spacing: 0.01em;
}

/* ── 背景层 ──
   静态。不参与动画（日式克制：动效服务于内容，不服务于"看起来高级"）。
   filter 压暗降饱和是文字层级的基础。
   PHASE 1.4：三个参数改为 CSS 变量，页面可按语义覆盖（默认值 == 原值）。
   注意：index 的实际观感由 WebGL 折射层完全覆盖（实测 Δ=0），此处参数仅影响
   WebGL 正常渲染之外的路径（降级 / fallback），故 index 必须显式钉住原值。 */
.background-image {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../images/home_bg.jpg') center/cover no-repeat;
  z-index: -2;
  filter: saturate(var(--bg-saturate)) brightness(var(--bg-brightness)) contrast(var(--bg-contrast));
}

/* ── 遮罩层 ──
   机制统一：暖色微光 ×2（氛围）+ 黑色强度变量（内容保护）。
   强度由页面按阅读需求设置 --overlay-strength，实现统一而语义有别。 */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(180, 210, 240, 0.03) 0%, transparent 50%),
    rgba(0, 0, 0, var(--overlay-strength, 0.48));
  z-index: -1;
}

/* ── 氛围光 ──
   静态柔和。不做有机变形动画。 */
.theme-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 1200px;
  height: 1200px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(circle at 30% 30%, rgba(180, 210, 240, 0.10), transparent 45%),
    radial-gradient(circle at 70% 70%, rgba(220, 200, 210, 0.06), transparent 45%);
  z-index: -1;
  pointer-events: none;
}

/* ── 和纸噪点 ── */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

/* ── 顶部导航 ── */
.top-nav {
  position: fixed;
  top: 0;
  width: 100%;
  padding: var(--space-4) 0;
  backdrop-filter: var(--glass-nav);
  -webkit-backdrop-filter: var(--glass-nav);
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    0 4px 20px rgba(0, 0, 0, 0.08);
  z-index: 50;
}

.nav-inner {
  width: 88%;
  margin: auto;
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.nav-logo {
  position: relative;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: 0.08em;   /* 日式排版节奏：字距提升为全站标准 */
}

/* 首页当前页指示：与 .nav-links 使用同一套微弱下划线语言 */
.nav-logo::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav-logo.active::after { width: 100%; }

.nav-links { display: flex; gap: 1.8rem; }

.nav-links a {
  position: relative;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-base);
  letter-spacing: 0.06em;
  transition: color var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
  transform: translateY(-1px);
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--text-primary);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav-links a:hover::after,
.nav-links a.active::after { width: 100%; }

/* ── 页脚 ── */
.site-footer {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  padding: var(--space-6) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.site-footer p {
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* ── 动态签名 ── */
#dynamic-signature {
  margin-bottom: var(--space-2);
  transition: opacity var(--duration-signature) var(--ease-out);
}

/* ── 访问徽章 ── */
.visit-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-surface);
  -webkit-backdrop-filter: var(--glass-surface);
  border: 1px solid var(--glass-border);
  box-shadow: var(--highlight-top), var(--shadow-sm);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition:
    transform var(--duration-normal) var(--ease-spring),
    background var(--duration-normal) var(--ease-out);
}

.visit-badge:hover {
  transform: translateY(-2px);
  background: var(--glass-bg-hover);
}

/* ── 页面标题对 ── */
.page-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin-bottom: var(--space-2);
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
}

/* ── 章节标题公共部（左侧蓝竖线）──
   resources 页通过 .section-title--with-tag 追加 flex 布局与上间距 */
.section-title {
  font-size: var(--text-xl);
  padding-left: var(--space-3);
  position: relative;
  margin-bottom: var(--space-5);
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.2em;
  background: linear-gradient(180deg,
    var(--text-primary),
    var(--accent-blue));
  border-radius: 2px;
}

.section-title--with-tag {
  margin-top: var(--space-10);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title .tag {
  font-size: var(--text-2xs);
  padding: 0.2rem 0.6rem;
  background: var(--glass-bg);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-weight: var(--weight-normal);
}

/* ── 响应式（共享组件）── */
@media (max-width: 768px) {
  .top-nav { padding: 0.8rem 0; }
  .nav-inner { width: 92%; gap: var(--space-4); }
  .nav-logo { font-size: 1.1rem; }
  .nav-links { gap: var(--space-5); }
  .nav-links a { font-size: 0.9rem; }
  .page-title { font-size: 1.5rem; }
  .theme-glow { width: 600px; height: 600px; opacity: 0.6; }
  .site-footer { padding: var(--space-5) var(--space-4); font-size: 0.85rem; }
  .site-footer p { font-size: var(--text-xs); }
}

@media (max-width: 480px) {
  .page-title { font-size: 1.3rem; }
}
