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

:root {
  --canvas: #e8eaed;
  --paper: #ffffff;
  --ink: #272727;
  --muted: #616161;
  --blue: #176789;
  --rule: #2d7394;
  --sans: Calibri, Arial, Helvetica, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.44;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-color: rgba(23, 103, 137, 0.55);
  text-underline-offset: 2px;
}

a:hover {
  color: var(--blue);
  text-decoration-color: var(--blue);
}

.site-shell {
  width: min(100% - 42px, 1280px);
  margin: 0 auto;
  padding: 22px 0 72px;
}

.document-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 11px;
}

.document-actions a {
  padding: 7px 11px;
  color: #32434c;
  border: 1px solid #9da7ad;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.document-actions a:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.resume-download-button {
  position: absolute;
  top: 19px;
  right: 24px;
  z-index: 1;
  padding: 7px 10px;
  color: #32434c;
  border: 1px solid #9da7ad;
  background: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.resume-download-button:hover {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
}

.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}

.gallery-home-aside {
  position: sticky;
  top: 22px;
}

.gallery-home-window {
  display: block;
  width: 100%;
  margin: 0;
  color: #1d2225;
  background: #f7f7f4;
  border: 1px solid #c9ced0;
  border-top: 5px solid var(--rule);
  box-shadow: 0 10px 28px rgba(29, 38, 47, 0.12);
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.gallery-home-window:hover {
  color: #1d2225;
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(29, 38, 47, 0.17);
}

.gallery-home-window-bar {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  color: #53616a;
  background: #eceeed;
  border-bottom: 1px solid #d5d9da;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.gallery-home-window-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px;
}

.gallery-home-window strong {
  color: #15191b;
  font-size: clamp(23px, 3vw, 32px);
  line-height: 1.04;
}

.gallery-home-window-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 4px;
  padding: 13px 18px;
  color: #fff;
  background: #171b1d;
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  animation: gallery-home-button-shake 5.2s ease-in-out infinite;
}

@keyframes gallery-home-button-shake {
  0%, 58%, 100% { transform: translateX(0) rotate(0); }
  60% { transform: translateX(-3px) rotate(-1deg); }
  62% { transform: translateX(3px) rotate(1deg); }
  64% { transform: translateX(-2px) rotate(-0.7deg); }
  66% { transform: translateX(2px) rotate(0.7deg); }
  68% { transform: translateX(0) rotate(0); }
}

@media (max-width: 1100px) {
  .home-layout {
    display: flex;
    flex-direction: column;
  }

  .gallery-home-aside {
    position: static;
    order: -1;
    width: 100%;
    margin-bottom: 26px;
  }

  .gallery-home-window {
    width: min(100%, 420px);
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .page-one {
    padding-top: 58px;
  }

  .resume-download-button {
    top: 14px;
    right: 16px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-home-window,
  .gallery-home-window-button {
    animation: none;
    transition: none;
  }
}

.cv-document {
  display: grid;
  gap: 30px;
}

.paper {
  position: relative;
  padding: 58px 64px 30px;
  background: var(--paper);
  border: 1px solid #d3d7da;
  box-shadow: 0 10px 28px rgba(29, 38, 47, 0.09);
}

.cv-header {
  margin-bottom: 20px;
}

h1 {
  margin: 0;
  color: #080808;
  font-size: 33px;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.08;
  text-align: center;
  text-transform: uppercase;
}

.chinese-name {
  margin-left: 0.16em;
  font-size: 0.72em;
  font-weight: 600;
  letter-spacing: 0;
}

.headline {
  margin: 5px 0 7px;
  color: var(--blue);
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.contact-line {
  display: flex;
  justify-content: center;
  gap: 4px 9px;
  flex-wrap: wrap;
  margin: 6px 0 9px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
}

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

.contact-line a:hover {
  color: var(--blue);
}

.summary {
  margin: 0;
  color: #565656;
  font-size: 16.5px;
  font-style: italic;
  line-height: 1.46;
}

.cv-section {
  margin-top: 18px;
}

.cv-section:first-child {
  margin-top: 0;
}

h2 {
  margin: 0 0 9px;
  padding-bottom: 3px;
  color: var(--blue);
  border-bottom: 1px solid var(--rule);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.005em;
  line-height: 1.2;
  text-transform: uppercase;
}

.skills-list {
  display: grid;
  gap: 3px;
  margin: 0;
}

.skills-list > div {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 20px;
}

.skills-list dt {
  color: var(--blue);
  font-weight: 700;
}

.skills-list dd {
  margin: 0;
}

.project-entry,
.role-entry {
  break-inside: avoid;
}

.project-entry + .project-entry,
.role-entry + .role-entry {
  margin-top: 10px;
}

.project-entry h3,
.role-heading h3 {
  margin: 0 0 3px;
  font-size: 17px;
  font-weight: 400;
  line-height: 1.32;
}

.project-entry h3 span,
.role-heading h3 span {
  color: var(--blue);
  font-weight: 700;
}

.project-entry h3 i,
.role-heading h3 i,
.education-list i {
  margin: 0 8px;
  color: var(--muted);
  font-style: normal;
  font-weight: 400;
}

.project-entry h3 em,
.role-heading h3 em {
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

.role-entry h4 {
  margin: 10px 0 4px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.paper ul {
  margin: 0;
  padding-left: 27px;
}

.paper li {
  margin: 0 0 4px;
  padding-left: 2px;
  line-height: 1.42;
}

.paper li:last-child {
  margin-bottom: 0;
}

.paper li::marker {
  color: #111;
}

.paper strong {
  color: #1e1e1e;
  font-weight: 700;
}

.role-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
}

.role-heading h3 {
  margin-bottom: 3px;
}

.role-heading h3 em {
  font-style: normal;
}

.role-heading time,
.role-heading .date-range,
.education-list time,
.education-list .date-range {
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}

.education-list {
  display: grid;
  gap: 4px;
}

.education-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: baseline;
}

.education-list p {
  margin: 0;
}

.education-list p span {
  color: var(--muted);
}

.section-intro {
  margin: 0 0 7px;
  color: var(--muted);
  font-style: italic;
}

.publication-list p {
  margin: 0 0 6px;
  padding-left: 20px;
  text-indent: -20px;
  line-height: 1.4;
}

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

.personal-section p {
  margin: 0;
  line-height: 1.4;
}

.paper-footer {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 30px;
  color: #6c6c6c;
  font-size: 12px;
  line-height: 1.2;
}

.paper-footer i {
  font-style: normal;
}

.paper-footer a {
  color: inherit;
  text-decoration: none;
}

.page-two {
  padding-top: 54px;
}

@media (max-width: 760px) {
  body {
    font-size: 15px;
  }

  .site-shell {
    width: calc(100% - 14px);
    padding: 12px 0 34px;
  }

  .document-actions {
    margin: 0 3px 8px;
  }

  .cv-document {
    gap: 14px;
  }

  .paper,
  .page-two {
    padding: 34px 21px 24px;
  }

  .cv-header {
    margin-bottom: 22px;
  }

  h1 {
    font-size: 31px;
  }

  .contact-line {
    display: grid;
    gap: 2px;
    margin: 8px 0 12px;
    text-align: center;
  }

  .contact-line > span[aria-hidden="true"] {
    display: none;
  }

  .summary {
    font-size: 15.5px;
    line-height: 1.5;
  }

  .headline {
    font-size: 14.5px;
  }

  .cv-section {
    margin-top: 22px;
  }

  h2 {
    margin-bottom: 11px;
    font-size: 17px;
  }

  .skills-list {
    gap: 8px;
  }

  .skills-list > div {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .project-entry + .project-entry,
  .role-entry + .role-entry {
    margin-top: 14px;
  }

  .project-entry h3,
  .role-heading h3 {
    font-size: 16px;
  }

  .project-entry h3 span,
  .project-entry h3 em {
    display: block;
  }

  .project-entry h3 i {
    display: none;
  }

  .project-entry h3 em {
    margin-top: 1px;
  }

  .paper ul {
    padding-left: 22px;
  }

  .paper li {
    margin-bottom: 6px;
    line-height: 1.48;
  }

  .role-heading {
    display: block;
  }

  .role-heading h3 i {
    margin: 0 5px;
  }

  .role-heading time,
  .role-heading .date-range {
    display: block;
    margin: 2px 0 5px;
    font-size: 14px;
  }

  .education-list {
    gap: 9px;
  }

  .education-list > div {
    display: block;
  }

  .education-list p strong,
  .education-list p span {
    display: block;
  }

  .education-list i {
    display: none;
  }

  .education-list time,
  .education-list .date-range {
    display: block;
    margin-top: 1px;
    font-size: 14px;
  }

  .publication-list p {
    padding-left: 14px;
    text-indent: -14px;
  }

  .paper-footer {
    margin-top: 26px;
  }
}

@media print {
  @page {
    size: letter;
    margin: 0;
  }

  body {
    color: #000;
    background: #fff;
    font-size: 9.5pt;
  }

  .site-shell {
    width: 100%;
    padding: 0;
  }

  .resume-download-button {
    display: none;
  }

  .cv-document {
    display: block;
  }

  .paper {
    min-height: 11in;
    padding: 0.48in 0.55in 0.28in;
    border: 0;
    box-shadow: none;
  }

  .page-one {
    break-after: page;
  }

  .page-two {
    break-before: page;
  }

  h1 {
    font-size: 22pt;
  }

  .summary {
    font-size: 10pt;
  }

  h2 {
    font-size: 12pt;
  }

  .project-entry h3,
  .role-heading h3 {
    font-size: 10.2pt;
  }

  .paper-footer {
    font-size: 8pt;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .document-actions a {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
  }
}
