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

/* ========== Variables ========== */
:root {
  --bg: #0d1117;
  --bg-surface: #161b22;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --accent: #58a6ff;
  --code-bg: #1c2128;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --content-width: 720px;
  --page-width: 1200px;
}

/* ========== Base ========== */
html {
  font-size: 20px;
}

body {
  font-family: var(--font-body);
  background-color: 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 {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

/* ========== Layout ========== */
.content {
  max-width: var(--page-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1rem;
  flex: 1;
}

/* ========== Header / Nav ========== */
.site-header {
  border-bottom: 1px solid var(--bg-surface);
}

.nav {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.nav-title:hover {
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

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

/* ========== Footer ========== */
.site-footer {
  border-top: 1px solid var(--bg-surface);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ========== Homepage Grid ========== */
.home-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 2rem;
  max-width: var(--page-width);
}

.home-posts {
  min-width: 0;
}

.home-sidebar {
  position: sticky;
  top: 2rem;
  align-self: start;
}

/* ========== Bio Sidebar ========== */
.bio {
  text-align: center;
  padding: 1.5rem 0;
}

.bio-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
}

.bio-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.bio-tagline {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  line-height: 1.4;
}

.bio-social {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.bio-social a {
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.bio-social a:hover {
  color: var(--accent);
}

/* ========== Post List ========== */
.post-list {
  list-style: none;
}

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

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

.post-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.post-title a {
  color: var(--text);
}

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

.post-meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.post-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 1rem;
  padding: 2rem 0;
}

.pagination a,
.pagination span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

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

/* ========== Single Post ========== */
article {
  max-width: var(--page-width);
}

.post-header {
  margin-bottom: 2rem;
}

.post-header h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
}

.post-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
}

.post-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.post-content p {
  margin-bottom: 1.25rem;
}

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

.post-content li {
  margin-bottom: 0.5rem;
}

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

.post-content img {
  border-radius: 4px;
  margin: 1.5rem 0;
}

/* ========== Code ========== */
code {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

p code, li code {
  background-color: var(--code-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

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

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

/* ========== Post Navigation ========== */
.post-nav {
  display: flex;
  justify-content: space-between;
  padding-top: 2rem;
  margin-top: 3rem;
  border-top: 1px solid var(--bg-surface);
  font-size: 0.9rem;
}

.post-nav a {
  color: var(--text-secondary);
}

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

/* ========== Presentations ========== */
.presentations {
  max-width: var(--page-width);
}

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

.talk-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--bg-surface);
}

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

.talk-detail {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

.talk-detail:first-child {
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
}

.talk-label {
  font-weight: 600;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .home-grid {
    grid-template-columns: 1fr;
  }

  .home-sidebar {
    order: -1;
    position: static;
    border-bottom: 1px solid var(--bg-surface);
    padding-bottom: 2rem;
    margin-bottom: 1rem;
  }

  .bio-social {
    flex-direction: row;
    justify-content: center;
    gap: 1.5rem;
  }
}

@media (max-width: 600px) {
  .post-header h1 {
    font-size: 1.5rem;
  }

  .post-nav {
    flex-direction: column;
    gap: 1rem;
  }
}
