@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg: #f4f5f7;
  --bg-card: #ffffff;
  --border: #e2e6ea;
  --accent: #2563eb;
  --accent-light: #eff6ff;
  --text: #1e2433;
  --text-mid: #4a5568;
  --text-dim: #9aa5b4;
  --tag-bg: #f1f5f9;
  --tag-text: #475569;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.1);
  --font: 'Inter', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --radius: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
}

.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 2rem;
}

.site-logo { text-decoration: none; font-weight: 700; font-size: 1.1rem; color: var(--text); white-space: nowrap; }
.site-logo span { color: var(--accent); }

.site-nav { display: flex; gap: 0.25rem; margin-left: auto; }

.site-nav a {
  color: var(--text-mid);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  transition: all 0.15s;
}

.site-nav a:hover { color: var(--accent); background: var(--accent-light); }

.header-search { position: relative; width: 200px; }

.header-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); background: #fff; }
.header-search input::placeholder { color: var(--text-dim); }

#search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  z-index: 200;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
}

.search-result-item { display: block; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); text-decoration: none; transition: background 0.15s; }
.search-result-item:hover { background: var(--bg); }
.sr-title { display: block; color: var(--accent); font-size: 0.88rem; font-weight: 600; margin-bottom: 0.15rem; }
.sr-excerpt { display: block; color: var(--text-dim); font-size: 0.78rem; }
.no-results { padding: 1rem; color: var(--text-dim); font-size: 0.85rem; text-align: center; }

.site-main { max-width: 1100px; margin: 0 auto; padding: 2.5rem 2rem 4rem; }

.home-hero {
  margin-bottom: 2.5rem;
  padding: 2.5rem;
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.home-hero h1 { font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.home-hero h1 span { color: var(--accent); }
.home-hero p { color: var(--text-mid); font-size: 1rem; max-width: 540px; }

.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.25rem; }

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}

.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); border-color: #c9d4e0; }

.post-meta-top { display: flex; align-items: center; gap: 0.6rem; }
.post-meta-top time { font-size: 0.78rem; color: var(--text-dim); }

.post-category {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.post-card-title { font-size: 1.08rem; font-weight: 700; line-height: 1.35; }
.post-card-title a { color: var(--text); text-decoration: none; transition: color 0.15s; }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt { color: var(--text-mid); font-size: 0.88rem; line-height: 1.6; flex: 1; }

.post-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.75rem; border-top: 1px solid var(--border); margin-top: 0.25rem; }

.post-tags { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.tag { font-size: 0.72rem; color: var(--tag-text); background: var(--tag-bg); padding: 0.15rem 0.5rem; border-radius: 4px; text-decoration: none; transition: background 0.15s, color 0.15s; }
.tag:hover { background: var(--accent-light); color: var(--accent); }

.read-more { font-size: 0.82rem; font-weight: 600; color: var(--accent); text-decoration: none; white-space: nowrap; }
.read-more:hover { text-decoration: underline; }

.newsletter-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  margin-top: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.newsletter-text h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 0.3rem; }
.newsletter-text p { color: var(--text-mid); font-size: 0.9rem; }
.newsletter-form { display: flex; gap: 0.5rem; }

.newsletter-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.88rem;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  outline: none;
  width: 210px;
  transition: border-color 0.2s;
}

.newsletter-form input:focus { border-color: var(--accent); }
.newsletter-form input::placeholder { color: var(--text-dim); }

.newsletter-form button {
  background: var(--accent);
  color: #fff;
  font-family: var(--font);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
  white-space: nowrap;
}

.newsletter-form button:hover { background: #1d4ed8; }

.post-full { max-width: 720px; margin: 0 auto; padding: 2.5rem 0; }
.post-header { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }

.post-header-meta { font-size: 0.82rem; color: var(--text-dim); margin-bottom: 0.75rem; display: flex; align-items: center; gap: 0.5rem; }
.divider { color: var(--border); }
.post-cat-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.post-cat-link:hover { text-decoration: underline; }

.post-title { font-size: 2rem; font-weight: 700; color: var(--text); line-height: 1.25; margin-bottom: 0.75rem; }
.post-tags-header { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.post-content { color: var(--text); line-height: 1.85; }
.post-content h2 { font-size: 1.4rem; font-weight: 700; margin: 2rem 0 0.75rem; }
.post-content h3 { font-size: 1.15rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.post-content p { margin-bottom: 1.25rem; }
.post-content a { color: var(--accent); }
.post-content a:hover { text-decoration: underline; }
.post-content ul, .post-content ol { margin: 0.75rem 0 1.25rem 1.5rem; }
.post-content li { margin-bottom: 0.35rem; }

.post-content code { font-family: var(--mono); font-size: 0.85em; background: var(--tag-bg); border: 1px solid var(--border); padding: 0.1em 0.4em; border-radius: 4px; color: #d63384; }

.post-content pre { background: #1e2433; border-radius: 8px; padding: 1.25rem 1.5rem; overflow-x: auto; margin: 1.5rem 0; }
.post-content pre code { background: none; border: none; padding: 0; color: #e2e8f0; font-size: 0.88rem; }

.post-content blockquote { border-left: 3px solid var(--accent); margin: 1.5rem 0; padding: 0.75rem 1.25rem; background: var(--accent-light); border-radius: 0 6px 6px 0; color: var(--text-mid); font-style: italic; }

.author-bio { display: flex; gap: 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; margin: 2.5rem 0 1.5rem; align-items: flex-start; }

.author-avatar { width: 58px; height: 58px; border-radius: 50%; background: var(--accent-light); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.avatar-initials { font-weight: 700; font-size: 1rem; color: var(--accent); }
.author-info { flex: 1; }
.author-name { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.1rem; }
.author-title { font-size: 0.8rem; color: var(--accent); font-weight: 500; margin-bottom: 0.5rem; }
.author-desc { font-size: 0.88rem; color: var(--text-mid); line-height: 1.6; margin-bottom: 0.6rem; }
.author-links { display: flex; gap: 1rem; }
.author-links a { font-size: 0.82rem; color: var(--text-dim); text-decoration: none; font-weight: 500; transition: color 0.15s; }
.author-links a:hover { color: var(--accent); }

.post-nav { display: flex; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.post-nav-item { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; padding: 1rem 1.25rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius); flex: 1; transition: border-color 0.2s, box-shadow 0.2s; }
.post-nav-item:hover { border-color: var(--accent); box-shadow: var(--shadow-hover); }
.post-nav-item.next { text-align: right; }
.nav-label { font-size: 0.75rem; color: var(--text-dim); }
.nav-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }

.site-footer { border-top: 1px solid var(--border); background: #fff; padding: 1.75rem 0; margin-top: 2rem; }
.footer-inner { max-width: 1100px; margin: 0 auto; padding: 0 2rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-logo { font-weight: 700; font-size: 1rem; color: var(--text); }
.footer-logo span { color: var(--accent); }
.footer-left p { font-size: 0.82rem; color: var(--text-dim); margin-top: 0.2rem; }
.footer-copy, .footer-stack { font-size: 0.78rem; color: var(--text-dim); text-align: right; }

.page-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin-bottom: 2rem; }
.page-title span { color: var(--accent); }

.category-group, .tag-group { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.category-name, .tag-name { font-size: 0.95rem; font-weight: 700; color: var(--text); padding-bottom: 0.6rem; margin-bottom: 0.75rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 0.5rem; }
.category-name span, .tag-name span { background: var(--accent-light); color: var(--accent); font-size: 0.72rem; font-weight: 600; padding: 0.1rem 0.5rem; border-radius: 20px; }
.category-posts { list-style: none; }
.category-posts li { display: flex; align-items: center; gap: 1rem; padding: 0.45rem 0; border-bottom: 1px solid var(--border); }
.category-posts li:last-child { border-bottom: none; }
.category-posts time { font-size: 0.78rem; color: var(--text-dim); white-space: nowrap; }
.category-posts a { color: var(--text); text-decoration: none; font-size: 0.92rem; transition: color 0.15s; }
.category-posts a:hover { color: var(--accent); }

@media (max-width: 768px) {
  .header-search { display: none; }
  .site-nav a { padding: 0.35rem 0.5rem; font-size: 0.82rem; }
  .posts-grid { grid-template-columns: 1fr; }
  .newsletter-section { flex-direction: column; }
  .newsletter-form { flex-direction: column; width: 100%; }
  .newsletter-form input { width: 100%; }
  .post-title { font-size: 1.5rem; }
  .author-bio { flex-direction: column; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-copy, .footer-stack { text-align: center; }
  .home-hero { padding: 1.5rem; }
}
