/* ---------- 主题 ---------- */
:root {
  --paper:      #f6f3ec;
  --paper-soft: #fbf9f4;
  --ink:        #1c1815;
  --ink-soft:   #6f675a;
  --ink-faint:  #a49a88;
  --seal:       #a83a22;
  --seal-soft:  #c25a3d;
  --rule:       #e3ddd0;
  --code-bg:    #efeadd;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --mono:  "JetBrains Mono", "SF Mono", "Cascadia Code", ui-monospace, Menlo, Consolas, "Courier New", monospace;

  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #12100c;
    --paper-soft: #181510;
    --ink:        #eae4d8;
    --ink-soft:   #8f8674;
    --ink-faint:  #5d5648;
    --seal:       #d97757;
    --seal-soft:  #e08e72;
    --rule:       #26221a;
    --code-bg:    #1c1913;
  }
}

/* ---------- 基础 ---------- */
* { box-sizing: border-box; }

html {
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: clamp(3rem, 8vw, 5.5rem) 1.5rem 4rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.95rem;
  line-height: 1.8;
  font-feature-settings: "kern" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body > * {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}

::selection {
  background: var(--seal);
  color: var(--paper);
}

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

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* ---------- 报头 ---------- */
.masthead {
  margin-bottom: 3.5rem;
}

.site-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.75rem, 9vw, 4.25rem);
  line-height: 1;
  margin: 0 0 1.25rem;
  letter-spacing: 0.02em;
}

.site-title span { display: inline-block; }
.site-title span + span { margin-left: 0.28em; }

.seal-rule {
  width: 2.75rem;
  height: 3px;
  background: var(--seal);
  margin-bottom: 1rem;
}

.tagline {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink-soft);
  margin: 0;
  letter-spacing: 0.06em;
}

/* ---------- 关于 ---------- */
.about {
  margin-bottom: 4rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

.about p {
  margin: 0 0 1em;
  color: var(--ink-soft);
}

.about p:last-child { margin-bottom: 0; }

.about-kicker {
  color: var(--ink) !important;
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  padding-left: 0.9rem;
  border-left: 2px solid var(--seal);
}

.about .contact-line {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  opacity: 0.85;
}

.about .contact-line a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  overflow-wrap: anywhere;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.about .contact-line a:hover {
  opacity: 0.65;
  border-bottom-color: transparent;
}

/* ---------- 区段标题 ---------- */
.section-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.section-label::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}

/* ---------- 文章 ---------- */
article {
  margin-bottom: 3rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--rule);
}

article:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
  letter-spacing: 0.05em;
}

.post-date {
  font-variant-numeric: tabular-nums;
}

.post-tags {
  display: flex;
  gap: 0.5rem;
}

.post-tags span {
  color: var(--seal);
}

.post-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.25rem;
  line-height: 1.5;
  margin: 0 0 0.75rem;
  letter-spacing: 0.01em;
}

.post-title a {
  background-image: linear-gradient(var(--seal), var(--seal));
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color 0.25s ease, background-size 0.3s ease;
}

.post-title a:hover {
  color: var(--seal);
  background-size: 100% 1px;
}

.post-body {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-soft);
  line-height: 1.85;
}

/* ---------- 状态 ---------- */
.state, .error {
  color: var(--ink-faint);
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.error { color: var(--seal); }

/* ---------- 搜索框 ---------- */
.search-box {
  margin-bottom: 2rem;
}

#search {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--rule);
  background: var(--paper-soft);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 0.9rem;
  line-height: 1.4;
  border-radius: 4px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

#search::placeholder {
  color: var(--ink-faint);
  letter-spacing: 0.03em;
}

#search:focus {
  border-color: var(--seal);
  box-shadow: 0 0 0 3px rgba(168, 58, 34, 0.12);
}

/* 去掉 Safari / Chrome 自带的清除按钮样式 */
#search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 0.9em;
  width: 0.9em;
  background: var(--ink-faint);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6l12 12M18 6L6 18' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M6 6l12 12M18 6L6 18' stroke='black' stroke-width='2' stroke-linecap='round'/></svg>") center/contain no-repeat;
  cursor: pointer;
  opacity: 0.6;
}

#search::-webkit-search-cancel-button:hover {
  opacity: 1;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
}

.pagination:empty {
  display: none;
  margin: 0;
  padding: 0;
  border: none;
}

.pagination button {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.9rem;
  border-radius: 4px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
}

.pagination button:hover:not(:disabled) {
  border-color: var(--seal);
  color: var(--seal);
}

.pagination button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.page-info {
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  min-width: 4.5em;
  text-align: center;
}

/* ---------- 落款 ---------- */
.colophon {
  margin-top: 5rem;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
}

.footer-brand .site-title {
  font-size: 1.25rem;
  margin: 0 0 0.5rem 0;
}

.footer-meta {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.footer-meta a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-meta a:hover {
  color: var(--ink);
}

.footer-social {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.footer-social a {
  color: var(--ink-faint);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  transition: color 0.2s ease;
}

.footer-social a:hover {
  color: var(--ink);
}

.footer-social svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}
