: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);
  font-family: Arial, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  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-size: 15px;
  line-height: 1.45;
}

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: grid; grid-template-columns: minmax(130px, 180px) 1fr; 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 { display: flex; flex-direction: column; padding: 18px var(--gutter) 22px var(--gutter); }

.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: column; align-items: flex-start; gap: 4px; margin-top: 44px; }
.nav-link { position: relative; padding: 0; background: none; color: var(--white); font-size: clamp(22px, 2.05vw, 38px); font-weight: 700; line-height: 1.24; letter-spacing: -0.05em; transition: color 220ms ease, opacity 220ms ease; }
.nav-link:hover, .nav-link.is-active { color: var(--accent); }
.nav-link:not(.is-active) { opacity: .94; }
.nav-link::after { position: absolute; right: -16px; bottom: 8px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; opacity: 0; transform: scale(0); transition: opacity 180ms ease, transform 180ms ease; }
.nav-link.is-active::after { opacity: 1; transform: scale(1); }

.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; min-width: 0; height: 100svh; padding: 0 var(--gutter) 22px 4.4vw; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; padding: 0 0 48px; opacity: 0; transform: translateY(18px); transition: opacity 500ms ease, transform 700ms cubic-bezier(.22,.61,.36,1); pointer-events: none; }
.view-home { right: var(--gutter); }
.view-projects { justify-content: flex-start; overflow-y: auto; padding-top: clamp(54px, 8vh, 94px); padding-right: 8px; padding-bottom: 96px; scrollbar-width: thin; }
.view.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.eyebrow { margin: 0 0 22px; color: var(--quiet); font-family: "Courier New", monospace; font-size: 11px; line-height: 1; letter-spacing: .04em; }

.home-photo-slot { position: absolute; top: 44%; left: clamp(48px, 4vw, 70px); display: grid; width: min(470px, 34vw); 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: 10px "Courier New", monospace; letter-spacing: .08em; }
.home-copy { width: min(780px, calc(100% - min(360px, 28vw) - clamp(48px, 8vw, 150px))); margin: -2vh 0 0 auto; text-align: right; }
.home-copy h2 { margin: 0; font-size: clamp(38px, 5.1vw, 94px); font-weight: 700; line-height: 1.02; letter-spacing: -0.07em; }
.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: 28px; margin-top: 36px; }
.text-action { padding: 0 0 5px; border-bottom: 1px solid var(--white); background: transparent; font-size: 14px; font-weight: 700; transition: color 180ms ease, border-color 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); }
.text-action:hover span { transform: translate(4px, -4px); }
.home-copy .eyebrow { text-align: right; }

.projects-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 24px; }
.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: "Courier New", monospace; font-size: 10px; }
.project-layout { display: grid; grid-template-columns: minmax(220px, .74fr) 1.55fr; gap: clamp(28px, 5vw, 92px); align-items: start; }
.project-list { border-top: 1px solid var(--line); }
.project-tab { display: grid; grid-template-columns: 34px minmax(0, 1fr) 20px; gap: 10px; align-items: center; width: 100%; overflow: hidden; padding: 17px 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--muted); text-align: left; transition: color 180ms ease, padding 180ms ease; }
.project-tab span { color: var(--quiet); font: 10px "Courier New", monospace; }
.project-tab strong { font-size: 15px; line-height: 1.2; }
.project-tab i { font-style: normal; opacity: .45; transition: transform 180ms ease; }
.project-tab:hover, .project-tab.is-active { color: var(--white); padding-left: 10px; }
.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: 370px; padding: 24px 0 0; border-top: 1px solid var(--line); }
.project-detail-top, .project-detail-bottom { display: flex; justify-content: space-between; gap: 20px; color: var(--quiet); font: 10px "Courier New", monospace; text-transform: uppercase; }
.project-detail h3 { margin: 30px 0 18px; color: var(--white); font-size: clamp(28px, 3.6vw, 64px); line-height: .95; letter-spacing: -0.065em; }
.project-detail > p { max-width: 720px; margin: 0; color: var(--white); font-size: clamp(15px, 1.25vw, 21px); font-weight: 600; line-height: 1.46; }
.project-launch { display: inline-flex; align-items: center; gap: 10px; margin-top: 18px; padding-bottom: 5px; border-bottom: 1px solid currentColor; color: var(--accent); font-size: 12px; font-weight: 700; }
.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: 12px; margin: 38px 0 34px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat { padding: 14px 0 12px; }
.stat strong { display: block; color: var(--accent); font-size: clamp(22px, 2vw, 34px); line-height: 1; letter-spacing: -0.05em; }
.stat span { display: block; margin-top: 8px; color: var(--quiet); font-size: 10px; }
.stat-platforms { min-width: 0; }
.platform-links { display: flex; align-items: center; gap: 7px; min-height: 34px; }
.platform-link { display: block; width: 34px; height: 34px; overflow: hidden; border: 1px solid rgba(247, 248, 245, .24); 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 Arial, sans-serif; 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 Arial, sans-serif; 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: 10px "Courier New", monospace; 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: 10px "Courier New", monospace; }
.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: 34px; }
.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: 18px; margin-bottom: 16px; padding-bottom: 12px; 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: 24px 14px; }
.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; }
.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: 10px "Courier New", monospace; }
.work-placeholder strong { font: 11px "Courier New", monospace; letter-spacing: 0; }
.project-work-label { display: flex; justify-content: space-between; gap: 12px; margin-top: 9px; color: var(--muted); font-size: 11px; 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(760px, 72vw); margin-top: -3vh; }
.contact-copy > .eyebrow { margin-bottom: 28px; color: var(--muted); font-size: 15px; font-weight: 700; letter-spacing: 0; }
.contact-channels { border-top: 1px solid var(--line); }
.contact-channel { display: grid; grid-template-columns: 150px minmax(0, 1fr); align-items: center; gap: 24px; min-height: 104px; border-bottom: 1px solid var(--line); }
.contact-channel > span { color: var(--muted); font: 700 13px "Courier New", monospace; }
.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: 34px; height: 34px; border: 1px solid var(--line); background: transparent; color: var(--muted); transition: color 180ms ease, border-color 180ms ease; }
.contact-copy-button:hover, .contact-copy-button.is-copied { color: var(--accent); border-color: var(--accent); }
.copy-icon, .copy-icon::after { position: absolute; width: 10px; height: 12px; border: 1px solid currentColor; content: ""; }
.copy-icon { top: 9px; left: 9px; }
.copy-icon::after { top: 3px; left: 3px; background: var(--night); }
.copy-status { min-height: 16px; margin: 10px 0 0; color: var(--accent); font: 10px "Courier New", monospace; }

.stage-footer { position: absolute; right: 0; bottom: 22px; left: 0; display: flex; justify-content: space-between; color: var(--quiet); font: 10px "Courier New", monospace; 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: 500; 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: 10px "Courier New", monospace; 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: 760px) {
  body { overflow: auto; }
  .portfolio-shell { position: relative; min-height: 100svh; grid-template-columns: 1fr; }
  .site-sidebar { position: relative; z-index: 3; display: block; padding: 18px 20px 0; }
  .identity-name { font-size: 28px; }
  .primary-nav { flex-direction: row; gap: 20px; margin-top: 28px; }
  .nav-link { font-size: 22px; }
  .nav-link::after { right: -9px; bottom: 4px; width: 4px; height: 4px; }
  .sidebar-meta { display: none; }
  .portfolio-stage { height: calc(100svh - 142px); min-height: 610px; padding: 0 20px 24px; }
  .view { position: absolute; padding: 0 0 48px; }
  .view-projects { padding-top: 34px; padding-bottom: 82px; }
  .view-home { right: 20px; }
  .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(33px, 10.2vw, 52px); }
  .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 h2 { font-size: 58px; }
  .project-layout { display: block; }
  .project-list { margin-bottom: 24px; }
  .project-tab { padding: 10px 0; }
  .project-detail { min-height: 0; 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)); }
  .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-size: 12px; }
  .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; }
}
