:root {
  --bg: #faf9f7;
  --fg: #16140f;
  --muted: #6b675e;
  --line: #e4e0d8;
  --accent: #d9622b;
  --accent-soft: #fbe9df;
  --card: #ffffff;
  --section-paper: rgba(255, 254, 251, 0.52);
  --section-warm: rgba(237, 232, 223, 0.62);
  --texture-dot: rgba(116, 91, 72, 0.075);
  --maxw: 1080px;
  --r: 16px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  min-width: 320px;
  overflow-x: hidden;
  font-family: Georgia, "Times New Roman", "PingFang SC", "Microsoft YaHei", serif;
  background:
    radial-gradient(circle at 8% 7%, rgba(217, 98, 43, 0.055), transparent 24rem),
    radial-gradient(circle at 92% 28%, rgba(217, 98, 43, 0.035), transparent 28rem),
    var(--bg);
  color: var(--fg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(22, 20, 15, 0.018) 0,
    rgba(22, 20, 15, 0.018) 1px,
    transparent 1px,
    transparent 5px
  );
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* ============ NAV ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem max(1.6rem, calc((100vw - var(--maxw)) / 2));
  background: rgba(250, 249, 247, 0.84);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid rgba(228, 224, 216, 0.78);
  transition: box-shadow 0.3s ease, background 0.3s ease;
}
.nav.is-scrolled {
  background: rgba(250, 249, 247, 0.94);
  box-shadow: 0 8px 28px rgba(22, 20, 15, 0.055);
}
.nav__brand {
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-weight: 700;
  letter-spacing: 0.025em;
  transition: color 0.25s ease;
}
.nav__brand:hover { color: var(--accent); }
.nav__links {
  display: flex;
  gap: 1.8rem;
  list-style: none;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.9rem;
}
.nav__links a {
  position: relative;
  color: var(--muted);
  transition: color 0.25s ease;
}
.nav__links a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -0.35rem;
  left: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease-out);
}
.nav__links a:hover { color: var(--fg); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ============ HERO ============ */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  max-width: var(--maxw);
  min-height: calc(100vh - 3.5rem);
  min-height: calc(100svh - 3.5rem);
  margin: 0 auto;
  padding: clamp(5.5rem, 10vw, 8.5rem) 1.6rem clamp(5rem, 8vw, 7.5rem);
}
.hero::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 50%;
  z-index: -1;
  width: 100vw;
  pointer-events: none;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse 42% 55% at 94% 9%, rgba(217, 98, 43, 0.065), transparent 72%),
    radial-gradient(ellipse 34% 45% at 4% 88%, rgba(191, 154, 117, 0.07), transparent 74%),
    radial-gradient(circle, var(--texture-dot) 0.75px, transparent 0.95px),
    linear-gradient(115deg, rgba(255, 255, 255, 0.2), rgba(246, 240, 232, 0.12));
  background-position: center, center, 0 0, center;
  background-size: auto, auto, 26px 26px, auto;
}
.hero::after {
  content: "";
  position: absolute;
  top: clamp(2rem, 7vw, 6rem);
  right: clamp(-22rem, -19vw, -10rem);
  z-index: -1;
  width: clamp(25rem, 47vw, 44rem);
  aspect-ratio: 1;
  pointer-events: none;
  border: 1px solid rgba(217, 98, 43, 0.075);
  border-radius: 50%;
  box-shadow:
    0 0 0 clamp(2.5rem, 5vw, 5rem) rgba(217, 98, 43, 0.018),
    0 0 0 clamp(6rem, 11vw, 10rem) rgba(191, 154, 117, 0.014);
}
.hero__inner {
  display: grid;
  grid-template-columns: minmax(280px, 350px) minmax(0, 1fr);
  width: 100%;
  align-items: center;
  gap: clamp(3rem, 7vw, 6rem);
}
.hero__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.72), transparent 36%),
    linear-gradient(145deg, var(--accent-soft), #efd1be);
  border: 4px solid var(--accent);
  border-radius: 38px 38px 38px 112px;
  box-shadow:
    12px 14px 0 -3px var(--accent-soft),
    20px 22px 0 -5px rgba(217, 98, 43, 0.48),
    0 32px 65px rgba(74, 47, 33, 0.16),
    0 3px 0 rgba(255, 255, 255, 0) inset;
  transform-origin: center;
}
.hero__photo::after {
  content: "";
  position: absolute;
  inset: 12px;
  z-index: 2;
  pointer-events: none;
  border: none;
  border-radius: 28px 28px 28px 6.2rem;
}
.hero__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform 0.9s var(--ease-out), filter 0.5s ease;
}
.hero__photo:hover img { transform: scale(1.025); filter: saturate(1.04); }
.hero__photo-ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  color: var(--accent);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.04em;
}
.hero__text { min-width: 0; }
.hero__eyebrow {
  color: var(--accent);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
}
.hero__name {
  font-size: clamp(3.3rem, 7.4vw, 5.8rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
  font-weight: 700;
  white-space: nowrap;
}
.hero__name-char {
  display: inline-block;
  white-space: pre;
}
.hero__tagline {
  font-size: clamp(0.9rem, 1.7vw, 1.16rem);
  line-height: 1.45;
  margin: 1.8rem 0 1.25rem;
  max-width: 640px;
  font-weight: 600;
}
.hero__tagline em { color: var(--accent); font-style: italic; }
.hero__bio {
  color: var(--muted);
  max-width: 640px;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.98rem;
}
.hero__bio strong { color: var(--fg); font-weight: 600; }
.hero__links {
  display: flex;
  gap: 0.8rem;
  margin-top: 2.2rem;
  flex-wrap: wrap;
}

/* ============ BTN ============ */
.btn {
  display: inline-block;
  padding: 0.68rem 1.45rem;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: var(--fg);
  color: #fff;
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(22, 20, 15, 0.12);
  transition:
    transform 0.35s var(--ease-out),
    box-shadow 0.35s ease,
    background 0.25s ease,
    border-color 0.25s ease;
}
.btn:hover {
  transform: translateY(-3px);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 13px 28px rgba(217, 98, 43, 0.2);
}
.btn:active { transform: translateY(-1px); }
.btn--ghost {
  background: rgba(255, 255, 255, 0.34);
  color: var(--fg);
  border-color: var(--line);
  box-shadow: none;
}
.btn--ghost:hover { color: #fff; }

/* ============ SECTION ============ */
.section {
  position: relative;
  isolation: isolate;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(4.5rem, 8vw, 7rem) 1.6rem;
  border-top: 1px solid var(--line);
  scroll-margin-top: 4rem;
}
.section::before {
  content: "";
  position: absolute;
  inset-block: 0;
  left: 50%;
  z-index: -1;
  width: 100vw;
  pointer-events: none;
  transform: translateX(-50%);
  background: linear-gradient(
    180deg,
    transparent 0,
    var(--section-tone) clamp(2rem, 5vw, 4.5rem),
    var(--section-tone) calc(100% - clamp(2rem, 5vw, 4.5rem)),
    transparent 100%
  );
}
body > .section:nth-of-type(odd) { --section-tone: var(--section-paper); }
body > .section:nth-of-type(even) { --section-tone: var(--section-warm); }
.section__head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin-bottom: 0.6rem;
}
.section__index {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
}
.section__title {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.01em;
}
.section__lead {
  color: var(--muted);
  max-width: 640px;
  margin: 0.8rem 0 2.4rem;
}
.section__lead em { color: var(--fg); font-style: normal; font-weight: 600; }

/* ============ PAPER ============ */
.paper {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1.7rem 1.9rem;
  margin-bottom: 1.2rem;
  box-shadow: 0 12px 30px rgba(22, 20, 15, 0.025);
  transition: border-color 0.3s ease, transform 0.4s var(--ease-out), box-shadow 0.4s ease;
}
.paper:hover {
  border-color: rgba(217, 98, 43, 0.55);
  transform: translateY(-5px);
  box-shadow: 0 20px 38px rgba(22, 20, 15, 0.07);
}
.paper__meta {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.tag {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}
.tag--role { background: #eef0ee; color: var(--muted); }
.paper__title {
  font-size: 1.12rem;
  line-height: 1.4;
  font-weight: 700;
  margin-bottom: 0.7rem;
}
.paper__desc { color: var(--muted); font-size: 0.97rem; }
.paper__desc em { color: var(--fg); font-style: normal; font-weight: 600; }
.paper__links {
  margin-top: 1rem;
  display: flex;
  gap: 1.2rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.paper__links a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.paper__links a:hover { border-color: var(--accent); }

/* ============ GRID / CARDS ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.2rem;
}
.card {
  display: block;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(22, 20, 15, 0.025);
  transition: border-color 0.3s ease, transform 0.45s var(--ease-out), box-shadow 0.45s ease;
}
.card:hover {
  border-color: rgba(217, 98, 43, 0.55);
  transform: translateY(-7px);
  box-shadow: 0 22px 42px rgba(22, 20, 15, 0.09);
}
.card__thumb {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--c1, #ddd), var(--c2, #bbb));
  position: relative;
  overflow: hidden;
}
.card__thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
  transition: transform 0.8s var(--ease-out);
}
.card:hover .card__thumb img { transform: scale(1.035); }
.card__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 30% 25%,
    rgba(255, 255, 255, 0.5),
    transparent 60%
  );
}
.card__body { padding: 1.2rem 1.4rem 1.5rem; }
.card__title { font-size: 1.15rem; font-weight: 700; }
.card__tags {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0.3rem 0 0.6rem;
}
.card__desc { color: var(--muted); font-size: 0.94rem; }
.works__more {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 1.6rem;
  font-style: italic;
}

/* ============ PROJECT VIEWERS ============ */
.work-page { min-height: 100vh; }
.work-nav { position: sticky; }
.work-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}
.work-nav__back::before {
  content: "←";
  color: var(--accent);
  transition: transform 0.3s var(--ease-out);
}
.work-nav__back:hover::before { transform: translateX(-4px); }
.work-nav__title {
  color: var(--muted);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: right;
  text-transform: uppercase;
}
.work-viewer {
  width: min(100% - 3.2rem, 1480px);
  margin: 0 auto;
  padding: clamp(2.8rem, 5vw, 4.8rem) 0 4.5rem;
}
.work-viewer__header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.5rem;
}
.work-viewer__eyebrow {
  margin-bottom: 0.35rem;
  color: var(--accent);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.work-viewer__title {
  max-width: 900px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.045em;
}
.work-viewer__download {
  flex: 0 0 auto;
  color: var(--accent);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  border-bottom: 1px solid currentColor;
  transition: color 0.25s ease;
}
.work-viewer__download:hover { color: var(--fg); }
.pdf-shell {
  overflow: hidden;
  height: max(620px, calc(100svh - 12rem));
  background: #e8e5df;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(22, 20, 15, 0.11);
}
.pdf-shell object,
.pdf-shell iframe,
.pdf-shell embed {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.pdf-fallback {
  display: grid;
  height: 100%;
  place-content: center;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}
.pdf-fallback a { color: var(--accent); border-bottom: 1px solid currentColor; }
.demo {
  margin-top: clamp(4rem, 8vw, 7rem);
  padding-top: 1.8rem;
  border-top: 1px solid var(--line);
}
.demo__head {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 1.3rem;
}
.demo__index { color: var(--accent); font-size: 0.85rem; font-weight: 700; }
.demo__title { font-size: clamp(1.7rem, 4vw, 2.5rem); }
.demo__video {
  display: block;
  width: 100%;
  max-height: 82svh;
  background: #0c0b09;
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(22, 20, 15, 0.13);
}
.work-viewer__footer {
  display: flex;
  justify-content: center;
  padding-top: clamp(3rem, 6vw, 5rem);
}
.js .work-viewer > * { opacity: 0; transform: translateY(22px); }
.js.is-ready .work-viewer > * {
  animation: work-enter 0.8s var(--ease-out) both;
}
.js.is-ready .work-viewer > *:nth-child(2) { animation-delay: 0.12s; }
.js.is-ready .work-viewer > *:nth-child(3) { animation-delay: 0.2s; }
.js.is-ready .work-viewer > *:nth-child(4) { animation-delay: 0.28s; }
@keyframes work-enter {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ CV ============ */
.section--cv .btn { margin-top: 0.4rem; }

/* ============ FOOTER ============ */
.footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3.5rem 1.6rem 4.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
  font-size: 0.9rem;
}
.footer p { margin-bottom: 0.4rem; }
.footer a {
  color: var(--fg);
  border-bottom: 1px solid var(--line);
  transition: color 0.25s ease, border-color 0.25s ease;
}
.footer a:hover { color: var(--accent); border-color: var(--accent); }
.footer__copy { font-size: 0.8rem; opacity: 0.7; margin-top: 1rem; }

/* ============ LOAD + REVEAL MOTION ============ */
.js .nav { opacity: 0; transform: translateY(-100%); }
.js.is-ready .nav { animation: nav-enter 0.75s var(--ease-out) 0.05s both; }

.js .hero__photo { opacity: 0; transform: translate3d(-42px, 18px, 0) scale(0.97); }
.js.is-ready .hero__photo { animation: photo-enter 0.95s var(--ease-out) 0.2s both; }

.js .hero__text > *:not(.hero__name) { opacity: 0; transform: translate3d(28px, 16px, 0); }
.js.is-ready .hero__eyebrow { animation: copy-enter 0.7s var(--ease-out) 0.34s both; }
.js.is-ready .hero__tagline { animation: copy-enter 0.7s var(--ease-out) 0.62s both; }
.js.is-ready .hero__bio { animation: copy-enter 0.75s var(--ease-out) 0.76s both; }
.js.is-ready .hero__links { animation: copy-enter 0.75s var(--ease-out) 0.9s both; }

.js .hero__name-char { opacity: 0; transform: translateY(0.7em); }
.js.is-ready .hero__name-char {
  animation: letter-enter 0.55s var(--ease-out) both;
  animation-delay: calc(0.42s + (var(--char-index) * 42ms));
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.75s ease var(--reveal-delay, 0ms),
    transform 0.85s var(--ease-out) var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal--left { transform: translate3d(-28px, 14px, 0); }
.reveal--right { transform: translate3d(28px, 14px, 0); }
.reveal.is-visible { opacity: 1; transform: translate3d(0, 0, 0); will-change: auto; }

@keyframes nav-enter {
  from { opacity: 0; transform: translateY(-100%); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes photo-enter {
  from { opacity: 0; transform: translate3d(-42px, 18px, 0) scale(0.97); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}
@keyframes copy-enter {
  from { opacity: 0; transform: translate3d(28px, 16px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes letter-enter {
  from { opacity: 0; transform: translateY(0.7em); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .hero__inner { grid-template-columns: minmax(230px, 290px) minmax(0, 1fr); gap: 2.5rem; }
  .hero__name { font-size: clamp(3rem, 7.5vw, 4.5rem); }
}

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .nav { padding: 0.85rem 1.2rem; }
  .work-nav__title { max-width: 58vw; font-size: 0.68rem; line-height: 1.25; }
  .work-viewer { width: min(100% - 2rem, 1480px); padding-top: 2.2rem; }
  .work-viewer__header { display: block; }
  .work-viewer__download { display: inline-block; margin-top: 1rem; }
  .pdf-shell { height: 72svh; min-height: 460px; border-radius: 10px; }
  .demo__video { border-radius: 10px; }
  .nav__links { gap: 0.9rem; font-size: 0.78rem; }
  .nav__brand { font-size: 0.9rem; }
  .hero { padding: 4.5rem 1.2rem 4rem; }
  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: 2.5rem; }
  .hero__photo { width: min(76vw, 280px); margin: 0 auto; border-radius: 30px 30px 30px 5.5rem; }
  .hero__photo::after { border-radius: 22px 22px 22px 4.9rem; }
  .hero__eyebrow { font-size: 0.74rem; }
  .hero__name { font-size: clamp(3rem, 16vw, 4.5rem); }
  .hero__tagline, .hero__bio { margin-left: auto; margin-right: auto; }
  .hero__links { justify-content: center; }
  .section { padding: 4rem 1.2rem; }
  .paper { padding: 1.4rem; }
}

@media (max-width: 430px) {
  .nav__brand { max-width: 5.5rem; line-height: 1.1; }
  .nav__links { gap: 0.7rem; }
  .hero__photo { width: min(82vw, 270px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .reveal,
  .js .nav,
  .js .hero__photo,
  .js .hero__text > *,
  .js .hero__name-char {
    opacity: 1 !important;
    transform: none !important;
  }
}
