/**
 * qianmo-glow.css
 * 基于 UI 设计规范优化：强化字体、色彩与动感动画
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;600;700;900&family=Noto+Sans+SC:wght@300;400;700;900&display=swap');

:root,
html[data-theme="dark"],
html[data-theme="light"] {
  --bg: #000000;
  --bg-card: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.15);
  --text: rgba(255, 255, 255, 0.85);
  --text-dim: rgba(255, 255, 255, 0.55);
  --blue: #22c55e;
  --purple: #4ade80;
  --cyan: #86efac;
  
  /* 动效曲线：更加灵动的弹性效果 */
  --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out-cubic: cubic-bezier(0.65, 0, 0.35, 1);
  
  /* 数字雨颜色 */
  --matrix-green: #00ff41;
  --global-theme-color: #22c55e;
  --global-hover-color: #4ade80;
  --global-bg-color: #000000;
  --global-code-bg-color: #0b0f0c;
  --global-text-color: #f5f7f5;
  --global-text-color-light: #a7afa9;
  --global-card-bg-color: #080a09;
  --global-divider-color: rgba(255, 255, 255, 0.14);
  --global-footer-bg-color: #000000;
  --global-footer-text-color: #d7ddd9;
  --global-footer-link-color: #ffffff;
  color-scheme: dark;
}

html {
  background-color: #000000 !important;
}

/* 数字雨画布容器 */
#matrix-rain {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  opacity: 0.22;
  pointer-events: none;
  filter: brightness(1.35) contrast(1.18) saturate(1.08);
}

#branch-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  opacity: 1;
  mix-blend-mode: screen;
}

/* 基础重置与字体优化 */
body {
  background-color: var(--bg) !important;
  color: var(--text) !important;
  font-family: 'Inter', 'Noto Sans SC', sans-serif !important;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  position: relative;
  isolation: isolate;
}

progress,
.progress-container {
  z-index: 1100 !important;
}

progress::-webkit-progress-value,
.progress-bar {
  background-color: #22c55e !important;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.8);
}

progress::-moz-progress-bar {
  background-color: #22c55e !important;
}

/* 强制可访问性：消除所有深色背景上的暗色字体 */
p, li, span, div, a, label, input, textarea, td, th, h1, h2, h3, h4, h5, h6, strong, em, b, i, code, kbd, pre {
  color: inherit; /* 默认继承 body 的 var(--text) */
}

h1, h2, h3, h4, h5, h6,
.card-title,
.post-title,
.navbar-brand,
button,
input,
textarea,
select {
  color: #f5f7f5 !important;
}

.af-page-link,
.pagination .page-link,
.dropdown-menu,
.list-group-item,
.modal-content,
.popover,
input,
textarea,
select {
  background-color: #080a09 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.navbar-toggler .icon-bar {
  background-color: #f5f7f5 !important;
}

/* 全站采用无图片展示模式 */
img {
  display: none !important;
}

.honors-dropdown {
  margin: 2rem 0;
  overflow: hidden;
  background: #080a09;
  border: 1px solid rgba(34, 197, 94, 0.38);
  border-radius: 12px;
}

.honors-dropdown summary {
  padding: 1rem 1.2rem;
  color: #f5f7f5 !important;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.honors-dropdown summary::-webkit-details-marker {
  display: none;
}

.honors-dropdown summary::after {
  content: '＋';
  float: right;
  color: #22c55e;
  transition: transform 0.25s ease;
}

.honors-dropdown[open] summary::after {
  transform: rotate(45deg);
}

.honors-dropdown ul {
  margin: 0;
  padding: 0 2.6rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.honors-dropdown li {
  padding-top: 0.85rem;
  color: rgba(255, 255, 255, 0.82) !important;
}

.blog-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.new-post-button,
.save-post-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.05rem;
  color: #041107 !important;
  background: #22c55e !important;
  border: 1px solid #4ade80 !important;
  border-radius: 9px;
  font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 0 18px rgba(34, 197, 94, 0.2);
  cursor: pointer;
}

.new-post-button:hover,
.save-post-button:hover {
  opacity: 1;
  background: #4ade80 !important;
  transform: translateY(-1px);
}

.post-editor {
  max-width: 820px;
  margin: 0 auto;
}

.post-editor-intro {
  color: rgba(255, 255, 255, 0.72) !important;
}

.post-editor form {
  display: grid;
  gap: 0.65rem;
}

.post-editor label {
  margin-top: 0.55rem;
  color: #f5f7f5 !important;
  font-weight: 650;
}

.post-editor input,
.post-editor textarea {
  width: 100%;
  padding: 0.78rem 0.9rem;
  color: #f5f7f5 !important;
  background: #080a09 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: 8px;
}

.post-editor input:focus,
.post-editor textarea:focus {
  border-color: #22c55e !important;
  outline: 2px solid rgba(34, 197, 94, 0.18);
}

.post-editor-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.cancel-post-button {
  color: rgba(255, 255, 255, 0.72) !important;
}

.post-save-status {
  min-height: 1.5rem;
  color: #86efac !important;
}

@media (max-width: 576px) {
  .post-editor-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* 针对 al-folio 可能存在的硬编码深色进行覆盖 */
.post p, .post li, .profile p, .profile li, .card-text, .news-title, .news-date, .post-title, .profile h1, .navbar-brand, .news table th, .news table td {
  color: var(--text) !important;
}

.text-muted, .text-secondary, --qm-muted, .muted, .headerLabel, .cardLabel, .complexityKey, .qualityOf, .judgeMeta, .caseMessage, .caseGrid b, abbr, time, .post-meta {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* 链接颜色优化 */
a, .navbar-nav .nav-link {
  color: var(--blue) !important;
  text-decoration: none;
  transition: opacity 0.2s;
}

a:hover {
  opacity: 0.8;
}

/* 渐变文字强化 */
.gradient-text, 
.hero-title, 
.post-title,
.profile h1 {
  background: linear-gradient(135deg, var(--blue), var(--purple), var(--cyan));
  -webkit-background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  background-clip: text !important;
  display: inline-block;
  font-weight: 900 !important;
  letter-spacing: -0.02em;
}

/* 排版层级优化 */
h1, .hero-title { font-size: 4rem !important; font-weight: 900 !important; line-height: 1.1; }
h2, .section-title { font-size: 2.2rem !important; font-weight: 700 !important; }
h3, .card-title { font-size: 1.15rem !important; font-weight: 600 !important; }

/* 沉浸式光斑背景 */
.light-spot {
  position: fixed;
  border-radius: 50%;
  filter: blur(135px);
  opacity: 0.26;
  pointer-events: none;
  z-index: -1;
  will-change: transform;
}

/* 跟随鼠标流动的绿色光晕 */
.cursor-flow {
  position: fixed;
  top: 0;
  left: 0;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(220, 255, 240, 0.24) 0%, rgba(134, 239, 172, 0.36) 15%, rgba(74, 222, 128, 0.24) 30%, rgba(34, 197, 94, 0.15) 46%, transparent 76%);
  filter: blur(22px);
  pointer-events: none;
  z-index: -1;
  opacity: 0;
  transform: translate3d(-720px, -720px, 0);
  transition: opacity 0.16s ease;
  will-change: transform;
}

body:hover .cursor-flow {
  opacity: 1;
}

.ls1 { background: var(--blue); width: 64vw; height: 64vw; top: -22vh; right: -18vw; animation: float-1 22s var(--ease-in-out-cubic) infinite; }
.ls2 { background: var(--purple); width: 56vw; height: 56vw; bottom: -18vh; left: -12vw; animation: float-2 26s var(--ease-in-out-cubic) infinite; }
.ls3 { background: var(--cyan); width: 46vw; height: 46vw; top: 26vh; right: 2vw; animation: float-3 19s var(--ease-in-out-cubic) infinite; }

@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
  50% { transform: translate(5vw, 5vh) scale(1.1) rotate(10deg); }
}
@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-4vw, 8vh) scale(1.05); }
}
@keyframes float-3 {
  0%, 100% { transform: translate(0, 0) scale(1.1); }
  50% { transform: translate(3vw, -6vh) scale(1); }
}

/* 卡片与容器动效重构 */
.reveal, .card, .post, .profile .more-info, .project-card {
  opacity: 0;
  transform: translateY(40px) scale(0.98);
  transition: opacity 1s var(--ease-out-expo), transform 1s var(--ease-out-expo);
  will-change: transform, opacity;
}

.reveal.visible, .card.visible, .post.visible, .profile .more-info.visible, .project-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* 卡片悬停精细化 */
.card, .post, .project-card {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  backdrop-filter: blur(12px);
  border-radius: 14px !important;
}

.card:hover, .post:hover, .project-card:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  transform: translateY(-8px) scale(1.02) !important;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
}

/* 导航栏毛玻璃强化 */
.navbar {
  background: rgba(10, 10, 10, 0.6) !important;
  backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border) !important;
  transition: background 0.4s ease;
}

.navbar.scrolled {
  background: rgba(10, 10, 10, 0.85) !important;
}

/* 标签与分割线 */
.tag {
  background: rgba(96, 165, 250, 0.12) !important;
  color: var(--blue) !important;
  border: 1px solid rgba(96, 165, 250, 0.3) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
}

.divider {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent) !important;
  height: 1px;
  width: 120px;
  margin: 2rem auto;
}

/* 响应式适配 */
@media (max-width: 768px) {
  h1, .hero-title { font-size: 2.8rem !important; }
  .light-spot { opacity: 0.18; filter: blur(92px); }
  .cursor-flow {
    width: 420px;
    height: 420px;
    transform: translate3d(-500px, -500px, 0);
  }
  #branch-canvas {
    opacity: 0.9;
  }
}
