/* SolarDash motion layer: small, calm animations. Everything animated lives inside no-preference. */
@media (prefers-reduced-motion:no-preference){
@view-transition{navigation:auto}
.topbar{view-transition-name:mo-topbar}
.page-nav{view-transition-name:mo-pagenav}
::view-transition-old(root),::view-transition-new(root){animation-duration:.18s}

/* staggered section entrance (extends app.css, 40 ms steps) */
.layout>section:nth-child(2){animation-delay:.04s}.layout>section:nth-child(3){animation-delay:.08s}.layout>section:nth-child(4){animation-delay:.12s}.layout>section:nth-child(5){animation-delay:.16s}.layout>section:nth-child(6){animation-delay:.2s}.layout>section:nth-child(7){animation-delay:.24s}.layout>section:nth-child(8){animation-delay:.28s}.layout>section:nth-child(n+9){animation-delay:.32s}
.account-switcher{animation:mo-rise .45s var(--ease) .05s both}
@keyframes mo-rise{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* menu: pop from the button corner, items cascade */
.main-menu[open] .main-menu-panel{transform-origin:top right;animation:mo-pop .2s var(--ease) both}
.main-menu[open] .main-menu-panel>*{animation:mo-item .26s var(--ease) both}
.main-menu[open] .main-menu-panel>*:nth-child(1){animation-delay:.03s}.main-menu[open] .main-menu-panel>*:nth-child(2){animation-delay:.05s}.main-menu[open] .main-menu-panel>*:nth-child(3){animation-delay:.07s}.main-menu[open] .main-menu-panel>*:nth-child(4){animation-delay:.09s}.main-menu[open] .main-menu-panel>*:nth-child(5){animation-delay:.11s}.main-menu[open] .main-menu-panel>*:nth-child(6){animation-delay:.13s}.main-menu[open] .main-menu-panel>*:nth-child(7){animation-delay:.15s}.main-menu[open] .main-menu-panel>*:nth-child(8){animation-delay:.17s}.main-menu[open] .main-menu-panel>*:nth-child(9){animation-delay:.19s}.main-menu[open] .main-menu-panel>*:nth-child(n+10){animation-delay:.21s}
@keyframes mo-pop{from{opacity:0;transform:translateY(-6px) scale(.96)}to{opacity:1;transform:none}}
@keyframes mo-item{from{opacity:0;transform:translateX(6px)}to{opacity:1;transform:none}}

/* collapsibles open and close with a height transition (Chromium 131+, others keep the instant toggle) */
@supports (interpolate-size:allow-keywords){
  main details:not(.main-menu){interpolate-size:allow-keywords}
  main details:not(.main-menu)::details-content{block-size:0;overflow:clip;transition:block-size .3s var(--ease),content-visibility .3s allow-discrete}
  main details:not(.main-menu)[open]::details-content{block-size:auto}
}

/* press feedback */
@media (hover:hover){.button:not(:disabled):hover{transform:translateY(-1px)}.market-hour:hover,.market-window:hover{transform:translateY(-2px);box-shadow:var(--shadow-1)}}
.button:not(:disabled):active,.range-switch button:active,.dash .seg button:active,.mg-seg button:active,.market-mode-switch button:active,.page-nav a:active,.main-menu summary:active{transform:scale(.97)}
.range-switch button,.page-nav a,.market-mode-switch button{transition:background-color .18s var(--ease),color .18s var(--ease),border-color .18s var(--ease),transform .12s var(--ease)}
.dash .seg button{transition:background-color .18s var(--ease),color .18s var(--ease),box-shadow .18s var(--ease),transform .12s var(--ease)}
.main-menu summary{transition:border-color .18s var(--ease),transform .12s var(--ease)}
.market-hour,.market-window{transition:transform .2s var(--ease),box-shadow .2s var(--ease),border-color .2s var(--ease)}

/* live pill: spinner while fetching, ping + soft green when fresh */
.update-pill{transition:border-color .6s var(--ease),color .6s var(--ease)}
.update-pill i{box-sizing:border-box}
.update-pill.syncing i{width:9px;height:9px;background:transparent;border:2px solid var(--ok);border-right-color:transparent;animation:mo-spin .7s linear infinite}
.update-pill.pulse{border-color:color-mix(in srgb,var(--ok) 50%,var(--line));color:var(--text)}
.update-pill.pulse i{animation:mo-ping .9s var(--ease)}
@keyframes mo-spin{to{transform:rotate(360deg)}}
@keyframes mo-ping{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--ok) 55%,transparent);transform:scale(1.6)}100%{box-shadow:0 0 0 9px transparent;transform:scale(1)}}

/* attention: warn and error states ring once, never blink */
.status.offline,.status.warn{animation:mo-attn 1.4s var(--ease) 1}
.w-alert:not(.hidden):not([data-level="ok"]):not([data-level="unknown"]){animation:mo-attn-box 1.6s var(--ease) 1}
@keyframes mo-attn{0%{box-shadow:0 0 0 0 color-mix(in srgb,currentColor 55%,transparent)}100%{box-shadow:0 0 0 10px transparent}}
@keyframes mo-attn-box{0%{box-shadow:0 0 0 0 color-mix(in srgb,var(--bad) 40%,transparent)}100%{box-shadow:0 0 0 12px transparent}}

/* main chart: cursor, dots and time bubble glide instead of jumping */
.dash .w-chart .chart-marker{transition:transform .09s linear}
.dash .w-chart .chart-dot{transition:cx .09s linear,cy .09s linear}
.dash .w-chart .chart-marker-time{transition:left .09s linear}

/* battery forecast curve draws itself once per day-view */
.fc-reveal .ln{stroke-dasharray:var(--len,2000);animation:mo-draw 1.1s var(--ease) both}
.fc-reveal .area,.fc-reveal .band{animation:mo-fade .9s var(--ease) .35s both}
.fc-reveal .now,.fc-reveal .sunp{transform-box:fill-box;transform-origin:center;animation:mo-dot .6s var(--ease) both}
.fc-reveal .now{animation-delay:.1s}.fc-reveal .sunp{animation-delay:.9s}
.fc-reveal .sun,.fc-reveal .min{animation:mo-fade .6s var(--ease) .8s both}
.fc-reveal .lbl{animation:mo-fade .5s var(--ease) .6s both}
@keyframes mo-draw{from{stroke-dashoffset:var(--len,2000)}to{stroke-dashoffset:0}}
@keyframes mo-fade{from{opacity:0}}
@keyframes mo-dot{0%{transform:scale(0);opacity:0}60%{transform:scale(1.6);opacity:1}100%{transform:scale(1)}}

/* market prices */
.market-chart-wrap svg.grow .market-bar{transform-box:fill-box;animation:mo-grow .6s var(--ease) both;animation-delay:calc(min(var(--i,0),48)*9ms)}
.market-bar.current{animation:mo-now-bar 2.4s ease-in-out infinite}
.market-chart-wrap svg.grow .market-bar.current{animation:mo-grow .6s var(--ease) both calc(min(var(--i,0),48)*9ms),mo-now-bar 2.4s ease-in-out 1s infinite}
.market-bar.cheapest{filter:drop-shadow(0 0 5px color-mix(in srgb,#65a67b 70%,transparent))}
@keyframes mo-grow{from{transform:scaleY(0);opacity:.3}}
@keyframes mo-now-bar{50%{stroke-opacity:.3}}
.market-hour-grid.reveal .market-hour{animation:mo-rise .4s var(--ease) both;animation-delay:calc(min(var(--i,0),36)*16ms)}
.market-hour.current{animation:mo-now-card 2.8s ease-in-out infinite}
.market-hour-grid.reveal .market-hour.current{animation:mo-rise .4s var(--ease) both calc(min(var(--i,0),36)*16ms),mo-now-card 2.8s ease-in-out 1s infinite}
.market-hour.cheapest{border-color:color-mix(in srgb,var(--ok) 55%,var(--line));box-shadow:0 0 16px -6px var(--ok)}
@keyframes mo-now-card{50%{box-shadow:0 0 0 3px color-mix(in srgb,var(--accent) 22%,transparent)}}

/* wallbox: light sweep and glow while charging, history draws in */
.wallbox-hero{position:relative;overflow:hidden}
.wallbox-hero.charging:before{content:"";position:absolute;left:0;right:0;top:0;height:3px;pointer-events:none;background:linear-gradient(90deg,transparent,var(--ok),transparent) -70% 0/40% 100% no-repeat;animation:mo-sweep 2.2s linear infinite}
.wallbox-hero.charging .wallbox-primary article:first-child strong{animation:mo-charge 2.2s ease-in-out infinite}
@keyframes mo-sweep{to{background-position:170% 0}}
@keyframes mo-charge{50%{color:var(--ok);text-shadow:0 0 14px color-mix(in srgb,var(--ok) 55%,transparent)}}
.wallbox-chart.reveal .wallbox-power-line{stroke-dasharray:1;animation:mo-draw-1 1.2s var(--ease) both}
.wallbox-chart.reveal .wallbox-energy-bar{transform-box:fill-box;transform-origin:50% 100%;animation:mo-grow .6s var(--ease) both;animation-delay:calc(min(var(--i,0),40)*14ms)}
@keyframes mo-draw-1{from{stroke-dashoffset:1}to{stroke-dashoffset:0}}

/* skeleton shimmer for values that have not arrived yet */
.mo-skel{display:inline-block;min-width:2.6ch;color:transparent!important;text-shadow:none!important;border-radius:6px;background:linear-gradient(100deg,rgb(var(--ink) / .07) 30%,rgb(var(--ink) / .16) 50%,rgb(var(--ink) / .07) 70%) 0 0/220% 100%;animation:mo-shim 1.5s linear infinite}
@keyframes mo-shim{to{background-position:-220% 0}}

/* Energievorteil / Tibber: Preisbalken wachsen, Jetzt pulsiert, Fenster atmet */
.dash .tb-insight{animation:mo-rise .5s var(--ease) both}
.dash .tb-strip i{transform-origin:bottom;animation:mo-grow .6s var(--ease) both;animation-delay:calc(var(--i,0)*18ms + .12s)}
.dash .tb-strip i[data-now="1"]:after{animation:mo-pulse-dot 2.4s ease-in-out infinite}
.dash .tb-strip i[data-window="1"]:before{animation:mo-breathe 3.2s ease-in-out infinite}
@keyframes mo-pulse-dot{0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.9);opacity:.3}}
@keyframes mo-breathe{0%,100%{opacity:.5}50%{opacity:1}}
.dash .tb-pill,.dash .tb-edge{transition:background-color .5s ease,color .5s ease,border-color .5s ease}
.dash .tb-tip:not(.hidden),.dash .tb-edge:not(.hidden){animation:mo-item .45s var(--ease) .5s both}
.dash .w-save .ledger li{animation:mo-item .4s var(--ease) both}
.dash .w-save .ledger li:nth-child(2){animation-delay:.07s}.dash .w-save .ledger li:nth-child(3){animation-delay:.14s}
}
