/* ============================================
   Murmur — Typecho 极简人文博客主题
   "让设计消失，让文字呼吸"
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --text-secondary: #6b6b6b;
  --border: #e0ddd8;
  --accent: #c05c3c;
  --code-bg: #f0eeeb;
  --code-inline-bg: #eae8e4;
  --selection: rgba(192, 92, 60, 0.15);

  --font-serif: "Source Han Serif SC", "Noto Serif SC", "Georgia", serif;
  --font-sans: "Source Han Sans SC", "Noto Sans SC", "Helvetica Neue", sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", monospace;
}

[data-theme="dark"] {
  --bg: #161614;
  --text: #d4d4d0;
  --text-secondary: #7a7a72;
  --border: #2a2a28;
  --accent: #d4836b;
  --code-bg: #1e1e1c;
  --code-inline-bg: #242422;
  --selection: rgba(212, 131, 107, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --text: #d4d4d0;
    --text-secondary: #7a7a72;
    --border: #2a2a28;
    --accent: #d4836b;
    --code-bg: #1e1e1c;
    --code-inline-bg: #242422;
    --selection: rgba(212, 131, 107, 0.15);
  }
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-serif);
  color: var(--text);
  background: var(--bg);
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* --- Layout --- */
.site-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 40px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.content-area {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  flex: 1;
  padding-top: 2rem;
}

/* --- Navigation --- */
.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 24px 0;
}

.site-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: baseline;
  font-family: var(--font-sans);
  font-size: 14px;
  letter-spacing: 0.05em;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.nav-links a.current {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
}

.nav-search-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.nav-search-btn:hover {
  color: var(--accent);
}

.nav-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* --- Search Bar --- */
.search-bar {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 0;
  display: none;
}

.search-bar.active {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-bar input {
  flex: 1;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-bottom-color: var(--accent);
}

.search-bar input::placeholder {
  color: var(--text-secondary);
}

.search-bar .search-close {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* --- Archive/Search Header --- */
.archive-header {
  margin-bottom: 2rem;
}

.archive-title {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* --- Post List (Homepage) --- */
.post-list-item {
  cursor: pointer;
}

.post-list-item a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.post-list-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
}

.post-list-title {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.4;
  margin: 0;
  transition: color 0.2s;
}

.post-list-item:hover .post-list-title,
.post-list-item a:hover .post-list-title {
  color: var(--accent);
}

.post-list-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.post-list-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-list-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

/* --- Article Page --- */
.article-header {
  margin-bottom: 2rem;
}

.article-title {
  font-family: var(--font-sans);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 12px;
}

.article-meta {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  display: flex;
  gap: 12px;
  align-items: baseline;
}

.article-tags {
  font-family: var(--font-sans);
}

/* --- Article Content --- */
.article-content {
  font-size: 1rem;
  line-height: 1.85;
}

.article-content p {
  margin: 0 0 1.5em;
  text-wrap: pretty;
}

.article-content h2 {
  font-family: var(--font-sans);
  font-size: 22px;
  font-weight: 600;
  margin: 2.5rem 0 1rem;
  line-height: 1.4;
}

.article-content h3 {
  font-family: var(--font-sans);
  font-size: 19px;
  font-weight: 600;
  margin: 2rem 0 0.8rem;
  line-height: 1.4;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.2s;
}

.article-content a:hover {
  opacity: 0.8;
}

/* Blockquote */
.article-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 1.5em;
  margin: 0 0 1.5em;
  font-style: normal;
  opacity: 0.8;
}

.article-content blockquote p {
  margin: 0;
}

/* Code */
.article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--code-inline-bg);
  padding: 2px 6px;
}

.article-content pre {
  background: var(--code-bg);
  padding: 1.5em;
  margin: 0 0 1.5em;
  overflow-x: auto;
  position: relative;
  line-height: 1.7;
}

.article-content pre code {
  background: none;
  padding: 0;
  font-size: 14px;
}

.article-content pre .lang-label {
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* Image */
.article-content figure {
  margin: 0 0 1.5em;
  text-align: center;
}

.article-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.article-content figcaption {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 0.5em;
  text-align: center;
}

/* HR */
.article-content hr {
  border: none;
  text-align: center;
  margin: 3rem 0;
  color: var(--text-secondary);
  font-size: 18px;
  letter-spacing: 12px;
}

.article-content hr::after {
  content: "· · ·";
}

/* Table */
.article-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 15px;
}

.article-content thead th {
  font-family: var(--font-sans);
  font-weight: 600;
  text-align: left;
  padding: 8px 12px 8px 0;
  border-bottom: 2px solid var(--text);
}

.article-content tbody td {
  padding: 8px 12px 8px 0;
  border-bottom: 1px solid var(--border);
}

/* Lists */
.article-content ul,
.article-content ol {
  margin: 0 0 1.5em;
  padding-left: 1.5em;
}

.article-content li {
  margin-bottom: 0.4em;
}

/* --- Post Navigation --- */
.post-nav {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-sans);
  font-size: 15px;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  gap: 24px;
}

.post-nav a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

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

.post-nav-next,
.post-nav a:last-child {
  text-align: right;
  margin-left: auto;
}

/* --- Comments --- */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.comments-title {
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 24px;
}

.comment-list,
.comment-list ol {
  list-style: none;
  padding: 0;
  margin: 0;
}

.comment-item {
  margin-bottom: 24px;
}

.comment-meta {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 6px;
}

.comment-author {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
}

.comment-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.comment-body {
  font-size: 15px;
  line-height: 1.75;
}

.comment-body p {
  margin: 0 0 0.8em;
}

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

.comment-children {
  margin-left: 1.5em;
  margin-top: 16px;
  padding-left: 1.5em;
  border-left: 1px solid var(--border);
}

/* Comment Form */
.comment-form-title {
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 500;
  margin: 32px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.comment-form-row {
  display: flex;
  gap: 24px;
  margin-bottom: 20px;
}

.comment-form-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-form-field label {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
}

.comment-form-field input,
.comment-form-field textarea {
  font-family: var(--font-serif);
  font-size: 15px;
  color: var(--text);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  outline: none;
  resize: none;
  transition: border-color 0.2s;
}

.comment-form-field input:focus,
.comment-form-field textarea:focus {
  border-bottom-color: var(--accent);
}

.comment-form-field textarea {
  min-height: 80px;
  line-height: 1.7;
}

.comment-form-submit {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.comment-form-submit button {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

.comment-form-submit button:hover {
  opacity: 0.7;
}

/* --- Projects Page --- */
.project-item {
  margin-bottom: 0;
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.project-name {
  font-family: var(--font-sans);
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.project-status {
  font-size: 14px;
  white-space: nowrap;
}

.project-status.active {
  color: var(--accent);
}

.project-status.archived {
  color: var(--text-secondary);
}

.project-desc {
  font-size: 15px;
  line-height: 1.7;
  margin: 6px 0;
}

.project-stack {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  margin: 4px 0;
}

.project-links {
  display: flex;
  gap: 16px;
  margin-top: 6px;
  font-size: 14px;
}

.project-links a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: opacity 0.2s;
}

.project-links a:hover {
  opacity: 0.7;
}

.project-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* --- Archive Page --- */
.archive-year {
  font-family: var(--font-sans);
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 16px;
}

.archive-group {
  margin-bottom: 2.5rem;
}

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-left: 4px;
}

.archive-item {
  display: flex;
  gap: 20px;
  align-items: baseline;
}

.archive-date {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
}

.archive-title {
  font-family: var(--font-sans);
  font-size: 16px;
}

.archive-title a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s;
}

.archive-title a:hover {
  color: var(--accent);
}

/* --- 404 Page --- */
.page-404 {
  text-align: center;
  padding: 6rem 0;
}

.page-404 h1 {
  font-family: var(--font-sans);
  font-size: 48px;
  font-weight: 700;
  margin-bottom: 1rem;
}

.page-404 p {
  color: var(--text-secondary);
  font-size: 16px;
}

.page-404 a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 32px 0 24px;
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-secondary);
}

.footer-inner {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.theme-toggle:hover {
  color: var(--accent);
}

.rss-link {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.rss-link:hover {
  color: var(--accent);
}

.rss-icon {
  width: 14px;
  height: 14px;
  vertical-align: -1px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  justify-content: center;
  gap: 24px;
  padding: 2rem 0;
  font-family: var(--font-sans);
  font-size: 14px;
}

.pagination a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

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

/* --- Page Transition --- */
.content-area {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .site-wrapper {
    padding: 0 1rem;
  }

  .nav-links {
    gap: 20px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .post-list-header {
    flex-direction: column;
    gap: 4px;
  }

  .post-list-date {
    order: -1;
  }

  .article-title {
    font-size: 24px;
  }

  .post-nav {
    flex-direction: column;
    gap: 12px;
  }

  .post-nav-next {
    text-align: left;
    margin-left: 0;
  }

  .comment-form-row {
    flex-direction: column;
    gap: 20px;
  }
}
