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

/* ============================================================
   CSS 变量 & 基础重置
   ============================================================ */
:root {
  --c-paper: #fdfbf7;
  --c-smoke: #f5f5f5;
  --c-ink: #1a1a1a;
  --c-ink-mid: #444444;
  --c-ink-light: #888888;
  --c-border: #d0cdc8;
  --c-accent: #1a1a1a;
  --c-accent-hover: #444;
  --font-mono: 'JetBrains Mono', 'Courier New', Courier, monospace;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --nav-h: 56px;
  --sticky-h: 40px;
  --radius: 0px;
  --content-max: 860px;
  --layout-max: 1200px;
}

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

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

body, .eink-body {
  font-family: var(--font-mono);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--c-paper);
  color: var(--c-ink);
  min-height: 100vh;
  overflow-x: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
}

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

a:hover {
  color: var(--c-accent-hover);
  text-decoration-thickness: 2px;
}

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

ul {
  list-style: none;
}

/* ============================================================
   整体页面布局 — 两栏 grid
   ============================================================ */
.page-wrapper {
  display: grid;
  grid-template-areas:
    "aside    aside"
    "sticky   sticky"
    "hero     hero"
    "main     sidebar"
    "footer   footer";
  grid-template-columns: minmax(0, 1fr) 240px;
  grid-template-rows: auto auto auto 1fr auto;
  max-width: var(--layout-max);
  margin: 0 auto;
  min-height: 100vh;
  width: 100%;
}

/* ============================================================
   顶部 Aside（主导航区）
   ============================================================ */
.site-aside {
  grid-area: aside;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  height: var(--nav-h);
  border-bottom: 2px solid var(--c-ink);
  background: var(--c-paper);
  position: sticky;
  top: 0;
  z-index: 200;
  width: 100%;
  overflow: hidden;
}

.aside-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.brand-logo {
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--c-ink);
  white-space: nowrap;
}

.brand-text {
  border: 2px solid var(--c-ink);
  padding: 4px 10px;
}

.aside-contact a {
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  border: 1px solid var(--c-ink);
  padding: 3px 10px;
  display: inline-block;
  min-height: 40px;
  line-height: 34px;
}

/* 主导航内部 nav > ul > li > a */
.main-nav {
  overflow: hidden;
  flex: 1 1 0;
  min-width: 0;
}

.main-nav > ul {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.main-nav > ul::-webkit-scrollbar {
  display: none;
}

.main-nav > ul > li > a {
  display: block;
  padding: 0 0.8rem;
  height: var(--nav-h);
  line-height: var(--nav-h);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-decoration: none;
  border-left: 1px solid var(--c-border);
  white-space: nowrap;
  transition: none;
  min-height: 44px;
}

.main-nav > ul > li:last-child > a {
  border-right: 1px solid var(--c-border);
}

.main-nav > ul > li > a:hover {
  background: var(--c-ink);
  color: var(--c-paper);
}

/* ============================================================
   粘性锚点条
   ============================================================ */
.sticky-bar {
  grid-area: sticky;
  position: sticky;
  top: var(--nav-h);
  z-index: 190;
  background: var(--c-smoke);
  border-bottom: 1px solid var(--c-border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  scrollbar-width: none;
}

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

.anchor-nav > ul {
  display: flex;
  align-items: center;
  min-width: max-content;
}

.anchor-nav > ul > li > a {
  display: block;
  padding: 0 1rem;
  height: var(--sticky-h);
  line-height: var(--sticky-h);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  border-right: 1px solid var(--c-border);
  white-space: nowrap;
  transition: none;
  color: var(--c-ink-mid);
  min-height: 40px;
}

.anchor-nav > ul > li:first-child > a {
  border-left: none;
}

.anchor-nav > ul > li > a:hover {
  background: var(--c-ink);
  color: var(--c-paper);
}

/* ============================================================
   Hero 区块
   ============================================================ */
.hero-block {
  grid-area: hero;
  position: relative;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  border-bottom: 2px solid var(--c-ink);
  overflow: hidden;
  background: var(--c-paper);
  width: 100%;
}

.hero-text {
  position: relative;
  z-index: 10;
  padding: 4rem 1.5rem 2rem;
  max-width: 660px;
  text-align: left;
}

.hero-text h1 {
  font-size: clamp(1.6rem, 4vw, 3.2rem);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 1rem;
  border-left: 5px solid var(--c-ink);
  padding-left: 1rem;
}

.hero-sub {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--c-ink-mid);
  margin-bottom: 2rem;
  max-width: 480px;
  padding-left: 1.25rem;
}

.hero-cta {
  display: inline-block;
  background: var(--c-ink);
  color: var(--c-paper);
  font-family: var(--font-mono);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 12px 28px;
  text-decoration: none;
  border: 2px solid var(--c-ink);
  border-radius: var(--radius);
  transition: none;
  min-height: 44px;
  line-height: 1.4;
}

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

.hero-media {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 50%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.hero-media .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.18;
  filter: grayscale(100%) contrast(1.2);
}

.hero-media--empty {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 8px,
    rgba(26,26,26,0.04) 8px,
    rgba(26,26,26,0.04) 9px
  );
}

/* 斜切分割色带 */
.hero-divider {
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 60px;
  z-index: 5;
  background: var(--c-paper);
  clip-path: polygon(0 100%, 100% 30%, 100% 100%);
}

/* ============================================================
   主内容区
   ============================================================ */
.site-main {
  grid-area: main;
  padding: 3rem 1.5rem 4rem;
  min-width: 0;
  overflow: hidden;
}

.main-article > section {
  max-width: var(--content-max);
}

/* scroll-margin for sticky headers */
section[id] {
  scroll-margin-top: calc(var(--nav-h) + var(--sticky-h) + 12px);
}

/* 正文内容样式 */
.content-section h2 {
  font-size: 1.25rem;
  font-weight: 500;
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--c-ink);
  letter-spacing: 0.02em;
}

.content-section h2 > span {
  display: inline;
}

.content-section h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin: 2rem 0 0.75rem;
  letter-spacing: 0.03em;
}

.content-section h3 > span {
  display: inline;
}

.content-section p {
  margin-bottom: 1.1rem;
  line-height: 1.75;
  word-break: break-word;
  overflow-wrap: break-word;
}

.content-section ul,
.content-section ol {
  padding-left: 1.5rem;
  margin-bottom: 1.1rem;
}

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

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

.content-section li {
  margin-bottom: 0.4rem;
  line-height: 1.7;
  word-break: break-word;
}

.content-section a {
  color: var(--c-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
}

.content-section blockquote {
  border-left: 4px solid var(--c-ink);
  padding: 0.5rem 1rem;
  margin: 1.5rem 0;
  color: var(--c-ink-mid);
  font-style: italic;
  background: var(--c-smoke);
}

.content-section strong {
  font-weight: 500;
}

.content-section table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.content-section th,
.content-section td {
  border: 1px solid var(--c-border);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.content-section th {
  background: var(--c-smoke);
  font-weight: 500;
}

/* section 分隔 */
.content-section > section,
section + section {
  border-top: 1px solid var(--c-border);
  padding-top: 2rem;
  margin-top: 2rem;
}

/* ============================================================
   侧边栏 Aside（右侧）
   ============================================================ */
.content-aside {
  grid-area: sidebar;
  padding: 3rem 1.25rem 3rem 1rem;
  border-left: 1px solid var(--c-border);
  min-width: 0;
  overflow: hidden;
}

.aside-widget {
  margin-bottom: 2.5rem;
}

.widget-title {
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--c-ink);
}

.widget-title > span {
  display: inline;
}

.widget-nav-list > li {
  border-bottom: 1px solid var(--c-border);
}

.widget-nav-list > li > a {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--c-ink);
  letter-spacing: 0.02em;
  transition: none;
  min-height: 40px;
  line-height: 1.5;
  word-break: break-word;
}

.widget-nav-list > li > a:hover {
  padding-left: 8px;
  border-left: 3px solid var(--c-ink);
}

.widget-desc {
  font-size: 0.8rem;
  line-height: 1.7;
  color: var(--c-ink-mid);
  word-break: break-word;
}

/* ============================================================
   页脚
   ============================================================ */
.site-footer {
  grid-area: footer;
  border-top: 2px solid var(--c-ink);
  background: var(--c-smoke);
  padding: 0;
  width: 100%;
}

.footer-cta-block {
  padding: 2rem 1.5rem 1.5rem;
  font-size: 0.92rem;
  font-weight: 400;
  border-bottom: 1px solid var(--c-border);
  letter-spacing: 0.02em;
  word-break: break-word;
}

.footer-cta-block strong {
  font-weight: 500;
}

.footer-copy {
  padding: 1rem 1.5rem;
}

.footer-copy small {
  font-size: 0.76rem;
  color: var(--c-ink-mid);
  letter-spacing: 0.03em;
}

/* ============================================================
   hover 微交互（纯 CSS）
   ============================================================ */
@media (hover: hover) {
  .main-nav > ul > li > a {
    position: relative;
  }
  .main-nav > ul > li > a::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 0.8rem;
    right: 0.8rem;
    height: 2px;
    background: var(--c-paper);
    transform: scaleX(0);
    transform-origin: left;
  }
  .main-nav > ul > li > a:hover::after {
    transform: scaleX(1);
  }
}

/* ============================================================
   parallax / 动效（prefers-reduced-motion 关闭）
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .hero-media .hero-img {
    will-change: transform;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

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

/* 平板 ≤1024px */
@media (max-width: 1024px) {
  .page-wrapper {
    grid-template-columns: minmax(0, 1fr) 200px;
  }
  .main-nav > ul > li > a {
    padding: 0 0.65rem;
    font-size: 0.76rem;
  }
}

/* 移动端 ≤768px */
@media (max-width: 768px) {
  .page-wrapper {
    grid-template-areas:
      "aside"
      "sticky"
      "hero"
      "main"
      "sidebar"
      "footer";
    grid-template-columns: minmax(0, 1fr);
  }

  .site-aside {
    flex-wrap: wrap;
    height: auto;
    padding: 0.6rem 1rem;
    gap: 0.5rem;
    position: sticky;
    top: 0;
  }

  .aside-top {
    width: 100%;
    justify-content: space-between;
  }

  .main-nav {
    width: 100%;
    border-top: 1px solid var(--c-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: none;
  }

  .main-nav > ul {
    flex-wrap: nowrap;
    min-width: max-content;
  }

  .main-nav > ul > li > a {
    height: 44px;
    line-height: 44px;
    padding: 0 0.7rem;
    font-size: 0.74rem;
    border-left: 1px solid var(--c-border);
    min-height: 44px;
  }

  .main-nav > ul > li:last-child > a {
    border-right: none;
  }

  .sticky-bar {
    top: 0;
  }

  .anchor-nav > ul > li > a {
    height: 44px;
    line-height: 44px;
    font-size: 0.72rem;
    padding: 0 0.75rem;
    min-height: 44px;
  }

  /* Hero */
  .hero-block {
    min-height: 55vh;
  }

  .hero-text {
    padding: 2.5rem 1rem 1.5rem;
    max-width: 100%;
  }

  .hero-text h1 {
    font-size: clamp(1.3rem, 5vw, 1.8rem);
    padding-left: 0.75rem;
    border-left-width: 3px;
  }

  .hero-sub {
    max-width: 100%;
    padding-left: 1rem;
  }

  .hero-media {
    width: 100%;
    height: 40%;
    top: auto;
    bottom: 0;
    opacity: 0.4;
  }

  .hero-cta {
    font-size: 0.85rem;
    padding: 12px 20px;
  }

  /* Main */
  .site-main {
    padding: 2rem 1rem 3rem;
  }

  .content-aside {
    border-left: none;
    border-top: 1px solid var(--c-border);
    padding: 2rem 1rem;
  }

  .footer-cta-block {
    padding: 1.5rem 1rem 1rem;
    font-size: 0.88rem;
  }

  .footer-copy {
    padding: 0.75rem 1rem;
  }

  .content-section table {
    font-size: 0.8rem;
  }
}

/* 超小屏 ≤400px */
@media (max-width: 400px) {
  .hero-text h1 {
    font-size: 1.2rem;
  }

  .content-section h2 {
    font-size: 1rem;
  }

  .main-nav > ul > li > a {
    padding: 0 0.55rem;
    font-size: 0.7rem;
  }
}
