/* Shuai Yang — personal site
   Apple-style type scale (SF Pro on Apple devices, Inter elsewhere; the intro paragraph in Hanken Grotesk), black / white / grey
   surfaces and one translucent blue → purple → red accent gradient.
   Breakpoints: tablet ≤ 1068px, phone ≤ 734px. Order follows the page from top to bottom. */

/* ============================================================ tokens */
@font-face {
  font-family: "Inter Variable";
  src: url("../fonts/inter-latin-var.woff2") format("woff2-variations"), url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face { /* intro paragraph; SIL OFL, see ../fonts/OFL-HankenGrotesk.txt */
  font-family: "Hanken Grotesk";
  src: url("../fonts/hanken-grotesk-latin-var.woff2") format("woff2-variations"), url("../fonts/hanken-grotesk-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  color-scheme: only light;
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --tile: #f5f5f7;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hair: #d2d2d7;
  --hair-soft: rgba(0, 0, 0, .08);
  --nav-bg: rgba(255, 255, 255, .72);
  --chip: #ffffff;
  --btn: rgba(0, 0, 0, .055);
  --btn-hover: rgba(0, 0, 0, .1);
  --grad: linear-gradient(90deg, #0a84ff 0%, #5e5ce6 34%, #bf5af2 66%, #ff375f 100%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter Variable", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter Variable", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --wrap: 980px;
  --gutter: 22px;
}
@media (max-width: 734px) { :root { --gutter: 20px; } }

/* ============================================================ base */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 17px/1.47059 var(--font); letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
body.hello-lock { overflow: hidden; }
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid #0a84ff; outline-offset: 3px; border-radius: 6px; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ============================================================ type */
.t-eyebrow { font: 600 21px/1.19048 var(--display); letter-spacing: .011em; margin: 0 0 10px; }
.t-caption { font: 400 14px/1.42859 var(--font); letter-spacing: -.016em; color: var(--ink-3); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
@media (max-width: 734px) { .t-eyebrow { font-size: 19px; } }

/* ============================================================ navigation */
.nav {
  position: sticky; top: 0; z-index: 50; height: 48px;
  background: var(--nav-bg); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair-soft);
}
.nav .wrap { height: 100%; display: flex; align-items: center; justify-content: space-between; }
.nav .brand { font: 600 15px/1 var(--display); letter-spacing: -.01em; }
.nav ul { list-style: none; display: flex; gap: 30px; margin: 0; padding: 0; }
.nav ul a { font: 400 12px/1 var(--font); letter-spacing: -.01em; color: var(--ink); opacity: .8; transition: opacity .2s; }
.nav ul a:hover, .nav ul a.active { opacity: 1; }
.nav ul a.active { font-weight: 600; }
.nav .menu { display: none; background: none; border: 0; width: 36px; height: 36px; padding: 0; color: var(--ink); cursor: pointer; }
.nav .menu span { display: block; width: 17px; height: 1.2px; background: currentColor; margin: 5px auto; transition: transform .3s; }
@media (max-width: 734px) {
  .nav .menu { display: block; }
  .nav ul {
    position: absolute; top: 48px; left: 0; right: 0; flex-direction: column; gap: 0; padding: 8px 20px 18px;
    background: var(--bg); box-shadow: 0 22px 34px -24px rgba(0, 0, 0, .35);
    border-bottom: 1px solid var(--hair-soft); transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  }
  .nav ul a { display: block; padding: 12px 0; font-size: 17px; border-bottom: 1px solid var(--hair-soft); }
  .nav.open ul { transform: none; opacity: 1; pointer-events: auto; }
  .nav.open .menu span:first-child { transform: translateY(3px) rotate(45deg); }
  .nav.open .menu span:last-child { transform: translateY(-3px) rotate(-45deg); }
}

/* ============================================================ sections */
.section { padding: 84px 0; }
.section.alt { background: var(--bg-alt); }
.section-head { margin-bottom: 34px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.head-row .t-eyebrow { margin: 0; }
@media (max-width: 734px) { .section { padding: 60px 0; } .section-head { margin-bottom: 24px; } }

/* ============================================================ intro: portrait · name · bio · links */
.intro { position: relative; overflow: hidden; padding: 76px 0 72px; }
.intro::before { /* faint translucent aura */
  content: ""; position: absolute; left: 6%; top: 10px; width: 760px; height: 420px;
  background: radial-gradient(closest-side at 28% 52%, rgba(10, 132, 255, .10), transparent 70%),
              radial-gradient(closest-side at 52% 44%, rgba(191, 90, 242, .09), transparent 70%),
              radial-gradient(closest-side at 74% 58%, rgba(255, 55, 95, .07), transparent 70%);
  filter: blur(24px); pointer-events: none;
}
.intro-grid { position: relative; display: grid; grid-template-columns: 224px 1fr; grid-template-rows: 1fr auto; grid-template-areas: "photo text" "dock text"; gap: 22px 54px; align-items: start; }
.intro-text { grid-area: text; align-self: stretch; display: flex; flex-direction: column; } /* text spans the photo and its icons: name level with the photo's top, affiliations level with the icons */

.portrait { grid-area: photo; position: relative; margin: 0; width: 100%; max-height: 336px; align-self: stretch; isolation: isolate; } /* the photo's own 4:5, or taller when the text beside it is (its row takes the extra height), so the icons stay right under it; 2:3 at most */
.portrait::before { /* soft aura, slowly drifting */
  content: ""; position: absolute; inset: 8% -10% -8% -10%; z-index: -1; border-radius: 40%;
  background: conic-gradient(from 210deg, rgba(10,132,255,.55), rgba(94,92,230,.45), rgba(191,90,242,.5), rgba(255,55,95,.45), rgba(10,132,255,.55));
  filter: blur(36px); opacity: .55; animation: aura 18s linear infinite;
}
.portrait picture, .portrait img { display: block; width: 100%; height: 100%; }
.portrait img { object-fit: cover; border-radius: 27px; box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 30px 60px -24px rgba(0,0,0,.45); }
.portrait::after { /* fine highlight edge */
  content: ""; position: absolute; inset: 0; border-radius: 27px; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), inset 0 1px 0 rgba(255,255,255,.35);
}
@keyframes aura { to { transform: rotate(360deg); } }

.name { margin: 0; line-height: 0; }
.name-script { display: block; width: 236px; height: auto; overflow: visible; margin-left: -3px; }
.bio { margin: 12px 0 14px; max-width: 690px; font: 400 18px/1.6 "Hanken Grotesk", var(--font); letter-spacing: 0; color: var(--ink-2); text-align: justify; text-wrap: pretty; }
.bio a { color: var(--ink); border-bottom: 1px solid var(--hair); transition: border-color .2s; }
.bio a:hover { border-color: var(--ink); }
.bio strong { color: var(--ink); font-weight: 600; }
.seeking { /* open-to-positions note under the bio: the accent gradient as a bar and a faint tint */
  position: relative; overflow: hidden; margin: 0 0 18px; max-width: 690px; padding: 10px 16px 10px 19px; border-radius: 4px 14px 14px 4px;
  font: 400 15.5px/1.45 "Hanken Grotesk", var(--font); letter-spacing: 0; color: var(--ink-2); text-align: left; text-wrap: pretty;
  background: linear-gradient(100deg, rgba(10, 132, 255, .075), rgba(94, 92, 230, .06) 34%, rgba(191, 90, 242, .055) 66%, rgba(255, 55, 95, .05));
}
.seeking::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(180deg, #0a84ff, #5e5ce6 34%, #bf5af2 66%, #ff375f); }
.seeking strong { color: var(--ink); font-weight: 600; }
.seeking a { color: var(--ink); border-bottom: 1px solid var(--hair); white-space: nowrap; transition: border-color .2s; } /* "reach out" never splits across lines */
.seeking a:hover { border-color: var(--ink); }
.aff { list-style: none; margin: auto 0 0; padding: 16px 0 0; border-top: 1px solid var(--hair); display: flex; flex-wrap: wrap; gap: 14px 32px; font-family: "Hanken Grotesk", var(--font); text-align: left; }
.aff li { display: flex; align-items: center; gap: 9px; }
.aff-logo { flex: none; width: auto; height: 26px; }
.aff b { display: block; font-size: 15px; line-height: 1.3; font-weight: 600; color: var(--ink); }
.aff small { display: block; font-size: 13.5px; line-height: 1.4; color: var(--ink-3); }

.links { grid-area: dock; align-self: end; display: flex; justify-content: space-between; margin: 0 -11px; } /* under the photo, level with the affiliations; -11px: the glyphs line up with its edges */
.icon-link { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 10px; color: var(--ink); opacity: .78; transition: background .2s, opacity .2s; }
.icon-link:hover { background: var(--bg-alt); opacity: 1; }
.icon-link svg { width: 20px; height: 20px; fill: currentColor; }

@media (prefers-reduced-motion: reduce) { .portrait::before { animation: none; } }
@media (max-width: 1068px) {
  .intro-grid { grid-template-columns: 220px 1fr; gap: 22px 38px; }
  .name-script { width: 214px; }
}
@media (min-width: 901px) and (max-width: 959px) { .bio { font-size: 17px; } .aff { gap: 14px 18px; } } /* the text column beside the photo narrows here: the bio keeps its lines and the affiliations their one row */
@media (max-width: 900px) { /* narrow tablets and phones: centred, stacked intro */
  .intro { text-align: center; }
  .intro::before { left: 50%; transform: translateX(-50%); width: 520px; }
  .intro-grid { grid-template-columns: 1fr; grid-template-rows: none; grid-template-areas: "photo" "text" "dock"; gap: 22px; justify-items: center; }
  .portrait { width: 196px; aspect-ratio: 4 / 5; }
  .name-script { margin: 0 auto; }
  .bio { text-align: left; margin: 14px auto 0; max-width: 620px; }
  .seeking { margin: 16px auto 14px; max-width: 620px; }
  .links { margin: 0; justify-content: center; gap: 14px; }
  .aff { justify-content: center; margin-top: 4px; }
}
@media (max-width: 734px) {
  .intro { padding: 44px 0 52px; }
  .portrait { width: 176px; }
  .portrait img, .portrait::after { border-radius: 23px; }
  .name-script { width: 188px; margin: 0 auto; }
  .bio { font-size: 17px; }
  .seeking { font-size: 15px; }
  .links { gap: 10px; }
  .aff { display: grid; justify-content: center; justify-items: start; gap: 12px; } /* one centred block, names aligned */
  .aff li { display: grid; grid-template-columns: 66px auto; column-gap: 10px; }
  .aff-logo { height: 22px; justify-self: end; } /* the widest mark (22 px tall) is 65 px */
}

/* ============================================================ publications */
.pubs { display: grid; gap: 12px; }
.pub { display: grid; grid-template-columns: 232px 1fr; gap: 26px; align-items: center; padding: 16px; border-radius: 22px; background: none; }
.pub .media { position: relative; aspect-ratio: 16 / 10; border-radius: 13px; overflow: hidden; background: #e8e8ed; }
.pub .media img, .pub .media video { width: 100%; height: 100%; object-fit: cover; }
.pub .media.contain img { object-fit: contain; background: #fff; padding: 6px; }
.venue {
  display: inline-block; font: 600 11px/1 var(--font); letter-spacing: .02em; padding: 5px 9px; border-radius: 980px; color: var(--ink);
  background: linear-gradient(var(--chip), var(--chip)) padding-box, var(--grad) border-box; border: 1px solid transparent;
}
.pub h3 { font: 600 17px/1.3 var(--display); letter-spacing: -.01em; margin: 9px 0 5px; }
.pub h3 a:hover { opacity: .75; }
.authors { margin: 0; font: 400 13px/1.5 var(--font); letter-spacing: -.005em; color: var(--ink-2); }
.authors b { color: var(--ink); font-weight: 600; }
.authors a:hover { color: var(--ink); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.actions a, .actions .soon {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px; border-radius: 980px;
  font: 500 12px/1 var(--font); letter-spacing: -.005em; color: var(--ink); background: var(--btn);
}
.actions a { transition: background .2s ease, color .2s ease; }
.actions svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .72; }
.actions a:hover { background: var(--btn-hover); }
.actions a:hover svg { opacity: 1; }
.actions .soon { color: var(--ink-3); cursor: default; user-select: none; } /* not yet available */
.actions .soon svg { opacity: .6; }
.actions .soon em { font-style: normal; font-weight: 400; opacity: .85; }

@media (max-width: 1068px) { .pub { grid-template-columns: 208px 1fr; gap: 22px; } }
@media (max-width: 734px) { .pub { grid-template-columns: 176px 1fr; gap: 18px; padding: 14px; } }
@media (max-width: 520px) { .pub { grid-template-columns: 1fr; gap: 14px; padding: 14px 14px 18px; } }

/* ============================================================ misc: NBA · F1 · cats */
#misc > .wrap > .t-eyebrow { display: inline-block; margin-bottom: 18px; }
.minis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 18px; background: var(--tile); }
.mini-label { flex: none; min-width: 58px; font: 600 11px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.mini-text { margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px; white-space: nowrap; font: 600 16px/1.2 var(--display); letter-spacing: -.005em; color: var(--ink); }
.mini-text > span { display: inline-flex; align-items: center; }
.mini-text .amp { color: var(--ink-3); font-weight: 400; margin-right: 6px; }
.emblem { height: 1.1em; width: auto; margin-left: .3em; flex: none; }
.emblem.speedmark { height: .72em; } /* centred on the text like the Ferrari shield */

.cats { margin-top: 12px; padding: 26px 28px 28px; border-radius: 22px; background: var(--tile); }
.cats-title { margin: 0; font: 600 26px/1.15 var(--display); letter-spacing: .004em; text-align: center; }
.triptych { display: grid; grid-template-columns: 1fr 1.28fr 1fr; gap: 12px; align-items: end; max-width: 640px; margin: 22px auto 0; }
.triptych figure { margin: 0; }
.triptych .frame { border-radius: 16px; overflow: hidden; aspect-ratio: 3 / 4; background: #e8e8ed; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 28px -14px rgba(0,0,0,.28); }
.triptych img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(.2,.7,.2,1); }
.triptych figure:hover img { transform: scale(1.035); }
.triptych figcaption { margin-top: 10px; text-align: center; font: 600 13px/1.3 var(--display); letter-spacing: .02em; color: var(--ink); }

@media (max-width: 1068px) {
  .cats { padding: 24px 24px 26px; }
  .cats-title { font-size: 24px; }
}
@media (max-width: 900px) { .minis { grid-template-columns: 1fr; } }
@media (max-width: 734px) {
  .mini { flex-direction: column; align-items: flex-start; padding: 14px 18px; }
  .cats { padding: 22px 0; }
  .cats-title { font-size: 22px; padding: 0 20px; text-align: left; }
  .triptych { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; max-width: none; margin-top: 18px; padding: 0 20px 6px; scrollbar-width: none; }
  .triptych::-webkit-scrollbar { display: none; }
  .triptych figure { flex: 0 0 62%; scroll-snap-align: center; }
}

/* ============================================================ service */
.service-end { padding: 56px 0 40px; }
.service-end .t-eyebrow { display: inline-block; margin-bottom: 14px; }
.spec { margin: 0; border-top: 1px solid var(--hair); }
.spec-row { display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--hair); }
.spec dt { font: 600 12px/1.6 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.spec dd { margin: 0; font: 500 17px/1.6 var(--display); letter-spacing: -.005em; color: var(--ink); }
.spec dd span { white-space: nowrap; }
.spec dd i { display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--ink-3); vertical-align: middle; margin: 0 12px; opacity: .7; }
@media (max-width: 734px) {
  .spec-row { grid-template-columns: 1fr; gap: 6px; padding: 14px 0; }
  .spec dd { display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 16px; }
  .spec dd i { display: none; }
}

/* ============================================================ footer: copyright · visitor statistics */
.footer { background: var(--bg-alt); padding: 22px 0 26px; }
.footer .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 24px; min-height: 30px; }
.footer p { margin: 0; font: 400 12px/1.4 var(--font); color: var(--ink-3); letter-spacing: -.01em; }
.visitor-stats { display: grid; justify-items: center; gap: 8px; max-width: 100%; color: var(--ink-2); font: 400 12px/1.4 var(--font); }
.footer .visits {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px 0 10px; border: 1px solid transparent; border-radius: 980px;
  background: linear-gradient(var(--chip), var(--chip)) padding-box, var(--grad) border-box;
  font: 400 13px/18px var(--font); letter-spacing: 0; color: var(--ink-3); white-space: nowrap;
}
.visits[hidden], .count-status[hidden] { display: none; }
.visits svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.visit-count { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 734px) { .footer .wrap { flex-direction: column-reverse; justify-content: center; } }

/* ============================================================ motion: scroll reveal */
[data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1s cubic-bezier(.2,.7,.2,1), transform 1s cubic-bezier(.2,.7,.2,1); }
[data-reveal].in { opacity: 1; transform: none; }
.no-js [data-reveal], .reduced [data-reveal] { opacity: 1; transform: none; transition: none; }

/* ============================================================ motion: "Hello, I am Shuai." opener */
.hello { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--bg); transition: opacity .55s ease; }
.hello::before { /* translucent aura behind the writing */
  content: ""; position: absolute; width: min(1100px, 120vw); height: min(620px, 80vh); left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(closest-side at 30% 50%, rgba(10,132,255,.13), transparent 72%),
              radial-gradient(closest-side at 52% 46%, rgba(191,90,242,.13), transparent 72%),
              radial-gradient(closest-side at 72% 56%, rgba(255,55,95,.11), transparent 72%);
  filter: blur(30px); opacity: var(--aura, 0); transition: opacity 1.4s ease;
}
.hello svg { position: relative; width: min(1120px, 90vw); height: auto; overflow: visible; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.hello svg path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hello .glow { opacity: .6; }
.hello button { position: absolute; right: 26px; bottom: 24px; border: 0; background: transparent; color: var(--ink-3); font: 400 14px/1 var(--font); padding: 12px 16px; border-radius: 980px; cursor: pointer; }
.hello button:hover { background: var(--bg-alt); color: var(--ink); }
.hello.leave { opacity: 0; pointer-events: none; }
@media (max-width: 734px) { .hello svg { width: 94vw; } }

/* first-paint guards set in <head>; failsafes reveal everything if scripts never run */
html.hello-pending body { visibility: hidden; animation: show-failsafe 0s 6s forwards; }
html.hello-pending .hello { visibility: visible; }
html.name-wait .name-script path { stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; animation: name-failsafe 0s 9s forwards; }
@keyframes show-failsafe { to { visibility: visible; } }
@keyframes name-failsafe { to { stroke-dashoffset: 0; opacity: 1; } }
