@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400&family=Playfair+Display:ital@1&display=swap');

/* ============================================================
   CSS 变量 & 重置
   ============================================================ */
:root {
  --c-white: #ffffff;
  --c-surface: #f5f5f5;
  --c-ink: #1f1f1f;
  --c-ink-mid: #555555;
  --c-ink-light: #888888;
  --c-border: #e0e0e0;
  --c-accent: #1f1f1f;
  --c-accent-hover: #444444;
  --radius-card: 16px;
  --radius-sm: 10px;
  --gap: 16px;
  --nav-h: 64px;
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'Fira Mono', monospace;
  --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  --max-w: 1200px;
  --scroll-offset: 72px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  background: var(--c-surface);
  color: var(--c-ink);
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--c-surface);
  color: var(--c-ink);
  min-height: 100vh;
}

/* scroll-margin for anchored sections */
section[id] {
  scroll-margin-top: var(--scroll-offset);
}

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

a {
  color: inherit;
  text-decoration: none;
}

ul, menu {
  list-style: none;
}

/* ============================================================
   布局外壳
   ============================================================ */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ============================================================
   顶部导航 — details > summary + menu > li > a
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  height: var(--nav-h);
}

.nav-details {
  height: 100%;
}

/* 隐藏 details 默认展开箭头 */
.nav-details > summary {
  list-style: none;
  cursor: default;
  height: 100%;
}
.nav-details > summary::-webkit-details-marker {
  display: none;
}

.nav-summary {
  display: block;
  height: 100%;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  gap: 24px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-menu--right {
  justify-content: flex-end;
}

.nav-menu li a {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-mid);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}

.nav-menu li a:hover {
  color: var(--c-ink);
  background: var(--c-surface);
}

.nav-brand {
  flex-shrink: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

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

.brand-text {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  font-family: var(--font-sans);
}

/* ============================================================
   主体
   ============================================================ */
.site-main {
  flex: 1;
  width: 100%;
}

.page-article {
  width: 100%;
}

/* ============================================================
   Hero 区块
   ============================================================ */
.hero-section {
  position: relative;
  min-height: 70vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: 80px 24px 80px;
}

/* 网格底纹 */
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--c-border) 1px, transparent 1px),
    linear-gradient(90deg, var(--c-border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  text-align: left;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-mid);
  border: 1px solid var(--c-border);
  border-radius: 6px;
  padding: 4px 12px;
  margin-bottom: 24px;
  background: var(--c-surface);
  font-family: var(--font-mono);
}

.hero-title {
  font-size: clamp(2.8rem, 7vw, 5.5rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--c-ink);
  max-width: 800px;
  margin-bottom: 24px;
}

.hero-desc {
  font-size: 18px;
  line-height: 1.7;
  color: var(--c-ink-mid);
  max-width: 560px;
  margin-bottom: 40px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 28px;
  background: var(--c-ink);
  color: var(--c-white);
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 2px solid var(--c-ink);
  transition: background var(--transition), color var(--transition);
}

.hero-cta:hover {
  background: var(--c-white);
  color: var(--c-ink);
}

/* Hero 装饰点 */
.hero-bento-preview {
  position: absolute;
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 12px;
  width: 200px;
  height: 200px;
  opacity: 0.12;
  pointer-events: none;
}

.bento-dot {
  border-radius: 16px;
  background: var(--c-ink);
}

.bento-dot--a { grid-column: 1 / 3; grid-row: 1; }
.bento-dot--b { grid-column: 1; grid-row: 2; }
.bento-dot--c { grid-column: 2; grid-row: 2; }

/* ============================================================
   内容区 + aside 布局
   ============================================================ */
.content-section {
  padding: 64px 24px;
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

.content-with-aside {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 40px;
  align-items: start;
}

/* ============================================================
   page.content 内部的 section（由 build 生成）
   Bento Box Grid 呈现
   ============================================================ */
.content-main > section {
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 40px;
  margin-bottom: 24px;
  transition: transform var(--transition);
  scroll-margin-top: var(--scroll-offset);
}

.content-main > section:hover {
  transform: scale(1.005);
}

.content-main > section > h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--c-ink);
  margin-bottom: 8px;
  line-height: 1.2;
}

.content-main > section > .subtitle,
.content-main > section > p.subtitle {
  font-size: 14px;
  color: var(--c-ink-light);
  margin-bottom: 20px;
  font-family: var(--font-mono);
}

.content-main > section > h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--c-ink);
  margin: 20px 0 8px;
}

.content-main > section p {
  font-size: 16px;
  line-height: 1.75;
  color: var(--c-ink-mid);
  margin-bottom: 12px;
}

.content-main > section ul,
.content-main > section ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.content-main > section li {
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-ink-mid);
  margin-bottom: 6px;
  list-style: disc;
}

.content-main > section ol li {
  list-style: decimal;
}

.content-main > section strong {
  color: var(--c-ink);
  font-weight: 600;
}

.content-main > section em {
  font-family: var(--font-serif);
  font-style: italic;
}

.content-main > section code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 4px;
  padding: 1px 6px;
}

/* Q&A / details 展开式内容保持可见 */
.content-main > section details {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 10px;
  background: var(--c-surface);
}

.content-main > section details summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 15px;
  color: var(--c-ink);
  list-style: none;
  padding: 4px 0;
}

.content-main > section details summary::-webkit-details-marker {
  display: none;
}

.content-main > section details > *:not(summary) {
  margin-top: 10px;
}

/* ============================================================
   Aside 快速导航
   ============================================================ */
.content-aside {
  position: sticky;
  top: calc(var(--nav-h) + 20px);
  background: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 28px 24px;
}

.content-aside h2 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--c-ink);
  margin-bottom: 6px;
  font-family: var(--font-mono);
}

.content-aside .subtitle {
  font-size: 12px;
  color: var(--c-ink-light);
  margin-bottom: 16px;
  font-family: var(--font-mono);
}

.aside-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aside-menu li a {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-ink-mid);
  border-radius: 8px;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aside-menu li a:hover {
  background: var(--c-surface);
  color: var(--c-ink);
}

/* ============================================================
   页脚 — footer 极简（仅 p + small）
   ============================================================ */
.site-footer {
  background: var(--c-ink);
  color: var(--c-white);
  text-align: center;
  padding: 48px 24px 32px;
  border-top: 1px solid #333;
}

.site-footer .footer-cta {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  color: var(--c-white);
  line-height: 1.3;
}

.site-footer .footer-copy {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-mono);
  display: block;
}

/* ============================================================
   Stagger 动效 — section 进场
   ============================================================ */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.content-main > section {
  animation: fadeSlideUp 0.45s ease both;
}

.content-main > section:nth-child(1) { animation-delay: 0.05s; }
.content-main > section:nth-child(2) { animation-delay: 0.12s; }
.content-main > section:nth-child(3) { animation-delay: 0.19s; }
.content-main > section:nth-child(4) { animation-delay: 0.26s; }
.content-main > section:nth-child(5) { animation-delay: 0.33s; }
.content-main > section:nth-child(6) { animation-delay: 0.40s; }
.content-main > section:nth-child(7) { animation-delay: 0.47s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .content-main > section {
    animation: none;
    transform: none;
  }
  .content-main > section:hover {
    transform: none;
  }
  .hero-cta { transition: none; }
  .nav-menu li a { transition: none; }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 960px) {
  .content-with-aside {
    grid-template-columns: 1fr;
  }

  .content-aside {
    position: static;
  }

  .hero-bento-preview {
    display: none;
  }
}

@media (max-width: 680px) {
  :root {
    --nav-h: 56px;
  }

  .nav-inner {
    padding: 0 16px;
    gap: 8px;
  }

  .nav-menu li a {
    font-size: 11px;
    padding: 0 6px;
    height: 44px;
  }

  .brand-text {
    font-size: 14px;
  }

  .hero-section {
    padding: 60px 16px;
    min-height: 70vh;
  }

  .hero-title {
    font-size: clamp(2rem, 10vw, 3rem);
  }

  .hero-desc {
    font-size: 16px;
  }

  .content-section {
    padding: 40px 16px;
  }

  .content-main > section {
    padding: 28px 20px;
  }

  .site-footer {
    padding: 40px 16px 28px;
  }

  .site-footer .footer-cta {
    font-size: 1.1rem;
  }
}

@media (max-width: 420px) {
  .nav-menu--left,
  .nav-menu--right {
    display: none;
  }

  .nav-inner {
    justify-content: center;
  }

  .brand-text {
    font-size: 16px;
  }
}
