@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Orbitron:wght@700;900&display=swap');

/* ── 变量 ── */
:root {
  --c-mint: #5cc6b0;
  --c-sand: #d4c4a8;
  --c-forest: #172623;
  --c-forest-90: rgba(23,38,35,0.92);
  --c-forest-70: rgba(23,38,35,0.70);
  --c-forest-40: rgba(23,38,35,0.40);
  --c-mint-20: rgba(92,198,176,0.18);
  --c-mint-40: rgba(92,198,176,0.38);
  --c-sand-80: rgba(212,196,168,0.82);
  --c-sand-20: rgba(212,196,168,0.16);
  --c-text: #e8dfc8;
  --c-text-muted: #a09880;
  --c-bg: #0e1a18;
  --c-bg2: #152220;
  --c-bg3: #1e2e2a;
  --c-border: rgba(92,198,176,0.22);
  --radius-card: 18px;
  --radius-sm: 8px;
  --font-title: 'Orbitron', 'JetBrains Mono', monospace;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'JetBrains Mono', system-ui, 'Helvetica Neue', sans-serif;
  --nav-h: 64px;
  --shadow-card: 0 4px 32px rgba(0,0,0,0.45), 0 1px 4px rgba(92,198,176,0.10);
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.30);
  --trans: 0.28s cubic-bezier(0.25,0.46,0.45,0.94);
}

/* ── 重置 ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-mint); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }

/* ── 隐藏工具 ── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── 点阵底纹 ── */
.hero-dot-bg {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: radial-gradient(circle, var(--c-mint-20) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.55;
}

/* ── 粗粒纹理叠加 ── */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  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%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  opacity: 0.55;
}

/* ── 站级容器 ── */
.site-wrap { position: relative; min-height: 100vh; }

/* ── HERO 基础 ── */
.hero--home {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  background: linear-gradient(160deg, var(--c-forest) 0%, var(--c-bg) 60%, #0a1210 100%);
}

.hero-slash {
  position: absolute; bottom: -2px; left: 0; right: 0; height: 80px; z-index: 2;
  background: var(--c-bg);
  clip-path: polygon(0 60%, 100% 0%, 100% 100%, 0 100%);
}

.hero-inner {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 2rem 1.5rem 5rem;
  max-width: 820px; width: 100%;
}

.hero-img { width: 100%; max-height: 40vh; object-fit: cover; border-radius: var(--radius-card); margin-bottom: 2rem; }

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  color: var(--c-mint);
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding: 0.3em 0.8em;
  border: 1px solid var(--c-mint-40);
  border-radius: 100px;
  display: inline-block;
}

.hero-h1 {
  font-family: var(--font-title);
  font-size: clamp(2.2rem, 7vw, 5rem);
  font-weight: 900;
  line-height: 1.05;
  color: #fff;
  text-shadow: 0 0 40px var(--c-mint-40), 0 2px 4px rgba(0,0,0,0.6);
  margin-bottom: 1.2rem;
  letter-spacing: -0.02em;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--c-sand-80);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.75;
}

.btn-primary {
  display: inline-block;
  padding: 0.85em 2.2em;
  background: var(--c-mint);
  color: var(--c-forest);
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  border-radius: 100px;
  border: none;
  cursor: pointer;
  transition: background var(--trans), transform var(--trans), box-shadow var(--trans);
  box-shadow: 0 0 20px var(--c-mint-40);
  min-height: 44px;
}
.btn-primary:hover { background: #4db8a2; transform: translateY(-2px); box-shadow: 0 6px 28px var(--c-mint-40); text-decoration: none; }

/* ── Topic / About / Tag / Privacy Hero ── */
.topic-hero, .tag-hero, .about-hero, .privacy-hero {
  position: relative;
  min-height: 40vh;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
  background: linear-gradient(150deg, var(--c-forest) 0%, var(--c-bg2) 100%);
  padding-bottom: 60px;
}

.topic-hero-inner, .tag-hero-inner, .about-hero-inner, .privacy-hero-inner {
  position: relative; z-index: 1;
  padding: 3rem 1.5rem 1rem;
  max-width: 860px; margin: 0 auto; width: 100%;
}

.topic-hero h1, .tag-hero h1, .about-hero h1, .privacy-hero h1 {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 900;
  color: #fff;
  margin-bottom: 0.6rem;
  line-height: 1.1;
}

.topic-hero .hero-slash {
  position: absolute; bottom: -2px; left: 0; right: 0;
  height: 60px; z-index: 2;
  background: var(--c-bg);
  clip-path: polygon(0 50%, 100% 0%, 100% 100%, 0 100%);
}

/* ── 面包屑 ── */
.breadcrumb {
  font-size: 0.82rem;
  color: var(--c-text-muted);
  padding: 1rem 1.5rem;
  max-width: 1200px; margin: 0 auto; width: 100%;
}
.breadcrumb a { color: var(--c-mint); }
.breadcrumb span[aria-hidden] { margin: 0 0.4em; }

/* ── 主布局：main + aside ── */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  gap: 0 2rem;
  align-items: start;
}

main .breadcrumb { grid-column: 1 / -1; padding-left: 0; padding-right: 0; }

/* ── wrap (正文容器) ── */
.wrap {
  min-width: 0;
}

/* ── aside ── */
.site-aside {
  position: sticky;
  top: 1rem;
  background: var(--c-bg3);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
}

.site-aside h2 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--c-mint);
  margin-bottom: 0.4rem;
}

.site-aside p.subtitle {
  font-size: 0.78rem;
  color: var(--c-text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.site-aside dl { display: flex; flex-direction: column; gap: 0.3rem; }
.site-aside dt a {
  display: block;
  font-size: 0.85rem;
  color: var(--c-sand);
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--c-mint-40);
  transition: background var(--trans), border-color var(--trans);
  min-height: 40px; line-height: 1.3;
  display: flex; align-items: center;
}
.site-aside dt a:hover { background: var(--c-mint-20); border-color: var(--c-mint); text-decoration: none; }
.site-aside dd { font-size: 0.75rem; color: var(--c-text-muted); padding: 0 0.6rem 0.4rem; line-height: 1.45; }

/* ── 正文排版 ── */
.content-prose {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--c-text);
}

.content-prose h1 { font-family: var(--font-title); font-size: clamp(1.6rem, 4vw, 2.4rem); font-weight: 900; color: #fff; margin-bottom: 0.8rem; }
.content-prose h2 { font-family: var(--font-title); font-size: 1.3rem; font-weight: 700; color: var(--c-mint); margin: 2rem 0 0.6rem; letter-spacing: 0.04em; }
.content-prose h3 { font-size: 1.1rem; font-weight: 700; color: var(--c-sand); margin: 1.5rem 0 0.5rem; }
.content-prose p { margin-bottom: 1.1rem; }
.content-prose ul, .content-prose ol { padding-left: 1.4rem; margin-bottom: 1rem; list-style: disc; }
.content-prose li { margin-bottom: 0.4rem; }
.content-prose blockquote { border-left: 3px solid var(--c-mint); padding: 0.6rem 1rem; background: var(--c-mint-20); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 1.2rem 0; color: var(--c-sand); }
.content-prose code { font-family: var(--font-mono); background: var(--c-bg3); padding: 0.15em 0.4em; border-radius: 4px; font-size: 0.9em; color: var(--c-mint); }
.content-prose pre { background: var(--c-bg3); padding: 1rem; border-radius: var(--radius-sm); overflow-x: auto; margin-bottom: 1rem; }
.content-prose a { color: var(--c-mint); border-bottom: 1px solid var(--c-mint-40); transition: border-color var(--trans); }
.content-prose a:hover { border-color: var(--c-mint); text-decoration: none; }

/* ── 文章页 ── */
.article-hero-wrap { border-radius: var(--radius-card); overflow: hidden; margin-bottom: 2rem; }
.article-hero-img { width: 100%; max-height: 420px; object-fit: cover; }
.article-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--c-border); }
.article-lead { color: var(--c-text-muted); font-size: 1.05rem; line-height: 1.65; margin-top: 0.6rem; }
.article-meta { font-size: 0.82rem; color: var(--c-text-muted); font-family: var(--font-mono); margin-top: 0.5rem; }
.article-back { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--c-border); font-size: 0.9rem; }

/* ── article>div 正文容器结构（契约必需） ── */
.article-section, .about-section, .privacy-section, .tag-intro, .topic-body, .home-intro { width: 100%; }

/* ── 卡片网格 ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.4rem;
  margin-top: 1.2rem;
}

/* ── 玻璃拟态卡片 ── */
.glass-card {
  background: rgba(30,46,42,0.72);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform var(--trans), box-shadow var(--trans), border-color var(--trans);
}
.glass-card:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 8px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--c-mint-40);
  border-color: var(--c-mint-40);
}

.card-body { padding: 1.2rem 1.3rem 1.4rem; }
.card-thumb { width: 100%; height: 160px; object-fit: cover; }
.card-date { display: block; font-size: 0.76rem; font-family: var(--font-mono); color: var(--c-text-muted); margin-bottom: 0.5rem; }

.glass-card h3 { font-size: 1rem; font-weight: 700; color: #fff; margin-bottom: 0.4rem; line-height: 1.35; }
.glass-card h3 a { color: inherit; transition: color var(--trans); }
.glass-card h3 a:hover { color: var(--c-mint); text-decoration: none; }
.glass-card p { font-size: 0.85rem; color: var(--c-text-muted); line-height: 1.55; margin: 0; }

.card-link-arrow {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--c-mint);
  letter-spacing: 0.04em;
  transition: letter-spacing var(--trans);
}
.card-link-arrow:hover { letter-spacing: 0.12em; text-decoration: none; }

/* ── Topic 卡片网格 ── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.2rem;
  margin-top: 1rem;
}

/* ── h2 + subtitle 装饰 ── */
h2 { font-family: var(--font-title); font-size: 1.25rem; font-weight: 700; color: var(--c-mint); margin-bottom: 0.4rem; letter-spacing: 0.05em; }
p.subtitle { color: var(--c-text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 1.2rem; }

/* ── article 间距 ── */
.home-intro, .home-topics, .home-featured,
.topic-body, .topic-children,
.tag-intro, .tag-articles,
.about-section, .privacy-section {
  margin-bottom: 3rem;
}

/* ── 页脚 ── */
.site-footer {
  background: var(--c-forest);
  border-top: 1px solid var(--c-border);
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  position: relative;
  overflow: hidden;
}

.footer-brand {
  font-family: var(--font-title);
  font-size: clamp(2.5rem, 8vw, 5rem);
  font-weight: 900;
  color: var(--c-mint);
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 1rem;
  text-shadow: 0 0 60px var(--c-mint-40);
  opacity: 0.85;
}

.site-footer small {
  display: block;
  font-size: 0.78rem;
  color: var(--c-text-muted);
  font-family: var(--font-mono);
  line-height: 1.8;
}
.site-footer small a { color: var(--c-sand); }
.site-footer small a:hover { color: var(--c-mint); }

/* ── 底部固定导航条 ── */
.bottom-nav-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--c-forest-90);
  border-top: 1px solid var(--c-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 1000;
  padding: 0 0.8rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bnb-brand {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--c-mint-20);
  border: 1px solid var(--c-mint-40);
  margin-right: 0.6rem;
  flex-shrink: 0;
}
.bnb-icon {
  font-family: var(--font-title);
  font-size: 1.1rem;
  color: var(--c-mint);
  font-weight: 900;
  line-height: 1;
}

.bnb-nav {
  flex: 1 1 auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.bnb-nav::-webkit-scrollbar { display: none; }

.bnb-nav dl {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  white-space: nowrap;
  padding: 0 0.3rem;
}

.bnb-nav dt a {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 0.75rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--c-sand);
  border-radius: var(--radius-sm);
  transition: background var(--trans), color var(--trans);
  white-space: nowrap;
  min-width: 44px;
  justify-content: center;
}
.bnb-nav dt a:hover { background: var(--c-mint-20); color: var(--c-mint); text-decoration: none; }

.bnb-search {
  flex: 0 0 auto;
  margin-left: 0.6rem;
}
.bnb-search form {
  display: flex;
  align-items: center;
  background: var(--c-bg3);
  border: 1px solid var(--c-border);
  border-radius: 100px;
  overflow: hidden;
  height: 40px;
}
.bnb-search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--c-text);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  padding: 0 0.7rem;
  width: 120px;
  height: 100%;
}
.bnb-search input::placeholder { color: var(--c-text-muted); }
.bnb-search button {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.6rem;
  height: 100%;
  font-size: 0.9rem;
  min-width: 40px;
  display: flex; align-items: center; justify-content: center;
}

/* ── 关于页 logo ── */
.about-logo { width: 80px; height: 80px; object-fit: contain; margin: 0 auto 1.5rem; border-radius: 50%; }

/* ── 动效：parallax hero（JS 配合） ── */
.hero--home .hero-inner { will-change: transform; }

/* ── reduced-motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── 响应式：平板 ── */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
  .site-aside {
    position: static;
    margin-top: 2rem;
  }
  .card-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* ── 响应式：手机 ── */
@media (max-width: 600px) {
  .hero-inner { padding: 1.5rem 1rem 5rem; }
  .hero--home { min-height: 100svh; }
  .bnb-search input { width: 80px; }
  .card-grid { grid-template-columns: 1fr; }
  .topic-grid { grid-template-columns: 1fr; }
  main { padding: 1.5rem 1rem 2rem; }
  .footer-brand { font-size: 2rem; }
  .topic-hero, .tag-hero, .about-hero, .privacy-hero { min-height: 30vh; }
  .bnb-nav dt a { padding: 0 0.5rem; font-size: 0.72rem; }
}

/* ── 首页布局调整 (main 在 home 时无 aside 配对) ── */
.page-home main {
  grid-template-columns: 1fr;
  position: relative;
}
.page-home .site-aside {
  max-width: 320px;
  margin: 0 auto 2rem;
}

@media (min-width: 901px) {
  .page-home main {
    grid-template-columns: 1fr 300px;
  }
  .page-home .wrap { grid-column: 1; }
  .page-home .site-aside { grid-column: 2; grid-row: 1 / 10; }
}
