:root {
  --bg: #fafaf8;
  --fg: #111111;
  --muted: #666666;
  --line: #e8e8e8;
  --link: #1d3d6b;
  --link-hover: #0f2240;
  --code-bg: #f4f4f2;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181a;
    --fg: #e8e8e6;
    --muted: #888888;
    --line: #2e2e2e;
    --link: #7aabf0;
    --link-hover: #a8c8f8;
    --code-bg: #111113;
  }
}

html[data-theme="light"] {
  --bg: #fafaf8;
  --fg: #111111;
  --muted: #666666;
  --line: #e8e8e8;
  --link: #1d3d6b;
  --link-hover: #0f2240;
  --code-bg: #f4f4f2;
}

html[data-theme="dark"] {
  --bg: #18181a;
  --fg: #e8e8e6;
  --muted: #888888;
  --line: #2e2e2e;
  --link: #7aabf0;
  --link-hover: #a8c8f8;
  --code-bg: #111113;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Courier New", Courier, monospace;
  line-height: 1.5;
}

.container {
  width: min(860px, 92vw);
  margin: 0 auto;
}

.site-header {
  padding: 48px 0 24px;
  border-bottom: 1px solid var(--line);
}

.header-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.profile-photo {
  width: 160px;
  height: 160px;
  border-radius: 0;
  object-fit: cover;
  flex-shrink: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  font-weight: 600;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 300;
}

.header-links {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
}

nav {
  margin-top: 18px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.theme-toggle {
  margin-left: auto;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 2px 10px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  line-height: 1.6;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--fg);
  color: var(--fg);
}

main {
  padding: 24px 0 48px;
}

.panel+.panel {
  margin-top: 52px;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--fg);
  width: fit-content;
}

.about-block+.about-block {
  margin-top: 16px;
}

.about-block h3 {
  font-size: 1rem;
  margin: 0 0 6px;
}

.about-block p+p {
  margin-top: 8px;
}

.about-list {
  margin: 0;
  padding-left: 18px;
}

.about-list li+li {
  margin-top: 4px;
}

.publication-sections {
  margin-top: 14px;
  display: grid;
  gap: 26px;
}

.publication-group h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.publication-list {
  margin: 12px 0 0;
  padding-left: 28px;
  display: grid;
  gap: 16px;
}

.publication-list .publication-item::marker {
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.publication-item {
  padding-bottom: 14px;
  padding-left: 12px;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid var(--line);
}

.publication-item:hover {
  border-left-color: var(--fg);
}

.pub-title {
  font-weight: 600;
}

.pub-authors,
.pub-venue,
.pub-links {
  margin-top: 4px;
  color: var(--muted);
}

.pub-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

.pub-venue {
  color: var(--fg);
}

.pub-status {
  color: var(--muted);
  font-weight: 300;
}

.badge {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-left: 8px;
}

.author-self {
  font-weight: 800;
  color: var(--fg);
}

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

a:hover,
a:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.dot {
  color: var(--muted);
  margin: 0 8px;
}

.action-link {
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}

.action-link:hover,
.action-link:focus-visible {
  color: var(--link-hover);
  text-decoration: underline;
}

.news-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.news-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.news-list li:last-child {
  border-bottom: none;
}

.news-date {
  font-weight: 600;
  margin-right: 8px;
}

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

.to-top-button {
  position: fixed;
  right: 20px;
  bottom: 20px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.to-top-button.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (max-width: 640px) {
  .header-main {
    flex-direction: column-reverse;
    align-items: flex-start;
  }

  .profile-photo {
    width: 120px;
    height: 120px;
  }

  h1 {
    font-size: 1.7rem;
  }

  .publication-list {
    padding-left: 18px;
  }

  .to-top-button {
    right: 14px;
    bottom: 14px;
  }
}
