/* Kelly Zheng — personal site. Black, white and a little green. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

html { scroll-behavior: smooth; transition: background-color .45s ease, color .45s ease; }
html.dark { background: #000000; color: #FFFFFF; }
html.light { background: #FFFFFF; color: #000000; }
body {
  margin: 0;
  font-family: "Archivo", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Arial Narrow", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}
.preload, .preload * { transition: none !important; }

a { color: inherit; text-decoration: none; }
a:hover { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
a:focus-visible, button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.wrap { position: relative; max-width: 1440px; margin: 0 auto; padding: 32px clamp(20px, 3.4vw, 48px) 40px; box-sizing: border-box; }
.screen1 { min-height: calc(min(100vh, 900px) - 32px); display: flex; flex-direction: column; }
.g12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: 24px; }
.g10 { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: 24px; }
.full { min-height: min(100vh, 900px); box-sizing: border-box; padding: 64px 0; display: flex; flex-direction: column; justify-content: center; }

/* Line heights that change with the language */
.lh-text { line-height: 1.25; }
.lh-title { line-height: .9; }
.lh-h3 { line-height: 1.05; }
.lh-body { line-height: 1.45; }
.lh-big { line-height: 1.08; }
.lh-h1 { line-height: .8; letter-spacing: -.03em; }
.lh-next { line-height: .85; }
:lang(zh) .lh-text { line-height: 1.6; }
:lang(zh) .lh-title { line-height: 1.05; }
:lang(zh) .lh-h3 { line-height: 1.3; }
:lang(zh) .lh-body { line-height: 1.7; }
:lang(zh) .lh-big { line-height: 1.35; }
:lang(zh) .lh-h1 { line-height: .95; letter-spacing: -.02em; }
:lang(zh) .lh-next { line-height: 1; }

/* Header controls */
.lang { display: flex; }
.lang button {
  font: inherit; font-size: 14px; font-weight: 700; min-width: 52px; min-height: 44px; padding: 0 12px;
  border: 1px solid currentColor; cursor: pointer; background: transparent; color: inherit;
}
.lang button + button { margin-left: -1px; }
.dark .lang button[aria-pressed="true"] { background: #FFFFFF; color: #000000; }
.light .lang button[aria-pressed="true"] { background: #000000; color: #FFFFFF; }

.lamp {
  font: inherit; color: inherit; background: none; border: 1px solid currentColor; width: 44px; height: 44px;
  padding: 0; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lamp .rays { opacity: 0; transition: opacity .3s ease; }
.lamp .bulb { fill: none; transition: fill .3s ease; }
.light .lamp .rays { opacity: 1; }
.light .lamp .bulb { fill: #2FB45A; }

.light .logo { filter: invert(1); }

/* Photo block */
.photo-btn {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; padding: 0; border: 0;
  background: #2FB45A; color: #000000; cursor: pointer; overflow: hidden; font: inherit; text-align: left;
}
.photo-btn .flip { position: absolute; inset: 0; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; transition: opacity .3s ease; }
.photo-btn .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(100% 0 0 0); transition: clip-path .6s cubic-bezier(.2,.8,.2,1); }
.photo-btn.is-on .flip { opacity: 0; }
.photo-btn.is-on .photo { clip-path: inset(0 0 0 0); }

/* Row hover */
.row .t { transition: color .2s ease; }
.dark .row:hover .t, .dark .row:focus-visible .t { color: #2FB45A; }
.light .row:hover .t, .light .row:focus-visible .t { color: #17853F; }
.row:hover { text-decoration: none; }
.next .t { transition: color .2s ease; }
.next:hover { text-decoration: none; }
.dark .next:hover .t, .dark .next:focus-visible .t { color: #2FB45A; }
.light .next:hover .t, .light .next:focus-visible .t { color: #17853F; }

/* Side rail */
.rail { grid-column: 1 / span 2; grid-row: 1; align-self: start; position: sticky; top: 0; height: min(100vh, 900px); box-sizing: border-box; padding: 64px 0; display: flex; gap: 16px; }
.rail a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding-left: 22px; color: #8C8C8C; font-weight: 500; transition: color .2s ease; }
.light .rail a { color: #6B6B6B; }
.rail a.is-active { color: inherit; font-weight: 700; }
.rail a:hover { text-decoration: none; }
.mk { position: absolute; left: 0; width: 8px; height: 8px; background: #2FB45A; transition: top .4s cubic-bezier(.2,.8,.2,1); }
.bar { position: absolute; left: 0; top: 0; width: 1px; height: 0; background: currentColor; transition: height .15s linear; }

/* Experience and education rows */
.xr { display: grid; grid-template-columns: minmax(0, 1fr) 230px 72px 140px; column-gap: 24px; row-gap: 10px; align-items: baseline; }
.xt { grid-column: 1; } .xa { grid-column: 2; } .xb { grid-column: 3; } .xc { grid-column: 4; } .xab { grid-column: 2 / span 2; }
@media (max-width: 1100px) {
  .xr { grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr) minmax(0, 1fr); }
  .xt { grid-column: 1 / -1; } .xa { grid-column: 1; } .xb { grid-column: 2; } .xc { grid-column: 3; } .xab { grid-column: 1 / span 2; }
}

/* Skill tree */
.node {
  font: inherit; text-align: left; width: 100%; min-height: 200px; padding: 16px; border: 1px solid currentColor;
  cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  background: transparent; color: inherit; transition: background-color .2s ease, color .2s ease;
}
.node.is-on { background: #2FB45A; color: #000000; border-color: #2FB45A; }
.sq { width: 14px; height: 14px; box-sizing: border-box; border: 1px solid currentColor; }
.sq.f { background: currentColor; }
.stub { width: 1px; height: 28px; background: transparent; }
.stub.is-on { background: currentColor; }
.textbtn { font: inherit; font-size: 15px; font-weight: 500; color: inherit; background: none; border: 0; padding: 12px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* Visually hidden section labels (shown on phones) */
.lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }

/* Motion: page load */
@keyframes rise { from { transform: translateY(1.25em); } to { transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes wipe { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.mh { display: block; overflow: hidden; padding: .2em 0; margin: -.2em 0; }
.mh > span { display: block; animation: rise 1.1s cubic-bezier(.2,.8,.2,1) both; }
.fa { animation: fadein .8s ease .8s both; }
.wipe { animation: wipe .9s cubic-bezier(.7,0,.2,1) .45s both; }
.eye { transform-origin: center; animation: blink 4.5s ease-in-out 2.2s infinite; }

/* Motion: on scroll (JS adds .on to a section when it enters view) */
.mr { display: block; overflow: hidden; padding: .14em 0; margin: -.14em 0; }
.mr > span { display: block; transform: translateY(115%); transition: transform .9s cubic-bezier(.2,.8,.2,1); }
.on .mr > span { transform: none; }
.ln { position: relative; }
.ln::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .8s cubic-bezier(.2,.8,.2,1); }
.on .ln::before { transform: scaleX(1); }
.fd { opacity: 0; transition: opacity .6s ease .45s; }
.on .fd { opacity: 1; }
.fdl { transition-delay: 1.4s; }
.ln .xa, .ln .xb, .ln .xc, .ln .xab { opacity: 0; transition: opacity .6s ease .45s; }
.on .ln .xa, .on .ln .xb, .on .ln .xc, .on .ln .xab { opacity: 1; }
.on .ln:nth-child(2)::before, .on .ln:nth-child(2) .mr > span { transition-delay: .15s; }
.on .ln:nth-child(3)::before, .on .ln:nth-child(3) .mr > span { transition-delay: .3s; }
.on .pl > .mr:nth-child(2) > span { transition-delay: .12s; }
.on .pl > .mr:nth-child(3) > span { transition-delay: .24s; }
.on .pl > .mr:nth-child(4) > span { transition-delay: .36s; }
.on .pl > .mr:nth-child(5) > span { transition-delay: .48s; }
.step { position: relative; }
.step::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .5s cubic-bezier(.2,.8,.2,1); }
.step > * { opacity: 0; transition: opacity .5s ease; }
.on .step::before { transform: scaleX(1); }
.on .step > * { opacity: 1; }
.on .step:nth-child(1)::before { transition-delay: .6s; }  .on .step:nth-child(1) > * { transition-delay: .75s; }
.on .step:nth-child(2)::before { transition-delay: .72s; } .on .step:nth-child(2) > * { transition-delay: .87s; }
.on .step:nth-child(3)::before { transition-delay: .84s; } .on .step:nth-child(3) > * { transition-delay: .99s; }
.on .step:nth-child(4)::before { transition-delay: .96s; } .on .step:nth-child(4) > * { transition-delay: 1.11s; }
.on .step:nth-child(5)::before { transition-delay: 1.08s; } .on .step:nth-child(5) > * { transition-delay: 1.23s; }
.on .step:nth-child(6)::before { transition-delay: 1.2s; }  .on .step:nth-child(6) > * { transition-delay: 1.35s; }
.on .step:nth-child(7)::before { transition-delay: 1.32s; } .on .step:nth-child(7) > * { transition-delay: 1.47s; }
.stepg { clip-path: inset(0 100% 0 0); transition: clip-path .7s cubic-bezier(.7,0,.2,1) 1.55s; }
.on .stepg { clip-path: inset(0 0 0 0); }
.vt { transform: scaleY(0); transform-origin: top; transition: transform .35s ease .2s; }
.hz { transform: scaleX(0); transition: transform .6s cubic-bezier(.2,.8,.2,1) .5s; }
.vt2 { transform: scaleY(0); transform-origin: top; transition: transform .35s ease 1s; }
.on .vt, .on .hz, .on .vt2 { transform: none; }
.g4 > div { opacity: 0; transition: opacity .5s ease 1.2s; }
.on .g4 > div { opacity: 1; }

/* Phones */
@media (max-width: 760px) {
  .g { grid-template-columns: minmax(0, 1fr) !important; }
  .g > * { grid-column: 1 / -1 !important; grid-row: auto !important; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .tl, .rail { display: none !important; }
  .lbl { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: normal; margin: 0 0 16px; }
}

/* Respect reduced motion: show everything in its final state */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; transition: none; }
  .row .t, .next .t, .node, .mk, .bar, .rail a, .photo-btn .photo, .photo-btn .flip, .lamp .rays, .lamp .bulb { transition: none; }
  .mh > span, .fa, .wipe, .eye { animation: none; }
  .mr > span, .ln::before, .step::before, .vt, .hz, .vt2 { transition: none; transform: none; }
  .fd, .ln .xa, .ln .xb, .ln .xc, .ln .xab, .step > *, .g4 > div { transition: none; opacity: 1; }
  .stepg { transition: none; clip-path: none; }
}
