:root {
  --bg: #ffffff;
  --bg-secondary: #f5f5f5;
  --text: #1a1a1a;
  --text-secondary: #595959;
  --accent: #2563eb;
  --border: #e2e2e2;
  --code-bg: #f0f0f0;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Malgun Gothic", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg: #121212;
  --bg-secondary: #1e1e1e;
  --text: #e8e8e8;
  --text-secondary: #a8a8a8;
  --accent: #60a5fa;
  --border: #333333;
  --code-bg: #1e1e1e;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  transition: background-color .2s ease, color .2s ease;
}

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

.container {
  max-width: 68ch;
  margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 68ch;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--text);
}

#theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

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

.site-footer {
  max-width: 68ch;
  margin: 3rem auto 0;
  padding: 1.5rem 1rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

.loading, .error {
  color: var(--text-secondary);
}

.error { color: #dc2626; }

/* 글 목록 카드 */
.post-card {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}

.post-card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.post-card h2 a { text-decoration: none; }
.post-card h2 a:hover { text-decoration: underline; }

.post-card time {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.post-card p { margin: 0; }

/* 글 상세 */
.prose h1 { margin-top: 0.5rem; }

.prose > time {
  display: block;
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2rem;
}

#post-content h1 { font-size: 2rem; line-height: 1.3; margin-bottom: 0.25rem; }
#post-content h2 { font-size: 1.5rem; line-height: 1.3; margin-top: 2rem; }
#post-content h3 { font-size: 1.25rem; line-height: 1.3; margin-top: 1.5rem; }

#post-content p,
#post-content ul,
#post-content ol,
#post-content blockquote,
#post-content table,
#post-content pre {
  margin: 1rem 0;
}

#post-content code {
  font-family: var(--font-mono);
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

#post-content pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
}

#post-content pre code {
  background: none;
  padding: 0;
}

#post-content blockquote {
  border-left: 3px solid var(--accent);
  margin-left: 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--text-secondary);
}

#post-content table {
  border-collapse: collapse;
  width: 100%;
}

#post-content th,
#post-content td {
  border: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

#post-content img {
  max-width: 100%;
  border-radius: 8px;
}

/* 모바일 */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  .site-header { padding: 1rem; }
  #post-content h1 { font-size: 1.6rem; }
  #post-content h2 { font-size: 1.3rem; }
}

@media (min-width: 1024px) {
  .site-header { padding: 1.5rem 1rem; }
}
