/* APIX GAMES — "We build it. Then we bring it." scroll story (home page) */

/* ---------- story: build it -> bring it ---------- */
.story-head { margin-bottom: 20px; }
.story-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 56px; align-items: start; }
.chapter { min-height: 78vh; display: flex; flex-direction: column; justify-content: center; opacity: .28; transition: opacity .5s; }
.chapter.active { opacity: 1; }
.chapter .ch-num { font-family: var(--font-display); font-size: 15px; letter-spacing: .2em; color: var(--pink); margin-bottom: 14px; }
.chapter h3 { font-size: clamp(34px, 4.4vw, 58px); text-transform: uppercase; line-height: 1; margin-bottom: 18px; }
.chapter p { color: var(--muted); font-size: 18px; max-width: 470px; }
.chapter:first-child { min-height: 64vh; }
.chapter:last-child { min-height: 90vh; }

.stage-wrap { position: sticky; top: 13vh; height: 74vh; }
.stage {
  position: relative; height: 100%; border-radius: 30px; overflow: hidden; border: 1px solid var(--line-2);
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(168, 85, 247, .25), transparent 70%),
    radial-gradient(60% 50% at 50% 100%, rgba(34, 227, 255, .12), transparent 70%),
    linear-gradient(180deg, #0c0920, #07050f);
}
.stage::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
  background-size: 32px 32px;
}
.rail { position: absolute; z-index: 5; top: 16px; left: 16px; right: 16px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.rail span {
  position: relative; padding: 8px 0 0; font-family: var(--font-ui); font-weight: 700; font-size: 11.5px; letter-spacing: .18em;
  text-transform: uppercase; color: var(--muted); transition: color .3s;
}
.rail span::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .12); }
.rail span::after { content: ""; position: absolute; left: 0; top: 0; height: 3px; width: 0; border-radius: 3px; background: var(--grad); transition: width .6s var(--ease); }
.rail span.done { color: var(--text); }
.rail span.done::after { width: 100%; }

.layer { position: absolute; transition: opacity .6s var(--ease), transform .8s var(--ease); }
.l-island { inset: 12% 6% 6%; display: grid; place-items: center; }
.l-island svg { width: 100%; height: 100%; overflow: visible; }
.stage[data-step="3"] .l-island { transform: translateY(-29%) scale(.33); }

.tile { fill: rgba(34, 227, 255, 0); stroke: rgba(34, 227, 255, .7); stroke-width: 1; opacity: 0; transition: opacity .4s, fill .6s, stroke .6s; }
.stage.s0 .tile, .stage.s1 .tile, .stage.s2 .tile, .stage.s3 .tile { opacity: 1; }
.stage.s1 .tile, .stage.s2 .tile, .stage.s3 .tile { fill: url(#grass); stroke: rgba(10, 40, 30, .55); }
.side { opacity: 0; transition: opacity .6s .2s; }
.stage.s1 .side, .stage.s2 .side, .stage.s3 .side { opacity: 1; }
.bld { transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); transition: transform .7s var(--ease); }
.stage.s1 .bld, .stage.s2 .bld, .stage.s3 .bld { transform: scaleY(1); }
.player { opacity: 0; transition: opacity .4s; }
.stage.s1 .player, .stage.s2 .player, .stage.s3 .player { opacity: 1; }
.beacon { opacity: 0; transition: opacity .5s; }
.stage.s2 .beacon, .stage.s3 .beacon { opacity: 1; }

.card-ui {
  padding: 14px 16px; border-radius: 16px; background: rgba(11, 9, 24, .82); border: 1px solid var(--line-2);
  backdrop-filter: blur(10px); box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8);
  font-family: var(--font-ui); font-size: 13px;
}
.l-code { left: 5%; bottom: 6%; width: min(360px, 78%); opacity: 0; transform: translateY(20px); }
.stage.s0 .l-code { opacity: 1; transform: none; }
.l-code .dots { display: flex; gap: 6px; margin-bottom: 10px; }
.l-code .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--pink); }
.l-code .dots i:nth-child(2) { background: var(--yellow); }
.l-code .dots i:nth-child(3) { background: var(--lime); }
.l-code pre { margin: 0; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; line-height: 1.55; color: #cfc8ff; white-space: pre; min-height: 118px; }
.l-code pre b { color: var(--cyan); font-weight: 400; }
.caret { display: inline-block; width: 7px; height: 14px; background: var(--cyan); vertical-align: -2px; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.l-hud { right: 5%; bottom: 7%; display: grid; gap: 10px; opacity: 0; transform: translateX(20px); }
.stage.s1 .l-hud { opacity: 1; transform: none; }
.l-hud .card-ui { display: flex; justify-content: space-between; gap: 18px; min-width: 210px; letter-spacing: .1em; text-transform: uppercase; }
.l-hud .k { color: var(--muted); }
.l-hud .v { color: var(--lime); font-weight: 700; }

.l-publish { left: 50%; bottom: 8%; width: min(340px, 84%); translate: -50% 0; opacity: 0; transform: translateY(24px) scale(.95); text-align: center; }
.stage.s2 .l-publish { opacity: 1; transform: none; }
.l-publish .card-ui { padding: 18px; }
.l-publish .live { display: inline-flex; align-items: center; gap: 8px; color: var(--lime); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: 12px; }
.l-publish .live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); animation: ping 2s infinite; }
.l-publish .code { font-family: var(--font-display); font-size: 26px; letter-spacing: .06em; margin: 8px 0 4px; }
.l-publish small { color: var(--muted); }

.screen-frame {
  position: absolute; left: 50%; top: 11%; width: 50%; aspect-ratio: 16 / 10; translate: -50% 0; border-radius: 10px;
  border: 3px solid rgba(255, 255, 255, .25); box-shadow: 0 0 0 6px rgba(0, 0, 0, .4), 0 0 60px rgba(34, 227, 255, .35);
  opacity: 0; transition: opacity .6s .3s;
}
.screen-frame::after { content: "LIVE AT THE EVENT"; position: absolute; left: 50%; bottom: -30px; translate: -50% 0; white-space: nowrap; font-family: var(--font-ui); font-weight: 700; font-size: 11px; letter-spacing: .24em; color: var(--pink); }
.stage.s3 .screen-frame { opacity: 1; }

.l-floor { left: 5%; right: 5%; bottom: 6%; opacity: 0; transform: translateY(40px); }
.stage.s3 .l-floor { opacity: 1; transform: none; transition-delay: .25s; }
.stations { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.station { position: relative; padding: 12px 8px 10px; text-align: center; border-radius: 14px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line-2); }
.station svg { width: 26px; height: 26px; margin: 0 auto 6px; color: var(--cyan); }
.station:nth-child(2) svg { color: var(--pink); }
.station:nth-child(3) svg { color: #3ddc5a; }
.station:nth-child(4) svg { color: var(--lime); }
.station b { display: block; font-family: var(--font-ui); font-size: 11.5px; letter-spacing: .14em; }
.station .q { display: flex; justify-content: center; gap: 3px; margin-top: 8px; height: 8px; }
.station .q i { width: 6px; height: 6px; border-radius: 50%; background: var(--text); opacity: 0; animation: queue 2.4s infinite; }
.station .q i:nth-child(2) { animation-delay: .3s; } .station .q i:nth-child(3) { animation-delay: .6s; } .station .q i:nth-child(4) { animation-delay: .9s; }
@keyframes queue { 0% { opacity: 0; transform: translateY(6px); } 20%, 70% { opacity: .85; transform: none; } 100% { opacity: 0; transform: translateY(-6px); } }
.floor-count { display: flex; justify-content: space-between; margin-top: 12px; font-family: var(--font-ui); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.floor-count b { color: var(--lime); font-size: 16px; letter-spacing: .06em; }

@media (max-width: 900px) {
  .story-grid { grid-template-columns: 1fr; gap: 0; }
  .l-island { inset: 11% 4% 36%; }
  .stage[data-step="3"] .l-island { transform: translateY(-30%) scale(.35); }
  .stage-wrap { order: -1; top: 70px; height: 46vh; z-index: 3; margin: 0 -4px; background: var(--bg); padding-bottom: 10px; }
  .chapter, .chapter:first-child { min-height: 62vh; padding-top: 20px; }
  .chapter:last-child { min-height: 70vh; }
  .chapter p { font-size: 16px; }
  .rail span { font-size: 9.5px; letter-spacing: .12em; }
  .l-code pre { font-size: 10.5px; min-height: 96px; }
  .l-hud .card-ui { min-width: 0; font-size: 11px; padding: 9px 12px; }
  .station { padding: 8px 4px; } .station svg { width: 20px; height: 20px; } .station b { font-size: 9.5px; }
  .l-publish .code { font-size: 20px; }
}
