@import url('https://fonts.googleapis.com/css2?family=Exo:wght@300;400;500;600;700&family=Roboto+Mono:wght@300;400;500;700&display=swap');

/* ===== 设计令牌 ===== */
:root {
  --c-primary: #56228b;
  --c-secondary: #8b4513;
  --c-ink: #1f1726;
  --c-primary-light: #7c3fbf;
  --c-primary-muted: rgba(86,34,139,0.10);
  --c-secondary-muted: rgba(139,69,19,0.10);
  --c-bg: #faf7f2;
  --c-bg-card: #f5f0e8;
  --c-bg-alt: #ede5d8;
  --c-text: #2a1e35;
  --c-text-muted: #6b5a7a;
  --c-border: rgba(86,34,139,0.15);
  --c-border-warm: rgba(139,69,19,0.18);
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --shadow-soft: 0 4px 24px rgba(31,23,38,0.09), 0 1px 4px rgba(86,34,139,0.07);
  --shadow-card: 0 2px 16px rgba(31,23,38,0.08);
  --nav-width: 230px;
  --font-main: 'Exo', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Roboto Mono', 'SFMono-Regular', Consolas, monospace;
  --transition: 0.28s cubic-bezier(.4,0,.2,1);
}

/* ===== 重置 & 基础 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-main);
  background-color: var(--c-bg);
  color: var(--c-text);
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== 布局：左导航 + 主区 ===== */
.site-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== 左侧竖排导航 ===== */
.sidenav {
  position: fixed;
  top: 0; left: 0;
  width: var(--nav-width);
  height: 100vh;
  background: linear-gradient(168deg, #2a1240 0%, #1f1726 60%, #3a1c00 100%);
  border-right: 1px solid rgba(86,34,139,0.25);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidenav-brand {
  padding: 28px 20px 16px;
  border-bottom: 1px solid rgba(86,34,139,0.18);
}

.nav-logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.nav-logo-img { height: 36px; width: auto; }

.nav-brand-text {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: #e8d8ff;
  letter-spacing: 0.04em;
}

/* 搜索框 */
.sidenav-search {
  padding: 14px 16px 10px;
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(86,34,139,0.3);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 9px 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  color: #e8d8ff;
  min-width: 0;
}

.search-input::placeholder { color: rgba(232,216,255,0.4); }

.search-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(232,216,255,0.65);
  padding: 9px 10px;
  display: flex;
  align-items: center;
  min-height: 40px;
  transition: color var(--transition);
}

.search-btn:hover { color: #e8d8ff; }

/* 导航列表：nav > ol > li > a */
.sidenav-list {
  list-style: none;
  padding: 10px 0 20px;
  margin: 0;
  flex: 1;
}

.sidenav-list li {
  margin: 2px 10px;
}

.sidenav-list li a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(232,216,255,0.78);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background var(--transition), color var(--transition);
  position: relative;
  letter-spacing: 0.01em;
}

.sidenav-list li a::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--c-secondary);
  opacity: 0.55;
  margin-right: 10px;
  flex-shrink: 0;
  transition: opacity var(--transition), background var(--transition);
}

.sidenav-list li a:hover,
.sidenav-list li a:focus-visible {
  background: rgba(86,34,139,0.35);
  color: #fff;
}

.sidenav-list li a:hover::before,
.sidenav-list li a:focus-visible::before {
  opacity: 1;
  background: #c97aff;
}

.sidenav-deco {
  padding: 0 10px 20px;
  pointer-events: none;
}

.blob-deco {
  width: 100%;
  max-width: 160px;
  display: block;
}

/* ===== 主区 ===== */
.main-canvas {
  margin-left: var(--nav-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ===== Hero ===== */
.hero-wrap {
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(125deg, #f5ede0 0%, #ede0f5 55%, #f0e8d5 100%);
  overflow: hidden;
  padding: 0;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 80px 60px 60px;
  max-width: 900px;
}

.hero-text {
  flex: 1;
  min-width: 0;
}

.hero-h1 {
  font-family: var(--font-main);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.18;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}

.hero-desc {
  font-size: 1.08rem;
  color: var(--c-text-muted);
  max-width: 480px;
  line-height: 1.8;
}

.hero-illustration {
  flex-shrink: 0;
}

.hero-blob {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 8px 32px rgba(86,34,139,0.14));
}

/* 斜切色带 */
.hero-slash {
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 80px;
  background: var(--c-bg);
  clip-path: polygon(0 100%, 100% 100%, 100% 40%, 0 100%);
  z-index: 3;
}

.hero-slash::before {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary) 0%, var(--c-secondary) 100%);
  opacity: 0.08;
  clip-path: polygon(0 60%, 100% 0%, 100% 100%, 0 100%);
}

/* ===== 正文区 ===== */
main {
  flex: 1;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 48px 40px 60px;
}

/* 契约：main > article.wrap > section > div */
.content-section {
  /* section 直接子 */
}

.content-article {
  display: flex;
  align-items: flex-start;
  gap: 36px;
}

/* aside 在内容左侧 */
.content-aside {
  flex-shrink: 0;
  width: 190px;
  position: sticky;
  top: 24px;
  align-self: flex-start;
}

.aside-inner {
  background: var(--c-bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border);
  border-bottom: 3px solid var(--c-primary);
  padding: 20px 16px;
  box-shadow: var(--shadow-card);
}

.aside-title {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--c-primary);
  text-transform: none;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

.aside-title span {
  display: inline-block;
}

.aside-nav-list {
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.aside-nav-list li {
  margin: 3px 0;
}

.aside-nav-list li a {
  display: block;
  font-size: 0.82rem;
  color: var(--c-text-muted);
  text-decoration: none;
  padding: 5px 6px;
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
  min-height: 32px;
  display: flex;
  align-items: center;
}

.aside-nav-list li a:hover {
  background: var(--c-primary-muted);
  color: var(--c-primary);
}

.aside-deco {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.article-body {
  flex: 1;
  min-width: 0;
}

/* ===== 正文内容排版 ===== */
.article-body h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--c-ink);
  margin: 48px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-border-warm);
  position: relative;
}

.article-body h2 > span {
  display: inline;
}

.article-body h2::after {
  content: '';
  display: block;
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 56px;
  height: 2px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-secondary));
  border-radius: 2px;
}

.article-body h3 {
  font-size: 1.12rem;
  font-weight: 600;
  color: var(--c-primary);
  margin: 32px 0 12px;
}

.article-body h3 > span {
  display: inline;
}

.article-body p {
  margin: 0 0 16px;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text);
}

.article-body ul,
.article-body ol {
  margin: 0 0 16px 20px;
  padding: 0;
}

.article-body li {
  margin-bottom: 8px;
  line-height: 1.7;
}

.article-body a {
  color: var(--c-primary);
  text-decoration: underline;
  text-decoration-color: rgba(86,34,139,0.3);
  transition: color var(--transition), text-decoration-color var(--transition);
}

.article-body a:hover {
  color: var(--c-secondary);
  text-decoration-color: rgba(139,69,19,0.5);
}

.article-body section {
  margin-bottom: 56px;
  padding: 32px 36px;
  background: var(--c-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border);
  border-bottom: 3px solid var(--c-secondary);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.article-body section::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(86,34,139,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.article-body img {
  max-width: 100%;
  border-radius: var(--radius-md);
  display: block;
  margin: 16px 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.95rem;
}

.article-body th {
  background: var(--c-primary-muted);
  color: var(--c-primary);
  font-weight: 600;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 2px solid var(--c-border);
}

.article-body td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: top;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--c-secondary-muted);
  color: var(--c-secondary);
  padding: 2px 6px;
  border-radius: 5px;
}

.article-body pre {
  background: var(--c-ink);
  color: #e8d8ff;
  border-radius: var(--radius-md);
  padding: 20px;
  overflow-x: auto;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* scroll-margin-top для section с id */
section[id] {
  scroll-margin-top: 24px;
}

/* ===== 页脚：footer > section×2 ===== */
.site-footer {
  background: linear-gradient(160deg, #1f1726 0%, #2a1240 60%, #3a1c00 100%);
  color: rgba(232,216,255,0.75);
  padding: 52px 60px 0;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-start;
}

.site-footer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--c-primary), var(--c-secondary), var(--c-primary));
}

.footer-brand {
  flex: 1;
  min-width: 220px;
  padding-bottom: 40px;
}

.footer-brand-logo {
  margin-bottom: 14px;
}

.footer-brand-name {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8d8ff;
}

.footer-logo-img {
  height: 28px;
  width: auto;
}

.footer-brand-desc {
  font-size: 0.9rem;
  line-height: 1.7;
  color: rgba(232,216,255,0.6);
  max-width: 320px;
  margin-bottom: 14px;
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-contact-item {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: rgba(232,216,255,0.5);
}

.footer-links {
  flex: 0 0 200px;
  padding-bottom: 40px;
}

.footer-links-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--c-primary-light);
  letter-spacing: 0.08em;
  margin-bottom: 14px;
  text-transform: uppercase;
}

.footer-links-title span {
  display: inline-block;
}

.footer-nav-list {
  list-style: none;
  padding: 0; margin: 0;
}

.footer-nav-list li {
  margin-bottom: 4px;
}

.footer-nav-list li a {
  display: flex;
  align-items: center;
  min-height: 40px;
  font-size: 0.88rem;
  color: rgba(232,216,255,0.65);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--transition);
}

.footer-nav-list li a:hover {
  color: #e8d8ff;
}

.footer-bar {
  width: 100%;
  border-top: 1px solid rgba(86,34,139,0.2);
  padding: 16px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-copy {
  font-size: 0.82rem;
  color: rgba(232,216,255,0.4);
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: rgba(86,34,139,0.6);
  letter-spacing: 0.08em;
}

/* ===== Scroll Reveal 动效 ===== */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.55s cubic-bezier(.4,0,.2,1), transform 0.55s cubic-bezier(.4,0,.2,1);
  }
  .reveal.visible {
    opacity: 1;
    transform: none;
  }
  .stagger-list > * {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.42s cubic-bezier(.4,0,.2,1), transform 0.42s cubic-bezier(.4,0,.2,1);
  }
  .stagger-list.visible > * {
    opacity: 1;
    transform: none;
  }
  .stagger-list.visible > *:nth-child(1) { transition-delay: 0.04s; }
  .stagger-list.visible > *:nth-child(2) { transition-delay: 0.10s; }
  .stagger-list.visible > *:nth-child(3) { transition-delay: 0.16s; }
  .stagger-list.visible > *:nth-child(4) { transition-delay: 0.22s; }
  .stagger-list.visible > *:nth-child(5) { transition-delay: 0.28s; }
  .stagger-list.visible > *:nth-child(6) { transition-delay: 0.34s; }
  .stagger-list.visible > *:nth-child(7) { transition-delay: 0.40s; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .stagger-list > * {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  :root { --nav-width: 0px; }

  .sidenav {
    position: fixed;
    top: 0; left: 0;
    width: 100%;
    height: auto;
    min-height: unset;
    flex-direction: row;
    align-items: center;
    overflow: visible;
    z-index: 200;
    padding: 0;
    border-right: none;
    border-bottom: 1px solid rgba(86,34,139,0.25);
  }

  .sidenav-brand {
    padding: 10px 16px;
    border-bottom: none;
    border-right: 1px solid rgba(86,34,139,0.18);
    flex-shrink: 0;
  }

  .sidenav-search {
    display: none;
  }

  .sidenav-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 6px 8px;
    flex: 1;
    gap: 2px;
    margin: 0;
    scrollbar-width: none;
  }

  .sidenav-list::-webkit-scrollbar { display: none; }

  .sidenav-list li {
    margin: 0;
    flex-shrink: 0;
  }

  .sidenav-list li a {
    font-size: 0.8rem;
    padding: 8px 10px;
    min-height: 40px;
    white-space: nowrap;
  }

  .sidenav-list li a::before {
    display: none;
  }

  .sidenav-deco {
    display: none;
  }

  .main-canvas {
    margin-left: 0;
    padding-top: 60px;
  }

  .hero-inner {
    padding: 48px 24px 40px;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-blob {
    width: 110px;
    height: 110px;
  }

  .wrap {
    padding: 32px 20px 48px;
  }

  .content-article {
    flex-direction: column;
  }

  .content-aside {
    width: 100%;
    position: static;
  }

  .aside-nav-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .aside-nav-list li a {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 20px;
    padding: 5px 12px;
    min-height: 36px;
    font-size: 0.8rem;
  }

  .article-body section {
    padding: 20px 18px;
  }

  .site-footer {
    padding: 40px 24px 0;
    flex-direction: column;
    gap: 24px;
  }

  .footer-links {
    flex: none;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .hero-h1 {
    font-size: 1.6rem;
  }

  .hero-inner {
    padding: 36px 16px 32px;
  }

  .wrap {
    padding: 24px 14px 40px;
  }

  .article-body section {
    padding: 16px 14px;
    border-radius: var(--radius-md);
  }

  .site-footer {
    padding: 32px 16px 0;
  }

  .footer-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}
