/* ============================================================
   仍帅 3D 历史地图 — 主样式表
   设计原则：SEO 友好 HTML 结构 + 响应式 + 轻量无框架依赖
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --color-bg:          #fafaf9;
  --color-surface:     #ffffff;
  --color-border:      #e5e0d8;
  --color-text:        #2c2416;
  --color-text-muted:  #8c806b;
  --color-text-light:  #b8ad9a;
  --color-accent:      #8b4513;
  --color-accent-hover:#a0522d;
  --color-link:        #6b3a1f;
  --color-link-hover:  #8b4513;
  --color-vip:         #c8a050;
  --color-vip-bg:      #fdf6e3;
  --color-vip-border:  #e8d48b;
  --color-tag-bg:      #f5efe5;
  --color-tag-text:    #7a5c3e;
  --color-danger:      #b83a3a;
  --font-serif:        "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "宋体", serif;
  --font-sans:         -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius:            6px;
  --radius-lg:         10px;
  --shadow-sm:         0 1px 3px rgba(0,0,0,0.06);
  --shadow-md:         0 4px 16px rgba(0,0,0,0.08);
  --max-width:         1100px;
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.75;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--color-link-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ---- Header ---- */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.site-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}
.site-logo:hover { text-decoration: none; opacity: 0.85; }

.header-nav { display: flex; gap: 4px; align-items: center; }
.header-nav a {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--color-text-muted);
  transition: all 0.2s;
  white-space: nowrap;
}
.header-nav a:hover,
.header-nav a.active {
  color: var(--color-accent);
  background: var(--color-tag-bg);
  text-decoration: none;
}

.header-nav .nav-vip {
  color: var(--color-vip);
  border: 1px solid var(--color-vip-border);
  font-weight: 600;
}
.header-nav .nav-vip:hover {
  background: var(--color-vip-bg);
  color: var(--color-vip);
}

/* ---- Dropdown ---- */
.nav-dropdown {
  position: relative;
}
.nav-dropdown > a::after {
  content: " ▾";
  font-size: 0.7rem;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 180px;
  padding: 4px 0;
  z-index: 200;
}
.nav-dropdown:hover .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu a {
  display: block;
  padding: 6px 16px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  border-radius: 0;
}
.nav-dropdown-menu a:hover {
  background: var(--color-tag-bg);
  color: var(--color-accent);
  text-decoration: none;
}
.nav-dropdown-menu a.planned {
  color: var(--color-text-light);
  font-style: italic;
  pointer-events: none;
}
.nav-dropdown-menu .dropdown-divider {
  height: 1px;
  background: var(--color-border);
  margin: 4px 0;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 12px 20px 0;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb .sep { margin: 0 6px; color: var(--color-text-light); }
.breadcrumb .current { color: var(--color-text); font-weight: 500; }

/* ---- Main Layout ---- */
.site-main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.page-title {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 4px;
  line-height: 1.4;
}

.page-subtitle {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 24px;
}

/* ---- Hero Section (首页) ---- */
.hero {
  background: linear-gradient(135deg, #f5efe5 0%, #fdf6e3 50%, #f5efe5 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  margin-bottom: 36px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.hero p {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto 24px;
}

.hero .hero-cta {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-align: center;
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover { background: var(--color-accent-hover); color: #fff; }

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline:hover { background: var(--color-accent); color: #fff; }

.btn-vip {
  background: var(--color-vip);
  color: #fff;
  border-color: var(--color-vip);
}
.btn-vip:hover { background: #b8943a; color: #fff; }

/* ---- Year Grid (首页 & 索引页) ---- */
.year-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin: 20px 0 32px;
}

.year-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  transition: all 0.2s;
  box-shadow: var(--shadow-sm);
  display: block;
}
.year-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}

.year-card .year-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-accent);
  font-family: var(--font-serif);
}

.year-card .year-reign {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.year-card .year-event {
  font-size: 0.78rem;
  color: var(--color-text-light);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Section Headings ---- */
.section-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--color-accent);
  margin: 36px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--color-border);
}

/* ---- Content Panel / Card ---- */
.content-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.content-card h2 {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--color-accent);
  margin-bottom: 12px;
}

.content-card h3 {
  font-size: 1rem;
  margin: 16px 0 8px;
  color: var(--color-text);
}

.content-card p {
  margin-bottom: 12px;
  color: var(--color-text);
}

.content-card ul, .content-card ol {
  margin: 8px 0 16px 20px;
}

.content-card li {
  margin-bottom: 6px;
}

/* ---- Timeline (事件列表) ---- */
.timeline { position: relative; padding-left: 24px; }

.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: var(--color-border);
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
  padding-left: 20px;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
}

.timeline-item .tl-month {
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 600;
}

.timeline-item .tl-desc {
  font-size: 0.93rem;
  color: var(--color-text);
}

/* Scrollable timeline when > 10 items */
.timeline-scroll {
  max-height: 520px;
  overflow-y: auto;
  padding-right: 8px;
}
.timeline-scroll::-webkit-scrollbar { width: 6px; }
.timeline-scroll::-webkit-scrollbar-track { background: var(--color-bg); border-radius: 3px; }
.timeline-scroll::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }

/* ---- Map Placeholder ---- */
.map-container {
  background: #e8e2d5;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 1.1rem;
  margin: 16px 0;
  position: relative;
  overflow: hidden;
}

.map-container.map-vip-locked::after {
  content: "VIP 可查看完整地图动画";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.75);
  color: var(--color-vip);
  padding: 10px 24px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  white-space: nowrap;
}

/* ---- Person Card Grid ---- */
.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

/* Key years strip */
.key-years-strip {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0;
}
.key-years-strip a {
  padding: 5px 14px; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: 18px;
  font-size: 0.85rem; color: var(--color-text);
  text-decoration: none; transition: all 0.15s;
}
.key-years-strip a:hover {
  border-color: var(--color-accent); color: var(--color-accent);
}
.key-years-strip a.highlight {
  background: var(--color-accent); color: #fff; border-color: var(--color-accent);
}

.person-card {
  background: var(--color-tag-bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}

.person-card:hover { border-color: var(--color-accent); }

.person-card .pc-name {
  font-weight: 600;
  color: var(--color-accent);
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.person-card .pc-role {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ---- Quote Block ---- */
.quote-block {
  background: var(--color-tag-bg);
  border-left: 3px solid var(--color-accent);
  padding: 12px 18px 12px 20px;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.quote-block .quote-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--color-text);
  line-height: 1.8;
}

.quote-block .quote-source {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  margin-top: 8px;
  text-align: right;
}

/* ---- Year Nav (上/下一年) ---- */
.year-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 32px 0 16px;
  padding: 16px 0;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.year-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-accent);
  font-weight: 500;
}
.year-nav a:hover { text-decoration: underline; }

.year-nav .year-nav-center {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* ---- Related Years ---- */
.related-years {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.related-years a {
  padding: 6px 14px;
  background: var(--color-tag-bg);
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--color-tag-text);
  transition: all 0.2s;
}
.related-years a:hover,
.related-years a.current {
  background: var(--color-accent);
  color: #fff;
  text-decoration: none;
}

/* ---- VIP Banner ---- */
.vip-banner {
  background: var(--color-vip-bg);
  border: 1px solid var(--color-vip-border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  margin: 24px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.vip-banner .vip-text {
  flex: 1;
  min-width: 200px;
}

.vip-banner .vip-text strong {
  color: var(--color-vip);
  font-size: 1.05rem;
}

.vip-banner .vip-text p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  margin: 4px 0 0;
}

/* ---- Tags ---- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  background: var(--color-tag-bg);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--color-tag-text);
  margin: 2px 4px 2px 0;
}

/* ---- Year Info Table ---- */
.info-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 0.93rem;
}

.info-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

.info-table td:first-child {
  color: var(--color-text-muted);
  white-space: nowrap;
  width: 100px;
  font-weight: 500;
}

/* ---- Accordion / Toggle (FAQ) ---- */
.faq-item {
  border-bottom: 1px solid var(--color-border);
  padding: 14px 0;
}

.faq-item .faq-q {
  font-weight: 600;
  color: var(--color-accent);
  cursor: pointer;
  font-size: 0.95rem;
}

.faq-item .faq-a {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--color-text);
  padding-left: 8px;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 32px 20px 20px;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 32px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-inner h4 {
  font-family: var(--font-serif);
  color: var(--color-accent);
  margin-bottom: 8px;
  font-size: 0.95rem;
}

.footer-inner a {
  display: block;
  padding: 2px 0;
  color: var(--color-text-muted);
}
.footer-inner a:hover { color: var(--color-accent); }

.footer-disclaimer {
  max-width: var(--max-width);
  margin: 20px auto 0;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
  font-size: 0.78rem;
  color: var(--color-text-light);
  line-height: 1.7;
}

/* ---- Dynasty Page ---- */
.dynasty-periods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.period-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.period-card h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--color-accent);
}

.period-card .period-years {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.period-card p {
  font-size: 0.85rem;
  color: var(--color-text);
  margin-bottom: 8px;
}

/* ---- Event Page ---- */
.event-phases {
  margin: 16px 0;
}

.phase-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.phase-card .phase-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.phase-card .phase-years {
  font-size: 0.85rem;
  background: var(--color-accent);
  color: #fff;
  padding: 2px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.phase-card h3 {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--color-accent);
  margin: 0;
}

/* ---- Disclaimer Box ---- */
.disclaimer-box {
  background: #fefdf9;
  border: 1px solid #e8d48b;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin: 24px 0;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.disclaimer-box .disclaimer-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .header-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .header-nav { flex-wrap: wrap; gap: 2px; }
  .header-nav a { padding: 4px 8px; font-size: 0.82rem; }

  .hero { padding: 32px 20px; }
  .hero h1 { font-size: 1.5rem; }

  .page-title { font-size: 1.35rem; }

  .content-card { padding: 18px 16px; }

  .year-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .year-card { padding: 12px 8px; }
  .year-card .year-num { font-size: 1.3rem; }

  .footer-inner { grid-template-columns: 1fr; gap: 16px; }

  .person-grid { grid-template-columns: 1fr 1fr; }
  .year-nav { flex-direction: column; gap: 10px; text-align: center; }

  /* 首页 & 专题页双栏 → 单栏 */
  .home-grid { grid-template-columns: 1fr; }
  .ming-grid { grid-template-columns: 1fr; }

  /* 朝代卡片 → 2列 */
  .dynasty-grid { grid-template-columns: repeat(2, 1fr); }
  
  /* 面包屑截断 */
  .breadcrumb { font-size: 0.78rem; overflow-x: auto; white-space: nowrap; }

  /* 地图区域 */
  .map-showcase, .map-stage { height: 320px; }

  /* 底部联系我按钮缩小 */
  #site-contact-btn { bottom: 12px; right: 12px; padding: 4px 12px; font-size: 11px; }
}

@media (max-width: 480px) {
  .person-grid { grid-template-columns: 1fr; }
  .dynasty-periods { grid-template-columns: 1fr; }
  .dynasty-grid { grid-template-columns: 1fr; }
  .map-showcase, .map-stage { height: 260px; }
  .year-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
  .year-grid-scroll { max-height: 300px; }
  .timeline { padding-left: 16px; }
  .timeline-item { margin-bottom: 10px; padding-left: 14px; }
  .key-years-strip a { padding: 3px 10px; font-size: 0.75rem; }
  .page-subtitle { font-size: 0.85rem; }
  #site-contact-btn { bottom: 8px; right: 8px; }
}

/* ---- Print ---- */
@keyframes vipFadeIn { from { opacity:0; transform:scale(0.92); } to { opacity:1; transform:scale(1); } }

