/* research — 黑白影印 / 报纸栏 */

:root {
  --ink: #121212;
  --ink-mid: #2c2c2c;
  --ink-soft: #5a5a5a;
  --paper: #f4f1ea;
  --paper-deep: #e8e4da;
  --rule: #1a1a1a;
  --line: rgba(18, 18, 18, 0.14);
  --stamp: #141414;
  --moss: #2a2a2a;
  --font-display: "Newsreader", "Noto Serif SC", "Songti SC", "Times New Roman", Times, serif;
  --font-nav: "ZCOOL XiaoWei", "Songti SC", "Noto Serif SC", serif;
  --font-body: "Newsreader", "Noto Serif SC", "Source Han Serif SC", Georgia, serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  /* 顶栏边距与 idea / book 壳对齐 */
  --pad: clamp(0.85rem, 2.8vw, 1.6rem);
  --max: 44rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(0, 0, 0, 0.04) 1px, transparent 0);
  background-size: 3px 3px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  mix-blend-mode: multiply;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.028) 2px,
      rgba(0, 0, 0, 0.028) 3px
    );
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  filter: grayscale(1) contrast(1.12);
}

.wrap {
  width: min(100% - var(--pad) * 2, var(--max));
  margin-inline: auto;
}

/* —— nav：与 book 页同一结构 —— */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid var(--rule);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.2rem;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.nav__brand-text {
  font-family: var(--font-nav);
  font-size: 1.05rem;
}

.nav__brand:hover {
  background: transparent;
  color: var(--ink);
}

.nav__mark {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.2rem;
  object-fit: cover;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  filter: none;
}

.nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.05em;
}

.nav__links a {
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 0.1rem;
  text-decoration: none;
}

.nav__links a:hover,
.nav__links a.is-active {
  color: var(--ink);
  border-bottom-color: var(--rule);
  background: transparent;
}

/* —— masthead —— */
.masthead {
  padding: 2.1rem 0 1.25rem;
  border-bottom: 2px solid var(--rule);
}

.masthead__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5.5vw, 2.85rem);
  letter-spacing: -0.01em;
  line-height: 1.1;
  font-variation-settings: "opsz" 72;
}

/* —— tags —— */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 1rem 0 0.25rem;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid var(--stamp);
  padding: 0.16rem 0.42rem;
  background: transparent;
  color: var(--ink);
}

.tag:hover,
.tag.is-active {
  background: var(--stamp);
  color: var(--paper);
}

.tag-bar--filter {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1rem;
  margin-bottom: 0.15rem;
}

/* —— index list：双列卡片；手机单列 —— */
.wrap--index {
  width: min(100% - var(--pad) * 2, 56rem);
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0.85rem 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
}

.post-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 0.95rem 1.2rem;
  border-bottom: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-width: 0;
}

.post-card:nth-child(2n) {
  border-right: none;
}

.post-card__thumb {
  display: block;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--paper-deep);
  aspect-ratio: 4 / 3;
}

.post-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* 继承全局灰度，目录小图保持黑白 */
}

.post-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.post-card__meta {
  margin-bottom: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.post-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.post-card__title a {
  text-decoration: none;
}

.post-card__title a:hover {
  background: var(--ink);
  color: var(--paper);
}

.post-card__summary {
  margin: 0.45rem 0 0;
  color: var(--ink-mid);
  font-size: 0.92rem;
  line-height: 1.5;
}

.post-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: auto;
  padding-top: 0.7rem;
}

.empty {
  padding: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* —— article —— */
.article {
  padding: 2rem 0 3.5rem;
}

.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.article__title {
  margin: 0 0 1.35rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4.5vw, 2.45rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 0.8rem;
}

.article__body img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  margin: 1.25rem 0 1.75rem;
  border-radius: 0.25rem;
  border: 1px solid var(--rule);
  filter: none; /* 正文插图保留彩色原图，不受全局灰度滤镜影响 */
}

.article__body {
  font-size: 1.04rem;
  line-height: 1.7;
}

.article__body > *:first-child {
  margin-top: 0;
}

.article__body h2 {
  margin: 1.9rem 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.2rem;
}

.article__body h3 {
  margin: 1.4rem 0 0.45rem;
  font-family: var(--font-display);
  font-size: 1.08rem;
  font-weight: 600;
}

.article__body p,
.article__body li {
  color: var(--ink-mid);
}

.article__body a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.article__body a:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}

.article__body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  border: 1px solid var(--rule);
  padding: 0.05em 0.28em;
  background: var(--paper-deep);
}

.article__body pre {
  border: 1.5px solid var(--rule);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  background: var(--paper-deep);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
}

.article__body pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.article__body .table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1.1rem 0 1.4rem;
  border: 1px solid var(--rule);
}

.article__body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  line-height: 1.45;
}

.article__body th,
.article__body td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article__body th:last-child,
.article__body td:last-child {
  border-right: none;
}

.article__body thead th {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--paper-deep);
  border-bottom: 1.5px solid var(--rule);
}

.article__body tbody tr:last-child td {
  border-bottom: none;
}

.article__body blockquote {
  margin: 1.15rem 0;
  padding: 0.15rem 0 0.15rem 0.95rem;
  border-left: 3px solid var(--rule);
  color: var(--ink-soft);
  font-style: italic;
}

.article__back {
  display: inline-block;
  margin-top: 2.1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1.5px solid var(--rule);
  padding: 0.35rem 0.65rem;
}

.article__back:hover {
  background: var(--ink);
  color: var(--paper);
}

/* —— footer —— */
.site-footer {
  border-top: 2px solid var(--rule);
  padding: 1.2rem 0 2rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.site-footer a {
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}

.site-footer a:hover {
  background: var(--ink);
  color: var(--paper);
}

@media (max-width: 40rem) {
  .nav__brand-text {
    display: none;
  }

  .nav__inner {
    gap: 0.65rem;
    min-height: 3rem;
  }

  .nav__links {
    gap: 0.5rem 1rem;
    font-size: 0.9rem;
    justify-content: flex-end;
  }

  .post-list {
    grid-template-columns: 1fr;
  }

  .post-card {
    padding: 1.05rem 0 1.15rem;
    border-right: none;
  }

  .post-card__thumb {
    aspect-ratio: 16 / 10;
  }

  .post-card__title {
    font-size: 1.15rem;
  }
}
