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

/* ============================================================
   CSS 变量与根设置
   ============================================================ */
:root {
  --c-bg: #fafaf8;
  --c-mid: #4a4a4a;
  --c-ink: #1a1a1a;
  --c-border: #1a1a1a;
  --c-accent: #1a1a1a;
  --c-muted: #6b6b6b;
  --c-light: #e8e8e4;
  --c-hover-bg: #f0ede6;

  --font-main: 'Inter', 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;

  --top-bar-h: 64px;
  --anchor-bar-h: 44px;
  --nav-total-h: calc(var(--top-bar-h) + var(--anchor-bar-h));

  --border: 2px solid var(--c-ink);
  --border-thin: 1px solid var(--c-ink);
  --radius: 0;

  --max-w: 1200px;
  --gap: 24px;
}

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

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

body {
  font-family: var(--font-main);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--c-bg);
  color: var(--c-ink);
  overflow-x: hidden;
}

a {
  color: var(--c-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  background: var(--c-ink);
  color: var(--c-bg);
  text-decoration: none;
}

ul, ol { list-style: none; }

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

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* 纸张底纹伪元素 */
.page-wrapper::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(26,26,26,0.04) 40px
    );
  pointer-events: none;
  z-index: 0;
}

.page-wrapper {
  position: relative;
  min-height: 100vh;
}

/* ============================================================
   顶部导航 aside > nav > ul > li > a
   ============================================================ */
.site-aside {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-bg);
  border-bottom: var(--border);
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--top-bar-h);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

.brand-area {
  flex-shrink: 0;
  margin-right: 24px;
}

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

.brand-link:hover {
  background: transparent;
  color: inherit;
}

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

.logo-text {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  white-space: nowrap;
  border: var(--border);
  padding: 4px 10px;
  transform: rotate(-1deg);
  display: inline-block;
}

/* 导航结构：aside > nav > ul > li > a */
.top-nav {
  flex: 1;
}

.top-nav ul {
  display: flex;
  gap: 0;
  list-style: none;
  flex-wrap: nowrap;
  overflow-x: auto;
}

.top-nav ul li {
  flex-shrink: 0;
}

/* tap 目标 ≥40px：用 padding 撑高，确保可点击区域足够 */
.top-nav ul li a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--c-ink);
  border-right: var(--border-thin);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: none;
}

.top-nav ul li a:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

.top-nav ul li:first-child a {
  border-left: var(--border-thin);
}

/* 搜索框 */
.top-search {
  flex-shrink: 0;
  margin-left: 16px;
}

.search-form {
  display: flex;
  border: var(--border);
}

.search-input {
  width: 160px;
  padding: 6px 10px;
  border: none;
  background: var(--c-bg);
  color: var(--c-ink);
  font-size: 0.875rem;
  outline: none;
  min-height: 44px;
}

.search-input::placeholder {
  color: var(--c-muted);
}

.search-btn {
  border: none;
  border-left: var(--border);
  background: var(--c-ink);
  color: var(--c-bg);
  padding: 0 12px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  min-height: 44px;
  min-width: 44px;
}

.search-btn:hover {
  background: var(--c-mid);
}

/* 汉堡按钮（移动端） */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: var(--border);
  padding: 8px 10px;
  cursor: pointer;
  margin-left: 12px;
  min-height: 44px;
  min-width: 44px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-ink);
}

/* 移动端弹出导航 */
.mobile-nav {
  border-top: var(--border);
  background: var(--c-bg);
}

.mobile-nav nav ul {
  display: flex;
  flex-direction: column;
}

.mobile-nav nav ul li a {
  display: flex;
  align-items: center;
  padding: 0 20px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--c-ink);
  border-bottom: var(--border-thin);
  min-height: 48px;
}

.mobile-nav nav ul li a:hover {
  background: var(--c-ink);
  color: var(--c-bg);
}

/* ============================================================
   粘性锚点条
   ============================================================ */
.anchor-bar {
  position: sticky;
  top: var(--top-bar-h);
  z-index: 99;
  background: var(--c-ink);
  border-bottom: var(--border);
  overflow-x: auto;
}

.anchor-inner {
  display: flex;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px;
}

.anchor-link {
  display: flex;
  align-items: center;
  height: var(--anchor-bar-h);
  padding: 0 16px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--c-bg);
  text-decoration: none;
  white-space: nowrap;
  border-right: 1px solid rgba(250,250,248,0.2);
  text-transform: uppercase;
  min-height: 44px;
}

.anchor-link:hover {
  background: rgba(250,250,248,0.15);
  color: var(--c-bg);
}

/* ============================================================
   Hero 区
   ============================================================ */
.hero-wrap {
  position: relative;
  min-height: 45vh;
  display: flex;
  align-items: center;
  background: var(--c-bg);
  border-bottom: var(--border);
  overflow: hidden;
}

.hero-skew-band {
  position: absolute;
  top: 0;
  left: -5%;
  width: 60%;
  height: 100%;
  background: var(--c-ink);
  clip-path: polygon(0 0, 85% 0, 70% 100%, 0 100%);
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 60px 24px;
}

.hero-deco {
  flex-shrink: 0;
  transform: rotate(-3deg);
  opacity: 0.9;
}

.hero-icon rect,
.hero-icon path,
.hero-icon circle {
  stroke: var(--c-bg);
}

.hero-icon path {
  fill: var(--c-bg);
}

.hero-text {
  text-align: center;
  max-width: 640px;
}

.hero-h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--c-bg);
  margin-bottom: 16px;
  text-shadow: 3px 3px 0 rgba(0,0,0,0.2);
}

.hero-sub {
  font-size: 1.1rem;
  font-weight: 400;
  color: rgba(250,250,248,0.8);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto;
}

/* ============================================================
   scroll-margin-top 给所有 section
   ============================================================ */
section[id] {
  scroll-margin-top: var(--nav-total-h);
}

/* ============================================================
   正文主容器：main > div.wrap > section > article
   ============================================================ */
.site-main {
  max-width: 100%;
  position: relative;
  z-index: 1;
}

.wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px;
}

.content-section {
  width: 100%;
}

.content-article {
  width: 100%;
}

/* ============================================================
   正文 HTML 内容样式
   ============================================================ */
.content-article h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-top: 56px;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: var(--border);
  position: relative;
}

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

.content-article h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 32px;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
  border-left: 4px solid var(--c-ink);
  padding-left: 12px;
}

.content-article p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--c-mid);
  margin-bottom: 16px;
  max-width: 70ch;
}

.content-article ul,
.content-article ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

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

.content-article li {
  margin-bottom: 8px;
  line-height: 1.65;
  color: var(--c-mid);
}

.content-article a {
  color: var(--c-ink);
  font-weight: 600;
  text-underline-offset: 4px;
}

.content-article strong {
  font-weight: 700;
  color: var(--c-ink);
}

.content-article blockquote {
  border-left: 4px solid var(--c-ink);
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--c-hover-bg);
  font-style: italic;
}

.content-article img {
  border: var(--border);
  transform: rotate(-0.5deg);
  margin: 24px 0;
}

/* section 区块间距与分割 */
.content-article section {
  padding-top: 56px;
  padding-bottom: 40px;
  border-bottom: var(--border-thin);
  position: relative;
}

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

/* section 标签手绘感 */
.content-article section::before {
  content: attr(id);
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-bg);
  background: var(--c-ink);
  padding: 2px 8px;
  margin-bottom: 16px;
  transform: rotate(-1deg);
}

/* ============================================================
   small 眉题（标题装饰契约）
   ============================================================ */
small {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-muted);
  margin-bottom: 6px;
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  background: var(--c-ink);
  color: var(--c-bg);
  border-top: var(--border);
  position: relative;
  z-index: 1;
}

.footer-top {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px 40px;
}

.footer-brand-col,
.footer-nav-col,
.footer-contact-col {
  padding: 0 24px;
  border-right: 1px solid rgba(250,250,248,0.15);
}

.footer-brand-col { padding-left: 0; }
.footer-contact-col { border-right: none; }

.footer-brand a {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--c-bg);
  text-decoration: none;
  letter-spacing: -0.03em;
  display: inline-block;
  border-bottom: 2px solid var(--c-bg);
  margin-bottom: 12px;
}

.footer-brand a:hover {
  background: rgba(250,250,248,0.15);
}

.footer-desc {
  font-size: 0.875rem;
  line-height: 1.6;
  color: rgba(250,250,248,0.7);
  margin-bottom: 12px;
}

.footer-small {
  display: inline-block;
  font-size: 0.7rem;
  color: rgba(250,250,248,0.5);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(250,250,248,0.2);
  padding: 2px 8px;
}

/* footer small + h2 */
.footer-nav-col small,
.footer-contact-col small {
  color: rgba(250,250,248,0.5);
  margin-bottom: 6px;
}

.footer-nav-title,
.footer-contact-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-bg);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.footer-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-nav-list li a {
  font-size: 0.875rem;
  color: rgba(250,250,248,0.75);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.footer-nav-list li a:hover {
  color: var(--c-bg);
  border-bottom-color: var(--c-bg);
  background: transparent;
}

/* 订阅表单 */
.footer-subscribe {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.sub-input {
  padding: 10px 12px;
  border: 1px solid rgba(250,250,248,0.3);
  background: rgba(250,250,248,0.05);
  color: var(--c-bg);
  font-size: 0.875rem;
  outline: none;
  min-height: 44px;
}

.sub-input::placeholder {
  color: rgba(250,250,248,0.4);
}

.sub-input:focus {
  border-color: var(--c-bg);
}

.sub-btn {
  padding: 10px 16px;
  background: var(--c-bg);
  color: var(--c-ink);
  border: none;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.05em;
  min-height: 44px;
  text-transform: uppercase;
}

.sub-btn:hover {
  background: var(--c-light);
}

.footer-contact-info {
  font-size: 0.8rem;
  color: rgba(250,250,248,0.6);
}

.footer-contact-info a {
  color: rgba(250,250,248,0.85);
}

/* 底栏 footer > nav + div */
.footer-bottom {
  border-top: 1px solid rgba(250,250,248,0.15);
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-bottom-nav {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.footer-bottom-nav a {
  font-size: 0.8rem;
  color: rgba(250,250,248,0.6);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
}

.footer-bottom-nav a:hover {
  color: var(--c-bg);
  background: transparent;
}

.footer-bottom-nav span {
  color: rgba(250,250,248,0.3);
  font-size: 0.8rem;
}

.footer-copyright {
  font-size: 0.8rem;
  color: rgba(250,250,248,0.45);
  letter-spacing: 0.02em;
}

/* ============================================================
   Scroll Reveal 动画
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .content-article section {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }

  .content-article section.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .hero-inner {
    animation: heroFadeIn 0.6s ease forwards;
  }

  @keyframes heroFadeIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .hero-deco {
    animation: heroDeco 0.8s ease 0.2s both;
  }

  @keyframes heroDeco {
    from { opacity: 0; transform: rotate(-3deg) scale(0.8); }
    to   { opacity: 0.9; transform: rotate(-3deg) scale(1); }
  }

  /* stagger 锚点条 */
  .anchor-link {
    opacity: 0;
    animation: anchorIn 0.3s ease forwards;
  }

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

  @keyframes anchorIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
  }
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 900px) {
  .top-nav {
    display: none;
  }

  .top-search {
    display: none;
  }

  .nav-toggle {
    display: flex;
    margin-left: auto;
  }

  .footer-top {
    grid-template-columns: 1fr;
    padding: 32px 20px;
  }

  .footer-brand-col,
  .footer-nav-col,
  .footer-contact-col {
    padding: 20px 0;
    border-right: none;
    border-bottom: 1px solid rgba(250,250,248,0.1);
  }

  .footer-contact-col {
    border-bottom: none;
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
    padding: 40px 20px;
  }

  .hero-skew-band {
    clip-path: polygon(0 0, 100% 0, 100% 45%, 0 60%);
    width: 100%;
    height: 100%;
  }

  .hero-h1 {
    color: var(--c-bg);
  }

  .hero-sub {
    color: rgba(250,250,248,0.85);
  }
}

@media (max-width: 600px) {
  .brand-area {
    margin-right: 0;
  }

  .logo-text {
    font-size: 1rem;
    padding: 3px 8px;
  }

  .anchor-bar {
    top: var(--top-bar-h);
  }

  .anchor-link {
    font-size: 0.72rem;
    padding: 0 10px;
    letter-spacing: 0.03em;
    min-height: 44px;
  }

  .wrap {
    padding: 32px 16px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
  }

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

  .content-article p {
    max-width: 100%;
  }
}
