/*
Theme Name: BaguaHome
Theme URI: https://baguahome.co
Author: BaguaHome
Description: 中国传统色系风水内容站主题。Structure ref: onlinefengshuitools.com
Version: 1.0.0
Text Domain: baguahome
*/

:root {
  /* 中国传统色板 */
  --zhi-beige: #F5F1E8;      /* 宣纸 米白底 */
  --yue-white: #FBF9F4;      /* 月白 卡片底 */
  --mo-ink: #2B2B2B;         /* 墨 正文 */
  --mo-light: #5A5A52;       /* 淡墨 次级文字 */
  --zhu-red: #C3272B;        /* 朱红 主强调 */
  --jiang-deep: #8C1F28;     /* 绛 深红 hover */
  --dai-blue: #1D2A3A;       /* 黛 导航/页脚 */
  --dai-mid: #2F4156;        /* 黛中 */
  --qing-green: #5F7C62;     /* 竹青 辅助 */
  --jin-gold: #C8A96A;       /* 缃金 点缀 */
  --rou-pink: #EFB9B7;       /* 胭脂粉 浅点缀 */

  --radius: 10px;
  --shadow: 0 4px 18px rgba(45, 42, 32, 0.10);
  --font-serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--zhi-beige);
  color: var(--mo-ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.8;
}
a { color: var(--zhu-red); text-decoration: none; transition: color .2s; }
a:hover { color: var(--jiang-deep); }
.post-more { font-size: 14px; font-weight: 600; letter-spacing: .4px; }
.post-more:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ===== 顶部导航 ===== */
.site-header { background: var(--dai-blue); border-bottom: 3px solid var(--zhu-red); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; max-width: 1120px; margin: 0 auto; position: relative; }
.site-brand { display: flex; align-items: center; gap: 10px; color: var(--yue-white); font-family: var(--font-serif); font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.site-brand:hover { color: var(--jin-gold); }
.site-brand .bagua-mark { width: 30px; height: 30px; border-radius: 50%; background: conic-gradient(var(--zhu-red) 0 25%, var(--yue-white) 25% 50%, var(--zhu-red) 50% 75%, var(--yue-white) 75%); border: 2px solid var(--jin-gold); }
.main-nav ul { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; }
.main-nav a { color: var(--yue-white); font-size: 15px; }
.main-nav a:hover { color: var(--jin-gold); }

/* ===== Hero ===== */
.hero { background: linear-gradient(160deg, var(--dai-blue) 0%, var(--dai-mid) 70%); color: var(--yue-white); text-align: center; padding: 84px 24px 92px; position: relative; overflow: hidden; }
.hero::after { content: "☰☱☲☳☴☵☶☷"; position: absolute; bottom: -22px; left: 0; right: 0; text-align: center; font-size: 88px; letter-spacing: 40px; color: rgba(200, 169, 106, 0.10); pointer-events: none; }
.hero h1 { font-family: var(--font-serif); font-size: 42px; margin: 0 0 18px; }
.hero h1 em { color: var(--jin-gold); font-style: normal; }
.hero p { max-width: 640px; margin: 0 auto 30px; color: rgba(251, 249, 244, 0.85); font-size: 18px; }
.btn { display: inline-block; padding: 13px 34px; border-radius: 999px; background: var(--zhu-red); color: var(--yue-white); font-weight: 600; border: 1px solid transparent; transition: all .2s; }
.btn:hover { background: var(--jiang-deep); color: var(--yue-white); transform: translateY(-2px); }
.btn.ghost { background: transparent; border-color: var(--jin-gold); color: var(--jin-gold); }
.btn.ghost:hover { background: rgba(200, 169, 106, 0.15); }

/* ===== 区块标题 ===== */
.section { padding: 64px 0; }
.section-title { text-align: center; font-family: var(--font-serif); font-size: 30px; margin: 0 0 8px; color: var(--dai-blue); }
.section-title::after { content: ""; display: block; width: 56px; height: 3px; background: var(--zhu-red); margin: 14px auto 0; }
.section-sub { text-align: center; color: var(--mo-light); margin: 14px 0 44px; font-size: 15px; }

/* ===== 分类卡片 ===== */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; }
.cat-card { background: var(--yue-white); border-radius: var(--radius); padding: 30px 26px; box-shadow: var(--shadow); border-top: 4px solid var(--jin-gold); transition: transform .2s, border-color .2s; }
.cat-card:hover { transform: translateY(-4px); border-top-color: var(--zhu-red); }
.cat-card:nth-child(1) { border-top-color: var(--zhu-red); }
.cat-card:nth-child(2) { border-top-color: var(--qing-green); }
.cat-card:nth-child(3) { border-top-color: var(--dai-mid); }
.cat-card:nth-child(4) { border-top-color: var(--jin-gold); }
.cat-card .cat-glyph { display: inline-block; }
.cat-card .cat-glyph img { width: 40px; height: 40px; display: block; border-radius: 6px; }
.cat-card h3 { font-family: var(--font-serif); margin: 10px 0 8px; font-size: 21px; color: var(--dai-blue); }
.cat-card p { color: var(--mo-light); font-size: 14.5px; margin: 0 0 14px; }
.cat-card .more { font-size: 14px; font-weight: 600; color: var(--zhu-red); }

/* ===== 文章卡片 ===== */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.subcat-sections { display: flex; flex-direction: column; gap: 40px; }
.subcat-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--paper-line, #e8e2d5); padding-bottom: 10px; }
.subcat-head h2 { font-size: 1.5rem; margin: 0; }
.subcat-head h2 a { color: inherit; text-decoration: none; }
.subcat-count { color: #9a8f7a; font-size: .9rem; }
.post-card { background: var(--yue-white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s; }
.post-card:hover { transform: translateY(-4px); }
.post-card .post-thumb { height: 150px; background: linear-gradient(135deg, var(--dai-mid), var(--qing-green)); display: flex; align-items: center; justify-content: center; color: var(--yue-white); font-family: var(--font-serif); font-size: 34px; }
.post-card .post-thumb img { width: 100%; height: 100%; object-fit: contain; background: #f7f3ea; display: block; }

.post-card .post-body { padding: 20px 22px 24px; flex: 1; display: flex; flex-direction: column; }
.post-card .post-cat { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--qing-green); font-weight: 700; }
.post-card h3 { margin: 8px 0 8px; font-size: 18px; line-height: 1.5; font-family: var(--font-serif); }
.post-card h3 a { color: var(--mo-ink); }
.post-card h3 a:hover { color: var(--zhu-red); }
.post-card p { color: var(--mo-light); font-size: 14px; margin: 0; }
.post-card .post-more { margin-top: auto; padding-top: 14px; font-size: 14px; font-weight: 600; }

/* ===== CTA ===== */
.cta-band { background: var(--dai-blue); border-top: 3px solid var(--jin-gold); border-bottom: 3px solid var(--jin-gold); color: var(--yue-white); text-align: center; padding: 56px 24px; }
.cta-band h2 { font-family: var(--font-serif); font-size: 28px; margin: 0 0 10px; }
.cta-band p { color: rgba(251, 249, 244, 0.8); margin: 0 0 24px; }

/* ===== 页脚 ===== */
.site-footer { background: var(--dai-blue); color: rgba(251, 249, 244, 0.75); padding: 44px 0 28px; font-size: 14px; }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.footer-cols h4 { color: var(--jin-gold); font-family: var(--font-serif); margin: 0 0 12px; font-size: 16px; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols a { color: rgba(251, 249, 244, 0.75); }
.footer-cols a:hover { color: var(--jin-gold); }
.footer-bottom { border-top: 1px solid rgba(251, 249, 244, 0.15); text-align: center; margin-top: 30px; padding-top: 18px; font-size: 13px; color: rgba(251, 249, 244, 0.5); }

/* ===== 内容页（文章/页面） ===== */
.content-wrap { max-width: 1120px; margin: 0 auto; padding: 32px 24px 96px; }

.content-wrap .page-head { max-width: none; margin: 0 0 24px; text-align: left; }
.content-wrap .entry-media { max-width: 1120px; margin: 0 0 40px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.content-wrap .entry-media img { width: 100%; height: auto; display: block; }
.content-wrap .entry-content { max-width: none; margin: 0; }
.page-head .breadcrumb { font-size: 13px; color: var(--mo-light); line-height: 1.2; padding: 0px 0 8px; margin-bottom: 10px; border-bottom: 1px solid var(--paper-line, #e8e0d0); }



.page-head .breadcrumb a, .archive-head .breadcrumb a { color: var(--mo-light); text-decoration: none; }
.page-head .breadcrumb a:hover, .archive-head .breadcrumb a:hover { color: var(--jin-gold); text-decoration: underline; }
.archive-head .breadcrumb { font-size: 13px; color: var(--mo-light); line-height: 1.2; padding: 3px 0 5px; margin-bottom: 10px; border-bottom: 1px solid var(--paper-line, #e8e0d0); }



.page-head h1 { font-family: var(--font-serif); font-size: 34px; line-height: 1.4; margin: 0 0 12px; color: var(--dai-blue); }
.entry-meta { color: var(--mo-light); font-size: 14px; margin-bottom: 28px; }
.entry-content h2 { font-family: var(--font-serif); font-size: 25px; color: var(--dai-blue); border-left: 4px solid var(--zhu-red); padding-left: 14px; margin-top: 40px; }
.entry-content h3 { font-family: var(--font-serif); font-size: 20px; color: var(--dai-mid); margin-top: 32px; }
.entry-content blockquote { background: var(--yue-white); border-left: 4px solid var(--jin-gold); margin: 24px 0; padding: 18px 22px; color: var(--mo-light); font-style: normal; }
.entry-content ul li::marker { color: var(--zhu-red); }
.entry-content a { border-bottom: 1px dashed var(--zhu-red); }

/* 归档页 */
.archive-head { text-align: left; padding: 32px 24px 12px; }



.archive-head h1 { font-family: var(--font-serif); font-size: 32px; color: var(--dai-blue); margin: 16px 0 0; }
.archive-desc { margin: 10px 0 0; color: #6f675a; font-size: 15px; line-height: 1.6; }


.archive-list { max-width: 800px; margin: 24px auto 72px; padding: 0 24px; }
/* 归档/列表区（1120 版心，卡片同首页最新指南） */
.archive-body { padding-bottom: 72px; }
.archive-item { background: var(--yue-white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 26px; margin-bottom: 18px; }
.archive-item h2 { margin: 0 0 6px; font-size: 20px; font-family: var(--font-serif); }
.archive-item h2 a { color: var(--mo-ink); }
.archive-item h2 a:hover { color: var(--zhu-red); }
.archive-item p { color: var(--mo-light); font-size: 14.5px; margin: 0; }

/* 移动端 */
@media (max-width: 720px) {
  .header-inner { flex-direction: column; gap: 10px; }
  .hero h1 { font-size: 30px; }
  .footer-cols { grid-template-columns: 1fr; }
  .content-wrap .page-head h1 { font-size: 27px; }
}

/* ===== 头部二级下拉菜单 ===== */
/* 父项定位 + hover 区域缓冲（顶部 padding 让鼠标移动不中断） */
.main-nav ul.menu,
.main-nav > ul {
  position: relative;
}
.main-nav li {
  position: relative;
}

/* 有子菜单的父项：描边小三角（比字符 ▾ 更精细） */
.main-nav li:has(ul) > a {
  padding-right: 22px;
}
.main-nav li:has(ul) > a::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 6px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--jin-gold);
  border-bottom: 1.5px solid var(--jin-gold);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s ease, border-color .2s ease;
}
.main-nav li:has(ul):hover > a::after {
  transform: translateY(-30%) rotate(225deg);   /* 悬停时三角朝上 */
  border-color: var(--zhu-red);
}

/* 父项悬停反馈：朱红下划线从中线展开 */
.main-nav > ul > li > a { position: relative; }
.main-nav > ul > li > a::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 0;
  height: 2px;
  background: var(--zhu-red);
  transform: translateX(-50%);
  transition: width .25s ease;
}
.main-nav > ul > li:hover > a::before,
.main-nav > ul > li.current-menu-item > a::before,
.main-nav > ul > li.current-cat > a::before { width: 60%; }

/* 子菜单容器：默认隐藏，淡入上滑展开 */
.main-nav ul.children,
.main-nav ul.sub-menu {
  display: block;                 /* 常驻 block，用透明度+可见性控制 */
  position: absolute;
  top: calc(100% + 6px);          /* 与父项留 6px 呼吸间距 */
  left: 0;
  min-width: 200px;
  background: var(--yue-white);
  border: 1px solid rgba(200, 169, 106, .45);          /* 缃金半透描边 */
  border-radius: 6px;
  box-shadow:
    0 2px 6px rgba(29, 42, 58, .06),
    0 12px 32px rgba(29, 42, 58, .14);                 /* 双层阴影更有质感 */
  z-index: 999;
  padding: 8px 0;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
/* 朱红→缃金渐变顶线（替代原来的纯色 3px 粗线） */
.main-nav ul.children::before,
.main-nav ul.sub-menu::before {
  content: "";
  position: absolute;
  top: 0; left: 12px; right: 12px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--zhu-red), var(--jin-gold));
}
/* 鼠标从子菜单回到导航的缓冲桥（跨越 6px 间隙不消失） */
.main-nav li::after {
  content: "";
  position: absolute;
  top: 100%; left: 0; right: 0;
  height: 8px;
}
/* hover / 键盘焦点展开 */
.main-nav li:hover > ul.children,
.main-nav li:hover > ul.sub-menu,
.main-nav li:focus-within > ul.children,
.main-nav li:focus-within > ul.sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 子菜单项 */
.main-nav ul.children li,
.main-nav ul.sub-menu li { width: 100%; }
.main-nav ul.children li a,
.main-nav ul.sub-menu li a {
  display: block;
  position: relative;
  padding: 11px 20px 11px 24px;
  color: var(--mo-ink);
  white-space: nowrap;
  font-size: 14.5px;
  font-family: var(--font-serif);
  letter-spacing: .04em;
  transition: background .18s ease, color .18s ease, padding-left .18s ease;
}
/* hover：宣纸底 + 朱红左标线 + 文字右移一点 */
.main-nav ul.children li a:hover,
.main-nav ul.sub-menu li a:hover,
.main-nav ul.children li.current-cat > a,
.main-nav ul.sub-menu li.current-cat > a {
  background: rgba(245, 241, 232, .9);                  /* 宣纸 */
  color: var(--zhu-red);
  padding-left: 28px;
}
.main-nav ul.children li a::before,
.main-nav ul.sub-menu li a::before {
  content: "";
  position: absolute;
  left: 10px;
  width: 3px; height: 0;
  background: var(--zhu-red);
  transition: height .18s ease;
}
.main-nav ul.children li a:hover::before,
.main-nav ul.sub-menu li a:hover::before { height: 16px; }

/* 移动端：汉堡菜单 */
@media (max-width: 720px) {
  .header-inner { flex-wrap: nowrap; flex-direction: row; }
  .main-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--dai-blue);
    padding: 12px 20px 20px;
    box-shadow: 0 12px 24px rgba(0,0,0,.25);
    max-height: 80vh;
    overflow-y: auto;
    z-index: 90;
  }
  .main-nav.open { display: block; }
  .main-nav > ul { flex-direction: column; gap: 0; }
  .main-nav > ul > li > a {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(200,169,106,.25);
    font-size: 16px;
  }
  .main-nav ul.children,
  .main-nav ul.sub-menu {
    display: block;
    position: static;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: transparent;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--jin-gold, #C8A96A);
    border-radius: 0;
    margin: 4px 0 8px 14px;
    padding: 2px 0;
  }
  .main-nav ul.children::before,
  .main-nav ul.sub-menu::before { display: none; }
  .main-nav ul.children li a,
  .main-nav ul.sub-menu li a { padding: 8px 4px 8px 12px; color: var(--yue-white); font-size: 14px; }

  /* 汉堡按钮 */
  .nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px; height: 44px;
    padding: 10px;
    background: transparent;
    border: 1px solid var(--jin-gold, #C8A96A);
    border-radius: 6px;
    cursor: pointer;
  }
  .nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--jin-gold, #C8A96A);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
  }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
@media (min-width: 721px) {
  .nav-toggle { display: none; }
}

/* dev toast：开发中提示 */
.dev-toast {
    position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(16px);
    background: #1D2A3A; color: #FBF9F4;
    border: 1px solid #C8A96A; border-left: 4px solid #C3272B;
    padding: 12px 22px; border-radius: 6px; font-size: 14px; letter-spacing: .3px;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
    opacity: 0; visibility: hidden; transition: opacity .3s, transform .3s, visibility .3s;
    z-index: 9999; pointer-events: none; max-width: 90vw; text-align: center;
}
.dev-toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }


