/**
 * 武侠梦漫画网站 - 全局样式系统
 * 文件路径: /public/assets/css/styles.css
 * 功能: 定义设计Token、组件样式、响应式布局、动画效果
 * 依赖: Font Awesome 6.4 (CDN), Tailwind CSS (CDN)
 * 优先级: main
 * 
 * 设计特点:
 * - 移动优先响应式设计
 * - 武侠文化视觉风格（朱砂红、金色、青色）
 * - 深色背景模拟古籍夜读氛围
 * - 水墨晕染风格动效
 * - 无障碍支持（键盘导航、屏幕阅读器、减弱动画）
 */

/* ===== 系统配置与品牌色（直接赋值）===== */
:root {
  /* 系统类型标识 */
  --sys-type: content;
  --theme-mode: dark;
  --motion-level: standard;

  /* 品牌色 - 武侠风格：朱砂红、金色、青色 */
  --brand-primary: #C41E3A;      /* 朱砂红 - 侠义热血 */
  --brand-secondary: #D4AF37;    /* 金色 - 江湖尊贵 */
  --brand-accent: #00B4D8;       /* 青色 - 剑气灵动 */

  /* 语义色彩 - 自动计算 */
  --bg-default: #0a0a0f;         /* 深夜黑 - 古籍夜读氛围 */
  --bg-subtle: color-mix(in srgb, var(--bg-default) 95%, var(--brand-primary));
  --bg-hover: color-mix(in srgb, var(--bg-default) 90%, var(--brand-primary));
  --fg-default: #fafafa;         /* 宣纸白 */
  --fg-muted: color-mix(in srgb, var(--fg-default) 60%, var(--bg-default));
  --fg-inverse: var(--bg-default);
  --surface-default: color-mix(in srgb, var(--bg-default) 97%, var(--brand-primary));
  --surface-elevated: color-mix(in srgb, var(--bg-default) 92%, white);
  --surface-overlay: color-mix(in srgb, var(--bg-default) 50%, black);
  --border-default: color-mix(in srgb, var(--fg-default) 10%, transparent);
  --border-hover: color-mix(in srgb, var(--brand-primary) 30%, transparent);
  --border-active: var(--brand-primary);
  --status-success: #10B981;
  --status-warning: #F59E0B;
  --status-error: #EF4444;
  --status-info: var(--brand-accent);

  /* 组件色 */
  --color-primary: var(--brand-primary);
  --color-primary-fg: var(--fg-default);
  --color-secondary: var(--surface-elevated);
  --color-secondary-fg: var(--fg-default);
  --color-accent: var(--brand-accent);
  --color-accent-fg: var(--bg-default);
  --color-muted: var(--surface-default);
  --color-muted-fg: var(--fg-muted);
  --color-card: var(--surface-default);
  --color-card-fg: var(--fg-default);
  --color-border: var(--border-default);
  --color-input: var(--border-default);
  --color-ring: var(--brand-accent);
  --color-destructive: var(--status-error);
  --color-destructive-fg: var(--fg-default);

  /* 渐变 - 水墨风格 */
  --gradient-primary: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
  --gradient-surface: linear-gradient(180deg, var(--surface-elevated) 0%, var(--surface-default) 100%);
  --gradient-mesh:
    radial-gradient(at 0% 0%, color-mix(in srgb, var(--brand-primary) 30%, transparent) 0%, transparent 50%),
    radial-gradient(at 100% 0%, color-mix(in srgb, var(--brand-secondary) 20%, transparent) 0%, transparent 50%),
    radial-gradient(at 100% 100%, color-mix(in srgb, var(--brand-accent) 20%, transparent) 0%, transparent 50%),
    radial-gradient(at 0% 100%, color-mix(in srgb, var(--brand-primary) 15%, transparent) 0%, transparent 50%);

  /* 排版 - 融合传统与现代 */
  --font-sans: 'Noto Sans SC', 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Noto Serif SC', 'Plus Jakarta Sans', var(--font-sans);
  --font-mono: 'JetBrains Mono', monospace;
  --text-xs: 0.75rem;      /* 12px */
  --text-sm: 0.875rem;     /* 14px */
  --text-base: 1rem;       /* 16px */
  --text-lg: 1.125rem;     /* 18px */
  --text-xl: 1.25rem;      /* 20px */
  --text-2xl: 1.5rem;      /* 24px */
  --text-3xl: 1.875rem;    /* 30px */
  --text-4xl: 2.25rem;     /* 36px */
  --text-5xl: 3rem;        /* 48px */
  --text-6xl: 3.75rem;     /* 60px */
  --text-hero: clamp(2rem, 6vw, 4rem);
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-black: 900;
  --leading-tight: 1.1;
  --leading-snug: 1.375;
  --leading-normal: 1.6;
  --leading-relaxed: 1.8;

  /* 空间 - 内容型舒适密度 */
  --density: 1.0;
  --space-0: 0;
  --space-1: calc(0.25rem * var(--density));
  --space-2: calc(0.5rem * var(--density));
  --space-3: calc(0.75rem * var(--density));
  --space-4: calc(1rem * var(--density));
  --space-5: calc(1.25rem * var(--density));
  --space-6: calc(1.5rem * var(--density));
  --space-8: calc(2rem * var(--density));
  --space-10: calc(2.5rem * var(--density));
  --space-12: calc(3rem * var(--density));
  --space-16: calc(4rem * var(--density));
  --space-20: calc(5rem * var(--density));
  --space-24: calc(6rem * var(--density));

  /* 导航栏高度配置 */
  --nav-height-mobile: 3.5rem;    /* 56px */
  --nav-height-tablet: 4rem;      /* 64px */
  --nav-height-desktop: 4.5rem;   /* 72px */
  --nav-height: var(--nav-height-mobile);

  /* 安全顶部间距 - 防止内容被导航栏遮挡 */
  --safe-top: calc(var(--nav-height) + var(--space-4));
  --safe-top-tablet: calc(var(--nav-height-tablet) + var(--space-6));
  --safe-top-desktop: calc(var(--nav-height-desktop) + var(--space-8));

  /* 形状 - 现代与武侠平衡 */
  --radius-none: 0;
  --radius-sm: 0.375rem;   /* 6px */
  --radius-md: 0.5rem;     /* 8px */
  --radius-lg: 0.75rem;    /* 12px */
  --radius-xl: 1rem;       /* 16px */
  --radius-2xl: 1.5rem;    /* 24px */
  --radius-3xl: 2rem;      /* 32px */
  --radius-full: 9999px;

  /* 动效 - 水墨晕染风格 */
  --duration-instant: 0ms;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
  --duration-slower: 800ms;
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.68, -0.55, 0.265, 1.55);
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-ink: cubic-bezier(0.25, 0.46, 0.45, 0.94); /* 水墨扩散 */

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.3);
  --glow-sm: 0 0 20px color-mix(in srgb, var(--brand-primary) 30%, transparent);
  --glow-md: 0 0 40px color-mix(in srgb, var(--brand-primary) 40%, transparent);
  --glow-lg: 0 0 60px color-mix(in srgb, var(--brand-primary) 50%, transparent);

  /* 层级 */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
  --z-popover: 500;
  --z-tooltip: 600;

  /* 动态导航配置 */
  --nav-item-count: 6;
  --nav-stagger-delay: 50ms;
  --nav-link-max-width: 200px;
  --dropdown-max-height: 600px;
}

/* ===== 浅色模式适配 ===== */
@media (prefers-color-scheme: light) {
  :root {
    --bg-default: #f5f0e8;         /* 宣纸米黄 */
    --bg-subtle: color-mix(in srgb, var(--bg-default) 98%, var(--brand-primary));
    --bg-hover: color-mix(in srgb, var(--bg-default) 95%, var(--brand-primary));
    --fg-default: #1a1a1a;
    --fg-muted: color-mix(in srgb, var(--fg-default) 50%, var(--bg-default));
    --surface-default: #ffffff;
    --surface-elevated: color-mix(in srgb, var(--bg-default) 96%, black);
    --border-default: color-mix(in srgb, var(--fg-default) 8%, transparent);
    --border-hover: color-mix(in srgb, var(--brand-primary) 40%, transparent);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.05);
  }
}

/* ===== 减弱动画 ===== */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0.01ms;
    --duration-normal: 0.01ms;
    --duration-slow: 0.01ms;
    --duration-slower: 0.01ms;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== 基础重置 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--safe-top);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-default);
  color: var(--fg-default);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* 菜单打开时锁定背景滚动 */
body.menu-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ===== 页面容器（防遮挡核心）===== */
.page-wrapper {
  padding-top: var(--nav-height);
  width: 100%;
  min-height: 100vh;
  position: relative;
}

/* ===== 按钮系统 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all var(--duration-fast) var(--ease-default);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.96);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-primary-fg);
  box-shadow: var(--glow-sm);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow-md), var(--shadow-lg);
  filter: brightness(1.1);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-secondary-fg);
  border-color: var(--color-border);
}

.btn--secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.btn--gradient {
  background: var(--gradient-primary);
  color: var(--fg-default);
  position: relative;
  z-index: 1;
}

.btn--gradient::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: var(--gradient-mesh);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  filter: blur(8px);
  transition: opacity var(--duration-normal) var(--ease-default);
}

.btn--gradient:hover::before {
  opacity: 0.6;
}

.btn--ghost {
  background: transparent;
  color: var(--fg-default);
  border-color: var(--color-border);
}

.btn--ghost:hover {
  background: var(--surface-default);
  border-color: var(--border-hover);
}

.btn--gold {
  background: linear-gradient(135deg, var(--brand-secondary) 0%, #B8860B 100%);
  color: var(--bg-default);
  box-shadow: 0 0 20px color-mix(in srgb, var(--brand-secondary) 40%, transparent);
}

.btn--gold:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 40px color-mix(in srgb, var(--brand-secondary) 60%, transparent);
}

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  filter: none !important;
  box-shadow: none !important;
}

/* ===== 卡片系统 - 武侠风格 ===== */
.card {
  background: var(--color-card);
  color: var(--color-card-fg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  transition: all var(--duration-normal) var(--ease-default);
  position: relative;
  overflow: hidden;
}

/* 卡片装饰角 - 武侠卷轴风格 */
.card::before,
.card::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid var(--brand-secondary);
  opacity: 0.3;
  transition: all var(--duration-normal) var(--ease-default);
}

.card::before {
  top: 8px;
  left: 8px;
  border-right: none;
  border-bottom: none;
}

.card::after {
  bottom: 8px;
  right: 8px;
  border-left: none;
  border-top: none;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow-sm);
  border-color: var(--border-hover);
}

.card:hover::before,
.card:hover::after {
  opacity: 0.6;
  width: 30px;
  height: 30px;
}

.card--glass {
  background: color-mix(in srgb, var(--color-card) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.card--interactive {
  cursor: pointer;
}

.card--chapter {
  padding: 0;
  overflow: hidden;
}

.card--chapter .card__cover {
  aspect-ratio: 3/4;
  background: linear-gradient(135deg, var(--surface-default) 0%, var(--bg-hover) 100%);
  position: relative;
  overflow: hidden;
}

.card--chapter .card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-default);
}

.card--chapter:hover .card__cover img {
  transform: scale(1.05);
}

.card--chapter .card__content {
  padding: var(--space-4);
}

.card--chapter .card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-2);
  color: var(--fg-default);
}

.card--chapter .card__meta {
  font-size: var(--text-sm);
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ===== 导航栏 - 武侠风格固定导航 ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  background: color-mix(in srgb, var(--bg-default) 90%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--space-4);
  display: flex;
  align-items: center;
}

.navbar__container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* 品牌Logo - 武侠风格 */
.navbar__brand {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-black);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
  text-decoration: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.navbar__brand i {
  color: var(--brand-secondary);
  -webkit-text-fill-color: var(--brand-secondary);
}

/* 移动端菜单按钮 */
.navbar__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: transparent;
  border: none;
  color: var(--fg-default);
  font-size: var(--text-xl);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-default);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.navbar__toggle:hover {
  background: var(--surface-default);
  color: var(--brand-primary);
}

.navbar__toggle:active {
  transform: scale(0.95);
}

/* ===== 导航菜单容器 - 移动端全屏 ===== */
.navbar__nav {
  display: flex;
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  min-height: calc(100vh - var(--nav-height));
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  background: color-mix(in srgb, var(--bg-default) 98%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-4);
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition:
    opacity var(--duration-normal) var(--ease-default),
    visibility var(--duration-normal) var(--ease-default),
    transform var(--duration-normal) var(--ease-out);
  pointer-events: none;
  z-index: var(--z-dropdown);
}

.navbar__nav--open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: all;
}

/* ===== 导航项 - 动态级联动画 ===== */
.navbar__item {
  width: 100%;
  opacity: 0;
  transform: translateX(-10px);
  transition:
    opacity var(--duration-fast) var(--ease-default) calc(var(--item-index, 0) * var(--nav-stagger-delay)),
    transform var(--duration-fast) var(--ease-default) calc(var(--item-index, 0) * var(--nav-stagger-delay));
}

.navbar__nav--open .navbar__item {
  opacity: 1;
  transform: translateX(0);
}

/* 预定义菜单项索引 */
.navbar__item:nth-child(1) { --item-index: 0; }
.navbar__item:nth-child(2) { --item-index: 1; }
.navbar__item:nth-child(3) { --item-index: 2; }
.navbar__item:nth-child(4) { --item-index: 3; }
.navbar__item:nth-child(5) { --item-index: 4; }
.navbar__item:nth-child(6) { --item-index: 5; }
.navbar__item:nth-child(7) { --item-index: 6; }
.navbar__item:nth-child(8) { --item-index: 7; }

/* 导航链接 - 包含长文字处理 */
.navbar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-4);
  color: var(--fg-default);
  text-decoration: none;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-default);
  min-height: 48px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
}

.navbar__link:hover,
.navbar__link--active {
  color: var(--color-primary);
  background: var(--surface-default);
}

/* 当前章节标记 */
.navbar__link--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--gradient-primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.navbar__icon {
  width: 20px;
  text-align: center;
  color: var(--fg-muted);
  transition: color var(--duration-fast) var(--ease-default);
  flex-shrink: 0;
}

.navbar__link:hover .navbar__icon,
.navbar__link--active .navbar__icon {
  color: var(--color-primary);
}

/* 下拉箭头 */
.navbar__chevron {
  margin-left: auto;
  font-size: var(--text-sm);
  transition: transform var(--duration-fast) var(--ease-default);
}

.navbar__item--expanded .navbar__chevron {
  transform: rotate(180deg);
}

/* ===== 移动端二级菜单 - 垂直排列 ===== */
.navbar__item--has-dropdown {
  position: relative;
}

.navbar__dropdown {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--duration-normal) var(--ease-ink);
  margin-left: var(--space-4);
  margin-top: var(--space-2);
}

.navbar__item--expanded > .navbar__dropdown {
  grid-template-rows: 1fr;
}

.navbar__dropdown-inner {
  overflow: hidden;
  min-height: 0;
}

/* 二级菜单条目 - 强制垂直排列 */
.navbar__dropdown-item {
  display: block;
  width: 100%;
  padding: var(--space-3) var(--space-4);
  color: var(--fg-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-default);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 44px;
}

.navbar__dropdown-item:hover,
.navbar__dropdown-item--active {
  background: var(--bg-hover);
  color: var(--color-primary);
}

/* CTA按钮容器 */
.navbar__cta {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: auto;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity var(--duration-fast) var(--ease-default) calc(var(--nav-item-count) * var(--nav-stagger-delay)),
    transform var(--duration-fast) var(--ease-default) calc(var(--nav-item-count) * var(--nav-stagger-delay));
}

.navbar__nav--open .navbar__cta {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Hero区域 - 武侠风格 ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--safe-top) var(--space-4) var(--space-24);
  overflow: hidden;
  background: var(--bg-default);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-mesh);
  opacity: 0.6;
  animation: mesh-shift 30s linear infinite;
}

/* 水墨装饰 */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 200px;
  background: linear-gradient(to top, var(--bg-default) 0%, transparent 100%);
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 900px;
  animation: fade-in-up var(--duration-slow) var(--ease-smooth) both;
}

.hero__title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--font-black);
  line-height: var(--leading-tight);
  letter-spacing: 0.05em;
  margin-bottom: var(--space-6);
  background: linear-gradient(135deg, var(--fg-default) 0%, var(--brand-secondary) 50%, var(--brand-primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__subtitle {
  font-size: var(--text-xl);
  color: var(--brand-secondary);
  font-weight: var(--font-medium);
  margin-bottom: var(--space-4);
  letter-spacing: 0.1em;
}

.hero__description {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--fg-muted);
  margin-bottom: var(--space-8);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* 章节轮播指示器 */
.hero__indicators {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-top: var(--space-8);
}

.hero__indicator {
  width: 12px;
  height: 12px;
  border-radius: var(--radius-full);
  background: var(--surface-default);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.hero__indicator--active {
  background: var(--brand-primary);
  border-color: var(--brand-secondary);
  transform: scale(1.2);
}

/* ===== 输入框 ===== */
.input {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-default);
  border: 1px solid var(--color-input);
  border-radius: var(--radius-lg);
  color: var(--fg-default);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  outline: none;
  transition: all var(--duration-fast) var(--ease-default);
}

.input::placeholder {
  color: var(--fg-muted);
}

.input:focus {
  border-color: var(--color-ring);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-ring) 20%, transparent), var(--glow-sm);
  transform: translateY(-1px);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 搜索框 - 武侠风格 ===== */
.search-box {
  position: relative;
  width: 100%;
  max-width: 400px;
}

.search-box__input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) var(--space-12);
  background: var(--surface-default);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  color: var(--fg-default);
  font-size: var(--text-base);
  transition: all var(--duration-fast) var(--ease-default);
}

.search-box__input:focus {
  border-color: var(--brand-primary);
  box-shadow: var(--glow-sm);
}

.search-box__icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-muted);
  font-size: var(--text-lg);
}

/* ===== 骨架屏 ===== */
.skeleton {
  background: linear-gradient(90deg, var(--color-muted) 25%, color-mix(in srgb, var(--brand-primary) 10%, var(--color-muted)) 50%, var(--color-muted) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-md);
  animation: shimmer var(--duration-slow) linear infinite;
}

/* ===== 弹窗 - 武侠卷轴风格 ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: var(--surface-overlay);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal-backdrop);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--ease-default);
}

.modal-backdrop--open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: color-mix(in srgb, var(--color-card) 95%, transparent);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-2xl);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-xl), var(--glow-md);
  padding: var(--space-8);
  max-width: 90%;
  width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  z-index: var(--z-modal);
  opacity: 0;
  pointer-events: none;
  transition: all var(--duration-normal) var(--ease-bounce);
}

/* 卷轴装饰 */
.modal::before,
.modal::after {
  content: '◆';
  position: absolute;
  color: var(--brand-secondary);
  font-size: var(--text-sm);
  opacity: 0.5;
}

.modal::before {
  top: var(--space-4);
  left: var(--space-4);
}

.modal::after {
  bottom: var(--space-4);
  right: var(--space-4);
}

.modal-backdrop--open .modal {
  opacity: 1;
  pointer-events: all;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== 章节阅读器 ===== */
.reader {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--bg-default);
  display: flex;
  flex-direction: column;
}

.reader__header {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--color-border);
  background: color-mix(in srgb, var(--bg-default) 90%, transparent);
  backdrop-filter: blur(10px);
}

.reader__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--fg-default);
}

.reader__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width var(--duration-fast) var(--ease-default);
}

.reader__content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow: hidden;
}

.reader__page {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: var(--shadow-xl);
  border-radius: var(--radius-lg);
}

.reader__controls {
  position: absolute;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  background: color-mix(in srgb, var(--surface-default) 90%, transparent);
  backdrop-filter: blur(10px);
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
}

.reader__btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--fg-default);
  font-size: var(--text-lg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-default);
}

.reader__btn:hover {
  background: var(--bg-hover);
  color: var(--brand-primary);
}

/* ===== 页脚 - 武侠风格 ===== */
.footer {
  margin-top: auto;
  padding: var(--space-16) var(--space-4) var(--space-8);
  border-top: 1px solid var(--color-border);
  background: var(--surface-default);
  position: relative;
}

.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0.5;
}

.footer__container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer__top {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  margin-bottom: var(--space-12);
}

.footer__brand {
  max-width: 300px;
}

.footer__logo {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-black);
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer__description {
  color: var(--fg-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.footer__social {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.footer__social-link {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  color: var(--fg-muted);
  font-size: var(--text-lg);
  transition: all var(--duration-fast) var(--ease-default);
}

.footer__social-link:hover {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--fg-default);
  transform: translateY(-2px);
}

.footer__columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
}

.footer__column-title {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--fg-default);
  margin-bottom: var(--space-4);
  letter-spacing: 0.05em;
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.footer__link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all var(--duration-fast) var(--ease-default);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.footer__link:hover {
  color: var(--brand-primary);
  transform: translateX(4px);
}

.footer__bottom {
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  text-align: center;
}

.footer__copyright {
  color: var(--fg-muted);
  font-size: var(--text-sm);
}

.footer__legal {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  justify-content: center;
}

.footer__legal-link {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: var(--text-xs);
  transition: color var(--duration-fast) var(--ease-default);
}

.footer__legal-link:hover {
  color: var(--brand-primary);
}

/* ===== 动画关键帧 ===== */
@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pop-in {
  0% { opacity: 0; transform: scale(0.9); }
  70% { transform: scale(1.02); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes mesh-shift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(2%, 2%) scale(1.05); }
  50% { transform: translate(-1%, 3%) scale(1); }
  75% { transform: translate(3%, -2%) scale(1.02); }
}

@keyframes wiggle {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-20px); }
}

/* 水墨晕染效果 */
@keyframes ink-spread {
  0% { transform: scale(0); opacity: 0.8; }
  100% { transform: scale(2); opacity: 0; }
}

/* ===== 工具类 ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

/* 章节网格 */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

/* 标签 */
.tag {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-medium);
  color: var(--fg-muted);
  transition: all var(--duration-fast) var(--ease-default);
}

.tag:hover {
  border-color: var(--brand-primary);
  color: var(--brand-primary);
}

.tag--active {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
  color: var(--fg-default);
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-normal) var(--ease-default);
}

/* ===== 响应式优化（平板及以上）===== */
@media (min-width: 768px) {
  :root {
    --nav-height: var(--nav-height-tablet);
    --safe-top: var(--safe-top-tablet);
    --nav-link-max-width: 250px;
  }

  /* PC端二级菜单悬停桥接技术 */
  .navbar__item--has-dropdown {
    padding-bottom: 20px;
    margin-bottom: -20px;
  }

  /* PC端二级菜单 - 动态高度Grid动画 */
  .navbar__item--has-dropdown > .navbar__dropdown {
    display: grid;
    grid-template-rows: 0fr;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    max-width: 320px;
    background: var(--surface-elevated);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition:
      grid-template-rows var(--duration-fast) var(--ease-out),
      opacity var(--duration-fast) var(--ease-out),
      visibility var(--duration-fast) var(--ease-out),
      transform var(--duration-fast) var(--ease-out),
      padding var(--duration-fast) var(--ease-out);
    z-index: var(--z-dropdown);
    pointer-events: none;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin-left: 0;
    margin-top: 0;
  }

  /* 右侧溢出自动调整 */
  .navbar__item--has-dropdown > .navbar__dropdown--right {
    left: auto;
    right: 0;
  }

  /* 悬停桥接伪元素 */
  .navbar__item--has-dropdown::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    height: 20px;
    background: transparent;
    z-index: var(--z-dropdown);
    pointer-events: auto;
  }

  /* 悬停展开 */
  .navbar__item--has-dropdown:hover > .navbar__dropdown,
  .navbar__item--has-dropdown:focus-within > .navbar__dropdown {
    grid-template-rows: 1fr;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
    padding: var(--space-2);
  }

  /* PC端二级菜单条目 */
  .navbar__item--has-dropdown > .navbar__dropdown .navbar__dropdown-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }

  .navbar__item--has-dropdown > .navbar__dropdown .navbar__dropdown-item {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    color: var(--fg-default);
    text-decoration: none;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    transition: all var(--duration-fast) var(--ease-default);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .navbar__item--has-dropdown > .navbar__dropdown .navbar__dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--color-primary);
  }

  /* 导航栏平板样式 */
  .navbar {
    padding: 0 var(--space-6);
  }

  .navbar__toggle {
    display: none;
  }

  .navbar__nav {
    display: flex !important;
    position: static;
    flex-direction: row;
    background: transparent;
    backdrop-filter: none;
    border: none;
    padding: 0;
    gap: var(--space-6);
    margin-left: auto;
    margin-right: var(--space-6);
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: all;
    width: auto;
    min-height: auto;
    max-height: none;
    overflow-y: visible;
  }

  .navbar__item {
    width: auto;
    opacity: 1;
    transform: none;
    transition: none;
    --item-index: 0 !important;
    margin-bottom: 0;
    padding-bottom: 20px;
    margin-bottom: -20px;
  }

  .navbar__link {
    width: auto;
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    position: relative;
    min-height: auto;
    max-width: none;
  }

  .navbar__link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--duration-normal) var(--ease-default);
  }

  .navbar__link:hover::after,
  .navbar__link--active::after {
    width: 80%;
  }

  .navbar__cta {
    display: flex;
    flex-direction: row;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    opacity: 1;
    transform: none;
    gap: var(--space-3);
  }

  /* 页脚平板布局 */
  .footer__top {
    grid-template-columns: 1fr 2fr;
  }

  .footer__columns {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  .hero {
    padding: var(--safe-top) var(--space-6) var(--space-24);
  }

  .chapter-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
  }
}

/* ===== 响应式优化（桌面端）===== */
@media (min-width: 1024px) {
  :root {
    --nav-height: var(--nav-height-desktop);
    --safe-top: var(--safe-top-desktop);
  }

  .navbar {
    padding: 0 var(--space-8);
  }

  .navbar__nav {
    gap: var(--space-8);
  }

  .navbar__dropdown {
    min-width: 240px;
  }

  .container {
    padding: 0 var(--space-8);
  }

  .hero {
    padding: var(--safe-top) var(--space-8) var(--space-24);
  }

  .chapter-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .footer__columns {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1200px) {
  .chapter-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ===== 小屏手机优化 ===== */
@media (max-width: 767px) {
  :root {
    --density: 0.9;
    --nav-link-max-width: 150px;
    --nav-stagger-delay: 30ms;
  }

  .hero__description {
    font-size: var(--text-base);
  }

  .modal {
    width: 95%;
    padding: var(--space-6);
  }

  .chapter-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .footer__columns {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 360px) {
  .chapter-grid {
    grid-template-columns: 1fr;
  }

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

/* ===== 导航分组下拉菜单（超过6项时）===== */
@media (min-width: 768px) {
  /* "更多"下拉触发器 */
  .navbar__more-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-default);
    color: var(--fg-default);
    font-size: var(--text-lg);
    background: var(--surface-default);
    margin-left: var(--space-2);
    padding-bottom: 20px;
    margin-bottom: -20px;
  }

  .navbar__more-trigger:hover {
    background: var(--bg-hover);
    box-shadow: var(--shadow-md);
    color: var(--brand-primary);
  }

  /* 分组下拉菜单 */
  .navbar__dropdown--grouped {
    min-width: 400px;
    max-width: 480px;
  }

  .navbar__dropdown--grouped .navbar__dropdown-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .navbar__dropdown-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
  }

  .navbar__dropdown-group-title {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--fg-muted);
    letter-spacing: 0.05em;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-1);
  }

  .navbar__dropdown-group-items {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }
}

/* ===== Tooltip 提示 ===== */
.tooltip {
  position: relative;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--surface-elevated);
  color: var(--fg-default);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-default);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-fast) var(--ease-default);
  pointer-events: none;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(-4px);
}

/* 导航链接Tooltip */
.navbar__link[title] {
  position: relative;
}

/* ===== 无障碍焦点样式 ===== */
:focus-visible {
  outline: 2px solid var(--color-ring);
  outline-offset: 2px;
}

/* 键盘导航时的菜单保持 */
.navbar__item--has-dropdown:focus-within > .navbar__dropdown {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
  padding: var(--space-2);
}

/* ===== 打印样式 ===== */
@media print {
  .navbar,
  .footer,
  .reader__controls {
    display: none !important;
  }

  .page-wrapper {
    padding-top: 0;
  }

  .reader__page {
    box-shadow: none;
    max-width: 100%;
  }
}