/* Light mode (default) */
:root {
  --bg: #E7ECF1;
  --bg-secondary: #d4dce5;
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #2563eb;
  --border: rgba(100, 116, 139, 0.2);
}

/* Dark mode */
[data-theme="dark"] {
  --bg: #0D1A06;
  --bg-secondary: #172E0B;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #22c55e;
  --border: rgba(148, 163, 184, 0.2);
}

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

html {
  font-size: 16px;
}

body {
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  opacity: 0.8;
}

.container {
  width: 100%;
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

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

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

.site-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

nav {
  display: flex;
  gap: 1.5rem;
}

nav a {
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

main {
  flex: 1;
  padding: 3rem 0;
}

footer {
  padding: 2rem 0;
  border-top: 1px dotted var(--border);
}

footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.social-links {
  display: flex;
  gap: 1.25rem;
}

h1, h2, h3 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 1rem;
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; margin-top: 2rem; }
h3 { font-size: 1rem; margin-top: 1.5rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-muted);
}

strong { color: var(--text); }

code {
  font-size: 0.85em;
  background: var(--bg-secondary);
  padding: 0.15em 0.4em;
  border-radius: 0;
}

pre {
  background: var(--bg-secondary);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

pre code {
  background: none;
  padding: 0;
}

ul, ol {
  margin: 1rem 0 1rem 1.5rem;
  color: var(--text-muted);
}

li { margin-bottom: 0.5rem; }

img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.article-item {
  padding: 1.25rem 0;
  border-bottom: 1px dotted var(--border);
}

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

.article-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

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

.article-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.intro {
  margin-bottom: 3rem;
}

.article-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px dotted var(--border);
}

.article-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  font-style: italic;
}

hr {
  border: none;
  border-top: 1px dotted var(--border);
  margin: 2rem 0;
}

.img-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.img-row img {
  height: 200px;
  width: auto;
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }

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

/* Collapsible code blocks */
.code-block {
  position: relative;
  margin: 1.5rem 0;
}

.code-block pre {
  margin: 0;
  max-height: 15em;
  overflow: hidden;
}

.code-block.expanded pre {
  max-height: none;
}

.code-block:not(.expanded)::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3em;
  background: linear-gradient(transparent, var(--bg-secondary));
  pointer-events: none;
  border-radius: 0 0 6px 6px;
}

.code-toggle {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 0.65rem;
  font-family: inherit;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  cursor: pointer;
  z-index: 1;
}

.code-toggle:hover {
  background: var(--accent);
  color: var(--bg);
}

@media (max-width: 600px) {
  header .container {
    flex-direction: column;
    align-items: flex-start;
  }
  nav { gap: 1rem; }
  h1 { font-size: 1.3rem; }
}
