/* 主题详情页专用样式：仿书卷/界画风格 */
:root {
  --scroll-bg: #ece5d3; /* 宋代画卷底色 */
  --scroll-border: #d4a373; 
  --text-dark: #333333;
}

body.theme-page {
  background-color: #d8cdb8; /* 外围底色 */
  background-image: none;
  display: flex;
  justify-content: center;
  padding: 40px 20px;
  min-height: 100vh;
}

/* 画卷主容器 */
.scroll-container {
  width: 100%;
  max-width: 1400px;
  background-color: var(--scroll-bg);
  border: 15px solid transparent;
  /* 模拟画卷边界，可后续用图片border-image替换 */
  border-image: repeating-linear-gradient(45deg, #d4a373, #d4a373 10px, transparent 10px, transparent 20px) 15;
  box-shadow: 0 15px 40px rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 20px 40px 40px;
}

/* 顶部导航区 */
.theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px dashed var(--color-primary);
  padding-bottom: 15px;
  margin-bottom: 30px;
}
.back-btn {
  font-size: 16px;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  gap: 5px;
}
.back-btn:hover {
  color: var(--color-accent-red);
}
.theme-nav {
  display: flex;
  gap: 15px;
  font-size: 16px;
}
.theme-nav a {
  color: var(--text-dark);
  transition: opacity 0.3s;
}
.theme-nav a:hover, .theme-nav a.active {
  color: var(--color-accent-red);
  font-weight: bold;
}
.theme-nav span {
  color: #ccc;
}
.menu-btn {
  font-size: 24px;
  cursor: pointer;
}

/* 标题区 */
.theme-title-area {
  text-align: center;
  margin-bottom: 30px;
}
.theme-main-title {
  font-size: 48px;
  color: var(--text-dark);
  margin-bottom: 10px;
  letter-spacing: 5px;
}
.theme-sub-title {
  font-size: 18px;
  color: var(--text-dark);
  opacity: 0.8;
}

/* 核心内容区：主图 + 侧侧边栏 */
.theme-content {
  display: flex;
  gap: 30px;
  margin-bottom: 30px;
}
.theme-image-wrapper {
  flex: 3;
  position: relative;
  border: 4px solid var(--color-primary);
  padding: 10px;
  background: #fdfbf7;
}
.theme-main-img {
  width: 100%;
  height: 600px;
  object-fit: cover;
  display: block;
}

/* 图上交互点 */
.hotspot {
  position: absolute;
  width: 30px;
  height: 30px;
  background: rgba(255,255,255,0.7);
  border: 2px solid var(--color-accent-blue);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}
.hotspot:hover {
  background: var(--color-accent-blue);
}
.hotspot::after {
  content: attr(data-label);
  position: absolute;
  top: -30px;
  background: var(--color-bg);
  padding: 4px 8px;
  border: 1px solid var(--color-text);
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s;
}
.hotspot:hover::after {
  opacity: 1;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(168, 218, 220, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(168, 218, 220, 0); }
  100% { box-shadow: 0 0 0 0 rgba(168, 218, 220, 0); }
}

/* 侧边考据解读 */
.theme-sidebar {
  flex: 1;
  background: #f9f5eb;
  border: 2px solid var(--color-primary);
  border-radius: 4px;
  padding: 20px;
  position: relative;
}
.sidebar-title {
  font-size: 24px;
  color: var(--text-dark);
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 1px solid var(--color-primary);
  padding-bottom: 10px;
}
.sidebar-close {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 20px;
  cursor: pointer;
}
.sidebar-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-dark);
}
.sidebar-content h4 {
  color: var(--color-accent-yellow);
  margin-bottom: 10px;
}

/* 底部数据区 */
.theme-data-area {
  display: flex;
  justify-content: space-between;
  border: 2px solid var(--color-primary);
  padding: 20px;
  background: #fcfaf5;
}
.data-box {
  flex: 1;
  text-align: center;
  border-right: 1px dashed var(--color-primary);
  padding: 0 15px;
}
.data-box:last-child {
  border-right: none;
}
.data-box-title {
  font-size: 16px;
  color: var(--text-dark);
  margin-bottom: 15px;
}

/* 模拟图表 */
.dummy-pie {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: conic-gradient(var(--color-accent-blue) 0 25%, #d4a373 25% 50%, #e68a8a 50% 75%, #ccc 75% 100%);
  margin: 0 auto;
}
.dummy-bar {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  font-size: 12px;
}
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.bar-fill {
  height: 10px;
  background: var(--color-accent-yellow);
}

.theme-footer {
  text-align: center;
  margin-top: 30px;
  font-size: 14px;
  color: var(--text-dark);
  border-top: 1px dotted var(--color-primary);
  padding-top: 20px;
}

/* 1ʱС */
.time-weather-bar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid var(--color-primary);
    border-radius: 20px;
    padding: 8px 20px;
    margin: 15px auto 30px;
    font-size: 14px;
    color: var(--color-text);
    box-shadow: 0 2px 10px rgba(0,0,0,0.02);
    backdrop-filter: blur(4px);
    width: max-content;
}
.time-mark {
    font-weight: bold;
    color: var(--color-accent-red);
    letter-spacing: 2px;
}
.weather-quote {
    letter-spacing: 1px;
    border-left: 1px solid var(--color-primary);
    padding-left: 15px;
    color: #555;
}

.fade-in-text {
    opacity: 0;
    animation: fadeInText 1.5s ease-in forwards;
}
@keyframes fadeInText {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* 2ʽ */
.layered-analysis {
    margin: 60px 0;
    padding: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02), 0 5px 15px rgba(0,0,0,0.05);
}
.layered-analysis .section-title {
    text-align: center;
    font-size: 24px;
    color: var(--color-text);
    margin-bottom: 30px;
    position: relative;
}
.layered-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.layered-top {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    background: #e8c9a833;
    border: 1px solid var(--color-primary);
}
.layered-top img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.4s ease;
}
.layered-bottom {
    display: flex;
    justify-content: space-between;
    gap: 15px;
}
.thumb-card {
    flex: 1;
    cursor: pointer;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    transition: all 0.3s ease;
}
.thumb-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}
.thumb-card.active {
    border-color: var(--color-accent-red);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}
.thumb-img-wrapper {
    width: 100%;
    height: 80px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
    background: #f5f0e6;
}
.thumb-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.thumb-card p {
    font-size: 14px;
    color: var(--color-text);
    margin: 0;
}
@media (max-width: 768px) {
    .time-weather-bar { font-size: 12px; padding: 6px 15px; }
    .layered-top { height: 250px; }
    .layered-bottom { flex-direction: column; }
    .thumb-card { display: flex; align-items: center; text-align: left; padding: 8px; }
    .thumb-img-wrapper { width: 80px; height: 60px; margin-bottom: 0; margin-right: 15px; }
}


/* 板块1升级：漏刻风格时间条 */
.louke-timer {
    display: inline-flex;
    align-items: center;
    background: #fff;
    border: 2px solid var(--color-primary);
    border-radius: 30px;
    padding: 8px 25px;
    margin: 20px auto 40px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    position: relative;
    overflow: hidden;
}
.louke-icon {
    width: 20px;
    height: 30px;
    border: 2px solid var(--color-accent-blue);
    border-radius: 4px;
    border-top: none;
    position: relative;
    margin-right: 15px;
    display: flex;
    align-items: flex-end;
}
.louke-water {
    width: 100%;
    background: var(--color-accent-blue);
    animation: flowWater 3s infinite alternate;
}
@keyframes flowWater { 0% { height: 10% } 100% { height: 90% } }
.louke-time {
    font-weight: bold;
    color: var(--color-text);
    font-size: 16px;
    padding-right: 15px;
    position: relative;
}
.louke-time::after {
    content: ''; position: absolute; right: 0; top: 10%; height: 80%; width: 1px; background: var(--color-primary);
}
.louke-desc {
    padding-left: 15px;
    color: #666;
    font-size: 14px;
}

/* 板块4：信息数据卡片网格 */
.info-data-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 40px 0;
}
.info-card {
    background: #fdfbf7;
    border: 1px dashed var(--color-primary);
    border-radius: 6px;
    padding: 15px;
    text-align: center;
    transition: transform 0.3s;
}
.info-card:hover { transform: translateY(-3px); box-shadow: 0 4px 12px rgba(0,0,0,0.06); }
.info-label { font-size: 12px; color: var(--color-accent-red); margin-bottom: 5px; }
.info-value { font-size: 16px; font-weight: bold; color: var(--color-text); }

/* 板块5：人物图鉴卧轴滑动 */
.character-scroll-area {
    margin: 40px 0;
}
.char-scroll-wrap {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding-bottom: 15px;
    scrollbar-width: thin;
    scrollbar-color: var(--color-primary) transparent;
}
.char-card {
    min-width: 140px;
    height: 180px;
    background: #ebe3d5;
    border-radius: 8px;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 15px;
    border: 1px solid #d4a37355;
    transition: 0.3s;
}
.char-card h4 { font-size: 16px; border-bottom: 1px solid var(--color-accent-red); display: inline-block; padding-bottom: 5px; margin-bottom: 0;}
.char-hover-info {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(232, 201, 168, 0.95);
    border-radius: 8px;
    padding: 15px;
    opacity: 0;
    transition: opacity 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
    color: #333;
}
.char-card:hover .char-hover-info { opacity: 1; }

/* 板块6：图鉴网格 */
.items-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 30px 0;
}
.item-cell {
    background: #fff;
    padding: 15px;
    border-radius: 6px;
    text-align: center;
    border-left: 3px solid var(--color-accent-blue);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}
.item-name { font-size: 16px; font-weight: bold; margin-bottom: 5px; }
.item-desc { font-size: 12px; color: #777; }

/* 板块7：古文对照 */
.bilingual-box {
    display: flex;
    gap: 40px;
    background: #f6f3ed;
    padding: 30px;
    border-radius: 8px;
    margin: 40px 0;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.02);
}
.bilingual-left {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    border-left: 2px solid var(--color-primary);
    padding-left: 20px;
    font-family: var(--font-title);
    font-size: 20px;
    line-height: 2;
    letter-spacing: 2px;
    color: #2F2A24;
    max-height: 300px;
}
.bilingual-right {
    flex: 1;
    font-size: 15px;
    line-height: 1.8;
    color: #555;
    display: flex;
    align-items: center;
    padding-left: 20px;
}

@media (max-width: 768px) {
    .info-data-grid, .items-grid { grid-template-columns: repeat(2, 1fr); }
    .bilingual-box { flex-direction: column; gap: 20px; }
    .bilingual-left { writing-mode: horizontal-tb; border-left: none; border-bottom: 2px solid var(--color-primary); padding-left: 0; padding-bottom: 20px; }
}
/* 新增：模块8、9、10，严格遵守宋代古籍UI规范 */
/* Module 8: 汴京全图地图 */
.map-module {
    margin: 60px auto;
    width: 90vw;
    max-width: 1200px;
    background: #fdfaf5; /* 淡米白宣纸底纹 */
    border: 1px solid #d4c4b7;
    position: relative;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.05);
}
.map-container {
    position: relative;
    width: 100%;
    height: 600px;
    background: #fffdf5; /* Placeholder */
    border: 2px solid #5a4b41;
    overflow: hidden;
}
/* Encode lines for map */
.map-svg-lines {
    position: absolute; top:0; left:0; width:100%; height:100%; pointer-events:none;
}
.map-svg-lines path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawMap 4s ease forwards;
}
@keyframes drawMap { to { stroke-dashoffset: 0; } }

.map-landmark {
    position: absolute;
    width: 40px; height: 40px;
    border: 2px solid #b86a54; /* 淡赭石 */
    border-radius: 5px;
    background: #fffdf5;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex; justify-content: center; align-items: center;
    box-shadow: 0 4px 6px rgba(184,106,84,0.2);
}
.map-landmark:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(184,106,84,0.4);
}
.map-landmark::after {
    content: attr(data-name);
    position: absolute;
    bottom: -25px;
    font-family: "STKaiti", "KaiTi", serif;
    color: #333;
    white-space: nowrap;
    font-size: 14px;
    background: rgba(255,255,255,0.8);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Map Popup */
.map-popup-overlay {
    position: fixed; top:0; left:0; width:100vw; height:100vh;
    background: rgba(0,0,0,0.6);
    display: none; justify-content: center; align-items: center;
    z-index: 1000;
}
.map-popup-overlay.active { display: flex; }
.map-popup {
    background: #fdfaf5;
    border: 3px solid #b86a54;
    width: 80vw; max-width: 800px;
    padding: 40px;
    position: relative;
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.5s ease;
    display: flex; gap: 30px;
}
.map-popup-overlay.active .map-popup {
    transform: translateY(0); opacity: 1;
}
.map-popup-close {
    position: absolute; top: 15px; right: 20px;
    font-size: 24px; color: #b86a54; cursor: pointer;
}
.map-popup-left {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-right: 1px dashed #d4c4b7; padding-right: 20px;
}
.map-popup-left img { max-width: 100%; border: 1px solid #d4c4b7; padding: 5px; background: #fff; }
.map-popup-right {
    flex: 2; display: flex; flex-direction: column;
}
.map-popup-title { font-family: "STKaiti", "KaiTi", serif; font-size: 28px; color: #b86a54; margin-bottom: 10px; border-bottom: 1px solid #b86a54; padding-bottom: 5px;}
.map-popup-time { display: inline-block; background: #567b79; color:#fff; padding: 3px 10px; font-size: 14px; border-radius: 3px; margin-bottom: 20px; width: fit-content; }
.map-popup-content { display: flex; gap: 20px; }
.map-popup-guwen { 
    writing-mode: vertical-rl; text-orientation: upright;
    font-family: "STKaiti", "KaiTi", serif;
    font-size: 16px; border-left: 2px dashed #b86a54; padding-left: 15px; margin-left: 10px;
    height: 200px; color: #333;
}
.map-popup-baihua { font-size: 15px; line-height: 1.8; color: #555; flex: 1;}
.map-btn { display: inline-block; margin-top: 20px; padding: 8px 20px; background: #b86a54; color:#fff; text-decoration: none; border-radius: 4px; text-align: center; width: fit-content; font-family: "STKaiti", "KaiTi", serif;}
.map-btn:hover { background: #9a5542; }

/* Module 9: Word Cloud */
.wordcloud-module { margin: 60px auto; width: 90vw; max-width: 1200px; display: flex; gap: 30px; }
.wordcloud-sidebar { width: 150px; display: flex; flex-direction: column; gap: 15px; }
.wc-filter { padding: 10px 15px; border: 1px solid #5a4b41; cursor:pointer; text-align:center; transition: all 0.3s; font-family: "STKaiti", "KaiTi", serif;}
.wc-filter.active { background: #5a4b41; color:#fff; }
.wordcloud-canvas { flex: 1; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 25px; min-height: 400px; position:relative; }
.wc-signboard {
    padding: 10px 20px; border: 2px solid; border-radius: 2px; font-family: "STKaiti", "KaiTi", serif;
    cursor: pointer; position: relative; transition: all 0.4s ease;
    display: flex; align-items: center; justify-content: center;
    background: #fffdf5; /* Texturization fallback */
    box-shadow: inset 0 0 10px rgba(0,0,0,0.05), 0 2px 5px rgba(0,0,0,0.1);
}
.wc-signboard.fade-out { opacity: 0.2; pointer-events: none; }
.wc-signboard.type-food { border-color: #6a8c88; color: #2e4d4a; border-style: double; }
.wc-signboard.type-play { border-color: #b86a54; color: #6b3323; border-style: solid; box-shadow: inset 0 0 0 1px #b86a54;}
.wc-signboard.type-show { border-color: #d1b46a; color: #7a6327; border-style: dashed; }
.wc-signboard:hover { transform: translateY(-5px); z-index: 10; }
.wc-signboard.type-food:hover { box-shadow: 0 10px 20px rgba(106,140,136,0.3), inset 0 0 15px rgba(106,140,136,0.2); }
.wc-signboard.type-play:hover { box-shadow: 0 10px 20px rgba(184,106,84,0.3), inset 0 0 15px rgba(184,106,84,0.2); }
.wc-signboard.type-show:hover { box-shadow: 0 10px 20px rgba(209,180,106,0.3), inset 0 0 15px rgba(209,180,106,0.2); }
.wc-tooltip {
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    background: rgba(40,30,20,0.9); color:#fdfaf5; padding: 8px 12px; font-size:12px;
    border-radius:4px; white-space:nowrap; pointer-events:none; opacity:0; transition:0.3s;
    border: 1px solid #d1b46a;
}
.wc-tooltip::after {
    content:''; position:absolute; top:100%; left:50%; margin-left:-5px; border-width:5px; border-style:solid; border-color: rgba(40,30,20,0.9) transparent transparent transparent;
}
.wc-signboard:hover .wc-tooltip { opacity: 1; bottom: 125%; }

/* Module 10: Horizontal Scroll */
.scroll-recommends { margin: 60px auto 30px; width: 90vw; max-width: 1200px; padding: 40px; background: #faf5eb; border-top: 2px solid #5a4b41; border-bottom: 2px solid #5a4b41;}
.scroll-track { display: flex; gap: 30px; overflow-x: auto; padding: 20px 10px; scroll-snap-type: x mandatory; }
.scroll-track::-webkit-scrollbar { height: 8px; }
.scroll-track::-webkit-scrollbar-thumb { background: #b86a54; border-radius: 4px; }
.scroll-track::-webkit-scrollbar-track { background: rgba(0,0,0,0.05); }
.mini-scroll-book {
    flex: 0 0 180px; height: 260px; scroll-snap-align: start;
    border: 1px solid #d4c4b7; background: #fffcf5;
    position: relative; cursor: pointer; transition: all 0.3s ease;
    display:flex; justify-content:center; align-items:center;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.05);
    background-image: linear-gradient(to right, #f2e9dc 0%, #fffcf5 10%, #fffcf5 90%, #f2e9dc 100%);
}
.mini-scroll-book::before {
    content: ''; position: absolute; left: 10px; top: 10px; bottom: 10px; width: 2px; background: #d4c4b7;
}
.mini-scroll-book.highlight { border: 2px solid #b86a54; box-shadow: 0 0 15px rgba(184,106,84,0.2); }
.mini-scroll-book:hover { transform: translateY(-5px) scale(1.02); box-shadow: -5px 10px 20px rgba(0,0,0,0.1); }
.book-cover-title { writing-mode: vertical-rl; font-family: "STKaiti", "KaiTi", serif; font-size: 22px; letter-spacing: 5px; color: #333; }
.book-hover-peel {
    position: absolute; right: 0; top: 0; width: 0; height: 0;
    border-style: solid; border-width: 0 30px 30px 0;
    border-color: transparent #e8dcc8 transparent transparent;
    transition: all 0.3s ease; opacity: 0;
    box-shadow: -2px 2px 5px rgba(0,0,0,0.1);
}
.mini-scroll-book:hover .book-hover-peel { opacity: 1; border-width: 0 40px 40px 0; }

/* Book Details Panel */
.b-detail-wrapper { margin-top: 10px; }
.b-detail-item { display: none; background: #fffdf5; padding: 30px; border: 1px dashed #b86a54; position: relative;}
.b-detail-item.active { display: block; animation: fadeIn 0.4s ease; }
.b-detail-title { font-family: "STKaiti", "KaiTi", serif; font-size: 24px; color: #5a4b41; border-bottom: 2px solid #5a4b41; display:inline-block; margin-bottom: 15px;}
.b-detail-flex { display: flex; gap: 30px; align-items: flex-start; }
.b-detail-text { flex: 2; font-size: 15px; color: #444; line-height: 1.8; }
.b-detail-quote { flex: 1; writing-mode: vertical-rl; padding-left: 20px; border-left: 2px solid #b86a54; font-family: "STKaiti", "KaiTi", serif; height: 180px; }
.b-tag-link { display: inline-block; margin-top: 15px; font-size: 13px; color: #b86a54; padding: 4px 10px; background: rgba(184,106,84,0.1); border-radius: 3px; }

@media (max-width: 768px) {
    .wordcloud-module { flex-direction: column; }
    .wordcloud-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; justify-content: center;}
    .map-popup { flex-direction: column; height: 80vh; overflow-y: auto;}
    .map-popup-left { border-right: none; border-bottom: 1px dashed #d4c4b7; padding-bottom: 20px; }
    .map-popup-guwen { writing-mode: horizontal-tb; height: auto; border-left: none; border-bottom: 2px dashed #b86a54; padding-left: 0; padding-bottom:10px; margin-left:0; margin-bottom:10px;}
    .scroll-track { gap: 15px; }
    .b-detail-flex { flex-direction: column; }
    .b-detail-quote { writing-mode: horizontal-tb; height: auto; border-left: none; border-top: 2px dashed #b86a54; padding-left: 0; padding-top: 15px;}
}
