/*
Theme Name: Cook1e Minimal
Theme URI: https://cook1e.cc
Author: Cook1e
Description: 极简现代风格个人博客主题，支持浅色与深色模式无缝切换。
Version: 1.0.0
Text Domain: cook1e-minimal
*/

:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f4f4f5;
  --header-bg: rgba(250, 250, 250, 0.82);
  --text: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --border: #e4e4e7;
  --accent: #18181b;
  --accent-text: #ffffff;
  --accent-soft: #f4f4f5;
  --code-bg: #f4f4f5;
  --link: #09090b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --container: 760px;
}

[data-theme="dark"] {
  --bg: #0b0b0e;
  --surface: #131318;
  --surface-hover: #1b1b22;
  --header-bg: rgba(11, 11, 14, 0.82);
  --text: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --border: #27272a;
  --accent: #f4f4f5;
  --accent-text: #09090b;
  --accent-soft: #1c1c24;
  --code-bg: #18181f;
  --link: #fafafa;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  line-height: 1.7;
  transition: background-color 0.22s ease, color 0.22s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.22s ease, border-color 0.22s ease;
}

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

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
  color: var(--text-secondary);
  transition: background-color 0.16s ease, color 0.16s ease;
}

.site-nav a:hover,
.site-nav .current-menu-item > a {
  color: var(--text);
  background: var(--accent-soft);
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
  padding: 0;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.icon-sun {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: block;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

/* Search Bar */
.header-search {
  border-top: 1px solid var(--border);
  padding: 12px 0;
  display: none;
}

.header-search.is-open {
  display: block;
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-input {
  flex: 1;
  height: 40px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--text-muted);
}

.search-submit {
  height: 40px;
  padding: 0 18px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

/* Main */
.site-main {
  flex: 1;
  padding: 44px 0 72px;
}

/* Hero */
.hero {
  padding: 12px 0 40px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8rem;
  margin-bottom: 16px;
}

.hero-title {
  margin: 0 0 12px;
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
}

.hero-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 1.02rem;
  max-width: 600px;
}

/* Archive / Search Header */
.archive-header {
  padding-bottom: 24px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.archive-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.archive-title {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 680;
  letter-spacing: -0.02em;
}

/* Post Feed */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  padding: 24px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: var(--text-muted);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.post-cat {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
}

.post-cat:hover {
  color: var(--text);
}

.post-card-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.38;
}

.post-card-title a:hover {
  opacity: 0.78;
}

.post-excerpt {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.68;
}

.post-readmore {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 14px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text);
}

/* Single Post & Page */
.article-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

.article-title {
  margin: 10px 0 0;
  font-size: clamp(1.65rem, 3.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.28;
}

.article-cover {
  margin: 0 0 32px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}

.prose {
  font-size: 1.02rem;
  line-height: 1.85;
  color: var(--text);
}

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

.prose h2 {
  margin: 2.1em 0 0.75em;
  font-size: 1.42rem;
  font-weight: 660;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.prose h3 {
  margin: 1.7em 0 0.6em;
  font-size: 1.18rem;
  font-weight: 640;
  line-height: 1.4;
}

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

.prose a {
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--text-muted);
}

.prose a:hover {
  text-decoration-color: var(--text);
}

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

.prose li {
  margin: 0.35em 0;
}

.prose blockquote {
  margin: 1.5em 0;
  padding: 12px 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  border-radius: 0 8px 8px 0;
  color: var(--text-secondary);
}

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

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--code-bg);
}

.prose pre {
  margin: 1.5em 0;
  padding: 16px 18px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  overflow-x: auto;
  line-height: 1.6;
}

.prose pre code {
  padding: 0;
  background: transparent;
  font-size: 0.87rem;
}

.prose img {
  border-radius: 10px;
  margin: 1.5em auto;
  border: 1px solid var(--border);
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.94rem;
}

.prose th,
.prose td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
}

.prose th {
  background: var(--surface);
  font-weight: 600;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.tag-pill {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.tag-pill:hover {
  color: var(--text);
}

.post-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 32px;
}

.post-nav-item {
  display: block;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.16s ease;
}

.post-nav-item:hover {
  border-color: var(--text-muted);
}

.post-nav-label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.post-nav-title {
  display: block;
  font-size: 0.94rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 36px;
}

.pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.pagination .page-numbers.current {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* Comments */
.comments-area {
  margin-top: 44px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.comments-title {
  margin: 0 0 20px;
  font-size: 1.15rem;
  font-weight: 650;
}

.comment-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment-list .children {
  list-style: none;
  padding-left: 22px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-body {
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
}

.comment-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.comment-author .fn {
  font-style: normal;
  font-weight: 600;
  color: var(--text);
}

.comment-author img {
  display: inline-block;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}

.comment-respond {
  margin-top: 24px;
}

.comment-form label {
  display: block;
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
}

.comment-form input:focus,
.comment-form textarea:focus {
  outline: none;
  border-color: var(--text-muted);
}

.comment-form .submit {
  padding: 10px 20px;
  border-radius: 9px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.92rem;
  font-weight: 500;
  cursor: pointer;
}

/* Empty & 404 */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}

.empty-state h1,
.empty-state h2 {
  margin: 0 0 10px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--text-secondary);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 9px 18px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

@media (max-width: 640px) {
  .container {
    padding: 0 18px;
  }

  .site-main {
    padding: 28px 0 56px;
  }

  .post-card {
    padding: 18px;
  }

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

  .site-nav a {
    padding: 6px 8px;
    font-size: 0.86rem;
  }
}
