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

/* ============================================================
   CSS 变量 & 重置
   ============================================================ */
:root {
  --bg: #fafaf8;
  --ink: #1a1a1a;
  --mid: #4a4a4a;
  --accent: #1a1a1a;
  --card-radius: 4px;
  --nav-h: 56px;
  --font: 'Roboto', system-ui, -apple-system, sans-serif;
  --paper-noise: 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.06'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.65;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + 8px);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--paper-noise);
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
}

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

/* ============================================================
   排版工具
   ============================================================ */
h1 { font-size: clamp(1.6rem, 5vw, 2.4rem); font-weight: 700; line-height: 1.2; }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.05rem; font-weight: 500; }
p  { font-size: 1rem; line-height: 1.7; margin-bottom: 1rem; }

hr {
  border: none;
  border-top: 2px solid var(--ink);
  margin: 0.5rem 0 1.2rem;
  opacity: 0.18;
  transform: rotate(-0.3deg);
}

/* ============================================================
   底部固定导航条 (header.site-nav)
   ============================================================ */
.site-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: var(--ink);
  color: var(--bg);
  z-index: 999;
  display: flex;
  align-items: stretch;
  border-top: 2px solid rgba(250,250,248,0.15);
}

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

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

.site-nav nav p {
  display: flex;
  align-items: center;
  gap: 0;
  height: var(--nav-h);
  white-space: nowrap;
  padding: 0 8px;
}

.site-nav nav p a {
  color: var(--bg);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0 10px;
  height: var(--nav-h);
  display: inline-flex;
  align-items: center;
  border-right: 1px solid rgba(250,250,248,0.1);
  min-width: 40px;
  transition: background 0.15s;
}

.site-nav nav p a:hover,
.site-nav nav p a:focus {
  background: rgba(250,250,248,0.12);
  opacity: 1;
}

/* ============================================================
   主容器布局 main > div.wrap > section > article
   ============================================================ */
main {
  position: relative;
  z-index: 1;
}

main > div.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
}

main > div.wrap > section {
  flex: 1;
  min-width: 0;
}

main > div.wrap > section > article {
  background: var(--bg);
  position: relative;
}

/* ============================================================
   侧边栏 aside
   ============================================================ */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: 1rem;
}

.sidebar h3 {
  margin-bottom: 0.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.sidebar-links {
  margin-bottom: 1.5rem;
}

.sidebar-links li {
  border-bottom: 1px solid rgba(26,26,26,0.1);
}

.sidebar-links li a {
  display: block;
  padding: 0.45rem 0;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--mid);
  transition: color 0.1s, padding-left 0.1s;
}

.sidebar-links li a:hover {
  color: var(--ink);
  padding-left: 4px;
  opacity: 1;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  main > div.wrap { flex-direction: column; gap: 1rem; }
}

/* ============================================================
   Hero (首页双图错位拼贴)
   ============================================================ */
.hero {
  position: relative;
  min-height: 100vh;
  background: var(--ink);
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
}

.hero-collage {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-img {
  position: absolute;
  object-fit: cover;
}

.hero-img-a {
  width: 65%;
  height: 80%;
  top: 5%;
  left: 0;
  transform: rotate(-1.5deg);
  filter: grayscale(20%) contrast(1.05);
  opacity: 0.85;
}

.hero-img-b {
  width: 50%;
  height: 65%;
  bottom: 4%;
  right: 0;
  transform: rotate(1.2deg);
  filter: grayscale(10%) contrast(1.08);
  opacity: 0.9;
}

.hero-text {
  position: relative;
  z-index: 2;
  text-align: right;
  padding: 2rem 2.5rem;
  max-width: 520px;
  background: rgba(250,250,248,0.92);
  margin: auto 2rem 6rem auto;
  border: 2px solid var(--ink);
  transform: rotate(0.4deg);
}

.hero-title {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-sub {
  font-size: 1rem;
  color: var(--mid);
  margin: 0;
  line-height: 1.6;
}

@media (max-width: 600px) {
  .hero { min-height: 100svh; }
  .hero-text {
    margin: auto 0.75rem 5rem;
    padding: 1.25rem 1rem;
    transform: rotate(0.2deg);
  }
  .hero-img-a { width: 100%; height: 55%; }
  .hero-img-b { width: 75%; height: 45%; }
}

/* ============================================================
   频道 Hero / 内页 Hero
   ============================================================ */
.channel-hero,
.inner-hero,
.tag-hero {
  position: relative;
  z-index: 1;
  padding: 3rem 1rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
  border-bottom: 2px solid var(--ink);
}

.channel-hero::after,
.inner-hero::after,
.tag-hero::after {
  content: '';
  display: block;
  height: 2px;
  background: var(--ink);
  margin-top: 0.75rem;
  opacity: 0.08;
  transform: rotate(-0.2deg);
}

.channel-title,
.inner-h1,
.tag-h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  font-weight: 700;
}

.channel-desc,
.tag-desc {
  color: var(--mid);
  margin-top: 0.5rem;
  font-size: 1rem;
}

.page-eyebrow,
.tag-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--bg);
  padding: 2px 8px;
  margin-bottom: 0.6rem;
  transform: rotate(-0.5deg);
}

/* ============================================================
   卡片列表
   ============================================================ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 1rem;
}

.card {
  border: 1.5px solid var(--ink);
  border-radius: var(--card-radius);
  border-bottom: 4px solid var(--ink);
  background: var(--bg);
  overflow: hidden;
  transform: rotate(calc(var(--i, 0) * 0.3deg - 0.3deg));
  transition: transform 0.15s, box-shadow 0.15s;
}

.card:hover {
  transform: rotate(0deg) translateY(-3px);
  box-shadow: 3px 3px 0 var(--ink);
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1rem;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
}

.card-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--mid);
  text-transform: uppercase;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--mid);
  line-height: 1.5;
}

.card-meta {
  font-size: 0.75rem;
  color: var(--mid);
  margin-top: auto;
}

/* ============================================================
   频道子页列表 (ol > li > a + small)
   ============================================================ */
.channel-list {
  counter-reset: ch-counter;
  margin-top: 0.75rem;
}

.channel-list li {
  counter-increment: ch-counter;
  border-bottom: 1px solid rgba(26,26,26,0.12);
  padding: 0.75rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  position: relative;
  transition: background 0.1s;
}

.channel-list li::before {
  content: counter(ch-counter, decimal-leading-zero);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--mid);
  opacity: 0.5;
  flex-shrink: 0;
  margin-top: 3px;
  min-width: 24px;
}

.channel-list li a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  font-size: 0.95rem;
  display: block;
}

.channel-list li a:hover { text-decoration: underline; opacity: 1; }

.channel-list li small {
  display: block;
  font-size: 0.78rem;
  color: var(--mid);
  margin-top: 2px;
}

/* ============================================================
   文章页
   ============================================================ */
.article-hero {
  margin-bottom: 1.5rem;
  overflow: hidden;
  border-radius: var(--card-radius);
  border: 1.5px solid var(--ink);
}

.article-hero-img {
  width: 100%;
  height: 320px;
  object-fit: cover;
  display: block;
  filter: contrast(1.05) grayscale(8%);
}

.article-h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-meta {
  font-size: 0.82rem;
  color: var(--mid);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.meta-label { font-weight: 500; }
.meta-sep { opacity: 0.4; }

.article-prose {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink);
}

.article-prose h2 { margin: 2rem 0 0.4rem; }
.article-prose h3 { margin: 1.5rem 0 0.35rem; }
.article-prose p  { margin-bottom: 1rem; }
.article-prose ul, .article-prose ol { padding-left: 1.5rem; margin-bottom: 1rem; list-style: disc; }
.article-prose ol { list-style: decimal; }
.article-prose li { margin-bottom: 0.35rem; }
.article-prose blockquote {
  border-left: 3px solid var(--ink);
  padding-left: 1rem;
  color: var(--mid);
  font-style: italic;
  margin: 1rem 0;
}
.article-prose a { color: var(--ink); }
.article-prose img {
  max-width: 100%;
  border-radius: var(--card-radius);
  margin: 1rem 0;
  border: 1px solid rgba(26,26,26,0.15);
}

.article-nav-bottom {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1.5px solid rgba(26,26,26,0.12);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-back {
  font-size: 0.85rem;
  color: var(--mid);
  text-decoration: none;
  display: inline-block;
  padding: 0.4rem 0.75rem;
  border: 1px solid rgba(26,26,26,0.2);
  border-radius: var(--card-radius);
  transition: background 0.1s;
}

.btn-back:hover {
  background: var(--ink);
  color: var(--bg);
  opacity: 1;
}

/* ============================================================
   prose (about / privacy)
   ============================================================ */
.prose {
  font-size: 1rem;
  line-height: 1.75;
}

.prose h2 { margin: 2rem 0 0.4rem; }
.prose h3 { margin: 1.5rem 0 0.35rem; }
.prose p  { margin-bottom: 1rem; }
.prose ul { padding-left: 1.5rem; list-style: disc; margin-bottom: 1rem; }
.prose li { margin-bottom: 0.35rem; }
.prose a  { color: var(--ink); }

.privacy-date {
  font-size: 0.82rem;
  color: var(--mid);
  margin-bottom: 1.25rem;
}

/* ============================================================
   首页特定分区
   ============================================================ */
.home-channels,
.home-articles {
  margin-top: 2.5rem;
}

.home-channels h2,
.home-articles h2 {
  margin-bottom: 0.25rem;
}

/* ============================================================
   页脚 footer > section×n
   ============================================================ */
footer {
  position: relative;
  z-index: 1;
  border-top: 2px solid var(--ink);
  margin-bottom: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--bg);
}

footer section { display: contents; }

.footer-copy p {
  font-size: 0.78rem;
  color: var(--mid);
  margin: 0;
}

.footer-links {
  display: flex !important;
  gap: 1rem;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--mid);
  text-decoration: none;
}

.footer-links a:hover { color: var(--ink); opacity: 1; }

@media (max-width: 480px) {
  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
  }
}

/* ============================================================
   Scroll Reveal
   ============================================================ */
.reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.4s ease calc(var(--i, 0) * 60ms),
              transform 0.4s ease calc(var(--i, 0) * 60ms);
}

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

@media (prefers-reduced-motion: reduce) {
  .reveal-item {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ============================================================
   Hover Micro-interaction: 卡片抖动
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  .card:active {
    transform: rotate(0.8deg) scale(0.98);
  }

  .site-nav nav p a:focus-visible {
    outline: 2px solid var(--bg);
    outline-offset: -4px;
  }
}

/* ============================================================
   纸质噪点叠加（伪元素 + SVG filter）
   ============================================================ */
.page-home .hero::after,
.page-channel .channel-hero::before,
.page-article .article-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--paper-noise);
  pointer-events: none;
  mix-blend-mode: multiply;
  opacity: 0.3;
}

/* ============================================================
   手绘边框装饰 (伪随机旋转)
   ============================================================ */
.about-content,
.privacy-content,
.default-content,
.tag-content,
.channel-content {
  padding: 0;
}

/* 调试用辅助线，仅侧边栏 */
.sidebar > h3:first-child {
  padding-top: 0;
}

/* ============================================================
   移动端通用修正
   ============================================================ */
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: 1fr;
  }

  .article-hero-img {
    height: 200px;
  }

  .channel-hero,
  .inner-hero,
  .tag-hero {
    padding-top: 1.5rem;
  }

  main > div.wrap {
    padding: 1.25rem 0.85rem 2rem;
  }
}

/* ============================================================
   无障碍：聚焦环
   ============================================================ */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}
