/* Typing Racer: the lobby (games/typing-racer.php), My Garage (my-garage.php), Standings (racer-standings.php) and
   the Race Pass (race-pass.php) as one place (owner, 2026-11-15; js/racer/switch.js). Going from one to another, the page slides away and the
   other slides in: to the right is lobby, garage, standings (html.rsFwd), the other way slides back (html.rsBack),
   with a warm streak behind them and the menu bar staying put. Calm animations (js/racer/motion.js) get the
   browser's own quick fade instead.

   From the lobby, the garage and the standings open over it, in a layer (#rsLayer, an iframe.rsFrame): one page's
   own view transition (html.rsSame), where your car glides onto the garage's stage as a copy (#rsGhost).
   Opened as ordinary pages, the browser's view transitions between pages do it (html.rsGo), and the parts the
   pages share glide across: the menu bar, the sign, your car, your coins, the Sound button and
   your presets. Browsers without view transitions just switch. */
@view-transition { navigation: auto; }

/* ---- between pages: the parts that carry over, named only while going ---- */
/* (the race page's Sound button sits with the ? and the gear on the left since 2026-11-23: it sweeps across to the others') */
html.rsGo #main-header { view-transition-name: rsBar; }
html.rsGo #centerEntryModule h1, html.rsGo #garage .gxHeadSign, html.rsGo #racerStandings .stHead h1, html.rsGo #racePass .rpHead h1, html.rsGo #racerHistory .rhHead h1 { view-transition-name: rsSign; }
html.rsGo #lobbyRide, html.rsGo #gxStage .gxStageCar { view-transition-name: rsCar; }
html.rsGo #userSpeedCoinBank, html.rsGo #garage .gxHeadActs .gxWallet { view-transition-name: rsCoins; }
html.rsGo #leftOfTitle .racerSnd, html.rsGo #garage .gxSndOne, html.rsGo #racerStandings .stActs .racerSnd, html.rsGo #racePass .rpActs .racerSnd, html.rsGo #racerHistory .rhActs .racerSnd { view-transition-name: rsSnd; }
html.rsGo #hudPresets, html.rsGo #gxPresets { view-transition-name: rsPresets; }

/* ---- in the lobby, the layer: the menu bar stays, your car glides (its copy, when the garage has it) ---- */
html.rsSame #main-header { view-transition-name: rsBar; }
html.rsSame:not(.rsGhostOn) #lobbyRide { view-transition-name: rsCar; }
#rsGhost { position: fixed; z-index: 2147483200; margin: 0; pointer-events: none; view-transition-name: rsCar; }

/* behind the pages while they pass: the racer's dark, with a warm streak racing across the way they go */
html.rsGo::view-transition, html.rsSame::view-transition {
	background: #0d1018 linear-gradient(100deg, transparent 38%, rgba(255, 166, 72, .16) 47%, rgba(255, 214, 150, .3) 50%, rgba(255, 166, 72, .16) 53%, transparent 62%) no-repeat;
	background-size: 260% 100%;
}
html.rsFwd::view-transition { animation: rsStreakL .62s cubic-bezier(.65, 0, .25, 1) both; }
html.rsBack::view-transition { animation: rsStreakR .62s cubic-bezier(.65, 0, .25, 1) both; }

html.rsGo::view-transition-group(*), html.rsSame::view-transition-group(*) { animation-duration: .62s; animation-timing-function: cubic-bezier(.65, 0, .25, 1); }

html.rsFwd::view-transition-old(root) { animation: rsOutLeft .62s cubic-bezier(.65, 0, .25, 1) both; }
html.rsFwd::view-transition-new(root) { animation: rsInRight .62s cubic-bezier(.65, 0, .25, 1) both; }
html.rsBack::view-transition-old(root) { animation: rsOutRight .62s cubic-bezier(.65, 0, .25, 1) both; }
html.rsBack::view-transition-new(root) { animation: rsInLeft .62s cubic-bezier(.65, 0, .25, 1) both; }

@keyframes rsOutLeft { to { transform: translateX(-16%); opacity: 0; filter: blur(4px); } }
@keyframes rsInRight { from { transform: translateX(16%); opacity: 0; filter: blur(4px); } }
@keyframes rsOutRight { to { transform: translateX(16%); opacity: 0; filter: blur(4px); } }
@keyframes rsInLeft { from { transform: translateX(-16%); opacity: 0; filter: blur(4px); } }
@keyframes rsStreakL { from { background-position: 100% 0; } to { background-position: 0 0; } }
@keyframes rsStreakR { from { background-position: 0 0; } to { background-position: 100% 0; } }

/* calm animations: no slide or glide, only the browser's own crossfade, kept quick */
html.trgCalm::view-transition-old(root), html.trgCalm::view-transition-new(root) { animation-duration: .2s; }

/* ---- the layer over the lobby: the whole window under the lobby's menu bar (fixed, on top of everything) ---- */
#rsLayer { position: fixed; inset: 0; z-index: 2147483000; visibility: hidden; pointer-events: none; }
html.rsLayerOn #rsLayer { visibility: visible; pointer-events: auto; background: #0b0d12; }
#rsLayer iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; margin: 0; display: block; background: #0b0d12; }
#rsLayer iframe.rsWaiting { visibility: hidden; }
/* the lobby under it rests (its connection and its music go on) */
html.rsLayerOn, html.rsLayerOn body { overflow: hidden; }
html.rsLayerOn body > :not(#main-header):not(#rsLayer):not(#rsGhost):not(#challengeShade):not(#challengeCard) { visibility: hidden; }
/* a challenge while the garage is open: on top of it */
html.rsLayerOn #challengeShade { z-index: 2147483100; right: 0; }
html.rsLayerOn #challengeCard { z-index: 2147483101; left: 50vw; }
html.rsWait, html.rsWait * { cursor: progress !important; }

/* the page in the layer: its own menu bar under the lobby's, and its car hidden while the copy glides */
html.rsIn #main-header { visibility: hidden; }
html.rsIn.rsHideCar #gxStage .gxStageCar { visibility: hidden; }
