@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 {
  --clr-mint:    #5cc6b0;
  --clr-sand:    #d4c4a8;
  --clr-ink:     #172623;
  --clr-earth:   #b89a72;
  --clr-soil:    #8c6e4f;
  --clr-cream:   #f5efe4;
  --clr-mist:    #e8dfd0;
  --clr-mint-dk: #3da890;
  --clr-ink-lt:  #2e4a45;

  --ff-code: 'Fira Code', 'Courier New', monospace;
  --ff-body: 'Fira Sans', system-ui, -apple-system, sans-serif;

  --fs-xs:  0.75rem;
  --fs-sm:  0.875rem;
  --fs-base: 1rem;
  --fs-md:  1.125rem;
  --fs-lg:  1.375rem;
  --fs-xl:  1.75rem;
  --fs-2xl: 2.25rem;
  --fs-3xl: 3rem;

  --lh-tight: 1.3;
  --lh-base:  1.6;
  --lh-loose: 1.8;

  --radius-sm: 2px;
  --radius-md: 4px;

  --shadow-soft: 0 2px 12px rgba(23,38,35,.08);
  --shadow-card: 0 0 0 1.5px var(--clr-sand);

  --nav-height: 100px;
  --aside-w: 220px;
  --content-max: 820px;
  --site-max: 1280px;

  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --transition: 240ms var(--ease-out);
}

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

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

body {
  font-family: var(--ff-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  background: var(--clr-cream);
  color: var(--clr-ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* div scroll offset */
div[id] {
  scroll-margin-top: calc(var(--nav-height) + 16px);
}

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

a {
  color: var(--clr-mint-dk);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--clr-mint);
}

ul {
  list-style: none;
}

/* =============================================
   粒状纹理 overlay
   ============================================= */
.hero-bg-texture {
  position: absolute;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.07'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 1;
  mix-blend-mode: multiply;
}

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

/* =============================================
   顶部 header（两行）
   ============================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--clr-ink);
  border-bottom: 2px solid var(--clr-mint);
}

.header-brand {
  padding: 14px 32px 10px;
  border-bottom: 1px solid rgba(212,196,168,.15);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--clr-sand) !important;
  text-decoration: none;
}
.brand-link:hover {
  color: var(--clr-mint) !important;
}

.brand-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 50%;
}

.brand-name {
  font-family: var(--ff-code);
  font-size: var(--fs-lg);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: inherit;
}

/* 导航行住在 aside 里 */
.header-aside {
  padding: 0 32px;
  background: var(--clr-ink);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.site-nav li a {
  display: flex;
  align-items: center;
  font-family: var(--ff-code);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--clr-sand);
  padding: 10px 14px;
  min-height: 44px;
  letter-spacing: 0.02em;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
.site-nav li a:hover {
  color: var(--clr-mint);
  border-bottom-color: var(--clr-mint);
}

/* =============================================
   Hero
   ============================================= */
.hero-wrap {
  position: relative;
  min-height: 70vh;
  background: var(--clr-ink);
  display: flex;
  align-items: center;
  overflow: hidden;
}

/* 点阵底纹 */
.hero-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(92,198,176,.18) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--site-max);
  margin: 0 auto;
  padding: 80px 32px 120px;
  display: flex;
  align-items: center;
  gap: 48px;
  will-change: transform;
}

.hero-content {
  flex: 1 1 480px;
  max-width: 640px;
}

.hero-h1 {
  font-family: var(--ff-code);
  font-size: clamp(var(--fs-2xl), 5vw, var(--fs-3xl));
  font-weight: 700;
  color: var(--clr-cream);
  line-height: var(--lh-tight);
  margin-bottom: 20px;
  letter-spacing: -0.01em;
}

.hero-desc {
  font-size: var(--fs-md);
  color: var(--clr-sand);
  line-height: var(--lh-loose);
  margin-bottom: 32px;
  max-width: 480px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  font-family: var(--ff-code);
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--clr-ink);
  background: var(--clr-mint);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  transition: background var(--transition), transform var(--transition);
  min-height: 44px;
}
.hero-cta:hover {
  background: var(--clr-mint-dk);
  color: var(--clr-cream);
  transform: translateY(-2px);
}

.hero-media {
  flex: 0 0 340px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-media .hero-img {
  width: 100%;
  max-width: 340px;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
  object-fit: cover;
}

/* 斜切底边 */
.hero-arc {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: var(--clr-cream);
  clip-path: polygon(0 100%, 100% 100%, 100% 0, 0 100%);
  z-index: 3;
}

/* =============================================
   主体布局（侧边栏 + 正文）
   ============================================= */
.body-layout {
  flex: 1;
  display: flex;
  gap: 0;
  max-width: var(--site-max);
  margin: 0 auto;
  width: 100%;
  padding: 0 0 64px;
  align-items: flex-start;
}

/* =============================================
   侧边栏 aside（内容左侧）
   ============================================= */
.content-aside {
  flex: 0 0 var(--aside-w);
  position: sticky;
  top: var(--nav-height);
  max-height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  padding: 32px 20px 32px 32px;
  border-right: 1.5px solid var(--clr-sand);
  background: var(--clr-cream);
}

.toc-label {
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--clr-soil);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.toc-nav ul {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.toc-nav li a {
  display: flex;
  align-items: center;
  font-size: var(--fs-sm);
  color: var(--clr-ink-lt);
  padding: 8px 8px;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  line-height: 1.4;
  min-height: 40px;
}
.toc-nav li a:hover {
  color: var(--clr-mint-dk);
  border-left-color: var(--clr-mint);
  background: rgba(92,198,176,.06);
}

.aside-tag {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px dashed var(--clr-sand);
}

.aside-eyebrow {
  display: block;
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  color: var(--clr-earth);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  font-weight: 600;
}

.aside-intro {
  font-size: var(--fs-xs);
  color: var(--clr-soil);
  line-height: var(--lh-base);
}

/* =============================================
   主正文区
   ============================================= */
.site-main {
  flex: 1 1 0;
  min-width: 0;
  padding: 40px 40px 40px 48px;
}

.page-article {
  max-width: var(--content-max);
}

/* =============================================
   page.content 内 div 样式
   ============================================= */
.page-content-section > div,
.page-article div {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--clr-mist);
}
.page-content-section > div:last-child,
.page-article div:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

/* h2 前的 small 眉题 */
small + h2,
small + h3 {
  margin-top: 4px;
}

small {
  display: block;
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  color: var(--clr-earth);
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 4px;
}

h2 {
  font-family: var(--ff-code);
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--clr-ink);
  line-height: var(--lh-tight);
  margin-bottom: 16px;
}

h3 {
  font-family: var(--ff-body);
  font-size: var(--fs-lg);
  font-weight: 600;
  color: var(--clr-ink-lt);
  margin: 24px 0 10px;
  line-height: var(--lh-tight);
}

h4 {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--clr-soil);
  margin: 18px 0 8px;
}

p {
  font-size: var(--fs-base);
  line-height: var(--lh-loose);
  color: var(--clr-ink);
  margin-bottom: 14px;
  max-width: 70ch;
}

ul, ol {
  margin: 12px 0 16px 0;
  padding-left: 20px;
}
ul { list-style: disc; }
ol { list-style: decimal; }

li {
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  margin-bottom: 6px;
  color: var(--clr-ink);
}

strong {
  font-weight: 600;
  color: var(--clr-ink);
}

em {
  font-style: italic;
  color: var(--clr-ink-lt);
}

code {
  font-family: var(--ff-code);
  font-size: 0.9em;
  background: var(--clr-mist);
  color: var(--clr-mint-dk);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--ff-code);
  background: var(--clr-ink);
  color: var(--clr-sand);
  padding: 20px 24px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 20px 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-base);
}

blockquote {
  border-left: 3px solid var(--clr-mint);
  padding: 12px 20px;
  background: rgba(92,198,176,.06);
  margin: 20px 0;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
blockquote p {
  margin-bottom: 0;
  color: var(--clr-ink-lt);
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: var(--fs-sm);
  font-family: var(--ff-code);
}
th {
  background: var(--clr-ink);
  color: var(--clr-sand);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--clr-mist);
  color: var(--clr-ink);
}
tr:hover td {
  background: rgba(212,196,168,.15);
}

/* 正文内卡片/面板 */
.card {
  border: var(--shadow-card);
  border-radius: 0;
  padding: 20px 24px;
  background: var(--clr-cream);
  margin: 20px 0;
  transition: border-color var(--transition);
}
.card:hover {
  border-color: var(--clr-mint);
}

/* =============================================
   页脚
   ============================================= */
.site-footer {
  background: var(--clr-ink);
  color: var(--clr-sand);
  padding: 48px 32px 0;
  border-top: 2px solid var(--clr-mint);
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 40px;
  max-width: var(--site-max);
  margin: 0 auto 40px;
}

.footer-dt {
  font-family: var(--ff-code);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--clr-mint);
  letter-spacing: 0.06em;
  margin-bottom: 12px;
  display: block;
}

.footer-dd {
  font-size: var(--fs-sm);
  color: var(--clr-sand);
  line-height: var(--lh-base);
  margin-bottom: 8px;
}
.footer-dd a {
  color: var(--clr-sand);
  transition: color var(--transition);
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
}
.footer-dd a:hover {
  color: var(--clr-mint);
}

.footer-tag {
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  color: var(--clr-earth);
  letter-spacing: 0.05em;
}

.footer-contact-label {
  color: var(--clr-earth);
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  letter-spacing: 0.08em;
  margin-top: 12px;
}

.footer-bottom {
  border-top: 1px solid rgba(212,196,168,.15);
  padding: 20px 0;
  text-align: center;
}

.footer-copy {
  font-family: var(--ff-code);
  font-size: var(--fs-xs);
  color: var(--clr-earth);
  letter-spacing: 0.04em;
  line-height: var(--lh-base);
  max-width: none;
}

/* =============================================
   Parallax（原生 JS 配合）
   ============================================= */
@media (prefers-reduced-motion: no-preference) {
  .hero-content {
    transition: transform 0.1s linear;
  }
}

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

@media (min-width: 1200px) {
  .body-layout {
    padding: 0 0 80px;
  }
}

@media (max-width: 900px) {
  :root {
    --aside-w: 180px;
    --nav-height: 88px;
  }

  .body-layout {
    flex-direction: column;
  }

  .content-aside {
    position: static;
    flex: none;
    width: 100%;
    max-height: none;
    padding: 24px 32px;
    border-right: none;
    border-bottom: 1.5px solid var(--clr-sand);
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .toc-nav {
    flex: 1 1 200px;
  }

  .toc-nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }

  .toc-nav li a {
    min-height: 44px;
    padding: 8px 12px;
  }

  .aside-tag {
    flex: 1 1 200px;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
  }

  .site-main {
    padding: 32px;
  }

  .hero-inner {
    flex-direction: column;
    padding: 60px 32px 100px;
    gap: 32px;
  }

  .hero-media {
    flex: none;
    width: 100%;
    max-width: 400px;
  }

  .footer-cols {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer-dl--more {
    grid-column: 1 / -1;
  }
}

@media (max-width: 600px) {
  :root {
    --nav-height: 108px;
  }

  .header-brand {
    padding: 12px 20px 8px;
  }

  .header-aside {
    padding: 0 20px;
    overflow-x: auto;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    gap: 0;
  }

  .site-nav li a {
    padding: 10px 10px;
    font-size: 0.78rem;
    white-space: nowrap;
    min-height: 44px;
  }

  .hero-h1 {
    font-size: var(--fs-2xl);
  }

  .hero-inner {
    padding: 48px 20px 90px;
  }

  .hero-desc {
    font-size: var(--fs-base);
  }

  .hero-cta {
    min-height: 44px;
    padding: 12px 22px;
  }

  .content-aside {
    padding: 20px;
    flex-direction: column;
    gap: 16px;
  }

  .site-main {
    padding: 24px 20px;
  }

  .footer-cols {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-dl--more {
    grid-column: auto;
  }

  .site-footer {
    padding: 36px 20px 0;
  }

  h2 {
    font-size: var(--fs-lg);
  }
}

/* =============================================
   prefers-reduced-motion
   ============================================= */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
