/* ============================================
   黄色仓库数据资料归档与知识管理平台 - 主样式表
   版本: 1.0.0
   色彩方案: 档案黄 + 深棕
   ============================================ */

/* === CSS变量定义 === */
:root {
  --primary: #F9A825;
  --secondary: #F57F17;
  --bg: #FFFDE7;
  --card-bg: #FFFFFF;
  --accent: #FBC02D;
  --text: #3E2723;
  --text-light: #5D4037;
  --text-muted: #8D6E63;
  --border: #F5E6C8;
  --shadow: rgba(62, 39, 35, 0.08);
  --shadow-hover: rgba(62, 39, 35, 0.15);
  --radius: 8px;
  --radius-lg: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-title: 'Noto Serif SC', 'SimSun', serif;
  --font-body: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-code: 'Fira Code', 'Consolas', monospace;
  --sidebar-width: 280px;
  --header-height: 64px;
  --max-width: 1200px;
}

/* === 全局重置 === */
*,
*::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-body);
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
}

/* === 排版系统 === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.5em;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1em;
  color: var(--text-light);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--secondary);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

code {
  font-family: var(--font-code);
  background: #FFF8E1;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.9em;
}

/* === 布局容器 === */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.container--wide {
  max-width: 1400px;
}

/* === 头部导航 === */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
}

.header__logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.header__logo img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.header__nav-link {
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 8px 0;
  position: relative;
}

.header__nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: var(--transition);
}

.header__nav-link:hover,
.header__nav-link--active {
  color: var(--primary);
  text-decoration: none;
}

.header__nav-link:hover::after,
.header__nav-link--active::after {
  width: 100%;
}

.header__search {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 16px;
  gap: 8px;
  width: 240px;
  transition: var(--transition);
}

.header__search:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(249, 168, 37, 0.15);
  width: 300px;
}

.header__search input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.9rem;
  width: 100%;
  color: var(--text);
}

.header__search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* 移动端菜单按钮 */
.header__menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: var(--text);
}

/* === Hero区域 === */
.hero {
  position: relative;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-top: var(--header-height);
  overflow: hidden;
  background: linear-gradient(135deg, #3E2723 0%, #4E342E 100%);
}

.hero__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.7;
}

.hero__content {
  position: relative;
  z-index: 2;
  padding: 60px 24px;
  max-width: 800px;
}

.hero__title {
  font-size: 3rem;
  color: #FFFFFF;
  margin-bottom: 16px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.hero__subtitle {
  font-size: 1.2rem;
  color: rgba(255,255,255,0.9);
  margin-bottom: 32px;
}

.hero__search {
  display: flex;
  align-items: center;
  background: var(--card-bg);
  border-radius: 30px;
  padding: 6px 6px 6px 24px;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.hero__search input {
  border: none;
  outline: none;
  font-size: 1rem;
  flex: 1;
  padding: 12px 0;
  color: var(--text);
}

.hero__search-btn {
  background: var(--primary);
  color: #FFFFFF;
  border: none;
  border-radius: 24px;
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.hero__search-btn:hover {
  background: var(--secondary);
  transform: translateY(-1px);
}

.hero__tags {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.hero__tag {
  background: rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.9);
  padding: 4px 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
  transition: var(--transition);
}

.hero__tag:hover {
  background: var(--primary);
  color: #FFFFFF;
  text-decoration: none;
}

/* === 区块通用 === */
.section {
  padding: 80px 0;
}

.section--alt {
  background: var(--card-bg);
}

.section__header {
  text-align: center;
  margin-bottom: 48px;
}

.section__title {
  font-size: 2rem;
  margin-bottom: 12px;
}

.section__desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* === 功能特性网格 === */
.features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.feature-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow-hover);
  border-color: var(--primary);
}

.feature-card__icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
}

.feature-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feature-card__title {
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-family: var(--font-title);
}

.feature-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* === 知识库卡片网格 === */
.kb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.kb-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.kb-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px var(--shadow-hover);
}

.kb-card__cover {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.kb-card__body {
  padding: 20px;
}

.kb-card__title {
  font-size: 1.1rem;
  margin-bottom: 8px;
  font-family: var(--font-title);
}

.kb-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kb-card__meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.kb-card__meta span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* === 时间线组件 === */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline__item {
  position: relative;
  padding-bottom: 24px;
}

.timeline__item::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid var(--card-bg);
  box-shadow: 0 0 0 3px var(--primary);
}

.timeline__time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.timeline__title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* === 标签云 === */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.tag-cloud__item {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 0.9rem;
  background: #FFF8E1;
  color: var(--text-light);
  border: 1px solid var(--border);
  transition: var(--transition);
}

.tag-cloud__item:hover {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
  text-decoration: none;
  transform: scale(1.05);
}

.tag-cloud__item--lg {
  font-size: 1.1rem;
  padding: 8px 20px;
  font-weight: 600;
}

.tag-cloud__item--sm {
  font-size: 0.8rem;
  padding: 4px 12px;
}

/* === 数据统计 === */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-item {
  padding: 24px;
}

.stat-item__number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-title);
}

.stat-item__label {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* === 专题卡片 === */
.collection-card {
  display: flex;
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
}

.collection-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-hover);
}

.collection-card__cover {
  width: 240px;
  min-height: 160px;
  object-fit: cover;
  flex-shrink: 0;
}

.collection-card__body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.collection-card__title {
  font-size: 1.2rem;
  margin-bottom: 8px;
  font-family: var(--font-title);
}

.collection-card__desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.collection-card__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* === 树形导航侧边栏 === */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--card-bg);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 20px 0;
  z-index: 100;
  transition: var(--transition);
}

.sidebar__title {
  padding: 0 20px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tree-nav {
  list-style: none;
}

.tree-nav__item {
  position: relative;
}

.tree-nav__link {
  display: flex;
  align-items: center;
  padding: 8px 20px;
  color: var(--text-light);
  font-size: 0.9rem;
  gap: 8px;
  transition: var(--transition);
}

.tree-nav__link:hover {
  background: #FFF8E1;
  color: var(--primary);
  text-decoration: none;
}

.tree-nav__link--active {
  background: #FFF8E1;
  color: var(--primary);
  font-weight: 600;
  border-right: 3px solid var(--primary);
}

.tree-nav__toggle {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.tree-nav__toggle--open {
  transform: rotate(90deg);
}

.tree-nav__children {
  padding-left: 20px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.tree-nav__children--open {
  max-height: 1000px;
}

/* === 文档内容区 === */
.doc-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 40px;
  max-width: 900px;
}

.doc-content h1 {
  font-size: 2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 24px;
}

.doc-content h2 {
  font-size: 1.5rem;
  margin-top: 32px;
  margin-bottom: 16px;
}

.doc-content p {
  margin-bottom: 16px;
  line-height: 1.9;
}

.doc-content blockquote {
  border-left: 4px solid var(--primary);
  padding: 12px 20px;
  background: #FFF8E1;
  margin: 16px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.doc-content pre {
  background: #3E2723;
  color: #FFF8E1;
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-code);
  font-size: 0.9rem;
  line-height: 1.6;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.doc-content th,
.doc-content td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.doc-content th {
  background: #FFF8E1;
  font-weight: 600;
}

/* === 搜索页 === */
.search-page {
  margin-top: var(--header-height);
  padding: 40px 0;
}

.search-filters {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.search-filter {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  font-size: 0.9rem;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
}

.search-filter:hover,
.search-filter--active {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--primary);
}

.search-result {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  transition: var(--transition);
}

.search-result:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px var(--shadow);
}

.search-result__title {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 8px;
}

.search-result__title mark {
  background: #FFF176;
  color: var(--text);
  padding: 0 2px;
  border-radius: 2px;
}

.search-result__snippet {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 1.6;
}

.search-result__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
}

/* === 版本历史时间线 === */
.version-timeline {
  border-left: 3px solid var(--primary);
  padding-left: 24px;
  margin: 24px 0;
}

.version-item {
  position: relative;
  padding-bottom: 24px;
}

.version-item::before {
  content: '';
  position: absolute;
  left: -31px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 3px solid var(--primary);
}

.version-item__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.version-item__tag {
  background: var(--primary);
  color: #FFFFFF;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.version-item__time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.version-item__desc {
  font-size: 0.9rem;
  color: var(--text-light);
}

/* === 按钮系统 === */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 0.95rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn--primary {
  background: var(--primary);
  color: #FFFFFF;
}

.btn--primary:hover {
  background: var(--secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 168, 37, 0.4);
  color: #FFFFFF;
  text-decoration: none;
}

.btn--outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn--outline:hover {
  background: var(--primary);
  color: #FFFFFF;
  text-decoration: none;
}

.btn--lg {
  padding: 14px 32px;
  font-size: 1.05rem;
}

/* === 面包屑导航 === */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--primary);
}

.breadcrumb__separator {
  color: var(--border);
}

/* === 页脚 === */
.footer {
  background: #3E2723;
  color: rgba(255,255,255,0.8);
  padding: 60px 0 24px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer__brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer__brand-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: #FFFFFF;
  font-weight: 700;
}

.footer__brand-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.6);
}

.footer__col-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 16px;
}

.footer__links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.footer__links a {
  color: rgba(255,255,255,0.6);
  font-size: 0.9rem;
  transition: var(--transition);
}

.footer__links a:hover {
  color: var(--primary);
  text-decoration: none;
}

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
}

/* === 404页面 === */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  padding: 40px 24px;
  margin-top: var(--header-height);
}

.error-page__code {
  font-size: 8rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-title);
  line-height: 1;
}

.error-page__title {
  font-size: 1.5rem;
  margin: 16px 0 8px;
}

.error-page__desc {
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* === 骨架屏加载 === */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* === 响应式设计 === */
@media (max-width: 1024px) {
  .features {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .kb-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar--open {
    transform: translateX(0);
  }
  
  .doc-content {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }
  
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }
  
  .header__nav {
    display: none;
  }
  
  .header__menu-btn {
    display: block;
  }
  
  .header__search {
    width: 160px;
  }
  
  .hero {
    min-height: 400px;
  }
  
  .hero__title {
    font-size: 2rem;
  }
  
  .hero__subtitle {
    font-size: 1rem;
  }
  
  .features {
    grid-template-columns: 1fr;
  }
  
  .kb-grid {
    grid-template-columns: 1fr;
  }
  
  .stats {
    grid-template-columns: 1fr 1fr;
  }
  
  .collection-card {
    flex-direction: column;
  }
  
  .collection-card__cover {
    width: 100%;
    height: 160px;
  }
  
  .section {
    padding: 48px 0;
  }
  
  .footer__grid {
    grid-template-columns: 1fr;
  }
  
  .footer__bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero__search {
    flex-direction: column;
    border-radius: var(--radius-lg);
    padding: 12px;
  }
  
  .hero__search input {
    text-align: center;
  }
  
  .hero__search-btn {
    width: 100%;
  }
  
  .container {
    padding: 0 16px;
  }
}

/* === 懒加载图片过渡 === */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* === 打印样式 === */
@media print {
  .header,
  .sidebar,
  .footer {
    display: none;
  }
  
  .doc-content {
    margin: 0;
    padding: 0;
  }
}
