:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --pill: #efefef;
  --pill-hover: #e2e2e2;
  --bg: #ffffff;
  --accent: #2fd16b;
  --radius: 14px;
  --gutter: clamp(16px, 4vw, 48px);
  --head: 58px;
  --sans: "Helvetica Neue", Helvetica, "Inter Tight", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --ease-io: cubic-bezier(.76, 0, .24, 1);
}
html[lang="zh-CN"] {
  --sans: "Helvetica Neue", Helvetica, "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --mono: "IBM Plex Mono", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", monospace;
}
html[lang="zh-CN"] :is(.h-xl, .h-l, .statement, .lede, .story .lede, .hero-card h3, .p-hero h1, .next .over b, .founder h3, .office-card h3, .row .t, .mobile-menu a) { letter-spacing: 0; }
html[lang="zh-CN"] .statement, html[lang="zh-CN"] .h-l { line-height: 1.25; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
body.lock { overflow: hidden; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

/* ---------- Header ---------- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: 50; height: var(--head);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--gutter);
  transition: transform .5s var(--ease);
}
.header.hidden { transform: translateY(-110%); }
.header::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(255,255,255,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); opacity: 0; transition: opacity .4s var(--ease); }
.header.scrolled::before { opacity: 1; }
.logo { font-family: "Inter Tight", var(--sans); font-weight: 800; font-size: 26px; letter-spacing: -.04em; line-height: 1; white-space: nowrap; }
.logo span { color: var(--muted); font-weight: 400; }
.nav { display: flex; gap: 6px; align-items: center; }
.pill {
  font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(239,239,239,.85); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 0; border-radius: 5px; height: 26px; padding: 0 12px;
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink);
  transition: background .25s;
}
.pill:hover, .pill.active { background: var(--pill-hover); }
.pill.icon { width: 30px; padding: 0; justify-content: center; }
.pill.icon svg { width: 11px; height: 11px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.plus { transition: transform .35s var(--ease); display: inline-block; }
.office[aria-expanded="true"] .plus { transform: rotate(45deg); }
.dropdown {
  position: absolute; top: 48px; right: var(--gutter); width: 270px;
  background: rgba(245,245,245,.95); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 10px; padding: 8px;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: .35s var(--ease);
}
.dropdown.open { opacity: 1; transform: none; pointer-events: auto; }
.dropdown a { display: flex; justify-content: space-between; gap: 12px; font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 8px 10px; border-radius: 5px; }
.dropdown a small { color: var(--muted); font-size: 10px; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.dropdown a:hover { background: #fff; }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.burger { display: none; }
.search-panel {
  position: absolute; top: 48px; right: var(--gutter); width: min(400px, calc(100vw - 2 * var(--gutter)));
  background: rgba(245,245,245,.97); backdrop-filter: blur(16px); border-radius: 10px; padding: 8px;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: .35s var(--ease);
}
.search-panel.open { opacity: 1; transform: none; pointer-events: auto; }
.search-panel input { width: 100%; border: 0; background: #fff; border-radius: 6px; padding: 10px 12px; font: 15px var(--sans); outline: none; }
.search-panel ul { list-style: none; margin-top: 6px; max-height: 50vh; overflow: auto; }
.search-panel li a { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 6px; font-size: 14px; }
.search-panel li a:hover { background: #fff; }
.search-panel li img { width: 48px; height: 32px; border-radius: 4px; flex: none; }
.search-panel li small { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.mobile-menu {
  position: fixed; inset: 0; background: #fff; z-index: 45; padding: 90px var(--gutter) 32px;
  display: flex; flex-direction: column; gap: 6px;
  clip-path: inset(0 0 100% 0); transition: clip-path .7s var(--ease-io);
}
.mobile-menu.open { clip-path: inset(0 0 0 0); }
.mobile-menu a { font-size: 30px; font-weight: 300; letter-spacing: -.02em; border-bottom: 1px solid var(--line); padding: 10px 0;
  transform: translateY(30px); opacity: 0; transition: .6s var(--ease); }
.mobile-menu.open a { transform: none; opacity: 1; }
.mobile-menu.open a:nth-child(2) { transition-delay: .05s; } .mobile-menu.open a:nth-child(3) { transition-delay: .1s; }
.mobile-menu.open a:nth-child(4) { transition-delay: .15s; } .mobile-menu.open a:nth-child(5) { transition-delay: .2s; }

/* ---------- Page transition curtain ---------- */
.curtain {
  position: fixed; inset: 0; z-index: 90; background: #fff; pointer-events: none;
  opacity: 1; transition: opacity .55s var(--ease);
}
.curtain.gone { opacity: 0; }
.curtain.in { opacity: 1; pointer-events: auto; }

/* Image that flies from a card to the project hero */
.fly { position: fixed; z-index: 95; overflow: hidden; border-radius: 10px; pointer-events: none;
  transition: top .9s var(--ease-io), left .9s var(--ease-io), width .9s var(--ease-io), height .9s var(--ease-io), border-radius .9s var(--ease-io); }
.fly-bg { position: fixed; inset: 0; z-index: 94; background: #fff; opacity: 0; transition: opacity .6s var(--ease); }
.fly-bg.on { opacity: 1; }

/* ---------- Blur-in image loading ---------- */
.media { position: relative; overflow: hidden; background: #ece9e6; }
.media img { filter: blur(22px); transform: scale(1.08); opacity: .6; transition: filter 1.2s var(--ease), transform 1.6s var(--ease), opacity .8s; }
.media img.ok { filter: none; transform: scale(1); opacity: 1; }

/* ---------- Reveal ---------- */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.mask > * { clip-path: inset(100% 0 0 0); transition: clip-path 1.2s var(--ease-io); transition-delay: inherit; }
.mask.in > * { clip-path: inset(0 0 0 0); }
.lines .ln { display: block; overflow: hidden; }
.lines .ln > span { display: block; transform: translateY(105%); transition: transform 1s var(--ease); }
.lines.in .ln > span { transform: none; }

/* ---------- Common ---------- */
section { padding: clamp(64px, 10vw, 140px) var(--gutter); }
.page-top { padding-top: calc(var(--head) + clamp(40px, 7vw, 100px)); }
.eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 20px; }
.h-xl { font-weight: 300; font-size: clamp(44px, 8vw, 120px); letter-spacing: -.03em; line-height: .95; }
.h-l { font-weight: 300; font-size: clamp(36px, 5vw, 64px); letter-spacing: -.02em; line-height: 1.02; }
.btn {
  font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 12px; background: var(--pill); padding: 10px 16px; border-radius: 6px;
  transition: background .25s, gap .35s var(--ease);
}
.btn:hover { background: var(--pill-hover); gap: 18px; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #333; }
.center { display: flex; justify-content: center; margin-top: 48px; }
.tag { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; padding: 4px 8px; border-radius: 4px; background: var(--pill); }

/* Project card (shared by home + projects) */
.work { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; cursor: pointer; display: block; }
.work .media { position: absolute; inset: 0; }
.work .media img.ok { transition: transform 1.2s var(--ease), filter 1.2s var(--ease), opacity .8s; }
.work:hover .media img.ok { transform: scale(1.05); }
.work .caption {
  position: absolute; left: 12px; right: 12px; bottom: 10px; color: #fff; z-index: 2;
  display: flex; justify-content: space-between; align-items: end; gap: 12px;
  opacity: 0; transform: translateY(10px); transition: .5s var(--ease);
}
.work::after { content: ""; position: absolute; inset: 0; z-index: 1; background: linear-gradient(transparent 55%, rgba(0,0,0,.55)); opacity: 0; transition: opacity .5s; }
.work:hover::after, .work:hover .caption { opacity: 1; transform: none; }
.caption b { font-weight: 400; font-size: 17px; }
.caption small { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; white-space: nowrap; text-transform: uppercase; }

/* ---------- Lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 120; pointer-events: none; }
.lb-bg { position: absolute; inset: 0; background: rgba(14,14,14,.94); opacity: 0; transition: opacity .6s var(--ease); }
.lb.open { pointer-events: auto; }
.lb.open .lb-bg { opacity: 1; }
.lb-img { position: fixed; object-fit: contain; border-radius: 10px; transition: top .75s var(--ease-io), left .75s var(--ease-io), width .75s var(--ease-io), height .75s var(--ease-io), border-radius .75s var(--ease-io), opacity .35s; }
.lb-ui { position: absolute; inset: 0; color: #fff; opacity: 0; transition: opacity .4s .3s; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.lb.open .lb-ui { opacity: 1; }
.lb-ui button { position: absolute; background: rgba(255,255,255,.12); border: 0; color: #fff; border-radius: 6px; height: 36px; min-width: 36px; padding: 0 14px; cursor: pointer; font: inherit; letter-spacing: inherit; backdrop-filter: blur(8px); }
.lb-ui button:hover { background: rgba(255,255,255,.24); }
.lb-close { top: 14px; right: var(--gutter); }
.lb-prev { left: var(--gutter); top: 50%; transform: translateY(-50%); }
.lb-next { right: var(--gutter); top: 50%; transform: translateY(-50%); }
.lb-count { position: absolute; left: var(--gutter); top: 24px; }
.lb.sideways .lb-bg { background: #000; }
.lb.sideways .lb-img { border-radius: 0; }
.lb.sideways .lb-title { display: none; }
.lb.sideways .lb-ui button { background: rgba(0,0,0,.35); }
.lb.sideways .lb-close { top: 10px; right: 10px; }
.lb.sideways .lb-count { top: 18px; left: 12px; text-shadow: 0 1px 4px rgba(0,0,0,.6); }
.lb.sideways :is(.lb-prev, .lb-next) { top: 50%; bottom: auto; transform: translateY(-50%); }
.lb.sideways .lb-prev { left: 10px; right: auto; }
.lb.sideways .lb-next { right: 10px; }
.lb-title { position: absolute; left: var(--gutter); bottom: 22px; text-transform: none; letter-spacing: 0; font-family: var(--sans); font-size: 15px; opacity: .85; }

/* ---------- Footer ---------- */
/* Grey panel: logo left, link groups in the middle, back-to-top right; legal and social pinned to the bottom */
.site-foot {
  margin-top: clamp(64px, 8vw, 120px); background: #ececec; color: var(--ink);
  padding: 28px var(--gutter) 24px; min-height: 80vh;
  display: grid; grid-template-columns: 1fr 2fr auto; align-content: space-between;
  grid-template-areas: "logo main top" "legal bottom .";
  column-gap: var(--gutter); row-gap: clamp(80px, 12vw, 160px);
}
.foot-logo { grid-area: logo; align-self: start; }
.foot-main { grid-area: main; display: grid; gap: 40px; max-width: 560px; }
.foot-group h4 { font-weight: 400; font-size: 15px; margin-bottom: 10px; }
.foot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.site-foot .pill { background: #dcdcdc; backdrop-filter: none; -webkit-backdrop-filter: none; }
.site-foot .pill:hover { background: #cdcdcd; }
.signup { display: flex; align-items: center; gap: 6px; background: #dcdcdc; border-radius: 8px; padding: 6px 6px 6px 12px; max-width: 320px; margin-bottom: 8px; }
.signup input { flex: 1; min-width: 0; border: 0; background: transparent; font: 14px var(--sans); color: var(--ink); outline: none; }
.signup input::placeholder { color: #8f8f8f; }
.signup:focus-within { outline: 1px solid var(--ink); }
.site-foot .signup .pill { background: #cbcbcb; }
.fine { font-size: 10px; color: var(--muted); line-height: 1.4; max-width: 250px; }
.to-top { grid-area: top; align-self: start; width: 40px; height: 52px; padding: 0; justify-content: center; font-size: 16px; }
.foot-legal { grid-area: legal; align-self: end; display: grid; gap: 6px; font-size: 11px; color: var(--muted); }
.foot-legal a:hover { color: var(--ink); }
.foot-bottom { grid-area: bottom; align-self: end; display: grid; gap: 16px; }
.foot-social, .foot-lang { display: flex; gap: 14px; flex-wrap: wrap; font-size: 15px; color: #8a8a8a; }
.foot-social a, .foot-lang a { transition: color .2s; }
.foot-social a:hover, .foot-lang a:hover, .foot-lang .on { color: var(--ink); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav .pill:not(.burger) { display: none; }
  .burger { display: inline-flex; }
  .logo { font-size: 21px; }
  .site-foot { grid-template-columns: 1fr auto; grid-template-areas: "logo top" "main main" "bottom bottom" "legal legal"; row-gap: 40px; min-height: 0; }
  .work .caption, .work::after { opacity: 1; transform: none; }
  /* Narrow cards: stack the name over the location so neither gets cut off */
  .work .caption { flex-direction: column; align-items: flex-start; gap: 4px; left: 10px; right: 10px; }
  .caption b { font-size: 15px; line-height: 1.2; }
  .caption small { white-space: normal; font-size: 9px; }
  .lb-prev, .lb-next { top: auto; bottom: 14px; transform: none; }
  .lb-prev { left: auto; right: calc(var(--gutter) + 50px); }
  .lb-title { bottom: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
  .mask > * { clip-path: none; }
}
