:root {
  --bg: #fafaf9;
  --bg-elevated: #f3f3f1;
  --text: #18181b;
  --text-muted: #52525b;
  --text-subtle: #71717a;
  --border: #e4e4e7;
  --accent: #18181b;
  --link: #0f4c81;
  --link-hover: #09355c;
  --code-bg: #f1f1ef;
  --pre-bg: #1e1f26;
  --pre-text: #f8f8f2;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Newsreader", Georgia, Cambria, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #111113;
  --bg-elevated: #19191d;
  --text: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-subtle: #71717a;
  --border: #27272a;
  --accent: #f4f4f5;
  --link: #7dd3fc;
  --link-hover: #bae6fd;
  --code-bg: #202026;
  --pre-bg: #181920;
  --pre-text: #f8f8f2;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.72;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--link) 35%, transparent);
  text-underline-offset: 3px;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

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

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header & Navigation */
.site-header {
  padding: 2rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.75rem;
}

.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.92rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

.nav-links a[aria-current="page"] {
  font-weight: 500;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background-color: var(--bg-elevated);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

[data-theme="dark"] .icon-moon {
  display: none;
}

[data-theme="light"] .icon-sun,
:root:not([data-theme]) .icon-sun {
  display: none;
}

/* Hero / About */
.hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.avatar {
  width: 84px;
  height: 84px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
}

.hero-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-serif);
  font-size: 1.95rem;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-muted);
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.1rem;
  margin: 0 0 2rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.social-row a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
}

.social-row a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

.about-prose p {
  margin: 0 0 1.15rem;
}

.about-prose p:last-child {
  margin-bottom: 0;
}

/* Section dividers & headings */
.section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-title {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
}

.section-more {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-decoration: none;
}

.section-more:hover {
  color: var(--text);
}

/* Posts list */
.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.post-item {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.55rem 0;
}

.post-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
  flex-shrink: 0;
  width: 6.75rem;
}

.post-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 450;
}

.post-link:hover {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.year-group {
  margin-bottom: 2.25rem;
}

.year-heading {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-subtle);
}

/* Page / Article */
.page-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-lead {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 0.96rem;
}

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

.post-back {
  display: inline-block;
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  text-decoration: none;
}

.post-back:hover {
  color: var(--text);
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text-subtle);
  margin: 0;
}

.article-body {
  font-size: 1rem;
  line-height: 1.75;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 2rem 0 0.75rem;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--text);
}

.article-body h1 {
  font-size: 1.5rem;
}

.article-body h2 {
  font-size: 1.3rem;
}

.article-body h3 {
  font-size: 1.12rem;
}

.article-body p,
.article-body ul,
.article-body ol,
.article-body blockquote {
  margin: 0 0 1.15rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35rem;
}

.article-body li + li {
  margin-top: 0.35rem;
}

.article-body blockquote {
  padding-left: 1rem;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
}

.article-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin: 0.5rem 0;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.14em 0.36em;
  border-radius: 4px;
}

.article-body pre,
.article-body .highlight pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  background: var(--pre-bg);
  color: var(--pre-text);
  padding: 1rem 1.15rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow-x: auto;
  margin: 1.25rem 0;
}

.article-body pre code {
  background: transparent;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.article-body hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 1.75rem 0 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.86rem;
  color: var(--text-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

@media (max-width: 560px) {
  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .post-item {
    flex-direction: column;
    gap: 0.15rem;
    padding: 0.65rem 0;
  }

  .post-date {
    width: auto;
  }
}

/* Resume */
.resume-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.resume-top .page-title {
  margin-bottom: 0.25rem;
}

.resume-subtitle {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-muted);
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-elevated);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.btn-download:hover {
  color: var(--text);
  border-color: var(--text-subtle);
  text-decoration: none;
}

.btn-download svg {
  width: 14px;
  height: 14px;
}

.resume-section {
  margin-top: 2.1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.resume-section .section-title {
  margin-bottom: 1.1rem;
}

.resume-item + .resume-item {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.resume-item-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.resume-org {
  margin: 0;
  font-size: 1.14rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

.resume-dates {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-subtle);
  white-space: nowrap;
  flex-shrink: 0;
}

.resume-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.15rem;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.resume-role {
  font-style: italic;
}

.resume-loc {
  font-size: 0.86rem;
  color: var(--text-subtle);
  white-space: nowrap;
}

.resume-bullets {
  margin: 0.55rem 0 0;
  padding-left: 1.15rem;
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--text);
}

.resume-bullets li + li {
  margin-top: 0.35rem;
}

.resume-bullets code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.1em 0.32em;
  border-radius: 4px;
}

.resume-note {
  margin: 0.45rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.skills-list {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: 0.94rem;
}

.skills-list dt {
  font-weight: 500;
  color: var(--text-muted);
}

.skills-list dd {
  margin: 0;
  color: var(--text);
}

@media (max-width: 560px) {
  .resume-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .resume-item-head,
  .resume-subhead {
    flex-direction: column;
    gap: 0.1rem;
  }

  .skills-list {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
  }

  .skills-list dt {
    margin-top: 0.55rem;
  }

  .skills-list dt:first-child {
    margin-top: 0;
  }
}

@media print {
  .site-header,
  .site-footer,
  .btn-download {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .resume-section {
    margin-top: 1.2rem;
    padding-top: 0.85rem;
  }
}
