/* Living city, part 2 (cityfx.js): window lights, banners, water, day/night, entering a building.
   Window, banner and water layers sit inside the mirrored city layers, so they use source coordinates. */

/* --- day / night: colour grading of the city picture only (not the HUD, not the heroine) --- */
.city-bg,.fg-layer img,.cb-img,.cb-flag{filter:var(--grade,none)}
.hub[data-phase=dawn]{--grade:sepia(.3) saturate(1.15) hue-rotate(-16deg) brightness(1.1);--win:.55}
.hub[data-phase=day]{--grade:brightness(1.32) contrast(.9) saturate(.72);--win:.3}
.hub[data-phase=dusk]{--grade:sepia(.45) saturate(1.35) hue-rotate(-28deg) brightness(.95);--win:.9}
.hub:not([data-phase=night]) .fx-moon{display:none}
.hub[data-phase=day] .fx-portal{opacity:.6}

/* --- lit windows: a warm glow over the painted light, or a shade when the window goes dark.
   Plain alpha, no blend modes: ~180 blended sprites over the animated embers cost a third of the frame rate. --- */
.cb-win{position:absolute;inset:0;pointer-events:none}
.cb-win i{position:absolute;border-radius:50%;background:radial-gradient(closest-side,rgba(255,232,170,.8),rgba(255,170,80,.32) 55%,rgba(255,150,60,0));opacity:calc(var(--win,1) * .5);transition:opacity .9s}
.cb-win i.dim{opacity:calc(var(--win,1) * .22)}
.cb-win i.off{background:radial-gradient(closest-side,rgba(30,14,40,.8),rgba(30,14,40,.45) 60%,rgba(30,14,40,0));opacity:.8}
.cb-win i.flick{animation:winFlick 1.1s steps(1,end)}
@keyframes winFlick{0%{opacity:calc(var(--win,1) * .9)}15%{opacity:calc(var(--win,1) * .3)}30%{opacity:calc(var(--win,1) * .85)}45%{opacity:calc(var(--win,1) * .45)}60%{opacity:calc(var(--win,1) * .95)}}
.cb:hover .cb-win,.cb:focus-visible .cb-win{opacity:.6}

/* --- banners: cloth layer over the painted banners --- */
.cb-flag{position:absolute;pointer-events:none}
.cb:hover .cb-flag,.cb:focus-visible .cb-flag{filter:var(--grade,) brightness(1.16)}

/* --- water: moonlit glitter on the lake, ripples in the fountain --- */
.water-layer{position:absolute;inset:0;transform:scaleX(-1);pointer-events:none}
.fx-lake{position:absolute;overflow:hidden;-webkit-mask:var(--mask) 0 0/100% 100%;mask:var(--mask) 0 0/100% 100%;opacity:.7}
.fx-lake i{position:absolute;left:-60px;top:0;width:calc(100% + 120px);height:100%;
  background:radial-gradient(4px 1px at 9px 3px,rgba(255,240,255,.9),transparent),radial-gradient(6px 1px at 31px 9px,rgba(230,215,255,.8),transparent),radial-gradient(3px 1px at 47px 5px,rgba(255,255,255,.9),transparent);
  background-size:60px 13px;animation:lakeDrift 9s linear infinite alternate}
.fx-lake i.l2{background-size:46px 9px;background-position:17px 4px;animation-duration:6.5s;animation-direction:alternate-reverse;opacity:.8}
@keyframes lakeDrift{to{transform:translateX(30px)}}
.hub[data-phase=day] .fx-lake{opacity:.3}
.fx-fountain{position:absolute;border-radius:50%}
.fx-fountain i{position:absolute;inset:0;border-radius:50%;border:1px solid rgba(220,235,255,.65);animation:ripple 2.6s ease-out infinite;opacity:0}
.fx-fountain i.r2{animation-delay:-1.3s}
.fx-fountain b{position:absolute;left:30%;right:30%;top:20%;bottom:20%;border-radius:50%;background:radial-gradient(closest-side,rgba(220,235,255,.55),transparent);animation:fountGlint 1.7s ease-in-out infinite alternate}
@keyframes ripple{0%{transform:scale(.25);opacity:.9}100%{transform:scale(1);opacity:0}}
@keyframes fountGlint{to{opacity:.35;transform:scaleX(1.4)}}
.water-layer.still *{animation:none!important}

/* --- entering a building: the city zooms toward it through mist; the mist clears over the next screen --- */
.hub.entering .city-cam{transform:scale(1.9);filter:blur(2px);transition:transform .52s cubic-bezier(.5,0,.8,.6),filter .52s ease-in}
.hub.entering .hud,.hub.entering .dock,.hub.entering .fight,.hub.entering .wall-act,.hub.entering .swap-mascot{opacity:0;transition:opacity .3s}
.hub.entering .cb{pointer-events:none}
.city-mist{position:absolute;inset:0;z-index:50;pointer-events:none;background:#2c1a36}
.city-mist.in{background:radial-gradient(circle at var(--mx) var(--my),rgba(255,226,240,.55),rgba(200,160,220,.75) 22%,#2c1a36 70%);animation:mistIn .52s ease-in forwards}
.city-mist.in::after{content:"";position:absolute;inset:0;background:#2c1a36;animation:mistSolid .52s ease-in forwards}
@keyframes mistSolid{0%,55%{opacity:0}100%{opacity:1}}
.city-mist.out{animation:mistOut .34s ease-out forwards}
.city-mist.back{animation-duration:.45s}
@keyframes mistIn{0%{opacity:0;transform:scale(1.8)}55%{opacity:.75}100%{opacity:1;transform:scale(1)}}
@keyframes mistOut{0%{opacity:1}100%{opacity:0}}
.hub:has(.city-mist.back) .city-cam{animation:camBack .45s ease-out}
@keyframes camBack{from{transform:scale(1.08)}}
.calm .city-mist{display:none}

/* Veil Gates plaque shifted left so the right dock does not cover it (the city layer is mirrored: larger left = further left on screen). */
.cb[data-k="camp"] .plaque{left:72%}
