@font-face { font-family: "Noto Sans SC"; src: url("assets/fonts/noto-sans-sc.woff2") format("woff2"); font-weight: 300 600; font-display: swap; }
@font-face { font-family: "Noto Serif SC"; src: url("assets/fonts/noto-serif-sc.woff2") format("woff2"); font-weight: 500; font-display: swap; }
/* 作品集 · 项目导航、详情与图片展廊 */
@scope (.portfolio-stage-view) {
*, *::before, *::after { box-sizing: border-box; }
.stage :where(h2, p, figure) { margin: 0; }
.stage:focus-visible { outline: 1px solid var(--blue-hi); outline-offset: -3px; }

/* ---------- work stages ---------- */
.stages {
  position: fixed; inset: 0; z-index: 10; overflow: hidden auto;
  overscroll-behavior: contain; scroll-snap-type: y mandatory; scrollbar-width: none;
}
.stage {
  position: relative; height: 100%; scroll-snap-align: start; touch-action: pan-y;
  display: grid; grid-template-columns: minmax(190px, 22vw) minmax(0, 1fr);
  align-items: center; gap: clamp(20px, 3vw, 48px);
  padding: 82px var(--pad) 58px var(--pad);
}
.stage-copy {
  max-width: 36ch; opacity: var(--intro-opacity, 1);
  user-select: none;
}
.stage-copy h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(25px, 2.8vw, 44px); letter-spacing: .035em; line-height: 1.2;
}
.en { margin-top: 9px; font-size: 11px; letter-spacing: .18em; color: var(--dim); }
.pitch { margin-top: 18px; font-size: 14px; line-height: 1.9; color: var(--ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.tags span { font-size: 10px; padding: 4px 7px; border: 1px solid var(--line); color: var(--dim); }
.cta { display: inline-block; margin-top: 16px; font-size: 12px; color: var(--blue-hi); text-underline-offset: 5px; }

/* ---------- gallery entry ---------- */
.gallery-guide {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 7px 12px; margin-top: clamp(14px, 1.8vw, 24px);
}
.gallery-entry, .gallery-return {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  border: 1px solid #659fe68c; border-radius: 2px;
  background: linear-gradient(135deg, #26487bdb, #132949e8);
  color: #e5f1ff; font: 500 12px/1.2 var(--sans);
  cursor: pointer;
}
.gallery-entry { padding: 0 11px; min-height: 34px; }
.gallery-entry span, .gallery-return span { color: var(--blue-hi); font-size: 17px; }
.gallery-entry:hover, .gallery-return:hover { border-color: #92ceff; background: #284f86; }
.gallery-entry:focus-visible, .gallery-return:focus-visible {
  outline: 1px solid #a8d4ff; outline-offset: 3px;
}
.gallery-gesture { color: var(--dim); font-size: 11px; }
.gallery-return {
  position: absolute; z-index: 3; left: clamp(14px, 4vw, 64px); bottom: clamp(14px, 4svh, 38px);
  width: 40px; height: 36px;
}
.gallery-return[hidden] { display: none; }
@media (max-width: 650px) {
  .gallery-guide { margin-top: 10px; }
  .gallery-entry, .gallery-return { min-height: 36px; }
}

/* ---------- video and portrait images ---------- */
.rail {
  position: relative; display: flex; align-items: center; gap: clamp(14px, 2vw, 30px);
  height: min(66svh, 720px); overflow: hidden;
  overscroll-behavior-x: contain; scrollbar-width: none;
  cursor: grab; user-select: none;
}
.rail::-webkit-scrollbar, .stages::-webkit-scrollbar { display: none; }
.stage.is-dragging, .stage.is-dragging .rail { cursor: grabbing; }
.rail figure {
  position: relative; flex: 0 0 auto; overflow: hidden;
  border: 1px solid var(--line); background: #060d1f;
}
.rail img, .rail video { display: block; width: 100%; height: 100%; object-fit: contain; }
.rail-video { width: 100%; height: 100%; border-radius: 6px; }
.rail-video video { background: #030712; }
.rail-shot {
  width: min(32%, 320px, 45svh); aspect-ratio: 3 / 4; border-radius: 6px;
}
.stage-copy, .rail { translate: var(--intro-shift, 0) 0; }
.rail { opacity: var(--intro-opacity, 1); }
.stage-gallery {
  position: absolute; inset: 0; z-index: 2; overflow: hidden;
  opacity: var(--gallery-opacity, 0); pointer-events: none;
}
.stage-gallery canvas {
  display: block; width: 100%; height: 100%;
  mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent);
}
.gallery-markers {
  position: absolute; inset: auto 0 clamp(16px, 4svh, 38px);
  display: flex; justify-content: center; align-items: center; gap: 7px;
}
.gallery-markers span {
  width: 5px; height: 3px; border-radius: 9px; background: #8fb9f84d;
  transition: width 240ms ease, background 240ms ease;
}
.gallery-markers .is-current {
  width: 16px; background: #b8d8ff; box-shadow: 0 0 8px #609dff70;
}
.stage.is-gallery { cursor: grab; }
.stage.is-gallery.is-dragging { cursor: grabbing; }
.hint {
  position: fixed; left: var(--pad); bottom: 18px; z-index: 24;
  font-size: 11px; letter-spacing: .08em; color: var(--dim); pointer-events: none;
}

@media (max-width: 780px) {
  .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    align-content: center; gap: 12px; padding: 81px var(--pad) 38px;
  }
  .stage-copy { max-width: none; }
  .stage-copy h2 { font-size: 22px; }
  .en { margin-top: 4px; font-size: 10px; }
  .pitch { margin-top: 7px; font-size: 12px; line-height: 1.55; }
  .tags { gap: 3px; margin-top: 6px; }
  .tags span { padding: 2px 4px; }
  .rail { height: 100%; }
  .rail-shot { width: min(63%, 35svh); }
  .hint { left: var(--pad); bottom: 11px; font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .stage-copy, .cat img, .gallery-markers span { transition: none; }
}

.play {
  position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%);
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid #c7ddff9c;
  color: #f4f8ff; background: #061126bd; backdrop-filter: blur(6px);
  font-size: 19px; cursor: pointer; padding-left: 3px;
}
.play:hover, .play:focus-visible { background: #173765; }

}

#portfolio-detail {
  --ink: #dce9ff;
  --dim: #a7bde2;
  --line: #4274cb52;
  --blue-hi: #a8d4ff;
  --pad: clamp(18px, 3vw, 48px);
  --sans: "Noto Sans SC", "Microsoft YaHei UI", system-ui, sans-serif;
  --serif: "Noto Serif SC", "Microsoft YaHei UI", serif;
  position: fixed; inset: 78px 0 0; z-index: 12;
  font-family: var(--sans); color: var(--ink); pointer-events: none;
}
#portfolio-detail[hidden] { display: none; }
#portfolio-detail .stages { position: absolute; pointer-events: auto; }
#portfolio-detail .stage {
  grid-template-columns: minmax(0, .39fr) minmax(0, 1fr);
  align-content: center;
  align-items: start;
  gap: clamp(14px, 1.8vw, 34px);
  padding: 0 16vw 48px 16vw;
}
#portfolio-detail .stage-copy {
  align-self: start;
  max-width: none;
  padding: clamp(14px, 1.5vw, 25px);
  border: 1px solid #3768ba80;
  background: linear-gradient(160deg, #1b2d59e8, #101c3bdd);
  clip-path: polygon(12px 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%,0 12px);
}
#portfolio-detail .stage-copy h2 { font-size: clamp(21px, 2.1vw, 36px); }
#portfolio-detail .pitch { line-height: 1.65; }
#portfolio-detail .rail { height: min(58svh, 32vw); }
#portfolio-detail .rail-video { height: auto; max-height: 100%; aspect-ratio: 5 / 3; border-radius: 0; }
#portfolio-detail .rail-shot { width: min(31%, 330px); }
#portfolio-detail .stage-photos .rail-shot { width: min(43%, 39svh, 390px); }
#portfolio-detail .hint { display: none; }

@media (max-width: 950px) {
  #portfolio-detail .stage { padding-right: 18px; padding-left: 18px; }
}
@media (max-width: 650px) {
  #portfolio-detail { top: 60px; }
  #portfolio-detail .stage {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    padding: 0 14px 22px;
  }
  #portfolio-detail .stage-copy { padding: 10px; }
  #portfolio-detail .stage-copy h2 { font-size: 20px; }
  #portfolio-detail .rail { height: min(42svh, 65vw); }
  #portfolio-detail .rail-shot, #portfolio-detail .stage-photos .rail-shot { width: min(57%, 30svh); }
}


#portfolio-detail .detail-exit {
  position: fixed; top: 11px; right: 9px; z-index: 24;
  width: 66px; height: 61px; padding: 0; border: 0;
  background: transparent; cursor: pointer; pointer-events: auto;
}
#portfolio-detail .detail-exit:focus-visible { outline: 1px solid var(--blue-hi); outline-offset: -6px; }
@media (max-width: 650px) {
  #portfolio-detail .detail-exit {
    top: 10px; right: 10px; width: 44px; height: 44px;
    color: var(--ink); border: 1px solid #3768ba80; background: #122449;
  }
  #portfolio-detail .detail-exit::before { content: "×"; font: 29px/1 system-ui, sans-serif; }
}

.portfolio-stage-view.is-project-detail {
  --project-index-width: clamp(110px, 10vw, 164px);
  --project-index-left: clamp(12px, 1.55vw, 30px);
  --project-content-left: calc(var(--project-index-width) + var(--project-index-left));
}

.is-project-detail .project-index {
  position: fixed; z-index: 22; top: calc(50% + 25px); left: var(--project-index-left);
  translate: 0 -50%; width: var(--project-index-width);
  max-height: calc(100dvh - 110px); padding: 10px 6px 10px 0;
  overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: none;
  border-left: 1px solid #3c6db36e;
  background: linear-gradient(90deg, #0c1b3ae8, #0b1733be 72%, #0a15316b);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
  pointer-events: auto;
}
.is-project-detail .project-index::-webkit-scrollbar { display: none; }
.is-project-detail .project-index button {
  position: relative; display: block; width: 100%; min-height: 28px;
  padding: 5px 5px 5px 13px; border: 0; border-radius: 0;
  color: #aac2e6; background: transparent; text-align: left;
  font: 500 clamp(11px, .9vw, 14px)/1.35 var(--sans);
  cursor: pointer; overflow-wrap: anywhere;
}
.is-project-detail .project-index button:hover,
.is-project-detail .project-index button[aria-current="true"] {
  color: #f0f7ff;
  background: linear-gradient(90deg, #28519580, #1c39634d 72%, transparent);
}
.is-project-detail .project-index button[aria-current="true"]::before {
  content: ""; position: absolute; inset: 4px auto 4px 0;
  width: 2px; background: #92ceff; box-shadow: 0 0 8px #6bbaffbb;
}
.is-project-detail .project-index button:focus-visible {
  outline: 1px solid var(--blue-hi); outline-offset: -2px;
}

.is-project-detail .project-stages { left: var(--project-content-left); }
.portfolio-stage-view:not(#portfolio-detail) .project-stages,
.portfolio-stage-view:not(#portfolio-detail) .stage-boundary { top: 76px; }
.is-project-detail .project-stages .stage,
#portfolio-detail .project-stages .stage {
  display: block; padding: 0; overflow: clip; perspective: 1150px;
}
.project-stages .stage-face {
  position: relative; display: grid; height: 100%;
  grid-template-columns: minmax(0, .39fr) minmax(0, 1fr);
  align-content: center; align-items: start;
  gap: clamp(14px, 1.8vw, 34px);
  padding: 0 clamp(20px, 6.5vw, 128px) 48px;
}
.project-stages .stage-photos .rail { justify-content: center; }
#portfolio-detail .project-stages .stage-photos .rail-shot {
  width: min(44%, 38svh, 24vw);
  max-height: 100%;
}
.project-stages .stage-face.is-turning {
  transform: translate3d(0, var(--facet-rise), var(--facet-depth))
    rotateX(var(--facet-angle)) rotateZ(var(--facet-bank));
  opacity: var(--facet-light);
}
.is-project-detail .stage-boundary {
  position: fixed; inset: 0 0 0 var(--project-content-left); z-index: 19;
  overflow: hidden; pointer-events: none;
}
#portfolio-detail .stage-boundary { position: absolute; }
.stage-boundary::before {
  content: ""; position: absolute; inset: 0 -3% auto;
  height: 48px; translate: 0 calc(var(--boundary-y, 0px) - 24px);
  rotate: var(--boundary-angle, 0deg);
  opacity: var(--boundary-light, 0);
  background:
    linear-gradient(90deg, transparent, #487bb333 18%, #80c5ffbc 55%, #487bb355 87%, transparent)
      center / 100% 1px no-repeat,
    linear-gradient(180deg, transparent, #296ed827 49%, #173c731c 51%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 14%, #000 88%, transparent);
}

@media (max-width: 950px) {
  .project-stages .stage-face { padding-inline: clamp(12px, 3vw, 30px); }
}
@media (max-width: 650px) {
  .portfolio-stage-view.is-project-detail {
    --project-index-width: 84px;
    --project-index-left: 6px;
  }
  .is-project-detail .project-index { padding-right: 3px; }
  .is-project-detail .project-index button { min-height: 31px; padding-inline: 7px 2px; font-size: 10px; }
  .project-stages .stage-face {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto;
    padding: 0 10px 22px;
  }
  #portfolio-detail .project-stages .rail { height: min(36svh, calc((100vw - 110px) * .65)); }
  .project-stages .stage-photos .rail-shot + .rail-shot { display: none; }
  #portfolio-detail .project-stages .stage-photos .rail-shot { width: min(68%, 27svh, 47vw); }
  .project-stages .gallery-markers {
    inset: min(95%, calc(48% + (100vw - 90px) * .52 + 24px)) 0 auto;
  }
}
@media (prefers-reduced-motion: reduce) {
  .stage-boundary { display: none; }
  .project-stages .stage-face.is-turning { opacity: 1; transform: none; }
}
