/* =============================================================================
 *  styles.css
 *  纯黑 / 极小号大写字体 / 大量留白 / 一屏一个作品
 * ========================================================================== */

:root {
  --bg: #000;
  --ink: #fff;
  --dim: rgba(255, 255, 255, 0.34);
  --pad: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --micro: 11.5px;
  --track: 0.06em;
  /* iPhone 的刘海和底部指示条 */
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (min-width: 768px) { :root { --pad: 22px; } }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
}

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: "Helvetica Neue", Inter, Archivo, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--micro);
  line-height: 1.34;
  letter-spacing: var(--track);
  text-transform: uppercase;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  cursor: grab;
  /* 切换作品是竖向拖动，不能让它顺手选中文字 */
  -webkit-user-select: none;
  user-select: none;
}

body:active { cursor: grabbing; }

#header { -webkit-user-select: text; user-select: text; }

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

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

button {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* 极淡颗粒，避免纯黑显得像没加载出来 ------------------------------------- */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 5;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* 两块画布：首页的影像 / 作品的影像墙 ------------------------------------ */
#frame, #trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 0.8s var(--ease);
}

#frame { z-index: 1; opacity: 0; }
#trail { z-index: 2; opacity: 1; }

body.is-work #frame { opacity: 1; }
body.is-work #trail { opacity: 0; }

/* =============================================================================
 *  顶部信息栏
 * ========================================================================== */

#header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  padding: calc(var(--pad) + var(--safe-t)) var(--pad) var(--pad);
  mix-blend-mode: difference;
  pointer-events: none;
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}

#header > * { pointer-events: auto; }

.head-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .head-grid {
    grid-template-columns: 20% 48% 32%;
    gap: 0;
    align-items: start;
  }
}

.head-name h1 {
  display: inline-block;
  margin: 0;
  font-size: clamp(19px, 1.55vw, 27px);
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
}

.head-name .cn {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.5;
  letter-spacing: 0.08em;
  line-height: 1;
}

.head-mid { min-width: 0; }
@media (min-width: 768px) { .head-mid { padding-right: 40px; } }

#siteBio { margin: 0 0 8px; opacity: 0.5; max-width: 46em; }

.head-actions { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; }
.head-actions .dash { display: none; margin: 0 4px; }
@media (min-width: 768px) { .head-actions .dash { display: inline; } }

.linkish { display: inline-block; transition: opacity 0.25s var(--ease); }
.linkish:hover { opacity: 0.5; }

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
}

.filter { opacity: 0.32; transition: opacity 0.25s var(--ease); }
.filter:hover { opacity: 0.7; }
.filter.is-on { opacity: 1; }
.filter-sep { opacity: 0.18; }

.head-right { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }

@media (min-width: 768px) {
  .head-right { margin-top: 0; align-items: flex-end; text-align: right; }
}

.head-right a { opacity: 0.85; transition: opacity 0.25s var(--ease); }
.head-right a:hover { opacity: 0.5; }

/* =============================================================================
 *  作品信息（左侧）
 * ========================================================================== */

.pinfo {
  position: fixed;
  left: var(--pad);
  top: 50%;
  z-index: 30;
  max-width: 34vw;
  transform: translateY(-50%) translateY(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease), transform 0.8s var(--ease), visibility 0.7s;
}

body.is-work .pinfo {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%);
}

.p-client, .p-title {
  margin: 0;
  font-size: clamp(15px, 1.28vw, 20px);
  font-weight: 500;
  line-height: 1.24;
  letter-spacing: 0.015em;
  text-transform: uppercase;
}

.p-title { opacity: 0.92; }

.pill {
  display: inline-block;
  margin-top: 16px;
  padding: 8px 13px 7px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.72);
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.pill:hover { background: rgba(255, 255, 255, 0.17); color: #fff; }

.pill-solid { background: rgba(255, 255, 255, 0.9); color: #000; margin-top: 0; }
.pill-solid:hover { background: #fff; color: #000; }

/* =============================================================================
 *  底栏
 * ========================================================================== */

.bar {
  position: fixed;
  left: var(--pad);
  right: var(--pad);
  bottom: calc(var(--pad) + 43px + 12px + var(--safe-b));
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.bar > * { pointer-events: auto; }

.bar-left {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.55;
  white-space: nowrap;
}

.bar-mid {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.6s var(--ease), transform 0.7s var(--ease), visibility 0.6s;
}

body.is-work .bar-mid {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dot { opacity: 0.5; }
.bar-left.no-sound .dot { display: none; }

.scroll-hint {
  margin-left: 2px;
  transition: opacity 0.5s var(--ease);
}

body.is-work .scroll-hint,
body.is-work .hint-line { display: none; }

.sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.25s var(--ease);
}

.sound:hover { opacity: 1; }
.sound .note { display: inline-block; }
.sound.is-off { opacity: 0.45; }
.sound.is-off .note { text-decoration: line-through; }

.icon-btn { display: block; padding: 8px 7px; line-height: 0; opacity: 0.85; transition: opacity 0.25s; }
.icon-btn:hover { opacity: 1; }
.icon-btn svg { width: 10px; height: 12px; fill: currentColor; display: block; }
.icon-btn .ic-play { display: none; }

body.is-paused .icon-btn .ic-play,
.player.is-paused .icon-btn .ic-play { display: block; }

body.is-paused .icon-btn .ic-pause,
.player.is-paused .icon-btn .ic-pause { display: none; }

/* =============================================================================
 *  作品胶片条（一直自动向左滚动，鼠标移上去暂停）
 * ========================================================================== */

.filmstrip {
  position: fixed;
  left: var(--pad);
  right: var(--pad);
  bottom: calc(var(--pad) + var(--safe-b));
  z-index: 30;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}

.filmstrip-track {
  display: flex;
  gap: 2px;
  width: max-content;
  will-change: transform;
}

.film-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 76px;
  height: 43px;
  overflow: hidden;
  background: #0a0a0a;
  opacity: 0.32;
  transition: opacity 0.4s var(--ease);
}

.film-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.film-thumb img.is-vert { object-position: 50% 15%; }
.film-thumb:hover { opacity: 0.7; }
.film-thumb.is-active { opacity: 1; }

/* =============================================================================
 *  首页提示
 * ========================================================================== */

.hint-line {
  display: block;
  width: 46px;
  height: 1px;
  background: rgba(255, 255, 255, 0.25);
  overflow: hidden;
  position: relative;
}

.hint-line i {
  position: absolute;
  inset: 0 auto 0 0;
  width: 14px;
  background: #fff;
  animation: slide 2.4s var(--ease) infinite;
}

@keyframes slide {
  0% { transform: translateX(-16px); }
  60%, 100% { transform: translateX(48px); }
}

/* =============================================================================
 *  入场页（只在浏览器拦截了自动播放时出现）
 * ========================================================================== */

.entry {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}

.entry.is-open { opacity: 1; visibility: visible; }

.entry-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.entry-name {
  font-size: clamp(20px, 1.9vw, 30px);
  font-weight: 500;
  letter-spacing: 0.04em;
}

.entry-btn { padding: 10px 22px 9px; }

/* =============================================================================
 *  全屏播放器
 * ========================================================================== */

.player {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}

.player.is-open { opacity: 1; visibility: visible; }

.player-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: var(--pad);
  flex: 0 0 auto;
}

.player-stage {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 var(--pad);
}

.player-stage video,
.player-stage iframe {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  border: 0;
  background: #000;
}

.player-stage video { object-fit: contain; }

.player-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--pad) calc(var(--pad) + 2px);
}

.player-foot.is-hidden { display: none; }
.player-foot .icon-btn { padding: 6px 5px; }

.time { opacity: 0.5; font-variant-numeric: tabular-nums; min-width: 34px; }
.time:last-child { text-align: right; }

.progress { flex: 1 1 auto; padding: 8px 0; cursor: pointer; }

.progress-track { height: 1px; background: rgba(255, 255, 255, 0.3); transition: height 0.2s var(--ease); }
.progress:hover .progress-track { height: 2px; }
.progress-fill { height: 100%; width: 0; background: #fff; }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  background: #000;
  padding: 24px;
  text-align: center;
}

/* =============================================================================
 *  入场 / 展开
 * ========================================================================== */

body.is-loading #header,
body.is-loading .bar-left,
body.is-loading .filmstrip { opacity: 0; }

body.is-expanded #header,
body.is-expanded .pinfo,
body.is-expanded .filmstrip {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* =============================================================================
 *  移动端
 * ========================================================================== */

@media (max-width: 767px) {
  .head-grid { gap: 10px; }
  .head-name h1 { font-size: 21px; }
  #siteBio { max-width: 100%; line-height: 1.4; }
  .head-actions { gap: 12px; }
  .filters { margin-top: 9px; }
  .head-right { flex-direction: row; flex-wrap: wrap; gap: 12px; margin-top: 9px; }

  .film-thumb { width: 54px; height: 31px; }

  .bar { bottom: calc(var(--pad) + 31px + 10px + var(--safe-b)); }

  .pinfo {
    top: auto;
    bottom: calc(var(--pad) + 31px + 10px + 40px + var(--safe-b));
    max-width: 62vw;
    transform: translateY(10px);
  }
  body.is-work .pinfo { transform: translateY(0); }

  .bar-mid { display: none; }
}

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