:root {
  /* 宣纸作底，墨色阅读，朱砂点缀。 */
  --bg: #f5f1e8;
  --card: #fcfaf5;
  --text: #302f2b;
  --muted: #6e685f;
  --line: #e4ddd0;
  --accent: #a63d32;
  --accent-hover: #8f3229;
  --tag-bg: #eee8dc;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.8;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

main { padding: 28px 16px 48px; }

/* 栏目导航：暖白底、墨色文字，当前栏目以朱砂标记。 */
.main-header { background: var(--card); color: var(--text); border-bottom: 1px solid var(--line); }
.main-header .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; padding-top: 12px; padding-bottom: 12px; }
.main-logo { flex-shrink: 0; font-family: var(--serif); font-size: 15px; font-weight: 700; white-space: nowrap; }
.main-nav { display: flex; flex: 1; min-width: 0; align-items: center; gap: 14px; white-space: nowrap; font-size: 15px; }
.main-nav a { padding: 4px 0; border-bottom: 2px solid transparent; }
.main-nav .section-start { border-left: 1px solid var(--line); padding-left: 16px; }
.main-nav a.active, .main-nav a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.main-header a:hover { color: var(--accent); }
.search-mini { display: flex; flex-shrink: 0; align-items: center; margin-left: auto; gap: 4px; min-width: 0; }
.search-mini input { width: 150px; min-width: 0; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; }
.search-mini button { flex-shrink: 0; padding: 5px 0 5px 6px; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; cursor: pointer; }
.search-mini button:hover { color: var(--accent-hover); }
@media (max-width: 900px) {
  .main-header .wrap { flex-wrap: wrap; gap: 10px 20px; }
  .main-nav { order: 3; flex: 0 0 100%; overflow-x: auto; gap: 20px; scrollbar-width: thin; padding-bottom: 2px; }
  .main-nav a { flex-shrink: 0; }
  .search-mini input { width: 160px; }
}
@media (max-width: 380px) {
  .main-header .wrap { gap: 10px; }
  .search-mini input { width: 135px; }
}

/* 搜索 */
.search-big { display: flex; gap: 8px; }
.search-big input {
  flex: 1; min-width: 0; height: 42px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--text); font-size: 16px;
}
.search-big input:focus { outline: none; border-color: var(--accent); }
.search-big button {
  height: 42px; padding: 0 22px; border: 0; border-radius: 6px;
  background: var(--accent); color: #fff; font-size: 16px; cursor: pointer;
}
.search-big button:hover, .home-search-row button:hover { background: var(--accent-hover); }
.search-mini input::placeholder, .search-big input::placeholder, .home-search-row input::placeholder { color: var(--muted); opacity: 1; }
mark { background: #f6e3a1; color: inherit; padding: 0 1px; border-radius: 2px; }

.site-footer { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 0 40px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px 28px;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--serif);
  font-size: 19px;
  margin: 0 0 16px;
  padding-left: 10px;
  border-left: 3px solid var(--accent);
  line-height: 1.3;
}

.muted { color: var(--muted); }

/* 首页 */
.hero { text-align: center; padding: 20px 0 8px; }
.hero h1 { font-family: var(--serif); font-size: 34px; margin: 0; letter-spacing: 6px; }
.hero p { color: var(--muted); margin: 6px 0 0; }

/* 标签 */
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-block;
  background: var(--tag-bg);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 14px;
  line-height: 1.8;
}
.tag small { color: var(--muted); margin-left: 4px; }
.tag:hover { background: var(--accent); color: #fff; }
.tag:hover small { color: var(--card); }

/* 朝代筛选栏 */
.dynasty-bar { display: flex; flex-wrap: wrap; gap: 6px 4px; }
.dynasty-bar a { padding: 2px 12px; border-radius: 4px; font-size: 15px; }
.dynasty-bar a:hover { background: var(--tag-bg); color: var(--accent); }
.dynasty-bar a.active { background: var(--accent); color: #fff; }

/* 诗文列表 */
.poem-list { list-style: none; margin: 0; padding: 0; }
.poem-list li { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.poem-list li:last-child { border-bottom: 0; }
.poem-list .name { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.poem-list .meta { color: var(--muted); font-size: 14px; margin-left: 8px; }
.poem-list .excerpt { color: #5c574e; font-family: var(--serif); margin-top: 2px; }
.poem-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0 28px; }

/* 详情 */
.poem-head { text-align: center; }
.poem-head h1 { font-family: var(--serif); font-size: 28px; margin: 0 0 6px; letter-spacing: 2px; }
.poem-head .author { color: var(--muted); }
.poem-head .author b { color: var(--text); font-weight: 400; }
.poem-head .author a:hover b { color: var(--accent); }
.poem-head .cipai-line { font-size: 14px; color: var(--muted); margin-top: 2px; }
.poem-head .cipai-line a { color: var(--accent); }
.poem-content {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 2.1;
  text-align: center;
  margin: 22px 0;
}
.poem-content p { margin: 0; }
.poem-content.long { text-align: left; text-indent: 2em; font-size: 17px; }
.poem-content.long p { margin-bottom: 8px; }
.poem-tags { justify-content: center; margin-top: 8px; }

.prose p { margin: 0 0 10px; text-align: justify; }
.prose h3 { font-size: 15px; color: var(--accent); margin: 18px 0 8px; }
.prose h3:first-child { margin-top: 0; }
.source { font-size: 13px; color: var(--muted); margin-top: 12px; }

/* 古籍 */
.guji-row { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.guji-row:last-child { border-bottom: 0; }
.guji-part { flex: none; color: var(--accent); font-weight: 600; }
.book-text p { text-indent: 2em; }
.book-text h3 { font-family: var(--serif); font-size: 17px; color: var(--text); margin: 18px 0 8px; text-indent: 0; }
.toc-volume { font-family: var(--serif); font-size: 16px; color: var(--accent); margin: 16px 0 6px; }
.toc { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 4px 16px; }
.toc li { padding: 4px 0; border-bottom: 1px dashed var(--line); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toc small { margin-left: 6px; font-size: 11px; color: var(--accent); border: 1px solid var(--accent); border-radius: 3px; padding: 0 3px; }

/* 分页 */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; height: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 4px; background: var(--card); font-size: 14px;
}
.pager .current { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .gap { border: 0; background: none; }

.breadcrumb { font-size: 14px; line-height: 20px; color: var(--muted); margin: 0 0 16px; }
main:has(> .breadcrumb) { padding-top: 16px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb ol { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 0; min-height: 20px; list-style: none; margin: 0; padding: 0; }
.breadcrumb li { display: inline-flex; align-items: center; line-height: 20px; min-width: 0; overflow-wrap: anywhere; }
.breadcrumb-separator { margin: 0 10px; color: var(--muted); opacity: .5; }
.breadcrumb [aria-current="page"] { color: var(--text); }

@media (max-width: 600px) {
  .card { padding: 18px 16px; }
  .hero h1 { font-size: 28px; }
  .poem-content { font-size: 17px; }
}

.card, .poem-list li, .prose { overflow-wrap: anywhere; }
.poem-head h1 { line-height: 1.5; }
.toc li { white-space: normal; }
.pager a { height: auto; min-height: 36px; max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 600px) {
  .poem-head h1 { font-size: 24px; letter-spacing: 1px; }
  .poem-list .meta { display: block; margin-left: 0; }
  .guji-row { align-items: flex-start; }
  .toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 搜索区域下方的水墨山水画。 */
/* 首页首屏:水墨图作背景,搜索框叠在图上 */
.home-hero { position: relative; display: flex; align-items: center; justify-content: center; min-height: 120px; margin-bottom: 16px; padding: 16px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg) center 35% / cover no-repeat; overflow: hidden; }
.home-hero::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(252,250,245,.15), rgba(252,250,245,.5)); }
.home-search { position: relative; width: 100%; max-width: 560px; text-align: center; }
.home-hero-title { margin: 0 0 8px; font-size: 20px; letter-spacing: 4px; color: var(--text); text-shadow: 0 1px 2px var(--card); }
.home-search-row { display: flex; gap: 8px; background: rgba(252,250,245,.92); padding: 6px; border-radius: 8px; box-shadow: 0 4px 16px rgba(48,47,43,.08); }
.home-search-row input { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--text); font-size: 16px; }
.home-search-row input:focus { outline: none; border-color: var(--accent); }
.home-search-row button { height: 40px; padding: 0 22px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; font-size: 16px; cursor: pointer; }
.main-header.is-home .search-mini { display: none; }

/* 站点顶部小栏：与古诗词栏目导航分开 */
.site-bar { background: var(--tag-bg); color: var(--muted); font-size: 13px; }
.site-bar-in { display: flex; align-items: center; justify-content: flex-end; min-height: 32px; }
.site-links { display: flex; gap: 16px; }
.site-links a { color: var(--muted); }
.site-links a:hover { color: var(--accent); }
.main-nav a { font-size: 15px; }
