/* ============================================================
   祖师观 · 古籍墨蓝主题（全站统一）
   与「道教图书馆」同一视觉语言：墨蓝底 + 鎏金描边 + 米黄正文
   仅覆盖变量与少量细节，不改布局结构
   ============================================================ */

/* ---------- 强制全站使用深色变量（含无 data-theme 的根节点）---------- */
:root,
[data-theme="dark"],
html, body {
  --fj-bg:            #0e161d;
  --fj-bg-alt:        #121c25;
  --fj-surface:       #16212b;
  --fj-surface-alt:   #1b2833;
  --fj-card-bg:       #16212b;
  --fj-sand-light:    #182530;

  --fj-ink:           #ece2cc;
  --fj-ink-light:     #c9bda3;
  --fj-ink-muted:     #8f846f;
  --fj-text-secondary:#a89b82;

  --fj-border:        #26333f;
  --fj-timeline-band-a:#131e27;
  --fj-timeline-band-b:#1b2833;

  --fj-accent:        #c9a86a;
  --fj-accent-hover:  #dcbc7c;
  --fj-gold:          #c9a86a;
  --fj-highlight:     #dcbc7c;
  --fj-cinnabar:      #d97a52;
  --fj-on-accent:     #101820;
  --fj-on-gold:       #101820;

  --fj-success:       #6fbf8b;
  --fj-danger:        #e07a72;
  --fj-warning:       #e0b45c;
  --fj-info:          #7fb0d9;

  --fj-chrome-bg:     #0a1015;
  color-scheme: dark;
}

/* ---------- 底色与文字 ---------- */
html, body, #root {
  background: #0e161d !important;
  color: #ece2cc;
}

/* 页面主区微渐变，模拟卷册受光 */
body {
  background-image:
    radial-gradient(1200px 600px at 50% -10%, rgba(201,168,106,.05), transparent 70%),
    linear-gradient(180deg, #101a22 0%, #0e161d 40%, #0b1319 100%) !important;
  background-attachment: fixed !important;
}

/* ---------- 顶栏 ---------- */
.ant-layout-header,
header[class*="header"],
[class*="AppHeader"],
[class*="TopNav"] {
  background: rgba(10,16,21,.92) !important;
  border-bottom: 1px solid rgba(201,168,106,.18) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ---------- 侧栏 / 抽屉 ---------- */
.ant-layout-sider,
.ant-drawer-content,
.ant-drawer-header {
  background: #101a22 !important;
  border-color: rgba(201,168,106,.14) !important;
}
.ant-drawer-body { background: #0e161d !important; }

/* ---------- 卡片：深色描金 ---------- */
.ant-card,
.ant-card-bordered {
  background: rgba(22,33,43,.78) !important;
  border: 1px solid rgba(201,168,106,.16) !important;
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(255,255,255,.03) inset,
              0 8px 28px rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
}
.ant-card-hoverable:hover,
.ant-card:hover {
  border-color: rgba(201,168,106,.42) !important;
  box-shadow: 0 1px 0 rgba(255,255,255,.05) inset,
              0 14px 40px rgba(0,0,0,.5),
              0 0 0 1px rgba(201,168,106,.10);
}
.ant-card-head {
  border-bottom: 1px solid rgba(201,168,106,.16) !important;
  background: transparent !important;
  color: #ece2cc !important;
}

/* ---------- 标题：鎏金衬线 ---------- */
h1, h2, h3, h4,
.ant-typography h1, .ant-typography h2, .ant-typography h3,
.ant-card-head-title {
  font-family: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif !important;
  letter-spacing: .04em;
  color: #ece2cc;
}
h1 { font-weight: 600; }

/* ---------- 正文与次要文字 ---------- */
.ant-typography, p, span, li, td, .ant-descriptions-item-content {
  color: inherit;
}
.ant-typography-secondary,
.ant-descriptions-item-label,
[class*="subtitle"], [class*="muted"] {
  color: #8f846f !important;
}

/* ---------- 按钮 ---------- */
.ant-btn-default {
  background: rgba(30,44,56,.7) !important;
  border-color: rgba(201,168,106,.28) !important;
  color: #d9cdb4 !important;
  border-radius: 10px;
}
.ant-btn-default:hover {
  border-color: #c9a86a !important;
  color: #ece2cc !important;
  background: rgba(40,58,72,.85) !important;
}
.ant-btn-primary {
  background: linear-gradient(180deg, #d2b276 0%, #bf9c5c 100%) !important;
  border-color: #c9a86a !important;
  color: #101820 !important;
  border-radius: 10px;
  box-shadow: 0 3px 14px rgba(201,168,106,.22);
  font-weight: 500;
}
.ant-btn-primary:hover {
  background: linear-gradient(180deg, #ddc089 0%, #c9a86a 100%) !important;
  box-shadow: 0 6px 20px rgba(201,168,106,.34);
  transform: translateY(-1px);
}
.ant-btn-link, .ant-btn-text { color: #c9a86a !important; }
.ant-btn-link:hover, .ant-btn-text:hover { color: #dcbc7c !important; }

/* ---------- 表单控件 ---------- */
.ant-input, .ant-input-affix-wrapper, .ant-input-number,
.ant-picker, .ant-select-selector, textarea.ant-input {
  background: rgba(13,22,29,.85) !important;
  border-color: rgba(201,168,106,.20) !important;
  color: #ece2cc !important;
  border-radius: 10px !important;
}
.ant-input::placeholder, textarea.ant-input::placeholder { color: #6f6656 !important; }
.ant-input-affix-wrapper-focused, .ant-input:focus,
.ant-select-focused .ant-select-selector {
  border-color: #c9a86a !important;
  box-shadow: 0 0 0 3px rgba(201,168,106,.14) !important;
}
.ant-select-dropdown, .ant-dropdown-menu, .ant-picker-panel-container {
  background: #16212b !important;
  border: 1px solid rgba(201,168,106,.18);
}
.ant-select-item-option-active,
.ant-dropdown-menu-item:hover { background: rgba(201,168,106,.10) !important; }

/* ---------- 弹窗 ---------- */
.ant-modal-content, .ant-modal-header {
  background: #131e27 !important;
  border-radius: 16px;
}
.ant-modal-header { border-bottom: 1px solid rgba(201,168,106,.16) !important; }
.ant-modal-title { color: #ece2cc !important; }
.ant-modal-footer { border-top: 1px solid rgba(201,168,106,.12) !important; }

/* ---------- 表格 ---------- */
.ant-table { background: transparent !important; color: #d9cdb4; }
.ant-table-thead > tr > th {
  background: rgba(22,33,43,.95) !important;
  color: #c9bda3 !important;
  border-bottom: 1px solid rgba(201,168,106,.20) !important;
}
.ant-table-tbody > tr > td { border-bottom: 1px solid rgba(201,168,106,.08) !important; }
.ant-table-tbody > tr:hover > td { background: rgba(201,168,106,.06) !important; }

/* ---------- 标签 / 分页 / 面包屑 ---------- */
.ant-tag {
  background: rgba(201,168,106,.10) !important;
  border-color: rgba(201,168,106,.28) !important;
  color: #d9c497 !important;
  border-radius: 999px;
}
.ant-pagination-item, .ant-pagination-prev, .ant-pagination-next {
  background: rgba(22,33,43,.8) !important;
  border-color: rgba(201,168,106,.20) !important;
}
.ant-pagination-item a { color: #c9bda3 !important; }
.ant-pagination-item-active {
  border-color: #c9a86a !important;
  background: rgba(201,168,106,.14) !important;
}
.ant-pagination-item-active a { color: #e8d6ad !important; }
.ant-breadcrumb, .ant-breadcrumb a { color: #8f846f !important; }
.ant-breadcrumb a:hover { color: #c9a86a !important; }

/* ---------- 分割线 / 加载 ---------- */
.ant-divider { border-color: rgba(201,168,106,.14) !important; }
.ant-spin-dot-item { background-color: #c9a86a !important; }

/* ---------- 空状态 ---------- */
.ant-empty-description { color: #8f846f !important; }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar-thumb {
  background: rgba(201,168,106,.28);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(201,168,106,.45); background-clip: padding-box; }

/* ---------- 选中 ---------- */
::selection { background: rgba(201,168,106,.35); color: #fff8e8; }

/* ---------- 移动端收敛 ---------- */
@media (max-width: 768px) {
  .ant-card:hover { transform: none; }
  .ant-btn-primary:hover { transform: none; }
}

/* ---------- 兜底：强制覆盖原主题变量（更高优先级）---------- */
html:root, html[data-theme], html[data-theme="light"], html[data-theme="dark"],
html body, html body #root {
  --fj-bg:#0e161d !important;
  --fj-bg-alt:#121c25 !important;
  --fj-surface:#16212b !important;
  --fj-surface-alt:#1b2833 !important;
  --fj-card-bg:#16212b !important;
  --fj-sand-light:#182530 !important;
  --fj-ink:#ece2cc !important;
  --fj-ink-light:#c9bda3 !important;
  --fj-ink-muted:#8f846f !important;
  --fj-text-secondary:#a89b82 !important;
  --fj-border:#26333f !important;
  --fj-accent:#c9a86a !important;
  --fj-accent-hover:#dcbc7c !important;
  --fj-gold:#c9a86a !important;
  --fj-highlight:#dcbc7c !important;
  --fj-cinnabar:#d97a52 !important;
  --fj-on-accent:#101820 !important;
  --fj-on-gold:#101820 !important;
  --fj-chrome-bg:#0a1015 !important;
  --fj-timeline-band-a:#131e27 !important;
  --fj-timeline-band-b:#1b2833 !important;
  color-scheme:dark !important;
}
/* Ant Design 设计令牌同步 */
html, html body {
  --ant-color-bg-container:#16212b;
  --ant-color-bg-elevated:#1b2833;
  --ant-color-bg-layout:#0e161d;
  --ant-color-text:#ece2cc;
  --ant-color-text-secondary:#a89b82;
  --ant-color-border:#26333f;
  --ant-color-primary:#c9a86a;
}




/* ---------- 主页 Hero 修正 ---------- */
/* 主标题：描金 + 太极 */
.home-title {
  color: #e6c98d !important;
  text-shadow: 0 4px 26px rgba(0,0,0,.8), 0 0 70px rgba(201,168,106,.28) !important;
}
.home-title em { color: #e6c98d !important; font-style: normal; }
.home-title::before {
  content: "☯ ";
  color: #c9a86a;
  display: inline-block;
  animation: taiji-spin 10s linear infinite;
  transform-origin: 50% 50%;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  font-size: .55em;
  vertical-align: .18em;
  margin-right: .1em;
  letter-spacing: 0;
}
/* 副标题：提高可读性 */
.home-subtitle {
  color: #fff6e4 !important;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 16px rgba(0,0,0,.65), 0 0 2px rgba(0,0,0,.9) !important;
  letter-spacing: clamp(4px,1vw,8px) !important;
}
/* ---------- 兜底：强制覆盖原主题变量（更高优先级）---------- */
html:root, html[data-theme], html[data-theme="light"], html[data-theme="dark"],
html body, html body #root {
  --fj-bg:#0e161d !important;
  --fj-bg-alt:#121c25 !important;
  --fj-surface:#16212b !important;
  --fj-surface-alt:#1b2833 !important;
  --fj-card-bg:#16212b !important;
  --fj-sand-light:#182530 !important;
  --fj-ink:#ece2cc !important;
  --fj-ink-light:#c9bda3 !important;
  --fj-ink-muted:#8f846f !important;
  --fj-text-secondary:#a89b82 !important;
  --fj-border:#26333f !important;
  --fj-accent:#c9a86a !important;
  --fj-accent-hover:#dcbc7c !important;
  --fj-gold:#c9a86a !important;
  --fj-highlight:#dcbc7c !important;
  --fj-cinnabar:#d97a52 !important;
  --fj-on-accent:#101820 !important;
  --fj-on-gold:#101820 !important;
  --fj-chrome-bg:#0a1015 !important;
  --fj-timeline-band-a:#131e27 !important;
  --fj-timeline-band-b:#1b2833 !important;
  color-scheme:dark !important;
}
/* Ant Design 设计令牌同步 */
html, html body {
  --ant-color-bg-container:#16212b;
  --ant-color-bg-elevated:#1b2833;
  --ant-color-bg-layout:#0e161d;
  --ant-color-text:#ece2cc;
  --ant-color-text-secondary:#a89b82;
  --ant-color-border:#26333f;
  --ant-color-primary:#c9a86a;
}




/* ---------- 主页 Hero 修正 ---------- */
/* 主标题：描金 + 太极 */
.home-title {
  color: #e6c98d !important;
  text-shadow: 0 4px 26px rgba(0,0,0,.8), 0 0 70px rgba(201,168,106,.28) !important;
}
.home-title em { color: #e6c98d !important; font-style: normal; }
.home-title::before {
  content: "☯ ";
  color: #c9a86a;
  display: inline-block;
  animation: taiji-spin 10s linear infinite;
  transform-origin: 50% 50%;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  font-size: .55em;
  vertical-align: .18em;
  margin-right: .1em;
  letter-spacing: 0;
}
/* 副标题：提高可读性 */
.home-subtitle {
  color: #fff6e4 !important;
  font-weight: 500;
  text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 16px rgba(0,0,0,.65), 0 0 2px rgba(0,0,0,.9) !important;
  letter-spacing: clamp(4px,1vw,8px) !important;
}
/* ================= 描金太极（最终版，唯一） ================= */
@keyframes taiji-spin { to { transform: rotate(360deg); } }

/* 顶栏与页脚「祖师观」：金色文字 + 旋转太极 */
.header-logo, h5.ant-typography.header-logo { color: #c9a86a !important; }
.home-footer-logo { color: #c9a86a !important; }
.header-logo::before, .home-footer-logo::before {
  content: "☯";
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  color: #c9a86a;
  margin-right: 6px;
  font-size: 0.9em;
  vertical-align: 0.06em;
  animation: taiji-spin 10s linear infinite;
  transform-origin: 50% 50%;
}

/* 通用太极组件（图书馆/免责声明等） */
.fj-taiji {
  display: inline-block;
  width: 1em;
  height: 1em;
  line-height: 1;
  text-align: center;
  color: #c9a86a;
  animation: taiji-spin 10s linear infinite;
  transform-origin: 50% 50%;
  vertical-align: -0.08em;
}

@media (prefers-reduced-motion: reduce) {
  .fj-taiji, .header-logo::before, .home-footer-logo::before { animation: none; }
}

/* ================= 主页四卡片 v19：JS 移到 .home-hero 下后居中 ================= */
.home-hero { position: relative !important; }
.home-card-grid {
  position: absolute !important;
  top: 62% !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: center !important;
  gap: 10px !important;
  width: calc(100% - 32px) !important;
  max-width: 860px !important;
  box-sizing: border-box !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 6;
}
.home-card {
  flex: 0 0 calc(50% - 5px) !important;
  width: calc(50% - 5px) !important;
  max-width: calc(50% - 5px) !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
@media (min-width: 761px) {
  .home-card {
    flex: 0 0 calc(25% - 7.5px) !important;
    width: calc(25% - 7.5px) !important;
    max-width: calc(25% - 7.5px) !important;
  }
}

/* ---- v20：5 卡布局（新增 AI 问答卡）---- */
@media (min-width: 761px) {
  .home-card-grid .home-card {
    flex: 0 0 calc(25% - 7.5px) !important;
    width: calc(25% - 7.5px) !important;
    max-width: calc(25% - 7.5px) !important;
  }
  .home-card-ai {
    border-color: rgba(201, 168, 106, .55) !important;
    box-shadow: 0 0 0 1px rgba(201, 168, 106, .25), 0 6px 18px rgba(201, 168, 106, .12) !important;
  }
  .home-card-ai .home-card-icon { animation: taiji-spin 10s linear infinite; }
}
