
/* ============================================================
   Portfolio — minimal, content-first, dark/light mode
   ============================================================ */

:root {
  --bg: #ffffff;
  --bg-secondary: #f8f9fa;
  --text: #1a1a1a;
  --text-secondary: #555;
  --text-muted: #888;
  --border: #e0e0e0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --tag-bg: #f0f4ff;
  --tag-text: #2563eb;
  --code-bg: #f5f5f5;
  --code-text: #1a1a1a;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --max-width: 720px;
}

[data-theme="dark"] {
  --bg: #1a1a1a;
  --bg-secondary: #242424;
  --text: #e0e0e0;
  --text-secondary: #aaa;
  --text-muted: #777;
  --border: #333;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --tag-bg: #1e3a5f;
  --tag-text: #60a5fa;
  --code-bg: #2d2d2d;
  --code-text: #e0e0e0;
}

/* ---- Reset ---- */

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

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- Layout ---- */

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ---- Header ---- */

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

.site-header .header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header .site-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.site-logo {
  width: 28px;
  height: 28px;
}

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

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

.icon-link, .theme-toggle {
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.icon-link:hover, .theme-toggle:hover { color: var(--accent); text-decoration: none; }

/* Show/hide theme icons based on current theme */
.show-light, .show-dark { display: flex; align-items: center; }
.show-dark { display: none; }
[data-theme="dark"] .show-light { display: none; }
[data-theme="dark"] .show-dark { display: flex; }

/* ---- Profile section ---- */

.profile-section {
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.profile-section h2 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.profile-section .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.profile-section .bio {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ---- Tag filter ---- */

.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 600px) {
  .tag-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 0.25rem;
  }
  .tag-btn { white-space: nowrap; }
}

.tag-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.tag-btn:hover { border-color: var(--accent); color: var(--accent); }
.tag-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Post list ---- */

.post-list { list-style: none; }

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

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

.post-item .post-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.post-item .post-title a { color: var(--text); cursor: pointer; }
.post-item .post-title a:hover { color: var(--accent); text-decoration: none; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.post-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.post-tag {
  background: var(--tag-bg);
  color: var(--tag-text);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.75rem;
  cursor: pointer;
}

.post-tag:hover { opacity: 0.8; }
.post-tag.active { background: var(--accent); color: #fff; }

.post-tldr {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ---- Post detail ---- */

.post-detail { padding-top: 0.5rem; }

.post-detail .back-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.post-detail .back-link:hover { color: var(--accent); }

.post-detail h1 {
  font-size: 1.75rem;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-detail .post-repos {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.post-detail .post-repos span { color: var(--text-muted); }

/* ---- Markdown content ---- */

.markdown-content {
  margin-top: 2rem;
  line-height: 1.7;
}

.markdown-content h2 {
  font-size: 1.3rem;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--border);
}

.markdown-content h3 {
  font-size: 1.1rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.markdown-content p { margin-bottom: 1rem; }

.markdown-content ul, .markdown-content ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

.markdown-content li { margin-bottom: 0.3rem; }

.markdown-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

.markdown-content pre {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.markdown-content pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.5;
}

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

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

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

.markdown-content th {
  background: var(--bg-secondary);
  font-weight: 600;
}

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

/* ---- Footer ---- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-footer .version { opacity: 0.5; }

/* ---- Syntax highlighting (highlight.js GitHub theme) ---- */

pre code.hljs { display: block; overflow-x: auto; padding: 1em; }
code.hljs { padding: 3px 5px; }

.hljs { color: #24292e; background: var(--code-bg); }
.hljs-doctag, .hljs-keyword, .hljs-meta .hljs-keyword, .hljs-template-tag,
.hljs-template-variable, .hljs-type, .hljs-variable.language_ { color: #d73a49; }
.hljs-title, .hljs-title.class_, .hljs-title.class_.inherited__,
.hljs-title.function_ { color: #6f42c1; }
.hljs-attr, .hljs-attribute, .hljs-literal, .hljs-meta, .hljs-number,
.hljs-operator, .hljs-selector-attr, .hljs-selector-class, .hljs-selector-id,
.hljs-variable { color: #005cc5; }
.hljs-meta .hljs-string, .hljs-regexp, .hljs-string { color: #032f62; }
.hljs-built_in, .hljs-symbol { color: #e36209; }
.hljs-code, .hljs-comment, .hljs-formula { color: #6a737d; }
.hljs-name, .hljs-quote, .hljs-selector-pseudo, .hljs-selector-tag { color: #22863a; }
.hljs-subst { color: #24292e; }
.hljs-section { color: #005cc5; font-weight: 700; }
.hljs-bullet { color: #735c0f; }
.hljs-emphasis { color: #24292e; font-style: italic; }
.hljs-strong { color: #24292e; font-weight: 700; }
.hljs-addition { color: #22863a; background-color: #f0fff4; }
.hljs-deletion { color: #b31d28; background-color: #ffeef0; }

[data-theme="dark"] .hljs { color: #c9d1d9; background: var(--code-bg); }
[data-theme="dark"] .hljs-doctag, [data-theme="dark"] .hljs-keyword,
[data-theme="dark"] .hljs-meta .hljs-keyword, [data-theme="dark"] .hljs-template-tag,
[data-theme="dark"] .hljs-template-variable, [data-theme="dark"] .hljs-type,
[data-theme="dark"] .hljs-variable.language_ { color: #ff7b72; }
[data-theme="dark"] .hljs-title, [data-theme="dark"] .hljs-title.class_,
[data-theme="dark"] .hljs-title.class_.inherited__,
[data-theme="dark"] .hljs-title.function_ { color: #d2a8ff; }
[data-theme="dark"] .hljs-attr, [data-theme="dark"] .hljs-attribute,
[data-theme="dark"] .hljs-literal, [data-theme="dark"] .hljs-meta,
[data-theme="dark"] .hljs-number, [data-theme="dark"] .hljs-operator,
[data-theme="dark"] .hljs-selector-attr, [data-theme="dark"] .hljs-selector-class,
[data-theme="dark"] .hljs-selector-id, [data-theme="dark"] .hljs-variable { color: #79c0ff; }
[data-theme="dark"] .hljs-meta .hljs-string, [data-theme="dark"] .hljs-regexp,
[data-theme="dark"] .hljs-string { color: #a5d6ff; }
[data-theme="dark"] .hljs-built_in, [data-theme="dark"] .hljs-symbol { color: #ffa657; }
[data-theme="dark"] .hljs-code, [data-theme="dark"] .hljs-comment,
[data-theme="dark"] .hljs-formula { color: #8b949e; }
[data-theme="dark"] .hljs-name, [data-theme="dark"] .hljs-quote,
[data-theme="dark"] .hljs-selector-pseudo, [data-theme="dark"] .hljs-selector-tag { color: #7ee787; }
[data-theme="dark"] .hljs-subst { color: #c9d1d9; }
[data-theme="dark"] .hljs-section { color: #1f6feb; font-weight: 700; }
[data-theme="dark"] .hljs-bullet { color: #f2cc60; }
[data-theme="dark"] .hljs-emphasis { color: #c9d1d9; font-style: italic; }
[data-theme="dark"] .hljs-strong { color: #c9d1d9; font-weight: 700; }
[data-theme="dark"] .hljs-addition { color: #aff5b4; background-color: #033a16; }
[data-theme="dark"] .hljs-deletion { color: #ffdcd7; background-color: #67060c; }

/* ---- Responsive ---- */

@media (max-width: 640px) {
  .main-content { padding: 1.5rem 1rem; }
  .post-detail h1 { font-size: 1.4rem; }
  .profile-section h2 { font-size: 1.3rem; }
}
