/* Momiji theme: page tint, seesawing leaves, pond life, and the leaf-stream cover. */

.view[data-theme="momiji"] {
  --th: #c9774f;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cg fill='%23c9774f' fill-opacity='.05'%3E%3Cpath id='m' d='M0,1.8L-2.2,3.7L-6.9,5.4L-5.3,2.9L-3.6,1L-6.9,1.4L-14.3,-2L-9.5,-2.9L-5.3,-2.9L-7.6,-4.7L-11.8,-14.1L-6.6,-10.8L-2.6,-7.3L-3.1,-9.2L0,-20L3.1,-9.2L2.6,-7.3L6.6,-10.8L11.8,-14.1L7.6,-4.7L5.3,-2.9L9.5,-2.9L14.3,-2L6.9,1.4L3.6,1L5.3,2.9L6.9,5.4L2.2,3.7L0,1.8V10' stroke='%23c9774f' stroke-opacity='.05' stroke-width='.6' transform='translate(46 58) rotate(24) scale(1.25)'/%3E%3Cuse href='%23m' transform='translate(168 6) rotate(96) scale(.8)'/%3E%3Cuse href='%23m' transform='translate(84 186) rotate(-52) scale(.95)'/%3E%3Cuse href='%23m' transform='translate(232 124) rotate(158) scale(.7)'/%3E%3Cuse href='%23m' transform='translate(6 262) rotate(212) scale(1.05)'/%3E%3C/g%3E%3Cg fill='%23e0a95c' fill-opacity='.05'%3E%3Ccircle cx='150' cy='84' r='15'/%3E%3Ccircle cx='258' cy='236' r='22'/%3E%3Ccircle cx='24' cy='138' r='10'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting: a leaf comes down swinging from side to side */
.fx-a.fx-momiji-fall {
  animation-name: fx-momiji-fall;
  animation-direction: normal;
  animation-timing-function: linear;
}
.fx-a.fx-momiji-rock {
  animation-name: fx-momiji-rock;
  animation-direction: normal;
}
@keyframes fx-momiji-fall {
  0% { transform: translate(var(--x, 0px), var(--y, 0px)); opacity: 0; }
  8% { opacity: 1; }
  88% { opacity: 1; }
  100% { transform: translate(calc(var(--x, 0px) + var(--dx, -60px)), calc(var(--y, 0px) + var(--dy, 400px))); opacity: 0; }
}
/* one full swing there and back; the leaf is highest and most tilted at each end */
@keyframes fx-momiji-rock {
  0%, 100% {
    transform: translate(calc(var(--sw, 30px) * -1), calc(var(--up, 6px) * -1)) rotate(calc(var(--tilt, 30deg) * -1));
    animation-timing-function: cubic-bezier(.45, 0, .8, .7);
  }
  25%, 75% {
    transform: translate(0, var(--up, 6px)) rotate(0deg);
    animation-timing-function: cubic-bezier(.2, .3, .55, 1);
  }
  50% {
    transform: translate(var(--sw, 30px), calc(var(--up, 6px) * -1)) rotate(var(--tilt, 30deg));
    animation-timing-function: cubic-bezier(.45, 0, .8, .7);
  }
}

/* koi circling, floating leaves turning */
.fx-a.fx-momiji-orbit {
  animation-name: fx-momiji-orbit;
  animation-direction: normal;
  animation-timing-function: linear;
}
@keyframes fx-momiji-orbit {
  to { transform: rotate(var(--rot, 360deg)); }
}

/* the dragonfly holds, darts, holds */
.fx-a.fx-momiji-dart {
  animation-name: fx-momiji-dart;
  animation-direction: normal;
  animation-timing-function: cubic-bezier(.6, 0, .3, 1);
}
@keyframes fx-momiji-dart {
  0%, 20% { transform: translate(0, 0); }
  27%, 46% { transform: translate(var(--ax, -30px), var(--ay, -10px)); }
  53%, 71% { transform: translate(var(--bx, 20px), var(--by, -20px)); }
  79%, 93% { transform: translate(var(--cx, 40px), var(--cy, 6px)); }
  100% { transform: translate(0, 0); }
}
.fx-momiji-wing { animation: fx-momiji-wing .13s linear infinite alternate; }
@keyframes fx-momiji-wing {
  from { transform: scaleY(1); }
  to { transform: scaleY(.62); }
}
.fx-paused .fx-momiji-wing { animation-play-state: paused; }

/* ---- transition */
.fx-momiji-cover,
.fx-momiji-water,
.fx-momiji-pond,
.fx-momiji-leaves { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-momiji-cover { z-index: 1; }
.fx-momiji-leaves { z-index: 3; pointer-events: none; }
.fx-momiji-pond svg { display: block; width: 100%; height: 100%; overflow: hidden; }

/* amber water: tree colours mirrored in the corners, a pool of light in the middle */
.fx-momiji-water {
  background-color: #94592e;
  background-image:
    radial-gradient(50% 42% at 50% 49%, rgba(255, 216, 142, .4), rgba(255, 206, 130, .16) 56%, rgba(255, 206, 130, 0) 100%),
    linear-gradient(112deg, rgba(255, 226, 160, 0) 24%, rgba(255, 226, 160, .13) 40%, rgba(255, 226, 160, 0) 52%, rgba(255, 226, 160, .08) 66%, rgba(255, 226, 160, 0) 78%),
    radial-gradient(70% 60% at 0% 0%, rgba(226, 132, 62, .62), rgba(226, 132, 62, 0) 70%),
    radial-gradient(70% 60% at 100% 100%, rgba(236, 158, 66, .55), rgba(236, 158, 66, 0) 70%),
    radial-gradient(60% 50% at 100% 0%, rgba(246, 200, 100, .46), rgba(246, 200, 100, 0) 70%),
    radial-gradient(64% 54% at 0% 100%, rgba(110, 112, 66, .6), rgba(110, 112, 66, 0) 72%),
    radial-gradient(90% 70% at 50% 110%, rgba(96, 62, 38, .5), rgba(96, 62, 38, 0) 70%),
    linear-gradient(165deg, #ad6c33 0%, #92562b 50%, #7b4a2a 100%);
}
.fx-momiji-water::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--fx-u-grain), var(--fx-u-fibre);
  opacity: .2;
}
.fx-momiji-glint { animation: fx-momiji-glint 3s ease-in-out infinite alternate both; }
@keyframes fx-momiji-glint {
  from { opacity: .12; }
  to { opacity: .6; }
}
.fx-momiji-koi { animation: fx-momiji-koi 5s ease-in-out both; }
@keyframes fx-momiji-koi {
  from { transform: translate(-2.4%, 1.2%); }
  to { transform: translate(2.4%, -1.2%); }
}

/* caption on the amber cover */
.fx-cap--momiji .fx-cap-glyph {
  color: #fff0cf;
  text-shadow:
    0 0 .04em rgba(255, 236, 190, .9),
    0 .03em .08em rgba(98, 50, 18, .55),
    0 0 .32em rgba(108, 58, 22, .6),
    0 0 .9em rgba(120, 66, 26, .5);
}
.fx-cap--momiji .fx-cap-label {
  border-radius: 4px;
  color: #6e4122;
  background: linear-gradient(135deg, #fbe9bd, #f1cd85 58%, #e6b767);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 232, .8),
    inset 0 0 0 3px #f1cd85,
    0 0 0 1px rgba(128, 74, 34, .4),
    0 12px 26px -12px rgba(70, 34, 12, .75);
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-momiji-fall,
  .fx-a.fx-momiji-rock,
  .fx-a.fx-momiji-orbit,
  .fx-a.fx-momiji-dart,
  .fx-momiji-wing,
  .fx-momiji-glint,
  .fx-momiji-koi { animation: none; }
  /* leaves hang where they were mid-fall */
  .fx-a.fx-momiji-fall {
    transform: translate(calc(var(--x, 0px) + var(--dx, 0px) * var(--f, .5)), calc(var(--y, 0px) + var(--dy, 0px) * var(--f, .5)));
  }
}
