/* Sakura theme: page tint, falling-petal motion, and the blossom blizzard cover. */

.view[data-theme="sakura"] {
  --th: #c96a84;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='%23c96a84' fill-opacity='.055'%3E%3Cpath id='p' d='M0,9.5C-3,8 -7.5,3 -6.6,-3C-6,-7 -3.6,-9.2 -1.3,-9.8L0,-7.6L1.3,-9.8C3.6,-9.2 6,-7 6.6,-3C7.5,3 3,8 0,9.5Z' transform='translate(38 46) rotate(24)'/%3E%3Cuse href='%23p' transform='translate(142 -8) rotate(70) scale(.7)'/%3E%3Cuse href='%23p' transform='translate(60 150) rotate(-40) scale(.8)'/%3E%3Cuse href='%23p' transform='translate(196 96) rotate(150) scale(.6)'/%3E%3Cuse href='%23p' transform='translate(-18 190) rotate(200) scale(.9)'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting: petals that fall, fade at both ends and turn over */
.fx-a.fx-sakura-fall {
  animation-name: fx-sakura-fall;
  animation-direction: normal;
  animation-timing-function: linear;
}
.fx-a.fx-sakura-flip {
  animation-name: fx-sakura-flip;
  animation-direction: normal;
  animation-timing-function: linear;
}
@keyframes fx-sakura-fall {
  0% { transform: translate(var(--x, 0px), var(--y, 0px)); opacity: 0; }
  7% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translate(calc(var(--x, 0px) + var(--dx, -80px)), calc(var(--y, 0px) + var(--dy, 400px))); opacity: 0; }
}
@keyframes fx-sakura-flip {
  0% { transform: rotate(var(--r0, 0deg)) scaleY(1); }
  25% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .25)) scaleY(.2); }
  50% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .5)) scaleY(-.8); }
  75% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .75)) scaleY(.2); }
  100% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg))) scaleY(1); }
}
/* a petal that glides, rocking from side to side */
.fx-a.fx-sakura-rock { animation-name: fx-sakura-rock; }
@keyframes fx-sakura-rock {
  from { transform: rotate(calc(var(--r0, 0deg) - 34deg)) scaleY(.5); }
  to { transform: rotate(calc(var(--r0, 0deg) + 34deg)) scaleY(.92); }
}
/* reflections under the far bank lengthen and lean with the water */
.fx-a.fx-sakura-waver { animation-name: fx-sakura-waver; }
@keyframes fx-sakura-waver {
  from { transform: skewX(-1.6deg) scaleY(.92); }
  to { transform: skewX(1.6deg) scaleY(1.08); }
}
/* the swan: across, a slow turn, and back */
.fx-a.fx-sakura-glide {
  animation-name: fx-sakura-glide;
  animation-direction: normal;
  animation-timing-function: ease-in-out;
}
@keyframes fx-sakura-glide {
  0% { transform: translateX(0) scaleX(1); }
  45% { transform: translateX(var(--dx, -120px)) scaleX(1); }
  50% { transform: translateX(var(--dx, -120px)) scaleX(-1); }
  95% { transform: translateX(0) scaleX(-1); }
  100% { transform: translateX(0) scaleX(1); }
}
/* the bird on the bough */
.fx-a.fx-sakura-hop,
.fx-a.fx-sakura-peek {
  animation-direction: normal;
  animation-timing-function: ease-in-out;
}
.fx-a.fx-sakura-hop { animation-name: fx-sakura-hop; }
.fx-a.fx-sakura-peek { animation-name: fx-sakura-peek; }
@keyframes fx-sakura-hop {
  0%, 58% { transform: translate(0, 0); }
  59.6% { transform: translate(-2.6px, -2.6px); }
  61.2%, 86% { transform: translate(-5.2px, .5px); }
  87.6% { transform: translate(-2.6px, -2.4px); }
  89.2%, 100% { transform: translate(0, 0); }
}
@keyframes fx-sakura-peek {
  0%, 30% { transform: rotate(0deg); }
  33%, 49% { transform: rotate(15deg); }
  52%, 70% { transform: rotate(-11deg); }
  73%, 84% { transform: rotate(6deg); }
  87%, 100% { transform: rotate(0deg); }
}
/* a ribbon of petals on a passing breath of wind */
.fx-a.fx-sakura-gust {
  animation-name: fx-sakura-gust;
  animation-direction: normal;
  animation-timing-function: cubic-bezier(.3, 0, .55, 1);
}
@keyframes fx-sakura-gust {
  0%, 58% { transform: translate(var(--x0, 1500px), var(--y0, 100px)); opacity: 0; }
  62% { opacity: .95; }
  90% { opacity: .9; }
  100% { transform: translate(var(--x1, 300px), var(--y1, 300px)); opacity: 0; }
}
.fx-sakura-wing { animation: fx-sakura-wing .3s ease-in-out infinite alternate; }
@keyframes fx-sakura-wing {
  from { transform: scaleX(1); }
  to { transform: scaleX(.3); }
}

/* ---- transition */
.fx-sakura-cover,
.fx-sakura-wash,
.fx-sakura-light,
.fx-sakura-deep,
.fx-sakura-sprays,
.fx-sakura-petals { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-sakura-cover { z-index: 1; }
.fx-sakura-petals { z-index: 3; pointer-events: none; }
.fx-sakura-sprays svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.fx-sakura-spray { transform-origin: 0 0; }
.fx-sakura-deep { filter: blur(4px); }
.fx-sakura-deep svg { display: block; width: 100%; height: 100%; overflow: hidden; }
/* morning light coming through the blossom from the corner the bough grows from */
.fx-sakura-light {
  background-image: radial-gradient(56% 64% at 4% 2%, rgba(255, 247, 224, .92), rgba(255, 240, 222, .5) 42%, rgba(255, 240, 224, 0) 76%);
  animation: fx-sakura-breath 3.8s ease-in-out infinite alternate both;
}
@keyframes fx-sakura-breath {
  from { opacity: .55; }
  to { opacity: 1; }
}
/* once grown in, the sprays keep stirring while the caption is up */
.fx-sakura-breeze {
  transform-origin: 0 0;
  animation: fx-sakura-breeze 3.6s ease-in-out 1s infinite alternate both;
}
@keyframes fx-sakura-breeze {
  from { transform: rotate(0deg); }
  to { transform: rotate(var(--rot, .8deg)); }
}

/* blush washi with a clear, light middle */
.fx-sakura-wash {
  background-color: #fbe6ea;
  background-image:
    radial-gradient(58% 46% at 50% 47%, rgba(255, 252, 247, .96), rgba(255, 250, 246, .6) 52%, rgba(255, 250, 246, 0) 100%),
    radial-gradient(70% 60% at 0% 0%, rgba(244, 178, 197, .5), rgba(244, 178, 197, 0) 70%),
    radial-gradient(70% 60% at 100% 100%, rgba(240, 170, 194, .5), rgba(240, 170, 194, 0) 70%),
    radial-gradient(60% 50% at 100% 0%, rgba(226, 214, 240, .7), rgba(226, 214, 240, 0) 70%),
    radial-gradient(60% 50% at 0% 100%, rgba(255, 226, 206, .75), rgba(255, 226, 206, 0) 70%),
    linear-gradient(160deg, #fdeef0 0%, #f9dde6 52%, #efe1f1 100%);
}
/* out-of-focus lights */
.fx-sakura-wash::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 16% 62%, rgba(255, 255, 255, .34) 0, rgba(255, 255, 255, .42) 5.4vmin, rgba(255, 255, 255, 0) 6vmin),
    radial-gradient(circle at 27% 82%, rgba(255, 240, 236, .4) 0, rgba(255, 246, 240, .5) 8.2vmin, rgba(255, 255, 255, 0) 9vmin),
    radial-gradient(circle at 8% 38%, rgba(246, 188, 205, .26) 0, rgba(246, 188, 205, .34) 3.6vmin, rgba(255, 255, 255, 0) 4.1vmin),
    radial-gradient(circle at 84% 34%, rgba(255, 255, 255, .34) 0, rgba(255, 255, 255, .44) 6.6vmin, rgba(255, 255, 255, 0) 7.3vmin),
    radial-gradient(circle at 73% 14%, rgba(246, 188, 205, .24) 0, rgba(246, 188, 205, .32) 4.4vmin, rgba(255, 255, 255, 0) 5vmin),
    radial-gradient(circle at 92% 58%, rgba(255, 244, 232, .4) 0, rgba(255, 244, 232, .5) 3.2vmin, rgba(255, 255, 255, 0) 3.7vmin),
    radial-gradient(circle at 60% 90%, rgba(255, 255, 255, .3) 0, rgba(255, 255, 255, .4) 4.6vmin, rgba(255, 255, 255, 0) 5.2vmin),
    radial-gradient(circle at 38% 9%, rgba(255, 255, 255, .3) 0, rgba(255, 255, 255, .4) 3.8vmin, rgba(255, 255, 255, 0) 4.3vmin);
}
/* paper fibre and grain */
.fx-sakura-wash::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--fx-u-grain), var(--fx-u-fibre);
  opacity: .5;
  mix-blend-mode: multiply;
}

.fx-sakura-pop {
  animation: fx-sakura-pop 560ms cubic-bezier(.3, 1.35, .5, 1) both;
}
@keyframes fx-sakura-pop {
  0% { transform: scale(0) rotate(-50deg); opacity: 0; }
  40% { opacity: 1; }
  100% { transform: none; opacity: 1; }
}

.fx-sakura-wood { animation: fx-sakura-wood 520ms ease-out both; }
@keyframes fx-sakura-wood {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* caption on the blush cover */
.fx-cap--sakura .fx-cap-glyph {
  color: #8e4160;
  text-shadow:
    0 0 .05em rgba(255, 252, 248, .95),
    0 0 .22em rgba(255, 250, 246, .9),
    0 0 .7em rgba(255, 244, 240, .85),
    0 .05em .14em rgba(150, 70, 100, .16);
}
.fx-cap--sakura .fx-cap-label {
  border-radius: 4px;
  color: #fffaf5;
  background: linear-gradient(135deg, #d98aa0, #c96a84 60%, #bd5f7b);
  box-shadow:
    inset 0 0 0 1px rgba(255, 250, 244, .62),
    inset 0 0 0 3px #c96a84,
    0 0 0 1px rgba(207, 174, 120, .55),
    0 12px 26px -14px rgba(160, 70, 104, .7);
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-sakura-fall,
  .fx-a.fx-sakura-flip,
  .fx-a.fx-sakura-rock,
  .fx-a.fx-sakura-waver,
  .fx-a.fx-sakura-glide,
  .fx-a.fx-sakura-hop,
  .fx-a.fx-sakura-peek,
  .fx-a.fx-sakura-gust,
  .fx-sakura-wing,
  .fx-sakura-light,
  .fx-sakura-breeze,
  .fx-sakura-pop,
  .fx-sakura-wood { animation: none; }
  /* petals hang where they were mid-fall */
  .fx-a.fx-sakura-fall {
    transform: translate(calc(var(--x, 0px) + var(--dx, 0px) * var(--f, .5)), calc(var(--y, 0px) + var(--dy, 0px) * var(--f, .5)));
  }
  .fx-a.fx-sakura-flip,
  .fx-a.fx-sakura-rock { transform: rotate(var(--r0, 0deg)); }
  .fx-a.fx-sakura-gust { opacity: 0; }
}
