:root {
  --bg: #0f0f0f;
  --bg2: #181818;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-muted: #888;
  --accent: #7aa2f7;
  --accent2: #9ece6a;
  --tag-bg: #1e2030;
  --font: "Georgia", serif;
  --mono: "JetBrains Mono", "Fira Code", "Courier New", monospace;
  --max-w: 720px;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
}

header nav {
  max-width: var(--max-w);
  margin: 0 auto;
}

.site-title {
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--text);
  font-family: var(--mono);
  letter-spacing: -0.02em;
}

.site-title:hover { text-decoration: none; color: var(--accent); }

main {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  width: 100%;
}

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

/* Index */
.blog-description {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2.5rem;
}

.tag {
  background: var(--tag-bg);
  color: var(--text-muted);
  padding: 0.2rem 0.7rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: var(--mono);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

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

.tag-count {
  opacity: 0.6;
}

.article-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.article-card {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
}

.article-card:last-child {
  border-bottom: none;
}

.article-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  font-family: var(--mono);
}

.dot { margin: 0 0.35rem; }

.tag-inline {
  color: var(--accent2);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.article-card h2 {
  font-size: 1.35rem;
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.article-card h2 a {
  color: var(--text);
}

.article-card h2 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.article-summary {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.4rem;
}

/* Article */
.page-article {
  max-width: 680px;
}

.article-header {
  margin-bottom: 2.5rem;
}

.article-header h1 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  line-height: 1.3;
}

.article-body p { margin-bottom: 1.2rem; }

.article-body ul,
.article-body ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}

.article-body li { margin-bottom: 0.3rem; }

.article-body blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  margin: 1.5rem 0;
  font-style: italic;
}

.article-body code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg2);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.article-body pre {
  background: var(--bg2) !important;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9rem;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.article-body th,
.article-body td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.article-body th {
  background: var(--bg2);
  color: var(--text-muted);
}

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

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

.article-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* Tag page */
.tag-heading {
  font-size: 1.5rem;
  margin-bottom: 2rem;
  color: var(--accent2);
  font-family: var(--mono);
}

.back-link {
  margin-top: 2rem;
}

/* Admin */
.page-admin {
  max-width: 100%;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.admin-header h1 {
  font-size: 1.5rem;
}

.btn {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 0.45rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  font-family: var(--mono);
}

.btn:hover { opacity: 0.85; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  text-align: center;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  font-family: var(--mono);
  color: var(--accent);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

section {
  margin-bottom: 2rem;
}

section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: normal;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-family: var(--mono);
  font-weight: normal;
  font-size: 0.8rem;
}

td code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.flag { vertical-align: middle; margin-right: 0.4rem; border-radius: 2px; }

.bar {
  height: 10px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0.7;
}

/* Preview banner */
.preview-banner {
  font-family: var(--mono);
  font-size: 0.8rem;
  text-align: center;
  padding: 0.4rem 1rem;
  margin-bottom: 2rem;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.preview-banner--draft {
  background: #2a2000;
  color: #f0a500;
  border: 1px solid #f0a500;
}

.preview-banner--internal {
  background: #0a1a2a;
  color: #7aa2f7;
  border: 1px solid #7aa2f7;
}

.empty {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.85rem;
}

/* Pygments highlight */
.highlight {
  background: var(--bg2) !important;
}

@media (max-width: 640px) {
  main { padding: 1.5rem 1rem; }
  .admin-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .article-header h1 { font-size: 1.5rem; }
}
