:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #343942;
  --muted: #69707a;
  --line: #e5e8ec;
  --link: #2574a9;
  --link-dark: #155d8b;
  --soft: #f6f8fa;
  --soft-strong: #eef3f7;
  --code-bg: #f3f5f7;
  --header-bg: rgb(255 255 255 / 94%);
  --accent: #4f76ad;
  --shadow: 0 18px 38px rgb(15 23 42 / 6%);
}

body.theme-dark {
  color-scheme: dark;
  --bg: #111418;
  --ink: #e8edf3;
  --muted: #a8b0ba;
  --line: #2a3038;
  --link: #8ac5e4;
  --link-dark: #b7ddf0;
  --soft: #181d24;
  --soft-strong: #202732;
  --code-bg: #1c222b;
  --header-bg: rgb(17 20 24 / 94%);
  --accent: #8ab3e8;
  --shadow: 0 18px 38px rgb(0 0 0 / 24%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, "Noto Sans SC", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
}

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

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

img {
  display: block;
  max-width: 100%;
}

.wrap {
  width: min(1420px, calc(100% - 96px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-top: 3px solid var(--accent);
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(14px);
}

.header-grid {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: flex-start;
  gap: 72px;
}

.brand {
  color: var(--ink);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0;
}

.brand:hover {
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 34px;
  font-size: 1.08rem;
  font-weight: 500;
}

.nav a {
  color: var(--muted);
}

.nav a:hover {
  color: var(--ink);
  text-decoration: none;
}

.theme-toggle {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.05em;
  line-height: 1;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--line);
  background: var(--soft);
}

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 96px;
  align-items: start;
  padding-block: 52px 80px;
}

.sidebar {
  position: sticky;
  top: 28px;
}

.profile {
  text-align: left;
}

.avatar {
  width: 320px;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  padding: 7px;
  background: var(--bg);
  box-shadow: var(--shadow);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.profile h2 {
  margin: 22px 0 10px;
  color: var(--ink);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.12;
}

.profile-links {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink);
  font-size: 1.06rem;
  line-height: 1.15;
}

.profile-links li {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
}

.profile-links a,
.profile-links li > span:last-child {
  color: var(--ink);
}

.profile-links a:hover {
  color: var(--link-dark);
}

.profile-icon {
  display: inline-grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  line-height: 1;
}

.profile-icon svg {
  width: 29px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.25;
}

.profile-icon-gh {
  font-size: 1.18rem;
  letter-spacing: 0;
}

.profile-icon-linkedin {
  font-size: 1.36rem;
  letter-spacing: 0;
}

.content {
  min-width: 0;
  max-width: 940px;
}

.section {
  border-bottom: 1px solid var(--line);
  padding: 0 0 46px;
  margin-bottom: 42px;
  scroll-margin-top: 96px;
}

.section:last-child {
  border-bottom: 0;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  margin-bottom: 20px;
  color: var(--ink);
  font-size: clamp(2.15rem, 4vw, 2.7rem);
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  color: var(--ink);
  font-size: 1.72rem;
  font-weight: 800;
  letter-spacing: 0;
}

h3 {
  font-size: 1.18rem;
}

p {
  margin: 0 0 20px;
}

ul,
ol {
  margin: 0 0 14px;
  padding-left: 1.25rem;
}

li + li {
  margin-top: 18px;
}

.interest-list {
  display: grid;
  gap: 16px;
  margin: 6px 0 22px;
  padding: 0;
  list-style: none;
}

.interest-list li {
  margin: 0;
  border-left: 3px solid var(--accent);
  padding: 2px 0 2px 16px;
}

.interest-list strong {
  color: var(--ink);
  font-weight: 800;
}

.publication-list {
  margin-top: 4px;
  padding-left: 1.35rem;
}

.publication-list li {
  padding-left: 4px;
  margin-bottom: 18px;
}

.publication-list li::marker {
  color: var(--muted);
  font-weight: 700;
}

.publication-list strong {
  color: var(--ink);
}

.pub-links {
  display: inline-flex;
  gap: 8px;
  margin-left: 4px;
}

.blog-posts-title {
  margin-bottom: 22px;
  font-size: clamp(2rem, 4vw, 2.35rem);
}

.blog-year-group {
  margin-top: 18px;
}

.blog-year {
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.blog-entry {
  padding: 0 0 30px;
}

.blog-entry + .blog-entry {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.post-number {
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: var(--soft);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.post-number-page {
  margin-bottom: 10px;
}

.blog-title-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.blog-title-row .post-number {
  flex: 0 0 auto;
  transform: translateY(-0.08em);
}

.blog-title {
  margin: 0;
  font-size: clamp(1.22rem, 3vw, 1.45rem);
  line-height: 1.28;
}

.blog-title a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.published {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.94rem;
}

.published strong {
  font-weight: 800;
}

.calendar-icon {
  display: inline-flex;
  width: 1.2em;
  justify-content: center;
  color: var(--ink);
  font-size: 0.95em;
}

.blog-summary {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
}

.article-date {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
}

.article-layout {
  display: block;
  max-width: 980px;
}

.article {
  min-width: 0;
}

.article-content h1 {
  margin-bottom: 18px;
}

.article-content h2 {
  margin-top: 30px;
}

.article-content h3 {
  margin-top: 22px;
}

.article-figure {
  margin: 18px 0 34px;
}

.article-figure-wide {
  width: 100%;
  max-width: 980px;
}

.article-figure img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #020402;
}

.article-figure-light img {
  background: #fff;
}

.article-table-wrap {
  margin: 22px 0 34px;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 92%, var(--accent) 8%);
}

.article-table-wrap table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.article-table-wrap th,
.article-table-wrap td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.article-table-wrap th {
  color: var(--ink);
  font-weight: 760;
  background: color-mix(in srgb, var(--paper) 82%, var(--accent) 18%);
}

.article-table-wrap tr:last-child td {
  border-bottom: 0;
}

.article-content hr {
  margin: 34px 0 24px;
  border: 0;
  border-top: 1px solid var(--line);
}

.article-content code {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0.08em 0.28em;
  background: var(--code-bg);
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

pre {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 14px 16px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.55;
}

.article-content pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.citation-box {
  margin-top: 42px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.citation-box h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1.2rem;
}

.citation-box p {
  margin: 0 0 12px;
}

.citation-text {
  color: var(--muted);
  font-size: 0.98rem;
}

.citation-bibtex {
  margin-top: 14px;
  font-size: 0.82rem;
}

.article-back {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@media (max-width: 1120px) {
  .article-layout {
    display: block;
  }

  .article-layout .sidebar {
    position: static;
    max-width: 320px;
    margin-bottom: 34px;
  }
}

@media (max-width: 860px) {
  .header-grid,
  .layout {
    display: block;
  }

  .header-grid {
    padding-block: 12px;
  }

  .nav {
    justify-content: flex-start;
    margin-top: 8px;
    gap: 12px 18px;
  }

  .sidebar {
    position: static;
    margin-bottom: 30px;
  }

  .avatar {
    width: 220px;
    height: auto;
  }

  .blog-title-row {
    align-items: flex-start;
    gap: 10px;
  }
}

@media (max-width: 560px) {
  .wrap {
    width: min(100% - 22px, 1180px);
  }

  .layout,
  .article-layout {
    padding-block: 24px 44px;
  }

  .blog-title-row {
    display: block;
  }

  .blog-title-row .post-number {
    margin-bottom: 8px;
    transform: none;
  }

}
