@import url('https://fonts.googleapis.com/css2?family=Kalam:wght@400;700&family=Patrick+Hand&display=swap');

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 108px;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body.paper-body {
  background-color: #fdfbf7;
  color: #1a1a1a;
  font-family: 'Patrick Hand', 'Kalam', 'Noto Serif SC', Georgia, serif;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== 纸质纹理叠加 ===== */
.paper-texture {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-repeat: repeat;
  opacity: 0.6;
}

/* ===== 头部 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background-color: #fdfbf7;
  border-bottom: 2px solid #1a1a1a;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1.5rem;
  min-height: 56px;
}

.brand-corner {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  color: #1a1a1a;
  min-width: 40px;
  min-height: 40px;
}

.site-logo-mark {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.logo-text-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: #1a1a1a;
  color: #fdfbf7;
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 1.25rem;
  border-radius: 6px;
  flex-shrink: 0;
}

.main-nav {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.nav-pills-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: center;
  white-space: nowrap;
}

.nav-pill {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 1rem;
  border: 1.5px solid #1a1a1a;
  border-radius: 999px;
  text-decoration: none;
  color: #1a1a1a;
  font-family: 'Kalam', serif;
  font-size: 0.875rem;
  font-weight: 400;
  background-color: #fdfbf7;
  transition: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-pill:hover,
.nav-pill:focus-visible {
  background-color: #1a1a1a;
  color: #fdfbf7;
  outline: none;
}

/* ===== 粘性锚点条 ===== */
.sticky-anchors {
  position: sticky;
  top: 56px;
  z-index: 190;
  background-color: #f5f5f5;
  border-bottom: 1px solid #1a1a1a;
}

.anchors-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.anchors-inner::-webkit-scrollbar {
  display: none;
}

.anchor-pills-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.375rem;
  align-items: center;
  padding: 0.5rem 0;
  white-space: nowrap;
}

.anchor-pill {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.875rem;
  border: 1px solid #1a1a1a;
  border-radius: 999px;
  text-decoration: none;
  color: #1a1a1a;
  font-size: 0.8125rem;
  font-family: 'Patrick Hand', serif;
  background-color: transparent;
  transition: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.anchor-pill:hover,
.anchor-pill:focus-visible {
  background-color: #1a1a1a;
  color: #fdfbf7;
  outline: none;
}

/* ===== Hero 区块 ===== */
.hero-band {
  position: relative;
  min-height: 45vh;
  background-color: #fdfbf7;
  border-bottom: 2px solid #1a1a1a;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-collage {
  display: flex;
  gap: 0;
  align-items: stretch;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  position: relative;
  z-index: 2;
}

.hero-card {
  flex: 1;
  border: 2px solid #1a1a1a;
  border-radius: 10px;
  overflow: hidden;
  background-color: #fdfbf7;
  position: relative;
}

.hero-card-a {
  margin-right: -1.5rem;
  z-index: 2;
}

.hero-card-b {
  background-color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 220px;
  flex-shrink: 0;
  transform: translateY(1.5rem);
  z-index: 1;
}

.hero-card-inner {
  padding: 2rem 2rem 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  text-align: center;
}

.hero-card-inner-b {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 2rem 1.5rem;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-family: 'Kalam', serif;
  letter-spacing: 0.08em;
  color: #555;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.25rem;
  align-self: center;
}

.hero-title {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  line-height: 1.2;
  color: #1a1a1a;
}

.hero-sub {
  font-size: 0.9375rem;
  color: #444;
  max-width: 420px;
  margin: 0 auto;
  line-height: 1.6;
}

.hero-stamp {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 2rem;
  color: #fdfbf7;
  line-height: 1;
}

.hero-stamp-sub {
  font-family: 'Patrick Hand', serif;
  font-size: 0.875rem;
  color: #ccc;
  border-top: 1px solid #555;
  padding-top: 0.4rem;
  letter-spacing: 0.1em;
}

.hero-slash {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background-color: #1a1a1a;
  transform: skewY(-0.8deg);
  transform-origin: left;
  z-index: 1;
}

/* ===== 布局主容器 ===== */
.layout-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  position: relative;
  z-index: 1;
}

/* ===== 侧边栏（内容左侧）===== */
.side-rail {
  width: 220px;
  flex-shrink: 0;
  position: sticky;
  top: 108px;
}

.aside-inner {
  border: 1.5px solid #1a1a1a;
  border-radius: 10px;
  padding: 1.25rem 1rem;
  background-color: #f5f5f5;
}

.aside-heading {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #1a1a1a;
  margin-bottom: 0.25rem;
}

.aside-sub {
  font-size: 0.8125rem;
  color: #666;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.625rem;
}

.aside-toc {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.aside-toc-item {
  border-bottom: 1px solid #e8e8e0;
}

.aside-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.25rem;
  text-decoration: none;
  color: #1a1a1a;
  font-size: 0.875rem;
  min-height: 40px;
  transition: none;
}

.aside-link:hover,
.aside-link:focus-visible {
  background-color: #1a1a1a;
  color: #fdfbf7;
  border-radius: 4px;
  outline: none;
}

.aside-num {
  font-family: 'Kalam', serif;
  font-size: 0.75rem;
  color: #999;
  min-width: 20px;
  flex-shrink: 0;
}

.aside-link:hover .aside-num,
.aside-link:focus-visible .aside-num {
  color: #ccc;
}

.aside-name {
  flex: 1;
  line-height: 1.4;
}

.aside-divider {
  border-top: 1.5px solid #1a1a1a;
  margin: 0.875rem 0;
}

.aside-note {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.aside-note-text {
  font-size: 0.8125rem;
  color: #555;
  font-family: 'Kalam', serif;
}

/* ===== 主内容区 ===== */
.main-content {
  flex: 1;
  min-width: 0;
}

.page-article {
  width: 100%;
}

.content-section {
  width: 100%;
}

/* ===== 正文内容样式（page.content 里的 section 等）===== */
.content-section h2,
.page-article h2 {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 1.375rem;
  color: #1a1a1a;
  margin-top: 2.5rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid #1a1a1a;
  padding-bottom: 0.4rem;
}

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

.content-section p.subtitle,
.content-section p.subhead,
.content-section p.desc,
.content-section p.lead,
.page-article p.subtitle,
.page-article p.subhead,
.page-article p.desc,
.page-article p.lead {
  font-size: 0.9375rem;
  color: #555;
  margin-bottom: 1rem;
  font-style: italic;
}

.content-section p,
.page-article p {
  font-size: 1rem;
  line-height: 1.75;
  color: #1a1a1a;
  margin-bottom: 1rem;
  max-width: 68ch;
}

.content-section h3,
.page-article h3 {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 1.125rem;
  color: #1a1a1a;
  margin-top: 1.75rem;
  margin-bottom: 0.4rem;
}

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

.content-section li,
.page-article li {
  font-size: 1rem;
  line-height: 1.7;
  margin-bottom: 0.4rem;
  color: #1a1a1a;
}

.content-section a,
.page-article a {
  color: #1a1a1a;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.content-section a:hover,
.page-article a:hover {
  background-color: #1a1a1a;
  color: #fdfbf7;
  text-decoration: none;
}

.content-section section,
.page-article section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #e0e0e0;
  scroll-margin-top: 108px;
}

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

.content-section table,
.page-article table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}

.content-section th,
.content-section td,
.page-article th,
.page-article td {
  border: 1px solid #ccc;
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.content-section th,
.page-article th {
  background-color: #f5f5f5;
  font-family: 'Kalam', serif;
  font-weight: 700;
}

.content-section blockquote,
.page-article blockquote {
  border-left: 3px solid #1a1a1a;
  padding: 0.75rem 1rem;
  margin: 1.25rem 0;
  background-color: #f5f5f5;
  border-radius: 0 10px 10px 0;
  font-style: italic;
  color: #444;
}

/* ===== 卡片样式（正文中若有）===== */
.card {
  border: 1.5px solid #1a1a1a;
  border-radius: 10px;
  padding: 1.25rem 1.25rem 0.875rem;
  background-color: #fdfbf7;
  border-bottom: 4px solid #1a1a1a;
  margin-bottom: 1rem;
  transition: none;
}

.card:hover {
  background-color: #f5f5f5;
}

/* ===== 页脚 ===== */
.site-footer {
  background-color: #1a1a1a;
  color: #fdfbf7;
  margin-top: 3rem;
  position: relative;
  z-index: 1;
}

.footer-top {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 2rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}

.footer-col-title {
  font-family: 'Kalam', serif;
  font-weight: 700;
  font-size: 1rem;
  color: #fdfbf7;
  margin-bottom: 0.25rem;
}

.footer-col-sub {
  font-size: 0.8125rem;
  color: #888;
  margin-bottom: 1rem;
  border-bottom: 1px solid #333;
  padding-bottom: 0.5rem;
}

.footer-address {
  font-style: normal;
  font-size: 0.875rem;
  line-height: 1.8;
  color: #ccc;
}

.footer-address p {
  margin-bottom: 0.3rem;
  font-size: 0.875rem;
  color: #ccc;
  max-width: none;
}

.footer-link {
  color: #ccc;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-link:hover {
  color: #fdfbf7;
}

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

.footer-nav-list li a {
  display: block;
  padding: 0.35rem 0;
  min-height: 40px;
  display: flex;
  align-items: center;
  color: #ccc;
  text-decoration: none;
  font-size: 0.875rem;
  border-bottom: 1px solid #2a2a2a;
  transition: none;
}

.footer-nav-list li a:hover {
  color: #fdfbf7;
  padding-left: 0.5rem;
}

.footer-info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-info-list li {
  font-size: 0.875rem;
  color: #aaa;
  padding-left: 0.75rem;
  border-left: 2px solid #444;
  line-height: 1.5;
}

.footer-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer-form-label {
  font-size: 0.8125rem;
  color: #aaa;
}

.footer-form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  color: #fdfbf7;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
}

.footer-form-input:focus {
  border-color: #fdfbf7;
}

.footer-form-btn {
  padding: 0.6rem 1rem;
  min-height: 40px;
  background-color: #fdfbf7;
  color: #1a1a1a;
  border: none;
  border-radius: 999px;
  font-family: 'Kalam', serif;
  font-size: 0.9rem;
  cursor: pointer;
  transition: none;
}

.footer-form-btn:hover {
  background-color: #f5f5f5;
}

.footer-bottom {
  border-top: 1px solid #333;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.footer-copy {
  font-size: 0.8125rem;
  color: #888;
  line-height: 1.6;
}

.footer-copy-sub {
  font-size: 0.75rem;
  color: #555;
  margin-top: 0.2rem;
}

/* ===== 动效（stagger + hover，prefers-reduced-motion 关闭）===== */
@media (prefers-reduced-motion: no-preference) {
  .aside-toc-item {
    opacity: 0;
    transform: translateX(-8px);
    animation: slideInLeft 0.3s ease forwards;
  }

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

  @keyframes slideInLeft {
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  .nav-pill {
    position: relative;
    overflow: hidden;
  }

  .nav-pill::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: #1a1a1a;
    border-radius: 999px;
    transform: scaleX(0);
    transform-origin: left;
  }

  .hero-card {
    animation: cardDrop 0.4s ease forwards;
  }

  .hero-card-b {
    animation-delay: 0.15s;
    opacity: 0;
  }

  @keyframes cardDrop {
    from {
      opacity: 0;
      transform: translateY(12px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .hero-card-b {
    animation: cardDrop 0.4s 0.15s ease forwards;
    transform: translateY(1.5rem);
  }
}

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

/* ===== 响应式 ===== */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .side-rail {
    display: none;
  }

  .layout-wrap {
    padding: 1.5rem 1rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 0.5rem 1rem;
    min-height: 52px;
  }

  .anchors-inner {
    padding: 0 1rem;
  }

  html {
    scroll-padding-top: 100px;
  }

  .content-section section,
  .page-article section {
    scroll-margin-top: 100px;
  }

  .hero-collage {
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 1rem;
  }

  .hero-card-a {
    margin-right: 0;
  }

  .hero-card-b {
    max-width: 100%;
    transform: none;
    min-height: 80px;
  }

  .hero-band {
    min-height: auto;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .layout-wrap {
    padding: 1rem;
  }

  .footer-top {
    padding: 2rem 1rem 1.5rem;
  }

  .footer-bottom {
    padding: 1rem;
  }

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

@media (max-width: 400px) {
  .nav-pill {
    padding: 0 0.75rem;
    font-size: 0.8125rem;
  }

  .anchor-pill {
    padding: 0 0.625rem;
    font-size: 0.75rem;
  }
}

/* ===== 焦点可访问性 ===== */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #1a1a1a;
  outline-offset: 3px;
}

/* ===== 图片 ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* ===== 文字选中 ===== */
::selection {
  background-color: #1a1a1a;
  color: #fdfbf7;
}
