:root {
  color-scheme: dark;
  --night: #071a35;
  --night-deep: #031126;
  --white: #f7f8f5;
  --muted: rgba(247, 248, 245, 0.66);
  --quiet: rgba(247, 248, 245, 0.38);
  --line: rgba(247, 248, 245, 0.18);
  --accent: #b9b2ff;
  --gutter: clamp(24px, 3.2vw, 62px);
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-family: var(--sans);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

html { background: var(--night-deep); }

body {
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
  background: var(--night-deep);
  color: var(--white);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, a { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; border: 0; border-radius: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.ambient-background, .grain-overlay, .portfolio-shell { position: fixed; inset: 0; }
.ambient-background { z-index: 0; width: 100%; height: 100%; background: var(--night); }
.grain-overlay {
  z-index: 1;
  pointer-events: none;
  opacity: 0.19;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.portfolio-shell { z-index: 2; display: block; opacity: 0; transform: translateY(16px); transition: opacity 900ms ease, transform 1100ms cubic-bezier(.22,.61,.36,1); }
body.is-entered .portfolio-shell { opacity: 1; transform: none; }

.site-sidebar { position: fixed; z-index: 4; top: 18px; left: 50%; transform: translateX(-50%); }
.home-photo-slot.has-photo { border-style: solid; border-color: rgba(247, 248, 245, .48); background-position: center; background-size: cover; }
.home-photo-slot.has-photo span { opacity: 0; }

.identity { display: flex; width: max-content; font-weight: 700; line-height: 1; transition: opacity 180ms ease; }
.identity:hover { opacity: .68; }
.identity-name { white-space: nowrap; font-size: clamp(25px, 2.45vw, 48px); letter-spacing: -0.055em; }

.primary-nav { display: flex; flex-direction: row; align-items: center; gap: clamp(18px, 2.4vw, 32px); }
.nav-link {
  position: relative;
  padding: 7px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(247, 248, 245, .035);
  color: var(--white);
  font-size: clamp(26px, 2.8vw, 46px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.05em;
  transition: color 220ms ease, opacity 220ms ease, background 220ms ease, border-color 220ms ease, transform 220ms ease;
}
.nav-link:hover, .nav-link.is-active { color: var(--accent); border-color: var(--line); background: rgba(247, 248, 245, .075); transform: translateX(3px); }
.nav-link:not(.is-active) { opacity: .94; }
.nav-link::after { display: none; }

.sidebar-meta { display: flex; flex-direction: column; gap: 5px; margin-top: auto; color: var(--quiet); font-size: 10px; font-weight: 700; line-height: 1.25; text-transform: uppercase; }
.portfolio-stage { position: relative; width: 100%; height: 100svh; overflow-y: auto; overscroll-behavior-y: none; scroll-behavior: smooth; scroll-snap-type: y mandatory; scrollbar-width: none; }
.portfolio-stage::-webkit-scrollbar { display: none; }
.view { position: relative; inset: auto; display: flex; flex-direction: column; justify-content: center; min-height: 100svh; height: 100svh; padding: 0 var(--gutter) 28px; opacity: 1; transform: none; pointer-events: auto; scroll-snap-align: start; scroll-snap-stop: always; }
.view[hidden] { display: flex; }
.view-home { right: auto; }
.view-projects { display: block; height: 300svh; min-height: 300svh; overflow: visible; padding: 0; }
.view.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.eyebrow { margin: 0 0 16px; color: var(--quiet); font-family: var(--sans); font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: .04em; }

.home-photo-slot { position: absolute; top: 58%; left: clamp(36px, 10vw, 220px); display: grid; width: min(780px, 60vw); aspect-ratio: 16 / 10; place-items: center; border: 1px solid rgba(247, 248, 245, .48); background-image: url("./assets/miao-lei-photo.jpg"); background-position: center; background-size: cover; color: var(--quiet); transform: translateY(-50%); }
.home-photo-slot span { font: 700 10px var(--sans); letter-spacing: .08em; }
.home-copy { width: min(680px, calc(100% - min(320px, 27vw) - clamp(44px, 7vw, 120px))); margin: -1vh clamp(8px, 1.5vw, 36px) 0 auto; text-align: right; }
.home-copy h2 { margin: 0; font-size: clamp(32px, 4.08vw, 75px); font-weight: 700; line-height: 1; letter-spacing: -0.06em; }
.home-copy h2 span { display: block; }
.home-copy h2 .accent-line, .contact-copy h2 .accent-line { color: var(--accent); }
.home-links { display: flex; justify-content: flex-end; gap: clamp(36px, 6vw, 104px); margin-top: 32px; }
.text-action {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(247, 248, 245, .045);
  font-size: 16px;
  font-weight: 700;
  transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.text-action span { display: inline-block; margin-left: 10px; transition: transform 180ms ease; }
.text-action:hover { color: var(--accent); border-color: var(--accent); background: rgba(185, 178, 255, .10); transform: translateY(-2px); }
.text-action:hover span { transform: translate(4px, -4px); }
.home-copy .eyebrow { text-align: right; }

.project-scroll-frame { position: sticky; top: 0; display: flex; width: 100%; height: 100svh; align-items: stretch; padding: 0 var(--gutter) 28px 0; }
.projects-head { display: grid; grid-template-columns: minmax(220px, .74fr) 1.55fr; gap: clamp(28px, 5vw, 92px); align-items: end; margin-bottom: 24px; }
.projects-head > div { text-align: center; }
.projects-head h2 { margin: 0; font-size: clamp(42px, 6vw, 104px); line-height: .85; letter-spacing: -0.07em; }
.project-count { color: var(--quiet); font-family: var(--sans); font-size: 10px; font-weight: 700; }
.project-layout { display: grid; grid-template-columns: clamp(240px, 28vw, 360px) minmax(0, 1fr); gap: clamp(24px, 3.4vw, 64px); align-items: stretch; width: 100%; height: 100%; min-height: 0; }
.project-list { display: flex; flex-direction: column; align-items: stretch; align-self: center; gap: 8px; width: 100%; transform: none; }
.project-tab {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 18px;
  gap: 8px;
  align-items: center;
  width: 100%;
  overflow: hidden;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(247, 248, 245, .035);
  color: var(--muted);
  text-align: left;
  transition: color 420ms cubic-bezier(.22,.61,.36,1), background 420ms cubic-bezier(.22,.61,.36,1), border-color 420ms cubic-bezier(.22,.61,.36,1), transform 420ms cubic-bezier(.22,.61,.36,1);
}
.project-tab span { color: var(--quiet); font: 700 11px var(--sans); }
.project-tab strong { overflow: hidden; font-size: clamp(16px, 1.5vw, 22px); line-height: 1.2; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.project-tab i { font-size: 17px; font-style: normal; opacity: .45; transition: transform 420ms cubic-bezier(.22,.61,.36,1); }
.project-tab:hover, .project-tab.is-active { color: var(--accent); border-color: var(--line); background: rgba(247, 248, 245, .075); transform: translateX(3px); }
.project-tab.is-active strong { color: var(--accent); }
.project-tab:hover i, .project-tab.is-active i { opacity: 1; transform: translate(3px, -3px); }
.project-detail { min-height: 0; max-height: calc(100svh - 28px); overflow-y: auto; padding: 104px 0 36px; border-top: 1px solid var(--line); scrollbar-width: thin; transition: opacity 680ms cubic-bezier(.22,.61,.36,1), transform 760ms cubic-bezier(.22,.61,.36,1); }
.project-detail.is-switching { opacity: 0; transform: translateY(18px) scale(.992); }
.project-detail-top, .project-detail-bottom { display: flex; justify-content: space-between; gap: 20px; color: var(--quiet); font: 700 10px var(--sans); text-transform: uppercase; }
.project-detail h3 { margin: 26px 0 12px; color: var(--white); font-size: clamp(26px, 3vw, 52px); line-height: .95; letter-spacing: -0.055em; }
.project-detail > p { max-width: 720px; margin: 0; color: var(--white); font-size: clamp(15px, 1.25vw, 21px); font-weight: 600; line-height: 1.42; }
.project-launch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 16px; padding: 0 17px; border: 1px solid currentColor; border-radius: 999px; background: rgba(185, 178, 255, .08); color: var(--accent); font-size: 13px; font-weight: 700; transition: background 180ms ease, transform 180ms ease; }
.project-launch:hover { background: rgba(185, 178, 255, .15); transform: translateY(-2px); }
.project-launch:hover span { transform: translate(3px, -3px); }
.project-launch span { transition: transform 180ms ease; }
.project-launch[hidden] { display: none; }
.project-launch-note { display: inline-block; margin: 0 0 0 10px; color: var(--quiet); font-size: 10px; line-height: 1.5; vertical-align: baseline; }
.project-launch-note[hidden], .project-stats[hidden] { display: none; }
.project-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 22px 0 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 10px 0 9px; }
.stat strong { display: block; color: var(--accent); font-size: clamp(22px, 2vw, 34px); line-height: 1; letter-spacing: -0.04em; }
.stat span { display: block; margin-top: 6px; color: var(--quiet); font-size: 9px; }
.stat-platforms { min-width: 0; }
.platform-links { display: flex; align-items: center; gap: 6px; min-height: 30px; }
.platform-link { display: block; width: 30px; height: 30px; overflow: hidden; border: 1px solid rgba(247, 248, 245, .24); border-radius: 6px; transition: border-color 180ms ease, transform 180ms ease, opacity 180ms ease; }
.platform-link img { display: block; width: 100%; height: 100%; object-fit: cover; }
.platform-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.platform-link.is-pending { cursor: default; opacity: .38; }
.platform-link.is-pending:hover { border-color: rgba(247, 248, 245, .24); transform: none; }
.project-detail-bottom { align-items: start; }
.project-detail-bottom > div { width: 48%; }
.project-detail-bottom p { max-width: 380px; margin: 9px 0 0; color: var(--muted); font: 12px/1.45 var(--sans); text-transform: none; }
.project-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.project-tags span { padding: 5px 7px; border: 1px solid var(--line); color: var(--muted); font: 10px var(--sans); text-transform: none; }

.project-story { display: grid; gap: 0; margin-top: 32px; border-top: 1px solid var(--line); }
.project-story > section { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.project-story > section > span { color: var(--quiet); font: 700 10px var(--sans); text-transform: uppercase; }
.project-story > section > p { max-width: 720px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.project-story ol, .project-story ul { margin: 0; padding: 0; list-style: none; }
.project-story ol { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.project-story ol li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 9px; min-width: 0; padding: 14px 12px 14px 0; border-bottom: 1px solid var(--line); }
.project-story ol li:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--line); }
.project-story ol li > span { color: var(--accent); font: 700 10px var(--sans); }
.project-story ol strong { display: block; font-size: 12px; }
.project-story ol p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.project-story ul { display: grid; gap: 9px; }
.project-story ul li { position: relative; padding-left: 15px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.project-story ul li::before { position: absolute; top: .72em; left: 0; width: 6px; height: 1px; background: var(--accent); content: ""; }

.project-works { margin-top: 22px; }
.project-works[hidden], .project-detail-bottom[hidden], .project-story[hidden] { display: none; }
.project-works-head { display: flex; align-items: end; justify-content: flex-start; gap: 14px; margin-bottom: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); text-align: left; }
.project-works-head h4 { margin: 0; font-size: clamp(20px, 2vw, 30px); line-height: 1; }
.project-work-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 10px; }
.project-work-grid.is-single { grid-template-columns: minmax(0, 1fr); }
.project-work-grid.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.project-work-grid.is-portrait { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.project-work-item { display: block; min-width: 0; }
.project-work-item > img, .work-placeholder { width: 100%; aspect-ratio: var(--work-aspect, 16 / 9); background: #000; }
.project-work-item > img { display: block; object-fit: contain; }
.project-work-grid.is-single .project-work-item > img { width: auto; max-width: 50%; max-height: calc(50svh - 180px); margin: 0 auto; }
.work-placeholder { position: relative; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line); color: var(--quiet); }
.work-placeholder::before { position: absolute; inset: 12px; border: 1px solid rgba(247, 248, 245, .08); content: ""; }
.work-placeholder > span { position: absolute; top: 10px; left: 11px; font: 700 10px var(--sans); }
.work-placeholder strong { font: 700 11px var(--sans); letter-spacing: 0; }
.project-work-label { display: flex; justify-content: space-between; gap: 12px; margin-top: 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.project-work-label i { font-style: normal; transition: transform 180ms ease; }
a.project-work-item:hover .project-work-label { color: var(--accent); }
a.project-work-item:hover .project-work-label i { transform: translate(3px, -3px); }
.project-work-item.is-placeholder .project-work-label i { visibility: hidden; }

.contact-copy { width: min(680px, 72vw); margin: -3vh auto 0; }
.contact-copy > .eyebrow { margin-bottom: 22px; color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 0; }
.contact-channels { border-top: 1px solid var(--line); }
.contact-channel { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 20px; min-height: 88px; border-bottom: 1px solid var(--line); }
.contact-channel > span { color: var(--muted); font: 700 clamp(20px, 2.15vw, 34px)/1.08 var(--sans); }
.contact-value, .contact-value-row { min-width: 0; }
.contact-value { width: fit-content; font-size: clamp(20px, 2.15vw, 34px); font-weight: 700; line-height: 1.08; overflow-wrap: anywhere; transition: color 180ms ease; }
.contact-value:hover { color: var(--accent); }
.contact-email i { display: inline-block; margin-left: 10px; font-style: normal; transition: transform 180ms ease; }
.contact-email:hover i { transform: translate(4px, -4px); }
.contact-value-row { display: flex; align-items: center; gap: 15px; }
.contact-copy-button { position: relative; flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; background: rgba(247, 248, 245, .045); color: var(--muted); transition: color 180ms ease, border-color 180ms ease, background 180ms ease, transform 180ms ease; }
.contact-copy-button:hover, .contact-copy-button.is-copied { color: var(--accent); border-color: var(--accent); background: rgba(185, 178, 255, .10); transform: translateY(-2px); }
.copy-icon, .copy-icon::after { position: absolute; width: 10px; height: 12px; border: 1px solid currentColor; content: ""; }
.copy-icon { top: 7px; left: 7px; }
.copy-icon::after { top: 3px; left: 3px; background: var(--night); }
.copy-status { min-height: 16px; margin: 10px 0 0; color: var(--accent); font: 700 10px var(--sans); }

.stage-footer { position: absolute; right: 0; bottom: 22px; left: 0; display: flex; justify-content: space-between; color: var(--quiet); font: 700 10px var(--sans); text-transform: uppercase; }

.welcome-screen { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; overflow: hidden; background: #000; color: var(--white); transition: opacity 900ms ease, transform 1100ms cubic-bezier(.76,0,.24,1); }
.welcome-screen::before { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, rgba(37, 61, 102, .24), transparent 42%); content: ""; }
.welcome-screen h1 { position: relative; margin: 0; padding: 24px; text-align: center; font-size: clamp(25px, 3.2vw, 58px); font-weight: 600; line-height: 1.1; letter-spacing: -0.04em; opacity: 0; transform: translateY(-52px); animation: welcome-in 1300ms 350ms cubic-bezier(.22,.61,.36,1) forwards; }
.welcome-kicker, .welcome-hint { position: absolute; z-index: 1; color: rgba(247,248,245,.42); font: 700 10px var(--sans); letter-spacing: .05em; }
.welcome-kicker { top: 28px; left: 30px; }
.welcome-hint { bottom: 28px; left: 50%; margin: 0; transform: translateX(-50%); animation: hint-pulse 2.2s 1.6s ease-in-out infinite; }
body.is-entering .welcome-screen { opacity: 0; transform: translateY(-100%); pointer-events: none; }
body.is-entered .welcome-screen { visibility: hidden; }

@keyframes welcome-in { to { opacity: 1; transform: none; } }
@keyframes hint-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

@media (max-width: 680px) {
  body { overflow: auto; }
  .portfolio-shell { position: relative; min-height: 100svh; }
  .site-sidebar { position: fixed; z-index: 4; top: 14px; left: 50%; display: block; padding: 0; transform: translateX(-50%); }
  .primary-nav { flex-direction: row; gap: 8px; }
  .nav-link { font-size: 22px; }
  .nav-link::after { right: -6px; bottom: 9px; width: 4px; height: 4px; }
  .sidebar-meta { display: none; }
  .portfolio-stage { height: 100svh; min-height: 0; padding: 0; }
  .view { position: relative; padding: 0 20px 48px; }
  .view-projects { height: 300svh; min-height: 300svh; overflow: visible; padding: 0; }
  .view-home { right: auto; }
  .home-photo-slot { top: 29%; left: 8px; width: min(230px, 60vw); }
  .home-copy, .contact-copy { width: 100%; margin-top: -4vh; }
  .home-copy { position: relative; z-index: 1; }
  .home-copy h2 { font-size: clamp(28px, 8.8vw, 44px); }
  .intro-copy { width: 100%; margin-top: 28px; font-size: 15px; }
  .home-note { right: 0; bottom: 84px; width: 70%; }
  .projects-head { margin-bottom: 20px; }
  .projects-head { grid-template-columns: 1fr; gap: 10px; }
  .projects-head > div { text-align: center; }
  .project-count { display: none; }
  .projects-head h2 { font-size: 58px; }
  .project-scroll-frame { position: sticky; top: 0; display: block; height: 100svh; padding: 0; }
  .project-layout { position: relative; display: block; height: 100%; padding: 0 20px; }
  .project-list { position: absolute; top: 82px; right: 20px; left: 20px; z-index: 2; align-self: auto; gap: 8px; width: auto; margin-bottom: 0; transform: none; }
  .project-tab { min-height: 52px; padding: 12px 14px; }
  .project-tab span { font-size: 10px; }
  .project-tab strong { font-size: 13px; }
  .project-tab i { font-size: 16px; }
  .project-detail { position: absolute; top: 286px; right: 20px; bottom: 0; left: 20px; min-height: 0; max-height: none; overflow-y: auto; padding-top: 18px; }
  .project-detail h3 { margin: 22px 0 14px; font-size: 37px; }
  .project-detail > p { font-size: 14px; }
  .project-launch-note { display: block; margin: 8px 0 0; }
  .project-stats { margin: 18px 0; }
  .stat strong { font-size: 23px; }
  .project-detail-bottom { gap: 18px; }
  .project-detail-bottom > div { width: 50%; }
  .project-story { margin-top: 24px; }
  .project-story > section { grid-template-columns: 1fr; gap: 12px; padding: 18px 0; }
  .project-story ol { grid-template-columns: 1fr; }
  .project-story ol li:nth-child(even) { padding-left: 0; border-left: 0; }
  .project-works { margin-top: 24px; }
  .project-work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 10px; }
  .project-work-grid.is-single { grid-template-columns: minmax(0, 1fr); }
  .project-work-grid.is-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-work-grid.is-portrait { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-work-grid.is-single .project-work-item > img { width: 100%; max-height: none; }
  .contact-copy > .eyebrow { margin-bottom: 22px; font-size: 13px; }
  .contact-channel { grid-template-columns: 1fr; gap: 10px; min-height: 102px; padding: 16px 0; }
  .contact-channel > span { font: 700 21px/1.08 var(--sans); }
  .contact-value { font-size: 21px; }
  .stage-footer { bottom: 20px; font-size: 9px; }
  .stage-footer span:last-child { display: none; }
}

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