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

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

html {
  font-size: 17px;
  scroll-behavior: smooth;
}

body {
  background-color: #fafaf8;
  color: #4a4a4a;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  line-height: 1.65;
  min-height: 100vh;
  padding-bottom: 72px;
  /* paper texture overlay via pseudo */
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%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='400' height='400' filter='url(%23noise)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ===== 排版基础 ===== */
h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, 'Noto Serif SC', serif;
  color: #1a1a1a;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 700; margin-bottom: 0.6em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); font-weight: 600; margin-bottom: 0.5em; }
h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.4em; }

p { margin-bottom: 1em; }
a { color: #1a1a1a; text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: #4a4a4a; }

ul, ol { padding-left: 1.4em; margin-bottom: 1em; }
li { margin-bottom: 0.35em; }

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

/* ===== 眉题 small.eyebrow ===== */
small.eyebrow {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #4a4a4a;
  opacity: 0.65;
  margin-bottom: 0.3em;
}

/* ===== 底部固定导航条 ===== */
details.site-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #fafaf8;
  border-top: 1.5px solid #1a1a1a;
  /* hand-drawn feel: slight uneven border */
  box-shadow: 0 -1px 0 #4a4a4a40, 0 -3px 0 #fafaf8;
}

details.site-nav summary.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  height: 54px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

details.site-nav summary.nav-bar::-webkit-details-marker { display: none; }

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 0 0 auto;
}

.nav-brand a {
  text-decoration: none;
  color: #1a1a1a;
}

.nav-toggle-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #4a4a4a;
  border: 1px solid #4a4a4a;
  padding: 6px 14px;
  border-radius: 2px;
  /* slightly rotated for raw feel */
  transform: rotate(-0.5deg);
  display: inline-block;
  min-height: 40px;
  line-height: 28px;
}

details.site-nav[open] .nav-toggle-label {
  background: #1a1a1a;
  color: #fafaf8;
}

details.site-nav menu.nav-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 0.75rem 1rem 1rem;
  border-top: 1px dashed #4a4a4a50;
  list-style: none;
  background: #fafaf8;
  max-height: 60vh;
  overflow-y: auto;
}

details.site-nav menu.nav-menu li {
  margin: 0;
  padding: 0;
}

details.site-nav menu.nav-menu li a {
  display: block;
  padding: 10px 14px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  color: #1a1a1a;
  border-bottom: 1px solid transparent;
  min-height: 40px;
  line-height: 20px;
  white-space: nowrap;
}

details.site-nav menu.nav-menu li a:hover {
  border-bottom-color: #1a1a1a;
}

/* 桌面：展开式横排导航 */
@media (min-width: 768px) {
  details.site-nav {
    height: 56px;
    overflow: visible;
  }

  details.site-nav summary.nav-bar {
    justify-content: center;
    gap: 0;
    height: 56px;
  }

  .nav-brand {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.05rem;
  }

  .nav-toggle-label { display: none; }

  details.site-nav menu.nav-menu {
    position: absolute;
    bottom: 56px;
    left: 0;
    right: 0;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 2rem;
    border-top: 1px solid #1a1a1a;
    border-bottom: none;
    max-height: none;
    overflow: visible;
  }

  /* On desktop keep nav always visible */
  details.site-nav:not([open]) menu.nav-menu {
    display: none;
  }

  /* Auto-open on desktop via CSS (summary is still visible) */
  details.site-nav summary.nav-bar {
    display: flex;
    align-items: center;
  }

  details.site-nav menu.nav-menu li a {
    font-size: 0.8rem;
    padding: 8px 12px;
  }

  /* CTA on last nav link */
  details.site-nav menu.nav-menu li:last-child a {
    background: #1a1a1a;
    color: #fafaf8;
    border-radius: 2px;
    padding: 8px 16px;
  }
}

/* ===== main 容器 ===== */
main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

/* ===== Hero 区块 ===== */
.hero-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2rem 0 2.5rem;
  border-bottom: 1.5px solid #1a1a1a;
  margin-bottom: 2.5rem;
  min-height: 40vh;
  align-items: flex-start;
}

@media (min-width: 768px) {
  .hero-section {
    flex-direction: row;
    align-items: center;
    gap: 3rem;
    min-height: 45vh;
  }

  .hero-text {
    flex: 0 0 55%;
  }

  .hero-media {
    flex: 0 0 40%;
  }
}

.hero-text {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hero-sub {
  font-size: 1rem;
  color: #4a4a4a;
  line-height: 1.6;
  max-width: 480px;
  margin-bottom: 0.5rem;
}

.hero-img {
  width: 100%;
  height: auto;
  border: 1.5px solid #1a1a1a;
  transform: rotate(0.8deg);
  filter: contrast(1.04);
}

/* ===== CTA 按钮 ===== */
.cta-btn {
  display: inline-block;
  background: #1a1a1a;
  color: #fafaf8 !important;
  text-decoration: none;
  padding: 12px 28px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  border-radius: 2px;
  transform: rotate(-0.4deg);
  transition: none;
  border: 2px solid #1a1a1a;
  min-height: 44px;
  line-height: 20px;
  align-self: flex-start;
}

.cta-btn:hover {
  background: #fafaf8;
  color: #1a1a1a !important;
  transform: rotate(0.3deg);
}

.cta-sm {
  padding: 8px 18px;
  font-size: 0.8rem;
  min-height: 40px;
}

/* ===== 内容区双栏布局 ===== */
.content-section {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding: 2rem 0;
}

@media (min-width: 768px) {
  .content-section {
    flex-direction: row;
    gap: 3rem;
    align-items: flex-start;
  }

  .sidebar {
    flex: 0 0 220px;
    order: -1;
  }

  .main-content {
    flex: 1 1 0;
    min-width: 0;
  }
}

/* ===== 侧边栏 ===== */
.sidebar {
  border: 1.5px solid #1a1a1a;
  padding: 1.25rem 1rem;
  transform: rotate(-0.3deg);
  background: #fafaf8;
  position: relative;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 6px;
  right: -3px;
  bottom: -3px;
  border: 1px solid #4a4a4a40;
  z-index: -1;
}

.sidebar h3 {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px dashed #4a4a4a60;
  padding-bottom: 0.4rem;
}

.sidebar-links {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
}

.sidebar-links li {
  border-bottom: 1px solid #4a4a4a18;
  margin: 0;
}

.sidebar-links li a {
  display: block;
  padding: 8px 0;
  font-size: 0.82rem;
  text-decoration: none;
  color: #1a1a1a;
  min-height: 40px;
  line-height: 24px;
}

.sidebar-links li a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sidebar-cta {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #4a4a4a40;
}

/* ===== 正文 prose ===== */
.prose {
  font-size: 1rem;
  line-height: 1.75;
  color: #4a4a4a;
  max-width: 72ch;
}

.prose h2 {
  margin-top: 1.8em;
  margin-bottom: 0.5em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid #1a1a1a30;
}

.prose h3 {
  margin-top: 1.4em;
  margin-bottom: 0.4em;
}

.prose ul, .prose ol {
  margin-bottom: 1em;
}

.prose a {
  color: #1a1a1a;
  font-weight: 500;
}

.prose img {
  margin: 1.5em 0;
  border: 1.5px solid #1a1a1a;
  transform: rotate(0.4deg);
  filter: contrast(1.03);
}

.prose blockquote {
  border-left: 3px solid #1a1a1a;
  padding: 0.75em 1.25em;
  margin: 1.5em 0;
  font-style: italic;
  font-family: 'Playfair Display', serif;
  color: #1a1a1a;
  background: #f0efe9;
}

/* ===== 页面头部 ===== */
.page-header-section {
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1.5px solid #1a1a1a;
  margin-bottom: 0;
}

.page-lead {
  font-size: 1rem;
  color: #4a4a4a;
  max-width: 60ch;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

/* ===== 面包屑 ===== */
.breadcrumb {
  font-size: 0.78rem;
  color: #4a4a4a;
  margin-bottom: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.breadcrumb a {
  color: #4a4a4a;
  text-decoration: none;
}

.breadcrumb a:hover { text-decoration: underline; }

.breadcrumb span { color: #4a4a4a80; }

/* ===== 文章元信息 ===== */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.art-date {
  font-size: 0.78rem;
  color: #4a4a4a80;
  font-family: 'Inter', sans-serif;
}

/* ===== 文章 Hero 图 ===== */
.article-header-section {
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1.5px solid #1a1a1a;
  margin-bottom: 0;
}

.article-hero {
  margin-top: 1.25rem;
}

.article-hero-img {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border: 1.5px solid #1a1a1a;
  transform: rotate(-0.3deg);
  filter: contrast(1.03);
}

/* ===== 子页卡片 ===== */
.child-cards-section,
.child-listing {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1.5px dashed #4a4a4a50;
}

.child-cards-section h2,
.child-listing h2 {
  margin-bottom: 1.25rem;
}

.child-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 540px) {
  .child-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .child-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

a.child-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1rem 1rem;
  border: 1.5px solid #1a1a1a;
  border-radius: 18px;
  text-decoration: none;
  color: #1a1a1a;
  background: #fafaf8;
  position: relative;
  transform: rotate(0deg);
  transition: none;
  /* bottom emphasis line */
  border-bottom-width: 3px;
}

a.child-card::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 8px;
  right: -4px;
  height: 100%;
  border: 1.5px solid #4a4a4a30;
  border-radius: 18px;
  z-index: -1;
}

a.child-card:hover {
  transform: rotate(-0.5deg) translate(-1px, -1px);
  border-color: #1a1a1a;
}

a.child-card strong {
  display: block;
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a1a;
  line-height: 1.35;
}

.card-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border: 1px solid #4a4a4a30;
  filter: contrast(1.02);
}

.card-desc {
  font-size: 0.82rem;
  color: #4a4a4a;
  line-height: 1.55;
  flex: 1;
}

/* ===== 文章卡片列表 ===== */
.articles-section {
  padding: 2.5rem 0;
  border-top: 1.5px solid #1a1a1a;
  margin-top: 2rem;
}

.articles-section h2 {
  margin-bottom: 1.25rem;
}

.article-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 540px) {
  .article-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .article-cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

a.article-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem;
  border: 1.5px solid #1a1a1a;
  border-radius: 18px;
  border-bottom-width: 3px;
  text-decoration: none;
  color: #1a1a1a;
  background: #fafaf8;
  position: relative;
}

a.article-card::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 8px;
  right: -4px;
  height: 100%;
  border: 1.5px solid #4a4a4a25;
  border-radius: 18px;
  z-index: -1;
}

a.article-card:hover {
  transform: translate(-1px, -1px);
}

a.article-card strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: 'Playfair Display', serif;
  color: #1a1a1a;
  line-height: 1.35;
}

.art-excerpt {
  font-size: 0.8rem;
  color: #4a4a4a;
  line-height: 1.55;
  flex: 1;
}

a.article-card .art-date {
  font-size: 0.72rem;
  color: #4a4a4a70;
}

/* ===== About 页特殊布局 ===== */
.about-header {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (min-width: 600px) {
  .about-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.about-title-block {
  flex: 1;
}

.about-sketch-deco {
  flex: 0 0 auto;
  opacity: 0.45;
  transform: rotate(5deg);
}

/* ===== 隐私页 ===== */
.privacy-prose h2 {
  font-size: 1.2rem;
  margin-top: 2em;
}

/* ===== 页脚 ===== */
footer {
  text-align: center;
  padding: 3rem 1rem 5rem;
  border-top: 1.5px solid #1a1a1a;
  position: relative;
  z-index: 1;
}

footer p.footer-brand {
  font-family: 'Playfair Display', serif;
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 1rem;
  opacity: 0.88;
}

footer small {
  display: block;
  font-size: 0.78rem;
  color: #4a4a4a;
  line-height: 1.7;
}

footer small a {
  color: #4a4a4a;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ===== Scroll Reveal ===== */
@media (prefers-reduced-motion: no-preference) {
  .child-card,
  .article-card,
  .prose > *,
  .sidebar {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.4s ease, transform 0.4s ease;
  }

  .child-card.revealed,
  .article-card.revealed,
  .prose > *.revealed,
  .sidebar.revealed {
    opacity: 1;
    transform: translateY(0);
  }

  /* Override card hover when revealed */
  a.child-card.revealed:hover {
    transform: rotate(-0.5deg) translate(-1px, -1px);
  }

  a.article-card.revealed:hover {
    transform: translate(-1px, -1px);
  }
}

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

/* ===== 移动端修正 ===== */
@media (max-width: 540px) {
  main {
    padding: 1rem 0.875rem 2.5rem;
  }

  .hero-section {
    padding: 1.5rem 0 2rem;
    min-height: auto;
  }

  .content-section {
    padding: 1.5rem 0;
  }

  .sidebar {
    transform: none;
  }

  a.child-card, a.article-card {
    transform: none !important;
  }

  details.site-nav menu.nav-menu li a {
    font-size: 0.85rem;
    padding: 12px 16px;
    min-height: 44px;
  }
}

/* ===== 手绘装饰线条 ===== */
.sketch-line {
  display: block;
  width: 100%;
  height: 2px;
  background: none;
  border: none;
  border-top: 1.5px solid #1a1a1a;
  opacity: 0.3;
  transform: rotate(-0.2deg) scaleX(0.98);
  margin: 1.5rem 0;
}

/* ===== 无横向滚动保障 ===== */
body, main, section, article, .content-section, .hero-section {
  max-width: 100%;
  overflow-x: hidden;
}
