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

/* =====================
   CSS 变量 & 基础重置
   ===================== */
:root {
  --black: #000000;
  --white: #ffffff;
  --accent: #000000;
  --gray-100: #f4f4f4;
  --gray-200: #e0e0e0;
  --gray-400: #999999;
  --gray-600: #555555;
  --border: 1px solid #000000;
  --base: 8px;
  --font-body: 'Fira Sans', Helvetica, Arial, sans-serif;
  --font-mono: 'Fira Code', 'Courier New', monospace;
  --max-w: 1280px;
  --nav-h: 56px;
  --anchor-h: 40px;
  --scroll-offset: calc(var(--nav-h) + var(--anchor-h) + 8px);
}

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

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--black);
  background: var(--white);
  overflow-x: hidden;
}

section[id] {
  scroll-margin-top: var(--scroll-offset);
}

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

a:hover {
  text-decoration: underline;
}

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

ul, ol {
  list-style: none;
}

/* =====================
   网格系统
   ===================== */
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: calc(var(--base) * 2);
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: calc(var(--base) * 3);
  padding-right: calc(var(--base) * 3);
  width: 100%;
}

.col-span-3 { grid-column: span 3; }
.col-span-4 { grid-column: span 4; }
.col-span-5 { grid-column: span 5; }
.col-span-7 { grid-column: span 7; }
.col-span-8 { grid-column: span 8; }
.col-span-9 { grid-column: span 9; }
.col-span-12 { grid-column: span 12; }

/* =====================
   站点包裹
   ===================== */
.site-wrapper {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* =====================
   顶部导航
   ===================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--black);
  color: var(--white);
  height: var(--nav-h);
  border-bottom: var(--border);
}

.header-inner {
  height: 100%;
  align-items: center;
}

.header-brand {
  display: flex;
  align-items: center;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--white);
  letter-spacing: 0.03em;
  white-space: nowrap;
  min-height: 40px;
  padding: 0 4px;
}

.brand-text {
  text-transform: none;
}

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

.header-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 calc(var(--base) * 2);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--white);
  border-left: 1px solid rgba(255,255,255,0.15);
  white-space: nowrap;
  transition: background 0.15s;
  letter-spacing: 0.02em;
}

.nav-link:first-child {
  border-left: none;
}

.nav-link:hover {
  background: rgba(255,255,255,0.12);
  text-decoration: none;
}

/* =====================
   粘性锚点条
   ===================== */
.anchor-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 90;
  background: var(--white);
  border-bottom: 2px solid var(--black);
  height: var(--anchor-h);
  overflow-x: auto;
  scrollbar-width: none;
}

.anchor-bar::-webkit-scrollbar {
  display: none;
}

.anchor-inner {
  display: flex;
  align-items: center;
  height: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 calc(var(--base) * 3);
  gap: 0;
}

.anchor-link {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 calc(var(--base) * 2);
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--black);
  border-right: 1px solid var(--gray-200);
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background 0.12s;
}

.anchor-link:last-child {
  border-right: none;
}

.anchor-link:hover {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
}

/* =====================
   Hero 区块
   ===================== */
.hero-block {
  background: var(--white);
  border-bottom: 2px solid var(--black);
  min-height: 70vh;
  display: flex;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.hero-inner {
  padding-top: calc(var(--base) * 8);
  padding-bottom: calc(var(--base) * 8);
  align-items: center;
  width: 100%;
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: calc(var(--base) * 2.5);
  padding-right: calc(var(--base) * 4);
}

.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: var(--border);
  padding: 3px 10px;
  background: var(--black);
  color: var(--white);
  width: fit-content;
}

.hero-h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--black);
}

.hero-desc {
  font-size: 1.0625rem;
  font-weight: 300;
  line-height: 1.65;
  color: var(--gray-600);
  max-width: 480px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 calc(var(--base) * 3);
  background: var(--black);
  color: var(--white);
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: var(--font-mono);
  border: 2px solid var(--black);
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s;
  width: fit-content;
}

.hero-cta:hover {
  background: var(--white);
  color: var(--black);
  text-decoration: none;
}

.hero-media {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.hero-img {
  width: 100%;
  height: auto;
  border: 2px solid var(--black);
  display: block;
  object-fit: cover;
  max-height: 50vh;
}

.hero-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--gray-100);
  border: 2px dashed var(--gray-200);
}

/* =====================
   主体内容
   ===================== */
.site-main {
  flex: 1;
  padding: calc(var(--base) * 6) 0;
}

.wrap {
  align-items: flex-start;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: calc(var(--base) * 3);
  padding-right: calc(var(--base) * 3);
}

.content-section {
  /* col-span-9 via grid */
}

.content-article {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--black);
}

/* 正文内部元素 */
.content-article h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: calc(var(--base) * 6);
  margin-bottom: calc(var(--base) * 1.5);
  padding-bottom: calc(var(--base) * 1);
  border-bottom: 2px solid var(--black);
  letter-spacing: -0.01em;
}

.content-article h2:first-child {
  margin-top: 0;
}

.content-article h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  margin-top: calc(var(--base) * 4);
  margin-bottom: calc(var(--base) * 1);
  font-family: var(--font-mono);
}

.content-article p {
  margin-bottom: calc(var(--base) * 2);
  font-size: 1rem;
  line-height: 1.75;
}

.content-article p.subtitle,
.content-article p.subhead,
.content-article p.desc,
.content-article p.lead {
  font-size: 1.0625rem;
  font-weight: 300;
  color: var(--gray-600);
  margin-bottom: calc(var(--base) * 2.5);
  border-left: 3px solid var(--black);
  padding-left: calc(var(--base) * 2);
}

.content-article ul,
.content-article ol {
  margin-bottom: calc(var(--base) * 2);
  padding-left: calc(var(--base) * 2.5);
}

.content-article ul {
  list-style: disc;
}

.content-article ol {
  list-style: decimal;
}

.content-article li {
  margin-bottom: calc(var(--base) * 0.75);
  line-height: 1.65;
}

.content-article a {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.content-article a:hover {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
}

.content-article strong {
  font-weight: 700;
}

.content-article em {
  font-style: italic;
  color: var(--gray-600);
}

.content-article blockquote {
  border-left: 4px solid var(--black);
  padding: calc(var(--base) * 2) calc(var(--base) * 3);
  margin: calc(var(--base) * 3) 0;
  background: var(--gray-100);
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
}

.content-article table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: calc(var(--base) * 3);
  font-size: 0.9375rem;
}

.content-article th,
.content-article td {
  border: var(--border);
  padding: calc(var(--base) * 1.5) calc(var(--base) * 2);
  text-align: left;
}

.content-article th {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.875rem;
}

.content-article tr:nth-child(even) td {
  background: var(--gray-100);
}

.content-article img {
  max-width: 100%;
  border: var(--border);
  margin: calc(var(--base) * 2) 0;
}

.content-article section {
  margin-bottom: calc(var(--base) * 6);
  padding-bottom: calc(var(--base) * 6);
  border-bottom: 1px solid var(--gray-200);
}

.content-article section:last-child {
  border-bottom: none;
}

/* 标题装饰契约：h2 + p.subtitle */
.subtitle, .subhead, .desc, .lead {
  font-size: 1rem;
  font-weight: 300;
  color: var(--gray-600);
  margin-top: calc(var(--base) * -1);
  margin-bottom: calc(var(--base) * 2);
  line-height: 1.6;
}

/* =====================
   侧边栏 Aside
   ===================== */
.content-aside {
  position: sticky;
  top: calc(var(--nav-h) + var(--anchor-h) + 16px);
}

.aside-inner {
  border: 2px solid var(--black);
  padding: calc(var(--base) * 3);
  background: var(--white);
}

.aside-title {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: calc(var(--base) * 0.5);
  letter-spacing: 0.03em;
}

.aside-inner .subtitle {
  font-size: 0.8125rem;
  color: var(--gray-400);
  margin-bottom: calc(var(--base) * 2);
  border-left: none;
  padding-left: 0;
}

.aside-nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: calc(var(--base) * 3);
}

.aside-link {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 calc(var(--base) * 1.5);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--gray-200);
  transition: background 0.12s, border-color 0.12s;
  letter-spacing: 0.01em;
}

.aside-link:hover {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
  text-decoration: none;
}

.aside-tip {
  border-top: 1px solid var(--gray-200);
  padding-top: calc(var(--base) * 2);
}

.tip-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--black);
  color: var(--white);
  padding: 2px 6px;
  margin-bottom: calc(var(--base) * 1);
}

.aside-tip p {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--gray-600);
}

/* =====================
   页脚
   ===================== */
.site-footer {
  background: var(--black);
  color: var(--white);
  padding: calc(var(--base) * 5) calc(var(--base) * 3);
  text-align: center;
  border-top: 2px solid var(--black);
}

.footer-brand {
  font-size: 1rem;
  font-weight: 500;
  font-family: var(--font-mono);
  margin-bottom: calc(var(--base) * 1.5);
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.footer-copy {
  display: block;
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.01em;
  line-height: 1.5;
}

/* 页脚导航区块（结构抽签） */
.footer-nav-block {
  background: var(--gray-100);
  border-top: var(--border);
  padding: calc(var(--base) * 4) calc(var(--base) * 3);
}

.footer-nav-block nav {
  max-width: var(--max-w);
  margin: 0 auto;
}

.footer-dl {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border: var(--border);
}

.footer-dl dt,
.footer-dl dd {
  flex: 0 0 auto;
}

.footer-dl dt a,
.footer-dl dd a {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding: 0 calc(var(--base) * 2.5);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--black);
  border-right: 1px solid var(--gray-200);
  white-space: nowrap;
  transition: background 0.12s;
  font-family: var(--font-mono);
  min-height: 40px;
}

.footer-dl dt a:hover,
.footer-dl dd a:hover {
  background: var(--black);
  color: var(--white);
  text-decoration: none;
}

.footer-dl dt {
  font-weight: 700;
}

/* =====================
   动效：Stagger List
   ===================== */
@media (prefers-reduced-motion: no-preference) {
  .aside-nav-list .aside-link {
    opacity: 0;
    transform: translateY(8px);
    animation: staggerFadeIn 0.35s ease forwards;
  }

  .aside-nav-list li:nth-child(1) .aside-link { animation-delay: 0.05s; }
  .aside-nav-list li:nth-child(2) .aside-link { animation-delay: 0.10s; }
  .aside-nav-list li:nth-child(3) .aside-link { animation-delay: 0.15s; }
  .aside-nav-list li:nth-child(4) .aside-link { animation-delay: 0.20s; }
  .aside-nav-list li:nth-child(5) .aside-link { animation-delay: 0.25s; }
  .aside-nav-list li:nth-child(6) .aside-link { animation-delay: 0.30s; }
  .aside-nav-list li:nth-child(7) .aside-link { animation-delay: 0.35s; }

  @keyframes staggerFadeIn {
    to {
      opacity: 1;
      transform: none;
    }
  }

  /* Parallax subtle: hero badge */
  .hero-badge {
    animation: badgePop 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
  }

  @keyframes badgePop {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: none; }
  }

  .hero-h1 {
    animation: fadeSlideUp 0.55s ease 0.15s both;
  }

  .hero-desc {
    animation: fadeSlideUp 0.55s ease 0.25s both;
  }

  .hero-cta {
    animation: fadeSlideUp 0.55s ease 0.35s both;
  }

  @keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* =====================
   响应式断点
   ===================== */

/* 平板 */
@media (max-width: 1024px) {
  .col-span-3 { grid-column: span 4; }
  .col-span-9 { grid-column: span 8; }
  .col-span-5 { grid-column: span 6; }
  .col-span-7 { grid-column: span 6; }

  .hero-text {
    padding-right: calc(var(--base) * 2);
  }
}

/* 手机横屏 */
@media (max-width: 768px) {
  :root {
    --nav-h: 52px;
    --anchor-h: 40px;
  }

  .grid-12 {
    grid-template-columns: 1fr;
    padding-left: calc(var(--base) * 2);
    padding-right: calc(var(--base) * 2);
  }

  .col-span-3,
  .col-span-4,
  .col-span-5,
  .col-span-7,
  .col-span-8,
  .col-span-9,
  .col-span-12 {
    grid-column: span 1;
  }

  .header-inner {
    grid-template-columns: 1fr auto;
    gap: var(--base);
  }

  .header-brand {
    grid-column: span 1;
  }

  .header-nav {
    grid-column: span 1;
  }

  .nav-links {
    display: none;
  }

  .anchor-bar {
    display: flex;
    overflow-x: auto;
  }

  .hero-block {
    min-height: auto;
    padding: calc(var(--base) * 6) 0;
  }

  .hero-inner {
    padding-top: calc(var(--base) * 4);
    padding-bottom: calc(var(--base) * 4);
  }

  .hero-text {
    padding-right: 0;
    order: 1;
  }

  .hero-media {
    order: 2;
    margin-top: calc(var(--base) * 3);
  }

  .hero-h1 {
    font-size: 1.75rem;
  }

  .content-aside {
    position: static;
    order: -1;
  }

  .wrap {
    gap: calc(var(--base) * 3);
    padding-left: calc(var(--base) * 2);
    padding-right: calc(var(--base) * 2);
  }

  .footer-dl {
    flex-direction: column;
  }

  .footer-dl dt a,
  .footer-dl dd a {
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
    width: 100%;
  }
}

/* 手机竖屏 375px */
@media (max-width: 480px) {
  body {
    font-size: 16px;
  }

  .hero-h1 {
    font-size: 1.5rem;
  }

  .hero-desc {
    font-size: 0.9375rem;
  }

  .brand-logo {
    font-size: 0.95rem;
  }

  .content-article h2 {
    font-size: 1.25rem;
  }

  .site-footer {
    padding: calc(var(--base) * 4) calc(var(--base) * 2);
  }

  .footer-nav-block {
    padding: calc(var(--base) * 3) calc(var(--base) * 2);
  }

  .anchor-link {
    font-size: 0.75rem;
    padding: 0 calc(var(--base) * 1.5);
  }
}

/* =====================
   工具类
   ===================== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

button[aria-expanded]{min-width:44px;min-height:44px}
