:root {
  --bg: #0d1117;
  --bg-surface: #161b22;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-hover: #79c0ff;
  --border: #30363d;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --max-width: 720px;
}

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

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

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

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

/* Header */
header {
  border-bottom: 1px solid var(--border);
  padding: 2rem 1.5rem 0;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 600;
}

.tagline {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

nav {
  display: flex;
  gap: 0;
  margin-top: 1.5rem;
}

nav button {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 0.95rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

nav button:hover {
  color: var(--text);
}

nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* About */
#about h2,
#resume h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* Dictionary definition */
.definition {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.def-word {
  font-weight: 700;
  font-size: 1.15rem;
  font-style: italic;
  letter-spacing: 0.02em;
}

.def-pos {
  color: var(--text-muted);
  font-size: 0.825rem;
  font-style: italic;
  margin-left: 0.5rem;
}

.def-text {
  color: var(--text-muted);
  margin-left: 0.75rem;
}

.links-row {
  display: flex;
  gap: 1.25rem;
  margin-top: 1.25rem;
}

.links-row a {
  color: var(--text-muted);
  transition: color 0.15s;
}

.links-row a:hover {
  color: var(--accent);
  text-decoration: none;
}

.links-row svg {
  width: 22px;
  height: 22px;
  display: block;
}

.entry {
  margin-bottom: 1.25rem;
}

.entry-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}

.entry-header .date {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
}

.entry p {
  color: var(--text-muted);
  font-size: 0.925rem;
  margin-top: 0.25rem;
}

.entry p a {
  color: var(--accent);
}

/* Resume placeholder */
.placeholder {
  color: var(--text-muted);
  font-style: italic;
  margin-top: 2rem;
  text-align: center;
}

/* Blog */
#blog-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: border-color 0.15s;
}

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

.blog-card h3 {
  font-size: 1.05rem;
  font-weight: 500;
}

.blog-card .date {
  color: var(--text-muted);
  font-size: 0.825rem;
  margin-top: 0.25rem;
}

#blog-post {
  animation: fadeIn 0.2s ease;
}

#blog-back {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--font);
  font-size: 0.925rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.5rem;
}

#blog-back:hover {
  text-decoration: underline;
}

/* Rendered markdown in blog posts */
#blog-post-content h1 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

#blog-post-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}

#blog-post-content h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

#blog-post-content p {
  margin-bottom: 1rem;
}

#blog-post-content a {
  color: var(--accent);
}

#blog-post-content code {
  background: var(--bg-surface);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.875em;
}

#blog-post-content pre {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}

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

#blog-post-content ul,
#blog-post-content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

#blog-post-content blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

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

/* Empty blog state */
#blog-list:empty::after {
  content: "No posts yet.";
  color: var(--text-muted);
  font-style: italic;
}

/* Footer */
footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.825rem;
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Responsive */
@media (max-width: 600px) {
  header h1 {
    font-size: 1.4rem;
  }

  nav button {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }

  .entry-header {
    flex-direction: column;
    gap: 0.15rem;
  }

  .entry-header .date {
    margin-left: 0;
  }

  .links-row {
    flex-direction: column;
    gap: 0.5rem;
  }
}
