/* Ajisai theme: page tint, rain, falling drops, small garden life, and the watercolour cover. */

.view[data-theme="ajisai"] {
  --th: #6f8fc4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cg fill='%236f8fc4' fill-opacity='.055'%3E%3Cpath id='f' d='M0,0C-2,-6 -9,-9 -13,-13C-9,-17 -2,-12 0,0C6,-2 9,-9 13,-13C17,-9 12,-2 0,0C2,6 9,9 13,13C9,17 2,12 0,0C-6,2 -9,9 -13,13C-17,9 -12,2 0,0Z' transform='translate(52 60) rotate(12)'/%3E%3Cuse href='%23f' transform='translate(186 14) rotate(40) scale(.7)'/%3E%3Cuse href='%23f' transform='translate(118 204) rotate(-22) scale(.85)'/%3E%3Cuse href='%23f' transform='translate(262 150) rotate(64) scale(1.1)'/%3E%3Cuse href='%23f' transform='translate(14 280) rotate(30) scale(.6)'/%3E%3C/g%3E%3Cg fill='none' stroke='%238a7cc8' stroke-opacity='.05'%3E%3Ccircle cx='164' cy='108' r='9'/%3E%3Ccircle cx='164' cy='108' r='19'/%3E%3Ccircle cx='272' cy='268' r='7'/%3E%3Ccircle cx='272' cy='268' r='15'/%3E%3Ccircle cx='272' cy='268' r='25'/%3E%3Ccircle cx='40' cy='170' r='11'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting: the last fine rain comes and goes */
.fx-a.fx-ajisai-rain {
  animation-name: fx-ajisai-rain;
  animation-direction: normal;
  animation-timing-function: linear;
}
@keyframes fx-ajisai-rain {
  0% { transform: translate(0, 0); opacity: 0; }
  30% { opacity: var(--hi, .4); }
  70% { opacity: var(--hi, .4); }
  100% { transform: translate(var(--dx, -8px), var(--dy, 60px)); opacity: 0; }
}

/* a drop swells on a leaf tip, lets go, and the leaf springs back */
.fx-a.fx-ajisai-drip {
  animation-name: fx-ajisai-drip;
  animation-direction: normal;
  animation-timing-function: ease-in-out;
}
@keyframes fx-ajisai-drip {
  0% { transform: translateY(0) scale(.15); opacity: 0; }
  10% { opacity: .9; }
  56% { transform: translateY(0) scale(1); opacity: 1; animation-timing-function: cubic-bezier(.55, 0, .95, .6); }
  76% { transform: translateY(var(--dy, 80px)) scale(.86, 1.2); opacity: .9; }
  79%, 100% { transform: translateY(var(--dy, 80px)) scale(.86, 1.2); opacity: 0; }
}
.fx-a.fx-ajisai-spring {
  animation-name: fx-ajisai-spring;
  animation-direction: normal;
  animation-timing-function: ease-in-out;
}
@keyframes fx-ajisai-spring {
  0% { transform: rotate(0deg); }
  56% { transform: rotate(-1.6deg); }
  63% { transform: rotate(1.3deg); }
  71% { transform: rotate(-.7deg); }
  80% { transform: rotate(.3deg); }
  90%, 100% { transform: rotate(0deg); }
}
.fx-a.fx-ajisai-plink {
  animation-name: fx-ajisai-plink;
  animation-direction: normal;
  animation-timing-function: cubic-bezier(.2, .6, .3, 1);
  transform-box: fill-box;
  transform-origin: 50% 50%;
}
@keyframes fx-ajisai-plink {
  0%, 75% { transform: scale(.1); opacity: 0; }
  79% { opacity: .85; }
  100% { transform: scale(1); opacity: 0; }
}

/* the snail stretches as it goes */
.fx-a.fx-ajisai-inch {
  animation-name: fx-ajisai-inch;
  animation-duration: 3.4s;
  transform-origin: 8px 0;
}
@keyframes fx-ajisai-inch {
  from { transform: scaleX(.9); }
  to { transform: scaleX(1.12); }
}

/* the butterfly works its way round the flowers and rests on them */
.fx-a.fx-ajisai-flit {
  animation-name: fx-ajisai-flit;
  animation-direction: normal;
  animation-timing-function: cubic-bezier(.5, 0, .3, 1);
}
@keyframes fx-ajisai-flit {
  0%, 16% { transform: translate(0, 0) rotate(0deg); }
  28%, 42% { transform: translate(var(--ax, -80px), var(--ay, 40px)) rotate(-26deg); }
  54%, 66% { transform: translate(var(--bx, -40px), var(--by, -20px)) rotate(18deg); }
  78%, 90% { transform: translate(var(--cx, 50px), var(--cy, 10px)) rotate(34deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.fx-ajisai-wing { animation: fx-ajisai-wing .3s ease-in-out infinite alternate; }
@keyframes fx-ajisai-wing {
  from { transform: scaleX(1); }
  to { transform: scaleX(.46); }
}
.fx-paused .fx-ajisai-wing { animation-play-state: paused; }

/* ---- transition */
.fx-ajisai-wash,
.fx-ajisai-paper,
.fx-ajisai-field { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-ajisai-wash { z-index: 1; }
.fx-ajisai-paper {
  z-index: 2;
  opacity: 0;
  background-image: var(--fx-u-grain), var(--fx-u-fibre);
  mix-blend-mode: multiply;
  pointer-events: none;
}
.fx-ajisai-field { z-index: 3; pointer-events: none; }

/* caption on the pale pool in the middle of the cover */
.fx-cap--ajisai .fx-cap-glyph {
  color: #4a5596;
  text-shadow:
    0 0 .05em rgba(255, 255, 255, .95),
    0 0 .3em rgba(255, 255, 255, .85),
    0 0 .8em rgba(244, 244, 255, .8),
    0 .04em .1em rgba(74, 85, 150, .25);
}
.fx-cap--ajisai .fx-cap-label {
  border-radius: 3px;
  color: #4a5596;
  background: linear-gradient(135deg, rgba(255, 255, 252, .94), rgba(240, 242, 253, .9));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .9),
    inset 0 0 0 2px rgba(111, 143, 196, .5),
    0 0 0 1px rgba(111, 143, 196, .28),
    0 12px 26px -14px rgba(74, 85, 150, .6);
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-ajisai-rain,
  .fx-a.fx-ajisai-drip,
  .fx-a.fx-ajisai-spring,
  .fx-a.fx-ajisai-plink,
  .fx-a.fx-ajisai-inch,
  .fx-a.fx-ajisai-flit,
  .fx-ajisai-wing { animation: none; }
  .fx-a.fx-ajisai-rain,
  .fx-a.fx-ajisai-plink { opacity: 0; }
}
