/* ═══════════════════════════════════════════════
   yenny wang — portfolio 2025
   dark terminal aesthetic · awwwards-style
   ═══════════════════════════════════════════════ */

:root {
  --bg: #080c16;
  --bg-2: #0d1322;
  --panel: #101828;
  --line: rgba(143, 184, 248, 0.14);
  --line-strong: rgba(143, 184, 248, 0.32);
  --ink: #e4eaf6;
  --dim: #6b7fa3;
  --accent: #8fb8f8;
  --orange: #e8a33d;
  --purple: #b9a8f5;
  --green: #9fd8b4;
  --font-sans: "Space Grotesk", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "SF Mono", "PingFang SC", monospace;
  --font-serif: "Cormorant Garamond", "Songti SC", serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: clamp(20px, 5vw, 80px);
}

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

html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--bg); }

.mono { font-family: var(--font-mono); }
.dim { color: var(--dim); }
.accent { color: var(--orange); }

a { color: inherit; text-decoration: none; }
picture { display: block; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }
ul { list-style: none; }

/* ── scrollbar ── */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #1d2a44; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #2b3c60; }

/* ═══════════ PRELOADER ═══════════ */
.preloader {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column;
  justify-content: center; align-items: flex-start;
  padding: var(--pad);
}
.preloader__term { max-width: 640px; }
.preloader__line {
  font-size: clamp(13px, 1.4vw, 17px);
  margin-bottom: 14px;
  white-space: pre-wrap; word-break: break-all;
  opacity: 0;
}
.preloader__count {
  position: absolute; right: var(--pad); bottom: calc(var(--pad) - 10px);
  font-size: clamp(80px, 16vw, 220px);
  font-weight: 500; line-height: 0.9;
  color: transparent;
  -webkit-text-stroke: 1px var(--line-strong);
}
.preloader__bar {
  position: absolute; left: 0; bottom: 0;
  width: 100%; height: 2px; background: var(--line);
}
.preloader__bar span {
  display: block; width: 0%; height: 100%;
  background: var(--accent);
}
.blink { animation: blink 0.8s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ═══════════ CURSOR ═══════════ */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  .cursor { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 999; }
  .cursor__dot {
    position: absolute; width: 6px; height: 6px;
    background: var(--accent); border-radius: 50%;
    transform: translate(-50%, -50%);
  }
  .cursor__ring {
    position: absolute; width: 36px; height: 36px;
    border: 1px solid var(--line-strong); border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex; align-items: center; justify-content: center;
    transition: width 0.35s var(--ease-out), height 0.35s var(--ease-out),
                background-color 0.35s, border-color 0.35s;
  }
  .cursor__label {
    font-size: 11px; color: var(--bg); opacity: 0;
    transition: opacity 0.25s; white-space: nowrap;
  }
  .cursor--hover .cursor__ring { width: 64px; height: 64px; border-color: var(--accent); }
  .cursor--label .cursor__ring {
    width: 84px; height: 84px;
    background: var(--accent); border-color: var(--accent);
  }
  .cursor--label .cursor__label { opacity: 1; }
  .cursor--label .cursor__dot { opacity: 0; }
  .cursor--down .cursor__ring { transform: translate(-50%, -50%) scale(0.85); }
}

/* ═══════════ PROGRESS / NAV ═══════════ */
.scroll-progress {
  position: fixed; top: 0; left: 0; width: 100%; height: 2px;
  z-index: 200; pointer-events: none;
}
.scroll-progress span {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--orange));
  transform-origin: left; transform: scaleX(0);
}

.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px var(--pad);
  mix-blend-mode: difference; color: #dfe8f8;
  opacity: 0;
}
.nav__logo { display: flex; align-items: center; gap: 12px; }
.wave-mark { width: 60px; height: auto; }
.nav__domain { font-size: 13px; letter-spacing: 0.04em; }
.nav__links { display: flex; gap: clamp(14px, 2.4vw, 34px); font-size: 13px; }
.nav__links a { position: relative; padding: 4px 2px; }
.nav__links a::after {
  content: ""; position: absolute; left: 0; bottom: 0;
  width: 100%; height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__meta { font-size: 12px; }
@media (max-width: 640px) { .nav__meta { display: none; } }

/* ═══════════ HERO ═══════════ */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--pad) + 40px) var(--pad) 0;
  overflow: hidden;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, black 20%, transparent 75%);
  opacity: 0.5;
}
.hero__corner { position: absolute; top: 100px; right: var(--pad); text-align: right; font-size: 14px; line-height: 1.7; z-index: 2; }
.hero__term { position: relative; z-index: 2; max-width: 420px; }
.hero__term-line { font-size: clamp(12px, 1.3vw, 15px); min-height: 1.6em; color: #9fb4d8; }
.hero__term-line--quote { color: var(--ink); }
.hero__term-line .typed-caret { color: var(--orange); }

.hero__center { position: relative; z-index: 2; text-align: center; margin-top: -6vh; }
.hero__mark { width: clamp(240px, 30vw, 420px); height: auto; color: var(--ink); margin: 0 auto 18px; }
.hero__sub { font-size: clamp(13px, 1.5vw, 17px); letter-spacing: 0.06em; }
.hero__roles { margin-top: 10px; font-size: clamp(11px, 1.1vw, 13px); letter-spacing: 0.12em; }
.hero__roles em { color: var(--orange); font-style: normal; margin: 0 4px; }

.hero__title {
  position: relative; z-index: 1;
  font-weight: 300; text-align: center;
  font-size: clamp(64px, 17.5vw, 300px);
  line-height: 0.82; letter-spacing: -0.02em;
  text-transform: lowercase;
  margin: 0 -2vw -0.1em;
  user-select: none;
}
.hero__title-inner { display: inline-block; }
.hero__title .char {
  display: inline-block;
  background: linear-gradient(180deg, #b8d2f5 20%, #4a6ea8 65%, #1a2a4a 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__scrollhint {
  position: absolute; bottom: 26px; left: var(--pad);
  z-index: 2; font-size: 12px; letter-spacing: 0.1em;
}
.scroll-arrow { display: inline-block; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ═══════════ MARQUEE ═══════════ */
.marquee {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  overflow: hidden; padding: 18px 0;
  background: var(--bg-2);
}
.marquee__track { display: flex; align-items: center; gap: 34px; width: max-content; will-change: transform; }
.marquee__track span {
  font-size: clamp(18px, 2.6vw, 30px); font-weight: 500;
  letter-spacing: 0.02em; white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px #47608f;
  transition: color 0.3s;
}
.marquee__track span:hover { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.marquee__track i { color: var(--orange); font-style: normal; font-size: 18px; }

/* ═══════════ SECTIONS COMMON ═══════════ */
.section { position: relative; padding: calc(var(--pad) * 1.6) var(--pad); scroll-margin-top: 60px;
  /* 大屏限宽：内容区最大 1440px，背景仍全幅 */
  padding-inline: max(var(--pad), calc((100% - 1440px) / 2)); }
.project { scroll-margin-top: 60px; }
.section__path { font-size: 13px; margin-bottom: 26px; }
.section__title {
  font-weight: 400; letter-spacing: -0.02em;
  font-size: clamp(44px, 8vw, 120px);
  line-height: 1;
}
.section__title .char { display: inline-block; }

/* ═══════════ ABOUT ═══════════ */
.about { background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%); }
.about__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: clamp(36px, 6vw, 80px); }
.about__zh { font-size: clamp(15px, 1.8vw, 20px); }

.about__portrait { grid-area: portrait; position: relative; }
.about__portrait img {
  aspect-ratio: 3/4; border-radius: 10px;
  border: 1px solid var(--line);
  filter: saturate(0.92);
  transition: filter 0.5s, transform 0.6s var(--ease-out);
}
.about__portrait:hover img { filter: saturate(1.1); transform: translateY(-6px); }

/* ═══════════ WORKS ═══════════ */
.works__head { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: clamp(40px, 7vw, 100px); }
.works__count { font-size: 13px; }

.project { position: relative; padding: clamp(50px, 8vw, 120px) 0; border-top: 1px solid var(--line); }
.project__head { position: relative; margin-bottom: clamp(28px, 4vw, 56px); }
.project__index {
  position: absolute; top: -0.35em; right: 0; z-index: 0;
  font-size: clamp(90px, 16vw, 240px); font-weight: 500; line-height: 1;
  color: transparent; -webkit-text-stroke: 1px rgba(143, 184, 248, 0.2);
  user-select: none; pointer-events: none;
}
.project__title { position: relative; z-index: 1; font-weight: 500; letter-spacing: -0.02em; line-height: 1.02; font-size: clamp(40px, 7.2vw, 104px); }
.project__title-main .char, .project__title-sub .char { display: inline-block; }
.project__title--serif { font-family: var(--font-serif); font-style: italic; font-weight: 500; letter-spacing: 0; }
.project__title-sub { font-size: 0.6em; }
.project__title--green { color: var(--green); }
.project__tagline { position: relative; z-index: 1; margin-top: 14px; font-size: clamp(14px, 1.7vw, 19px); color: var(--dim); }
.project__tagline--script { font-family: var(--font-serif); font-style: italic; font-size: clamp(18px, 2.4vw, 28px); color: var(--accent); margin-top: 18px; }
.project__tagline--purple { color: var(--purple); }
.project__tags { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.project__tags li {
  font-size: 11.5px; padding: 6px 14px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--accent); letter-spacing: 0.04em;
  transition: background 0.3s, color 0.3s;
}
.project__tags li:hover { background: var(--accent); color: var(--bg); }

.img-frame {
  position: relative; overflow: hidden; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel);
  display: block;
}
.img-frame img { will-change: transform; height: auto; }
.img-frame--video { aspect-ratio: 16/9; }
.img-frame--video iframe { display: block; width: 100%; height: 100%; border: 0; }
.img-frame__cap {
  position: absolute; left: 14px; bottom: 12px; z-index: 2;
  font-size: 11.5px; padding: 6px 12px;
  background: rgba(8, 12, 22, 0.72); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 999px;
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.4s, transform 0.4s var(--ease-out);
}
.img-frame:hover .img-frame__cap { opacity: 1; transform: translateY(0); }

.project__hero { margin-bottom: clamp(28px, 4vw, 56px); }
.project__body { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 4vw, 64px); margin-bottom: clamp(28px, 4vw, 56px); }
@media (max-width: 860px) { .project__body { grid-template-columns: 1fr; } }
.project__col-title { font-size: 13.5px; margin-bottom: 18px; letter-spacing: 0.04em; }
.project__list li { font-size: 14.5px; padding: 10px 0; border-bottom: 1px dashed var(--line); color: #b8c4dc; }
.project__list li strong { color: var(--ink); font-weight: 600; }
.project__text { font-size: 15px; line-height: 1.95; color: #b8c4dc; }
.project__text b { color: var(--ink); font-weight: 600; }
.project__note { margin-top: 18px; font-size: 12.5px; line-height: 1.9; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 18px 14px; text-align: center; background: var(--bg-2); }
.stat__num { font-size: clamp(30px, 4vw, 48px); font-weight: 600; color: var(--accent); line-height: 1; }
.stat__unit { font-size: 14px; color: var(--orange); margin-left: 2px; }
.stat p { font-size: 11px; margin-top: 8px; line-height: 1.5; }

.project__gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; }
.project__img--wide { grid-column: 1 / -1; }
.project__img--tall { grid-row: span 2; aspect-ratio: auto; min-height: 100%; }
@media (max-width: 700px) {
  .project__gallery { grid-template-columns: 1fr; }
  .project__img--wide, .project__img--tall { grid-column: auto; grid-row: auto; min-height: 0; }
}

/* 等高横向滚动画廊（projects 区）：画框用内联 aspect-ratio 定宽，img 填满画框，避免 Safari flex 下按原图宽度撑开画框 */
.project__gallery--row {
  display: flex; align-items: flex-start;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  padding-bottom: 10px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
  /* 出血到视口右缘：截断发生在屏幕边缘而非正文栏边缘，明确"可左滑"的观感 */
  width: calc(100% + max(var(--pad), calc((100vw - 1440px) / 2)));
  padding-right: max(var(--pad), calc((100vw - 1440px) / 2));
  /* 右缘渐隐：提示后面还有图可滑 */
  -webkit-mask-image: linear-gradient(90deg, #000 84%, transparent 99%);
  mask-image: linear-gradient(90deg, #000 84%, transparent 99%);
}
.project__gallery--row .project__img {
  flex: 0 0 auto; height: clamp(200px, 24vw, 300px); scroll-snap-align: start;
}
.project__gallery--row .project__img img { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 700px) {
  .project__gallery--row .project__img { height: clamp(140px, 40vw, 200px); }
}

.project__links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 26px; margin-top: clamp(24px, 3vw, 40px); font-size: 13.5px; }
.project__links a { color: var(--accent); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; transition: color 0.3s, border-color 0.3s; }
.project__links a:hover { color: var(--orange); border-color: var(--orange); }
.project__exhibitions { margin-top: clamp(24px, 3vw, 40px); font-size: 12.5px; line-height: 2; }
.project__exhibitions span { color: var(--accent); }

/* ═══════════ CONTACT ═══════════ */
.contact {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(180deg, var(--bg-2) 0%, #05080f 100%);
  overflow: hidden; position: relative;
  padding-bottom: 0;
}
.contact__center { position: relative; z-index: 2; text-align: center; padding-top: clamp(30px, 6vw, 80px); }
.contact__mark { width: clamp(200px, 24vw, 340px); height: auto; margin: 0 auto 22px; }
.contact__thanks { font-size: clamp(15px, 1.8vw, 20px); letter-spacing: 0.08em; }
.contact__cta {
  margin-top: clamp(24px, 4vw, 48px);
  font-size: clamp(26px, 4.6vw, 64px);
  font-weight: 500; line-height: 1.25; letter-spacing: -0.01em;
}
.contact__cta em { font-style: normal; }
.contact__links { display: flex; flex-direction: column; gap: 14px; align-items: center; margin-top: clamp(28px, 4vw, 52px); font-size: clamp(13px, 1.6vw, 17px); }
.contact__links a { color: var(--accent); transition: color 0.3s; }
.contact__links a:hover { color: var(--orange); }
.contact__giant {
  position: relative; z-index: 1;
  font-size: clamp(70px, 18.5vw, 320px);
  font-weight: 300; line-height: 0.8; text-align: center;
  letter-spacing: -0.02em; user-select: none;
  margin: 40px -2vw -0.16em;
  color: rgba(143, 184, 248, 0.07);
}
.footer {
  position: relative; z-index: 2;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 22px 0; border-top: 1px solid var(--line);
  font-size: 12px;
}
.footer a { color: var(--accent); }

/* ═══════════ 2026 RESTRUCTURE ═══════════ */
:root { --pink: #f7a8c4; }

.overline { font-size: 12.5px; letter-spacing: 0.05em; margin-bottom: 18px; position: relative; z-index: 1; }
.overline .accent { margin-right: 8px; }

/* about */
.about__grid {
  display: grid; gap: clamp(20px, 3vw, 40px);
  grid-template-columns: minmax(280px, 360px) 1fr;
  grid-template-areas: "portrait strengths";
  align-items: start;
}
.about__grid .about__visual { grid-area: portrait; position: relative; }
.about__prompt {
  position: relative; z-index: 2; margin: -72px 0 12px 18px;
  border: 1px dashed var(--line-strong); border-radius: 10px; padding: 14px 16px; font-size: 12px;
  background: rgba(8, 12, 22, 0.78); backdrop-filter: blur(8px);
}
.about__prompt-out { margin-top: 10px; font-size: clamp(13px, 1.3vw, 16px); color: var(--accent); line-height: 1.7; }
.caret { color: var(--orange); animation: blink 0.9s steps(1) infinite; }
.about__cap { margin: 2px 0 0 4px; font-size: 11.5px; }
.about__strengths { grid-area: strengths; align-self: center; display: grid; }
.strength {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px;
  padding: clamp(20px, 2.6vw, 34px) 4px;
  border-top: 1px solid var(--line);
  transition: padding-left 0.35s var(--ease-out), border-color 0.3s;
}
.strength:last-child { border-bottom: 1px solid var(--line); }
.strength:hover { padding-left: 16px; border-color: var(--line-strong); }
.strength h4 { font-size: clamp(15px, 1.6vw, 18px); letter-spacing: 0.03em; transition: color 0.3s; }
.strength:hover h4 { color: var(--accent); }
.strength h4 .accent { margin-right: 12px; }
.strength:hover h4 .accent { color: var(--orange); }
.strength .project__tags { margin-left: auto; }
.about__strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(18px, 3vw, 40px);
  margin-top: clamp(32px, 5vw, 60px); padding-top: clamp(24px, 3vw, 40px);
  border-top: 1px solid var(--line); font-size: 12.5px; line-height: 2.1;
}
.about__strip h4 { font-size: 12px; margin-bottom: 10px; letter-spacing: 0.08em; }
@media (max-width: 900px) {
  .about__grid { grid-template-columns: 1fr; grid-template-areas: "portrait" "strengths"; }
  .about__grid .about__visual { max-width: 320px; }
  .about__strip { grid-template-columns: 1fr; }
}

/* projects sub-structure */
.subhead { font-size: 14px; letter-spacing: 0.06em; margin: clamp(30px, 5vw, 70px) 0 clamp(20px, 3vw, 36px); }
.project--condensed { padding-bottom: clamp(30px, 4vw, 60px); }
.project__title--pink { color: var(--pink); }
.project__tagline--pink { color: var(--pink); }

/* mini cards */
.mini-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(14px, 2vw, 26px); align-items: start; }
.mini-card {
  display: block; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: var(--bg-2); transition: transform 0.5s var(--ease-out), border-color 0.3s, box-shadow 0.5s;
}
.mini-card:hover { transform: translateY(-8px); border-color: var(--line-strong); box-shadow: 0 30px 60px -30px rgba(0,0,0,0.7); }
.mini-card__img { border: none; border-radius: 0; aspect-ratio: 16/10; }
.mini-card__img img { height: 100%; object-fit: contain; }
.mini-card__img--video { aspect-ratio: 16/9; }
.mini-card__img--video iframe { display: block; width: 100%; height: 100%; border: 0; }
.mini-card__body { padding: 18px 20px 20px; }
.mini-card__body h4 { font-size: 16.5px; font-weight: 600; margin-bottom: 8px; }
.mini-card__body h4 .dim { font-weight: 400; font-size: 13px; }
.mini-card__body > .dim { font-size: 13px; line-height: 1.8; }
.mini-card__link { margin-top: 14px; font-size: 12px; color: var(--accent); transition: color 0.3s; }
.mini-card:hover .mini-card__link { color: var(--orange); }
.mini-card__term {
  aspect-ratio: 16/10; padding: 20px; font-size: 12.5px; line-height: 2.2;
  background: #060a12; border-bottom: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: center;
}
.mini-card__term p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 700px) { .mini-grid { grid-template-columns: 1fr; } }

.contact__loc { margin-top: 26px; font-size: 12.5px; letter-spacing: 0.06em; }

[data-reveal] { opacity: 0; transform: translateY(46px); }
[data-reveal="clip"] { opacity: 1; transform: none; clip-path: inset(12% 6% 12% 6% round 12px); }
[data-reveal="clip"] img { transform: scale(1.25); }
.no-js [data-reveal], .no-anim [data-reveal] { opacity: 1 !important; transform: none !important; clip-path: none !important; }
.no-js [data-reveal="clip"] img, .no-anim [data-reveal="clip"] img { transform: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  [data-reveal] { opacity: 1; transform: none; clip-path: none; }
  [data-reveal="clip"] img { transform: none; }
}
