@import url("./tokens.css");

* {
  box-sizing: border-box;
}

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  scroll-padding-top: 118px;
}

body {
  position: relative;
  isolation: isolate;
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  background:
    radial-gradient(ellipse at 18% -8%, var(--glow-warm-spot), transparent 34rem),
    radial-gradient(ellipse at 86% 8%, var(--glow-cool), transparent 42rem),
    linear-gradient(180deg, var(--bg-lift), var(--bg) 38rem, var(--bg-deep));
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background:
    radial-gradient(circle at 16% 14%, var(--glow-warm-soft), transparent 14rem),
    radial-gradient(ellipse at 70% 24%, var(--glow-warm-soft), transparent 22rem),
    radial-gradient(ellipse at 86% 76%, var(--spot-light), transparent 26rem);
  filter: none;
  opacity: .22;
  transform: translate3d(0, 0, 0);
  animation: opticalDrift 42s var(--ease) infinite alternate;
}

body::after {
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.74' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.42'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: .08;
  mix-blend-mode: soft-light;
  animation: grainShift 14s steps(2, end) infinite;
}

body.is-media-playing::before,
body.is-media-playing::after,
body.is-media-playing .grainient-background {
  animation: none;
}

body.is-media-playing::before {
  opacity: .12;
}

body.is-media-playing::after {
  opacity: .035;
}

.grainient-background {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  opacity: .34;
  mix-blend-mode: normal;
}

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

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.site-header,
.page,
.footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border-soft);
  background:
    linear-gradient(180deg, var(--header-shine), transparent),
    var(--header-bg);
  backdrop-filter: blur(24px) saturate(112%);
  -webkit-backdrop-filter: blur(24px) saturate(112%);
}

body.is-media-playing .site-header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.nav {
  position: relative;
  width: min(var(--max), calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
}

.site-header .brand {
  display: none;
}

.brand {
  display: inline-grid;
  gap: 3px;
}

.brand strong {
  color: var(--fg-strong);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 610;
  letter-spacing: 0.01em;
}

.brand span {
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: 520;
  letter-spacing: 0.07em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 520;
}

.nav-links a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 17px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  transition: color 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), transform 180ms var(--ease);
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--fg-strong);
  border-color: var(--border-soft);
  background: var(--button-bg);
  transform: translateY(-1px);
}

.nav-toggle {
  min-height: 40px;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--fg-strong);
  background: var(--button-bg);
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  width: 16px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.nav-toggle-icon {
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before {
  top: -5px;
}

.nav-toggle-icon::after {
  top: 5px;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav-menu {
  display: none;
}

.page {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.page:has(.case-layout) {
  width: min(calc(100% - 40px), calc(1024px + 500px + 192px));
}

.hero,
.case-hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  align-items: center;
  padding: 54px 0 64px;
}

.reel-hero {
  scroll-margin-top: 92px;
  padding-bottom: 120px;
}

.hero::before,
.case-hero::before {
  content: "";
  position: absolute;
  inset: 4% -11% auto 38%;
  height: min(74%, 620px);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 42% 48%, var(--glow-warm), transparent 48%),
    radial-gradient(ellipse at 70% 34%, var(--glow-brown), transparent 46%);
  filter: blur(64px);
  opacity: .86;
  transform: translate3d(0, 0, 0);
  animation: lensBreath 18s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: -1;
}

body.is-media-playing .hero::before,
body.is-media-playing .case-hero::before {
  animation: none;
  filter: blur(24px);
  opacity: .35;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(560px, 1.85fr);
  align-items: center;
  gap: clamp(40px, 5.2vw, 86px);
}

.hero-scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 14px;
  width: min(72vw, 1180px);
  height: 72px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  color: rgb(184, 178, 160);
  opacity: var(--scroll-cue-opacity, 1);
  text-decoration: none;
  transition: opacity 120ms linear;
  z-index: 2;
}

.hero-scroll-cue::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  transform: translateY(0);
  background: linear-gradient(180deg,
    rgba(166, 160, 141, .38),
    rgb(112, 107, 96) 58%,
    rgba(28, 28, 24, .30) 100%);
  -webkit-mask-image: linear-gradient(90deg,
      transparent,
      rgba(0, 0, 0, .04) 14%,
      rgba(0, 0, 0, .18) 25%,
      rgba(0, 0, 0, .56) 39%,
      #000 calc(50% - 22px),
      transparent calc(50% - 7px),
      transparent calc(50% + 7px),
      #000 calc(50% + 22px),
      rgba(0, 0, 0, .56) 61%,
      rgba(0, 0, 0, .18) 75%,
      rgba(0, 0, 0, .04) 86%,
      transparent);
  mask-image: linear-gradient(90deg,
      transparent,
      rgba(0, 0, 0, .04) 14%,
      rgba(0, 0, 0, .18) 25%,
      rgba(0, 0, 0, .56) 39%,
      #000 calc(50% - 22px),
      transparent calc(50% - 7px),
      transparent calc(50% + 7px),
      #000 calc(50% + 22px),
      rgba(0, 0, 0, .56) 61%,
      rgba(0, 0, 0, .18) 75%,
      rgba(0, 0, 0, .04) 86%,
      transparent);
  box-shadow: 0 -1px 0 rgba(24, 24, 20, .34);
  filter: drop-shadow(0 0 2px rgba(217, 205, 166, .06));
  z-index: 3;
}

.hero-scroll-cue::after {
  content: none;
}

.hero-scroll-cue .cue-light {
  position: absolute;
  left: 50%;
  top: calc(50% - 44px);
  width: min(42vw, 540px);
  height: 44px;
  transform: translateX(-50%);
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.hero-scroll-cue .cue-light::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -10px;
  width: 100%;
  height: 54px;
  transform: translateX(-50%);
  background:
    radial-gradient(ellipse 58% 62% at 50% 96%,
      rgba(192, 185, 164, .30),
      rgba(192, 185, 164, .13) 27%,
      rgba(192, 185, 164, .05) 52%,
      transparent 78%);
  filter: blur(7px);
  opacity: .88;
  animation: scrollCueLightBreath 2s var(--ease) infinite;
}

.hero-scroll-cue svg {
  position: relative;
  width: 26px;
  height: 15px;
  transform: translateY(2px);
  overflow: visible;
  animation: scrollCueBreath 2s var(--ease) infinite;
  color: rgb(170, 164, 148);
  z-index: 4;
}

.hero-scroll-cue path {
  fill: currentColor;
}

.hero-scroll-cue .cue-glow {
  opacity: .18;
  transform: scale(1.18);
  transform-origin: center;
  filter: blur(2px) drop-shadow(0 0 7px rgba(192, 185, 164, .20));
}

.hero-scroll-cue .cue-mark {
  opacity: 1;
  filter: drop-shadow(0 0 2px rgba(192, 185, 164, .24));
}

.reel-hero + .section {
  border-top-color: transparent;
}

.reel-hero + .section::before {
  top: -56px;
  opacity: .72;
}

.hero-scroll-cue:hover {
  color: rgb(184, 178, 160);
}

.hero-scroll-cue:focus-visible {
  outline: 1px solid var(--border);
  outline-offset: 8px;
  border-radius: 999px;
}

.hero-copy,
.case-copy {
  display: grid;
  gap: 24px;
  align-content: start;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--fg-strong);
  font-family: var(--font-display);
  font-weight: 610;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

h1 {
  max-width: 13ch;
  font-size: clamp(45px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.hero-copy h1 {
  max-width: 15ch;
  white-space: pre-line;
}

h2 {
  font-size: clamp(30px, 3.4vw, 43px);
  line-height: 1.12;
}

h3 {
  font-size: 23px;
  line-height: 1.22;
}

p {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  /* 贪心填充：每行填满到右边缘再断；pretty 会回流缩短前面的行，
     对中文表现为「行没到边缘就断、留出空白」 */
  text-wrap: wrap;
}

.lead {
  color: var(--c-cream-dim);
  font-size: 16px;
  font-weight: 450;
  line-height: 1.6;
}

.hero-copy .lead {
  max-width: 100%;
  white-space: pre-line;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 520;
  letter-spacing: 0.08em;
}

.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--border-eyebrow);
}

.meta-strip,
.hero-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.tag,
.button {
  border-radius: var(--radius-sm);
  letter-spacing: 0.02em;
}

.tag {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border: 1px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--tag-text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 520;
  white-space: nowrap;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  background: var(--button-bg);
  color: var(--fg-strong);
  box-shadow: inset 0 1px 0 var(--surface-specular);
  transition: transform 180ms var(--ease), border-color 180ms var(--ease), background 180ms var(--ease), color 180ms var(--ease);
}

.button:hover {
  border-color: var(--border-strong);
  background: var(--button-hover-bg);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink-on-accent);
}

.media-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 46%),
    var(--surface);
  box-shadow: 0 30px 80px var(--shadow);
}

.media-frame:has(video) {
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round var(--radius));
  box-shadow: none;
  transform: none;
}

.media-top,
.video-caption {
  display: flex;
  gap: 16px;
  color: var(--media-top);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.07em;
}

.media-top {
  align-items: center;
  justify-content: flex-start;
  padding: 15px 16px;
  border-bottom: 1px solid var(--border-soft);
}

.media-top span:nth-child(2) {
  margin-left: auto;
}

.video-plate,
.clip-thumb,
.project-media {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
}

.video-plate.has-video,
.clip-thumb.has-video,
.project-media.has-video {
  isolation: isolate;
  contain: paint;
  transform: none;
}

.video-plate.has-video,
.project-media.has-video {
  clip-path: inset(0 round var(--radius-sm));
}

.video-plate,
.clip-thumb {
  background: var(--media-empty-bg);
}

.project-media {
  background:
    radial-gradient(ellipse at 68% 24%, var(--glow-brown), transparent 32%),
    linear-gradient(180deg, var(--video-bg-start), var(--video-bg-mid) 58%, var(--video-bg-end));
}

.video-plate {
  aspect-ratio: 16 / 9;
  margin: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border-media);
  background: var(--media-empty-bg);
}

.video-plate img,
.video-plate video,
.clip-thumb img,
.clip-thumb video,
.video-preview img,
.project-media img,
.project-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: none;
}

.media-frame:has(video) video,
.video-plate.has-video > video,
.clip-thumb.has-video > video,
.project-media.has-video > video {
  position: relative;
  z-index: 1;
  isolation: isolate;
  contain: paint;
  transform: none;
}

.video-preview {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--media-empty-bg);
  color: inherit;
  overflow: hidden;
}

.video-preview::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: 46px;
  height: 46px;
  border: 1px solid var(--feature-button-border);
  border-radius: var(--radius-circle);
  background: var(--feature-button-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transform: translate(-50%, -50%);
}

.video-preview::after {
  content: "";
  position: absolute;
  left: calc(50% + 2px);
  top: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid var(--fg-strong);
  transform: translate(-50%, -50%);
}

.video-preview:hover::before {
  border-color: var(--feature-button-border-hover);
  background: var(--button-hover-bg);
}

.video-state-toggle {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 4;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-circle);
  background: transparent;
  box-shadow: none;
  color: var(--fg-strong);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transform: translate(-50%, -50%) scale(.96);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

.video-state-toggle::after {
  content: "";
  position: absolute;
  left: calc(50% + 3px);
  top: 50%;
  width: 0;
  height: 0;
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  border-left: 16px solid var(--fg-strong);
  transform: translate(-50%, -50%);
}

.video-plate.is-video-paused .video-state-toggle,
.clip-thumb.is-video-paused .video-state-toggle,
.project-media.is-video-paused .video-state-toggle {
  border-color: var(--feature-button-border-hover);
  background: var(--feature-button-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 16px 34px var(--shadow-strong);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transform: translate(-50%, -50%) scale(1);
}

.video-state-toggle:hover {
  border-color: var(--accent);
  background: var(--button-hover-bg);
}

@media (hover: none), (pointer: coarse), (max-width: 640px) {
  .video-plate.is-video-paused .video-state-toggle,
  .clip-thumb.is-video-paused .video-state-toggle,
  .project-media.is-video-paused .video-state-toggle {
    display: none;
  }
}

.video-plate.has-video .video-caption,
.video-plate.has-video-preview .video-caption,
.video-plate.is-empty .video-caption {
  display: none;
}

.video-caption {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  align-items: end;
  justify-content: space-between;
}

.section {
  position: relative;
  isolation: isolate;
  padding: 88px 0;
  border-top: 1px solid var(--border-soft);
}

.section::before {
  content: "";
  position: absolute;
  inset: 0 calc(50% - 50vw);
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 12%, var(--glow-warm-weaker), transparent 32rem),
    radial-gradient(ellipse at 86% 78%, var(--glow-brown), transparent 28rem);
  opacity: .9;
  pointer-events: none;
}

.compact-section {
  padding: 74px 0;
}

.section-head {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(280px, .48fr);
  gap: 32px;
  align-items: end;
  margin-bottom: 30px;
}

.section-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -16px;
  height: 1px;
  background: linear-gradient(90deg, var(--section-head-line), transparent);
}

.clip-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.clip-card,
.credit-card,
.resume-card,
.project-row,
.system-panel,
.audio-module,
.case-summary,
.contact-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 46%),
    var(--surface);
  box-shadow: 0 22px 60px var(--shadow);
}

.credit-card {
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 46%),
    var(--surface);
}

.clip-card {
  min-height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  isolation: isolate;
  box-shadow: none;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), background 220ms var(--ease), box-shadow 220ms var(--ease);
}

.clip-card:hover,
.clip-card.is-active,
.credit-card:hover {
  border-color: var(--border-strong);
  background:
    linear-gradient(180deg, var(--clip-hover-shine), transparent 48%),
    var(--surface-soft);
  box-shadow: 0 26px 72px var(--shadow-card-hover);
  transform: translateY(-3px);
}

.clip-card:hover,
.clip-card.is-active {
  box-shadow: 0 12px 34px var(--shadow-card-hover);
}

.clip-card.has-inline-video,
.clip-card.has-inline-video:hover,
.clip-card.has-inline-video.is-active {
  border-color: var(--border);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 46%),
    var(--surface);
  box-shadow: none;
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round var(--radius));
  transform: none;
}

.clip-thumb {
  aspect-ratio: 16 / 9;
  width: 100%;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  z-index: 1;
}

.clip-thumb.has-video {
  contain: paint;
  isolation: isolate;
  clip-path: inset(0);
  transform: none;
}

.clip-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 18% 20%, var(--glow-warm-soft), transparent 28%),
    linear-gradient(180deg, transparent, var(--clip-thumb-vignette));
  opacity: .55;
  pointer-events: none;
}

.clip-thumb.has-video::after {
  content: none;
}

.clip-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  align-content: start;
  padding: 22px;
}

.clip-body h3 {
  color: var(--fg-strong);
  font-size: 22px;
}

.clip-body p {
  color: var(--muted);
  font-size: 15px;
  font-weight: 450;
  line-height: 1.58;
}

.clip-meta {
  display: grid;
  gap: 8px;
  margin: 0;
}

.clip-meta div {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 21px;
}

.clip-meta dt {
  display: flex;
  align-items: center;
  color: var(--quiet);
  font-size: 15px;
  font-weight: 480;
  letter-spacing: 0;
  line-height: 21px;
}

.clip-meta dd {
  display: flex;
  align-items: center;
  margin: 0;
  color: var(--fg);
  font-size: 15px;
  font-weight: 540;
  line-height: 21px;
}

.credit-grid,
.resume-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.resume-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.credit-card,
.resume-card {
  display: grid;
  gap: 16px;
  align-content: start;
  padding: 28px;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease), background 220ms var(--ease);
}

.credit-card {
  grid-template-rows: auto auto 1fr auto;
}

.credit-card h2,
.credit-card h3 {
  color: var(--fg-strong);
}

.credit-card p {
  color: var(--fg);
  max-width: none;
}

.credit-card strong {
  align-self: end;
  color: var(--fg-strong);
  font-weight: 590;
}

.credit-year {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 520;
  letter-spacing: .08em;
}

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 46px;
  align-items: end;
}

.about-copy {
  display: grid;
  gap: 22px;
  min-width: 0;
}

.about-copy p {
  max-width: none;
  white-space: nowrap;
}

.about-action {
  justify-self: end;
  min-width: 190px;
}

.resume-hero {
  min-height: 62vh;
}

.case-hero {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(420px, 1fr);
  gap: clamp(34px, 5vw, 74px);
  align-items: center;
  padding: 74px 0 70px;
}

.case-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.case-summary div {
  min-height: 112px;
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 20px;
  border-right: 1px solid var(--border-soft);
}

.case-summary div:last-child {
  border-right: 0;
}

.case-summary span {
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: 520;
  letter-spacing: .08em;
}

.case-summary strong {
  color: var(--fg-strong);
  font-weight: 580;
  line-height: 1.46;
}

.resume-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.resume-card h3 {
  color: var(--fg-strong);
}

.resume-card li {
  position: relative;
  padding-left: 16px;
  color: var(--muted);
}

.resume-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bullet-bg);
}

.contact-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 30px;
}

.contact-panel p {
  max-width: 60ch;
  color: var(--muted);
}

.footer {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--quiet);
  border-top: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 520;
  letter-spacing: .07em;
}

.footer a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.js-reveal .reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 700ms var(--ease), transform 700ms var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.js-reveal .reveal-item.is-visible {
  opacity: 1;
  transform: none;
}

/* =========================================================
   Case pages — shared layout / typography helpers
   ========================================================= */
.case-layout {
  display: grid;
  /* 正文列居中；TOC 作为左侧辅助层，不参与正文视觉重心 */
  grid-template-columns: minmax(170px, 250px) minmax(0, 1024px) minmax(170px, 250px);
  column-gap: clamp(72px, 5.6vw, 96px);
  row-gap: 28px;
  justify-content: center;
  align-items: start;
  padding: 24px 0 8px;
}

.case-toc {
  grid-column: 1;
  min-width: 0;
  position: sticky;
  top: 92px;
  overflow: hidden;
  padding: 6px 0 24px;
}

.case-toc .toc-label {
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: 520;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.case-toc .toc-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  gap: 2px;
  min-width: 0;
}

.case-toc .toc-list > li {
  min-width: 0;
}

.case-toc .toc-list > li > a {
  display: block;
  overflow: hidden;
  padding: 9px 12px 9px 14px;
  border-left: 1px solid var(--border-soft);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.case-toc .toc-list > li > a:hover {
  color: var(--fg-strong);
  background: var(--surface-soft);
  border-left-color: var(--border-strong);
}

.case-toc .toc-list > li > a[aria-current="true"] {
  color: var(--fg-strong);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.case-toc .toc-num {
  color: var(--quiet);
  margin-right: 10px;
}

/* 子章节：默认收起，仅当父级章节 current 时展开 */
.case-toc .toc-list > li > .toc-sub {
  list-style: none;
  margin: 2px 0 4px;
  padding: 0;
  display: none;
  gap: 0;
}

.case-toc .toc-list > li:has(> .toc-sub > li > a[aria-current="true"]) > .toc-sub {
  display: grid;
}

.case-toc .toc-sub a {
  display: block;
  overflow: hidden;
  padding: 6px 12px 6px 48px;
  border-left: 1px solid transparent;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: 520;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
  transition: color 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease);
}

.case-toc .toc-sub a:hover {
  color: var(--fg-strong);
  background: var(--surface-soft);
  border-left-color: var(--border-strong);
}

.case-toc .toc-sub a[aria-current="true"] {
  color: var(--fg-strong);
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.case-doc {
  grid-column: 2;
  min-width: 0;
}

.page-header {
  position: relative;
  display: grid;
  /* 与 .case-layout 同一套栅格：标题内容落在居中的正文列 */
  grid-template-columns: minmax(170px, 250px) minmax(0, 1024px) minmax(170px, 250px);
  column-gap: clamp(72px, 5.6vw, 96px);
  justify-content: center;
  padding: 48px 0 28px;
  border-bottom: 1px solid var(--border-soft);
  overflow: visible;
}

.page-header > * {
  grid-column: 2;
  min-width: 0;
}

.page-header > :not(.case-header-art) {
  position: relative;
  z-index: 1;
}

.page-header .case-header-art {
  position: absolute;
  top: -76px;
  right: 8px;
  width: min(56vw, 780px);
  max-width: none;
  height: auto;
  opacity: 1;
  -webkit-mask-image:
    linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent),
    linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent),
    linear-gradient(180deg, transparent, #000 10%, #000 90%, transparent);
  mask-composite: intersect;
  pointer-events: none;
  z-index: 0;
}

body[data-case-key="animm"] .page-header .case-header-art {
  top: 42px;
  right: 286px;
  width: min(30vw, 360px);
  -webkit-mask-image: none;
  mask-image: none;
}

.page-header h1 {
  max-width: none;
  font-size: clamp(34px, 4.4vw, 52px);
  line-height: 1.08;
  letter-spacing: -0.018em;
  margin-bottom: 20px;
}

.page-header .lead {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.68;
  max-width: none;
  white-space: pre-line;
}

.page-header .meta-strip {
  margin-top: 18px;
}

.case-section {
  padding: 56px 0;
  border-top: 1px solid var(--border-soft);
  scroll-margin-top: 92px;
}

.case-section:first-child {
  border-top: 0;
  padding-top: 12px;
}

.case-section h2 {
  margin-bottom: 18px;
  letter-spacing: -0.012em;
}

.case-section h3[id] {
  scroll-margin-top: 118px;
}

.case-section > h3 {
  color: var(--fg-strong);
  font-size: 22px;
  line-height: 1.28;
  margin: 44px 0 12px;
}

/* 让正文 h3 更明确地统领下方段落/媒体，避免贴近上一组内容 */
.case-section > h3 + .media-embed,
.case-section > h3 + .figure-grid,
.case-section > h3 + .pipeline,
.case-section > h3 + .module-grid,
.case-section > h3 + .patch-tabs {
  margin-top: 10px;
}

.case-section p {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.72;
  margin-bottom: 16px;
  /* 填满正文列（列宽已封顶 1024px），不再卡在半列宽换行 */
  max-width: none;
}

.case-section .lead-doc {
  color: var(--c-cream-dim);
  font-size: 17.5px;
  line-height: 1.66;
  margin-bottom: 22px;
  max-width: none;
  white-space: pre-line;
}

.doc-note {
  box-sizing: border-box;
  display: inline-block;
  width: max-content;
  max-width: none;
  color: var(--quiet);
  font-size: 14px;
  line-height: 1.6;
  padding: 12px 16px;
  border-left: 1px solid var(--border-eyebrow);
  background: var(--surface-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin: 18px 0;
  white-space: pre;
}

.case-section p.doc-note {
  max-width: none;
}

/* 正文内短语按中文自然断行；不再强制 nowrap，
   否则行尾放不下整句时会整块跳行、留出莫名的空白 */
.keep {
  white-space: normal;
}

.media-embed {
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 46%),
    var(--surface);
  box-shadow: 0 18px 48px var(--shadow);
  margin: 24px 0 28px;
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0;
}

.figure-grid.cols-1 {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
}

.media-embed:has(video),
.media-embed:has(iframe) {
  position: relative;
  isolation: isolate;
  contain: paint;
  clip-path: inset(0 round var(--radius));
  box-shadow: none;
  transform: none;
}

.media-embed video {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.media-embed img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  object-position: center;
  background: color-mix(in srgb, var(--surface) 78%, var(--c-cream) 22%);
}

.case-viewable-image {
  cursor: zoom-in;
}

.case-viewable-image:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.media-embed:has(video) video,
.media-embed:has(iframe) iframe {
  position: relative;
  z-index: 1;
  isolation: isolate;
  contain: paint;
  transform: none;
}

.media-embed .embed-cap {
  padding: 10px 14px 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  letter-spacing: 0.02em;
  border-top: 1px solid var(--border-soft);
  white-space: pre-line;
}

.music-player {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 52%),
    var(--surface-soft);
}

.single-audio-player {
  width: 100%;
  margin: 16px 0 24px;
}

.mp-body {
  display: grid;
  gap: 13px;
  min-width: 0;
}

.mp-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mp-title {
  color: var(--fg-strong);
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 610;
  letter-spacing: -0.01em;
  line-height: 24px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.mp-meta .music-tag {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 24px;
  letter-spacing: 0;
}

.mp-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mp-play {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--button-bg);
  color: var(--fg-strong);
  box-shadow: inset 0 1px 0 var(--surface-specular);
  transition: border-color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.mp-play:hover {
  border-color: var(--border-strong);
  background: var(--button-hover-bg);
  transform: translateY(-1px);
}

.mp-play svg {
  width: 16px;
  height: 16px;
  display: block;
}

.mp-play .icon-pause {
  display: none;
}

.music-player.is-playing .mp-play .icon-play {
  display: none;
}

.music-player.is-playing .mp-play .icon-pause {
  display: block;
}

.mp-progress {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.mp-bar {
  position: relative;
  flex: 1 1 auto;
  height: 4px;
  min-width: 0;
  border-radius: 999px;
  background: var(--border-soft);
  cursor: pointer;
}

.mp-bar::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}

.mp-bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: var(--accent);
}

.mp-time {
  flex: none;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.music-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.music-tag .dot {
  flex: none;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--c-muted);
  transform: translateY(1px);
}

.cover-stub {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 8px;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  letter-spacing: 0.04em;
  text-align: center;
}

.music-player audio {
  display: none;
}

.audio-line {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  margin: 16px 0;
  max-width: 640px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface-top-shine), transparent 58%),
    var(--surface);
  box-shadow: inset 0 1px 0 var(--surface-specular);
}

.audio-line .audio-name {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.audio-line audio {
  flex: 1 1 auto;
  min-width: 0;
}

.asset-stub {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 22px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--quiet);
  text-align: center;
}

.asset-stub .stub-kind {
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  font-weight: 520;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.asset-stub .stub-path {
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  letter-spacing: 0.02em;
  color: var(--quiet);
  word-break: break-all;
  max-width: 92%;
}

html.is-image-viewer-open,
body.is-image-viewer-open {
  overflow: hidden;
}

.image-viewer[hidden] {
  display: none;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: clamp(18px, 3vw, 42px);
  overscroll-behavior: contain;
  touch-action: none;
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 28, 24, .85);
}

.image-viewer-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 1480px);
  max-height: calc(100vh - clamp(36px, 6vw, 84px));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
}

.image-viewer-panel img {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  justify-self: center;
  align-self: center;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 78%, var(--c-cream) 22%);
  box-shadow: 0 28px 80px var(--shadow-strong);
}

.image-viewer-panel video {
  width: min(100%, 1280px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 170px);
  justify-self: center;
  align-self: center;
  object-fit: contain;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 78%, var(--c-cream) 22%);
  box-shadow: 0 28px 80px var(--shadow-strong);
}

.image-viewer-caption {
  justify-self: center;
  max-width: min(100%, 92ch);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--type-sm);
  letter-spacing: 0.02em;
  text-align: center;
  white-space: pre-line;
}

@media (max-width: 1100px) {
  .case-layout {
    grid-template-columns: 1fr;
  }

  .case-toc,
  .case-doc {
    grid-column: auto;
  }

  .page-header {
    display: block;
  }

  .page-header .case-header-art {
    display: none;
  }

  .case-toc {
    position: static;
    max-height: none;
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 18px;
  }

  .case-toc .toc-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .case-toc .toc-list > li > a {
    border-left: 0;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    padding: 7px 11px;
  }

  .case-toc .toc-sub {
    display: none;
  }
}

@media (max-width: 640px) {
  .page-header {
    padding: 36px 0 24px;
  }

  .case-section {
    padding: 40px 0;
  }

  .music-player {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .audio-line {
    flex-wrap: wrap;
  }

  .audio-line .audio-name {
    width: 100%;
  }
}

@keyframes opticalDrift {
  from { transform: translate3d(-1.2%, -0.8%, 0) scale(1); }
  to { transform: translate3d(1.3%, 1.1%, 0) scale(1.035); }
}

@keyframes lensBreath {
  from { opacity: .56; transform: translate3d(-1%, 0, 0) scale(.98); }
  to { opacity: .92; transform: translate3d(1%, 1%, 0) scale(1.04); }
}

@keyframes scrollCueBreath {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(.7); }
}

@keyframes scrollCueLightBreath {
  0%, 100% { opacity: .88; }
  50% { opacity: .62; }
}

@keyframes grainShift {
  0% { transform: translate3d(0, 0, 0); }
  50% { transform: translate3d(-1%, .8%, 0); }
  100% { transform: translate3d(.8%, -1%, 0); }
}

@media (max-width: 1100px) {
  .hero-grid,
  .case-hero {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }



  .clip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-copy p {
    white-space: normal;
  }
}

@media (max-width: 820px) {
  .nav {
    min-height: 64px;
    justify-content: flex-end;
    padding: 12px 0;
  }

  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    position: absolute;
    top: calc(100% - 6px);
    right: 0;
    width: min(280px, calc(100vw - 24px));
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    background:
      linear-gradient(180deg, var(--surface-specular), transparent),
      var(--shell-bg-solid);
    box-shadow: 0 24px 60px var(--shadow-strong);
  }

  .nav-menu[hidden] {
    display: none;
  }

  .nav-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 14px;
    font-weight: 560;
  }

  .nav-menu a:hover,
  .nav-menu a[aria-current="page"] {
    color: var(--fg-strong);
    border-color: var(--border-soft);
    background: var(--button-bg);
  }

  .section-head,
  .about-grid,
  .credit-grid,
  .resume-grid,
  .case-summary {
    grid-template-columns: 1fr;
  }

  .case-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--border-soft);
  }

  .case-summary div:last-child {
    border-bottom: 0;
  }

  .contact-panel {
    align-items: flex-start;
    flex-direction: column;
  }

  .about-action {
    justify-self: start;
  }
}

@media (max-width: 640px) {
  .page,
  .nav,
  .footer {
    width: min(100% - 24px, var(--max));
  }

  h1 {
    font-size: clamp(38px, 13vw, 50px);
    max-width: 11ch;
  }

  .hero-copy h1 {
    max-width: 13ch;
  }

  h2 {
    font-size: 30px;
  }

  .hero,
  .case-hero,
  .section,
  .compact-section {
    padding: 48px 0;
  }

  .hero-copy,
  .case-copy {
    gap: 20px;
  }

  .lead {
    font-size: 16px;
  }

  .clip-grid {
    grid-template-columns: 1fr;
  }

  .clip-card {
    grid-template-rows: auto 1fr;
  }

  .clip-body,
  .credit-card,
  .resume-card,
  .contact-panel {
    padding: 20px;
  }

  .video-plate {
    margin: 10px;
  }

  .media-top,
  .video-caption,
  .footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .media-top span:nth-child(2) {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }

  .js-reveal .reveal-item {
    opacity: 1;
    transform: none;
  }

  .hero-scroll-cue svg,
  .hero-scroll-cue .cue-light::before {
    animation-duration: 2s !important;
    animation-iteration-count: infinite !important;
  }
}
