:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #526071;
  --soft: #f7fafc;
  --line: rgba(17, 24, 39, 0.12);
  --glass: rgba(255, 255, 255, 0.82);
  --glass-strong: rgba(255, 255, 255, 0.94);
  --shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  flex-direction: column;
  font-family: Lato, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #e9eef4;
}

body.reader-open {
  overflow: hidden;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

code {
  padding: 0.1rem 0.28rem;
  border-radius: 4px;
  background: rgba(17, 24, 39, 0.07);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
}

.site-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.site-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.site-bg__wash {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(5, 9, 16, 0.36), rgba(255, 255, 255, 0.14) 44%, rgba(10, 16, 26, 0.2)),
    rgba(247, 250, 252, 0.08);
  backdrop-filter: blur(0px);
  transition: backdrop-filter 500ms ease, background 500ms ease;
}

body:not([data-view="home"]) .site-bg__wash,
body.reader-open .site-bg__wash {
  background:
    linear-gradient(90deg, rgba(5, 9, 16, 0.36), rgba(255, 255, 255, 0.28) 44%, rgba(10, 16, 26, 0.22)),
    rgba(247, 250, 252, 0.28);
  backdrop-filter: blur(18px);
}

.topbar {
  position: fixed;
  top: 18px;
  left: 50%;
  z-index: 20;
  display: flex;
  width: min(1120px, calc(100% - 32px));
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.66);
  box-shadow: 0 10px 32px rgba(15, 23, 42, 0.12);
  transform: translateX(-50%);
  backdrop-filter: blur(20px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  overflow-x: auto;
}

.nav__item {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 13px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(17, 24, 39, 0.66);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.nav__item:hover,
.nav__item.is-active {
  background: rgba(17, 24, 39, 0.9);
  color: #fff;
}

.nav__item:active {
  transform: scale(0.97);
}

.shell {
  flex: 1 0 auto;
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 118px 0 52px;
}

.view {
  display: none;
  animation: fade-in-up 520ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.view.is-active {
  display: block;
}

.hero {
  display: grid;
  min-height: calc(100vh - 210px);
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: center;
  gap: 48px;
}

.profile-hero {
  min-height: auto;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  padding: 52px 0 24px;
}

.profile-panel {
  display: grid;
  width: min(900px, 100%);
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: center;
  gap: 46px;
  padding: 42px 48px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.profile-panel__avatar {
  width: 240px;
  height: 240px;
  border: 4px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22);
  object-fit: cover;
  object-position: 62% center;
}

.profile-panel__text {
  min-width: 0;
  color: #111827;
}

.eyebrow {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.panel .eyebrow,
.section-heading--floating .eyebrow,
.contact-panel .eyebrow {
  color: rgba(17, 24, 39, 0.48);
  text-shadow: none;
}

.hero h1 {
  max-width: 620px;
  margin: 0;
  font-size: 2.25rem;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.12;
}

.hero h1 span {
  font-style: italic;
  white-space: nowrap;
}

.name-cn {
  margin: 4px 0 0;
  color: rgba(17, 24, 39, 0.56);
  font-size: 1.25rem;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 1.4;
}

.hero__lede {
  max-width: 620px;
  margin: 20px 0 0;
  color: rgba(17, 24, 39, 0.68);
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.625;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.social-link {
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  color: #111827;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
  font-size: 1.12rem;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.social-link:hover {
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
  transform: translateY(-2px);
}

.social-link__icon {
  width: 1.28em;
  height: 1.28em;
  fill: currentColor;
}

.news-block {
  margin-top: 0;
  padding-top: 0;
}

.home-section {
  width: min(900px, 100%);
  margin: 0 auto 48px;
  padding: 28px 48px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.news-block h2 {
  margin: 0 0 12px;
  color: rgba(17, 24, 39, 0.52);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.news-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: baseline;
  color: rgba(17, 24, 39, 0.66);
  font-size: 1rem;
  font-weight: 300;
  line-height: 1.65;
}

.news-item time {
  color: rgba(17, 24, 39, 0.82);
  font-size: 0.9rem;
  font-weight: 700;
  white-space: nowrap;
}

.news-item p {
  margin: 0;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  padding: 0 18px;
  font-size: 0.94rem;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button--dark {
  background: #111827;
  color: #fff;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.22);
}

.button--light {
  border: 1px solid rgba(255, 255, 255, 0.52);
  background: rgba(255, 255, 255, 0.8);
  color: #111827;
}

.profile-panel,
.glass-tile,
.panel,
.post-card,
.reader__panel {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

.glass-tile {
  min-height: 170px;
  padding: 24px;
}

.tile-number {
  color: rgba(17, 24, 39, 0.32);
  font-size: 0.8rem;
  font-weight: 700;
}

.glass-tile h2,
.archive-grid h3 {
  margin: 20px 0 8px;
  font-size: 1.1rem;
  font-weight: 400;
}

.glass-tile p,
.archive-grid p {
  margin: 0;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.6;
}

.panel {
  padding: 36px;
  background: var(--glass-strong);
}

.panel--wide {
  max-width: 100%;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 30px;
}

.section-heading--floating {
  margin: 0 0 22px;
  padding: 24px 28px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(20px);
}

.section-heading h2,
.contact-panel h2 {
  margin: 0;
  color: #111827;
  font-size: clamp(2rem, 3.2vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.15;
}

.prose {
  color: #243040;
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.78;
}

.prose p {
  margin: 0 0 1rem;
}

.prose h1,
.prose h2,
.prose h3 {
  margin: 1.6rem 0 0.75rem;
  color: #111827;
  font-weight: 400;
  line-height: 1.2;
}

.prose ul {
  margin: 0 0 1rem;
  padding-left: 1.2rem;
}

.prose li {
  margin: 0.4rem 0;
}

.archive-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(249, 250, 251, 0.78);
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

body[data-view="blog"] .post-grid,
body[data-view="research"] .post-grid {
  padding-top: 10px;
}

.post-card {
  overflow: hidden;
  background: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.post-card:hover {
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  transform: translateY(-4px);
}

.post-card__image {
  width: 100%;
  height: 188px;
  object-fit: cover;
}

.post-card__body {
  padding: 18px;
}

.post-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: rgba(17, 24, 39, 0.48);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.post-card h3 {
  margin: 0 0 10px;
  font-size: 1.12rem;
  font-weight: 400;
  line-height: 1.25;
}

.post-card p {
  display: -webkit-box;
  min-height: 4.8em;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.6;
}

.post-card__status {
  display: inline-flex;
  margin-top: 16px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.08);
  color: rgba(17, 24, 39, 0.7);
  font-size: 0.75rem;
  font-weight: 700;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.archive-grid h3 {
  margin-top: 0;
}

.asset-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 24px;
}

.asset-strip img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  object-fit: cover;
}

.contact-panel {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
}

.contact-panel > img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  object-fit: cover;
}

.contact-panel p:not(.eyebrow) {
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 300;
  line-height: 1.7;
}

.reader {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
}

.reader.is-open {
  display: block;
}

.reader__scrim {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 18, 0.42);
  backdrop-filter: blur(10px);
}

.reader__panel {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  width: min(960px, calc(100% - 28px));
  max-height: min(780px, calc(100vh - 36px));
  grid-template-columns: 320px minmax(0, 1fr);
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.reader__cover {
  width: 100%;
  height: 100%;
  min-height: 460px;
  object-fit: cover;
}

.reader__content {
  overflow: auto;
  padding: 34px;
  background: rgba(255, 255, 255, 0.96);
}

.reader__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.reader__meta {
  margin-bottom: 12px;
  color: rgba(17, 24, 39, 0.48);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.reader h2 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 3.2vw, 2.6rem);
  font-weight: 400;
  line-height: 1.15;
}

.reader__source {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  margin-top: 16px;
  border-radius: var(--radius);
  padding: 0 14px;
  background: #111827;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.footer {
  display: flex;
  width: min(1120px, calc(100% - 32px));
  margin: 10px auto 24px;
  justify-content: space-between;
  gap: 16px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}

.post-shell {
  flex: 1 0 auto;
  width: min(860px, calc(100% - 32px));
  margin: 0 auto;
  padding: 118px 0 56px;
}

.post-page__card {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.post-page__header {
  padding: 46px 64px 18px;
}

.post-page__back {
  display: inline-flex;
  margin-bottom: 24px;
  color: rgba(17, 24, 39, 0.62);
  font-size: 0.94rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.post-page__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  color: rgba(17, 24, 39, 0.5);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.post-page__header h1 {
  margin: 0;
  color: #111827;
  font-size: clamp(2.2rem, 4vw, 3rem);
  font-weight: 400;
  line-height: 1.12;
}

.post-page__card .prose {
  padding: 22px 64px 28px;
  color: #1f2937;
  font-size: 1.08rem;
  line-height: 1.82;
}

.prose--article p {
  margin-bottom: 1.2rem;
}

.prose--article mjx-container[jax="CHTML"][display="true"] {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25rem 0;
}

.math-block {
  overflow-x: auto;
  margin: 1.4rem 0;
  padding: 0.2rem 0;
}

.post-page__footer {
  padding: 0 64px 48px;
}

.post-page__footer a {
  color: #111827;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .nav {
    width: 100%;
    justify-content: flex-start;
  }

  .shell {
    padding-top: 154px;
  }

  .post-shell {
    padding-top: 154px;
  }

  .hero,
  .contact-panel,
  .reader__panel {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    gap: 24px;
  }

  .quick-grid,
  .post-grid,
  .archive-grid {
    grid-template-columns: 1fr 1fr;
  }

  .profile-panel {
    grid-template-columns: 200px minmax(0, 1fr);
    gap: 28px;
    padding: 36px;
  }

  .home-section {
    margin-top: -10px;
    padding: 28px 36px;
  }

  .profile-panel__avatar {
    width: 200px;
    height: 200px;
  }

  .reader__cover {
    height: 230px;
    min-height: 0;
  }
}

@media (max-width: 640px) {
  .topbar {
    top: 10px;
    width: calc(100% - 20px);
    padding: 10px;
  }

  .brand {
    font-size: 0.95rem;
  }

  .nav__item {
    padding: 0 10px;
    font-size: 0.86rem;
  }

  .shell {
    width: calc(100% - 20px);
    padding-top: 148px;
  }

  .post-shell {
    width: calc(100% - 20px);
    padding-top: 148px;
  }

  .post-page__header,
  .post-page__card .prose,
  .post-page__footer {
    padding-left: 24px;
    padding-right: 24px;
  }

  .post-page__header {
    padding-top: 28px;
  }

  .profile-panel {
    grid-template-columns: 1fr;
    padding: 28px;
    text-align: center;
  }

  .profile-panel__avatar {
    width: 170px;
    height: 170px;
    margin: 0 auto;
  }

  .social-links {
    justify-content: center;
  }

  .news-block {
    text-align: left;
  }

  .home-section {
    margin-bottom: 36px;
    padding: 28px;
  }

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

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero__lede {
    font-size: 1.05rem;
    line-height: 1.625;
  }

  .social-link {
    width: 44px;
    height: 44px;
    font-size: 1.16rem;
  }

  .quick-grid,
  .post-grid,
  .archive-grid,
  .asset-strip {
    grid-template-columns: 1fr;
  }

  .panel,
  .section-heading--floating {
    padding: 22px;
  }

  .section-heading h2,
  .contact-panel h2 {
    font-size: 2rem;
  }

  .reader__panel {
    width: calc(100% - 18px);
    max-height: calc(100vh - 18px);
  }

  .reader__content {
    padding: 24px;
  }

  .footer {
    flex-direction: column;
    width: calc(100% - 20px);
  }
}
