/* Haichuan Xu — portfolio (V2 dark) */
:root {
  --bg: #0e0e0d;
  --fg: #ece8e1;
  --muted: #8f8b84;
  --soft: #b9b5ad;
  --line: #2b2a28;
  --line-strong: #4a4845;
  --surface: #1b1a19;
  --side: 32px;
  --sans: 'Jost', 'Futura', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  --serif: 'Cormorant Garamond', 'Noto Serif SC', 'Songti SC', Georgia, serif;
  --cn: 'Noto Serif SC', 'Songti SC', 'STSong', serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-weight: 400;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
img, video { display: block; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.label { font-size: 11px; letter-spacing: 0.22em; color: var(--muted); text-transform: uppercase; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- header ---------- */
.hdr {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 28px var(--side);
}
.hdr.on-media { color: #fff; text-shadow: 0 0 14px rgba(0, 0, 0, 0.28); }
.sig { display: flex; align-items: flex-start; gap: 16px; text-decoration: none; }
.sig-cn { writing-mode: vertical-rl; font-family: var(--cn); font-weight: 500; font-size: 30px; line-height: 1; letter-spacing: 0.32em; }
.sig-en { display: flex; flex-direction: column; gap: 9px; padding-top: 2px; }
.sig-name { font-size: 26px; line-height: 1; letter-spacing: 0.38em; }
.sig-tag { font-size: 11px; line-height: 1; letter-spacing: 0.26em; opacity: 0.6; }
.nav { display: flex; align-items: center; gap: 28px; font-size: 13px; letter-spacing: 0.14em; padding-top: 6px; }
.nav a, .nav button { background: none; border: 0; padding: 0 0 3px; margin: 0; cursor: pointer; text-decoration: none; letter-spacing: inherit; border-bottom: 1px solid transparent; }
.nav .is-on { border-bottom-color: currentColor; }
.lang { display: inline-flex; align-items: center; gap: 6px; padding-bottom: 3px; }
.lang button { border: 0; padding: 0; opacity: 0.5; }
.lang button.is-on { opacity: 1; border: 0; }
.lang .zh { letter-spacing: 0; }
.ig { display: inline-flex; padding-bottom: 3px; }

.menu {
  position: absolute; top: 72px; right: 24px; z-index: 30; width: 360px; max-width: calc(100% - 24px); max-height: 72vh; overflow-y: auto;
  background: var(--bg); color: var(--fg); text-shadow: none; text-align: left; border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6); padding: 18px 22px;
}
.menu-all { display: block; padding: 6px 0 12px; border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: 0.16em; font-weight: 500; text-decoration: none; }
.menu-sec { padding-top: 14px; }
.menu-sec .label { font-size: 10px; padding-bottom: 4px; }
.menu a.menu-item { display: block; padding: 4px 0; font-family: var(--serif); font-size: 17px; line-height: 1.35; text-decoration: none; }
.menu a.menu-item:hover { color: var(--soft); }

/* ---------- home (desktop slideshow) ---------- */
.hero { position: relative; width: 100%; height: 100vh; height: 100svh; min-height: 560px; overflow: hidden; background: #000; }
.track { position: absolute; inset: 0; display: flex; transition: transform 1.15s cubic-bezier(0.77, 0, 0.18, 1); will-change: transform; }
.slide { position: relative; flex: 0 0 100%; height: 100%; overflow: hidden; }
.slide video, .slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transform: scale(1.08); transition: transform 1.6s ease; }
.slide.is-active video, .slide.is-active img { transform: scale(1); }
.cap { position: absolute; left: var(--side); bottom: 30px; max-width: calc(100% - 460px); color: #fff; text-shadow: 0 0 18px rgba(0, 0, 0, 0.45); display: flex; flex-direction: column; gap: 8px; opacity: 0; transition: opacity 0.8s ease 0.5s; pointer-events: none; }
.slide.is-active .cap { opacity: 1; }
.cap-cat { font-size: 11px; letter-spacing: 0.22em; opacity: 0.8; }
.cap-title { font-family: var(--serif); font-size: 40px; line-height: 1.1; font-weight: 300; }
.hero-hit { position: absolute; inset: 0; z-index: 2; }
/* light film grain + soft vignette over the desktop slideshow */
.hero-grain { position: absolute; inset: -50%; z-index: 1; pointer-events: none; background-repeat: repeat; mix-blend-mode: overlay; opacity: 0.10; animation: grain 0.5s steps(5) infinite; }
.hero-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.35) 100%); }
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-6%, 4%); } 40% { transform: translate(3%, -7%); } 60% { transform: translate(-4%, -2%); } 80% { transform: translate(7%, 5%); } 100% { transform: translate(0, 0); } }
.arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 72px; height: 112px; background: none; border: 0; padding: 0; cursor: pointer; color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0.85; transition: opacity 0.3s; }
.arrow:hover { opacity: 1; }
.arrow svg { filter: drop-shadow(0 0 8px rgba(0, 0, 0, 0.35)); }
.arrow.prev { left: 14px; }
.arrow.next { right: 14px; }
.hero-index { position: absolute; right: var(--side); bottom: 26px; z-index: 3; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: #fff; text-shadow: 0 0 12px rgba(0, 0, 0, 0.5); }
.hero-index button { display: flex; align-items: baseline; gap: 12px; min-height: 28px; background: none; border: 0; padding: 2px 0; cursor: pointer; text-align: right; opacity: 0.55; transition: opacity 0.4s; }
.hero-index button:hover, .hero-index button.is-on { opacity: 1; }
.hero-index .t { font-size: 12px; letter-spacing: 0.06em; }
.hero-index .bar { display: inline-block; width: 10px; height: 1px; background: #fff; transform: translateY(-4px); transition: width 0.5s ease; }
.hero-index button.is-on .bar { width: 28px; }
.hero-index .n { font-size: 10px; letter-spacing: 0.16em; min-width: 16px; }

/* ---------- home (phone feed) ---------- */
.feed { padding: 196px 0 8px; }
.feed-list { display: flex; flex-direction: column; gap: 44px; }
.feed-item { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 0 20px; text-decoration: none; text-align: center; }
.feed-item video { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--surface); }
.feed-text { display: flex; flex-direction: column; align-items: center; gap: 6px; max-width: 320px; }
.feed-text .label { font-size: 10px; }
.feed-text .serif { font-size: 22px; line-height: 1.25; }
.feed-ctas { padding: 44px 20px 0; display: flex; flex-direction: column; gap: 10px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 18px; font-size: 12px; letter-spacing: 0.18em; text-decoration: none; }
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.ghost { border: 1px solid var(--line-strong); }

/* ---------- shared page frame ---------- */
.page { padding: 190px var(--side) 40px; max-width: 1600px; margin: 0 auto; }
.intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px 48px; padding: 8px 0 56px; }
.intro h1 { margin: 0; font-weight: 400; }
.intro p { margin: 0; max-width: 460px; font-size: 14px; line-height: 1.75; font-weight: 300; color: var(--soft); }
html[lang="zh-Hans"] .intro p { line-height: 1.9; }

/* ---------- works ---------- */
.sec { padding-bottom: 72px; }
.sec-head { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 28px; font-size: 12px; letter-spacing: 0.2em; }
.sec-head h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.2em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 32px; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border: 1px solid var(--fg); border-radius: 999px; background: transparent; cursor: pointer; font-size: 11px; letter-spacing: 0.16em; }
.chip span { opacity: 0.6; }
.chip.is-on { background: var(--fg); color: var(--bg); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 44px 24px; }
.card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; }
.card-media { position: relative; display: block; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background: var(--surface); }
.card-media img, .card-media video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card-media video { opacity: 0; transition: opacity 0.5s ease; }
.card.is-playing .card-media video { opacity: 1; }
.tag { align-self: flex-start; font-size: 10px; letter-spacing: 0.2em; color: var(--muted); border: 1px solid var(--line-strong); padding: 3px 8px 2px; margin-bottom: -2px; }
.card-title { font-family: var(--serif); font-size: 24px; line-height: 1.2; }
.card-meta { font-size: 12px; letter-spacing: 0.04em; color: var(--muted); margin-top: -6px; }

/* ---------- films ---------- */
.film { display: grid; grid-template-columns: 1fr 0.4fr; grid-template-areas: 'video poster' 'text text'; gap: 32px 24px; padding: 56px 0; border-top: 1px solid var(--line); }
.film > video { grid-area: video; display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #000; }
.film-poster { grid-area: poster; position: relative; min-height: 0; overflow: hidden; background: var(--surface); }
.film-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.film-body { grid-area: text; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.film-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; }
.film-head h2 { margin: 0; font-family: var(--serif); font-size: 64px; font-weight: 300; line-height: 1.02; }
.film-meta { font-size: 12px; letter-spacing: 0.14em; color: var(--muted); }
.film-fests { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.film-fests .fest { font-family: var(--serif); font-size: 21px; line-height: 1.35; font-style: italic; font-weight: 300; }

/* ---------- project ---------- */
.project { padding-top: 180px; }
.player-wrap { padding: 0 var(--side); }
.player { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: 80vh; background: #000; overflow: hidden; }
.player > img, .player > video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.play { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: #fff; background: rgba(0, 0, 0, 0.16); border: 0; cursor: pointer; width: 100%; }
.play-ring { width: 92px; height: 92px; border-radius: 50%; border: 1.5px solid #fff; background: rgba(0, 0, 0, 0.14); display: flex; align-items: center; justify-content: center; padding-left: 6px; transition: transform 0.4s ease, background 0.4s ease; }
.play:hover .play-ring { transform: scale(1.06); background: rgba(0, 0, 0, 0.3); }
.play-label { font-size: 12px; letter-spacing: 0.26em; text-shadow: 0 0 12px rgba(0, 0, 0, 0.45); }
.player-note { padding: 12px var(--side) 0; font-size: 12px; letter-spacing: 0.04em; color: var(--muted); min-height: 1em; }
.player-note a { color: var(--fg); text-underline-offset: 3px; }
.proj-info { display: flex; flex-wrap: wrap; gap: 28px 64px; padding: 40px var(--side) 0; max-width: 1600px; }
.proj-left { flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.proj-left h1 { margin: 0; font-family: var(--serif); font-size: 48px; line-height: 1.12; font-weight: 300; }
.proj-meta { font-size: 14px; line-height: 1.7; letter-spacing: 0.03em; color: var(--soft); }
.proj-right { flex: 1 1 420px; min-width: 0; max-width: 620px; display: flex; flex-direction: column; gap: 22px; }
.proj-right p { margin: 0; font-size: 19px; line-height: 1.6; font-weight: 300; }
.proj-links { display: flex; flex-wrap: wrap; gap: 4px 28px; font-size: 12px; letter-spacing: 0.14em; }
.proj-links a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 4px; }
.stills { padding-top: 56px; }
.stills .label { padding: 0 var(--side) 14px; }
.strip { display: flex; gap: 10px; overflow-x: auto; padding: 0 var(--side) 16px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.strip img { flex: 0 0 auto; height: clamp(180px, 24vw, 360px); width: auto; scroll-snap-align: start; background: var(--surface); }
.pn { display: flex; justify-content: space-between; gap: 24px; margin: 64px var(--side) 0; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; letter-spacing: 0.12em; }
.pn a { text-decoration: none; min-height: 44px; padding: 8px 0; }
.pn a.next { text-align: right; }
.pn .serif { font-size: 20px; letter-spacing: 0; }

/* ---------- info ---------- */
.info { padding: 190px var(--side) 40px; max-width: 1280px; }
.info-row { display: flex; flex-wrap: wrap; gap: 40px 72px; align-items: flex-end; }
.info-photo { flex: 1 1 340px; max-width: 460px; min-width: 0; }
.info-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface); }
.info-text { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 28px; padding-bottom: 4px; }
.info-text p { margin: 0; max-width: 620px; font-size: 21px; line-height: 1.6; font-weight: 300; }
.info-text a { align-self: flex-start; font-size: 15px; letter-spacing: 0.04em; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* ---------- footer ---------- */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 56px var(--side) 32px; font-size: 11px; letter-spacing: 0.16em; color: var(--muted); }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--fg); }
.foot-links { display: flex; flex-wrap: wrap; gap: 24px; }

/* ---------- phone ---------- */

/* ---------- phone home: full-screen vertical reels ---------- */
html.is-reels, html.is-reels body { height: 100%; overflow: hidden; overscroll-behavior: none; }
.reels { position: fixed; inset: 0; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; background: #000; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.reels::-webkit-scrollbar { display: none; }
.reel { position: relative; height: 100vh; height: 100svh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #0e0e0d; color: #fff; }
.reel video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.reel-shade { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to top, rgba(0,0,0,.42) 0, rgba(0,0,0,0) 30%), linear-gradient(to bottom, rgba(0,0,0,.38) 0, rgba(0,0,0,0) 18%); }
.reel-text { position: absolute; left: 20px; right: 72px; bottom: calc(64px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; color: #fff; text-decoration: none; text-shadow: 0 0 14px rgba(0,0,0,.4); }
.reel-kicker { display: flex; align-items: baseline; gap: 10px; font-size: 10px; letter-spacing: .22em; }
.reel-kicker b { font-weight: 500; }
.reel-kicker span { opacity: .75; }
.reel-head { font-family: var(--serif); font-size: 30px; line-height: 1.05; font-weight: 300; letter-spacing: .005em; }
.reel-sub { font-size: 12px; font-weight: 300; line-height: 1.4; opacity: .85; }
.reel-meta { font-size: 9px; letter-spacing: .16em; line-height: 1.5; opacity: .6; text-transform: uppercase; }
.reel-cta { position: absolute; left: 20px; bottom: calc(18px + env(safe-area-inset-bottom)); display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: #fff; text-decoration: underline; text-underline-offset: 5px; text-decoration-color: rgba(255,255,255,.6); font-size: 10px; letter-spacing: .22em; opacity: .9; text-shadow: 0 0 14px rgba(0,0,0,.4); }
.reel-hint { position: absolute; right: 20px; bottom: calc(34px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; letter-spacing: .22em; animation: reelBob 1.8s ease-in-out infinite; transition: opacity .4s; }
.reels.moved .reel-hint { opacity: 0; }
@keyframes reelBob { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(-6px); opacity: .55; } }
.reel-rail { position: fixed; right: 12px; top: 50%; transform: translateY(-50%); z-index: 15; display: flex; flex-direction: column; gap: 6px; pointer-events: none; transition: opacity .4s; }
.reel-rail span { display: block; width: 2px; height: 14px; background: #fff; opacity: .4; transition: height .4s ease, opacity .4s ease; }
.reel-rail span.on { height: 28px; opacity: 1; }
.reels-grain { position: fixed; inset: -50%; z-index: 14; pointer-events: none; background-repeat: repeat; mix-blend-mode: overlay; opacity: .1; animation: grain .5s steps(5) infinite; }
.reel-end { background: var(--bg); color: var(--fg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 0 24px; text-align: center; }
.reel-end-cn { flex: none; writing-mode: vertical-rl; font-family: var(--cn); font-size: 72px; font-weight: 500; line-height: 1; letter-spacing: .2em; }
.reel-end-name { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.reel-end-name span:first-child { font-size: 18px; letter-spacing: .38em; padding-left: .38em; }
.reel-end-name span:last-child { font-size: 11px; letter-spacing: .26em; color: var(--muted); }
.reel-end-ctas { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
.reel-end-links { display: flex; flex-direction: column; gap: 8px; font-size: 11px; letter-spacing: .16em; }
.reel-end-links a { color: var(--soft); text-decoration: none; }
.menu-top { display: flex; gap: 22px; padding: 6px 0 14px; border-bottom: 1px solid var(--line); font-size: 12px; letter-spacing: .16em; }
.menu-top a { text-decoration: none; }

@media (max-width: 719px) {
  :root { --side: 20px; }
  .hdr { flex-direction: column; align-items: center; gap: 16px; padding: 20px 20px 16px; }
  .sig { gap: 12px; }
  .sig-cn { font-size: 22px; }
  .sig-name { font-size: 17px; letter-spacing: 0.3em; }
  .sig-tag { font-size: 9px; }
  .nav { gap: 18px; font-size: 12px; padding-top: 0; flex-wrap: wrap; justify-content: center; }
  .hdr { position: relative; }
  .hdr.reels-hdr { position: fixed; top: 0; left: 0; right: 0; z-index: 20; flex-direction: row; justify-content: space-between; align-items: flex-start; padding: calc(16px + env(safe-area-inset-top)) 20px 0; color: #fff; text-shadow: 0 0 14px rgba(0,0,0,.3); }
  .reels-hdr .sig { gap: 10px; }
  .reels-hdr .sig-cn { font-size: 17px; letter-spacing: .3em; }
  .reels-hdr .sig-en { gap: 6px; padding-top: 1px; }
  .reels-hdr .sig-name { font-size: 13px; letter-spacing: .34em; }
  .reels-hdr .sig-tag { font-size: 9px; }
  .reels-nav { gap: 14px; flex-wrap: nowrap; }
  .reels-nav .lang button { padding: 10px 2px; }
  .burger { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: -8px -10px 0 0; background: none; border: 0; color: inherit; cursor: pointer; }
  .reels-hdr .menu { top: calc(100% + 8px); }
  .menu { top: 100%; right: 12px; left: 12px; width: auto; }
  .page { padding: 28px 20px 32px; }
  .intro { padding: 0 0 36px; }
  .sec { padding-bottom: 52px; }
  .grid { gap: 36px 24px; }
  .film { grid-template-columns: 38% 1fr; grid-template-areas: 'video video' 'poster text'; gap: 20px; padding: 36px 0; }
  .film-poster { aspect-ratio: var(--ar); align-self: start; }
  .film-body { gap: 14px; }
  .film-head h2 { font-size: 30px; }
  .film-meta { font-size: 10px; line-height: 1.6; }
  .film-fests { padding-top: 12px; }
  .film-fests .fest { font-size: 16px; }
  .project { padding-top: 12px; }
  .proj-info { padding-top: 28px; }
  .proj-left h1 { font-size: 34px; }
  .proj-right p { font-size: 17px; }
  .pn { margin-top: 48px; }
  .play-ring { width: 72px; height: 72px; }
  .feed { padding-top: 8px; }
  .foot, .foot-links { flex-direction: column; align-items: center; text-align: center; gap: 12px; }
  .info { padding: 28px 20px 32px; }
  .info-row { gap: 32px; }
  .info-text p { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-grain, .reels-grain, .reel-hint { animation: none; }
  .track, .slide video, .slide img, .cap, .card-media video { transition: none; }
}
