@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@300;400;500;600;700&family=Share+Tech+Mono&display=swap');

/* ===== CSS 变量 ===== */
:root {
  --bg: #f5e6c8;
  --accent: #d4a574;
  --dark: #262117;
  --bg-dark: #1a160e;
  --text: #262117;
  --text-muted: #6b5a3e;
  --border: #c8a96e;
  --card-bg: #ede0c4;
  --font-mono: 'Share Tech Mono', 'Fira Code', 'Courier New', monospace;
  --radius: 10px;
  --max-w: 1100px;
  --sidebar-w: 260px;
  --gap: 1.5rem;
  --transition: 0.3s ease;
}

/* ===== 重置 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ===== Film Grain 纹理 ===== */
.grain-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='grain'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23grain)'/%3E%3C/svg%3E");
  background-size: 120px 120px;
  mix-blend-mode: multiply;
  animation: grain-drift 8s steps(2) infinite;
}

@keyframes grain-drift {
  0%   { transform: translate(0,0); }
  25%  { transform: translate(-1px, 2px); }
  50%  { transform: translate(2px,-1px); }
  75%  { transform: translate(-2px, 1px); }
  100% { transform: translate(0,0); }
}

/* ===== Light Leak 叠加 ===== */
.light-leak {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9997;
  background:
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(212,165,116,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 5% 80%, rgba(245,230,200,0.12) 0%, transparent 50%);
  mix-blend-mode: screen;
  animation: light-leak-pulse 12s ease-in-out infinite alternate;
}

@keyframes light-leak-pulse {
  0%   { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ===== 顶部公告条 ===== */
.top-bar {
  background: var(--dark);
  color: var(--accent);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  padding: 0 1.5rem;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid rgba(212,165,116,0.3);
}

.top-bar-slogan { flex: 1; }

/* ===== 汉堡按钮 ===== */
.hamburger {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 8px;
  min-height: 40px;
  min-width: 40px;
}

.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--accent);
  transition: var(--transition);
}

.hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.hamburger.active span:nth-child(2) { opacity: 0; }
.hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ===== 全屏遮罩菜单 ===== */
.overlay-menu {
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 14, 0.97);
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.overlay-menu.open {
  opacity: 1;
  pointer-events: auto;
}

.overlay-menu nav ul {
  list-style: none;
  text-align: center;
}

.overlay-menu nav ul li {
  margin: 0.6rem 0;
}

.overlay-menu nav ul li a {
  color: var(--bg);
  text-decoration: none;
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  letter-spacing: 0.08em;
  display: block;
  padding: 0.5rem 2rem;
  min-height: 44px;
  line-height: 44px;
  transition: color var(--transition);
}

.overlay-menu nav ul li a:hover,
.overlay-menu nav ul li a[aria-current="page"] {
  color: var(--accent);
}

.menu-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.4rem 0.7rem;
  min-height: 40px;
  min-width: 40px;
  font-family: var(--font-mono);
  transition: background var(--transition);
}
.menu-close:hover { background: var(--accent); color: var(--dark); }

/* ===== 侧边导航 aside（桌面隐藏，结构保留契约） ===== */
.site-nav-aside {
  display: none;
}

/* ===== 页面整体包裹 ===== */
.page-wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1rem;
}

/* ===== 内容布局：主区 + 侧边栏 ===== */
.content-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
  padding: 2rem 0;
}

@media (min-width: 768px) {
  .content-layout {
    grid-template-columns: 1fr var(--sidebar-w);
    align-items: start;
  }
}

/* ===== 侧边栏 ===== */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.sidebar-block {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem;
  border: 1px solid var(--border);
}

.sidebar-block h3 {
  font-size: 0.8rem;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-block h3 span { display: inline-block; }

.sidebar-block nav ul {
  list-style: none;
}

.sidebar-block nav ul li {
  border-bottom: 1px solid rgba(200,169,110,0.3);
}

.sidebar-block nav ul li:last-child { border-bottom: none; }

.sidebar-block nav ul li a {
  display: block;
  padding: 0.5rem 0;
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
  min-height: 40px;
  line-height: 40px;
  transition: color var(--transition);
}

.sidebar-block nav ul li a:hover { color: var(--accent); }

/* ===== main > article > section 结构 ===== */
main { min-width: 0; }
article { min-width: 0; }
section { min-width: 0; }

/* ===== 面包屑 ===== */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  letter-spacing: 0.05em;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}
.breadcrumb a:hover { text-decoration: underline; }

/* ===== 日期 ===== */
.date-row { margin-top: 0.6rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.pub-date, .mod-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ===== Hero（首页） ===== */
.home-hero {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 1rem;
  position: relative;
}

.hero-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1.2rem;
  border: 1px solid var(--border);
  padding: 0.3rem 0.8rem;
  display: inline-block;
  border-radius: 2px;
}

.hero-title {
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--dark);
  margin-bottom: 1.2rem;
  max-width: 16ch;
  text-shadow: 2px 2px 0 rgba(212,165,116,0.3);
}

.hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 48ch;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary {
  background: var(--dark);
  color: var(--bg);
  text-decoration: none;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.btn-primary:hover { background: var(--accent); color: var(--dark); }

.btn-ghost {
  border: 1px solid var(--dark);
  color: var(--dark);
  text-decoration: none;
  padding: 0.75rem 1.8rem;
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  transition: background var(--transition), color var(--transition);
}
.btn-ghost:hover { background: var(--dark); color: var(--bg); }

/* ===== 首页各区块 ===== */
.home-content-section,
.home-topics,
.home-recent {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.home-topics h2,
.home-recent h2,
.topic-children h2,
.tag-list-section h2,
.about-nav-section h2 {
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.home-topics h2 span,
.home-recent h2 span,
.topic-children h2 span,
.tag-list-section h2 span,
.about-nav-section h2 span { display: inline-block; }

/* ===== 话题卡片网格 ===== */
.topic-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.topic-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.topic-card a {
  display: block;
  padding: 1.2rem;
  text-decoration: none;
  color: var(--text);
  height: 100%;
  transition: background var(--transition);
}
.topic-card a:hover { background: rgba(212,165,116,0.2); }

.topic-card h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--dark);
}
.topic-card h3 span { display: inline-block; }

.topic-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ===== 文章列表 ===== */
.article-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.article-card {
  border-bottom: 1px solid rgba(200,169,110,0.4);
}

.article-card a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0;
  text-decoration: none;
  color: var(--text);
  min-height: 44px;
  transition: color var(--transition);
}
.article-card a:hover { color: var(--accent); }

.card-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.article-card time {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.view-more {
  display: inline-block;
  margin-top: 1.2rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  min-height: 40px;
  line-height: 40px;
  padding: 0 0.5rem;
  transition: letter-spacing var(--transition);
}
.view-more:hover { letter-spacing: 0.2em; }

/* ===== 栏目页 ===== */
.topic-header,
.article-header,
.privacy-header,
.tag-header,
.about-header {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.topic-header h1,
.article-header h1,
.privacy-header h1,
.tag-header h1,
.about-header h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.2;
  color: var(--dark);
  margin-top: 0.5rem;
  letter-spacing: -0.01em;
}

.page-hero {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.page-h1 {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.2;
  color: var(--dark);
}

/* ===== 文章元信息 ===== */
.article-meta {
  margin-top: 0.75rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.tag-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tag-link {
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  transition: background var(--transition), color var(--transition);
}
.tag-link:hover { background: var(--accent); color: var(--dark); }

/* ===== 正文区 ===== */
.page-body {
  line-height: 1.8;
  font-size: 1rem;
  color: var(--text);
}

.page-body h2 {
  font-size: 1.3rem;
  margin: 2rem 0 0.8rem;
  color: var(--dark);
  border-left: 3px solid var(--accent);
  padding-left: 0.75rem;
}
.page-body h2 span { display: inline-block; }

.page-body h3 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.6rem;
  color: var(--dark);
}
.page-body h3 span { display: inline-block; }

.page-body p { margin-bottom: 1rem; }

.page-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.page-body a:hover { color: var(--dark); }

.page-body ul, .page-body ol {
  margin: 0.8rem 0 1rem 1.4rem;
}
.page-body li { margin-bottom: 0.4rem; }

.page-body blockquote {
  border-left: 3px solid var(--accent);
  margin: 1.5rem 0;
  padding: 0.8rem 1.2rem;
  background: var(--card-bg);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.page-body code {
  background: var(--card-bg);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.page-body pre {
  background: var(--dark);
  color: var(--bg);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
}

.page-body img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

/* ===== 子页列表（栏目页 ol > li > a + small） ===== */
.children-list {
  list-style: none;
  counter-reset: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.children-list li {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.children-list li a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  min-height: 40px;
  font-size: 0.95rem;
  transition: color var(--transition);
}
.children-list li a:hover { color: var(--accent); }

.item-num {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: 600;
  min-width: 2ch;
}

.item-title { flex: 1; }

.children-list li small {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  padding-left: calc(2ch + 0.75rem);
}

/* ===== 标签页列表（ol > li > a + small） ===== */
.tag-article-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.tag-article-list li {
  border-bottom: 1px solid rgba(200,169,110,0.4);
  padding: 0.7rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.tag-article-list li a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
  min-height: 40px;
  line-height: 40px;
  display: block;
  transition: color var(--transition);
}
.tag-article-list li a:hover { color: var(--accent); }

.tag-article-list li small {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.tag-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* ===== 返回链接 ===== */
.article-back {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  transition: letter-spacing var(--transition);
}
.back-link:hover { letter-spacing: 0.15em; }

/* ===== 关于页导航列表 ===== */
.about-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.about-nav-list li a {
  display: block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  min-height: 40px;
  line-height: 40px;
  border-bottom: 1px solid rgba(200,169,110,0.3);
  transition: color var(--transition);
}
.about-nav-list li a:hover { color: var(--dark); }

/* ===== 页脚（仅 p + small） ===== */
footer {
  text-align: center;
  padding: 3rem 1rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

footer p {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  letter-spacing: 0.05em;
  color: var(--dark);
  margin-bottom: 0.8rem;
}

.footer-brand { font-weight: 700; }

footer small {
  font-size: 0.78rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

footer small a {
  color: var(--accent);
  text-decoration: none;
  margin: 0 0.3rem;
}
footer small a:hover { text-decoration: underline; }

/* ===== Scroll Reveal 动效 ===== */
.reveal-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.reveal-item.visible {
  opacity: 1;
  transform: none;
}

/* 错开动画 */
.reveal-item:nth-child(2) { transition-delay: 0.1s; }
.reveal-item:nth-child(3) { transition-delay: 0.2s; }
.reveal-item:nth-child(4) { transition-delay: 0.3s; }
.reveal-item:nth-child(5) { transition-delay: 0.4s; }
.reveal-item:nth-child(6) { transition-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .grain-overlay { animation: none; }
  .light-leak { animation: none; }
  .overlay-menu { transition: none; }
}

/* ===== 响应式断点 ===== */
@media (max-width: 767px) {
  .home-hero { min-height: 70vh; padding: 3rem 0.5rem; }
  .hero-cta { flex-direction: column; align-items: center; }
  .btn-primary, .btn-ghost { width: 100%; max-width: 280px; justify-content: center; }
  .topic-grid { grid-template-columns: 1fr 1fr; }
  .article-card a { grid-template-columns: auto 1fr; }
  .article-card time { display: none; }
  .content-layout { padding: 1.5rem 0; }
  footer p { font-size: 1.4rem; }
}

@media (max-width: 420px) {
  .topic-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 2.2rem; }
}

/* ===== VHS tracking 细节线 ===== */
body::after {
  content: '';
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(212,165,116,0.6) 50%, transparent 100%);
  pointer-events: none;
  z-index: 9999;
  animation: vhs-line 15s linear infinite;
  opacity: 0.5;
}

@keyframes vhs-line {
  0%   { top: -2px; }
  100% { top: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  body::after { animation: none; opacity: 0; }
}
