/* Docsify v5：主题色通过 CSS 变量控制（原 themeColor 配置已在 v5 弃用） */
:root {
  --theme-color: #25798A;
}

aside.toc-nav.is-hidden {
  display: none;
}

/* v5 说明：cover-main 的 z-index 由 core 主题层级变量体系管理
   （--z-sidebar:60 > --z-cover:10），不再需要 v4 时代的 z-index:100 hack */
section.cover.has-mask .mask {
  background-color: #fff;
  opacity: .1!important;
  position: absolute;
  top: 0;
  height: 100%;
  width: 100%;
}

/* ============ 封面艺术字（星寻记）+ 动画 ============ */
/* 标题：霞鹜文楷 + 青金渐变（加宽+流光扫过）+ 星辉光晕呼吸 + 入场上浮 */
section.cover .cover-main h1 {
  font-family: 'LXGW WenKai Screen', 'Noto Serif SC', 'KaiTi', serif;
  font-weight: 400;
  font-size: clamp(2.4em, 6.5vw, 3.4em);
  letter-spacing: 0.2em;
  padding-left: 0.2em; /* 补偿末字字距，保持视觉居中 */
  background: linear-gradient(135deg, #17606f 0%, #25798A 38%, #e0a94a 50%, #25798A 62%, #17606f 100%) no-repeat;
  background-size: 250% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 14px rgba(224, 169, 74, 0.32));
  animation: title-in 0.9s ease-out both, title-sheen 7s linear infinite 0.9s, title-glow 4.5s ease-in-out infinite 0.9s;
}
@keyframes title-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes title-sheen {
  0%   { background-position: 0% center; }
  100% { background-position: -250% center; }
}
@keyframes title-glow {
  0%, 100% { filter: drop-shadow(0 1px 12px rgba(224, 169, 74, 0.28)); }
  50%      { filter: drop-shadow(0 1px 22px rgba(224, 169, 74, 0.58)); }
}

/* 标语：提亮为冷月色（夜空上更易看清）+ 暗影抬对比 + 入场 + 呼吸 */
section.cover .cover-main h3 {
  font-family: 'LXGW WenKai Screen', 'Noto Serif SC', 'KaiTi', serif;
  font-weight: 400;
  font-size: 1.08em;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: #aecdd6;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.45), 0 0 18px rgba(176, 219, 230, 0.22);
  animation: tagline-in 1.1s ease-out 0.2s both, tagline-breathe 4.5s ease-in-out infinite 1.3s;
}
@keyframes tagline-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tagline-breathe {
  0%, 100% { opacity: 0.78; }
  50%      { opacity: 1; }
}
section.cover .cover-main h3::before,
section.cover .cover-main h3::after {
  color: #e8c062;
  letter-spacing: 0;
  display: inline-block;
  animation: star-twinkle 3s ease-in-out infinite;
}
section.cover .cover-main h3::before { content: '✦ '; animation-delay: 0s; }
section.cover .cover-main h3::after  { content: ' ✦'; animation-delay: 1.5s; }
@keyframes star-twinkle {
  0%, 100% { opacity: 0.5; transform: scale(0.9); }
  50%      { opacity: 1; transform: scale(1.15); }
}

/* 尊重系统减弱动态效果偏好：关闭封面动画 */
@media (prefers-reduced-motion: reduce) {
  section.cover .cover-main h1,
  section.cover .cover-main h3,
  section.cover .cover-main h3::before,
  section.cover .cover-main h3::after { animation: none; }
}

/* 封面 logo：球面立体感 + 月色光晕呼吸，与夜空背景融合
   inset 顶光高光/底部暗影 → 球面；外发光冷白青 → 仿月光散入夜空；
   单层纵深投影 → 从背景浮起；4.5s 缓慢呼吸让它像一颗被月亮眷顾的星 */
section.cover .cover-main img[src*="logo"] {
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow:
    inset 0 3px 6px rgba(255, 255, 255, 0.28),
    inset 0 -4px 10px rgba(0, 0, 0, 0.28),
    0 0 0 3px rgba(255, 255, 255, 0.05),
    0 0 26px rgba(176, 219, 230, 0.32),
    0 12px 30px rgba(0, 0, 0, 0.38);
  animation: logo-glow 4.5s ease-in-out infinite;
}

/* 模块内文章前后导航 */
.article-pagination {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(127, 127, 127, 0.2);
}

.article-pagination__item {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem 1.15rem;
  border: 1px solid rgba(37, 121, 138, 0.18);
  border-radius: 0.5rem;
  background: rgba(37, 121, 138, 0.045);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.article-pagination__item:hover {
  border-color: var(--theme-color);
  background: rgba(37, 121, 138, 0.09);
}

.article-pagination__item.is-next {
  text-align: right;
}

.article-pagination__direction {
  color: var(--theme-color);
  font-size: 0.85em;
}

.article-pagination__title {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.article-pagination__item.is-disabled {
  opacity: 0.5;
}

@media (max-width: 480px) {
  .article-pagination {
    gap: 0.6rem;
  }

  .article-pagination__item {
    padding: 0.8rem;
  }
}
@keyframes logo-glow {
  0%, 100% {
    box-shadow:
      inset 0 3px 6px rgba(255, 255, 255, 0.28),
      inset 0 -4px 10px rgba(0, 0, 0, 0.28),
      0 0 0 3px rgba(255, 255, 255, 0.05),
      0 0 22px rgba(176, 219, 230, 0.26),
      0 12px 30px rgba(0, 0, 0, 0.38);
  }
  50% {
    box-shadow:
      inset 0 3px 6px rgba(255, 255, 255, 0.3),
      inset 0 -4px 10px rgba(0, 0, 0, 0.28),
      0 0 0 3px rgba(255, 255, 255, 0.09),
      0 0 42px rgba(176, 219, 230, 0.5),
      0 12px 30px rgba(0, 0, 0, 0.38);
  }
}

section.cover .cover-main > p:last-child a .iconfont {
  font-size: 1em;
}

/* v5 将站名选择器从 .sidebar > h1 a 改为 .app-name-link；同步换成文楷保持品牌一致 */
.sidebar .app-name-link {
  font-family: 'LXGW WenKai Screen', 'Noto Serif SC', 'KaiTi', serif;
}

/* ============ 移动端适配优化 ============ */

/* 侧栏长文章名单行省略，完整标题保留在链接 title 属性中 */
.sidebar .sidebar-nav li.file > a.page-link {
  position: relative;
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding-left: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar .sidebar-nav li.file > a.page-link::before {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}

/* 防止横向滚动：图片、表格、代码块自适应 */
.markdown-section img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1em auto;
}

.markdown-section table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.markdown-section pre,
.markdown-section pre > code {
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
  max-width: 100%;
}

/* 移动端样式：v5 的移动端断点是 640px（--_mobile-breakpoint），与 core 主题保持一致。
   注意不要在 640-768px 区间应用移动端规则，否则会与 v5 的桌面布局冲突 */
@media screen and (max-width: 640px) {
  /* v5：层级与宽度由 core 主题变量管理（--z-sidebar:60、--sidebar-width:280px），
     仅保留背景与阴影增强可读性 */
  .sidebar {
    background-color: var(--docsify_dark_mode_bg) !important;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
  }

  /* 窄屏由侧栏目录提供章节导航，隐藏悬浮目录避免遮挡正文 */
  aside.toc-nav {
    display: none;
  }

  /* 侧边栏打开时隐藏封面，彻底避免任何重叠/遮挡
     （v5 用 .sidebar.show 表示打开状态，v4 的 body.close 已移除；
     此规则仅限 640px 内的抽屉模式，桌面模式下 .sidebar.show 常驻不能隐藏封面） */
  .sidebar.show ~ .content :is(.cover, section.cover) {
    display: none !important;
  }

  /* 侧边栏打开时锁定背景滚动 */
  body:has(.sidebar.show) {
    overflow: hidden;
  }

  /* 取消移动端点击高亮 */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* 标题字号适配 */
  .markdown-section h1 { font-size: 1.6em; }
  .markdown-section h2 { font-size: 1.35em; }
  .markdown-section h3 { font-size: 1.15em; }

  /* 封面标语：窄屏强制单行，避免 ✦ 星尘伪元素跨行错乱
     （::before/::after 钉在 h3 两端，换行时会被拆到首末两行；缩小字距+nowrap 让整体塞进一行） */
  section.cover .cover-main h3 {
    font-size: 0.92em;
    letter-spacing: 0.15em;
    padding-left: 0.15em;
    white-space: nowrap;
  }

  /* 表格在窄屏内可横向滚动 */
  .markdown-section table {
    font-size: 0.85em;
  }
}
