:root {
  --paper: #ffffff;
  --surface: #ffffff;
  --ink: #14171a;
  --muted: #5f6870;
  --quiet: #8b949a;
  --line: #e1e5e0;
  --line-strong: #c5ccc6;
  --accent: #0f6074;
  --accent-warm: #95551e;
  --max: 1120px;
  --measure: 710px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.62;
}

body[data-site-lang="en"] [data-copy-lang="zh"],
body[data-site-lang="zh"] [data-copy-lang="en"] {
  display: none !important;
}

::selection {
  background: #c9e1e7;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

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

h1,
h2,
h3,
p,
figure,
dl,
dd {
  margin-top: 0;
}

p {
  margin-bottom: 1rem;
}

img {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  left: 20px;
  top: -64px;
  z-index: 5;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.skip-link:focus {
  top: 20px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-nav,
main,
.site-footer {
  width: min(var(--max), calc(100% - 48px));
  margin: 0 auto;
}

.site-nav {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand {
  flex: 0 0 auto;
  color: var(--ink);
  font-weight: 760;
  text-decoration: none;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
  font-size: 0.92rem;
}

.nav-links a {
  border-bottom: 1px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

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

.lang-toggle {
  display: flex;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}

.lang-toggle button {
  min-width: 42px;
  border: 0;
  border-left: 1px solid var(--line-strong);
  padding: 5px 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
}

.lang-toggle button:first-child {
  border-left: 0;
}

.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

main {
  padding: 54px 0 34px;
}

section {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}

section:first-child {
  border-top: 0;
  padding-top: 0;
}

.home-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 76px;
  align-items: center;
  min-height: 474px;
}

.intro-copy {
  max-width: 760px;
}

.eyebrow,
.project-kicker {
  margin-bottom: 12px;
  color: var(--accent-warm);
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 22px;
  font-size: clamp(2.4rem, 5vw, 4.3rem);
  font-weight: 780;
  letter-spacing: 0;
  line-height: 0.98;
}

.page-title.compact-title h1 {
  font-size: clamp(2rem, 4vw, 3.1rem);
}

.home-intro h1 {
  max-width: 760px;
  font-size: clamp(3.55rem, 7.4vw, 5.9rem);
}

body[data-site-lang="zh"] h1 {
  line-height: 1.08;
}

.lead {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.16rem;
  line-height: 1.56;
}

.hero-meta {
  display: grid;
  max-width: 670px;
  margin: 32px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line-strong);
}

.hero-meta li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.hero-meta b {
  color: var(--ink);
  font-size: 0.88rem;
}

.hero-meta span {
  color: var(--muted);
}

.portrait-block {
  margin: 0;
}

.portrait-block img {
  display: block;
  width: 330px;
  height: 410px;
  border: 1px solid var(--line);
  object-fit: cover;
  filter: grayscale(0.05) contrast(1.03);
}

figcaption {
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.plain-section,
.timeline-section,
.contact-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 64px;
}

.section-heading h2,
.timeline-section > h2 {
  margin-bottom: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.14rem;
  font-weight: 760;
  line-height: 1.25;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 12px;
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.35;
}

.prose {
  max-width: var(--measure);
}

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

.page-title {
  max-width: 820px;
  padding-bottom: 52px;
}

.page-title h1 {
  font-size: clamp(2.35rem, 5vw, 4.4rem);
}

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

.feature-row article {
  padding-top: 16px;
  border-top: 2px solid var(--ink);
}

.feature-row h2 a {
  color: var(--ink);
}

.feature-row p {
  color: var(--muted);
}

.quiet-links {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.quiet-links li {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 30px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.quiet-links li:first-child {
  padding-top: 0;
  border-top: 0;
}

.quiet-links a {
  color: var(--ink);
  font-weight: 760;
}

.quiet-links span {
  color: var(--muted);
}

.timeline {
  display: grid;
  gap: 0;
}

.timeline div {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 30px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.timeline div:first-child {
  padding-top: 0;
  border-top: 0;
}

dt {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

dd {
  margin-left: 0;
}

dd strong {
  display: block;
  margin-bottom: 2px;
}

.project-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 56px;
  align-items: end;
  max-width: none;
  padding-bottom: 44px;
}

.project-title h1 {
  max-width: 620px;
  margin-bottom: 0;
}

.page-intro {
  max-width: 350px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.58;
}

.featured-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 52px;
  align-items: start;
}

.featured-copy {
  max-width: 590px;
  min-width: 0;
}

.featured-copy h2 {
  margin-bottom: 18px;
  font-size: 2rem;
  font-weight: 780;
  line-height: 1.08;
}

.project-kicker {
  color: var(--muted);
}

.featured-project figure {
  margin: 0;
}

.featured-project > figure:not(.project-screen-panel) {
  justify-self: end;
  width: min(100%, 460px);
}

.featured-project > figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.featured-project > figure:not(.project-screen-panel) img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.project-story {
  min-height: 360px;
}

.logo-story {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
}

.project-name-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.project-name-row h2 {
  margin-bottom: 0;
}

.project-name-row img {
  display: block;
  width: auto;
  height: 40px;
  object-fit: contain;
}

.project-screen-panel {
  align-self: center;
  min-width: 0;
}

.featured-project .project-screen-panel img {
  height: auto;
  object-fit: contain;
}

.project-media-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-self: end;
  align-self: start;
  align-items: start;
  width: min(100%, 460px);
  gap: 12px;
  min-width: 0;
}

.project-media-stack figure {
  margin: 0;
  min-width: 0;
  aspect-ratio: auto;
}

.project-media-stack img,
.code-example pre {
  display: block;
  width: 100%;
  height: 180px;
  aspect-ratio: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.project-media-stack img {
  object-fit: contain;
}

.project-media-stack figure:first-child img {
  filter: saturate(0.85) contrast(1.04);
}

.code-example pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  background: #ffffff;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.55rem;
  font-weight: 520;
  line-height: 1.48;
  white-space: pre;
  tab-size: 2;
}

.code-example code {
  font: inherit;
}

.code-keyword {
  color: var(--accent);
  font-weight: 760;
}

.code-string {
  color: var(--accent-warm);
}

.code-comment {
  color: var(--muted);
}

.raw-data-example {
  grid-column: 1 / -1;
  aspect-ratio: auto;
  align-self: start;
}

.raw-data-example pre {
  height: 158px;
  aspect-ratio: auto;
  font-size: 0.58rem;
  line-height: 1.42;
  white-space: pre-wrap;
  word-break: break-word;
}

.project-facts {
  align-self: center;
  min-width: 0;
  padding: 22px 0 4px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.project-facts h3 {
  margin-bottom: 6px;
}

.project-facts dl {
  display: grid;
  gap: 0;
  margin-bottom: 0;
}

.project-facts dl div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 24px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.project-facts dd {
  color: var(--muted);
}

.small-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 12px;
  font-size: 0.92rem;
}

.talks-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 56px;
  align-items: end;
  max-width: none;
  padding-bottom: 40px;
}

.talks-title h1 {
  max-width: 620px;
  margin-bottom: 0;
  font-size: clamp(2.6rem, 5vw, 4.8rem);
}

.talk-index {
  display: grid;
  gap: 0;
}

.talk-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 180px;
  gap: 34px;
  align-items: start;
  padding: 34px 0;
  border-top: 1px solid var(--line);
}

.talk-row-video {
  grid-template-columns: 130px minmax(280px, 0.82fr) minmax(420px, 1.18fr);
  gap: 38px;
}

.talk-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.talk-date {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.talk-date strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.talk-copy {
  min-width: 0;
}

.talk-copy h2 {
  margin-bottom: 7px;
  font-size: 1.42rem;
  font-weight: 780;
  line-height: 1.16;
}

.talk-copy p {
  max-width: 650px;
}

.talk-subtitle {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.45;
}

.talk-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 18px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  list-style: none;
}

.talk-thumbs {
  display: grid;
  gap: 10px;
  width: 180px;
  min-width: 0;
}

.talk-thumbs figure {
  margin: 0;
  min-width: 0;
}

.talk-thumbs a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.talk-thumbs img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  background: var(--surface);
  object-fit: cover;
}

.talk-video {
  min-width: 0;
}

.talk-video iframe {
  display: block;
  width: 100%;
  max-width: 560px;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 1px solid var(--line);
  background: var(--ink);
}

.talk-video .small-links {
  margin: 10px 0 0;
}

.video-thumb a {
  position: relative;
}

.video-thumb a::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 36px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(20, 23, 26, 0.78);
  transform: translate(-50%, -50%);
}

.video-thumb a::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: calc(50% + 2px);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid #ffffff;
  transform: translate(-50%, -50%);
}

.video-thumb img {
  filter: saturate(0.96) contrast(1.02);
}

.video-thumb a:hover img {
  filter: saturate(1.06) contrast(1.04);
}

.contact-email {
  margin-bottom: 1.2rem;
  font-size: 1.08rem;
  font-weight: 760;
  line-height: 1.35;
}

.contact-links {
  align-self: start;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 26px 0 46px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin-bottom: 0;
}

@media (max-width: 820px) {
  .site-nav,
  main,
  .site-footer {
    width: min(100% - 32px, var(--max));
  }

  .site-nav {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 14px 0 16px;
    gap: 12px 16px;
  }

  .nav-right {
    display: contents;
  }

  .nav-links {
    grid-column: 1 / -1;
    order: 3;
    justify-content: flex-start;
    gap: 8px 14px;
    line-height: 1.35;
  }

  .lang-toggle {
    justify-self: end;
  }

  main {
    padding-top: 38px;
  }

  section {
    padding: 38px 0;
  }

  .home-intro,
  .plain-section,
  .timeline-section,
  .project-title,
  .featured-project,
  .talks-title,
  .talk-row,
  .contact-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .home-intro {
    min-height: 0;
  }

  .home-intro h1 {
    font-size: clamp(3.1rem, 15vw, 4.7rem);
  }

  .portrait-block {
    margin-top: 2px;
  }

  .portrait-block img {
    width: min(100%, 260px);
    height: auto;
    aspect-ratio: 4 / 5;
  }

  .lead {
    font-size: 1.06rem;
  }

  .hero-meta {
    margin-top: 24px;
  }

  .hero-meta li {
    grid-template-columns: 1fr;
    gap: 2px;
    padding: 11px 0;
  }

  .page-title,
  .project-title {
    padding-bottom: 34px;
  }

  .page-title h1 {
    font-size: clamp(2.25rem, 10vw, 3.55rem);
  }

  .page-intro {
    max-width: none;
    margin-bottom: 0;
  }

  .feature-row {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .quiet-links li,
  .timeline div,
  .project-facts dl div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .featured-copy h2 {
    font-size: 1.68rem;
  }

  .project-story {
    min-height: 0;
  }

  .project-media-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-self: start;
    width: min(100%, 360px);
  }

  .talk-row {
    padding: 30px 0;
  }

  .talk-copy h2 {
    font-size: 1.68rem;
  }

  .talk-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(100%, 260px);
  }

  .project-name-row {
    align-items: center;
    gap: 10px;
  }

  .project-name-row img {
    height: 34px;
  }

  .featured-project > figure:not(.project-screen-panel) img {
    aspect-ratio: auto;
  }

  .site-footer {
    display: grid;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  .project-media-stack {
    grid-template-columns: minmax(0, 1fr);
    width: min(100%, 300px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
