/* Layout concept: a dark-teal "control room" hero where the giant name is the instrument,
   then a pale blueprint sheet: sticky bio on the left, a desk of small windows on the right. */
:root {
  /* colour — edit these to re-theme the whole site */
  --abyss: #052628;      /* hero + player background */
  --deep: #0b3a3c;       /* raised dark surfaces */
  --teal: #0e7470;       /* primary blue-green */
  --glow: #41e2c8;       /* bright aqua accent */
  --paper: #e4eeeb;      /* page sheet */
  --sheet: #f2f7f5;      /* window body */
  --ink: #0a2526;        /* text on paper */
  --mute: #557371;       /* secondary text on paper */
  --mist: #9fc4bf;       /* secondary text on dark */
  --rule: rgba(10, 37, 38, .16);
  --rule-dark: rgba(228, 238, 235, .14);

  /* type */
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Instrument Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Martian Mono", "SFMono-Regular", Menlo, Consolas, "Noto Sans SC", monospace;

  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
html[lang^="zh"] body { font-family: "Noto Sans SC", var(--body); }
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }
[hidden] { display: none !important; }

.label {
  font-family: var(--mono);
  font-size: 11px;
  font-variation-settings: "wdth" 87;
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.5;
}
html[lang^="zh"] .label { letter-spacing: .04em; }
/* Section titles (Selected work, About me, Selected activity, Contact):
   same mono voice as the small labels, but large enough to find at a glance. */
.label.sec-title {
  font-size: clamp(16px, 1.45vw, 22px);
  font-variation-settings: "wdth" 100, "wght" 450;
  letter-spacing: .16em;
  line-height: 1.3;
}
html[lang^="zh"] .label.sec-title {
  font-family: "Noto Sans SC", var(--mono);
  font-size: clamp(18px, 1.6vw, 24px);
  font-weight: 500;
  letter-spacing: .2em;
}
.label.sec-title > span::before {
  content: "";
  display: inline-block;
  width: .5em; height: .5em;
  margin-right: .7em;
  vertical-align: .08em;
  border-radius: 50%;
  background: var(--glow);
}
.wrap {
  max-width: 1440px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
}

/* ───────── HERO ───────── */
.hero {
  position: relative;
  background:
    linear-gradient(var(--rule-dark) 1px, transparent 1px) 0 0 / 100% 64px,
    linear-gradient(90deg, var(--rule-dark) 1px, transparent 1px) 0 0 / 64px 100%,
    var(--abyss);
  background-blend-mode: normal;
  color: var(--paper);
  overflow: hidden;
  min-height: min(100svh, 980px);
  display: flex;
}
.hero::after { /* vignette softens the grid toward the edges */
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 90% at 50% 40%, transparent 40%, var(--abyss) 100%);
  pointer-events: none;
}
.hero-scope {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
  pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 2;
  width: 100%;
  display: flex; flex-direction: column;
  gap: 24px;
  padding: 20px var(--gutter-r) 22px var(--gutter);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
}
.mark {
  text-decoration: none;
  font-family: var(--display);
  font-variation-settings: "wdth" 125, "wght" 800;
  font-size: 18px; letter-spacing: 0;
}
.nav { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.nav a { text-decoration: none; color: var(--mist); transition: color .2s; }
.nav a:hover { color: var(--glow); }
.tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.clock { color: var(--mist); font-variant-numeric: tabular-nums; }
.sound-toggle {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(65, 226, 200, .08); color: var(--paper);
  border: 1.5px solid rgba(65, 226, 200, .65); border-radius: 999px;
  padding: 9px 18px 9px 13px; text-transform: uppercase; letter-spacing: .06em; font-size: 13px;
  font-family: var(--mono); cursor: pointer;
  transition: border-color .2s, color .2s, background .2s, box-shadow .2s;
}
.sound-toggle:hover { border-color: var(--glow); background: rgba(65, 226, 200, .16); }
.sound-toggle:focus-visible { outline: 2px solid var(--glow); outline-offset: 3px; }
/* off: a slow ring breathes outward so the button is easy to find */
.sound-toggle::after {
  content: ""; position: absolute; inset: -1.5px; border-radius: inherit;
  border: 1.5px solid var(--glow); opacity: 0; pointer-events: none;
  animation: soundPing 2.6s ease-out infinite;
}
@keyframes soundPing { 0% { opacity: .7; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(1.18, 1.45); } }
#soundLabel { min-width: 9ch; }
.sound-ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sound-ico .spk { fill: currentColor; stroke-width: 1.2; }
.sound-ico .w1, .sound-ico .w2 { opacity: 0; }
.sound-toggle[aria-pressed="true"] { background: var(--glow); color: var(--abyss); border-color: var(--glow); box-shadow: 0 0 18px rgba(65, 226, 200, .45); }
.sound-toggle[aria-pressed="true"]::after { animation: none; }
.sound-toggle[aria-pressed="true"] .x { opacity: 0; }
.sound-toggle[aria-pressed="true"] .w1 { opacity: 1; animation: soundWave 1.4s ease-in-out infinite; }
.sound-toggle[aria-pressed="true"] .w2 { opacity: 1; animation: soundWave 1.4s ease-in-out .25s infinite; }
@keyframes soundWave { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .sound-toggle::after, .sound-ico .w1, .sound-ico .w2 { animation: none !important; } }
.lang { display: inline-flex; border: 1px solid var(--rule-dark); border-radius: 999px; padding: 2px; }
.lang button {
  background: none; border: 0; border-radius: 999px;
  padding: 4px 11px; font-family: var(--mono); font-size: 11px; color: var(--mist);
}
.lang button[aria-pressed="true"] { background: var(--glow); color: var(--abyss); }

.hero-mid {
  flex: 1;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 32px; flex-wrap: wrap;
  padding-top: clamp(24px, 8vh, 96px);
}
.hero-intro { display: grid; gap: 14px; }
.cn-name { margin: 0 0 4px; color: var(--glow); line-height: 0; }
.cn-sig {
  display: block;
  height: clamp(84px, 11vw, 170px);
  width: auto;
  max-width: 100%;
  margin-left: -4px;   /* ink starts on the same left edge as the tagline below */
  filter: drop-shadow(0 0 14px rgba(65, 226, 200, .25));
}
/* Tagline: words start dim and light up in reading order, driven by scrolling the hero away;
   on desktop, hovering a word lights it and everything before it. Only colour changes. */
.tagline {
  --tg-dim: #3d5857;      /* unread: dim but legible over the hero grid */
  --tg-lit: var(--paper); /* read */
  margin: 0; max-width: 30ch;
  font-size: clamp(19px, 2.1vw, 28px); line-height: 1.3;
  text-wrap: balance; color: var(--tg-dim);
}
.tagline .w { color: var(--tg-dim); transition: color .32s ease; }
@supports (color: color-mix(in oklab, red 50%, blue)) {
  .tagline .w { color: color-mix(in oklab, var(--tg-lit) calc(var(--a, 0) * 100%), var(--tg-dim)); }
}
@supports not (color: color-mix(in oklab, red 50%, blue)) {
  .tagline .w.on { color: var(--tg-lit); }
}
@media (hover: hover) and (pointer: fine) { .tagline { cursor: default; } }
.sig-row { display: flex; align-items: center; gap: 14px clamp(10px, 1.4vw, 24px); flex-wrap: wrap; }
.roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 15px; text-align: left; }
.sig-row .roles { margin-left: -15px; }
.roles li {
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--mist);
}
.roles li::before { content: "◦ "; color: var(--glow); }

.name {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  line-height: .8;
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: var(--paper);
  user-select: none;
  cursor: crosshair;
  touch-action: pan-y;
}
.name-line { display: block; white-space: nowrap; font-size: 18vw; }
.name-line + .name-line { margin-top: .04em; }
.name .ch {
  display: inline-block;
  font-variation-settings: "wdth" var(--w, 118), "wght" var(--g, 820);
}
.name .ch.sp { width: .22em; }
.hero-foot {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  color: var(--mist);
  border-top: 1px solid var(--rule-dark);
  padding-top: 12px;
}
.hero-foot a { text-decoration: none; }
.hero-foot a:hover { color: var(--glow); }

/* ───────── PETS: the animals walking along the hero-foot line ───────── */
.pets {
  --lane: clamp(60px, 6.4vw, 104px);
  position: relative;
  width: clamp(340px, 46%, 700px);
  height: calc(var(--lane) * 1.55 + 18px);
  margin-bottom: -24px;            /* the meadow sits right on the hero-foot rule */
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 82%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 5%, #000 82%, transparent);
}
.scene-layer {
  position: absolute; left: 0; right: 0; bottom: 0;
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-position: 0 100%;
  pointer-events: none;
}
.scene-layer.far  { height: 46%; background-image: url(scene/far.svg); opacity: .9; }
.scene-layer.mid  { height: 72%; background-image: url(scene/mid.svg); }
.scene-layer.near { height: calc(var(--lane) * .62); background-image: url(scene/near.svg); }
.pets-row {
  position: absolute; left: clamp(28px, 9%, 72px);
  bottom: calc(var(--lane) * .62 * .1);  /* feet on the grass line */
  display: flex; align-items: flex-end; gap: calc(var(--lane) * .1);
}
.pet { position: relative; display: block; line-height: 0; outline: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
/* Each pet is the user's own illustration: a body layer plus four legs, each leg split at the knee.
   Gait (per leg): stance 0-60% — paw on the ground, sweeping back at the same speed the meadow scrolls;
   swing 60-100% — paw lifts (lower leg folds back) and reaches forward. Diagonal pairs are half a cycle apart.
   --t cycle, --a hip swing, --f knee fold, --ox/--oy hip, --kx/--ky knee: generated by tools/pets_build.py */
.pet-fig { position: relative; display: block; transform-origin: 50% 100%;
  transition: transform .24s cubic-bezier(.25, 1.4, .45, 1) .13s, opacity 0s .13s; }
.pet-walk { position: relative; display: block; animation: pet-bob calc(var(--t) / 2) ease-in-out calc(var(--t) * -.2) infinite; }
.pet-walk img { display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
.pet-walk .pet-body { position: relative; height: calc(var(--lane) * var(--s)); width: auto; max-width: none; }
.pet-walk .leg, .pet-walk .shin, .pet-walk .leg img, .pet-walk .shin img { position: absolute; inset: 0; width: 100%; height: 100%; }
.pet-walk .leg  { transform-origin: var(--ox) var(--oy); animation: pet-hip var(--t) linear infinite; }
.pet-walk .shin { transform-origin: var(--kx) var(--ky); animation: pet-knee var(--t) linear infinite; }
.pet-walk .leg.b, .pet-walk .leg.b .shin { animation-delay: calc(var(--t) * -.5); }
.pet-fig { filter: drop-shadow(0 2px 2px rgba(0,0,0,.28)); }
@keyframes pet-hip {
  0%   { transform: rotate(calc(var(--a) * -1)); animation-timing-function: linear; }
  60%  { transform: rotate(var(--a)); animation-timing-function: cubic-bezier(.45, 0, .4, 1); }
  100% { transform: rotate(calc(var(--a) * -1)); }
}
@keyframes pet-knee {
  0%, 60% { transform: rotate(0deg); animation-timing-function: cubic-bezier(.3, 0, .4, 1); }
  79%     { transform: rotate(var(--f)); animation-timing-function: cubic-bezier(.5, 0, .7, 1); }
  97%, 100% { transform: rotate(0deg); }
}
@keyframes pet-bob { 0%, 100% { transform: translateY(-1.3%); } 50% { transform: translateY(.3%); } }
/* click / tap: the pet turns to face you (front-view illustration), the parade stops while it looks */
.pet-front { position: absolute; left: 50%; bottom: 0; display: block; width: max-content; pointer-events: none;
  transform: translateX(-50%) scaleX(.08); transform-origin: 50% 100%; opacity: 0;
  transition: transform .13s ease-in, opacity 0s .13s; }
.pet-front .pet-step { position: relative; display: block; transform-origin: 50% 100%; }
.pet-front img { display: block; height: calc(var(--lane) * var(--s) * var(--fh)); width: auto; max-width: none; }
.pet-front .ft { position: relative; filter: drop-shadow(0 2px 2px rgba(0,0,0,.28)); }
.pet-front .fl, .pet-front .fr { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: 50% 80%; }
.pet.facing .pet-fig { transform: scaleX(.08); opacity: 0; transition: transform .13s ease-in, opacity 0s .13s; }
.pet.facing .pet-front { transform: translateX(-50%) scaleX(1); opacity: 1;
  transition: transform .26s cubic-bezier(.25, 1.5, .45, 1) .13s, opacity 0s .13s; }
/* facing you, it marks time: paws lift in turn (left / right halves of the legs), body sways and bobs */
.pet.facing .pet-step { animation: pet-march .64s ease-in-out .3s infinite; }
.pet.facing .fl { animation: pet-lift .64s ease-in-out .3s infinite; }
.pet.facing .fr { animation: pet-lift .64s ease-in-out .62s infinite; }
@keyframes pet-lift { 0%, 50%, 100% { transform: scaleY(1); } 25% { transform: scaleY(.66); } }
@keyframes pet-march {
  0%, 50%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-1.4%) rotate(1.2deg); }
  75% { transform: translateY(-1.4%) rotate(-1.2deg); }
}
.pets.paused .pet-walk, .pets.paused .leg, .pets.paused .shin { animation-play-state: paused; }
.pet-tag {
  position: absolute; left: 50%; bottom: calc(100% + 4px);
  transform: translate(-50%, 4px); opacity: 0;
  transition: opacity .2s, transform .2s;
  font-family: var(--mono); font-size: 11px; line-height: 1; letter-spacing: .04em; white-space: nowrap;
  color: var(--glow); pointer-events: none;
}
.pet:hover .pet-tag, .pet:focus-visible .pet-tag, .pet.facing .pet-tag { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 860px) {
  .pets { width: 100%; --lane: 58px; }
}

/* ───────── WORK ───────── */
.work {
  background: var(--paper);
  padding-block: clamp(48px, 8vw, 112px);
}
.work-grid {
  display: grid;
  gap: clamp(24px, 3vw, 44px);
}
.work-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 20px 48px; flex-wrap: wrap;
}
.work-head-text { display: grid; gap: 14px; min-width: 0; flex: 1 1 420px; }
.work-head-text .label { color: var(--mute); margin: 0; }
.work-head-text .sec-title, .about-label.sec-title { color: var(--teal); }
.work-head-text .sec-title > span::before, .about-label.sec-title > span::before { background: var(--teal); }
.intro {
  margin: 0;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.4;
  text-wrap: pretty;
  max-width: 46ch;
}
.work-head-tools { display: grid; gap: 10px; justify-items: end; flex: 0 1 auto; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.filter {
  border: 1px solid var(--rule); background: transparent;
  border-radius: 999px; padding: 6px 12px;
  font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--mute);
  transition: background .2s, color .2s, border-color .2s;
}
.filter sup { font-size: 9px; margin-left: 2px; }
.filter:hover { border-color: var(--teal); color: var(--teal); }
.filter[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: var(--sheet); }
.side-note { margin: 0; color: var(--mute); }

.windows {
  --gap: clamp(14px, 1.4vw, 22px);
  display: grid;
  gap: var(--gap);
  min-width: 0;
}
/* One row = up to 2 large windows (3 units) + 3 small windows (2 units); 12 units fill the width.
   Large windows are 2:1 and small ones 4:3, so their pictures line up at the same height. */
.win-row { display: flex; gap: var(--gap); align-items: stretch; min-width: 0; }
.win-row > .win { flex: 0 0 calc((100% - 4 * var(--gap)) * var(--u) / var(--U)); }
.win-row > .win .win-view { aspect-ratio: 4 / 3; }
.win-row > .win.featured .win-view { aspect-ratio: 2 / 1; }
.win {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 0 rgba(10,37,38,.04);
  transition: transform .35s cubic-bezier(.2,.7,.2,1), box-shadow .35s, border-color .35s;
  animation: rise .7s cubic-bezier(.2,.7,.2,1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  min-width: 0;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.win:hover { transform: translateY(-4px); box-shadow: 0 18px 40px -22px rgba(5,38,40,.55); border-color: rgba(14,116,112,.45); }
@media (max-width: 1099px) {
  /* narrower screens: drop the rows and let windows flow in a simple grid */
  .windows { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
  .win-row { display: contents; }
  .win-row > .win .win-view, .win-row > .win.featured .win-view { aspect-ratio: 4 / 3; }
}
@media (min-width: 700px) and (max-width: 1099px) {
  .win.featured { grid-column: span 2; }
  .win-row > .win.featured .win-view { aspect-ratio: 2 / 1; }
}

.win-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--mute);
  min-width: 0;
}
.win-dots { display: inline-flex; gap: 4px; flex: none; }
.win-dots i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid currentColor; opacity: .55; }
.win.playing .win-dots i:first-child { background: var(--glow); border-color: var(--glow); opacity: 1; }
.win-fig { flex: none; color: var(--teal); }
.win-file { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: none; min-width: 0; }

.win-view {
  position: relative; display: block; width: 100%;
  padding: 0; border: 0; background: var(--abyss);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.win-cover { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2,.7,.2,1), filter .4s; }
canvas.win-cover { display: block; }
.win:hover .win-cover { transform: scale(1.04); }
.win-play {
  position: absolute; left: 12px; bottom: 12px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 9px;
  background: color-mix(in srgb, var(--abyss) 78%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(65,226,200,.35);
  border-radius: 999px;
  color: var(--paper);
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  transition: background .25s, color .25s;
}
.win-play svg { width: 13px; height: 13px; fill: currentColor; }
.win:hover .win-play { background: var(--glow); color: var(--abyss); }
.eq { display: none; gap: 2px; align-items: flex-end; height: 12px; }
.eq i { width: 2px; background: currentColor; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; } .eq i:nth-child(3) { animation-delay: -.6s; } .eq i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { 0%,100% { height: 3px; } 50% { height: 12px; } }
.win.playing .eq { display: inline-flex; }
.win.playing .win-play svg { display: none; }
.win.playing.paused .eq i { animation-play-state: paused; }

.win-cap { padding: 12px 12px 14px; display: grid; gap: 4px; align-content: start; }
.win-cap h3 {
  margin: 0;
  font-family: var(--display);
  font-variation-settings: "wdth" 100, "wght" 650;
  font-size: 18px; line-height: 1.2; letter-spacing: -.005em;
  text-wrap: balance;
}
html[lang^="zh"] .win-cap h3 { font-family: "Noto Sans SC", var(--display); font-weight: 700; }
.win-role { margin: 0; color: var(--teal); }
.win-desc {
  margin: 4px 0 0; color: var(--mute); font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.win.featured .win-desc { -webkit-line-clamp: 3; }
.win-link { margin-top: 6px; font-family: var(--mono); font-size: 11px; color: var(--teal); text-decoration: none; text-transform: uppercase; letter-spacing: .05em; }
.win-link:hover { text-decoration: underline; }
.empty { grid-column: 1 / -1; color: var(--mute); padding: 40px 0; }

/* ───────── ABOUT ───────── */
.about {
  border-top: 1px solid var(--rule);
  padding-block: clamp(56px, 9vw, 128px);
}
.about-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 2fr;
  gap: clamp(28px, 4vw, 72px);
  align-items: start;
}
.about-side { display: grid; gap: 18px; min-width: 0; }
.about-label { color: var(--mute); margin: 0; }
.portrait {
  margin: 0;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
  max-width: 420px;
}
.portrait-frame {
  position: relative;
  aspect-ratio: 4 / 5;
  max-width: 100%;
  background: var(--abyss);
  overflow: hidden;
}
.portrait-frame img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .8s cubic-bezier(.2,.7,.2,1);
}
.portrait:hover .portrait-frame img { transform: scale(1.02); }
.portrait-empty {
  position: absolute; inset: 14px;
  border: 1px dashed rgba(65, 226, 200, .45);
  display: grid; place-items: center; text-align: center;
  color: var(--mist);
  padding: 16px;
  background:
    linear-gradient(var(--rule-dark) 1px, transparent 1px) 0 0 / 100% 24px,
    linear-gradient(90deg, var(--rule-dark) 1px, transparent 1px) 0 0 / 24px 100%;
}
.portrait-empty .label { color: var(--glow); }
.portrait figcaption { padding: 10px 12px; color: var(--mute); border-top: 1px solid var(--rule); }
.about-text { min-width: 0; }
.about-text p { margin: 0 0 1em; max-width: 60ch; font-size: 17px; }
.about-text p:first-child {
  font-size: clamp(21px, 2vw, 28px); line-height: 1.32; text-wrap: balance;
}
/* ───────── ACTIVITY (own section; honest.fi-style backgrounds) ───────── */
.activity {
  --ease: cubic-bezier(.22,1,.36,1);
  position: relative; isolation: isolate;
  background: var(--abyss); color: var(--paper);
}
.act-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.activity.is-wheel .act-bg { position: sticky; top: 0; height: 100svh; margin-bottom: -100svh; }
.act-bg::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--abyss), transparent 18%, transparent 82%, var(--abyss)),
    radial-gradient(ellipse at center, rgba(5,38,40,0) 40%, rgba(5,38,40,.45) 78%, rgba(5,38,40,.85) 100%);
}
/* photo wall (default) */
.act-wall {
  position: absolute; inset: -4% -2%; display: flex; gap: clamp(8px, 1vw, 16px);
  opacity: .17; filter: saturate(.85); transition: opacity 1.2s var(--ease);
}
.act-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: clamp(8px, 1vw, 16px);
  animation: wall-up var(--dur, 80s) linear infinite; }
.act-col:nth-child(even) { animation-direction: reverse; margin-top: -12%; }
.act-col img { display: block; width: 100%; aspect-ratio: var(--ar, 4 / 5); object-fit: cover; border-radius: 3px; }
@keyframes wall-up { to { transform: translateY(-50%); } }
/* single photo (selected line) */
.act-photos img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; scale: 1.06;
  transition: opacity 1.6s var(--ease), scale 6s var(--ease);
}
.act-photos img.on { opacity: .34; scale: 1; }
.activity.act-on .act-wall { opacity: 0; }

.act-stage { min-height: 100svh; display: grid; align-items: center; padding-block: clamp(80px, 10vw, 140px); }
.act-inner { width: 100%; }
.act-label { color: var(--mist); margin: 0 0 clamp(20px, 3vw, 36px); text-align: center; }
.act-track { width: min(880px, 100%); margin-inline: auto; }

.cv-list { list-style: none; margin: 0; padding: 0; position: relative; }
.cv-list::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--rule-dark);
  transform-origin: left; transform: scaleX(0); transition: transform 1.1s cubic-bezier(.65,0,.2,1);
}
.cv-list.in::before { transform: scaleX(1); }
.cv-list li {
  --d: 0ms;
  position: relative;
  display: grid; grid-template-columns: 5.6em 1fr; gap: clamp(12px, 2vw, 28px); align-items: baseline;
  padding: clamp(12px, 1.4vw, 18px) 0; cursor: default; outline: none;
}
.cv-list li::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule-dark);
  transform-origin: left; transform: scaleX(0);
  transition: transform 1s cubic-bezier(.65,0,.2,1) var(--d);
}
.cv-list li.in::after { transform: scaleX(1); }
.cv-list .m { display: block; overflow: hidden; padding-bottom: 3px; transition: opacity .45s; }
.cv-list .m > span {
  display: block; transform: translateY(110%); opacity: 0;
  transition: transform .9s cubic-bezier(.2,.8,.2,1) var(--d), opacity .6s var(--d);
}
.cv-list .txt > span {
  font-size: clamp(18px, 1.75vw, 25px); line-height: 1.3; letter-spacing: -.01em; text-wrap: pretty;
  text-shadow: 0 1px 18px rgba(5, 38, 40, .7);
  transition: transform .9s cubic-bezier(.2,.8,.2,1) calc(var(--d) + 90ms), opacity .6s calc(var(--d) + 90ms), translate .45s var(--ease);
}
.cv-list li.in .m > span { transform: none; opacity: 1; }
.cv-list .yr { font-family: var(--mono); font-size: 12px; color: var(--glow); font-variant-numeric: tabular-nums; }
.cv-list li.has-img { cursor: pointer; }
.cv-cam {
  display: inline-block; width: 7px; height: 7px; margin-left: 10px; vertical-align: .2em;
  border-radius: 50%; border: 1.5px solid var(--glow); transition: background-color .3s;
}
.cv-list li.cur .cv-cam { background: var(--glow); }
/* hover mode (mouse) */
.activity:not(.is-wheel) .cv-list li > .m { opacity: .85; }
.activity.act-on:not(.is-wheel) .cv-list li > .m { opacity: .26; }
.activity:not(.is-wheel) .cv-list li.cur > .m { opacity: 1; }
.activity:not(.is-wheel) .cv-list li.cur .txt > span { translate: 10px 0; }
.activity:not(.is-wheel) .cv-list li:focus-visible .txt > span { text-decoration: underline; text-underline-offset: 4px; }

/* wheel mode (phones / tablets): page scroll rolls the list through a picker */
.activity.is-wheel { height: calc(100svh + (var(--n, 1) - 1) * var(--step, 26svh)); }
.activity.is-wheel .act-stage {
  position: sticky; top: 0; height: 100svh; min-height: 0; padding: 0; display: block; overflow: hidden;
}
.activity.is-wheel .act-inner { height: 100%; position: relative; }
.activity.is-wheel .act-label { position: absolute; left: 0; right: 0; top: clamp(56px, 9svh, 96px); margin: 0; z-index: 2; }
.activity.is-wheel .act-track {
  height: 100%; perspective: 900px;
  -webkit-mask-image: linear-gradient(transparent 8%, #000 32%, #000 68%, transparent 92%);
          mask-image: linear-gradient(transparent 8%, #000 32%, #000 68%, transparent 92%);
}
.activity.is-wheel .cv-list { will-change: transform; transform-style: preserve-3d; }
.activity.is-wheel .cv-list::before, .activity.is-wheel .cv-list li::after { display: none; }
.activity.is-wheel .cv-list li { grid-template-columns: 1fr; gap: 4px; text-align: center; padding: 14px 4px; will-change: transform, opacity; }
.activity.is-wheel .cv-list .txt > span { font-size: clamp(19px, 3.4vw, 28px); }
.activity.is-wheel .cv-list li.cur .yr { color: var(--glow); }
@media (prefers-reduced-motion: reduce) {
  .tagline .w { transition: none; }
  .act-col { animation: none; }
}

/* ───────── CONTACT ───────── */
.contact {
  background: var(--abyss); color: var(--paper);
  padding-block: clamp(56px, 8vw, 112px) 24px;
  overflow: hidden;
}
.contact .label { color: var(--mist); }
.contact .sec-title, .act-label.sec-title { color: var(--paper); }
.contact-lead { margin: 18px 0 8px; color: var(--mist); max-width: 40ch; }
.email-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.email {
  font-family: var(--display);
  font-variation-settings: "wdth" 90, "wght" 500;
  font-size: clamp(28px, 6vw, 84px);
  line-height: 1.05;
  text-decoration: none;
  overflow-wrap: anywhere;
  transition: color .2s;
}
.email:hover { color: var(--glow); }
.copy-btn {
  border: 1px solid var(--rule-dark); background: none; border-radius: 999px;
  padding: 8px 14px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
}
.copy-btn:hover { border-color: var(--glow); color: var(--glow); }
.links { list-style: none; margin: 28px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 24px; }
.links a { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; text-decoration: none; color: var(--mist); }
.links a:hover { color: var(--glow); }
.footer-name {
  font-family: var(--display);
  font-variation-settings: "wdth" 125, "wght" 800;
  text-transform: uppercase;
  font-size: 27vw; line-height: .78; width: max-content;
  margin: clamp(40px, 6vw, 80px) 0 18px;
  color: transparent;
  -webkit-text-stroke: 1px rgba(65, 226, 200, .45);
  white-space: nowrap;
  user-select: none;
}
.foot-meta { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-top: 1px solid var(--rule-dark); padding-top: 14px; }
.foot-meta a { text-decoration: none; }
.foot-meta a:hover { color: var(--glow); }

/* ───────── PLAYER ───────── */
.player {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px var(--gutter-r) calc(10px + env(safe-area-inset-bottom, 0px)) var(--gutter);
  pointer-events: none;
}
.player-inner {
  pointer-events: auto;
  max-width: 1100px; margin: 0 auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1.2fr) minmax(80px, 1fr) minmax(0, 1.4fr) auto;
  align-items: center; gap: 14px;
  background: color-mix(in srgb, var(--abyss) 94%, transparent);
  backdrop-filter: blur(10px);
  color: var(--paper);
  border: 1px solid rgba(65,226,200,.25);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.6);
  animation: slideup .45s cubic-bezier(.2,.7,.2,1);
}
@keyframes slideup { from { transform: translateY(120%); } }
.p-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--glow); color: var(--abyss);
  display: grid; place-items: center;
}
.p-btn svg { width: 16px; height: 16px; fill: currentColor; }
.p-btn .i-play { display: none; }
.player.paused .p-btn .i-play { display: block; }
.player.paused .p-btn .i-pause { display: none; }
.p-info { display: grid; min-width: 0; }
.p-fig { color: var(--glow); }
.p-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.p-scope { width: 100%; height: 36px; display: block; }
.p-track { display: grid; gap: 2px; min-width: 0; }
.p-time { color: var(--mist); font-variant-numeric: tabular-nums; }
.p-close { background: none; border: 0; font-size: 24px; color: var(--mist); width: 32px; height: 32px; line-height: 1; }
.p-close:hover { color: var(--glow); }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; margin: 0; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: linear-gradient(90deg, var(--glow) var(--pct, 0%), var(--rule-dark) var(--pct, 0%)); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--rule-dark); }
input[type="range"]::-moz-range-progress { height: 2px; background: var(--glow); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--glow); margin-top: -4px; border: 0; }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border-radius: 50%; background: var(--glow); border: 0; }

/* ───────── MODAL ───────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) var(--gutter-r) max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter);
  background: rgba(3, 22, 24, .78);
  backdrop-filter: blur(6px);
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.modal-win {
  width: min(1000px, 100%);
  max-height: 100%; overflow: auto;
  background: var(--sheet); color: var(--ink);
  border-radius: 8px; border: 1px solid var(--rule);
  animation: rise .4s cubic-bezier(.2,.7,.2,1);
}
.modal-close { margin-left: auto; background: none; border: 0; font-size: 22px; line-height: 1; color: var(--mute); padding: 0 4px; }
.modal-close:hover { color: var(--teal); }
.modal-body { background: #000; aspect-ratio: 16 / 9; }
.modal-body video, .modal-body iframe { width: 100%; height: 100%; display: block; border: 0; }
.modal-cap { padding: 16px 18px 20px; display: grid; gap: 4px; }
.modal-cap h3 { margin: 0; font-family: var(--display); font-variation-settings: "wdth" 100, "wght" 650; font-size: 22px; }
html[lang^="zh"] .modal-cap h3 { font-family: "Noto Sans SC", var(--display); font-weight: 700; }
.modal-cap .label { color: var(--teal); margin: 0; }
.modal-cap #modalDesc { margin: 6px 0 0; color: var(--mute); max-width: 70ch; white-space: pre-line; }
.modal-cap .win-link { justify-self: start; margin-top: 8px; }
.modal-body.is-audio { aspect-ratio: auto; background: var(--sheet); }
.modal-error { margin: 0; height: 100%; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--mist); background: var(--abyss); }

/* ───────── RESPONSIVE ───────── */
@media (max-width: 1100px) {
  .about-grid { grid-template-columns: 1fr 1.4fr; }
}
@media (max-width: 860px) {
  .work-grid, .about-grid { grid-template-columns: 1fr; }
  .work-head-tools { justify-items: start; }
  .filters { justify-content: flex-start; }
  .sig-row .cn-name { flex-basis: 100%; }
  .sig-row .roles { margin-left: 0; }
  .cn-sig { margin-left: 0; }
  .nav { display: none; }
  .player-inner { grid-template-columns: auto minmax(0, 1fr) auto; }
  .p-scope { display: none; }
  .p-track { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 520px) {
  .clock { display: none; }
  .hero-mid { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
