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

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

:root {
  --bg: #fafaf8;
  --ink: #1a1a1a;
  --mid: #4a4a4a;
  --border: #d0cdc8;
  --accent: #2a2a2a;
  --paper: #f2f0ea;
  --nav-h: 64px;
  --anchor-h: 40px;
  --font-serif: 'EB Garamond', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --font-sans: 'Lato', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-sans);
  line-height: 1.7;
  background: var(--bg);
  overflow-x: hidden;
}

/* Paper texture overlay via pseudo */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  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.06'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.45;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
p { margin-bottom: 0.9em; }
p:last-child { margin-bottom: 0; }

/* =============================================
   排版
   ============================================= */
h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.25;
  color: var(--ink);
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.2rem); font-weight: 600; }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.6rem); font-weight: 500; }

h2 > span, h3 > span {
  display: inline;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 2px;
}

/* =============================================
   页面包装
   ============================================= */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =============================================
   顶部导航
   ============================================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--bg);
  border-bottom: 1.5px solid var(--ink);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
}

.main-nav {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-left, .nav-right {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
  margin: 0;
}

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

.main-nav a {
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: none;
  color: var(--mid);
  white-space: nowrap;
  padding: 0.5rem 0;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.main-nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.nav-brand {
  flex-shrink: 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-text {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}

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

/* 汉堡按钮 */
.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: 1.5px solid var(--ink);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  position: relative;
}

.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  transition: transform 0.2s, opacity 0.2s;
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  left: 0;
}

.menu-icon::before { top: -6px; }
.menu-icon::after  { top: 6px; }

.menu-toggle.is-open .menu-icon { background: transparent; }
.menu-toggle.is-open .menu-icon::before { transform: rotate(45deg); top: 0; }
.menu-toggle.is-open .menu-icon::after  { transform: rotate(-45deg); top: 0; }

/* =============================================
   全屏遮罩菜单
   ============================================= */
.fullscreen-menu {
  position: fixed;
  inset: 0;
  background: var(--ink);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}

.fullscreen-menu.is-open {
  opacity: 1;
  pointer-events: all;
}

.menu-close {
  position: absolute;
  top: 1.5rem;
  right: 2rem;
  background: none;
  border: none;
  color: var(--bg);
  font-size: 2rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
}

.fs-nav p {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  margin: 0;
}

.fs-nav a {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 600;
  color: var(--bg);
  letter-spacing: 0.04em;
  padding: 0.3rem 1rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  position: relative;
  transition: opacity 0.15s;
}

.fs-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--bg);
  transition: width 0.2s;
}

.fs-nav a:hover { opacity: 0.75; text-decoration: none; }
.fs-nav a:hover::after { width: 100%; }

/* stagger 动画 */
.fs-nav a {
  opacity: 0;
  transform: translateY(12px);
}

.fullscreen-menu.is-open .fs-nav a {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: no-preference) {
  .fullscreen-menu.is-open .fs-nav a:nth-child(1) { transition: opacity 0.25s 0.05s, transform 0.25s 0.05s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(2) { transition: opacity 0.25s 0.10s, transform 0.25s 0.10s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(3) { transition: opacity 0.25s 0.15s, transform 0.25s 0.15s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(4) { transition: opacity 0.25s 0.20s, transform 0.25s 0.20s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(5) { transition: opacity 0.25s 0.25s, transform 0.25s 0.25s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(6) { transition: opacity 0.25s 0.30s, transform 0.25s 0.30s; }
  .fullscreen-menu.is-open .fs-nav a:nth-child(7) { transition: opacity 0.25s 0.35s, transform 0.25s 0.35s; }
}

/* =============================================
   粘性锚点条
   ============================================= */
.sticky-anchor-bar {
  position: sticky;
  top: var(--nav-h);
  z-index: 190;
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.sticky-anchor-bar::-webkit-scrollbar { height: 2px; }
.sticky-anchor-bar::-webkit-scrollbar-thumb { background: var(--border); }

.sticky-anchor-bar nav p {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  width: max-content;
  min-width: 100%;
  justify-content: center;
}

.sticky-anchor-bar a {
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--mid);
  padding: 0 1rem;
  height: var(--anchor-h);
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  min-height: 40px;
  letter-spacing: 0.04em;
  transition: background 0.12s, color 0.12s;
}

.sticky-anchor-bar a:last-child { border-right: none; }

.sticky-anchor-bar a:hover {
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
}

/* scroll-margin for sections */
section[id] {
  scroll-margin-top: calc(var(--nav-h) + var(--anchor-h) + 8px);
}

/* =============================================
   Hero
   ============================================= */
.hero-section {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  padding-top: calc(var(--nav-h) + var(--anchor-h));
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
  overflow: hidden;
}

.hero-figure {
  flex: 0 0 50%;
  max-width: 50%;
  margin: 0;
  overflow: hidden;
  background: var(--paper);
  border-right: 1.5px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-figure .hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) saturate(0.9);
}

/* 若无图片，显示手绘风装饰 */
.hero-figure:empty::after,
.hero-figure > :not(img):only-child {
  content: '';
}

.hero-figure .sketch-placeholder {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 18px,
      rgba(74,74,74,0.07) 18px,
      rgba(74,74,74,0.07) 19px
    );
}

.hero-aside {
  flex: 0 0 50%;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 4rem;
  text-align: center;
}

.hero-h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  position: relative;
  transform: rotate(-0.4deg);
}

.hero-sub {
  font-size: 1rem;
  color: var(--mid);
  max-width: 34ch;
  margin-bottom: 2rem;
  line-height: 1.75;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.85rem 2rem;
  min-height: 44px;
  background: var(--ink);
  color: var(--bg);
  border: 2px solid var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

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

/* =============================================
   主内容区
   ============================================= */
.site-main {
  flex: 1;
  padding: 0;
}

.content-section {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "aside figure"
    "aside body";
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem 5rem;
  gap: 0 3rem;
}

.content-aside {
  grid-area: aside;
  position: sticky;
  top: calc(var(--nav-h) + var(--anchor-h) + 1.5rem);
  align-self: start;
  border: 1.5px solid var(--ink);
  padding: 1.5rem;
  background: var(--paper);
  transform: rotate(-0.3deg);
}

.aside-tag {
  font-family: var(--font-sans);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.aside-note {
  font-size: 0.9rem;
  color: var(--mid);
  line-height: 1.6;
}

.content-figure {
  grid-area: figure;
  margin: 0 0 1.5rem 0;
  height: 3px;
  overflow: visible;
}

.sketch-deco {
  width: 100%;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0,
    var(--ink) 6px,
    transparent 6px,
    transparent 12px
  );
  opacity: 0.5;
  transform: rotate(-0.2deg);
}

.content-body {
  grid-area: body;
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--ink);
  line-height: 1.8;
  min-width: 0;
}

/* 正文内 div 样式 */
.content-body div {
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.content-body div:first-child { padding-top: 0; }
.content-body div:last-child { border-bottom: none; }

.content-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
  transform: rotate(-0.2deg);
  display: inline-block;
}

.content-body h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2vw, 1.45rem);
  font-weight: 600;
  margin: 1.75rem 0 0.75rem;
}

.content-body p {
  margin-bottom: 1rem;
  max-width: 72ch;
}

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

.content-body li {
  margin-bottom: 0.4rem;
  max-width: 68ch;
}

.content-body a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

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

.content-body blockquote {
  border-left: 3px solid var(--ink);
  padding-left: 1.25rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: var(--mid);
}

.content-body strong { font-weight: 700; }
.content-body em { font-style: italic; }

/* FAQ 样式 */
.content-body dl {
  margin-bottom: 1rem;
}

.content-body dt {
  font-weight: 700;
  font-family: var(--font-serif);
  margin-top: 1.25rem;
  margin-bottom: 0.3rem;
  font-size: 1.05rem;
}

.content-body dd {
  margin-left: 0;
  color: var(--mid);
  max-width: 68ch;
  padding-left: 0.75rem;
  border-left: 2px solid var(--border);
}

/* 手绘风卡片（如果正文用到） */
.content-body .card {
  border: 1.5px solid var(--ink);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
  background: var(--paper);
  box-shadow: 4px 4px 0 rgba(26,26,26,0.12);
  border-radius: 0;
  transform: rotate(-0.15deg);
  transition: transform 0.15s, box-shadow 0.15s;
}

.content-body .card:hover {
  transform: rotate(0deg) translateY(-2px);
  box-shadow: 6px 6px 0 rgba(26,26,26,0.18);
}

/* =============================================
   页脚
   ============================================= */
.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  border-top: 1.5px solid var(--ink);
  background: var(--paper);
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-col {
  flex: 1;
  min-width: 120px;
}

.footer-col--center {
  text-align: center;
}

.footer-col--right {
  text-align: right;
}

.footer-col dt {
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mid);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.footer-col dd {
  font-size: 0.82rem;
  color: var(--mid);
  line-height: 1.5;
  margin: 0;
}

/* =============================================
   Stagger 列表动效
   ============================================= */
@media (prefers-reduced-motion: no-preference) {
  .content-body div {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }

  .content-body div.in-view {
    opacity: 1;
    transform: translateY(0);
  }

  .hero-h1 {
    animation: jitter 8s infinite;
  }

  @keyframes jitter {
    0%, 95%, 100% { transform: rotate(-0.4deg); }
    96%           { transform: rotate(-0.6deg) translateX(-1px); }
    97%           { transform: rotate(-0.2deg) translateX(1px); }
    98%           { transform: rotate(-0.5deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .content-body div { opacity: 1; transform: none; }
  .hero-h1 { animation: none; }
  html { scroll-behavior: auto; }
}

/* =============================================
   移动端响应
   ============================================= */
@media (max-width: 768px) {
  :root {
    --nav-h: 56px;
  }

  .site-header {
    padding: 0 1rem;
  }

  .nav-left, .nav-right {
    display: none;
  }

  .main-nav {
    justify-content: space-between;
  }

  .nav-brand {
    flex: 1;
    justify-content: flex-start;
  }

  .hero-section {
    flex-direction: column;
    min-height: 100vh;
  }

  .hero-figure {
    flex: 0 0 45vh;
    max-width: 100%;
    border-right: none;
    border-bottom: 1.5px solid var(--ink);
  }

  .hero-aside {
    flex: 1;
    max-width: 100%;
    padding: 2rem 1.5rem;
  }

  .hero-h1 {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }

  .content-section {
    grid-template-columns: 1fr;
    grid-template-areas:
      "figure"
      "aside"
      "body";
    padding: 2rem 1rem 3rem;
    gap: 1.5rem 0;
  }

  .content-aside {
    position: static;
    transform: none;
  }

  .sticky-anchor-bar nav p {
    justify-content: flex-start;
  }

  .site-footer {
    flex-direction: column;
    gap: 1rem;
  }

  .footer-col--center, .footer-col--right {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .hero-aside {
    padding: 1.5rem 1rem;
  }

  .hero-cta {
    width: 100%;
    justify-content: center;
  }

  .content-section {
    padding: 1.5rem 1rem 2.5rem;
  }
}

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