/* ============================================
   西藏事业单位 · 时政备考知识库 — 学术编辑风
   暖白底色 · 藏蓝标题 · 楷体/宋体标题 · 适合长时阅读
   ============================================ */

:root {
  /* 底色 — 暖白奶油 */
  --bg: #FAF8F5;
  --bg-rgb: 250, 248, 245;
  --surface: #FFFFFF;
  --surface-hover: #F7F4F0;

  /* 侧栏 — 藏蓝 */
  --sidebar-bg: #1B2A4A;
  --sidebar-text: #B0BCCE;
  --sidebar-active: #5B8CB8;

  /* 文字 */
  --text-primary: #1E2233;
  --text-secondary: #5A6070;
  --text-muted: #8B909E;
  --text-heading: #111622;

  /* 强调色 — 藏蓝 + 暖金 + 朱红 */
  --blue: #2C5F8A;
  --blue-light: #E8F0F7;
  --gold: #B07D30;
  --gold-light: #FDF6EC;
  --red: #B8312F;
  --red-light: #FDF0EE;
  --green: #2D7D5F;
  --green-light: #EDF6F2;

  /* 边框 */
  --border: #E6E1D8;
  --border-active: rgba(176, 125, 48, 0.35);

  /* 字体 — 标题用宋体/楷体，正文用系统无衬线 */
  --font-display: 'Songti SC', 'STSongti-SC', 'Noto Serif CJK SC', 'Source Han Serif SC', 'STSong', serif;
  --font-body: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Source Han Sans SC', sans-serif;
  --font-mono: 'SF Mono', 'Menlo', 'Consolas', monospace;

  --sidebar-width: 280px;
  --radius: 8px;
  --transition: 200ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============ SKIP LINK ============ */
.skip-link {
  position: absolute; top: -100px; left: 16px;
  background: var(--blue); color: #fff; padding: 8px 16px;
  border-radius: 0 0 6px 6px; z-index: 1000;
  font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ============ SIDEBAR ============ */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  overflow-y: auto;
  padding: 28px 0;
  z-index: 100;
}

.sidebar-header { padding: 0 24px 24px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 20px; }
.sidebar-header h1 { font-size: 1.25rem; color: #fff; font-weight: 700; font-family: var(--font-display); letter-spacing: 1px; }
.sidebar-header .subtitle { font-size: .82rem; color: #8899B0; margin-top: 6px; }

.search-box { padding: 0 20px; margin-bottom: 20px; }
.search-box input {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12); background: rgba(255,255,255,.06);
  color: #fff; font-size: .88rem; outline: none; transition: border-color .2s;
}
.search-box input:focus { border-color: var(--sidebar-active); background: rgba(255,255,255,.1); }
.search-box input::placeholder { color: #6B7A90; }

#nav-list { list-style: none; }
.nav-section {
  padding: 14px 24px 6px; font-size: .72rem; font-weight: 700;
  color: #6B7A90; text-transform: uppercase; letter-spacing: .8px;
}
.nav-item {
  display: block; padding: 9px 24px; color: var(--sidebar-text);
  text-decoration: none; font-size: .88rem; transition: all .15s;
  border-left: 3px solid transparent; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.nav-item.sub { padding-left: 36px; font-size: .84rem; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.05); }
.nav-item.active {
  color: #fff; background: rgba(91,140,184,.18);
  border-left-color: var(--sidebar-active); font-weight: 600;
}

/* ============ MOBILE NAV TOGGLE ============ */
#mobile-nav-toggle {
  display: none; position: fixed; top: 12px; right: 12px; z-index: 300;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-primary); border-radius: 8px;
  width: 44px; height: 44px; cursor: pointer;
  align-items: center; justify-content: center;
}
#mobile-nav-toggle:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ============ MAIN CONTENT ============ */
#content {
  margin-left: var(--sidebar-width);
  padding: 44px 56px 44px 56px;
}

.content-section { margin-bottom: 64px; scroll-margin-top: 40px; }

.content-section h2 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  color: var(--text-heading);
  margin-bottom: 26px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--blue);
  font-weight: 700;
  letter-spacing: .5px;
}

.content-section h3 {
  font-size: 1.15rem;
  margin: 26px 0 14px;
  color: var(--text-heading);
  font-weight: 600;
}

.content-section h4 {
  font-size: 1rem;
  margin: 18px 0 10px;
  color: var(--text-secondary);
  font-weight: 600;
}

/* ============ CARDS ============ */
.info-card, .knowledge-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 22px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
  transition: box-shadow var(--transition);
}
.info-card:hover, .knowledge-block:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,.06);
}

.info-card h3 { margin-top: 0; font-size: 1.05rem; color: var(--blue); margin-bottom: 16px; }
.knowledge-block h3 { margin-top: 0; color: var(--blue); display: flex; align-items: center; gap: 10px; }
.knowledge-block h4 { margin-top: 22px; }

/* ============ SOURCE TAG ============ */
.source-tag {
  background: var(--blue-light); color: var(--blue);
  padding: 10px 18px; border-radius: 6px; font-size: .88rem;
  margin-bottom: 24px; display: inline-block; font-weight: 500;
}
.context-note { font-size: .92rem; color: var(--text-secondary); margin-bottom: 18px; }

/* ============ BADGES ============ */
.badge-importance {
  display: inline-block; background: var(--red); color: #fff;
  padding: 3px 12px; border-radius: 14px; font-size: .76rem;
  font-weight: 700; letter-spacing: .3px;
}

/* ============ HIGHLIGHTING ============ */
mark {
  display: inline !important;
  background: #FDE8E5;
  color: #B8312F;
  padding: 1px 5px;
  border-radius: 3px;
}
/* legacy .highlight-red - kept for any remaining uses */
.highlight-red {
  background: #FDE8E5;
  color: #B8312F;
  padding: 1px 5px;
  border-radius: 3px;
}

.highlight-box {
  background: var(--gold-light);
  border-left: 5px solid var(--gold);
  padding: 20px 24px; margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .98rem; line-height: 1.8;
}
.highlight-box strong, .highlight-box mark, .highlight-box .highlight-red { color: var(--red); }

.trap-alert {
  background: var(--red-light);
  border-left: 5px solid var(--red);
  padding: 16px 20px; margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .93rem; line-height: 1.7;
}

.memory-aid {
  background: var(--green-light);
  border-left: 5px solid var(--green);
  padding: 16px 20px; margin: 20px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .93rem; line-height: 1.7;
}

/* ============ TABLES ============ */
.exam-table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.exam-table thead th {
  background: #F3F0EB; font-weight: 700; color: var(--text-heading);
  text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--border);
  font-size: .85rem; text-transform: uppercase; letter-spacing: .4px;
}
.exam-table td, .exam-table th {
  padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border);
}
.exam-table tbody tr:hover td { background: #FAF8F5; }
.exam-table td:first-child { font-weight: 600; white-space: nowrap; color: var(--text-secondary); font-size: .88rem; }

/* ============ TAGS ============ */
.tag { display: inline-block; padding: 3px 12px; border-radius: 14px; font-size: .78rem; font-weight: 600; }
.tag-source { background: var(--blue-light); color: var(--blue); }

/* ============ SOURCE FLOW ============ */
.source-flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.source-item {
  padding: 16px 20px; background: #F7F4F0; border-radius: var(--radius);
  border-left: 4px solid var(--blue); display: flex; align-items: flex-start; gap: 12px;
}
.source-item strong { display: block; margin-bottom: 4px; font-size: .93rem; color: var(--text-heading); }
.source-item small { color: var(--text-secondary); font-size: .83rem; line-height: 1.5; }
.source-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--blue); color: #fff;
  border-radius: 50%; font-size: .78rem; font-weight: 700; flex-shrink: 0;
}

/* ============ FOUR THINGS CARDS ============ */
.four-things { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin: 20px 0; }
.thing-card {
  text-align: center; padding: 26px 18px 22px; background: #F7F4F0;
  border-radius: var(--radius); border-top: 4px solid var(--blue);
  transition: transform .2s, box-shadow .2s;
}
.thing-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.thing-card:nth-child(1) { border-top-color: var(--red); }
.thing-card:nth-child(2) { border-top-color: var(--blue); }
.thing-card:nth-child(3) { border-top-color: var(--green); }
.thing-card:nth-child(4) { border-top-color: var(--gold); }
.thing-icon { font-size: 2rem; margin-bottom: 10px; }
.thing-card h4 { margin: 0 0 8px; font-size: 1rem; font-weight: 700; color: var(--text-heading); }
.thing-card p { font-size: .84rem; color: var(--text-secondary); margin: 0; line-height: 1.6; }

/* ============ LISTS ============ */
.must-list, .feature-list { padding-left: 24px; }
.must-list li, .feature-list li { padding: 8px 0; font-size: .98rem; line-height: 1.7; }
.must-list li strong, .feature-list li strong { color: var(--red); }

/* ============ EXAM ANGLES ============ */
.exam-angle { list-style: none; padding: 0; }
.exam-angle li {
  padding: 10px 16px; margin: 6px 0; background: #F7F4F0;
  border-radius: var(--radius); font-size: .93rem;
  border-left: 4px solid transparent; line-height: 1.7;
}
.exam-angle li:nth-child(odd) { border-left-color: var(--blue); }
.exam-angle li strong { color: var(--red); }

/* ============ NINE TASKS ============ */
.nine-tasks { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 10px; }
.task-item {
  padding: 14px 18px; background: #F7F4F0; border-radius: var(--radius);
  font-size: .9rem; display: flex; align-items: flex-start; gap: 12px;
  line-height: 1.75; color: var(--text-primary);
  transition: background var(--transition);
}
.task-item:hover { background: #EFEBE4; }
.task-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; background: var(--blue); color: #fff;
  border-radius: 50%; font-size: .73rem; font-weight: 700; flex-shrink: 0;
  margin-top: 2px;
}

/* ============ TIMELINE ============ */
.timeline { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 4px 24px; margin: 16px 0; }
.tl-item { padding: 10px 0 10px 20px; font-size: .9rem; border-left: 3px solid var(--border); line-height: 1.7; }
.tl-item:nth-child(5n+1) { border-left-color: var(--blue); }
.tl-item:nth-child(5n+2) { border-left-color: var(--red); }
.tl-item:nth-child(5n+3) { border-left-color: var(--green); }
.tl-item:nth-child(5n+4) { border-left-color: var(--gold); }
.tl-item:nth-child(5n+5) { border-left-color: rgba(44,95,138,.5); }
.tl-date { font-size: .78rem; font-weight: 700; color: var(--blue); margin-bottom: 3px; }
.tl-content strong { color: var(--red); }

/* ============ KEYWORD CLOUD ============ */
.keyword-cloud { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0; }
.keyword-tag {
  display: inline-block; padding: 8px 18px; background: var(--blue-light);
  color: var(--blue); border-radius: 22px; font-size: .86rem; font-weight: 600;
  cursor: default; transition: transform .1s;
}
.keyword-tag:hover { transform: scale(1.04); }
.keyword-tag:nth-child(3n+1) { background: var(--red-light); color: var(--red); }
.keyword-tag:nth-child(3n+2) { background: var(--green-light); color: var(--green); }

/* ============ QUIZ ITEMS ============ */
.quiz-item {
  background: #F9F7F4; border-radius: var(--radius);
  padding: 20px 24px; margin: 14px 0;
  border: 1px solid var(--border); font-size: .94rem;
}
.quiz-item ol { margin: 10px 0 0 24px; }
.quiz-item li { padding: 4px 0; line-height: 1.7; }
/* No green highlight on options — answers revealed only in <details> */

details { margin-top: 12px; }
details summary {
  cursor: pointer; color: var(--blue); font-weight: 600;
  font-size: .9rem; padding: 4px 0;
}
details summary:hover { text-decoration: underline; }
details p, details .answer-points {
  margin-top: 10px; padding: 14px 18px; background: #fff;
  border-radius: 8px; font-size: .91rem; line-height: 1.8;
  border: 1px solid var(--border);
}
/* Correct answer highlighted in green within expanded details */
.answer-points .correct-answer {
  display: inline-block; background: var(--green-light);
  color: var(--green); font-weight: 700; padding: 2px 10px;
  border-radius: 4px; margin-right: 4px;
}
.answer-points ol { padding-left: 22px; }
.answer-points li { padding: 5px 0; }

/* ============ FOOTER ============ */
footer {
  margin-left: var(--sidebar-width);
  text-align: center; padding: 32px 56px;
  color: var(--text-muted); font-size: .84rem;
  border-top: 1px solid var(--border); line-height: 1.8;
}

/* ============ SCROLL REVEAL (minimal) ============ */
.reveal {
  opacity: 0; transform: translateY(16px);
  transition: opacity 500ms ease, transform 500ms ease;
}
.reveal.revealed { opacity: 1; transform: translateY(0); }
.content-section h2 { opacity: 0; transform: translateY(10px); transition: opacity 400ms ease, transform 400ms ease; }
.content-section h2.revealed { opacity: 1; transform: translateY(0); }

/* ============ HIDDEN (search) ============ */
.hidden-section { display: none; }

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  :root { --sidebar-width: 260px; }
  #content { padding: 36px 36px; }
  .four-things { grid-template-columns: repeat(2, 1fr); }
  .source-flow { grid-template-columns: 1fr; }
  .nine-tasks { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  #sidebar { width: 100%; height: auto; position: relative; padding: 16px; }
  #content, footer { margin-left: 0; }
  #content { padding: 24px 18px; }
  .four-things { grid-template-columns: repeat(2, 1fr); }
  #mobile-nav-toggle { display: flex; }
  .sidebar-header, .search-box, #nav-list { display: none; }
  #sidebar.open .sidebar-header,
  #sidebar.open .search-box,
  #sidebar.open #nav-list { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .content-section h2 { opacity: 1; transform: none; transition: none; }
}
