/* =========================================================
   Hoperigence — 主题样式
   想改配色：只改下面的 CSS 变量即可
   ========================================================= */

:root,
:root[data-theme='light'] {
  --bg: #fbfaf7;
  --bg-soft: #f5f2ea;
  --bg-elev: #ffffff;
  --ink: #1a1917;
  --ink-2: #45423c;
  --muted: #7b756a;
  --line: #e6e1d6;
  --accent: #9c4a2a;
  --accent-soft: rgba(156, 74, 42, 0.08);
  --code-bg: #f2eee5;
  --code-ink: #3d3a33;
  --shadow: 0 1px 2px rgba(26, 25, 23, 0.04), 0 8px 24px rgba(26, 25, 23, 0.04);
}

:root[data-theme='dark'] {
  --bg: #121211;
  --bg-soft: #191918;
  --bg-elev: #1b1b19;
  --ink: #eae7df;
  --ink-2: #c4c0b5;
  --muted: #8d887c;
  --line: #2c2b27;
  --accent: #e2956f;
  --accent-soft: rgba(226, 149, 111, 0.12);
  --code-bg: #1c1c19;
  --code-ink: #d9d5cb;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB',
    'Microsoft YaHei', 'Noto Sans SC', sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

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

::selection {
  background: var(--accent-soft);
}

.wrap {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 0 24px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-elev);
  padding: 10px 16px;
  z-index: 99;
  border-radius: 0 0 6px 0;
}
.skip-link:focus {
  left: 0;
}

/* ---------------- 头部 ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
  min-width: 0;
}

.site-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
}

.site-nav a {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.site-nav a:hover {
  color: var(--ink);
  background: var(--bg-soft);
}

.site-nav a.is-active {
  color: var(--ink);
  font-weight: 600;
}

.nav-rss {
  font-variant: small-caps;
  letter-spacing: 0.06em;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
  transform: rotate(-12deg);
}

.theme-toggle svg {
  fill: none;
  stroke: currentColor;
}

:root[data-theme='light'] .icon-moon {
  display: none;
}

:root[data-theme='dark'] .icon-sun {
  display: none;
}

:root[data-theme='dark'] .icon-moon {
  fill: currentColor;
  stroke: none;
}

/* ---------------- 首页 hero ---------------- */
.hero {
  padding: 76px 0 34px;
  border-bottom: 1px solid var(--line);
}

.hero-eyebrow,
.post-eyebrow,
.page-eyebrow,
.section-label {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}

.hero-eyebrow {
  margin-bottom: 18px;
}

.hero-title {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: clamp(2.3rem, 7vw, 3.4rem);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.hero-tagline {
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-2);
  margin: 0 0 14px;
  max-width: 34em;
}

.hero-intro {
  font-size: 0.96rem;
  color: var(--muted);
  margin: 0;
  max-width: 36em;
}

/* ---------------- 文章列表 ---------------- */
.posts {
  padding: 14px 0 40px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 34px 0 18px;
  margin: 0;
}

.section-label .count {
  color: var(--accent);
  letter-spacing: 0;
}

.post-card {
  display: grid;
  grid-template-columns: 106px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  transition: opacity 0.18s ease;
}

.post-card-date {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  padding-top: 7px;
  white-space: nowrap;
}

.post-card-title {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: 1.3rem;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.005em;
  margin: 0 0 7px;
}

.post-card-title a {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 0.28s ease, color 0.18s ease;
}

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

.post-card-summary {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 0.94rem;
  line-height: 1.7;
}

.post-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.76rem;
  color: var(--muted);
}

.tag {
  display: inline-block;
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.72rem;
  color: var(--muted);
  transition: color 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.tag:hover {
  color: var(--accent);
  border-color: currentColor;
  background: var(--accent-soft);
}

/* ---------------- 文章页 ---------------- */
.post-header {
  padding: 62px 0 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.post-eyebrow {
  margin: 0 0 16px;
}

.post-title {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: clamp(1.75rem, 5.2vw, 2.5rem);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

.post-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
}

/* 正文排版 */
.prose {
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--ink-2);
}

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

.prose p {
  margin: 0 0 1.35em;
}

.prose h2,
.prose h3,
.prose h4 {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  color: var(--ink);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.008em;
  margin: 2.2em 0 0.7em;
}

.prose h2 {
  font-size: 1.5rem;
  padding-bottom: 0.35em;
  border-bottom: 1px solid var(--line);
}

.prose h3 {
  font-size: 1.2rem;
}

.prose h4 {
  font-size: 1.02rem;
}

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  transition: text-decoration-color 0.18s ease;
  overflow-wrap: break-word;
}

.prose a:hover {
  text-decoration-color: currentColor;
}

.prose strong {
  color: var(--ink);
  font-weight: 650;
}

.prose em {
  font-style: italic;
}

.prose ul,
.prose ol {
  margin: 0 0 1.35em;
  padding-left: 1.4em;
}

.prose li {
  margin: 0.4em 0;
}

.prose li::marker {
  color: var(--muted);
}

.prose blockquote {
  margin: 1.8em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: normal;
}

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

.prose code {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.16em 0.4em;
  border-radius: 4px;
}

.prose pre {
  margin: 1.7em 0;
  padding: 18px 20px;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  line-height: 1.62;
  font-size: 0.84rem;
}

.prose pre code {
  background: none;
  padding: 0;
  font-size: inherit;
  color: var(--code-ink);
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.6em 0;
}

.prose img {
  margin: 1.6em 0;
  border: 1px solid var(--line);
}

.prose .table-wrap {
  margin: 1.7em 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.prose th {
  background: var(--bg-soft);
  color: var(--ink);
  font-weight: 600;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

/* 上一篇 / 下一篇 */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 56px 0 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.post-nav-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.post-nav-item span {
  font-size: 0.74rem;
  color: var(--muted);
}

.post-nav-item strong {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--ink);
}

.post-nav-item.next {
  text-align: right;
  align-items: flex-end;
}

.post-nav-item:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-2px);
}

.post-back {
  margin: 34px 0 60px;
  font-size: 0.88rem;
  color: var(--muted);
}

.post-back a:hover {
  color: var(--accent);
}

/* ---------------- 标签页 / 关于 ---------------- */
.page-head {
  padding: 62px 0 26px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  font-family: ui-serif, 'Iowan Old Style', Georgia, 'Songti SC', serif;
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 8px;
}

.page-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.page-eyebrow {
  margin-bottom: 12px;
}

.page-eyebrow a:hover {
  color: var(--accent);
}

.tag-cloud {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 30px 0 60px;
  margin: 0;
}

.tag-cloud a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.9rem;
  transition: all 0.18s ease;
}

.tag-cloud a:hover {
  color: var(--accent);
  border-color: currentColor;
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.tag-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--muted);
}

/* 404 */
.notfound {
  padding: 110px 0 130px;
  text-align: center;
}

.notfound-code {
  font-family: ui-serif, Georgia, serif;
  font-size: 5rem;
  line-height: 1;
  color: var(--line);
  margin: 0 0 10px;
}

.notfound h1 {
  font-family: ui-serif, Georgia, 'Songti SC', serif;
  font-size: 1.6rem;
  margin: 0 0 12px;
}

.notfound p {
  color: var(--muted);
}

.btn {
  display: inline-block;
  margin-top: 18px;
  padding: 9px 20px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.9rem;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.btn:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ---------------- 页脚 ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding: 30px 0 40px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
  .wrap {
    padding: 0 20px;
  }
  .header-inner {
    height: 56px;
    gap: 10px;
  }
  .site-title {
    font-size: 0.94rem;
    letter-spacing: 0.01em;
  }
  .site-nav {
    flex: 0 0 auto;
    gap: 0;
    font-size: 0.82rem;
  }
  .site-nav a {
    padding: 6px 6px;
  }
  .site-nav .nav-rss {
    display: none;
  }
  .theme-toggle {
    width: 30px;
    height: 30px;
    margin-left: 1px;
  }
  .hero {
    padding: 48px 0 26px;
  }
  .post-card {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 20px 0;
  }
  .post-card-date {
    padding-top: 0;
  }
  .post-header {
    padding: 40px 0 24px;
  }
  .post-nav {
    grid-template-columns: 1fr;
  }
  .post-nav-item.next {
    text-align: left;
    align-items: flex-start;
  }
  .prose {
    font-size: 1.0125rem;
  }
}

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

@media print {
  .site-header,
  .site-footer,
  .post-nav,
  .post-back,
  .theme-toggle {
    display: none;
  }
  body {
    background: #fff;
    color: #000;
  }
}
