/* motion.css: the gx- motion vocabulary, ported from the McDermaid site's
   motion.css, brand-glint.css and mobile menu, recoloured for this page.
   Paired with js/motion.js.

   House rule: site.css is the finished page. Every hidden start state below
   needs BOTH html.gx-motion (set by motion.js only when IntersectionObserver
   exists and the reader has not asked for reduced motion or forced colours)
   AND html[data-armed] (set only after the reader has really scrolled). So
   with no script, slow script, reduced motion or an unscrolled page, nothing
   is ever hidden. Only transform, opacity and clip-path move. Nothing loops.
   Hover motion is for a fine pointer only. Keyboard actions do not animate.

     .gx-rise   list parent: children rise one after another (--i)
     .gx-plate  grid parent: children fade in on a diagonal (--r, --c)
     .gx-ease   container: the photos inside ease to rest, never hidden
     .gx-rule   the host's own ::after rule draws (--y: vertical)
     .gx-head   a section heading: its wire draws, then its terminal stamps
     .gx-print  the dots field inside prints on from its corner, in steps (McDermaid mx-print)
     .glint     one band of light across a button, once, then on hover */
:root{--gx-ease:cubic-bezier(.16,1,.3,1);--gx-inout:cubic-bezier(.65,0,.35,1)}

/* Controls: small state changes, pointer and keyboard alike. Transform, opacity and colour only. */
@media(prefers-reduced-motion:no-preference){
  .btn{transition:background-color .18s}
  html.cta-live .top__call{transition:background-color .25s,border-color .25s,color .25s}
  .sw::after{transition:transform .22s var(--gx-ease),background-color .22s}
  .ckt::before{transition:transform .28s var(--gx-ease)}
  .z__on{transition:opacity .35s ease-out}
  .menu-btn path{transition:transform .24s var(--gx-ease),opacity .12s}
  .stick{transition:opacity .2s}
  .faq summary::after{transition:transform .24s var(--gx-ease)}
  .faq details[open] summary::after{transform:rotate(180deg)}
}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .nav__a::after{transition:transform .24s var(--gx-ease)}
  /* Resting a pointer on a breaker previews its part of the house. */
  .svc:has(.ckt[data-c="1"]:not([open]):hover) .z[data-z="1"] .z__on,.svc:has(.ckt[data-c="2"]:not([open]):hover) .z[data-z="2"] .z__on,.svc:has(.ckt[data-c="3"]:not([open]):hover) .z[data-z="3"] .z__on,.svc:has(.ckt[data-c="4"]:not([open]):hover) .z[data-z="4"] .z__on,.svc:has(.ckt[data-c="5"]:not([open]):hover) .z[data-z="5"] .z__on,.svc:has(.ckt[data-c="6"]:not([open]):hover) .z[data-z="6"] .z__on,.svc:has(.ckt[data-c="7"]:not([open]):hover) .z[data-z="7"] .z__on,.svc:has(.ckt[data-c="8"]:not([open]):hover) .z[data-z="8"] .z__on{opacity:.55}
}

/* The hero's one moment: the lights are switched on, once. A veil drawn in the
   photo's own coordinates has a soft hole over each group of fittings, and each
   hole starts plugged. The plugs lift one after another, left to right (the two
   walls, the steps, the kitchen), then the room comes up. Every value only ever
   gets brighter, in one pass: nothing blinks. The photo itself is painted from
   the first frame (it is the LCP image and waits on nothing). CSS only; with
   reduced motion the veil is never drawn. */
@media(prefers-reduced-motion:no-preference){
  .mast__veil{display:block}
  .veil__plug{animation:gx-light-on .6s cubic-bezier(.3,0,.3,1) both;animation-delay:calc(.25s + var(--n,0)*.17s)}
  .veil__room{animation:gx-room-up 1.5s cubic-bezier(.45,0,.25,1) .75s both}
}
@keyframes gx-light-on{from{opacity:1}to{opacity:0}}
@keyframes gx-room-up{from{opacity:.62}to{opacity:0}}

/* Glint (McDermaid brand-glint, the rim-light sweep only): the band sits under the label. */
.glint{position:relative;overflow:hidden;isolation:isolate}
.glint::before{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(105deg,transparent 30%,rgba(255,255,255,.5) 50%,transparent 70%);transform:translateX(-110%)}
@media(prefers-reduced-motion:no-preference){
  .glint::before{animation:gx-glint 1s ease-in-out 2.5s 1 both}
}
@media(hover:hover) and (pointer:fine) and (prefers-reduced-motion:no-preference){
  .glint:hover::before{animation:gx-glint-hover .9s ease-in-out 1}
}
@keyframes gx-glint{from{transform:translateX(-110%)}to{transform:translateX(110%)}}
@keyframes gx-glint-hover{from{transform:translateX(-110%)}to{transform:translateX(110%)}}

/* Phone menu: the rows land one after another; opened from the keyboard they are simply there. */
@media(prefers-reduced-motion:no-preference){
  html.js .top.is-open:not(.is-kb) .nav>*{animation:gx-rise .42s var(--gx-ease) both;animation-delay:calc(var(--i,0)*45ms)}
  html.js .top.is-open:not(.is-kb)::before{animation:gx-plate .24s ease-out both}
}

/* Armed reveals */
html.gx-motion[data-armed] .gx-rise:not(.is-in)>*{opacity:0;transform:translateY(14px)}
html.gx-motion .gx-rise.is-in>*{animation:gx-rise .6s var(--gx-ease) both;animation-delay:min(calc(var(--i,0)*70ms),420ms)}
/* Steps: each length of wire runs down to the next terminal as its step lands. */
html.gx-motion .steps.gx-rise.is-in>li::after{animation:gx-rule-y .5s var(--gx-inout) both;animation-delay:calc(min(calc(var(--i,0)*70ms),420ms) + .25s)}
@keyframes gx-rise{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}

html.gx-motion[data-armed] .gx-plate:not(.is-in)>*{opacity:0}
html.gx-motion .gx-plate.is-in>*{animation:gx-plate .7s var(--gx-ease) both;animation-delay:min(calc((var(--r,0) + var(--c,0))*60ms),420ms)}
@keyframes gx-plate{from{opacity:0}to{opacity:1}}

/* Photos are never hidden, clipped or covered: they only ease to rest, from a
   touch large, as the band comes into view. */
html.gx-motion[data-armed] .gx-ease:not(.is-in) img{transform:scale(1.06)}
html.gx-motion .gx-ease.is-in img{animation:gx-ease 1.1s var(--gx-ease) backwards}
@keyframes gx-ease{from{transform:scale(1.06)}to{transform:none}}

html.gx-motion[data-armed] .gx-rule:not(.is-in)::after{transform:scaleX(0)}
html.gx-motion[data-armed] .gx-rule--y:not(.is-in)::after{transform:scaleY(0)}
html.gx-motion .gx-rule.is-in::after{animation:gx-rule .9s var(--gx-inout) both}
html.gx-motion .gx-rule--y.is-in::after{animation-name:gx-rule-y}
@keyframes gx-rule{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes gx-rule-y{from{transform:scaleY(0)}to{transform:scaleY(1)}}
/* The call wire ends at its terminal, which stamps on as the wire arrives. */
html.gx-motion[data-armed] .call__num.gx-rule:not(.is-in)::before{opacity:0;transform:scale(.9)}
html.gx-motion .call__num.gx-rule.is-in::before{animation:gx-stamp .24s steps(3) .85s both}

/* The dots field prints on from the top corner it is flush with. The host is the band, not the
   field: a fully clipped element is never reported as on screen. */
html.gx-motion[data-armed] .gx-print:not(.is-in) .dots{clip-path:inset(0 0 100% 100%)}
html.gx-motion .gx-print.is-in .dots{animation:gx-print .35s steps(5) .2s both}
@keyframes gx-print{from{clip-path:inset(0 0 100% 100%)}to{clip-path:inset(0 0 0 0)}}

html.gx-motion[data-armed] .gx-head:not(.is-in) h2::after{transform:scaleX(0)}
html.gx-motion[data-armed] .gx-head:not(.is-in) h2::before{opacity:0;transform:scale(.9)}
html.gx-motion .gx-head.is-in h2::after{animation:gx-rule .5s var(--gx-inout) both}
html.gx-motion .gx-head.is-in h2::before{animation:gx-stamp .24s steps(3) .45s both}
@keyframes gx-stamp{from{opacity:0;transform:scale(.9)}to{opacity:1;transform:none}}

/* Settled: on screen when the page armed, or switched from the keyboard. Final state, no entrance. */
html.gx-motion .gx-settled,html.gx-motion .gx-settled>*,html.gx-motion .gx-settled>*::after,html.gx-motion .gx-settled img,html.gx-motion .gx-settled::before,html.gx-motion .gx-settled::after,html.gx-motion .gx-settled h2::before,html.gx-motion .gx-settled h2::after,html.gx-motion .gx-settled .dots{animation:none!important}

/* Belt to the brace: a preference flipped mid-visit. */
@media(prefers-reduced-motion:reduce),(forced-colors:active){
  html.gx-motion :is(.gx-rise,.gx-plate)>*,html.gx-motion .gx-ease img,html.gx-motion .steps>li::after,html.gx-motion .gx-rule::after,html.gx-motion .gx-rule::before,html.gx-motion .gx-head h2::before,html.gx-motion .gx-head h2::after,html.gx-motion .gx-print .dots{animation:none!important;opacity:1!important;transform:none!important;clip-path:none!important}
  .glint::before,.veil__plug,.veil__room{animation:none!important}
  .mast__veil{display:none!important}
}
