/* 佛道经典 — 现代化样式（纯 CSS，无框架） */

:root {
  color-scheme: light dark;
  --bg-page: #e8e4dc;
  --bg-panel: rgba(255, 252, 245, 0.92);
  --bg-panel-border: rgba(90, 70, 40, 0.12);
  --text-primary: #2c2419;
  --text-muted: #6b5d4a;
  --accent: #8b6914;
  --accent-hover: #6b4f0a;
  --ruby-text: #5c4a2e;
  --ruby-pinyin: #7a6a55;
  --shadow: 0 8px 32px rgba(44, 36, 25, 0.08);
  --radius: 12px;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --font-sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --step: 1;
}

[data-theme="dark"] {
  --bg-page: #1a1814;
  --bg-panel: rgba(35, 32, 28, 0.95);
  --bg-panel-border: rgba(220, 200, 160, 0.08);
  --text-primary: #e8e2d6;
  --text-muted: #a89880;
  --accent: #d4a84b;
  --accent-hover: #e8bc5c;
  --ruby-text: #e0d8c8;
  --ruby-pinyin: #a09078;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: calc(15px + 0.15vw);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  background: var(--bg-page);
  color: var(--text-primary);
  line-height: 1.65;
  transition: background 0.25s ease, color 0.25s ease;
}

/* 首页 / 列表页背景 */
.page-home {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(232, 228, 220, 0.88) 0%, rgba(232, 228, 220, 0.95) 40%, var(--bg-page) 100%),
    url("../../index.jpg") center top / cover no-repeat fixed;
}

html[data-theme="dark"] body.page-home {
  background:
    linear-gradient(180deg, rgba(26, 24, 20, 0.92) 0%, var(--bg-page) 100%),
    url("../../index.jpg") center top / cover no-repeat fixed;
}

.page-list {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(232, 228, 220, 0.9) 0%, var(--bg-page) 50%),
    url("../../index.jpg") center 20% / cover no-repeat fixed;
}

html[data-theme="dark"] .page-list {
  background:
    linear-gradient(180deg, rgba(26, 24, 20, 0.95) 0%, var(--bg-page) 60%),
    url("../../index.jpg") center 20% / cover no-repeat fixed;
}

/* 经文阅读页 */
.page-scripture {
  background: var(--bg-page);
  padding-bottom: 5rem;
}

.scripture-panel {
  width: min(48rem, 100% - 1.5rem);
  margin: 0 auto;
  margin-top: 0.5rem;
  padding: 1rem 1.15rem 2.5rem;
  border: 1px solid var(--bg-panel-border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--bg-panel) 0%, rgba(255, 252, 245, 0.85) 100%),
    url("../../time.jpg") repeat;
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .scripture-panel {
  background:
    linear-gradient(180deg, var(--bg-panel) 0%, rgba(40, 36, 32, 0.9) 100%),
    url("../../time.jpg") repeat;
  background-blend-mode: multiply;
}

/* 导航与标题区 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.65rem 1rem;
  background: color-mix(in srgb, var(--bg-page) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-panel-border);
}

.site-header__brand {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.12em;
}

.site-header__brand a {
  color: var(--text-primary);
  text-decoration: none;
}

.site-header__brand a:hover {
  color: var(--accent);
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 0 0.5rem;
  border: 1px solid var(--bg-panel-border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-primary);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.icon-btn:active {
  transform: scale(0.98);
}

/* 首页主内容 */
.home-wrap {
  width: min(26rem, 100% - 2rem);
  margin: 2.5rem auto 3rem;
  padding: 2rem 1.5rem;
  text-align: center;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--bg-panel-border);
  box-shadow: var(--shadow);
}

.home-wrap h1 {
  margin: 0 0 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.2em;
}

.home-wrap .subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

.nav-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.nav-cards a {
  display: block;
  padding: 1rem 1.25rem;
  border-radius: 10px;
  border: 1px solid var(--bg-panel-border);
  background: color-mix(in srgb, var(--bg-page) 40%, var(--bg-panel));
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.nav-cards a:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 105, 20, 0.12);
}

/* 列表页 */
.list-wrap {
  width: min(28rem, 100% - 2rem);
  margin: 1.5rem auto 3rem;
  padding: 1.5rem 1.25rem 2rem;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--bg-panel-border);
  box-shadow: var(--shadow);
}

.list-wrap h1 {
  margin: 0 0 1rem;
  font-family: var(--font-serif);
  font-size: 1.25rem;
  text-align: center;
  letter-spacing: 0.15em;
  color: var(--text-primary);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--accent);
}

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

.link-list li {
  border-bottom: 1px solid var(--bg-panel-border);
}

.link-list li:last-child {
  border-bottom: none;
}

.link-list a {
  display: block;
  padding: 0.85rem 0.25rem;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-serif);
  letter-spacing: 0.12em;
  line-height: 1.5;
  transition: padding-left 0.15s, color 0.15s;
}

.link-list a:hover {
  padding-left: 0.5rem;
  color: var(--accent-hover);
}

/* 经文页下拉 */
.nav-row {
  margin-bottom: 1rem;
  text-align: center;
}

.scripture-select {
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
  padding: 0.6rem 0.85rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text-primary);
  background: color-mix(in srgb, var(--bg-page) 50%, transparent);
  border: 1px solid var(--bg-panel-border);
  border-radius: 8px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238b6914' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  padding-right: 2rem;
}

.scripture-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 经文排版 */
.scripture-panel h3 {
  margin: 0.5rem 0 1rem;
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 3.5vw, 1.35rem);
  text-align: center;
  letter-spacing: 0.25em;
  color: var(--text-primary);
}

.scripture-panel h4 {
  margin: 1.25rem 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  text-align: center;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}

.scripture-panel p {
  margin: 0.5rem 0;
  text-indent: 2em;
  font-family: var(--font-serif);
  font-size: calc(0.95rem * var(--step));
  line-height: 1.85;
  letter-spacing: 0.06em;
  color: var(--ruby-text);
}

.scripture-panel ruby {
  ruby-align: center;
  line-height: 2.4;
}

.scripture-panel rb {
  font-size: calc(1rem * var(--step));
  color: var(--ruby-text);
}

.scripture-panel rt {
  font-size: calc(0.72rem * var(--step));
  color: var(--ruby-pinyin);
  font-family: "Arial", var(--font-sans);
  padding: 0 1px;
}

.scripture-panel center,
.scripture-panel .text-center {
  text-indent: 0;
}

.scripture-panel div[style*="text-align: center"] {
  text-indent: 0;
}

.scripture-panel center {
  display: block;
  margin-bottom: 0.75rem;
}

/* 尊重减少动画 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
