:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --text: #1a1c20;
  --muted: #5f6672;
  --border: #e4e7ec;
  --accent: #d97706;
  --accent-hover: #b45309;
  --code-bg: #f1f3f6;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

:root[data-theme="dark"] {
  --bg: #111317;
  --surface: #181b21;
  --text: #e6e8ec;
  --muted: #9aa2b1;
  --border: #2a2f3a;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --code-bg: #222630;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111317;
    --surface: #181b21;
    --text: #e6e8ec;
    --muted: #9aa2b1;
    --border: #2a2f3a;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --code-bg: #222630;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.875rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-size: 0.925rem;
  font-weight: 500;
}

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

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 1.25rem 0;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--muted);
}

.filter-banner {
  margin-top: 1.25rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.hidden {
  display: none !important;
}

.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.9rem;
  font-size: 0.825rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.post-title {
  margin: 0.15rem 0 0.75rem;
  font-size: 1.45rem;
  line-height: 1.3;
}

.post-title a {
  color: var(--text);
  text-decoration: none;
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--muted);
  text-decoration: none;
  border: 1px solid var(--border);
}

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

.markdown-body {
  margin-top: 0.75rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 1.35rem 0 0.5rem;
  line-height: 1.3;
}

.markdown-body p {
  margin: 0.75rem 0;
}

.markdown-body a {
  color: var(--accent);
}

.markdown-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--code-bg);
  padding: 0.15em 0.35em;
  border-radius: 4px;
}

.markdown-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  line-height: 1.45;
}

.markdown-body pre code {
  background: transparent;
  padding: 0;
}

.markdown-body blockquote {
  margin: 0.9rem 0;
  padding: 0.25rem 1rem;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.markdown-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 6px;
}

.markdown-body .video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1rem 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--code-bg);
}

.markdown-body .video-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.post-excerpt-fade {
  max-height: 15rem;
  overflow: hidden;
  position: relative;
}

.post-excerpt-fade::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3.5rem;
  background: linear-gradient(transparent, var(--surface));
  pointer-events: none;
}

.read-more {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}

.read-more:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 1.5rem 0 2.5rem;
  gap: 1rem;
}

.btn {
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.875rem;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-small {
  padding: 0.2rem 0.55rem;
  font-size: 0.75rem;
}

.btn-ghost {
  background: transparent;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  margin-top: 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.loading,
.error-box {
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
}

.error-box {
  border-left: 3px solid #dc2626;
  color: var(--text);
}
