/* ============================================
   Xingnan Wang — Portfolio
   Typography · Nav · Hero · About · Gallery
   ============================================ */

:root {
  --font-heading: 'HelveticaNowDisplay-Medium', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  --font-body: 'HelveticaNowDisplayW01-Rg', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', Arial, sans-serif;
  --color-ink: #000;
  --color-paper: #fff;
  --color-ivory: #faf9f7;
  --color-stone: #eceae7;
  --color-line: rgba(0, 0, 0, 0.1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: #000; color: #fff; }

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

img, video { display: block; max-width: 100%; }

/* ---------- Page load fade ---------- */
.page { animation: pageIn 0.6s var(--ease-out) both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================
   NAVBAR  (fixed, z-index 10)
   ============================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  opacity: 0; transform: translateY(-6px);
  animation: navIn 0.7s var(--ease-out) 0.1s forwards;
  transition: background-color 0.3s ease, box-shadow 0.3s ease,
              backdrop-filter 0.3s ease, -webkit-backdrop-filter 0.3s ease;
}
.nav.scrolled {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
@keyframes navIn { to { opacity: 1; transform: translateY(0); } }

.nav-logo {
  display: flex; align-items: baseline; gap: 12px;
  font-family: var(--font-heading);
  font-size: 21px; letter-spacing: -0.02em; line-height: 1;
  color: #000;
}
.nav-logo .asterisk {
  font-family: var(--font-body);
  font-size: 25px; line-height: 1;
  letter-spacing: -0.02em; user-select: none;
  transition: transform 0.6s var(--ease-out);
}
.nav-logo:hover .asterisk { transform: rotate(180deg); }

.nav-links {
  display: none;
  align-items: baseline;
  font-size: 23px; line-height: 1; color: #000;
}
.nav-links a { transition: opacity 0.2s; }
.nav-links a:hover { opacity: 0.6; }
.nav-links a.active { text-decoration: underline; text-underline-offset: 4px; }
.nav-links .sep { user-select: none; }

.nav-cta {
  display: none;
  font-size: 23px; line-height: 1; color: #000;
  text-decoration: underline; text-underline-offset: 2px;
  transition: opacity 0.2s;
}
.nav-cta:hover { opacity: 0.6; }

/* Hamburger (mobile) */
.hamburger {
  display: flex; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 6px 0;
}
.hamburger span {
  display: block; width: 24px; height: 2px; background: #000;
  transition: transform 0.3s, opacity 0.3s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translateY(7px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translateY(-7px); }

/* Mobile overlay */
.mobile-overlay {
  position: fixed; inset: 0; z-index: 9;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 32px; gap: 32px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease-out);
}
.mobile-overlay.open { opacity: 1; pointer-events: auto; }
.mobile-overlay a {
  font-size: 32px; font-weight: 500; line-height: 1.1; color: #000;
  transform: translateY(10px); opacity: 0;
  transition: transform 0.5s var(--ease-out), opacity 0.5s var(--ease-out);
}
.mobile-overlay.open a { transform: translateY(0); opacity: 1; }
.mobile-overlay.open a:nth-child(1) { transition-delay: 0.05s; }
.mobile-overlay.open a:nth-child(2) { transition-delay: 0.1s; }
.mobile-overlay.open a:nth-child(3) { transition-delay: 0.15s; }
.mobile-overlay.open a:nth-child(4) { transition-delay: 0.2s; }
.mobile-overlay.open a:nth-child(5) { transition-delay: 0.25s; }
.mobile-overlay a.underline { text-decoration: underline; text-underline-offset: 3px; }

@media (min-width: 640px) {
  .nav { padding: 20px 32px; }
  .nav-logo { font-size: 26px; }
  .nav-logo .asterisk { font-size: 30px; }
}
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-cta { display: block; }
  .hamburger, .mobile-overlay { display: none; }
}

/* ============================================
   HERO
   ============================================ */
.hero-video {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  object-fit: cover; object-position: 70% center;
}

.hero {
  position: relative; z-index: 1;
  min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: flex-end; padding-bottom: 48px;
  padding-left: 20px; padding-right: 20px;
  overflow: hidden;
}
.hero-content { max-width: 576px; position: relative; z-index: 10; }

.blur-label {
  user-select: none;
  margin-bottom: 20px;
  font-size: clamp(18px, 4vw, 26px);
  line-height: 1.3; font-weight: 400; color: #000;
  filter: blur(4px);
  transition: filter 0.6s var(--ease-out);
  width: fit-content;
}
.blur-label:hover { filter: blur(0); }

.type-text {
  color: #000; margin-bottom: 20px;
  font-size: clamp(18px, 4vw, 26px);
  line-height: 1.35; font-weight: 400;
  min-height: 54px;
}
.cursor {
  display: inline-block; width: 2px; height: 1.1em;
  background: #000; vertical-align: middle; margin-left: 2px;
  animation: blink 1s step-end infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

/* Pills */
.pills {
  display: flex; flex-wrap: wrap; row-gap: 4px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.pills.visible { opacity: 1; transform: translateY(0); }

.pill {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.42); color: #000;
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  border: 1px solid rgba(0, 0, 0, 0.14); border-radius: 999px;
  font-size: 13px; font-family: var(--font-body);
  padding: 0.3em 16px; margin: 0 0.2em 0.4em 0.2em;
  white-space: nowrap; cursor: pointer;
  transition: background-color 0.25s, color 0.25s, border-color 0.25s;
}
.pill:first-child { margin-left: 0; }
.pill:hover { background: #000; color: #fff; border-color: #000; }

.pill-outline {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: #fff;
  border: 1px solid #fff; border-radius: 999px;
  font-size: 13px; font-family: var(--font-body);
  padding: 0.3em 16px; margin: 0 0.2em 0.4em 0.2em;
  white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.25);
}
.pill-outline:hover { background: #fff; color: #000; text-shadow: none; }
.pill-outline .email { text-decoration: underline; text-underline-offset: 1px; }
.pill-outline svg { width: 12px; height: 12px; flex: none; }

@media (min-width: 640px) {
  .hero { padding-left: 32px; padding-right: 32px; }
  .blur-label, .type-text { margin-bottom: 24px; }
  .pill, .pill-outline { font-size: 15px; padding-left: 20px; padding-right: 20px; }
  .pill-outline { gap: 12px; }
}
@media (min-width: 768px) {
  .hero { justify-content: center; padding-bottom: 0; padding-left: 40px; padding-right: 40px; }
}

/* Scroll hint */
.scroll-hint {
  position: absolute; right: 40px; bottom: 40px; z-index: 10;
  display: none; align-items: center; gap: 10px;
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: #000; opacity: 0;
  animation: hintIn 0.8s ease 1.2s forwards;
}
.scroll-hint .line {
  width: 1px; height: 44px; background: #000;
  transform-origin: top; animation: scrollLine 1.8s var(--ease-out) infinite;
}
@keyframes hintIn { to { opacity: 0.75; } }
@keyframes scrollLine { 0% { transform: scaleY(0); } 45% { transform: scaleY(1); } 100% { transform: scaleY(0); transform-origin: bottom; } }
@media (min-width: 768px) { .scroll-hint { display: flex; } }

/* ============================================
   ABOUT  (main page, below hero)
   ============================================ */
.about {
  position: relative; z-index: 2;
  background: var(--color-paper);
  padding: 96px 20px 64px;
}
.about-inner { max-width: 1080px; margin: 0 auto; }

.section-head { margin-bottom: 56px; }
.section-kicker {
  display: inline-block;
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55); margin-bottom: 14px;
}
.section-title {
  font-family: var(--font-heading);
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.05; letter-spacing: -0.02em;
}
.section-title .asterisk { letter-spacing: -0.02em; }

.about-lede {
  max-width: 720px;
  font-size: clamp(17px, 2.4vw, 22px);
  line-height: 1.6; color: #111;
  margin-bottom: 72px;
}

.about-intro {
  display: grid; grid-template-columns: 1fr;
  gap: 48px; align-items: end;
  margin-bottom: 72px;
}
.about-intro .about-lede { margin-bottom: 0; }
.portrait { max-width: 280px; justify-self: start; }
.portrait img {
  width: 100%; border-radius: 4px;
  filter: grayscale(0.8) contrast(1.03);
  transition: filter 0.6s var(--ease-out);
}
.portrait:hover img { filter: grayscale(0); }
.portrait figcaption {
  display: flex; justify-content: space-between;
  padding-top: 10px; font-size: 13px; color: rgba(0, 0, 0, 0.55);
}
@media (min-width: 900px) {
  .about-intro { grid-template-columns: 1.35fr 1fr; }
  .portrait { justify-self: end; }
}

.about-block { margin-bottom: 64px; }
.block-label {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55); margin-bottom: 8px;
}

.row {
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 0;
  border-top: 1px solid var(--color-line);
  transition: padding-left 0.35s var(--ease-out), background-color 0.35s;
}
.row:hover { padding-left: 10px; background: var(--color-ivory); }
.row:last-child { border-bottom: 1px solid var(--color-line); }
.row-main {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  font-size: 17px; line-height: 1.4;
}
.row-main .name { font-weight: 500; }
.row-main .meta { color: rgba(0, 0, 0, 0.5); font-size: 14px; white-space: nowrap; flex: none; }
.row-sub { font-size: 14px; line-height: 1.55; color: rgba(0, 0, 0, 0.6); max-width: 760px; }

@media (min-width: 640px) {
  .about { padding: 128px 32px 80px; }
  .row-main { font-size: 18px; }
}
@media (min-width: 768px) {
  .about { padding-left: 40px; padding-right: 40px; }
}

/* Contact footer */
.contact {
  position: relative; z-index: 2;
  background: var(--color-ink); color: #fff;
  padding: 96px 20px 40px;
}
.contact-inner { max-width: 1080px; margin: 0 auto; }
.contact-kicker {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55); margin-bottom: 20px;
}
.contact-title {
  font-family: var(--font-heading);
  font-size: clamp(36px, 7vw, 76px);
  line-height: 1.02; letter-spacing: -0.02em;
  margin-bottom: 40px;
}
.contact-links { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 72px; }
.contact .pill-outline { margin-left: 0; }
.contact-bottom {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 13px; color: rgba(255, 255, 255, 0.5);
}
@media (min-width: 640px) { .contact { padding: 128px 32px 48px; } }
@media (min-width: 768px) { .contact { padding-left: 40px; padding-right: 40px; } }

/* ============================================
   GALLERY PAGES
   ============================================ */
.gallery-page { background: var(--color-stone); min-height: 100vh; }
.gallery-page .nav.scrolled { background: rgba(236, 234, 231, 0.88); }

.gallery-head {
  padding: 132px 20px 40px;
  max-width: 1280px; margin: 0 auto;
}
.gallery-title {
  font-family: var(--font-heading);
  font-size: clamp(40px, 8vw, 92px);
  line-height: 1.0; letter-spacing: -0.03em;
  margin-bottom: 18px;
}
.gallery-sub {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: 15px; color: rgba(0, 0, 0, 0.55);
  padding-bottom: 24px; border-bottom: 1px solid var(--color-line);
}
.gallery-sub .en { letter-spacing: 0.06em; }

.filters { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 24px; }
.filter-chip {
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: #000;
  border: 1px solid var(--color-line); border-radius: 999px;
  font-size: 13px; font-family: var(--font-body);
  padding: 0.35em 18px; white-space: nowrap; cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.filter-chip:hover { border-color: #000; }
.filter-chip.active { background: #000; color: #fff; border-color: #000; }

.gallery-body {
  max-width: 1280px; margin: 0 auto;
  padding: 40px 20px 96px;
}
@media (min-width: 640px) {
  .gallery-head { padding: 160px 32px 48px; }
  .gallery-body { padding: 48px 32px 120px; }
}
@media (min-width: 768px) {
  .gallery-head { padding-left: 40px; padding-right: 40px; }
  .gallery-body { padding-left: 40px; padding-right: 40px; }
}

/* Masonry */
.masonry { column-count: 1; column-gap: 24px; }
@media (min-width: 700px) { .masonry { column-count: 2; } }
@media (min-width: 1100px) { .masonry { column-count: 3; } }

.card {
  break-inside: avoid; margin-bottom: 28px;
  cursor: pointer;
}
.card-media {
  overflow: hidden; border-radius: 4px; background: #eee;
  position: relative;
}
.card-media img, .card-media video {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.7s var(--ease-out), filter 0.7s var(--ease-out);
}
.card:hover .card-media img,
.card:hover .card-media video { transform: scale(1.03); }
.card-index {
  position: absolute; top: 10px; left: 12px;
  font-size: 12px; letter-spacing: 0.12em; color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
.card-badge {
  position: absolute; top: 10px; right: 12px;
  font-size: 11px; letter-spacing: 0.1em; color: #fff;
  background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(4px);
  padding: 3px 10px; border-radius: 999px;
  pointer-events: none;
}
.card-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.card-play .play-btn {
  width: 56px; height: 56px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  display: flex; align-items: center; justify-content: center;
  transform: scale(0.9); opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s;
}
.card:hover .play-btn { transform: scale(1); opacity: 1; }
.card-play svg { width: 18px; height: 18px; margin-left: 2px; }
.card-meta { padding-top: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.card-title { font-size: 16px; line-height: 1.35; font-weight: 500; }
.card-tag { font-size: 12px; color: rgba(0, 0, 0, 0.5); white-space: nowrap; flex: none; }

/* Video grid (uniform portrait cards) */
.video-grid {
  display: grid; grid-template-columns: 1fr; gap: 24px;
}
@media (min-width: 640px) { .video-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .video-grid { grid-template-columns: repeat(3, 1fr); } }
.video-grid .card { margin-bottom: 8px; }
.video-grid .card-media { aspect-ratio: 3 / 4; }
.subsection-label {
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
  margin: 64px 0 20px;
  padding-top: 24px; border-top: 1px solid var(--color-line);
}
.subsection-label:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* ============================================
   ARCHIVE TONE (images & videos pages only)
   黑白档案 · 悬停还色 · 排版降噪
   ============================================ */
.archive-tone .card-media {
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.archive-tone .card-media img,
.archive-tone .card-media video {
  filter: grayscale(0.8) contrast(1.04);
}
.archive-tone .card:hover .card-media img,
.archive-tone .card:hover .card-media video {
  filter: grayscale(0) contrast(1);
}
.archive-tone .masonry { column-gap: 28px; }
.archive-tone .masonry .card { margin-bottom: 36px; }
.archive-tone .video-grid { gap: 28px; }
.archive-tone .card-title { font-weight: 400; }
.archive-tone .card-meta { padding-top: 12px; }

/* Context block (images page) */
.context-block {
  max-width: 880px; margin-bottom: 56px;
  padding-top: 24px; border-top: 1px solid var(--color-line);
}
.context-block .block-label { margin-bottom: 14px; }
.context-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.context-stats .filter-chip { cursor: default; }
.context-stats .filter-chip:hover { border-color: var(--color-line); }

/* Design page sections */
.design-section { margin-bottom: 80px; scroll-margin-top: 110px; }
.design-section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px;
  padding-top: 24px; border-top: 1px solid var(--color-line);
  margin-bottom: 16px;
}
.design-section-head .zh { font-family: var(--font-heading); font-size: clamp(24px, 4vw, 40px); letter-spacing: -0.02em; }
.design-section-head .en { font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(0, 0, 0, 0.5); }
.section-desc {
  font-size: 15px; line-height: 1.7; color: rgba(0, 0, 0, 0.62);
  max-width: 780px; margin-bottom: 28px;
}
.slide-grid { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 768px) { .slide-grid { grid-template-columns: repeat(2, 1fr); } }
.slide-grid .card-media { aspect-ratio: 16 / 9; }

/* Back link */
.back-row { max-width: 1280px; margin: 0 auto; padding: 0 20px 80px; }
.back-link {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 17px; text-decoration: underline; text-underline-offset: 3px;
  transition: opacity 0.2s;
}
.back-link:hover { opacity: 0.6; }
@media (min-width: 640px) { .back-row { padding: 0 32px 96px; } }
@media (min-width: 768px) { .back-row { padding-left: 40px; padding-right: 40px; } }

/* ============================================
   LIGHTBOX / VIDEO MODAL
   ============================================ */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
.lightbox img {
  max-width: 92vw; max-height: 84vh; object-fit: contain;
  border-radius: 4px;
  transform: scale(0.96); transition: transform 0.35s var(--ease-out);
}
.lightbox.open img { transform: scale(1); }
.lightbox video {
  max-width: 92vw; max-height: 84vh; border-radius: 4px;
}
.lb-caption {
  position: absolute; left: 0; right: 0; bottom: 26px;
  text-align: center; color: rgba(255, 255, 255, 0.85);
  font-size: 15px; letter-spacing: 0.02em; pointer-events: none;
}
.lb-close {
  position: absolute; top: 22px; right: 26px;
  background: none; border: none; cursor: pointer;
  color: #fff; font-size: 15px; letter-spacing: 0.1em;
  font-family: var(--font-body);
  display: flex; align-items: center; gap: 8px;
  opacity: 0.8; transition: opacity 0.2s;
}
.lb-close:hover { opacity: 1; }
.lb-close svg { width: 16px; height: 16px; }
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: #fff; padding: 16px; opacity: 0.6; transition: opacity 0.2s;
}
.lb-arrow:hover { opacity: 1; }
.lb-arrow svg { width: 28px; height: 28px; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }
.lb-counter {
  position: absolute; top: 28px; left: 28px;
  color: rgba(255, 255, 255, 0.6); font-size: 13px; letter-spacing: 0.14em;
}

/* ============================================
   SCROLL REVEAL
   ============================================ */
.reveal {
  opacity: 0; transform: translateY(26px);
  transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out);
}
.reveal.in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
