/* 诗词题材分类专题页；沿用 reference.css 与系统的绿色纸感基线。 */
.theme-hero {
  padding: 30px 34px;
  margin-bottom: 22px;
  border: 1px solid #d3e0c9;
  border-radius: 22px;
  background: radial-gradient(ellipse at 92% 0, #fff0d6, transparent 58%),
    radial-gradient(ellipse at 0 100%, #e4f0dc, transparent 62%), #eef5e7;
}
.theme-hero h1 {
  margin: 0 0 8px;
  font-size: clamp(32px, 3vw, 46px);
  letter-spacing: .02em;
}
.theme-hero-sub {
  margin: 0 0 10px;
  color: var(--green-dark);
  font-size: 20px;
  letter-spacing: .06em;
}
.theme-hero-lead {
  max-width: 46rem;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.85;
}
.theme-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 15px;
}
.theme-hero-stats span {
  padding: 6px 12px;
  border: 1px solid #cfe0c6;
  border-radius: 999px;
  background: #fffefa;
}
.theme-hero-stats strong {
  color: var(--green);
  font-size: 17px;
}
.theme-prompt {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 0;
  padding: 12px 16px;
  border-left: 4px solid #b99e6c;
  border-radius: 0 12px 12px 0;
  background: #fff4e1;
  color: #6b4a2a;
  font-size: 15.5px;
  line-height: 1.8;
}
.theme-prompt span {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  background: #854521;
  color: #fff;
  font-size: 12px;
  letter-spacing: .08em;
}
.theme-dynasty {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.theme-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 6px 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--green);
  font-size: 15px;
  font-weight: 650;
}
.theme-pill.is-active {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.theme-workspace {
  display: grid;
  grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.theme-nav {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid #dbe6d3;
  border-radius: 18px;
  background: #f4f8ef;
}
.theme-nav a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--ink);
}
.theme-nav a:hover {
  background: #e7f0df;
}
.theme-nav strong {
  font-size: 15px;
}
.theme-nav small {
  color: var(--muted);
  font-size: 13px;
}
.theme-groups {
  display: flex;
  flex-direction: column;
  gap: 30px;
  min-width: 0;
}
.theme-group {
  scroll-margin-top: 20px;
}
.theme-group-head h2 {
  margin: 2px 0 6px;
  font-size: 26px;
}
.theme-group-head p:last-child {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 16px;
}
.theme-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 14px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 4px solid #a8c0a0;
  border-radius: 16px;
  background: var(--white);
  color: inherit;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.theme-card:hover {
  border-color: #87a583;
  box-shadow: 0 8px 20px #233e3714;
  transform: translateY(-2px);
}
.theme-card-kicker {
  margin: 0;
  color: #8a744f;
  font-size: 13.5px;
  letter-spacing: .06em;
}
.theme-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  font-size: 24px;
}
.theme-card-arrow {
  color: var(--green);
  font-size: 20px;
}
.theme-card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.85;
}
.theme-card-count {
  margin: auto 0 0;
  padding-top: 10px;
  border-top: 1px dashed #dbe6d3;
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 650;
}
.theme-card-count span {
  margin-left: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.theme-section {
  margin-top: 26px;
}
.theme-section-head h2 {
  margin: 0 0 4px;
  font-size: 23px;
}
.theme-section-head p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 15px;
}
.theme-poem-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.theme-poem {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-poem h3 {
  font-size: 21px;
  line-height: 1.5;
}
.theme-poem-label {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: .04em;
}
.theme-poem.is-featured {
  border-top: 3px solid #b99e6c;
  background: #fffdf7;
}
.theme-poem.is-featured .theme-poem-label {
  color: #8a744f;
  font-weight: 650;
}
.theme-back {
  margin: 30px 0 8px;
  font-size: 15px;
}
.theme-back a {
  color: var(--green);
}
@media (max-width: 1099px) {
  .theme-workspace {
    grid-template-columns: minmax(9rem, 11rem) minmax(0, 1fr);
    gap: 18px;
  }
}
@media (max-width: 899px) {
  .theme-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .theme-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px;
  }
  .theme-nav a {
    flex: none;
    padding: 8px 12px;
    white-space: nowrap;
  }
}
@media (max-width: 699px) {
  .theme-hero {
    padding: 24px 20px;
  }
  .theme-hero-lead {
    font-size: 16px;
  }
  .theme-cards,
  .theme-poem-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .theme-card {
    padding: 18px;
  }
  .theme-section-head h2 {
    font-size: 21px;
  }
  .theme-group-head h2 {
    font-size: 23px;
  }
  .theme-nav {
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .theme-nav a {
    flex: 1 1 calc(50% - 4px);
    white-space: normal;
  }
}
/* 诗词首页的专题入口：与飞花令并排，窄屏整行换行，避免挤压标题。 */
.poetry-index-header {
  flex-wrap: wrap;
}
.poetry-index-actions {
  flex: 1 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
@media (max-width: 699px) {
  .poetry-index-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }
}

/* ── 古诗文首页（.poetry-home 仅 index.html 包裹）：暖纸 hero 与文集卡 ── */
.poetry-home .poetry-index-header {
  padding: 22px 28px;
  border: 1px solid #e3dbc6;
  border-radius: 22px;
  background: radial-gradient(ellipse at 92% 0, #fff0d6, transparent 58%),
    radial-gradient(ellipse at 0 100%, #f3e9d3, transparent 62%), #f8f4e8;
}
.poetry-home .ref-toolbar { border-color: #e3dbc6; background: #f8f4e8; }
.poetry-home .ref-field input:focus, .poetry-home .ref-field select:focus { border-color: #8a744f; }
.poetry-home .ref-card .ref-meta:first-child {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #f6eddb;
  color: #8a744f;
  font-weight: 650;
  line-height: 1.6;
}
@media (max-width: 699px) {
  .poetry-home .poetry-index-header { padding: 16px 18px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-card {
    transition: none;
  }
}

/* ── 主题详情：左右工作区——左 sticky 导航（朝代 + 全量主题），右诗单 ── */
.theme-workspace { display: grid; grid-template-columns: minmax(280px, 320px) minmax(0, 1fr); gap: 22px; align-items: start; margin-bottom: 30px; }
.theme-side {
  position: sticky; top: 16px;
  max-height: calc(100dvh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px;
  border: 1px solid #d3e0c9; border-radius: 20px; background: #eef5e7;
  scrollbar-width: thin; scrollbar-color: #b7c9ab transparent;
}
.theme-side-card { padding: 14px; border-radius: 14px; background: #fff; }
.theme-side-label { margin: 0 0 8px; color: var(--muted, #586b62); font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.theme-nav-list { display: flex; flex-direction: column; gap: 3px; }
.theme-nav-link { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 9px; color: #234b38; font-size: 14px; font-weight: 650; transition: background .14s ease; }
.theme-nav-link:hover { background: #eaf4df; }
.theme-nav-link.on { background: var(--green, #22634c); color: #fff; }
.theme-nav-emoji { flex-shrink: 0; font-size: 16px; line-height: 1.2; }
.theme-nav-count { margin-left: auto; color: var(--muted, #586b62); font-size: 12px; font-variant-numeric: tabular-nums; }
.theme-nav-link.on .theme-nav-count { color: #d9ecda; }
.theme-nav-group { margin: 10px 0 4px; color: #49643f; font-size: 13px; font-weight: 800; }
.theme-nav-second { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #d9e4d4; }
.theme-main { min-width: 0; }

/* 详情版 hero 压缩：标题卡内边距与字号收一档 */
.theme-hero-detail { padding: 18px 26px; margin-bottom: 20px; }
.theme-hero-detail h1 { margin-bottom: 6px; font-size: clamp(26px, 2.6vw, 36px); }
.theme-hero-detail .theme-hero-sub { margin-bottom: 6px; font-size: 17px; }
.theme-hero-detail .theme-hero-lead { font-size: 16px; line-height: 1.75; }
.theme-hero-detail .theme-hero-stats { margin-top: 12px; }
.theme-hero-detail .theme-prompt { margin-top: 12px; padding: 9px 14px; font-size: 14.5px; }

@media (max-width: 860px) {
  .theme-workspace { grid-template-columns: minmax(0, 1fr); }
  .theme-side { position: static; max-height: none; }
}
