/* Steam Workshop 加速入口 — 电影入场 / 文字显现 / 淡入滑入 */

/* ========== 电影感开场 ========== */
.cinema {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #000;
  color: #f2efe8;
  overflow: hidden;
  transition: opacity 0.9s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)), visibility 0.9s;
}

.cinema.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.cinema__bars {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cinema__bar {
  position: absolute;
  left: 0;
  right: 0;
  height: 13vh;
  background: #000;
  z-index: 5;
  transition: transform 1.05s cubic-bezier(0.65, 0, 0.35, 1) 0.12s;
}

.cinema__bar--top { top: 0; }
.cinema__bar--bottom { bottom: 0; }

.cinema.is-open .cinema__bar--top {
  transform: translateY(-100%);
}

.cinema.is-open .cinema__bar--bottom {
  transform: translateY(100%);
}

.cinema__grain {
  position: absolute;
  inset: -20%;
  z-index: 2;
  opacity: 0.2;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: cinema-grain 0.32s steps(2) infinite;
}

.cinema__flash {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.cinema.is-flash .cinema__flash {
  animation: cinema-flash 0.55s ease-out forwards;
}

.cinema__vignette {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: radial-gradient(ellipse at center, transparent 32%, rgba(0, 0, 0, 0.78) 100%);
  pointer-events: none;
}

.cinema__scan {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.016) 2px,
    rgba(255, 255, 255, 0.016) 4px
  );
  opacity: 0.65;
}

.cinema__beams {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.cinema__beams span {
  position: absolute;
  top: -20%;
  width: 2px;
  height: 140%;
  background: linear-gradient(180deg, transparent, rgba(224, 138, 60, 0.35), transparent);
  opacity: 0;
  transform: rotate(18deg);
}

.cinema.is-loading .cinema__beams span {
  animation: cinema-beam 1.8s ease-in-out infinite;
}

.cinema__beams span:nth-child(1) { left: 28%; animation-delay: 0s; }
.cinema__beams span:nth-child(2) { left: 52%; animation-delay: 0.35s; }
.cinema__beams span:nth-child(3) { left: 74%; animation-delay: 0.7s; }

.cinema__stage {
  position: relative;
  z-index: 6;
  text-align: center;
  padding: 24px;
  max-width: 92vw;
}

.cinema__tag {
  margin: 0 0 18px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  letter-spacing: 0.38em;
  color: rgba(242, 239, 232, 0.5);
  opacity: 0;
  transform: translateY(12px);
}

.cinema__tag.is-in {
  animation: cinema-fade-up 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cinema__title {
  margin: 0;
  font-family: var(--font-display, sans-serif);
  font-weight: 800;
  font-size: clamp(30px, 7.5vw, 72px);
  letter-spacing: 0.06em;
  line-height: 1.05;
}

.cinema__title-line {
  display: inline-block;
}

.cinema__title-line .tr-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.5em) scale(0.9);
  filter: blur(8px);
  animation: cinema-char-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--i, 0) * 100ms + 220ms);
}

.cinema__sub {
  margin: 24px 0 0;
  font-size: clamp(14px, 2.4vw, 18px);
  letter-spacing: 0.32em;
  color: rgba(242, 239, 232, 0.68);
  opacity: 0;
  transform: translateY(16px);
}

.cinema__sub.is-in {
  animation: cinema-fade-up 1s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}

.cinema__progress {
  width: min(280px, 60vw);
  height: 2px;
  margin: 38px auto 0;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  opacity: 0;
}

.cinema.is-loading .cinema__progress {
  opacity: 1;
  transition: opacity 0.4s ease;
}

.cinema__progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #e08a3c, #2fd6c0);
  box-shadow: 0 0 14px rgba(47, 214, 192, 0.5);
}

.cinema.is-loading .cinema__progress-fill {
  animation: cinema-load 2.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cinema__skip {
  position: absolute;
  right: 24px;
  bottom: 18vh;
  z-index: 8;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: transparent;
  color: rgba(242, 239, 232, 0.65);
  font-family: var(--font-body, sans-serif);
  font-size: 12px;
  letter-spacing: 0.08em;
  cursor: pointer;
  opacity: 0;
  animation: cinema-fade-up 0.6s ease 1.2s forwards;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.cinema__skip:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06);
}

@keyframes cinema-grain {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-1%, 1%); }
  50% { transform: translate(1%, -1%); }
  75% { transform: translate(-1%, -2%); }
  100% { transform: translate(2%, 1%); }
}

@keyframes cinema-flash {
  0% { opacity: 0.88; }
  100% { opacity: 0; }
}

@keyframes cinema-fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cinema-char-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes cinema-load {
  to { width: 100%; }
}

@keyframes cinema-beam {
  0%, 100% {
    opacity: 0;
    transform: translateY(8%) rotate(18deg);
  }
  40% {
    opacity: 0.7;
  }
  70% {
    opacity: 0.15;
    transform: translateY(-4%) rotate(18deg);
  }
}

/* ========== 页面内容入场 ========== */
body:not(.is-ready) .top,
body:not(.is-ready) .shell,
body:not(.is-ready) .foot {
  opacity: 0;
}

body.is-ready .top {
  animation: page-slide-down 0.95s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.is-ready .shell {
  animation: page-slide-up 1.05s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
}

body.is-ready .foot {
  animation: page-slide-up 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}

@keyframes page-slide-down {
  from {
    opacity: 0;
    transform: translateY(-24px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes page-slide-up {
  from {
    opacity: 0;
    transform: translateY(40px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes page-fade-scale {
  from {
    opacity: 0;
    transform: scale(1.04);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
}

/* ========== 滚动显现 ========== */
[data-rise],
[data-reveal],
[data-reveal-chars] {
  opacity: 0;
}

[data-rise].is-in {
  animation: rise-in 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

[data-reveal].is-in {
  animation: rise-in 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

/* ========== 逐字显现 ========== */
.tr-chars .tr-char {
  display: inline-block;
  opacity: 0;
  transform: translateY(0.4em);
  filter: blur(3px);
  animation: tr-char 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--base, 0ms) + var(--i, 0) * 36ms);
}

.tr-block.is-in {
  animation: tr-block 1.05s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes tr-char {
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes tr-block {
  from {
    opacity: 0;
    clip-path: inset(0 100% 0 0);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0);
    filter: blur(0);
  }
}

.tr-chars.is-in {
  opacity: 1 !important;
}

/* ========== 持续生动感 ========== */
body.is-ready .hero__tagline:not(.tr-chars) {
  animation: gradient-shift 8s ease-in-out infinite;
}

body.is-ready .hero__tagline .tr-char {
  animation:
    tr-char 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards,
    gradient-shift 8s ease-in-out infinite;
  animation-delay:
    calc(var(--base, 0ms) + var(--i, 0) * 36ms),
    calc(var(--base, 0ms) + var(--i, 0) * 36ms + 0.45s);
}

body.is-ready .bg__glow--a {
  animation: drift-a 14s ease-in-out infinite alternate;
}

body.is-ready .bg__glow--b {
  animation: drift-b 16s ease-in-out infinite alternate;
}

body.is-ready .stat__live {
  animation: live-blink 2.4s ease-in-out infinite;
}

body.is-ready .hero__plane::after {
  animation: ring-pulse 6s ease-in-out infinite;
}

body.is-ready .brand__name:not(.tr-chars),
body.is-ready .section__head h2:not(.tr-chars):not(.tr-block) {
  animation: text-breathe 6s ease-in-out infinite;
}

@keyframes gradient-shift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4%, 6%) scale(1.08); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-5%, -4%) scale(1.1); }
}

@keyframes live-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

@keyframes ring-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.7;
  }
}

@keyframes text-breathe {
  0%, 100% {
    letter-spacing: -0.01em;
    opacity: 1;
  }
  50% {
    letter-spacing: 0.03em;
    opacity: 0.92;
  }
}

/* ========== 减弱动效 ========== */
@media (prefers-reduced-motion: reduce) {
  .cinema,
  .cinema *,
  body.is-ready .top,
  body.is-ready .hero__copy,
  body.is-ready .hero__plane,
  body.is-ready.page-browse .browse,
  [data-rise],
  [data-reveal],
  [data-reveal-chars],
  .tr-chars .tr-char,
  .tr-block,
  .bg__glow,
  .stat__live,
  .brand__name,
  .section__head h2,
  .hero__tagline,
  .hero__plane::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
  }

  .cinema {
    display: none !important;
  }

  body.is-intro {
    overflow: auto;
  }
}
