/* =========================================================
   Biblical Atlas · Stylesheet
   设计语言：editorial / scholarly · 衬线为主 · 米色羊皮纸调
   ========================================================= */

/* ---- 设计变量：浅色 ---- */
:root {
  --bg: #f5f0e6;
  --bg-elev: #faf6ee;
  --bg-soft: #efe8d9;
  --bg-tint: #e8dec9;
  --ink: #2c2823;
  --ink-soft: #4a443a;
  --ink-mute: #786e5e;
  --rule: #d8cfb9;
  --rule-soft: #e6dec9;
  --accent: #8b2635;
  --accent-soft: #b35062;
  --gold: #a17821;
  --shadow: 0 1px 0 rgba(60, 50, 30, 0.05), 0 8px 24px -12px rgba(60, 50, 30, 0.18);
  --serif-display: 'Noto Serif SC', 'Cormorant Garamond', 'Source Han Serif SC', serif;
  --serif: 'Noto Serif SC', 'Crimson Pro', Georgia, serif;
  --sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --eng-display: 'Cormorant Garamond', Georgia, serif;
}

/* ---- 设计变量：深色 ---- */
[data-theme="dark"] {
  --bg: #1a1814;
  --bg-elev: #232019;
  --bg-soft: #2a261e;
  --bg-tint: #322d23;
  --ink: #ede4d0;
  --ink-soft: #c8bfa8;
  --ink-mute: #918675;
  --rule: #3a342a;
  --rule-soft: #2a261e;
  --accent: #d4717f;
  --accent-soft: #b35062;
  --gold: #d4a64a;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 8px 24px -12px rgba(0, 0, 0, 0.6);
}

/* ---- 重置 ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s ease, color 0.3s ease;
}
button { font-family: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; border-bottom: 0.5px solid currentColor; }
a:hover { color: var(--accent-soft); }
::selection { background: var(--accent); color: var(--bg-elev); }

/* ---- 页头 ---- */
.site-header {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 32px 24px;
  border-bottom: 0.5px solid var(--rule);
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.brand-title {
  font-family: var(--serif-display);
  font-size: 38px;
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.5px;
  line-height: 1.15;
}
.brand-sub {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 17px;
  color: var(--ink-mute);
  margin: 0;
  letter-spacing: 0.3px;
}
.brand-tagline {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--ink-soft);
  max-width: 620px;
}
.theme-toggle {
  background: transparent;
  border: 0.5px solid var(--rule);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  color: var(--ink-soft);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.theme-toggle:hover {
  background: var(--bg-soft);
  color: var(--ink);
  transform: rotate(180deg);
}

/* ---- 标签栏 ---- */
.tabs {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px 0;
  display: flex;
  gap: 4px;
  border-bottom: 0.5px solid var(--rule);
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: none;
  padding: 12px 18px 14px;
  color: var(--ink-mute);
  font-size: 15px;
  font-family: var(--serif);
  border-bottom: 1.5px solid transparent;
  margin-bottom: -0.5px;
  transition: color 0.2s ease, border-color 0.2s ease;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.tab:hover { color: var(--ink); }
.tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.tab-num {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.5px;
}
.tab.active .tab-num { color: var(--accent); }
.tab-label { font-weight: 500; }

/* ---- 主内容 ---- */
.content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 32px 80px;
}
.panel { display: none; animation: fade 0.4s ease; }
.panel.active { display: block; }
@keyframes fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- 概览面板 ---- */
.testaments {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 820px) {
  .testaments { grid-template-columns: 1fr; }
}
.testament {
  background: var(--bg-elev);
  border: 0.5px solid var(--rule);
  border-radius: 4px;
  padding: 28px 28px 24px;
  position: relative;
}
.testament::before {
  content: '';
  position: absolute;
  top: 0; left: 28px; right: 28px;
  height: 3px;
  background: var(--accent);
}
.testament-eyebrow {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-mute);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.testament-title {
  font-family: var(--serif-display);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}
.testament-meta {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0 0 24px;
  font-style: italic;
}
.cat {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 0.5px solid var(--rule-soft);
}
.cat:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.cat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
}
.cat-name {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}
.cat-meta {
  font-size: 12px;
  color: var(--ink-mute);
  font-style: italic;
}
.books {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.book {
  font-family: var(--serif);
  font-size: 13.5px;
  padding: 6px 11px;
  background: var(--bg);
  border: 0.5px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  transition: all 0.18s ease;
  letter-spacing: 0.2px;
}
.book:hover {
  background: var(--accent);
  color: #faf6ee;
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* ---- 时间线 ---- */
.timeline {
  max-width: 760px;
  margin: 0 auto;
  position: relative;
  padding-left: 36px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: 12px;
  width: 0.5px;
  background: var(--rule);
}
.era {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 32px 0 12px;
  padding-left: 0;
}
.era:first-child { margin-top: 0; }
.era-title {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  font-style: normal;
  text-transform: none;
  letter-spacing: normal;
  display: block;
  margin-top: 2px;
}
.event {
  position: relative;
  padding: 8px 0 18px;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.event:hover { transform: translateX(3px); }
.event::before {
  content: '';
  position: absolute;
  left: -36px;
  top: 16px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--ink-mute);
  transition: all 0.2s ease;
}
.event:hover::before {
  background: var(--accent);
  border-color: var(--accent);
}
.event-title {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.event-brief {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 4px;
  line-height: 1.6;
}
.event-ref {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--ink-mute);
}

/* ---- 故事 / 人物卡片网格 ---- */
.section {
  margin-bottom: 36px;
}
.section:last-child { margin-bottom: 0; }
.section-label {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 0.5px solid var(--rule);
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.card {
  background: var(--bg-elev);
  border: 0.5px solid var(--rule);
  border-radius: 3px;
  padding: 16px 18px;
  text-align: left;
  transition: all 0.2s ease;
  font-family: inherit;
  position: relative;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.25s ease;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card:hover::before { width: 3px; }
.card-title {
  font-family: var(--serif);
  font-size: 16.5px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}
.card-sub {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0;
  font-style: italic;
  line-height: 1.5;
}

/* ---- 主题大卡片 ---- */
.theme-card {
  background: var(--bg-elev);
  border: 0.5px solid var(--rule);
  border-radius: 3px;
  padding: 20px 24px;
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
  display: block;
  transition: all 0.2s ease;
  font-family: inherit;
  position: relative;
}
.theme-card::before {
  content: '';
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 0;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}
.theme-card:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.theme-card:hover::before { width: 3px; }
.theme-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
}
.theme-desc {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.65;
}

/* ---- 抽屉 (Drawer) ---- */
.drawer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
}
.drawer.open {
  pointer-events: auto;
}
.drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 8, 0);
  transition: background 0.3s ease;
}
.drawer.open .drawer-overlay {
  background: rgba(20, 16, 8, 0.4);
}
.drawer-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: min(560px, 92vw);
  background: var(--bg-elev);
  border-left: 0.5px solid var(--rule);
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1);
  overflow-y: auto;
  padding: 56px 40px 48px;
  box-shadow: var(--shadow);
}
.drawer.open .drawer-panel {
  transform: translateX(0);
}
.drawer-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: transparent;
  border: 0.5px solid var(--rule);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  color: var(--ink-soft);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.drawer-close:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.drawer-content .d-eyebrow {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 12.5px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 0 0 6px;
}
.drawer-content h2 {
  font-family: var(--serif-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.2;
}
.drawer-content .d-sub {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mute);
  margin: 0 0 24px;
}
.drawer-content .d-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 13px;
  color: var(--ink-mute);
  margin: 0 0 22px;
  padding: 12px 0;
  border-top: 0.5px solid var(--rule);
  border-bottom: 0.5px solid var(--rule);
}
.drawer-content .d-meta b {
  color: var(--ink);
  font-weight: 500;
  margin-right: 4px;
}
.drawer-content .d-body {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink-soft);
}
.drawer-content .d-body p {
  margin: 0 0 16px;
}
.drawer-content .d-body p:last-child { margin-bottom: 0; }
.drawer-content .d-body strong {
  color: var(--ink);
  font-weight: 600;
}
.drawer-content .d-section-title {
  font-family: var(--eng-display);
  font-style: italic;
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin: 28px 0 10px;
}

/* ---- 页脚 ---- */
.site-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 32px 48px;
  border-top: 0.5px solid var(--rule);
  text-align: center;
  font-size: 13px;
  color: var(--ink-mute);
}
.site-footer a { color: var(--ink-mute); }
.site-footer a:hover { color: var(--accent); }

/* ---- 响应式 ---- */
@media (max-width: 640px) {
  .site-header { padding: 36px 20px 18px; }
  .brand-title { font-size: 28px; }
  .brand-sub { font-size: 14px; }
  .tabs { padding: 18px 20px 0; }
  .tab { padding: 10px 12px 12px; font-size: 14px; }
  .content { padding: 24px 20px 60px; }
  .testament { padding: 22px 20px 18px; }
  .drawer-panel { padding: 48px 24px 32px; }
  .drawer-content h2 { font-size: 24px; }
}
