/* style.css - 全站样式 */

/* ========== Reset & Base ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #1f2937;
  background: #faf5f0;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
img,
svg {
  display: block;
}

/* ========== Layout ========== */
.container {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ========== Header ========== */
.header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #111827;
  flex: 1;
}
.header-brand svg {
  width: 1.25rem;
  height: 1.25rem;
  color: #dc2626;
}
.header-brand span {
  font-weight: bold;
  font-size: 1rem;
}
.header-sub {
  font-size: 0.75rem;
  color: #9ca3af;
}
/* 文档页面的返回链接 */
.header-back {
  width: 3.5rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #dc2626;
  font-size: 0.875rem;
}
.header-back:hover {
  color: #b91c1c;
}
.header-back svg {
  width: 1rem;
  height: 1rem;
}

.header-sep {
  color: #d1d5db;
  margin: 0 0.5rem;
}
.header-breadcrumb {
  font-size: 0.75rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========== Main ========== */
.main {
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

/* ========== Card ========== */
.card {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #f3f4f6;
  overflow: hidden;
}

/* ========== Hero / Summary ========== */
.hero-header {
  background: linear-gradient(to right, #b91c1c, #dc2626);
  padding: 1rem 1.25rem;
}
.hero-title {
  text-align: center;
  color: #fff;
  font-size: 1.125rem;
  font-weight: 700;
}
.hero-subtitle {
  text-align: center;
  color: #fee2e2;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}
.hero-body {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  line-height: 1.75;
  color: #374151;
}
.hero-body p + p {
  margin-top: 0.75rem;
}
.hero-body details {
  margin-top: 0.5rem;
}
.hero-body summary {
  color: #dc2626;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
}
.hero-body details > div {
  margin-top: 0.75rem;
}
.hero-body details > div p + p {
  margin-top: 0.75rem;
}
/* 概述展开/收起 */
.summary-extra p + p {
  margin-top: 0.75rem;
}
.summary-toggle {
  text-align: right;
  color: #dc2626;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 0.5rem;
  user-select: none;
}
.summary-toggle:hover {
  color: #991b1b;
}
.summary-collapse {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #f3f4f6;
}
.text-faded {
  font-size: 0.75rem;
  color: #9ca3af;
}

/* ========== Timeline ========== */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.timeline-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  margin: 0 -0.5rem;
  padding-left: 1rem;
  padding-right: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.timeline-card {
  scroll-snap-align: start;
  flex-shrink: 0;
  width: 10rem;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #f3f4f6;
  padding: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.timeline-date {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 500;
}
.timeline-desc {
  font-size: 0.75rem;
  color: #4b5563;
  margin-top: 0.25rem;
}

/* ========== Section spacing ========== */
.section {
  margin-bottom: 2rem;
}

/* ========== Category card ========== */
.cat-header {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #f3f4f6;
}
.cat-header svg {
  width: 1rem;
  height: 1rem;
}
.cat-header h3 {
  font-weight: 700;
  font-size: 0.875rem;
}
.cat-count {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-left: auto;
}
.cat-chevron {
  width: 1rem;
  height: 1rem;
  color: #9ca3af;
  flex-shrink: 0;
  transition: transform 0.2s;
}
/* 分类颜色 */
.cat-amber .cat-header {
  background: #fffbeb;
}
.cat-amber .cat-header svg,
.cat-amber .cat-header h3 {
  color: #b45309;
}
.cat-blue .cat-header {
  background: #eff6ff;
}
.cat-blue .cat-header svg,
.cat-blue .cat-header h3 {
  color: #1d4ed8;
}
.cat-emerald .cat-header {
  background: #ecfdf5;
}
.cat-emerald .cat-header svg,
.cat-emerald .cat-header h3 {
  color: #047857;
}

/* ========== File list ========== */
.file-list > * + * {
  border-top: 1px solid #f9fafb;
}
.file-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  transition: background 0.15s;
}
.file-item:hover {
  background: #f9fafb;
}
.file-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 0.4rem;
  opacity: 0.6;
}
.dot-amber {
  background: #f59e0b;
}
.dot-blue {
  background: #3b82f6;
}
.dot-emerald {
  background: #10b981;
}
.dot-gray {
  background: #9ca3af;
}
.file-info {
  flex: 1;
  min-width: 0;
}
.file-title {
  font-size: 0.875rem;
  color: #1f2937;
  font-weight: 500;
}
.file-item:hover .file-title {
  color: #b91c1c;
}
.file-date {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.125rem;
}
.file-arrow {
  width: 1rem;
  height: 1rem;
  color: #d1d5db;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.file-item:hover .file-arrow {
  color: #f87171;
}
/* 子文件夹标题 */
.subfolder-title {
  padding: 0.75rem 1rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #6b7280;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.subfolder-title svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* ========== Directory list spacing ========== */
.dir-list > * + * {
  margin-top: 1rem;
}

/* ========== Footer ========== */
.footer {
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem 1rem;
  text-align: center;
  font-size: 0.75rem;
  color: #9ca3af;
  border-top: 1px solid #f3f4f6;
}

/* ========== Document page ========== */
.doc-meta {
  margin-bottom: 1.5rem;
}
.doc-date {
  font-size: 0.75rem;
  color: #dc2626;
  font-weight: 500;
  margin-bottom: 0.25rem;
}
.doc-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}
.doc-category {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}
.doc-body {
  background: #fff;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border: 1px solid #f3f4f6;
  padding: 1.5rem 1.25rem;
}
/* Document navigation */
.doc-nav {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.doc-nav-link {
  flex: 1;
  background: #fff;
  border-radius: 0.5rem;
  border: 1px solid #f3f4f6;
  padding: 0.75rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: border-color 0.15s;
}
.doc-nav-link:hover {
  border-color: #fecaca;
}
.doc-nav-label {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}
.doc-nav-title {
  font-size: 0.875rem;
  color: #374151;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.doc-nav-next {
  text-align: right;
}

/* ========== Markdown content ========== */
.md-content {
  font-size: 0.875rem;
  color: #374151;
}
.md-content h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 1.5rem 0 1rem;
  color: #111827;
}
.md-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.25rem 0 0.75rem;
  color: #1f2937;
}
.md-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  color: #374151;
}
.md-content p {
  margin: 0.75rem 0;
  line-height: 1.8;
}
.md-content ul,
.md-content ol {
  margin: 0.75rem 0;
  padding-left: 1.5rem;
}
.md-content li {
  margin: 0.25rem 0;
  line-height: 1.7;
}
.md-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.85rem;
}
.md-content table th,
.md-content table td {
  border: 1px solid #d1d5db;
  padding: 0.5rem;
  text-align: left;
}
.md-content table th {
  background: #f3f4f6;
  font-weight: 600;
}
.md-content table tr:nth-child(even) {
  background: #f9fafb;
}
.md-content blockquote {
  border-left: 3px solid #dc2626;
  padding-left: 1rem;
  margin: 1rem 0;
  color: #6b7280;
  font-style: italic;
}
.md-content a {
  color: #dc2626;
  text-decoration: underline;
}
.md-content strong {
  font-weight: 600;
}
.md-content hr {
  border: none;
  border-top: 1px solid #e5e7eb;
  margin: 1.5rem 0;
}
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ========== Animation ========== */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ========== Responsive ========== */
@media (min-width: 768px) {
  .header-brand span {
    font-size: 1rem;
  }
  .hero-title {
    font-size: 1.25rem;
  }
  .doc-title {
    font-size: 1.5rem;
  }
  .doc-body {
    padding: 2rem;
  }
  .md-content {
    font-size: 1rem;
  }
  .header-sub-hide {
    display: inline;
  }
}
@media (max-width: 767px) {
  .header-sub-hide {
    display: none;
  }
}
