/* anim-b.css — extra animations, loaded last.
   Section micro-motion for Displays, Sunlight, Our work and Design.
   Only transform, opacity, clip-path and background-position move. Loops run while their
   section is on screen and hold still for "Pause animation" and reduced motion. */

/* ==========================================================================
   Displays
   ========================================================================== */

/* the outline numbers write themselves in, left to right, once the tile opens */
.js #displays .dtile[data-reveal] .dtile__num {
  clip-path: inset(-20% -20% -20% -20%);
  transition:
    color .5s ease, -webkit-text-stroke-color .5s ease, opacity .5s ease,
    clip-path 1.1s cubic-bezier(.65, 0, .35, 1) calc(var(--rd, 0) * 90ms + .45s),
    translate 1.1s var(--ease-out) calc(var(--rd, 0) * 90ms + .45s);
}
.js #displays .dtile[data-reveal]:not(.is-in) .dtile__num {
  clip-path: inset(-20% 100% -20% -20%);
  translate: 0 14px;
}

/* a slow light runs through the hollow numbers now and then */
#displays .dtile__num {
  background: linear-gradient(100deg, transparent 40%, rgba(255, 244, 232, .7) 50%, transparent 60%) 100% 0 / 300% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  animation: ab-num-shine 9s ease-in-out infinite;
  animation-delay: calc(2.4s + var(--ab-d, 0s));
}
#displays .dtile--window { --ab-d: 1.2s; }
#displays .dtile--pharmacy { --ab-d: 2.4s; }
#displays .dtile--vwall { --ab-d: 3.6s; }
#displays .dtile--poster { --ab-d: 4.8s; }
@keyframes ab-num-shine {
  0% { background-position: 100% 0; }
  30%, 100% { background-position: 0 0; }
}

/* photo tiles: one soft sheet of light crosses the picture as the pointer arrives */
@media (hover: hover) and (pointer: fine) {
  #displays .dshot::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
    background: linear-gradient(105deg, transparent 38%, rgba(255, 246, 236, .05) 44%, rgba(255, 248, 240, .17) 50%, rgba(255, 246, 236, .05) 56%, transparent 62%);
    mix-blend-mode: screen;
    transform: translateX(-100%);
  }
  #displays .dtile:hover .dshot::after {
    transform: translateX(100%);
    transition: transform 1.3s cubic-bezier(.45, .05, .25, 1);
  }
}

/* the CTA band: a light travels along its coral edge, in step with the sweep inside it */
#displays .dshow__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 38%, rgba(255, 150, 110, .35) 45%, rgba(255, 214, 190, .95) 50%, rgba(255, 150, 110, .35) 55%, transparent 62%) 100% 0 / 300% 100% no-repeat;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: ab-cta-edge 8s ease-in-out infinite 2s;
}
@keyframes ab-cta-edge {
  0% { background-position: 100% 0; }
  45%, 100% { background-position: 0 0; }
}

/* ==========================================================================
   Sunlight
   ========================================================================== */

/* the ultra-bright pips light up one by one as the numbers count */
.js #bright .sunpips--ultra .sunpips__row i {
  transform-origin: 50% 100%;
  transition: opacity .5s ease, transform .6s cubic-bezier(.34, 1.56, .64, 1);
}
.js #bright .sunstats:not(.is-counted) .sunpips--ultra .sunpips__row i { opacity: .12; transform: scaleY(.3); }
#bright .sunpips--ultra .sunpips__row i:nth-child(2) { transition-delay: 70ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(3) { transition-delay: 140ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(4) { transition-delay: 210ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(5) { transition-delay: 280ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(6) { transition-delay: 350ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(7) { transition-delay: 420ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(8) { transition-delay: 490ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(9) { transition-delay: 560ms; }
#bright .sunpips--ultra .sunpips__row i:nth-child(10) { transition-delay: 630ms; }

/* the ultra bar and the heat line catch a glint once filled, then again every few seconds */
#bright :is(.sunbar--ultra .sunbar__track i, .suntherm__line i) { overflow: hidden; }
#bright :is(.sunbar--ultra .sunbar__track i, .suntherm__line i)::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 28%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 252, 240, .95), rgba(255, 255, 255, 0));
  opacity: 0;
  transform: translateX(-110%);
}
#bright .sunstats.is-counted :is(.sunbar--ultra .sunbar__track i, .suntherm__line i)::after {
  animation: ab-bar-glint 6.5s cubic-bezier(.45, 0, .2, 1) 1.5s infinite;
}
#bright .sunstats.is-counted .suntherm__line i::after { animation-delay: 1.9s; }
@keyframes ab-bar-glint {
  0% { opacity: 0; transform: translateX(-110%); }
  4% { opacity: 1; }
  24% { opacity: 1; transform: translateX(380%); }
  26%, 100% { opacity: 0; transform: translateX(380%); }
}

/* the feature icons answer the pointer, each in its own way */
@media (hover: hover) and (pointer: fine) {
  #bright .sunfeat .icon { transform-origin: 50% 50%; }
  #bright .sunfeat li:nth-child(1):hover .icon { animation: ab-ico-sun .9s cubic-bezier(.34, 1.4, .64, 1); }
  #bright .sunfeat li:nth-child(2):hover .icon { animation: ab-ico-blink .55s ease-in-out; }
  #bright .sunfeat li:nth-child(3):hover .icon { animation: ab-ico-turn .9s cubic-bezier(.65, 0, .35, 1); }
  #bright .sunfeat li:nth-child(4):hover .icon { animation: ab-ico-clock 1.1s cubic-bezier(.65, 0, .35, 1); }
  #bright .sunfeat li:nth-child(5):hover .icon { animation: ab-ico-cloud 1.2s ease-in-out; }
  #bright .sunfeat li:nth-child(6):hover .icon { animation: ab-ico-mount .8s cubic-bezier(.34, 1.4, .64, 1); }
}
@keyframes ab-ico-sun { 0% { transform: none; } 40% { transform: rotate(45deg) scale(1.16); } 100% { transform: rotate(90deg); } }
@keyframes ab-ico-blink { 0%, 100% { transform: none; } 40%, 55% { transform: scaleY(.12); } }
@keyframes ab-ico-turn { 0%, 100% { transform: none; } 45%, 60% { transform: rotate(-90deg); } }
@keyframes ab-ico-clock { from { transform: none; } to { transform: rotate(360deg); } }
@keyframes ab-ico-cloud { 0%, 100% { transform: none; } 30% { transform: translateX(4px); } 65% { transform: translateX(-3px); } }
@keyframes ab-ico-mount { 0%, 100% { transform: none; } 35% { transform: translateY(4px); } 65% { transform: translateY(-2px); } }

/* fine dust drifting through the sunbeams in the shop window: brighter as the sun gets stronger */
#bright .sf-window::before {
  content: "";
  position: absolute;
  top: -380px; left: -560px; right: 0; bottom: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 246, 222, .9) 0 .5px, transparent 2px),
    radial-gradient(circle at 37% 64%, rgba(255, 246, 222, .7) 0 .8px, transparent 2.6px),
    radial-gradient(circle at 58% 24%, rgba(255, 246, 222, .8) 0 .4px, transparent 1.8px),
    radial-gradient(circle at 74% 79%, rgba(255, 246, 222, .5) 0 1px, transparent 3.2px),
    radial-gradient(circle at 88% 44%, rgba(255, 246, 222, .85) 0 .5px, transparent 2px),
    radial-gradient(circle at 21% 86%, rgba(255, 246, 222, .45) 0 .7px, transparent 2.4px);
  background-size: 560px 380px;
  opacity: calc(.06 + var(--sun, .15) * var(--sun, .15) * .6);
  mix-blend-mode: screen;
  animation: ab-dust 70s linear infinite;
}
@keyframes ab-dust {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(560px, 380px, 0); }
}

/* ==========================================================================
   Our work
   ========================================================================== */

/* the wall photos: a glint crosses the glass as a photo lifts */
#work .wtile__btn::after {
  background: linear-gradient(110deg, transparent 42%, rgba(255, 250, 240, .07) 46%, rgba(255, 250, 240, .24) 50%, rgba(255, 250, 240, .07) 54%, transparent 58%) 100% 0 / 300% 100% no-repeat;
  transition: box-shadow .45s ease;
}
#work .wtile__btn:is(:hover, :focus-visible)::after {
  background-position: 0 0;
  transition: box-shadow .45s ease, background-position 1.1s cubic-bezier(.45, .05, .25, 1);
}

/* a chapter change: a soft film flash and a warm light leak from the edge of the frame */
#work .reelstage__media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  background:
    radial-gradient(50% 85% at 100% 30%, rgba(255, 150, 90, .5), transparent 70%),
    radial-gradient(80% 80% at 60% 45%, rgba(255, 246, 232, .32), transparent 75%);
  mix-blend-mode: screen;
  opacity: 0;
}
#work .reelstage.is-switching .reelstage__media::after { animation: ab-film-flash 1.1s ease-out both; }
@keyframes ab-film-flash {
  0% { opacity: 0; }
  14% { opacity: 1; }
  100% { opacity: 0; }
}

/* the caption writes across from the left, the bullet pops back in */
#work [data-reel-cap-text] {
  clip-path: inset(-20% -4% -20% 0);
  transition: clip-path .75s cubic-bezier(.22, .8, .3, 1) .05s;
}
#work .reelstage__cap.is-swapping [data-reel-cap-text] {
  clip-path: inset(-20% 100% -20% 0);
  transition: clip-path .24s ease-in;
}
#work .reelstage__cap .px-bullet { transition: scale .5s cubic-bezier(.34, 1.56, .64, 1); }
#work .reelstage__cap.is-swapping .px-bullet { scale: .2; transition: scale .2s ease-in; }

/* ==========================================================================
   Design & development
   ========================================================================== */

/* the canvas grid lives on its own layer, drifts very slowly and sits a little deeper on scroll */
#design {
  isolation: isolate;
  overflow: clip;
  background: var(--cream);
}
#design::before {
  content: "";
  position: absolute;
  inset: -90px 0 -90px -22px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(1.2px 1.2px at 50% 50%, rgba(18, 53, 43, .13) 99%, transparent) 0 0 / 22px 22px;
  animation: ab-grid-drift 26s linear infinite;
}
@keyframes ab-grid-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(22px, 22px, 0); }
}
@supports (animation-timeline: view()) {
  #design::before {
    animation: ab-grid-drift 26s linear infinite, ab-grid-depth linear both;
    animation-timeline: auto, view();
  }
  @keyframes ab-grid-depth {
    from { translate: 0 -48px; }
    to { translate: 0 48px; }
  }

  /* the artboard names type in, character by character, as each board scrolls up */
  /* the timeline belongs to the board: the label's own row clips (overflow), so it cannot be its own */
  #design .aboard { view-timeline: --ab-board block; }
  #design .aboard__top span:first-child {
    animation: ab-type steps(var(--ab-n, 16), end) both;
    animation-timeline: --ab-board;
    animation-range: entry 2% entry 34%;
  }
  #design .aboard--menu { --ab-n: 14; }
  #design .aboard--logo { --ab-n: 14; }
  #design .aboard--web { --ab-n: 22; }
  #design .aboard--seo { --ab-n: 29; }
  #design .aboard--social { --ab-n: 25; }
  #design .aboard--code { --ab-n: 23; }
  @keyframes ab-type {
    from { clip-path: inset(-30% 100% -30% 0); }
    to { clip-path: inset(-30% 0 -30% 0); }
  }
}

/* ==========================================================================
   Hold still: off screen, "Pause animation", reduced motion
   ========================================================================== */
:is(#displays, #bright):is(.perf-off, .is-off) .dtile__num,
:is(#displays, #bright):is(.perf-off, .is-off) :is(.dshow__cta, .sunbar__track i, .suntherm__line i)::after,
:is(#displays, #bright):is(.perf-off, .is-off) .sf-window::before,
#design:is(.perf-off, .is-off)::before,
html.is-paused #displays .dtile__num,
html.is-paused #displays .dshow__cta::after,
html.is-paused #bright .sf-window::before,
html.is-paused #bright .sunbar__track i::after,
html.is-paused #bright .suntherm__line i::after,
html.is-paused #design::before {
  animation-play-state: paused !important;
}
/* paused: the lights on the CTA edge and in the bars are hidden rather than frozen mid-way */
html.is-paused #displays .dshow__cta::after,
html.is-paused #bright .sunbar__track i::after,
html.is-paused #bright .suntherm__line i::after { opacity: 0 !important; }

@media (prefers-reduced-motion: reduce) {
  #displays .dtile__num,
  #displays .dshow__cta::after,
  #bright .sf-window::before,
  #bright :is(.sunbar--ultra .sunbar__track i, .suntherm__line i)::after,
  #bright .sunfeat .icon,
  #work .reelstage__media::after,
  #design::before,
  #design .aboard__top span:first-child { animation: none !important; }
  #displays .dshow__cta::after, #displays .dshot::after, #work .reelstage__media::after { display: none; }
  .js #displays .dtile[data-reveal] .dtile__num { clip-path: none !important; translate: none !important; }
  #design .aboard__top span:first-child { clip-path: none !important; }
  .js #bright .sunpips--ultra .sunpips__row i { opacity: 1 !important; transform: none !important; transition: none !important; }
  #work .wtile__btn::after { background: none; }
  #work [data-reel-cap-text], #work .reelstage__cap .px-bullet { clip-path: none !important; scale: none !important; transition: none !important; }
}
