/* ==========================================================================
   安科科学梦之队 · Recruitment keynote — CINEMA layer
   One pinned stage; the wheel drives the scenes instead of moving the page.
   Everything here is progressive: without html.cinema (reduced motion, very
   short screens, ?static) the acts simply stack as full-height sections.
   ========================================================================== */

.theatre { position: relative; }
.stage { position: relative; isolation: isolate; }
.stage__stars { position: absolute; z-index: 0; left: 0; top: 0; width: 100%; height: 100vh; opacity: .9; pointer-events: none; }
.act { position: relative; z-index: 1; }
.act__kicker { display: flex; width: max-content; margin: 0 auto 40px; }
.act__subtitle { margin: 0 auto; }
.fx, .scrollcue, .spark, .rail { display: none; }
.hero { background: transparent; }

/* ---------- meteor title (both modes) ---------- */
.meteor { position: relative; }
.meteor__kicker { display: flex; width: max-content; margin: 0 auto 28px; }
.meteor__title {
  margin: 0; font-family: var(--f-display); font-weight: 400; color: #fff;
  font-size: clamp(50px, 8.6vw, 142px); line-height: 1.02; letter-spacing: -.035em;
}
html[data-lang="zh"] .meteor__title { font-family: var(--f-zh); font-weight: 800; font-size: clamp(40px, 7.6vw, 124px); line-height: 1.22; letter-spacing: .02em; }
.meteor__title .ml { display: block; }
.meteor__sub { margin: 30px auto 0; max-width: 32em; font-size: clamp(16px, 1.5vw, 20px); color: var(--fg-2); }

/* ---------- lab grid (both modes) ---------- */
.labgrid { display: grid; grid-template-columns: minmax(0, 410px) minmax(0, 1fr); gap: 36px; align-items: start; }
.labgrid__side .mt-row { grid-template-columns: 62px 1fr 1fr; }
.labgrid__side .mt-row span { padding-left: 8px; padding-right: 8px; white-space: nowrap; }
.labgrid__side .mini-table { font-size: 14px; }
.labgrid__side .mini-table { margin-top: 6px; }
@media (max-width: 900px) { .labgrid { grid-template-columns: 1fr; } }

/* ---------- static fallback ---------- */
html:not(.cinema) .stage { background: radial-gradient(80% 60% at 50% 0%, #0a1430 0%, var(--bg) 70%) no-repeat; background-size: 100% 100vh; }
html:not(.cinema) .act:not(.hero) { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: 110px 0 90px; }
html:not(.cinema) .act__inner { width: 100%; }
html:not(.cinema) .act--a, html:not(.cinema) .act--b { min-height: 0; }
html:not(.cinema) .ring .ring__fg, html:not(.cinema) .ring .ring__glow { stroke-dashoffset: calc(314.16 * (1 - var(--pct, .92))); }

/* ==========================================================================
   CINEMA MODE
   ========================================================================== */
html.cinema { scroll-behavior: auto; }
html.cinema .stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden;
  background:
    radial-gradient(90% 70% at 50% -10%, rgba(18, 36, 84, .85) 0%, rgba(3, 5, 11, 0) 70%),
    radial-gradient(60% 50% at 50% 115%, rgba(242, 198, 109, calc(var(--warm, 0) * .16)) 0%, rgba(3, 5, 11, 0) 70%),
    var(--bg);
}
html.cinema .stage__stars { height: 100%; }

html.cinema .act {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 84px 0 34px; visibility: hidden; pointer-events: none;
  opacity: calc(var(--in, 0) * (1 - var(--out, 0)));
}
html.cinema .act.is-on { visibility: visible; }
html.cinema .act.is-live { pointer-events: auto; }
html.cinema .act__inner {
  width: 100%;
  transform: translate3d(0, calc((1 - var(--in, 0)) * 52px - var(--out, 0) * 52px), 0) scale(var(--fit, 1));
  transform-origin: 50% 50%;
}
html.cinema .act--zoom .act__inner {
  transform: translate3d(0, calc((1 - var(--in, 0)) * 28px), 0) scale(calc(var(--fit, 1) * (1 + var(--out, 0) * .1 - (1 - var(--in, 0)) * .05)));
  filter: blur(calc(var(--out, 0) * 10px));
}

/* cues: per-element progress --q (0 → 1) written by cinema.js */
html.cinema [data-cue] { opacity: var(--q, 0); transform: translate3d(0, calc((1 - var(--q, 0)) * 36px), 0); }
html.cinema .cue--left[data-cue] { transform: translate3d(calc((1 - var(--q, 0)) * -56px), 0, 0); }
html.cinema .cue--right[data-cue] { transform: translate3d(calc((1 - var(--q, 0)) * 56px), 0, 0); }
html.cinema .cue--zoom[data-cue] { transform: scale(calc(1.16 - var(--q, 0) * .16)); filter: blur(calc((1 - var(--q, 0)) * 14px)); }

/* shared spacing inside the stage */
html.cinema .act .track { padding-top: 0; padding-bottom: 0; }
html.cinema .act .shead { margin-bottom: clamp(32px, 6vh, 72px); }
html.cinema .act .formula { margin-top: clamp(26px, 5vh, 60px); padding: clamp(24px, 4vh, 48px) clamp(12px, 3vw, 40px); }
html.cinema .act .track__label { margin-bottom: clamp(16px, 3vh, 28px); }
html.cinema .act .pair { margin-top: 0; }
html.cinema .act .chart { margin-top: clamp(18px, 3.5vh, 36px); }

/* ---------- 01 · hero ---------- */
html.cinema .act--hero { padding: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; }
html.cinema .act--hero .hero__content { padding-bottom: calc(var(--cap) + 20px); }
html.cinema .scrollcue {
  position: absolute; left: var(--gut); bottom: 72px; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 10px; font: 500 10.5px var(--f-mono); letter-spacing: .3em; text-transform: uppercase; color: rgba(232, 240, 255, .55);
  opacity: calc((1 - var(--hp, 0) * 3) * .95); animation: up 1.2s 1.4s var(--ease-out) both;
}
html.cinema .scrollcue i { position: relative; width: 1px; height: 38px; overflow: hidden; background: rgba(255, 255, 255, .12); }
html.cinema .scrollcue i::after { content: ""; position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: linear-gradient(180deg, transparent, var(--gold)); animation: cue 1.8s var(--ease) infinite; }
@keyframes cue { to { top: 100%; } }

/* ---------- 02 · statement ---------- */
html.cinema .act--statement .scrolltext .ch { transition: opacity .35s linear, color .35s linear; }

/* ---------- 03 · numbers ---------- */
html.cinema .act--numbers .numbers__grid { border-top: 1px solid var(--hair); }

/* ---------- 04 · method ---------- */
html.cinema .steps4::after {
  content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 46px; height: 1px; transform-origin: 0 50%;
  transform: scaleX(var(--fill, 0)); background: linear-gradient(90deg, var(--gold), var(--sky));
  box-shadow: 0 0 12px rgba(242, 198, 109, .6);
}
html.cinema .mstep__n { transition: border-color .5s, box-shadow .5s, color .5s; }
html.cinema .mstep.is-done .mstep__n { border-color: rgba(242, 198, 109, .75); color: var(--gold-2); box-shadow: 0 0 34px -8px rgba(242, 198, 109, .7); }

/* ---------- 05 · meteor ---------- */
html.cinema .fx { display: block; position: absolute; inset: 0; z-index: 6; width: 100%; height: 100%; pointer-events: none; }
html.cinema .meteor__title { opacity: var(--mt, 0); letter-spacing: calc(-.035em + (1 - var(--mt, 0)) * .06em); }
html.cinema[data-lang="zh"] .meteor__title { letter-spacing: calc(.02em + (1 - var(--mt, 0)) * .08em); }
html.cinema .meteor__kicker { opacity: var(--mk, 0); transform: translateY(calc((1 - var(--mk, 0)) * 16px)); }
html.cinema .meteor__sub { opacity: var(--ms, 0); transform: translateY(calc((1 - var(--ms, 0)) * 16px)); }
html.cinema .spark { display: block; position: absolute; width: 22px; height: 22px; opacity: 0; pointer-events: none; }
html.cinema .spark svg { width: 100%; height: 100%; fill: #fff; filter: drop-shadow(0 0 6px rgba(181, 214, 255, .9)) drop-shadow(0 0 14px rgba(155, 140, 255, .6)); }
html.cinema .spark--1 { left: 9%; top: 16%; }
html.cinema .spark--2 { right: 7%; top: 47%; width: 15px; height: 15px; }
html.cinema .spark--3 { left: 24%; bottom: 2%; width: 12px; height: 12px; }
html.cinema .act--meteor.is-done .spark { animation: twinkle 3.2s ease-in-out infinite; }
html.cinema .act--meteor.is-done .spark--2 { animation-delay: 1.1s; }
html.cinema .act--meteor.is-done .spark--3 { animation-delay: 2.1s; }
@keyframes twinkle { 0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); } 45% { opacity: 1; transform: scale(1) rotate(45deg); } 70% { opacity: 0; transform: scale(.5) rotate(90deg); } }

/* ---------- 06–12 · research ---------- */
html.cinema .ring .ring__fg, html.cinema .ring .ring__glow { transition: none; stroke-dashoffset: calc(314.16 * (1 - var(--pct, 0))); }
html.cinema .act--lab .lab { max-width: 1040px; }
html.cinema .act--b.act--lab .labzone > .lab { margin: 0 auto; }
html.cinema .act--b .labzone__head { max-width: 1040px; margin-left: auto; margin-right: auto; }
html.cinema .act--data .kv { max-width: 920px; margin: 0 auto; }
html.cinema .chart .ln { stroke-dashoffset: 1; }
html.cinema .chart .pt, html.cinema .chart .cb, html.cinema .chart .b2t { opacity: 0; }
html.cinema .chart .b2 { transform: scaleY(0); }
html.cinema .chart.is-play .ln { stroke-dashoffset: 0; }
html.cinema .chart.is-play .pt, html.cinema .chart.is-play .cb, html.cinema .chart.is-play .b2t { opacity: 1; }
html.cinema .chart.is-play .b2 { transform: none; }

/* ---------- 14–15 · figures ---------- */
html.cinema .act--fig .figure__cap { margin-bottom: clamp(10px, 2vh, 22px); }
html.cinema .act--fig .legend { margin-top: clamp(8px, 1.6vh, 18px); justify-content: center; }
html.cinema .act--fig .roster { display: none; }
html.cinema .figure--01 .constellation svg { width: min(100%, calc((100svh - 290px) * 1.7857)); margin: 0 auto; }
html.cinema .act--fig .net--wide { width: min(100%, calc((100svh - 280px) * 1.875)); margin: 0 auto; }
html.cinema .act--fig .constellation .edge { transition: none; }
html.cinema .act--fig .constellation .net__edge { transition: opacity .3s, stroke-width .3s; }
html.cinema .act--fig .constellation .node { opacity: var(--nq, 0); transition: none; }
html.cinema .act--fig .constellation.has-focus .net__node { opacity: calc(var(--nq, 0) * .28); }
html.cinema .act--fig .constellation.has-focus .net__node.is-lit,
html.cinema .act--fig .constellation.has-focus .net__hub { opacity: var(--nq, 0); }
html.cinema .act--fig .net__pkt { opacity: calc(var(--pk, 0) * .95); transition: none; }
html.cinema .act--fig .constellation.has-focus .net__pkt { opacity: calc(var(--pk, 0) * .15); }

/* ---------- 17–20 · finale ---------- */
html.cinema .act--finale .mega { margin: 26px 0 0; }
html.cinema .act--finale .lead { margin-top: 26px; }
html.cinema .qq__num { background: none; filter: none; }
html.cinema .qq__num .dg {
  display: inline-block; color: transparent;
  background: linear-gradient(180deg, #fff6dc 0%, var(--gold) 55%, #b9822e 100%); -webkit-background-clip: text; background-clip: text;
  filter: blur(calc((1 - var(--q, 0)) * 10px)) drop-shadow(0 10px 40px rgba(242, 198, 109, .22));
  transform: translate3d(0, calc((1 - var(--q, 0)) * 60px), 0) scale(calc(1.25 - var(--q, 0) * .25));
}
html.cinema .act--mails .mails { margin-top: 0; }
html.cinema .act--mails .mail { padding-top: 36px; padding-bottom: 36px; gap: 12px; }
html.cinema .act--mails .mail a { font-size: clamp(16px, 1.55vw, 22px); }
html.cinema .act--mails .mail small { font-size: 12px; }
html.cinema .act--steps .steps3 { margin-top: clamp(30px, 7vh, 72px); }
html.cinema .act--steps .finale__cta { margin-top: clamp(30px, 7vh, 64px); }

/* ---------- chapter rail ---------- */
html.cinema .rail {
  position: fixed; right: 22px; top: 50%; z-index: 80; display: flex; flex-direction: column; gap: 14px;
  transform: translateY(-50%); transition: opacity .5s var(--ease);
}
html.cinema .rail.is-away { opacity: 0; pointer-events: none; }
html.cinema .rail button { position: relative; display: block; width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35); transition: background .35s, border-color .35s, transform .35s var(--ease-out); }
html.cinema .rail button::before { content: attr(data-label); position: absolute; right: 22px; top: 50%; transform: translate(6px, -50%); opacity: 0; white-space: nowrap; font: 500 11px var(--f-mono); letter-spacing: .14em; color: rgba(232, 240, 255, .8); transition: opacity .3s, transform .3s var(--ease-out); pointer-events: none; }
html.cinema .rail button:hover::before, html.cinema .rail button:focus-visible::before { opacity: 1; transform: translate(0, -50%); }
html.cinema .rail button.is-on { background: var(--gold); border-color: var(--gold); transform: scale(1.25); box-shadow: 0 0 12px rgba(242, 198, 109, .7); }
@media (max-width: 1100px) { html.cinema .rail { display: none; } }
@media (min-width: 1101px) { html.cinema .rail { display: flex; } }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  html.cinema .fields__grid { grid-template-columns: 1fr; border-top: 0; }
  html.cinema .field, html.cinema .field + .field { grid-area: 1 / 1; padding: 26px 0 0; border: 0; opacity: calc(var(--q, 0) * var(--nx, 1)); }
  html.cinema .steps4::after { display: none; }
}
@media (max-width: 700px) {
  html.cinema .labgrid__side { display: none; }
  html.cinema .act--fig .net--tall { width: min(100%, calc((100svh - 250px) * .476)); }
}
@media (max-width: 620px) {
  html.cinema .act { padding: 76px 0 26px; }
  html.cinema .act__kicker { margin-bottom: 26px; }
  html.cinema .steps4 { grid-template-columns: 1fr 1fr; row-gap: 26px; }
  html.cinema .mstep { padding: 0 6px; }
  html.cinema .mstep__n { width: 60px; height: 60px; font-size: 22px; margin-bottom: 14px; }
  html.cinema .mstep h3 { font-size: 17px !important; }
  html.cinema .mstep p { font-size: 13.5px; }
  html.cinema .act--pair .pub__sum { display: none; }
  html.cinema .act--pair .progress { flex-direction: row; align-items: center; }
  html.cinema .act--pair .ring { width: 104px; }
  html.cinema .act--pair .ring__v b { font-size: 30px; }
  html.cinema .act--pair .pair > div { padding: 22px 0; }
  html.cinema .act--pair .pair__k { margin-bottom: 14px; }
  html.cinema .act--track .formula__note { font-size: 13px; }
  html.cinema .act--mails .mail { padding: 16px 0; }
  html.cinema .act--steps .s3 { display: grid; grid-template-columns: 44px 1fr; column-gap: 16px; text-align: left; padding: 0; }
  html.cinema .act--steps .s3__n { grid-row: 1 / span 2; margin: 0; }
  html.cinema .act--steps .s3 h4 { margin: 8px 0 4px; }
  html.cinema .act--steps .s3 p { margin: 0; max-width: none; font-size: 14px; }
  html.cinema .act--steps .steps3 { row-gap: 22px; }
  html.cinema .act--steps .finale__cta { gap: 10px; }
  html.cinema .scrollcue { display: none; }
  html.cinema .spark--1 { left: 2%; top: 8%; }
  html.cinema .spark--2 { right: 2%; }
}
@media (max-height: 760px) and (min-width: 621px) {
  html.cinema .act { padding-top: 76px; }
  html.cinema .mstep__n { width: 72px; height: 72px; font-size: 27px; margin-bottom: 18px; }
  html.cinema .steps4::before, html.cinema .steps4::after { top: 36px; }
}

/* v4.1 polish */
.act__inner.track { padding-left: var(--gut); padding-right: var(--gut); }
html.cinema .act .act__inner.track { padding-top: 0; padding-bottom: 0; }
@media (max-width: 900px) {
  html.cinema .field { text-align: center; }
  html.cinema .field__art svg { margin: 0 auto; }
  html.cinema .field p { max-width: 26em; margin: 0 auto; }
}
@media (max-width: 620px) {
  html[data-lang="zh"].cinema .meteor__title, html.cinema[data-lang="zh"] .meteor__title { font-size: 12.6vw; }
  html.cinema[data-lang="en"] .meteor__title { font-size: 11vw; }
}

/* ---------- floating dock (autoplay + BGM) ---------- */
.dock {
  position: fixed; right: 20px; bottom: 20px; z-index: 88;
  display: flex; align-items: center; gap: 10px;
}
.dock .bgm { position: static; right: auto; bottom: auto; }
.autoplay {
  position: relative; overflow: hidden; display: none; align-items: center; gap: 9px;
  height: 40px; padding: 0 16px 0 13px; border-radius: 999px;
  background: rgba(6, 10, 22, .78); color: rgba(255, 255, 255, .92);
  border: 1px solid rgba(242, 198, 109, .38);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font: 500 11.5px var(--f-mono); letter-spacing: .08em;
  transition: border-color .3s, transform .3s var(--ease-out), box-shadow .35s;
}
html.cinema .autoplay { display: inline-flex; }
.autoplay:hover { transform: translateY(-2px); border-color: rgba(242, 198, 109, .78); box-shadow: 0 10px 28px -10px rgba(242, 198, 109, .45); }
.autoplay.is-playing { border-color: rgba(242, 198, 109, .85); box-shadow: 0 0 26px -8px rgba(242, 198, 109, .55); }
.autoplay__ic { width: 12px; height: 12px; flex: none; color: var(--gold); }
.autoplay:not(.is-playing) .autoplay__ic--pause,
.autoplay.is-playing .autoplay__ic--play,
.autoplay:not(.is-playing) .autoplay__state--on,
.autoplay.is-playing .autoplay__state--off { display: none; }
.autoplay__state--on { color: var(--gold-2); }
.autoplay__prog {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, var(--sky), var(--gold));
  transform-origin: 0 50%; transform: scaleX(var(--ap, 0));
  opacity: 0; transition: opacity .3s; pointer-events: none;
}
.autoplay.is-playing .autoplay__prog { opacity: .95; }
@media (max-width: 620px) {
  .dock { right: 12px; bottom: 12px; gap: 8px; }
  .dock .bgm, html.cinema .autoplay { height: 36px; padding: 0 13px 0 11px; font-size: 11px; gap: 7px; }
}

/* ---------- blurred welcome gate ---------- */
.gate {
  display: none; position: fixed; inset: 0; z-index: 200;
  align-items: center; justify-content: center; padding: 28px var(--gut);
  background: radial-gradient(65% 55% at 50% 44%, rgba(22, 42, 92, .34), rgba(3, 5, 11, .68) 76%);
  backdrop-filter: blur(24px) saturate(1.25); -webkit-backdrop-filter: blur(24px) saturate(1.25);
  transition: opacity .95s var(--ease-out), transform 1.05s var(--ease-out), visibility 0s .95s;
}
html.gate-open { overflow: hidden; }
html.gate-open body { overflow: hidden; }
html.gate-open .gate, .gate.is-leaving { display: flex; }
html.gate-open .dock, html.gate-open .rail, html.gate-open .scrollcue { opacity: 0 !important; pointer-events: none; }
.gate.is-leaving { opacity: 0; transform: scale(1.045); pointer-events: none; visibility: hidden; }
.gate__inner {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  max-width: 720px; width: 100%;
}
.gate__emblem {
  width: 56px; margin-bottom: 26px;
  filter: drop-shadow(0 0 28px rgba(124, 192, 255, .5));
  opacity: 0; animation: up 1s .08s var(--ease-out) forwards;
}
.gate__kicker { opacity: 0; animation: up 1s .18s var(--ease-out) forwards; }
.gate__title {
  margin: 24px 0 0; font-family: var(--f-display); font-weight: 400; color: #fff;
  font-size: clamp(36px, 6.2vw, 84px); line-height: 1.08; letter-spacing: -.03em;
  opacity: 0; animation: up 1.1s .28s var(--ease-out) forwards;
}
html[data-lang="zh"] .gate__title {
  font-family: var(--f-zh); font-weight: 800;
  font-size: clamp(30px, 5.4vw, 68px); line-height: 1.24; letter-spacing: .03em;
}
.gate__btn {
  position: relative; margin-top: 42px; min-width: 176px;
  font-size: 18px; letter-spacing: .04em;
  box-shadow: 0 14px 48px -10px rgba(242, 198, 109, .75);
  opacity: 0; animation: up 1.1s .44s var(--ease-out) forwards;
}
.gate__btn::after {
  content: ""; position: absolute; inset: -6px; border-radius: 999px;
  border: 1px solid rgba(242, 198, 109, .45); pointer-events: none;
  animation: gatePulse 2.6s var(--ease) infinite;
}
@keyframes gatePulse { 0% { transform: scale(.96); opacity: .75; } 100% { transform: scale(1.14, 1.32); opacity: 0; } }
.gate__hint {
  margin: 22px 0 0; font: 400 12px/1.6 var(--f-mono); letter-spacing: .12em;
  color: rgba(208, 220, 244, .54);
  opacity: 0; animation: up 1s .6s var(--ease-out) forwards;
}
@media (max-width: 620px) {
  .gate__emblem { width: 46px; margin-bottom: 20px; }
  .gate__btn { margin-top: 34px; min-width: 158px; height: 54px; font-size: 17px; }
  .gate__hint { font-size: 11px; }
}
