/* ==========================================================================
   Lincoln Guo — site styles
   Plain CSS, no build step. Tokens first, then base, layout, components.
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-var.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */

:root {
  --bg: #f4f5f6;
  --bg-glass: rgba(244, 245, 246, 0.78);
  --surface: #ffffff;
  --surface-2: #e9ebee;
  --ink: #131418;
  --ink-2: #4b4e57;
  --ink-3: #868a94;
  --line: rgba(19, 20, 24, 0.09);
  --line-strong: rgba(19, 20, 24, 0.18);
  --accent: #ff4a2b;
  --hero-bg: #0a0b0d;
  --code-bg: #111318;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 32px -16px rgba(0, 0, 0, 0.16);

  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --maxw: 1320px;
  --pad: clamp(16px, 4vw, 48px);
  --gutter: max(var(--pad), calc((100vw - var(--maxw)) / 2 + var(--pad)));
  --nav-h: 64px;
  --radius: 18px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --bg-glass: rgba(12, 13, 16, 0.72);
    --surface: #15171b;
    --surface-2: #1d1f24;
    --ink: #eef0f3;
    --ink-2: #a8acb6;
    --ink-3: #6e727c;
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.16);
    --shadow: none;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

img, video, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

.icon { width: 1em; height: 1em; flex: none; }

.skip {
  position: fixed;
  left: 16px;
  top: -100px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--bg);
}
.skip:focus { top: 16px; }

.eyebrow,
.section-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow { margin: 0 0 22px; color: var(--accent); }

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: clamp(28px, 4vw, 56px);
  color: var(--ink-3);
}
.section-label span { color: var(--accent); }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid currentColor;
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
}
.link-arrow .icon { transition: transform 0.35s var(--ease); }
.link-arrow:hover .icon { transform: translateX(4px); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 15px;
  font-weight: 500;
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s var(--ease);
}
.btn:hover { border-color: var(--ink); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--nav-h);
  color: var(--ink);
  border-bottom: 1px solid transparent;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.nav::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  backdrop-filter: saturate(1.6) blur(18px);
  transition: opacity 0.4s var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav--over-hero { color: #fff; border-bottom-color: transparent !important; }
.nav--over-hero::before { opacity: 0; }

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad);
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.logo-mark { width: 28px; height: 28px; --logo-ink: var(--bg); }
.nav--over-hero .logo-mark,
.menu-open .logo-mark { --logo-ink: var(--hero-bg); }

.nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 500;
}
.nav__links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  opacity: 0.7;
  transition: opacity 0.2s, background 0.2s;
}
.nav__links a:hover,
.nav__links a[aria-current] { opacity: 1; }
.nav__links a[aria-current] { background: var(--line); }
.nav--over-hero .nav__links a[aria-current] { background: rgba(255, 255, 255, 0.12); }

.nav__toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav__toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.4s var(--ease);
}
.menu-open .nav__toggle span:first-child { transform: translateY(3.75px) rotate(45deg); }
.menu-open .nav__toggle span:last-child { transform: translateY(-3.75px) rotate(-45deg); }

.menu-open body { overflow: hidden; }
.menu-open .nav { color: #fff; border-bottom-color: transparent; }
.menu-open .nav::before { opacity: 0; }

.menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--nav-h) + 24px) var(--pad) calc(28px + env(safe-area-inset-bottom));
  background: var(--hero-bg);
  color: #fff;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}
.menu-open .menu { opacity: 1; visibility: visible; }

.menu__links { display: flex; flex-direction: column; }
.menu__links a {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: clamp(40px, 12vw, 64px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.045em;
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
}
.menu-open .menu__links a { opacity: 1; transform: none; }
.menu__links a:nth-child(2) { transition-delay: 40ms; }
.menu__links a:nth-child(3) { transition-delay: 80ms; }
.menu__links a:nth-child(4) { transition-delay: 120ms; }
.menu__links a:nth-child(5) { transition-delay: 160ms; }
.menu__num { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0; opacity: 0.45; }

@media (max-width: 760px) {
  .nav__links { display: none; }
  .nav__toggle { display: flex; }
}
@media (min-width: 761px) {
  .menu { display: none; }
}

/* ---------- Social pills ---------- */

.social { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.social a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.social a:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.connect .social a,
.menu .social a { border-color: rgba(255, 255, 255, 0.2); }
.connect .social a:hover,
.menu .social a:hover { background: #fff; border-color: #fff; color: var(--hero-bg); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  isolation: isolate;
  background: var(--hero-bg);
  color: #fff;
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
canvas.hero__media { opacity: 0; transition: opacity 1.6s var(--ease); }
canvas.hero__media.is-ready { opacity: 1; }

.hero__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(to top, rgba(10, 11, 13, 0.92) 0%, rgba(10, 11, 13, 0.55) 26%, rgba(10, 11, 13, 0) 52%),
    linear-gradient(to bottom, rgba(10, 11, 13, 0.55) 0%, rgba(10, 11, 13, 0) 18%);
}

.hero__content { padding-bottom: clamp(24px, 5vh, 64px); }

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  margin: 0 0 clamp(16px, 2.5vh, 28px);
  padding: 8px calc(16px - 0.14em) 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.55);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
}

.dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(255, 74, 43, 0.55);
  animation: pulse 2.4s var(--ease) infinite;
}

.hero__title {
  margin: 0;
  font-size: clamp(68px, 12.6vw, 208px);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.055em;
}
.hero__title .line { display: inline-block; }

.hero__zh {
  display: inline-block;
  margin-left: 0.18em;
  vertical-align: top;
  writing-mode: vertical-rl;
  font-size: max(13px, 0.1em);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.4em;
  color: rgba(255, 255, 255, 0.6);
}

.hero__meta {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(20px, 3.5vh, 40px);
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.hero__tagline { margin: 0; font-size: clamp(15px, 1.35vw, 19px); color: rgba(255, 255, 255, 0.82); }

.hero__scroll {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
}
.hero__scroll-line { position: relative; width: 1px; height: 36px; overflow: hidden; background: rgba(255, 255, 255, 0.25); }
.hero__scroll-line::after {
  content: "";
  position: absolute;
  left: 0;
  top: -40%;
  width: 100%;
  height: 40%;
  background: #fff;
  animation: drip 2.2s var(--ease) infinite;
}

.hero__caption {
  position: absolute;
  top: calc(var(--nav-h) + 20px);
  right: var(--gutter);
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  text-align: right;
  color: rgba(255, 255, 255, 0.5);
}
.hero__caption span { display: block; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: rgba(255, 255, 255, 0.32); }

/* Entrance */
.hero__eyebrow, .hero__title .line, .hero__meta, .hero__caption { animation: rise 1.2s var(--ease) both; }
.hero__title .line:nth-child(2) { animation-delay: 0.08s; }
.hero__zh { animation: fade 1.6s 0.5s var(--ease) both; }
.hero__meta { animation-delay: 0.25s; }
.hero__caption { animation-delay: 0.6s; }

@media (max-width: 760px) {
  .hero__title { font-size: min(25vw, 128px); }
  .hero__title .line { display: block; }
  .hero__caption { left: var(--pad); right: auto; text-align: left; }
}

/* ---------- Marquee ---------- */

.marquee {
  overflow: hidden;
  padding-block: clamp(16px, 2.2vw, 28px);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.marquee__track { display: inline-flex; animation: marquee 48s linear infinite; }
.marquee__track span {
  padding-inline: 0.45em;
  font-size: clamp(24px, 3.4vw, 48px);
  font-weight: 600;
  letter-spacing: -0.035em;
}
.marquee__track .sep { color: var(--accent); font-weight: 400; }

/* ---------- Sections ---------- */

.section { padding-top: clamp(96px, 14vw, 208px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  margin-bottom: clamp(36px, 5vw, 72px);
}
.section-head .section-label { flex-basis: 100%; margin-bottom: 0; }

.section-title {
  margin: 0;
  font-size: clamp(42px, 7.2vw, 108px);
  font-weight: 600;
  line-height: 0.94;
  letter-spacing: -0.05em;
}

/* Intro */
.intro__grid { display: grid; gap: 48px; }
@media (min-width: 900px) {
  .intro__grid { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: clamp(48px, 7vw, 120px); align-items: end; }
}

.statement {
  margin: 0 0 32px;
  font-size: clamp(28px, 4.1vw, 60px);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.038em;
  color: var(--ink-3);
  text-wrap: balance;
}
.statement strong { font-weight: 500; color: var(--ink); }

.statement-zh { max-width: 38em; margin: 0 0 36px; font-size: clamp(16px, 1.4vw, 19px); line-height: 1.85; color: var(--ink-2); }

.intro__portrait { position: relative; margin: 0; max-width: 460px; }
.intro__portrait img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 35%; border-radius: var(--radius); }
.intro__portrait figcaption {
  position: absolute;
  left: 16px;
  bottom: 16px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: clamp(56px, 8vw, 112px) 0 0;
  border-top: 1px solid var(--line-strong);
}
.stats > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 12px; padding: 24px 16px 0 0; }
.stats > div + div { padding-left: clamp(12px, 2vw, 32px); border-left: 1px solid var(--line); }
.stats dd { margin: 0; font-size: clamp(44px, 6.4vw, 96px); font-weight: 600; line-height: 1; letter-spacing: -0.055em; }
.stats dd sup { font-size: 0.45em; vertical-align: top; color: var(--accent); }
.stats dt { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; line-height: 1.5; text-transform: uppercase; color: var(--ink-3); }

/* ---------- Post cards ---------- */

.cards { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (max-width: 699px) {
  .cards {
    display: flex;
    gap: 12px;
    margin-inline: calc(-1 * var(--pad));
    padding: 4px var(--pad) 12px;
    overflow-x: auto;
    scroll-padding-inline: var(--pad);
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }
  .cards::-webkit-scrollbar { display: none; }
  .cards .card { flex: 0 0 84%; min-height: 360px; scroll-snap-align: start; }
}
@media (min-width: 700px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card--feature { grid-column: 1 / -1; }
}
@media (min-width: 1100px) {
  .cards { grid-template-columns: 1.3fr 1fr 1fr; gap: 20px; }
  .card--feature { grid-column: 1; grid-row: span 2; }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 268px;
  padding: clamp(22px, 2.4vw, 32px);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.card:hover,
.js .card.is-in:hover { transform: translateY(-4px); }

.card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.card__title { margin: auto 0 0; padding-top: 24px; font-size: clamp(22px, 1.9vw, 27px); font-weight: 600; line-height: 1.18; letter-spacing: -0.028em; }
.card__excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-2);
}
.card__more { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; font-weight: 500; }
.card__more .icon { transition: transform 0.35s var(--ease); }
.card:hover .card__more .icon { transform: translateX(4px); }

.card--feature { min-height: 440px; background: var(--hero-bg); color: #fff; }
.card--feature::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: url("../img/ridges.svg") center 30% / cover no-repeat;
  opacity: 0.7;
  transition: transform 1.4s var(--ease);
}
.card--feature:hover::before { transform: scale(1.06); }
.card--feature > * { position: relative; }
.card--feature .card__top { color: rgba(255, 255, 255, 0.6); }
.card--feature .card__num { display: inline-flex; align-items: center; gap: 10px; }
.card--feature .card__num::before {
  content: "Latest";
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.card--feature .card__title { font-size: clamp(32px, 3.6vw, 54px); line-height: 1.02; letter-spacing: -0.045em; }
.card--feature .card__excerpt { max-width: 34em; color: rgba(255, 255, 255, 0.68); }

/* ---------- Moments strip ---------- */

.strip-nav { display: flex; gap: 8px; }
.strip-nav button {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: none;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, border-color 0.25s;
}
.strip-nav button:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
@media (max-width: 760px) { .strip-nav { display: none; } }

.strip {
  display: flex;
  gap: clamp(12px, 1.6vw, 20px);
  overflow-x: auto;
  padding-inline: var(--gutter);
  padding-bottom: 8px;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.strip::-webkit-scrollbar { display: none; }
.strip__item { flex: 0 0 auto; width: min(80vw, 560px); margin: 0; scroll-snap-align: start; }
.strip__media { overflow: hidden; aspect-ratio: 4 / 3; border-radius: var(--radius); background: var(--surface-2); }
.strip__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.strip__item:hover img { transform: scale(1.05); }
.strip__item figcaption,
.gallery__item figcaption { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; font-weight: 500; }
.strip__item figcaption { margin-top: 14px; }
.strip__item figcaption span + span,
.gallery__item figcaption span + span { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--ink-3); }
.moments__more { margin-top: clamp(28px, 4vw, 48px); }

/* ---------- Connect band ---------- */

.connect {
  position: relative;
  margin-top: clamp(96px, 14vw, 208px);
  padding-block: clamp(88px, 12vw, 168px);
  overflow: hidden;
  isolation: isolate;
  background: var(--hero-bg);
  color: #fff;
}
.connect::before {
  content: "";
  position: absolute;
  inset: 35% -5% -20%;
  z-index: -1;
  background: url("../img/ridges.svg") center top / cover no-repeat;
  opacity: 0.4;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%);
  mask-image: linear-gradient(to bottom, transparent, #000 30%);
}
@media (prefers-color-scheme: dark) {
  .connect { border-block: 1px solid var(--line); }
}
.connect .section-label { color: rgba(255, 255, 255, 0.5); }
.connect .section-label::after { background: rgba(255, 255, 255, 0.16); }

.connect__title {
  margin: 0 0 28px;
  font-size: clamp(52px, 10vw, 160px);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.058em;
}
.connect__title em { font-style: normal; color: var(--accent); }
.connect__sub { max-width: 34em; margin: 0 0 44px; font-size: clamp(16px, 1.4vw, 19px); color: rgba(255, 255, 255, 0.7); }

.connect__mail {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  margin-bottom: 40px;
  padding-bottom: 8px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.22);
  font-size: clamp(22px, 3.4vw, 46px);
  font-weight: 500;
  letter-spacing: -0.035em;
  overflow-wrap: anywhere;
  transition: border-color 0.3s;
}
.connect__mail .icon { color: var(--accent); transition: transform 0.4s var(--ease); }
.connect__mail:hover { border-color: var(--accent); }
.connect__mail:hover .icon { transform: translate(4px, -4px); }

/* ---------- Footer ---------- */

.footer { padding-block: clamp(56px, 7vw, 96px) 28px; }
.footer .wrap { container-type: inline-size; }

.footer__top { display: grid; gap: 28px; align-items: start; }
@media (min-width: 900px) { .footer__top { grid-template-columns: 1.2fr 1fr auto; } }

.footer__tagline { margin: 0; font-size: clamp(20px, 2vw, 26px); font-weight: 500; letter-spacing: -0.025em; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 24px; padding-top: 6px; font-size: 15px; color: var(--ink-2); }
.footer__links a:hover { color: var(--ink); }
.has-hero .footer .social { display: none; }

.footer__mark {
  margin: clamp(48px, 8vw, 112px) 0 20px;
  font-size: 15.9vw;
  font-size: 15.9cqw;
  font-weight: 700;
  line-height: 0.8;
  letter-spacing: -0.06em;
  white-space: nowrap;
  user-select: none;
  background: linear-gradient(to bottom, var(--ink) 30%, var(--ink-3));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-3);
}

/* ---------- Page header ---------- */

.page-head { padding-top: calc(var(--nav-h) + clamp(56px, 10vw, 144px)); padding-bottom: clamp(40px, 6vw, 88px); }
.page-head__title { margin: 0; font-size: clamp(60px, 12vw, 180px); font-weight: 600; line-height: 0.88; letter-spacing: -0.058em; }
.page-head__sub { max-width: 34em; margin: 32px 0 0; font-size: clamp(17px, 1.6vw, 22px); line-height: 1.5; color: var(--ink-2); }

/* ---------- Blog archive ---------- */

.archive-tools { display: flex; align-items: center; gap: 16px; margin-bottom: clamp(32px, 4vw, 56px); }
.search {
  flex: 1;
  max-width: 520px;
  height: 52px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
}
.search::placeholder { color: var(--ink-3); }
.search:focus { border-color: var(--ink); }
.archive-count { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

.archive__year { display: grid; gap: 8px 40px; padding: 28px 0 48px; border-top: 1px solid var(--line-strong); }
@media (min-width: 860px) {
  .archive__year { grid-template-columns: 220px minmax(0, 1fr); }
  .archive__label { position: sticky; top: calc(var(--nav-h) + 28px); align-self: start; }
}
.archive__label { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: clamp(36px, 4.4vw, 60px); font-weight: 600; line-height: 1; letter-spacing: -0.05em; }
.archive__label span { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.archive__list { margin: 0; padding: 0; list-style: none; }

.row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) 24px;
  align-items: baseline;
  gap: 16px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.4s var(--ease);
}
.archive__list li:first-child .row { padding-top: 6px; }
.row time { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.row__title { font-size: clamp(18px, 1.7vw, 23px); font-weight: 500; line-height: 1.3; letter-spacing: -0.02em; }
.row__arrow { color: var(--accent); opacity: 0; transform: translateX(-8px); transition: opacity 0.3s, transform 0.4s var(--ease); }
.row:hover { padding-left: 12px; }
.row:hover .row__arrow { opacity: 1; transform: none; }
@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; gap: 4px; }
  .row__arrow { display: none; }
}
.archive-empty { padding: 40px 0; color: var(--ink-3); }

/* ---------- Post ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 101;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(var(--p, 0));
  transform-origin: 0 50%;
}

.post .wrap { max-width: calc(760px + 2 * var(--pad)); }
.post-head { padding-top: calc(var(--nav-h) + clamp(40px, 7vw, 104px)); }

.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: clamp(32px, 5vw, 56px);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: color 0.2s;
}
.back:hover { color: var(--ink); }
.back .icon { transition: transform 0.35s var(--ease); }
.back:hover .icon { transform: translateX(-3px); }

.post-head__meta { display: flex; gap: 10px; margin: 0 0 18px; font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.post-head__title { margin: 0; font-size: clamp(38px, 6vw, 72px); font-weight: 600; line-height: 1.03; letter-spacing: -0.045em; text-wrap: balance; }
.post-head__sub { margin: 22px 0 0; font-size: 19px; line-height: 1.5; color: var(--ink-2); }

.post .post-cover { max-width: calc(1080px + 2 * var(--pad)); margin-top: clamp(36px, 5vw, 64px); }
.post-cover img { max-height: 540px; margin-inline: auto; border-radius: var(--radius); }
.post-cover figcaption { margin-top: 12px; font-family: var(--font-mono); font-size: 12px; text-align: center; color: var(--ink-3); }

/* ---------- Prose ---------- */

.prose { max-width: 720px; margin-top: clamp(40px, 6vw, 72px); font-size: 18px; line-height: 1.78; overflow-wrap: break-word; }
.layout-page .prose { margin-top: 0; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose ul, .prose ol, .prose dl, .prose blockquote, .prose table, .prose figure, .prose div.highlighter-rouge, .prose > pre { margin: 0 0 1.4em; }

.prose h1, .prose h2, .prose h3, .prose h4 { font-weight: 600; line-height: 1.22; letter-spacing: -0.028em; text-wrap: balance; }
.prose h1 { margin: 2.4em 0 0.8em; font-size: clamp(28px, 3.2vw, 36px); }
.prose h2 { margin: 2em 0 0.7em; font-size: clamp(24px, 2.6vw, 29px); }
.prose h3 { margin: 1.8em 0 0.6em; font-size: 22px; }
.prose h4 { margin: 1.6em 0 0.5em; font-size: 19px; letter-spacing: -0.015em; }

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: color 0.2s;
}
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.4em; }
.prose li > ul, .prose li > ol { margin: 0.4em 0 0; }
.prose li::marker { color: var(--ink-3); }

.prose blockquote { padding: 2px 0 2px 22px; border-left: 3px solid var(--accent); color: var(--ink-2); }
.prose blockquote > :last-child { margin-bottom: 0; }

.prose hr { height: 1px; margin: 3em 0; border: 0; background: var(--line-strong); }

.prose img { display: inline-block; height: auto; vertical-align: middle; border-radius: var(--radius-sm); }
.prose img[src*="codecogs.com"] { border-radius: 0; }

.prose code { padding: 0.14em 0.4em; border-radius: 6px; background: var(--surface-2); font-family: var(--font-mono); font-size: 0.84em; }

.prose pre,
.prose .highlight {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  color: #e6e8ee;
  font-size: 14px;
  line-height: 1.7;
}
.prose pre { margin: 0; padding: 20px 22px; }
.prose .highlight pre { background: none; }
.prose pre code { padding: 0; background: none; color: inherit; font-size: inherit; }
@media (max-width: 600px) {
  .prose div.highlighter-rouge, .prose > pre { margin-inline: calc(-1 * var(--pad)); }
  .prose pre, .prose .highlight { border-radius: 0; }
}

.prose table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.55;
}
.prose th, .prose td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { border-bottom-color: var(--line-strong); font-weight: 600; white-space: nowrap; }
.prose tr > :first-child { padding-left: 0; }

.prose mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

.prose figure.chart { margin: 2em 0; padding: clamp(14px, 3vw, 28px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.prose figure.chart svg { display: block; width: 100%; height: auto; }
.prose figure.chart figcaption { margin-top: 14px; font-size: 14px; line-height: 1.6; color: var(--ink-3); }

.prose dl { border-top: 1px solid var(--line); }
.prose dt { padding-top: 16px; font-weight: 600; }
.prose dd { margin: 4px 0 0; padding-bottom: 16px; border-bottom: 1px solid var(--line); color: var(--ink-2); }

@media (prefers-color-scheme: dark) {
  .prose img[src*="codecogs.com"] { filter: invert(1) hue-rotate(180deg); }
}

/* Rouge — dark theme for code blocks */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cd, .highlight .cp, .highlight .cpf { color: #7d8590; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kv, .highlight .o, .highlight .ow { color: #ff7b72; }
.highlight .kc, .highlight .kt, .highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .mo, .highlight .mb, .highlight .mx, .highlight .il, .highlight .na, .highlight .nb, .highlight .bp, .highlight .no { color: #79c0ff; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sa, .highlight .sb, .highlight .sc, .highlight .sd, .highlight .se, .highlight .sh, .highlight .si, .highlight .sx, .highlight .sr, .highlight .ss, .highlight .dl { color: #a5d6ff; }
.highlight .nf, .highlight .fm, .highlight .nd { color: #d2a8ff; }
.highlight .nc, .highlight .nn, .highlight .ne, .highlight .nv, .highlight .vi, .highlight .vg, .highlight .vc { color: #ffa657; }
.highlight .nt, .highlight .gi { color: #7ee787; }
.highlight .gd { color: #ffa198; }
.highlight .gh, .highlight .gu { color: #79c0ff; font-weight: 600; }
.highlight .ge { font-style: italic; }
.highlight .gs { font-weight: 600; }
.highlight .err { color: inherit; background: none; }

/* ---------- Post footer ---------- */

.author { display: flex; align-items: center; gap: 16px; margin-top: 72px; padding: 22px 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.author img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.author__name { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.author__bio { margin: 2px 0 0; font-size: 15px; line-height: 1.5; color: var(--ink-2); }

.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.pager__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: border-color 0.25s;
}
.pager__item:hover { border-color: var(--ink); }
.pager__item--next { grid-column: 2; align-items: flex-end; text-align: right; }
.pager__dir { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.pager__title { font-weight: 600; line-height: 1.35; letter-spacing: -0.012em; }
@media (max-width: 600px) {
  .pager { grid-template-columns: 1fr; }
  .pager__item--next { grid-column: auto; }
}

.comments { margin-top: 72px; }

/* ---------- About ---------- */

.about-hero { display: grid; gap: 48px; padding-top: calc(var(--nav-h) + clamp(56px, 9vw, 128px)); }
@media (min-width: 960px) {
  .about-hero { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(48px, 7vw, 112px); align-items: end; }
}
.lead { margin: 36px 0 0; font-size: clamp(19px, 1.8vw, 24px); line-height: 1.5; letter-spacing: -0.012em; }
.lead-zh { margin: 20px 0 0; font-size: 17px; line-height: 1.9; color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; }
.about-hero__photo { margin: 0; max-width: 520px; }
.about-hero__photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: 50% 35%; border-radius: var(--radius); }

.timeline { margin: 0; padding: 0; list-style: none; }
.tl { display: grid; gap: 6px 40px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.tl:first-child { padding-top: 0; }
@media (min-width: 860px) { .tl { grid-template-columns: 220px minmax(0, 1fr) minmax(0, 1.1fr); align-items: baseline; } }
.tl__period { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.tl__role { margin: 0; font-size: clamp(22px, 2.2vw, 30px); font-weight: 600; line-height: 1.15; letter-spacing: -0.03em; }
.tl__org { margin: 6px 0 0; font-size: 15px; color: var(--ink-2); }
.tl__sum { margin: 0; font-size: 16px; line-height: 1.65; color: var(--ink-2); }

.skills { display: grid; gap: 16px; }
@media (min-width: 700px) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .skills { grid-template-columns: repeat(4, 1fr); } }
.skill { padding: 24px; border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.skill h3 { margin: 0 0 18px; font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chips li { padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 14px; font-weight: 500; }

.research { display: grid; gap: 16px; }
@media (min-width: 860px) { .research { grid-template-columns: repeat(2, 1fr); } }
.research .card { min-height: 300px; }
.research .card--feature { grid-column: auto; grid-row: auto; }
.research .card__title { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.1; letter-spacing: -0.035em; }

.beyond { max-width: 1100px; }

/* ---------- Gallery ---------- */

.gallery { columns: 3 300px; column-gap: 16px; }
.gallery__item { position: relative; display: block; margin: 0 0 16px; overflow: hidden; break-inside: avoid; border-radius: var(--radius); cursor: zoom-in; }
.gallery__item img { width: 100%; height: auto; transition: transform 1.2s var(--ease); }
.gallery__item:hover img { transform: scale(1.04); }
.gallery__item figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 48px 18px 16px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.62), transparent);
  color: #fff;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.gallery__item figcaption span + span { color: rgba(255, 255, 255, 0.7); }
.gallery__item:hover figcaption, .gallery__item:focus-visible figcaption { opacity: 1; }
@media (hover: none) { .gallery__item figcaption { opacity: 1; } }

.lightbox {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}
.lightbox::backdrop { background: rgba(8, 9, 11, 0.94); }
.lightbox[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.lightbox img { max-width: 92vw; max-height: 82vh; border-radius: 8px; }
.lightbox__cap { margin: 0; font-family: var(--font-mono); font-size: 13px; color: rgba(255, 255, 255, 0.75); }
.lightbox__btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.lightbox__btn:hover { background: #fff; color: #000; }
.lightbox__close { top: 20px; right: 20px; }
.lightbox__prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 20px; top: 50%; transform: translateY(-50%); }
@media (max-width: 600px) {
  .lightbox__prev, .lightbox__next { top: auto; bottom: 24px; transform: none; }
}

/* ---------- 404 ---------- */

.lost {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: calc(var(--nav-h) + 40px) 64px;
}
.lost__code { margin: 0; font-size: clamp(120px, 28vw, 380px); font-weight: 700; line-height: 0.8; letter-spacing: -0.07em; }
.lost__code span { color: var(--accent); }
.lost__text { max-width: 30em; margin: 28px 0 36px; font-size: clamp(17px, 1.6vw, 21px); color: var(--ink-2); }

/* ---------- Reveal on scroll ---------- */

.js [data-reveal] { opacity: 0; transform: translateY(28px); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* ---------- Keyframes ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes drip { 0% { top: -40%; } 70%, 100% { top: 100%; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 74, 43, 0.55); }
  70%, 100% { box-shadow: 0 0 0 6px rgba(255, 74, 43, 0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
}

/* Breathing room before the footer, except where the page ends in a dark band */
main { padding-bottom: clamp(72px, 9vw, 140px); }
.has-hero main { padding-bottom: 0; }

/* Without JS: let the nav scroll away with the hero, and show links instead of the menu button */
html:not(.js) .nav--over-hero { position: absolute; }
@media (max-width: 760px) {
  html:not(.js) .nav__toggle { display: none; }
  html:not(.js) .nav__links { display: flex; overflow-x: auto; }
  html:not(.js) .nav__name { display: none; }
}
