:root {
  color-scheme: light;
  --bg: #f2efe8;
  --text: #2e2c29;
  --muted: #706d67;
  --accent: #c46f36;
  --line: #d9d5cd;
  --max-width: 860px;
  --sans: Inter, "Helvetica Neue", Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1e211f;
  --text: #e9e5dd;
  --muted: #aaa69e;
  --accent: #e29a66;
  --line: #373b38;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.58;
  transition: background-color 160ms ease, color 160ms ease;
}

a {
  color: inherit;
  text-decoration-color: var(--accent);
  text-underline-offset: 0.2em;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 10;
  transform: translateY(-160%);
  padding: 7px 10px;
  background: var(--text);
  color: var(--bg);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header,
main,
.site-footer {
  width: min(calc(100% - 40px), var(--max-width));
  margin-inline: auto;
}

.site-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.site-name,
.site-header nav a {
  text-decoration: none;
}

.site-name {
  font-weight: 600;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 19px;
}

.site-header nav a,
.theme-toggle {
  color: var(--muted);
}

.site-header nav a:hover,
.site-header nav a.active,
.theme-toggle:hover {
  color: var(--text);
}

.theme-toggle {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.hero {
  min-height: 380px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: clamp(36px, 7vw, 58px);
  padding: 30px 0 42px;
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.15rem, 5vw, 3.15rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  line-height: 0.86;
}

.hero h1 > span {
  display: block;
}

.hero h1 > span + span {
  margin-top: 0.11em;
}

.hero h1 > span:last-child {
  color: var(--accent);
}

.name-chinese {
  display: inline-block;
  margin-left: 0.2em;
  font-size: 0.5em;
  font-weight: 650;
  letter-spacing: 0;
  vertical-align: 0.18em;
}

.bio {
  max-width: 530px;
}

.bio p {
  margin: 0 0 8px;
}

.site-notice {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-style: italic;
}

.latest-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0 0;
  font-family: var(--mono);
  font-size: 0.67rem;
}

.latest-line span {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  text-transform: uppercase;
}

.latest-line a {
  color: var(--muted);
  text-decoration: none;
}

.profile-image {
  width: 185px;
  height: 185px;
  border-radius: 50%;
  object-fit: cover;
  filter: saturate(0.8);
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.76rem;
}

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

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

.content-section {
  padding: 25px 0 31px;
  border-top: 1px solid var(--line);
}

.content-section h2,
.year-group > h2 {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 8px;
}

.section-header > a,
.section-actions > a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-decoration: none;
}

.section-actions,
.slider-controls {
  display: flex;
  align-items: center;
}

.section-actions {
  gap: 18px;
}

.slider-controls {
  gap: 5px;
}

.slider-controls button {
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  line-height: 1;
}

.slider-controls button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.slider-controls button:disabled {
  cursor: default;
  opacity: 0.3;
}

.news-viewport {
  --news-row-height: 57px;
  height: calc(var(--news-row-height) * 5);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

.news-viewport::-webkit-scrollbar {
  display: none;
}

.news-track {
  border-top: 1px solid var(--line);
}

.news-card {
  min-height: var(--news-row-height);
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: start;
  gap: 13px;
  padding: 5px 4px;
  border-bottom: 1px solid var(--line);
  scroll-snap-align: start;
}

.news-card time,
.news-entry time {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.64rem;
  text-transform: uppercase;
}

.news-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: normal;
}

.news-card em {
  color: var(--text);
}

.publication-list,
.publication-archive {
  border-top: 1px solid var(--line);
}

.publication-item {
  padding: 15px 0 17px;
  border-bottom: 1px solid var(--line);
}

.publication-item h3 {
  max-width: 780px;
  margin: 0 0 5px;
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}

.paper-award {
  display: inline-block;
  margin-left: 7px;
  color: #b6382f;
  font-family: "Iosevka Charon", var(--mono);
  font-size: 0.76rem;
  font-weight: 300;
  letter-spacing: normal;
  line-height: 1.5;
  vertical-align: 0.08em;
  white-space: nowrap;
}

.award-medal {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 0.9em;
}

.authors,
.description {
  margin: 0;
}

.authors {
  color: var(--muted);
  font-size: 0.81rem;
}

.authors strong {
  color: var(--text);
}

.description {
  max-width: 760px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.publication-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
}

.publication-footer > span {
  color: var(--accent);
  text-transform: uppercase;
}

.publication-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.publication-actions a,
.publication-actions button,
.publication-action-unavailable {
  color: var(--muted);
  font: inherit;
  text-decoration: none;
}

.publication-action-unavailable {
  cursor: default;
  opacity: 0.42;
}

.publication-actions button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.publication-actions a:hover,
.publication-actions button:hover {
  color: var(--accent);
}

.publication-dialog {
  width: min(calc(100% - 32px), 720px);
  max-height: min(82vh, 720px);
  padding: 0;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 18px 55px rgb(25 22 18 / 25%);
  color: var(--text);
}

.publication-dialog::backdrop {
  background: rgb(25 22 18 / 48%);
  backdrop-filter: blur(2px);
}

.publication-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.publication-dialog-label {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.publication-dialog h2 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.42;
}

.publication-dialog-close {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.publication-dialog-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.publication-dialog-content {
  overflow: auto;
  max-height: calc(82vh - 104px);
  padding: 20px 22px 23px;
}

.publication-dialog-content p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.publication-dialog-content pre {
  overflow: auto;
  margin: 0;
  padding: 15px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--text) 4%, transparent);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.inner-page {
  padding-top: 30px;
}

.page-intro {
  max-width: 680px;
  padding: 18px 0 34px;
}

.back-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-decoration: none;
}

.page-intro h1 {
  margin: 12px 0 6px;
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  letter-spacing: -0.055em;
  line-height: 1;
}

.page-intro p {
  margin: 0;
  color: var(--muted);
}

.publication-intro {
  padding-bottom: 24px;
}

.publication-filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filter-group {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.filter-label,
#publication-result-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.filter-menu {
  position: relative;
  min-width: 0;
}

.filter-menu summary,
.publication-filter-panel button {
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.68rem;
}

.filter-menu summary {
  position: relative;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 27px 0 8px;
  cursor: pointer;
  list-style: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-menu summary::-webkit-details-marker {
  display: none;
}

.filter-menu summary::after {
  position: absolute;
  right: 9px;
  content: "⌄";
  transition: transform 120ms ease;
}

.filter-menu[open] summary::after {
  transform: rotate(180deg);
}

.filter-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, 210px);
  max-height: 245px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: 0 9px 24px rgb(40 35 29 / 12%);
}

.filter-options label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 5px 6px;
  color: var(--text);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.66rem;
  line-height: 1.35;
}

.filter-options label:hover {
  background: color-mix(in srgb, var(--accent) 9%, transparent);
}

.filter-options input {
  flex: 0 0 auto;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.publication-filter-panel button {
  padding: 0 11px;
  cursor: pointer;
}

.publication-filter-panel button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#publication-result-count {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: var(--accent);
}

.publication-archive {
  margin-bottom: 50px;
}

.news-archive {
  margin-bottom: 50px;
  border-top: 1px solid var(--line);
}

.news-entry {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr);
  gap: 28px;
  padding: 21px 0 23px;
  border-bottom: 1px solid var(--line);
}

.news-entry time {
  padding-top: 4px;
}

.news-entry h2 {
  margin: 0 0 5px;
  font-size: 0.98rem;
  line-height: 1.4;
}

.news-entry p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.year-group {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 18px;
}

.year-group > h2 {
  padding-top: 18px;
  color: var(--accent);
}

.year-group .publication-item {
  grid-column: 2;
  width: 100%;
}

.site-footer {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
}

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

@media (max-width: 720px) {
  .site-header {
    min-height: 56px;
  }

  .site-header nav {
    gap: 14px;
  }

  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 23px;
    padding: 27px 0 36px;
  }

  .profile-image {
    grid-row: 1;
    width: 145px;
    height: 145px;
  }

  .hero h1 {
    font-size: clamp(2.1rem, 12vw, 2.85rem);
  }

  .publication-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .publication-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .publication-filter-panel button {
    align-self: end;
  }

  .year-group {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .year-group > h2,
  .year-group .publication-item {
    grid-column: 1;
  }

  .year-group > h2 {
    padding-top: 30px;
  }

  .news-entry {
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 20px;
  }

  .news-viewport {
    --news-row-height: 78px;
  }

}

@media (max-width: 470px) {
  .site-header,
  main,
  .site-footer {
    width: min(calc(100% - 28px), var(--max-width));
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 14px 0;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
  }

  .section-header {
    align-items: flex-start;
  }

  .section-actions {
    gap: 10px;
  }

  .publication-filter-panel {
    grid-template-columns: 1fr;
  }

  .filter-options {
    width: 100%;
  }

  #publication-result-count {
    grid-column: 1;
  }

  .news-entry {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .news-viewport {
    --news-row-height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition-duration: 0.01ms !important;
  }
}
