:root {
  --bg: #f5efe2;
  --bg-strong: #efe4d0;
  --panel: rgba(255, 250, 239, 0.84);
  --panel-strong: rgba(255, 248, 233, 0.94);
  --line: rgba(44, 65, 74, 0.12);
  --text: #1f2d35;
  --muted: #6a756f;
  --brand: #d76b2c;
  --brand-deep: #8c3f1b;
  --accent: #1f6a70;
  --accent-soft: #d7ebe7;
  --shadow: 0 24px 60px rgba(31, 45, 53, 0.12);
  --radius: 22px;
  --sidebar-width: 320px;
  --toc-width: 260px;
  --body-font: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display-font: "Noto Serif SC", "Source Han Serif SC", "STSong", serif;
  --code-font: "Iosevka", "SFMono-Regular", "Menlo", "Monaco", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--body-font);
  background:
    radial-gradient(circle at top left, rgba(215, 107, 44, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(31, 106, 112, 0.12), transparent 24%),
    linear-gradient(180deg, #f9f4e9 0%, var(--bg) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(31, 45, 53, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 45, 53, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.4), transparent 90%);
}

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

a:hover {
  color: var(--brand-deep);
}

code,
pre {
  font-family: var(--code-font);
}

.site-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(250, 245, 235, 0.94), rgba(245, 239, 226, 0.9));
  backdrop-filter: blur(16px);
  overflow: hidden;
  z-index: 20;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  color: var(--text);
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--brand), #e9b164);
  color: white;
  font-family: var(--display-font);
  font-size: 1.3rem;
  box-shadow: 0 16px 32px rgba(215, 107, 44, 0.22);
}

.brand strong {
  display: block;
  font-family: var(--display-font);
  font-size: 1.15rem;
}

.brand small {
  color: var(--muted);
}

.search-box {
  position: relative;
  margin-bottom: 20px;
}

.search-box label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.84rem;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 1px solid rgba(31, 106, 112, 0.18);
  background: rgba(255, 250, 242, 0.9);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}

.search-box input:focus {
  border-color: rgba(215, 107, 44, 0.45);
  box-shadow: 0 0 0 4px rgba(215, 107, 44, 0.12);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 249, 238, 0.98);
  box-shadow: var(--shadow);
}

.search-results.visible {
  display: block;
}

.search-result {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(31, 45, 53, 0.08);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.search-result small {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.search-result span {
  color: #56625c;
  font-size: 0.88rem;
  line-height: 1.45;
}

.sidebar-scroll {
  height: calc(100vh - 180px);
  overflow: auto;
  padding-right: 6px;
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-section h3 {
  margin: 0 0 10px;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-deep);
}

.sidebar-section ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.sidebar-link {
  display: block;
  padding: 9px 12px;
  border-radius: 12px;
  color: #334047;
  line-height: 1.4;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: rgba(31, 106, 112, 0.1);
  color: var(--accent);
  transform: translateX(3px);
}

.page-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--toc-width);
}

.topbar {
  position: sticky;
  top: 0;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  backdrop-filter: blur(18px);
  background: rgba(245, 239, 226, 0.74);
  border-bottom: 1px solid var(--line);
  z-index: 15;
}

.sidebar-toggle {
  display: none;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--text);
  color: white;
  font-weight: 600;
}

.topbar-copy strong {
  display: block;
  font-family: var(--display-font);
  font-size: 1rem;
}

.topbar-copy span {
  color: var(--muted);
  font-size: 0.9rem;
}

.content {
  padding: 30px 32px 64px;
}

.toc-panel {
  padding: 30px 28px 64px 0;
}

.toc-card {
  position: sticky;
  top: 92px;
  padding: 22px 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.toc-card h2 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-family: var(--display-font);
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.toc-list li {
  line-height: 1.4;
}

.toc-level-3 {
  padding-left: 14px;
  font-size: 0.93rem;
}

.toc-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}

.doc-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-header {
  padding: 34px 36px 22px;
  background:
    linear-gradient(135deg, rgba(215, 107, 44, 0.14), transparent 42%),
    linear-gradient(180deg, rgba(31, 106, 112, 0.08), transparent 45%);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--brand-deep);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.doc-header h1 {
  margin: 0;
  font-family: var(--display-font);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.08;
}

.doc-summary {
  margin: 16px 0 0;
  font-size: 1.04rem;
  line-height: 1.7;
  max-width: 72ch;
  color: #37454d;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.doc-meta span,
.doc-meta a {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 250, 239, 0.86);
  color: var(--muted);
  border: 1px solid rgba(31, 45, 53, 0.08);
  font-size: 0.86rem;
}

.doc-body {
  padding: 10px 36px 42px;
}

.doc-body h2,
.doc-body h3,
.doc-body h4 {
  font-family: var(--display-font);
  scroll-margin-top: 92px;
}

.doc-body h2 {
  margin-top: 2.4rem;
  font-size: 1.75rem;
}

.doc-body h3 {
  margin-top: 2rem;
  font-size: 1.35rem;
}

.doc-body p,
.doc-body li,
.doc-body blockquote {
  line-height: 1.85;
  font-size: 1rem;
}

.doc-body ul,
.doc-body ol {
  padding-left: 1.4rem;
}

.doc-body img {
  max-width: 100%;
  border-radius: 18px;
}

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.4rem 0;
  overflow: hidden;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.92);
}

.doc-body th,
.doc-body td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(31, 45, 53, 0.08);
  text-align: left;
}

.doc-body blockquote {
  margin: 1.6rem 0;
  padding: 16px 18px;
  border-left: 4px solid var(--brand);
  background: rgba(215, 107, 44, 0.08);
  border-radius: 0 16px 16px 0;
}

.doc-body hr {
  border: 0;
  border-top: 1px solid rgba(31, 45, 53, 0.1);
  margin: 2rem 0;
}

.doc-body :not(pre) > code {
  padding: 0.16rem 0.42rem;
  border-radius: 0.45rem;
  background: rgba(31, 106, 112, 0.1);
  color: var(--accent);
}

.code-block {
  margin: 1.4rem 0;
  padding: 18px 20px;
  overflow: auto;
  border-radius: 20px;
  background: #172127;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.hljs {
  background: transparent !important;
  color: #e9efe8;
  line-height: 1.65;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.8fr);
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at top right, rgba(31, 106, 112, 0.16), transparent 32%),
    radial-gradient(circle at bottom left, rgba(215, 107, 44, 0.16), transparent 30%),
    var(--panel-strong);
  box-shadow: var(--shadow);
  margin-bottom: 28px;
}

.hero-copy h1 {
  margin: 0 0 14px;
  font-family: var(--display-font);
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 0.98;
}

.hero-copy p:last-of-type {
  max-width: 62ch;
  line-height: 1.9;
  font-size: 1.04rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}

.hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.hero-action:hover {
  transform: translateY(-2px);
}

.hero-action.primary {
  background: linear-gradient(135deg, var(--brand), #eb9c49);
  color: white;
  box-shadow: 0 18px 30px rgba(215, 107, 44, 0.26);
}

.hero-action.secondary {
  border: 1px solid rgba(31, 106, 112, 0.2);
  background: rgba(255, 251, 244, 0.88);
  color: var(--accent);
}

.hero-metrics {
  display: grid;
  gap: 14px;
}

.hero-metrics div {
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.82);
  border: 1px solid rgba(31, 45, 53, 0.08);
}

.hero-metrics strong {
  display: block;
  font-size: 2.2rem;
  font-family: var(--display-font);
}

.hero-metrics span {
  color: var(--muted);
}

.spotlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.spotlight-card,
.section-card,
.directory-item {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 251, 244, 0.86);
  box-shadow: var(--shadow);
  transition: transform 180ms ease, border-color 180ms ease;
}

.spotlight-card {
  display: block;
  padding: 20px;
}

.spotlight-card:hover,
.section-card:hover,
.directory-item:hover {
  transform: translateY(-4px);
  border-color: rgba(215, 107, 44, 0.24);
}

.spotlight-path {
  display: block;
  margin-bottom: 12px;
  font-size: 0.8rem;
  color: var(--brand-deep);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.spotlight-card strong {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-family: var(--display-font);
  font-size: 1.12rem;
  line-height: 1.3;
}

.spotlight-card p {
  margin: 0;
  color: #49555d;
  line-height: 1.7;
}

.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.section-card {
  padding: 20px;
}

.section-card h3 {
  margin: 0 0 10px;
  font-family: var(--display-font);
  font-size: 1.22rem;
}

.section-card p {
  margin: 0 0 14px;
  color: #4f5b63;
  line-height: 1.7;
}

.section-card ul {
  margin: 0;
  padding-left: 1rem;
  line-height: 1.9;
}

.directory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}

.directory-item {
  display: block;
  padding: 18px;
}

.directory-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(31, 106, 112, 0.1);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.directory-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
}

.directory-item small {
  color: var(--muted);
}

.directory-intro {
  margin-bottom: 24px;
}

.empty-state {
  padding: 30px 0 12px;
}

.empty-state h2 {
  font-family: var(--display-font);
  font-size: 1.8rem;
}

.empty-state p {
  line-height: 1.8;
}

.file-viewer {
  margin-top: 8px;
}

@media (max-width: 1280px) {
  .page-frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc-panel {
    display: none;
  }
}

@media (max-width: 960px) {
  .site-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    width: min(88vw, 340px);
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .content {
    padding: 24px 18px 48px;
  }

  .topbar {
    padding: 16px 18px;
  }

  .doc-header,
  .doc-body {
    padding-left: 20px;
    padding-right: 20px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
    padding: 22px;
  }
}
