/* PoetVista SEO 服务端渲染页面专用样式（独立于 SPA 编译产物）。
   设计令牌与 SPA（Tailwind stone 中性色）对齐，保证两类页面视觉一致。 */

:root {
  /* 色板：与 SPA Tailwind stone 一致 */
  --bg-page: #fafaf9;          /* stone-50  页面底色 */
  --bg-surface: #ffffff;       /* 卡片/导航底 */
  --border: #e7e5e4;           /* stone-200 */
  --border-strong: #d6d3d1;    /* stone-300 */
  --text-strong: #1c1917;      /* stone-900 */
  --text: #292524;             /* stone-800 */
  --text-700: #44403c;         /* stone-700 */
  --text-600: #57534e;         /* stone-600 */
  --text-muted: #78716c;       /* stone-500 */
  --text-faint: #a8a29e;       /* stone-400 */
  --accent: #1c1917;           /* 主按钮近黑（替代旧紫） */
  --accent-hover: #44403c;     /* stone-700 */

  /* 结构 */
  --container: 64rem;          /* max-w-5xl = 1024px */
  --radius-card: 1rem;         /* rounded-2xl */
  --radius-md: .5rem;          /* rounded-lg */
  --shadow-menu: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);

  /* 字体：与 SPA font-sans / font-serif 同栈，并兼容中文字体 */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", Times,
    "Songti SC", "SimSun", serif;
}

* {
  box-sizing: border-box;
}

button,
input,
select,
textarea {
  font: inherit;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg-page);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-strong);
}

h1 {
  font-size: 1.875rem;
  margin: 0 0 .5rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2rem 0 .75rem;
}

/* ==================== 站头（与 SPA +layout.svelte 一致） ==================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, .8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.site-header .nav {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .brand {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 400;
  line-height: 1.75rem;
  letter-spacing: -0.025em;
  color: var(--text-strong);
}

.site-header .brand:hover {
  text-decoration: none;
}

.site-header .nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  font-size: .875rem;
  line-height: 1.25rem;
  color: var(--text-600);
}

.site-header .nav-links > a {
  color: var(--text-600);
  transition: color .15s ease;
}

.site-header .nav-links > a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

/* 下拉菜单（账户 / 语言） */
.menu {
  position: relative;
}

.menu-trigger {
  display: flex;
  align-items: center;
  gap: .375rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .375rem .75rem;
  font-size: .875rem;
  color: var(--text-700);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.menu-trigger:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
}

.menu-trigger .caret {
  color: var(--text-faint);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: .5rem;
  z-index: 20;
  width: 10rem;
  padding: .25rem 0;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--bg-surface);
  box-shadow: var(--shadow-menu);
}

.menu-panel a,
.menu-panel button {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem 1rem;
  text-align: left;
  font-size: .875rem;
  color: var(--text-600);
  background: none;
  border: none;
  cursor: pointer;
}

.menu-panel a:hover,
.menu-panel button:hover {
  background: var(--bg-page);
  color: var(--text-strong);
  text-decoration: none;
}

.menu-panel a.active {
  font-weight: 500;
  color: var(--text-strong);
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.75rem;
  width: 1.75rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
}

/* ==================== 主体 ==================== */
.site-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}

/* ==================== 面包屑 ==================== */
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  padding: 0;
  margin: 0 0 1.5rem;
  font-size: .875rem;
  color: var(--text-muted);
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.breadcrumb .sep {
  color: var(--text-faint);
}

/* ==================== 页脚（与 SPA Footer.svelte 一致） ==================== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 2.5rem 0;
}

.site-footer .footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.site-footer .footer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.site-footer .footer-brand {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  letter-spacing: -0.025em;
  color: var(--text-muted);
}

.site-footer .footer-brand:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.site-footer .footer-links {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  font-size: .875rem;
}

.site-footer .footer-links a {
  color: var(--text-600);
  transition: color .15s ease;
}

.site-footer .footer-links a:hover {
  color: var(--text-strong);
  text-decoration: none;
}

.site-footer .footer-meta {
  margin: 2rem 0 0;
  text-align: center;
  font-size: .75rem;
  color: var(--text-faint);
}

/* 桌面端：品牌居左、链接居右 */
@media (min-width: 640px) {
  .site-footer .footer-top {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }

  .site-footer .footer-links {
    flex-direction: row;
    gap: 1.5rem;
  }

  .site-footer .footer-meta {
    text-align: left;
  }
}

/* ==================== 正文通用排版 ==================== */
.poem-text {
  white-space: pre-wrap;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  line-height: 2;
  letter-spacing: .02em;
  color: var(--text-strong);
  margin: .5rem 0;
}

.pinyin {
  color: var(--text-muted);
  font-size: .95rem;
  line-height: 1.9;
  margin: .25rem 0 1rem;
}

.prose {
  white-space: pre-line;
  color: var(--text);
  line-height: 1.85;
}

.meta-line {
  color: var(--text-muted);
  margin: .5rem 0 1.5rem;
  font-size: .95rem;
}

.meta-line span,
.meta-line a {
  margin-right: .75rem;
}

.meta-line a {
  color: var(--text-muted);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}

.meta-line a:hover {
  color: var(--text-strong);
}

.link-list {
  list-style: none;
  padding: 0;
}

.link-list li {
  margin: .375rem 0;
}

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

/* ==================== 诗词详情页 ==================== */
.poem-hero {
  margin-bottom: 1.5rem;
}

.poem-figure {
  margin: 1.5rem 0 0;
}

.poem-image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-card);
}

.poem-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2rem;
  margin: 1.5rem 0;
  text-align: center;
}

.poem-audio {
  margin: 1rem auto 0;
  max-width: 28rem;
}

.poem-audio audio {
  width: 100%;
}

.poem-audio.audio-player {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-surface);
}

.ap-btn {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-700);
  background: transparent;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.ap-btn:hover {
  background: var(--bg-page);
}

.ap-time {
  flex: none;
  font-size: .75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.ap-range {
  flex: 1 1 auto;
  min-width: 0;
  cursor: pointer;
  accent-color: var(--text-700);
}

.poem-location {
  margin: 1rem 0 0;
  font-size: .875rem;
  color: var(--text-muted);
}

.poem-location .sep {
  color: var(--text-faint);
  margin: 0 .5rem;
}

.poem-location .loc-place {
  color: var(--text-muted);
}

.poem-location .loc-map {
  display: inline-flex;
  align-items: center;
  margin-left: .5rem;
  color: var(--text-faint);
  vertical-align: middle;
  transition: color .15s;
}

.poem-location .loc-map:hover {
  color: var(--text-strong);
}

.question-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.question-list li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.question-index {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 1.5rem;
  min-width: 1.5rem;
  padding: 0 .4rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .75rem;
  font-weight: 500;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.mini-card {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 1rem 1.25rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.mini-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 6px -2px rgba(0, 0, 0, .08);
  text-decoration: none;
}

.mini-card-title {
  color: var(--text-strong);
  font-weight: 500;
}

.mini-card-sub {
  color: var(--text-muted);
  font-size: .875rem;
}

/* 作者页诗词列表：默认折叠第 13 首之后的卡片，点击按钮展开全部 */
.poem-grid.is-collapsed > .mini-card:nth-child(n + 13) {
  display: none;
}

.poem-list-toggle {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.poem-list-toggle .toggle-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .5rem 1.25rem;
  font-size: .875rem;
  color: var(--text-700);
  background: transparent;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease;
}

.poem-list-toggle .toggle-btn:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  color: var(--text-strong);
}

/* ==================== 订阅引导（teaser） ==================== */
.teaser {
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 2rem;
  margin: 1.5rem 0;
  background: var(--bg-surface);
  text-align: center;
}

.teaser h2 {
  margin-top: 0;
}

.teaser .cta {
  display: inline-block;
  margin-top: 1rem;
  padding: .75rem 1.5rem;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: .875rem;
  transition: background .15s ease;
}

.teaser .cta:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

/* ==================== 图片灯箱（seo.js 增强） ==================== */
.poem-figure.is-lightbox .poem-image {
  cursor: zoom-in;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(28, 25, 23, .85);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5rem;
  width: 2.5rem;
  border-radius: 999px;
  border: none;
  background: rgba(255, 255, 255, .16);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease;
}

.lightbox-close:hover {
  background: rgba(255, 255, 255, .28);
}

.lightbox-figure {
  margin: 0;
  max-width: 100%;
  max-height: 100%;
}

.lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
  border-radius: .5rem;
}

/* ==================== 作者页：对比 + 评价 ==================== */
.compare-list {
  display: grid;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.compare-item {
  margin: 0;
}

.compare-name {
  margin: 0 0 .25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-strong);
}

.evaluation-list {
  display: grid;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.evaluation-item {
  margin: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--border-strong);
}

.eval-quote {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-strong);
}

.eval-translation {
  margin: .5rem 0 0;
  font-size: .875rem;
  line-height: 1.6;
  color: var(--text-muted);
}

.eval-source {
  margin: .5rem 0 0;
  font-size: .75rem;
  color: var(--text-faint);
}

/* ==================== 响应式 ==================== */
@media (max-width: 640px) {
  .site-header .nav {
    flex-wrap: wrap;
    padding: .75rem 1rem;
    gap: .5rem;
  }

  .site-header .brand {
    width: 100%;
  }

  .site-header .nav-links {
    width: 100%;
    flex-wrap: wrap;
    gap: .75rem 1rem;
  }

  .site-main {
    padding: 2rem 1rem 4rem;
  }

  .poem-text {
    font-size: 1.25rem;
    line-height: 1.9;
  }

  .poem-card {
    padding: 1.5rem 1rem;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }
}