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

/* ===== 基础变量 ===== */
:root {
  --bg: #fdfbf7;
  --bg2: #f5f5f5;
  --ink: #1a1a1a;
  --ink2: #444;
  --ink3: #777;
  --border: #1a1a1a;
  --border-light: #d0cdc8;
  --font: 'JetBrains Mono', 'Courier New', Courier, monospace;
  --max-w: 1080px;
  --gap: 1.5rem;
}

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

html { font-size: 16px; scroll-behavior: auto; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
  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='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
a:hover { text-decoration: none; }
ul, ol { list-style: none; }

/* ===== 全屏遮罩导航 ===== */
.site-nav {
  position: fixed;
  inset: 0;
  background: var(--ink);
  color: var(--bg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 3rem 2rem;
  transform: translateX(-100%);
  transition: none;
}

.site-nav.is-open {
  transform: translateX(0);
}

.site-nav nav ul {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.site-nav nav ul li a {
  display: block;
  color: var(--bg);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 500;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(253,251,247,0.15);
  letter-spacing: 0.02em;
}

.site-nav nav ul li a:hover {
  background: rgba(253,251,247,0.05);
  padding-left: 0.5rem;
}

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.5);
  z-index: 190;
}

.nav-overlay.is-open {
  display: block;
}

/* ===== 顶部 Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}

.header-brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.brand-link {
  font-size: 1.05rem;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.03em;
  color: var(--ink);
}

.brand-link:hover { text-decoration: underline; }

.nav-toggle {
  background: none;
  border: 1px solid var(--ink);
  cursor: pointer;
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 40px;
  min-width: 40px;
  align-items: center;
  justify-content: center;
}

.hamburger-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
}

.header-contact-row {
  padding: 0.45rem 1.5rem;
  font-size: 0.8rem;
  color: var(--ink3);
  display: flex;
  align-items: center;
  gap: 1rem;
  overflow: hidden;
  white-space: nowrap;
}

.breadcrumb { font-size: 0.8rem; color: var(--ink3); overflow: hidden; text-overflow: ellipsis; }
.breadcrumb a { color: var(--ink3); }
.bc-sep { margin: 0 0.3em; }

.header-desc { font-size: 0.8rem; color: var(--ink3); }

/* ===== 首页 ===== */
.home-main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

/* Hero */
.hero-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--gap);
  min-height: 45vh;
  align-items: center;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
}

.hero-figure { grid-column: 2; grid-row: 1; }

.hero-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 120px 80px;
  gap: 6px;
  height: 100%;
}

.hero-tile {
  border: 1px solid var(--ink);
  display: flex;
  align-items: flex-end;
  padding: 0.4rem 0.5rem;
  background: var(--bg2);
  position: relative;
}

.hero-tile-a { grid-column: 1; grid-row: 1 / 3; background: var(--ink); }
.hero-tile-b { grid-column: 2; grid-row: 1; }

.hero-badge {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  border: 1px solid currentColor;
  padding: 0.15em 0.4em;
}

.hero-tile-a .hero-badge { color: var(--bg); border-color: var(--bg); }
.hero-tile-b .hero-badge { color: var(--ink); }

.hero-aside { grid-column: 1; grid-row: 1; }
.hero-h1 { font-size: 1.5rem; font-weight: 500; line-height: 1.3; margin-bottom: 0.75rem; letter-spacing: -0.01em; }
.hero-sub { font-size: 0.9rem; color: var(--ink2); margin-bottom: 1.25rem; line-height: 1.6; }

.btn-primary {
  display: inline-block;
  background: var(--ink);
  color: var(--bg);
  text-decoration: none;
  padding: 0.6rem 1.4rem;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  border: 1px solid var(--ink);
  min-height: 40px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.btn-primary:hover { background: var(--bg); color: var(--ink); }

/* Content section */
.content-section { margin-bottom: 2.5rem; }
.section-deco { border-left: 3px solid var(--ink); padding-left: 0.75rem; margin-bottom: 1rem; }
.deco-label { font-size: 0.7rem; letter-spacing: 0.15em; color: var(--ink3); font-weight: 500; text-transform: uppercase; }

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  border: 1px solid var(--ink);
  margin-top: 1.5rem;
}

.card {
  border-right: 1px solid var(--ink);
  padding: 1.25rem;
  background: var(--bg);
}

.card:last-child { border-right: none; }

.card h3 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.4rem; }
.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .subtitle { font-size: 0.78rem; color: var(--ink2); line-height: 1.5; margin-bottom: 0.5rem; }
.card-count { font-size: 0.7rem; color: var(--ink3); letter-spacing: 0.05em; }

/* Recent section */
.recent-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--gap);
  border-top: 1px solid var(--border-light);
  padding-top: 2rem;
}

.recent-aside { grid-column: 1; }
.recent-deco { grid-column: 2; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-light); }
.deco-index { font-size: 3rem; color: var(--border-light); font-weight: 500; letter-spacing: 0.2em; writing-mode: vertical-rl; }

.recent-aside h2 { font-size: 1rem; font-weight: 500; margin-bottom: 0.3rem; letter-spacing: 0.03em; }

/* ===== DL 列表 ===== */
.recent-list, .entry-list {
  display: grid;
  gap: 0;
  border-top: 1px solid var(--border-light);
  margin-top: 1rem;
}

.recent-list dt, .entry-list dt {
  padding: 0.6rem 0 0.1rem;
  border-top: 1px solid var(--border-light);
  font-size: 0.9rem;
  font-weight: 500;
}

.recent-list dt:first-child, .entry-list dt:first-child { border-top: none; }

.recent-list dt a, .entry-list dt a { text-decoration: none; }
.recent-list dt a:hover, .entry-list dt a:hover { text-decoration: underline; }

.recent-list dd, .entry-list dd {
  font-size: 0.78rem;
  color: var(--ink2);
  padding: 0 0 0.6rem;
  line-height: 1.5;
}

.entry-date { color: var(--ink3); font-size: 0.72rem; }

/* ===== 分类页 ===== */
.cat-main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

.cat-hero-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--gap);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
  align-items: center;
}

.cat-hero-figure {
  width: 80px;
  height: 80px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  flex-shrink: 0;
}

.cat-deco-label {
  font-size: 0.6rem;
  color: var(--bg);
  font-weight: 500;
  letter-spacing: 0.08em;
  writing-mode: vertical-rl;
  text-align: center;
  padding: 0.2em;
  word-break: break-all;
}

.cat-hero-aside h1 { font-size: 1.4rem; font-weight: 500; margin-bottom: 0.4rem; }
.cat-hero-aside .subtitle { font-size: 0.88rem; color: var(--ink2); margin-bottom: 0.5rem; }
.entry-count { font-size: 0.75rem; color: var(--ink3); letter-spacing: 0.05em; }

.cat-content-section { margin-bottom: 2rem; }

.cat-list-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--gap);
}

.cat-sidebar { border-right: 1px solid var(--border-light); padding-right: 1.5rem; }
.cat-sidebar h2 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; letter-spacing: 0.05em; border-bottom: 1px solid var(--ink); padding-bottom: 0.3rem; }

.cat-list-figure { padding: 0; }
.cat-list-figure h2 { font-size: 0.95rem; font-weight: 500; margin-bottom: 0.3rem; }

/* ===== 词条页 ===== */
.entry-main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

.entry-header-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--gap);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
  align-items: start;
}

.entry-id-figure {
  width: 60px;
  min-height: 100px;
  border: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  flex-shrink: 0;
}

.entry-id-deco {
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--ink3);
  writing-mode: vertical-rl;
  word-break: break-all;
}

.entry-header-aside h1 { font-size: 1.3rem; font-weight: 500; margin-bottom: 0.4rem; line-height: 1.4; }
.entry-header-aside .subtitle { font-size: 0.88rem; color: var(--ink2); margin-bottom: 0.6rem; }

.entry-dates { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.4rem; }
.date-item { font-size: 0.75rem; color: var(--ink3); }

.entry-body-section { margin-bottom: 2rem; }

.entry-sidebar-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--gap);
  border-top: 1px solid var(--border-light);
  padding-top: 1.5rem;
}

.entry-sidebar { border-right: 1px solid var(--border-light); padding-right: 1.5rem; }
.entry-sidebar h2 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; letter-spacing: 0.05em; border-bottom: 1px solid var(--ink); padding-bottom: 0.3rem; margin-top: 1.25rem; }
.entry-sidebar h2:first-child { margin-top: 0; }
.aside-h2 { margin-top: 1.5rem !important; }

.entry-nav-figure h2 { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; }

/* 标签 */
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 1.5rem; }
.tag-chip {
  display: inline-block;
  border: 1px solid var(--ink);
  padding: 0.2em 0.55em;
  font-size: 0.72rem;
  text-decoration: none;
  letter-spacing: 0.04em;
  background: var(--bg2);
  min-height: 28px;
  line-height: 1.6;
}
.tag-chip:hover { background: var(--ink); color: var(--bg); }

/* ===== 标签页 ===== */
.tag-main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

.tag-header-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--gap);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
  align-items: center;
}

.tag-deco-figure {
  width: 70px;
  height: 70px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tag-deco-mark { font-size: 2.5rem; font-weight: 500; color: var(--ink); line-height: 1; }

.tag-header-aside h1 { font-size: 1.3rem; font-weight: 500; margin-bottom: 0.4rem; }
.tag-content-section { margin-bottom: 2rem; }

.tag-list-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--gap);
}

.tag-sidebar { border-right: 1px solid var(--border-light); padding-right: 1.5rem; }
.tag-sidebar h2 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; border-bottom: 1px solid var(--ink); padding-bottom: 0.3rem; margin-top: 1.25rem; }
.tag-sidebar h2:first-child { margin-top: 0; }

.tag-entries-figure h2 { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; }

/* ===== about/privacy ===== */
.about-main, .privacy-main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  position: relative;
  z-index: 1;
}

.about-header-section, .privacy-header-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--gap);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
  align-items: center;
}

.about-deco-figure, .privacy-deco-figure {
  width: 80px;
  height: 80px;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  flex-shrink: 0;
}

.about-deco-text, .privacy-deco-text {
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.15em;
  color: var(--ink3);
}

.about-header-aside h1, .privacy-header-aside h1 { font-size: 1.3rem; font-weight: 500; margin-bottom: 0.4rem; }
.policy-date { font-size: 0.78rem; color: var(--ink3); margin-top: 0.4rem; }

.about-content-section, .privacy-content-section { margin-bottom: 2rem; }

.about-nav-section, .privacy-extra-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--gap);
  border-top: 1px solid var(--border-light);
  padding-top: 1.5rem;
}

.about-sidebar, .privacy-sidebar { border-right: 1px solid var(--border-light); padding-right: 1.5rem; }
.about-sidebar h2, .privacy-sidebar h2, .tag-sidebar h2 { font-size: 0.85rem; font-weight: 500; }
.about-info-figure h2, .privacy-notice-figure h2 { font-size: 0.9rem; font-weight: 500; margin-bottom: 0.3rem; }

/* ===== default ===== */
.default-main { max-width: var(--max-w); margin: 0 auto; padding: 0 1.5rem 3rem; position: relative; z-index: 1; }

.default-header-section {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--gap);
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2rem;
  align-items: center;
}

.default-deco-figure {
  width: 60px;
  height: 60px;
  border: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  flex-shrink: 0;
}

.default-header-aside h1 { font-size: 1.3rem; font-weight: 500; margin-bottom: 0.4rem; }
.default-content-section { margin-bottom: 2rem; }
.default-nav-section {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--gap);
}
.default-sidebar { border-right: 1px solid var(--border-light); padding-right: 1.5rem; }
.default-sidebar h2 { font-size: 0.85rem; font-weight: 500; margin-bottom: 0.3rem; }

/* ===== 侧边栏通用 ===== */
.aside-links { display: flex; flex-direction: column; gap: 0; margin-top: 0.5rem; }
.aside-links li { border-bottom: 1px solid var(--border-light); }
.aside-links li:first-child { border-top: 1px solid var(--border-light); }
.aside-links li a {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--ink);
  min-height: 40px;
  line-height: 1.3;
  display: flex;
  align-items: center;
}
.aside-links li a:hover { text-decoration: underline; }

/* ===== 正文内容 ===== */
.page-content {
  font-size: 0.95rem;
  line-height: 1.8;
  color: var(--ink);
}

.page-content h2 { font-size: 1.05rem; font-weight: 500; margin: 1.5rem 0 0.4rem; border-bottom: 1px solid var(--border-light); padding-bottom: 0.3rem; letter-spacing: 0.02em; }
.page-content h3 { font-size: 0.95rem; font-weight: 500; margin: 1.2rem 0 0.3rem; }
.page-content p { margin-bottom: 0.9rem; }
.page-content ul, .page-content ol { margin: 0.8rem 0 0.8rem 1.2rem; }
.page-content ul { list-style: disc; }
.page-content ol { list-style: decimal; }
.page-content li { margin-bottom: 0.3rem; line-height: 1.7; }
.page-content a { color: var(--ink); }
.page-content strong { font-weight: 500; }
.page-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.88rem; }
.page-content th, .page-content td { border: 1px solid var(--border-light); padding: 0.45rem 0.7rem; text-align: left; }
.page-content th { background: var(--bg2); font-weight: 500; }
.page-content blockquote { border-left: 3px solid var(--ink); padding-left: 1rem; margin: 1rem 0; color: var(--ink2); font-style: italic; }
.page-content code { font-family: var(--font); background: var(--bg2); border: 1px solid var(--border-light); padding: 0.1em 0.35em; font-size: 0.88em; }
.page-content pre { background: var(--bg2); border: 1px solid var(--ink); padding: 1rem; overflow-x: auto; margin: 1rem 0; }
.page-content pre code { background: none; border: none; padding: 0; }

/* subtitle 通用 */
.subtitle { font-size: 0.82rem; color: var(--ink2); line-height: 1.5; margin-bottom: 0.6rem; }

/* 须知列表 */
.notice-list { margin: 0.8rem 0 0 1rem; list-style: none; }
.notice-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.85rem;
  line-height: 1.6;
  padding-left: 1em;
  position: relative;
}
.notice-list li::before { content: '▸'; position: absolute; left: 0; color: var(--ink3); }

/* ===== 页脚 ===== */
.site-footer {
  border-top: 2px solid var(--ink);
  background: var(--bg2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  z-index: 1;
}

.site-footer article { padding: 2rem 1.5rem; }

.footer-brand strong { display: block; font-size: 0.95rem; font-weight: 500; margin-bottom: 0.5rem; }
.footer-brand p { font-size: 0.8rem; color: var(--ink2); margin-bottom: 0.75rem; line-height: 1.6; }
.footer-brand a { font-size: 0.82rem; }

.footer-links { border-left: 1px solid var(--border-light); }
.footer-links nav ul { display: flex; flex-direction: column; gap: 0; margin-bottom: 1.5rem; }
.footer-links nav ul li { border-bottom: 1px solid var(--border-light); }
.footer-links nav ul li a {
  display: block;
  padding: 0.4rem 0;
  font-size: 0.8rem;
  text-decoration: none;
  min-height: 40px;
  display: flex;
  align-items: center;
}
.footer-links nav ul li a:hover { text-decoration: underline; }

.footer-copy { font-size: 0.75rem; color: var(--ink3); line-height: 1.5; }
.footer-copy a { color: var(--ink3); font-size: 0.75rem; }

/* ===== Stagger reveal ===== */
@media (prefers-reduced-motion: no-preference) {
  .card, .recent-list dt, .entry-list dt, .aside-links li {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  .card.revealed,
  .recent-list dt.revealed,
  .entry-list dt.revealed,
  .aside-links li.revealed {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== 响应式 ===== */
@media (max-width: 720px) {
  .hero-section { grid-template-columns: 1fr; min-height: auto; }
  .hero-figure { grid-column: 1; grid-row: 2; height: 160px; }
  .hero-aside { grid-column: 1; grid-row: 1; }
  .hero-collage { height: 100%; }

  .recent-section { grid-template-columns: 1fr; }
  .recent-deco { display: none; }

  .cat-list-section,
  .entry-sidebar-section,
  .tag-list-section,
  .about-nav-section,
  .privacy-extra-section,
  .default-nav-section { grid-template-columns: 1fr; }

  .cat-sidebar,
  .entry-sidebar,
  .tag-sidebar,
  .about-sidebar,
  .privacy-sidebar,
  .default-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    padding-right: 0;
    padding-bottom: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .site-footer { grid-template-columns: 1fr; }
  .footer-links { border-left: none; border-top: 1px solid var(--border-light); }

  .category-grid { grid-template-columns: 1fr 1fr; }
  .card { border-right: none; border-bottom: 1px solid var(--ink); }
  .card:last-child { border-bottom: none; }
}

@media (max-width: 480px) {
  .header-brand-row { padding: 0.75rem 1rem; }
  .header-contact-row { padding: 0.4rem 1rem; }
  .home-main, .cat-main, .entry-main, .tag-main,
  .about-main, .privacy-main, .default-main { padding: 0 1rem 2rem; }
  .site-footer article { padding: 1.5rem 1rem; }
  .hero-h1 { font-size: 1.2rem; }
  .category-grid { grid-template-columns: 1fr; }
  .entry-id-figure, .cat-hero-figure { display: none; }
  .cat-hero-section { grid-template-columns: 1fr; }
  .entry-header-section { grid-template-columns: 1fr; }
}
