/* subject-scene.css — the scroll-driven journey layer for the four Academy subject hubs.
   Engine + scenes: subject-scene.js. Spec: ~/MOTHER/ACADEMY-FORGE/SUBJECT-HUB-JOURNEY-SPEC.md.
   Everything here is transform / opacity / paint only. No rule hides content: entrances translate from the
   visible base (<= 24 px, <= 500 ms) and a timer class (is-settled / sceneSettled) ends them even if
   animations never run. html.sceneOn = engine running (live or still); html.sceneLive = scroll-driven. */

/* the scene canvas: fixed, behind everything, never a hit target */
.subjectScene { position: fixed; left: 0; top: 0; width: 100%; height: 100vh; height: 100lvh; z-index: -1; pointer-events: none; contain: strict; }
.subjectScene canvas { display: block; width: 100%; height: 100%; }
html.sceneOn body.subjectPage::before { display: none; }

/* hero: the engine drives copy / portal / cue transforms, so CSS must not also tween them */
html.sceneLive .subjectCopy, html.sceneLive .subjectPortal, html.sceneLive .subjectScroll { will-change: transform, opacity; transition: none; }
html.sceneLive .subjectCopy > * { animation: sceneRise .42s cubic-bezier(.16, 1, .3, 1) both; }
html.sceneLive .subjectCopy > :nth-child(2) { animation-delay: .02s; }
html.sceneLive .subjectCopy > :nth-child(3) { animation-delay: .04s; }
html.sceneLive .subjectCopy > :nth-child(4) { animation-delay: .06s; }
html.sceneLive .subjectCopy > :nth-child(5) { animation-delay: .08s; }
html.sceneSettled .subjectCopy > * { animation: none; }
@keyframes sceneRise { from { transform: translateY(22px); } }
html.sceneHeroAway .scene-rotate, html.sceneHidden .scene-rotate, html.sceneHidden .subjectScroll span { animation-play-state: paused; }

/* the route: a self-drawing path through the world nodes, a spark at the drawn end with a counting label */
html.sceneOn section.apps::before { opacity: 0; }
.sceneRoute { position: absolute; left: 0; top: 0; z-index: 0; overflow: visible; pointer-events: none; }
.sceneRoute path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sceneRoute .ghost { stroke: var(--accent); stroke-opacity: .17; stroke-width: 1.5; stroke-dasharray: 2 7; }
.sceneRoute .glow { stroke: var(--accent); stroke-opacity: .28; stroke-width: 10; }
.sceneRoute .ink { stroke: url(#sceneInk); stroke-width: 2.6; }
.sceneRoute .tail { stroke: #fff; stroke-opacity: .85; stroke-width: 3.2; }
html.sceneStill .sceneRoute .tail { display: none; }
.sceneRoute .extra { stroke: var(--secondary); stroke-opacity: .55; stroke-width: 1.4; }
.sceneRoute .extra2 { stroke: var(--accent); stroke-opacity: .75; stroke-width: 1.6; }
.sceneRoute text { fill: #f4e9d8; fill-opacity: .55; font: 400 10px/1 Michroma, sans-serif; letter-spacing: .04em; }
.sceneSpark { --spark: var(--accent); position: absolute; left: 0; top: 0; z-index: 3; width: 0; height: 0; pointer-events: none; will-change: transform; }
.sceneSpark i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--spark), 0 0 16px 5px var(--spark), 0 0 46px 12px color-mix(in srgb, var(--spark) 45%, transparent); }
.sceneSpark b { position: absolute; left: 0; top: -36px; transform: translateX(-50%); padding: 4px 8px 3px; border-radius: 999px; color: #fff; background: #0a1124e0; border: 1px solid color-mix(in srgb, var(--spark) 55%, transparent); font: 400 11px/1.2 Michroma, sans-serif; letter-spacing: .04em; white-space: nowrap; box-shadow: 0 0 22px -6px var(--spark); }
.sceneSpark.off { visibility: hidden; }
html.sceneStill .sceneSpark { display: none; }
@media (max-width: 760px) { .sceneSpark b { display: none; } }

/* world nodes (the numbered circles on the route) and the side rail fill as each world is reached */
html.sceneOn .app::before { transition: background .35s, color .35s, box-shadow .35s, transform .35s cubic-bezier(.2, 1.4, .4, 1); z-index: 4; }
html.sceneOn .app.is-reached::before { color: #0b1020; background: var(--accent); }
html.sceneOn .app.is-current::before { transform: scale(1.18); box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent), 0 0 44px 4px color-mix(in srgb, var(--accent) 60%, transparent); }
html.sceneOn .worldRail a.is-reached { border-color: color-mix(in srgb, var(--accent) 60%, transparent); color: #f1f5ff; }
html.sceneOn .worldRail a.is-current { box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 70%, transparent); }

/* the card beat: JS tilts / slides / parallaxes; CSS adds the one-time light sweep and the chip stagger */
html.sceneLive .app .app-art { transition: border-color .5s, box-shadow .5s; backface-visibility: hidden; }
html.sceneLive .app .app-art svg { transition: none; will-change: transform; }
html.sceneLive .app.is-arrived .app-art::after { animation: sceneSweep 1.1s .05s cubic-bezier(.3, .1, .2, 1) both; }
html.sceneLive .app.is-arrived .chip { animation: sceneChip .32s cubic-bezier(.2, 1.5, .4, 1) both; }
html.sceneLive .app.is-arrived .chip:nth-child(2) { animation-delay: .04s; }
html.sceneLive .app.is-arrived .chip:nth-child(3) { animation-delay: .08s; }
html.sceneLive .app.is-arrived .chip:nth-child(4) { animation-delay: .12s; }
html.sceneLive .app.is-arrived .chip:nth-child(n+5) { animation-delay: .16s; }
html.sceneLive .app.is-settled .chip { animation: none; }
@keyframes sceneSweep { from { transform: translateX(-140%); } to { transform: translateX(140%); } }
@keyframes sceneChip { from { transform: translateY(14px) scale(.9); } }

/* the finish line: room for the subject symbol to assemble, then the tally and the way back */
html.sceneOn .subjectEnd { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 14px; min-height: 66vh; padding-bottom: 2vh; border-top-color: transparent; }
.sceneTally { margin: 0; padding: 10px 26px; border-radius: 999px; background: radial-gradient(closest-side, #070c1dd9 55%, transparent); color: #eef2ff; font: 400 clamp(15px, 1.6vw, 20px)/1.3 Michroma, sans-serif; letter-spacing: .06em; text-align: center; text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 45%, transparent); }
.sceneTally b { display: inline-block; min-width: 1.4em; color: var(--accent); font-weight: 400; }

@media (prefers-reduced-motion: reduce) {
  html.sceneOn .app::before { transition: none; }
}
html.sceneLive .subjectScroll:focus-visible, html.sceneLive .subjectCopy:focus-within { opacity: 1 !important; }
html.sceneLive .scene-rotate, html.sceneLive .subjectScroll span { animation: none; }
/* the hero's own tint must not end in a hard edge over the scene */
html.sceneOn .subjectIntro::before { -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent); }
/* once the camera moves, the hero's lower edge feathers out so the sinking copy and symbol never hit a hard cut */
html.sceneScrolled .subjectIntro { -webkit-mask-image: linear-gradient(#000 calc(100% - 150px), transparent); mask-image: linear-gradient(#000 calc(100% - 150px), transparent); }
