:root {
  --paper: #ffffff;
  --ink: #171817;
  --muted: #71736f;
  --line: #dcded8;
  --blue: #315df5;
  --yellow: #f0c933;
  --soft-blue: #dce5ff;
  --mono: "Space Mono", monospace;
  --body: "DM Sans", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button { font: inherit; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--ink);
  color: white;
  transform: translateY(-150%);
}

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

main,
footer {
  width: min(1080px, calc(100% - 64px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding-inline: max(32px, calc((100% - 1080px) / 2));
  border-bottom: 1px solid rgba(220, 222, 216, .78);
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.wordmark,
nav a,
.eyebrow,
.project-type,
.note-date,
.note-tag,
footer,
.avatar-tip,
.dialog-meta,
.currently-head p,
.currently-list article > span {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.wordmark {
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.wordmark span { color: var(--blue); }

.footer-ethan { cursor: pointer; }
.footer-ethan small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font: 9px var(--mono);
  letter-spacing: .06em;
  text-transform: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity .25s ease, transform .25s ease;
}
.footer-ethan.revealed small { opacity: 1; transform: translateY(0); }

.beijing-clock-trigger { cursor: pointer; }
.beijing-clock-trigger time {
  display: inline-block;
  margin-left: 9px;
  color: var(--blue);
  font: 10px var(--mono);
  letter-spacing: .04em;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .25s ease, transform .25s ease;
}
.beijing-clock-trigger.clock-visible time { opacity: 1; transform: translateX(0); }

#email-link.copied { color: var(--blue); }

.beyond-footer {
  position: relative;
  height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 0 max(32px, calc((100vw - 1080px) / 2));
  overflow: hidden;
  color: white;
  background: var(--blue);
  opacity: 0;
  transform: translateY(28px);
  transition: height .68s cubic-bezier(.16,1,.3,1), padding .68s cubic-bezier(.16,1,.3,1), opacity .28s ease, transform .68s cubic-bezier(.16,1,.3,1);
}
.beyond-footer span,
.beyond-footer strong,
.beyond-footer i { opacity: 0; transform: translateY(30px); }
.beyond-footer span { font: 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.beyond-footer strong { max-width: 900px; min-height: 1.1em; margin-top: 14px; font: 700 clamp(38px, 6vw, 78px)/1.05 var(--mono); letter-spacing: -.055em; }
.beyond-footer strong::after { content: ""; display: inline-block; width: .08em; height: .88em; margin-left: .1em; vertical-align: -.08em; background: currentColor; animation: typeCursor .75s steps(1) infinite; }
.beyond-footer i { position: absolute; right: max(28px, calc((100vw - 1080px) / 2)); top: 50%; font-size: clamp(52px, 8vw, 104px); font-style: normal; }
.beyond-footer.visible { height: min(34vh, 340px); padding: 48px max(32px, calc((100vw - 1080px) / 2)); opacity: 1; transform: translateY(0); }
.beyond-footer.visible span { animation: finaleRise .65s .28s both; }
.beyond-footer.visible strong { animation: finaleRise .8s .4s both; }
.beyond-footer.visible i { animation: finaleArrow .8s .58s both; }

@keyframes finaleRise {
  from { opacity: 0; transform: translateY(34px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes finaleArrow {
  from { opacity: 0; transform: translate(-24px, -15%) rotate(-15deg); }
  to { opacity: .75; transform: translate(0, -30%) rotate(0); }
}
@keyframes typeCursor { 50% { opacity: 0; } }

.copy-toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 28px;
  padding: 9px 14px;
  border-radius: 999px;
  color: white;
  background: var(--ink);
  box-shadow: 0 8px 28px rgba(23,24,23,.18);
  font: 10px var(--mono);
  letter-spacing: .08em;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .22s ease, transform .22s ease;
}
.copy-toast.visible { opacity: 1; transform: translate(-50%, 0); }

nav {
  display: flex;
  align-items: center;
  gap: 34px;
}

.language-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.language-picker::after {
  content: "⌄";
  position: absolute;
  right: 1px;
  top: 50%;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
  transform: translateY(-58%);
}

.language-picker select {
  appearance: none;
  -webkit-appearance: none;
  padding: 5px 14px 5px 2px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  font: 9px var(--mono);
  cursor: pointer;
  outline: none;
}

.language-picker:hover select,
.language-picker select:focus-visible {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

nav a {
  color: var(--muted);
  font-size: 10px;
  text-decoration: none;
  transition: color .2s ease;
}

nav a:hover,
nav a:focus-visible { color: var(--blue); }

.hero {
  min-height: 610px;
  display: flex;
  align-items: center;
  padding: 70px 0 110px;
}

.hero-copy { max-width: 880px; }

.avatar-wrap {
  position: relative;
  width: 126px;
  aspect-ratio: 1;
  margin-bottom: 28px;
  border-radius: 50%;
  overflow: visible;
  background: #e8e8e3;
  box-shadow: inset 0 0 0 1px rgba(23,24,23,.08);
}

.avatar-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.avatar-status {
  position: absolute;
  inset: auto 0 8px;
  text-align: center;
  color: rgba(23,24,23,.56);
  font: 8px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.avatar-wrap.ready .avatar-status { display: none; }

.avatar-easter-egg {
  min-height: 18px;
  width: max-content;
  max-width: 260px;
  margin: 0 0 10px;
  padding: 6px 10px;
  border: 1px solid rgba(49, 93, 245, .16);
  border-radius: 10px 10px 10px 3px;
  background: rgba(49, 93, 245, .06);
  color: var(--blue);
  font: 10px var(--mono);
  letter-spacing: .08em;
  opacity: 0;
  transform: translateY(5px) scale(.98);
  transition: opacity .35s ease, transform .35s ease;
}

.avatar-easter-egg.visible { opacity: 1; transform: translateY(0) scale(1); }

.dizzy-stars {
  position: absolute;
  z-index: 4;
  left: -18px;
  top: 9px;
  width: 162px;
  height: 78px;
  display: none;
  transform: rotate(-9deg);
  pointer-events: none;
}

.dizzy-stars i {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #f0b917;
  font-style: normal;
  text-shadow: 0 1px white;
  animation: starOrbit 1.45s linear infinite;
}
.dizzy-stars i:nth-child(1) { font-size: 13px; animation-delay: 0s; }
.dizzy-stars i:nth-child(2) { font-size: 17px; animation-delay: -.48s; }
.dizzy-stars i:nth-child(3) { font-size: 12px; animation-delay: -.96s; }
.avatar-wrap.dizzy { animation: avatarWobble .22s ease-in-out 4 alternate; }
.avatar-wrap.dizzy .dizzy-stars { display: block; }

@keyframes avatarWobble { to { transform: rotate(3deg) translateX(2px); } }
@keyframes starOrbit {
  0%   { opacity: 1;  transform: translate(-74px, 0) scale(1.05) rotate(9deg); }
  25%  { opacity: .5; transform: translate(0, -31px) scale(.66) rotate(99deg); }
  50%  { opacity: .3; transform: translate(74px, 0) scale(.52) rotate(189deg); }
  75%  { opacity: .9; transform: translate(0, 31px) scale(.95) rotate(279deg); }
  100% { opacity: 1;  transform: translate(-74px, 0) scale(1.05) rotate(369deg); }
}

.heart-burst {
  position: absolute;
  z-index: 5;
  inset: -20px;
  display: none;
  pointer-events: none;
}

.heart-burst i {
  position: absolute;
  left: 50%;
  top: 50%;
  color: #ef5570;
  font-style: normal;
  opacity: 0;
}

.avatar-wrap.heart-found .heart-burst { display: block; }
.avatar-wrap.heart-found .heart-burst i:nth-child(1) { animation: heartFloat 1.35s 0s ease-out both; --x: -62px; --y: -58px; --r: -14deg; }
.avatar-wrap.heart-found .heart-burst i:nth-child(2) { animation: heartFloat 1.35s .12s ease-out both; --x: 57px; --y: -68px; --r: 11deg; }
.avatar-wrap.heart-found .heart-burst i:nth-child(3) { animation: heartFloat 1.35s .22s ease-out both; --x: -78px; --y: -13px; --r: -8deg; }
.avatar-wrap.heart-found .heart-burst i:nth-child(4) { animation: heartFloat 1.35s .32s ease-out both; --x: 75px; --y: -20px; --r: 16deg; }

@keyframes heartFloat {
  0% { opacity: 0; transform: translate(-50%, -20%) scale(.35); }
  25% { opacity: 1; }
  75% { opacity: .9; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.25) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  .avatar-wrap.dizzy, .avatar-wrap.dizzy .dizzy-stars i, .avatar-wrap.heart-found .heart-burst i { animation: none; }
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 10px;
}

h1 {
  max-width: 880px;
  margin: 0;
  font-size: clamp(40px, 5vw, 66px);
  line-height: 1.08;
  letter-spacing: -.055em;
  font-weight: 600;
}

h1 span,
.about-statement span { color: var(--blue); }

.intro {
  max-width: 650px;
  margin: 27px 0 0;
  color: #40423f;
  font-size: 18px;
  line-height: 1.65;
}

.avatar-tip {
  margin: 20px 0 0;
  color: #9b9d98;
  font-size: 8px;
}

.currently {
  width: min(100%, 500px);
  justify-self: end;
  align-self: center;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.currently-head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: start;
  padding: 20px 0 26px;
}

.currently-head p {
  margin: 0;
  color: var(--blue);
  font-size: 10px;
}

.currently-head strong {
  color: var(--blue);
  font: 700 52px/.85 var(--mono);
  letter-spacing: -.1em;
}

.currently-head strong span { color: #b9bbb5; }

.currently-list article {
  display: grid;
  grid-template-columns: 88px 1fr;
  column-gap: 20px;
  padding: 20px 0 22px;
  border-top: 1px solid var(--line);
}

.currently-list article > span {
  grid-row: 1 / 3;
  padding-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.currently-list h2 {
  margin: 0 0 5px;
  font-family: var(--body);
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: -.025em;
  text-transform: none;
}

.currently-list p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  letter-spacing: 0;
  text-transform: none;
  font-family: var(--body);
}

.content-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: clamp(48px, 9vw, 132px);
  padding: 78px 0 92px;
  border-top: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0 0 14px;
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -.04em;
}

.section-heading p {
  max-width: 245px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.note-list { border-top: 1px solid var(--ink); }

.note {
  width: 100%;
  min-height: 79px;
  display: grid;
  grid-template-columns: 60px 1fr auto 22px;
  gap: 18px;
  align-items: center;
  padding: 0;
  color: var(--ink);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.note-date,
.note-tag { font-size: 8px; color: var(--muted); }

.note-title {
  font-size: 18px;
  line-height: 1.35;
  transition: color .2s ease, transform .2s ease;
}

.note-arrow {
  color: var(--blue);
  opacity: 0;
  transform: translate(-6px, 6px);
  transition: opacity .2s ease, transform .2s ease;
}

.note:hover .note-title,
.note:focus-visible .note-title { color: var(--blue); transform: translateX(4px); }
.note:hover .note-arrow,
.note:focus-visible .note-arrow { opacity: 1; transform: translate(0,0); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.project {
  min-height: 310px;
  position: relative;
  border-radius: 14px;
  background: transparent;
  perspective: 1100px;
  transition: transform .25s ease, box-shadow .25s ease;
}

.project:hover,
.project:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 16px 36px rgba(23, 24, 23, .12);
}

.project:first-child { grid-column: 1 / -1; min-height: 260px; }
.project-blue { color: white; }
.project-yellow { color: var(--ink); }
.project-ink { color: white; }
.project-flip-inner { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .65s cubic-bezier(.2,.75,.25,1); }
.project-flip.flipped .project-flip-inner { transform: rotateY(180deg); }
.project-face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 24px; border-radius: 14px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.project-blue .project-face { background: var(--blue); }
.project-yellow .project-face { background: var(--yellow); }
.project-ink .project-face { background: var(--ink); }
.project-back { transform: rotateY(180deg); justify-content: flex-end; }
.project-copy { margin-top: auto; }
.project-note-label { margin: 0 0 14px; font: 8px var(--mono); letter-spacing: .14em; opacity: .55; }
.project-back blockquote {
  max-width: 500px;
  margin: 0 0 18px;
  font-family: "Caveat", cursive;
  font-size: clamp(27px, 3vw, 40px);
  line-height: 1.08;
  letter-spacing: .005em;
  font-weight: 600;
  transform: rotate(-.7deg);
}
.project-grid .project:not(:first-child) .project-back blockquote { font-size: clamp(25px, 2.45vw, 32px); }
.project-flip { user-select: none; -webkit-user-select: none; touch-action: pan-y; cursor: pointer; }

.project-type { margin: auto 0 7px; font-size: 8px; opacity: .68; }
.project h3 { margin: 0 0 7px; font-size: 26px; letter-spacing: -.035em; }
.project-copy > p:last-child { max-width: 360px; margin: 0; font-size: 14px; opacity: .72; }

.project-mark {
  position: relative;
  width: 120px;
  height: 120px;
}

.project-icon {
  width: 68px;
  height: 68px;
  object-fit: cover;
  border-radius: 15px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .11);
}

.project:first-child .project-icon { align-self: flex-start; }

.mark-orbit { align-self: flex-end; }
.mark-orbit i { position: absolute; inset: 10px; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; }
.mark-orbit i:nth-child(2) { inset: 30px; }
.mark-orbit i:nth-child(3) { inset: 52px; background: var(--yellow); border: 0; }
.project-yellow .mark-orbit i { border-color: rgba(23, 24, 23, .38); }
.project-yellow .mark-orbit i:nth-child(3) { background: var(--blue); }
.mark-type { display: grid; place-items: center; font-size: 70px; font-weight: 600; }
.mark-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 18px; }
.mark-grid i { border: 1px solid rgba(255,255,255,.5); }

.more-projects {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 30px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}

.more-projects-copy p {
  margin: 0;
  color: var(--muted);
  font: 8px var(--mono);
  letter-spacing: .12em;
}

.more-projects-copy span {
  display: block;
  max-width: 130px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.more-projects > div:last-child {
  display: grid;
  grid-template-columns: 1fr;
}

.more-projects a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 13px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.more-projects a > span:last-child,
.contact-links a > span:last-child {
  padding-right: 8px;
}

.more-project-info {
  display: grid;
  gap: 2px;
}

.more-project-info strong {
  font-weight: 500;
}

.more-project-info small {
  color: #a0a29d;
  font-size: 11px;
  line-height: 1.4;
}

.more-projects a:hover,
.more-projects a:focus-visible { color: var(--blue); }

.about {
  padding: 92px 0 106px;
  border-top: 1px solid var(--line);
}

.about-statement {
  max-width: 920px;
  margin: 0;
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.18;
  letter-spacing: -.055em;
}

.about-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  margin-top: 60px;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
}

.about-meta p { margin: 0; color: var(--muted); font-size: 13px; }
.about-meta strong { display: block; margin-bottom: 7px; color: var(--ink); font-weight: 500; }

.contact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  padding: 78px 0 90px;
  border-top: 1px solid var(--line);
}

.contact h2 { margin: 0; font-size: clamp(38px, 5vw, 62px); line-height: 1.08; letter-spacing: -.055em; }
.contact-links { display: flex; flex-direction: column; align-self: end; }
.contact-links a { display: flex; justify-content: space-between; padding: 16px 0; text-decoration: none; border-bottom: 1px solid var(--line); }
.contact-links a:hover { color: var(--blue); }

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 0 42px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 8px;
}

.article-dialog {
  width: min(680px, calc(100% - 32px));
  max-height: min(760px, calc(100vh - 42px));
  padding: clamp(30px, 6vw, 68px);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  box-shadow: 0 30px 100px rgba(23,24,23,.25);
}

.article-dialog::backdrop { background: rgba(23,24,23,.45); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 20px; right: 22px; padding: 0; color: var(--muted); background: none; border: 0; cursor: pointer; }
.dialog-meta { margin: 0 0 22px; color: var(--blue); font-size: 9px; }
.article-dialog h2 { margin: 0 0 34px; font-size: clamp(34px, 5vw, 52px); line-height: 1.08; letter-spacing: -.05em; }
.dialog-body { color: #3e403d; font-size: 17px; }
.dialog-body p { margin: 0 0 1.35em; }

@media (max-width: 760px) {
  main, footer { width: min(100% - 36px, 1080px); }
  .site-header { padding-inline: 18px; }
  .site-header { height: 92px; }
  nav { gap: 16px; }
  .language-picker select { width: 45px; padding-right: 14px; }
  .hero { min-height: auto; padding: 38px 0 54px; }
  .currently { width: 100%; justify-self: stretch; }
  .content-section { grid-template-columns: 1fr; gap: 34px; padding: 62px 0 72px; }
  .project-grid { grid-template-columns: 1fr; }
  .project:first-child { grid-column: auto; }
  .more-projects { grid-column: auto; grid-template-columns: 1fr; gap: 12px; }
  .more-projects > div:last-child { grid-template-columns: 1fr; }
  .more-projects-copy span { max-width: 260px; }
  .about-meta { grid-template-columns: 1fr; gap: 22px; }
  .contact { grid-template-columns: 1fr; }
  footer { flex-direction: column; gap: 4px; }
}

@media (max-width: 480px) {
  nav { gap: 12px; }
  nav a { font-size: 8px; }
  .note { grid-template-columns: 48px 1fr 16px; gap: 10px; }
  .note-tag { display: none; }
  .note-title { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
