:root {
  --blue: #2563eb;
  --bg-color: #ffffff;
  --text-primary: #111111;
  --text-secondary: #4b5563;
  --text-muted: #8c8c8c;
  --border-color: #f3f4f6;
  --border-divider: #e5e7eb;
  --code-bg: #f8fafc;
  --code-border: #e2e8f0;
  --font-mono: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace;
}

html.dark {
  --blue: #3b82f6;
  --bg-color: #0d0d10;
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: #1f2937;
  --border-divider: #374151;
  --code-bg: #111827;
  --code-border: #1f2937;
}

p + p { margin-top: 1.1em; }

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.625;
  color: var(--text-primary);
  background: var(--bg-color);
  max-width: 680px;
  margin: 0 auto;
  padding: 50px 24px 100px;
  transition: background 0.2s ease, color 0.2s ease;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}

a:hover {
  opacity: 0.85;
}

hr {
  border: none;
  border-top: 1px solid var(--border-divider);
  margin: 32px 0;
}

/* NAV */
nav {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 48px;
  font-size: 14px;
}

.theme-toggle {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease, transform 0.1s ease;
  border-radius: 6px;
}

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

.theme-toggle:active {
  transform: scale(0.95);
}

.theme-toggle svg {
  display: block;
}

nav .nav-home {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 4px;
}

nav a {
  color: var(--text-secondary);
  transition: color 0.15s ease;
}

nav a:hover, nav a.active {
  color: var(--text-primary);
}

nav a.active {
  font-weight: 550;
  position: relative;
}

nav a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
}

/* HERO */
.hero-name {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}

.hero-name::after {
  content: '';
  display: block;
  width: 32px;
  height: 3px;
  background: var(--blue);
  margin-top: 12px;
  margin-bottom: 8px;
  border-radius: 1.5px;
}

.hero-sub {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.hero-links {
  font-size: 14px;
}

.hero-links a {
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-divider);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.hero-links a:hover {
  color: var(--blue);
  border-bottom-color: var(--blue);
  opacity: 1;
}

/* PAGE TITLE */
h1.page-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

h1.page-title::after {
  content: '';
  display: block;
  width: 32px;
  height: 3px;
  background: var(--blue);
  margin-top: 12px;
  margin-bottom: 28px;
  border-radius: 1.5px;
}

/* SECTION HEADINGS */
h2.section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 40px 0 16px;
}

/* TIMELINE / HISTORY */
.entry {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
}

.entry:last-child {
  border-bottom: 1px solid var(--border-color);
}

.entry-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding-top: 2px;
}

.entry-body p {
  margin-bottom: 8px;
}

.entry-body p:last-child {
  margin-bottom: 0;
}

.entry-role {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.entry-org {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 8px;
}

.entry-desc {
  color: var(--text-secondary);
  line-height: 1.6;
}

.entry-bullets {
  list-style: none;
  padding: 0;
  color: var(--text-secondary);
}

.entry-bullets li {
  padding-left: 14px;
  position: relative;
  margin-bottom: 5px;
}

.entry-bullets li::before {
  content: '–';
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

/* PROJECTS LIST */
.project-row {
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
}

.project-row:last-child {
  border-bottom: 1px solid var(--border-color);
}

.project-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.project-name {
  font-weight: 600;
  font-size: 14.5px;
}

.project-name a {
  color: var(--text-primary);
  transition: color 0.15s ease;
}

.project-name a:hover {
  color: var(--blue);
}

.project-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.project-desc {
  color: var(--text-secondary);
  font-size: 13.5px;
  line-height: 1.55;
}

/* POST BACK LINK */
.post-back {
  font-size: 14px;
  margin-top: 24px;
}

/* BLOG LIST */
.post-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--border-color);
  font-size: 14px;
}

.post-row:last-child {
  border-bottom: 1px solid var(--border-color);
}

.post-date {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding-top: 2px;
}

.post-title a {
  color: var(--text-primary);
  font-weight: 600;
  transition: color 0.15s ease;
}

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

.post-excerpt {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-top: 4px;
  line-height: 1.5;
}

.post-tags {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* BLOG POST */
.post-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.post-header h1 {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.post-header h1::after {
  content: '';
  display: block;
  width: 32px;
  height: 3px;
  background: var(--blue);
  margin-top: 14px;
  margin-bottom: 12px;
  border-radius: 1.5px;
}

.post-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.5;
}

.post-content {
  margin-top: 32px;
  font-size: 15px;
  line-height: 1.7;
}

.post-content h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 32px 0 12px;
  letter-spacing: -0.01em;
}

.post-content h3 {
  font-size: 15px;
  font-weight: 700;
  margin: 24px 0 10px;
}

.post-content p {
  margin-bottom: 16px;
}

.post-content a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(37, 99, 235, 0.25);
  transition: text-decoration-color 0.15s ease;
}

.post-content a:hover {
  text-decoration-color: var(--blue);
}

.post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 2px 5px;
  border-radius: 4px;
  color: var(--text-primary);
}

.post-content pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  padding: 16px;
  overflow-x: auto;
  margin: 20px 0;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}

.post-content pre code {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
}

.post-content blockquote {
  border-left: 3px solid var(--blue);
  padding-left: 16px;
  color: var(--text-secondary);
  margin: 20px 0;
  font-style: italic;
}

.post-content ul, .post-content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.post-content li {
  margin-bottom: 6px;
}

.post-content strong {
  font-weight: 600;
}

/* KaTeX */
.katex-display {
  margin: 24px 0;
  overflow-x: auto;
}

/* UTIL */
p.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

@media (max-width: 500px) {
  body {
    padding: 32px 16px 80px;
  }
  nav {
    margin-bottom: 36px;
  }
  .entry {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 16px 0;
  }
  .entry-time {
    font-size: 12px;
  }
  .post-row {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 14px 0;
  }
}
