/* Take theme: page tint, falling-leaf motion, and the bamboo curtain cover. */

/* page tint: faint culm shadows and a few leaf shadows on the paper */
.view[data-theme="take"] {
  --th: #6f9a62;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='340' height='420'%3E%3Cg fill='%236f9a62'%3E%3Cg fill-opacity='.04'%3E%3Cpath d='M28,0h13v118h-13zM28,122h13v150h-13zM28,276h13v144h-13z'/%3E%3Cpath d='M150,0h8v64h-8zM150,67h8v170h-8zM150,240h8v180h-8z'/%3E%3Cpath d='M262,0h17v190h-17zM262,195h17v182h-17zM262,382h17v38h-17z'/%3E%3C/g%3E%3Cg fill-opacity='.055'%3E%3Cpath id='l' d='M0,0C1.1,-2 2.9,-7 2.6,-13C2.2,-20 .9,-26 0,-31C-.9,-26 -2.2,-20 -2.6,-13C-2.9,-7 -1.1,-2 0,0Z' transform='translate(96 60) rotate(128) scale(1.3)'/%3E%3Cuse href='%23l' transform='translate(96 60) rotate(160) scale(1.1)'/%3E%3Cuse href='%23l' transform='translate(96 60) rotate(98)'/%3E%3Cuse href='%23l' transform='translate(214 250) rotate(-140) scale(1.2)'/%3E%3Cuse href='%23l' transform='translate(214 250) rotate(-172)'/%3E%3Cuse href='%23l' transform='translate(318 120) rotate(-118) scale(.9)'/%3E%3Cuse href='%23l' transform='translate(120 372) rotate(110) scale(.8)'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting */
.fx-a.fx-take-fall {
  animation-name: fx-take-fall;
  animation-direction: normal;
  animation-timing-function: linear;
}
.fx-a.fx-take-flip {
  animation-name: fx-take-flip;
  animation-direction: normal;
  animation-timing-function: linear;
}
@keyframes fx-take-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-take-flip {
  0% { transform: rotate(var(--r0, 0deg)) scaleX(1); }
  25% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .25)) scaleX(.25); }
  50% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .5)) scaleX(-.85); }
  75% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .75)) scaleX(.25); }
  100% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg))) scaleX(1); }
}

/* the bird looks round now and then */
.fx-a.fx-take-peek {
  animation: fx-take-peek 11s ease-in-out infinite normal both;
}
@keyframes fx-take-peek {
  0%, 50% { transform: rotate(0deg); }
  57%, 68% { transform: rotate(-15deg); }
  75%, 84% { transform: rotate(7deg); }
  91%, 100% { transform: rotate(0deg); }
}

/* butterfly: wings fold, and the whole insect crosses the grove once per cycle */
.fx-a.fx-take-flap {
  animation: fx-take-flap .46s ease-in-out infinite alternate both;
}
@keyframes fx-take-flap {
  from { transform: scaleX(1); }
  to { transform: scaleX(.22); }
}
.fx-a.fx-take-cross {
  animation: fx-take-cross 34s linear infinite normal both;
  animation-delay: -27s;
}
@keyframes fx-take-cross {
  0% { transform: translate(var(--x, 0px), var(--y, 0px)); opacity: 0; }
  4% { opacity: 1; }
  44% { opacity: 1; }
  50% { transform: translate(calc(var(--x, 0px) + var(--dx, 400px)), calc(var(--y, 0px) + var(--dy, -100px))); opacity: 0; }
  100% { transform: translate(calc(var(--x, 0px) + var(--dx, 400px)), calc(var(--y, 0px) + var(--dy, -100px))); opacity: 0; }
}

/* ---- transition */
.fx-take-cover,
.fx-take-base,
.fx-take-tier { position: absolute; inset: 0; }
.fx-take-cover { z-index: 1; overflow: hidden; }
.fx-take-defs { position: absolute; }

/* the misty morning light that shows between the furthest culms */
.fx-take-base {
  opacity: 0;
  background:
    radial-gradient(80% 70% at 22% 0%, rgba(255, 252, 214, .9), rgba(255, 252, 214, 0) 70%),
    linear-gradient(172deg, #eef5d0, #d6e8b6 46%, #b4d498);
}
.fx-take-pole {
  position: absolute;
  top: 0;
  height: 100%;
  transform-origin: 50% 100%;
  will-change: transform;
}
.fx-take-far .fx-take-pole { filter: blur(.9px); }
.fx-take-pole svg,
.fx-take-top svg,
.fx-take-soft svg,
.fx-take-air svg { display: block; overflow: visible; }
.fx-take-top {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  will-change: transform;
}
.fx-take-soft {
  position: absolute;
  inset: 0;
  filter: blur(4px);
  opacity: .92;
  will-change: transform;
}

/* haze between the far and the middle culms */
.fx-take-mist {
  opacity: 0;
  background:
    radial-gradient(75% 65% at 24% 4%, rgba(255, 251, 210, .5), rgba(250, 250, 206, 0) 100%),
    linear-gradient(180deg, rgba(196, 224, 190, .16), rgba(206, 230, 196, .12) 55%, rgba(238, 246, 220, .55) 100%);
}
/* thinner haze in front of the middle culms, mist at their feet, a darker frame,
   and a deeper green where the caption sits */
.fx-take-haze {
  opacity: 0;
  background:
    radial-gradient(36% 38% at 50% 51%, rgba(62, 116, 72, .62), rgba(74, 128, 80, .34) 58%, rgba(84, 138, 84, 0) 100%),
    radial-gradient(64% 56% at 26% 0%, rgba(255, 251, 208, .42), rgba(250, 250, 204, 0) 100%),
    linear-gradient(180deg, rgba(240, 248, 214, 0) 66%, rgba(240, 248, 214, .5) 100%),
    linear-gradient(90deg, rgba(34, 88, 58, .26), rgba(34, 88, 58, 0) 22%, rgba(34, 88, 58, 0) 80%, rgba(34, 88, 58, .24));
}
/* shafts of morning light slanting across the grove */
.fx-take-light {
  left: -20%;
  right: -20%;
  opacity: 0;
  background: linear-gradient(
    112deg,
    rgba(255, 252, 214, 0) 6%,
    rgba(255, 252, 214, .44) 17%,
    rgba(255, 252, 214, .06) 27%,
    rgba(255, 252, 214, .3) 35%,
    rgba(255, 252, 214, 0) 47%,
    rgba(255, 252, 214, 0) 60%,
    rgba(255, 252, 214, .3) 69%,
    rgba(255, 252, 214, .04) 77%,
    rgba(255, 252, 214, .24) 84%,
    rgba(255, 252, 214, 0) 94%
  );
}
/* the sweep of sunlight that comes through as the culms part */
.fx-take-glow {
  opacity: 0;
  background: radial-gradient(50% 72% at 50% 46%, rgba(255, 252, 226, .96), rgba(255, 250, 212, .5) 44%, rgba(255, 250, 212, 0) 72%);
}
.fx-take-air { opacity: 0; }
.fx-take-grain {
  opacity: 0;
  background-image: var(--fx-u-grain), var(--fx-u-fibre);
  mix-blend-mode: multiply;
  filter: opacity(.45);
}

.fx-take-mote { animation: fx-take-mote 3s ease-in-out infinite alternate both; }
@keyframes fx-take-mote {
  from { opacity: .15; transform: translate(0, 0); }
  to { opacity: .9; transform: translate(7px, -5px); }
}
.fx-take-drop { animation: fx-take-drop 3.2s linear both; }
@keyframes fx-take-drop {
  0% { transform: translate(var(--x, 0px), var(--y, 0px)) rotate(0deg); opacity: 0; }
  12% { opacity: 1; }
  100% { transform: translate(calc(var(--x, 0px) + var(--dx, 60px)), calc(var(--y, 0px) + var(--dy, 400px))) rotate(200deg); opacity: 1; }
}

/* caption: cream brush glyph in the green light, label between two gold hairlines */
.fx-cap--take .fx-cap-glyph {
  color: #fdf9e4;
  text-shadow:
    0 0 .04em rgba(255, 252, 226, .6),
    0 .03em .09em rgba(40, 84, 52, .5),
    0 0 .5em rgba(52, 100, 60, .35),
    0 0 .9em rgba(255, 244, 180, .22);
}
.fx-cap--take .fx-cap-label {
  position: relative;
  padding: .72em 1.5em .72em 1.92em;
  border-radius: 0;
  border-top: 1px solid rgba(243, 227, 191, .9);
  border-bottom: 1px solid rgba(243, 227, 191, .9);
  background: linear-gradient(90deg, rgba(46, 92, 56, 0), rgba(46, 92, 56, .34) 28%, rgba(46, 92, 56, .34) 72%, rgba(46, 92, 56, 0));
  box-shadow: 0 -3px 0 -2px rgba(243, 227, 191, .4), 0 3px 0 -2px rgba(243, 227, 191, .4);
  color: #fdf9e4;
  text-shadow: 0 1px 6px rgba(34, 70, 44, .65);
}
.fx-cap--take.fx-cap--tate .fx-cap-label {
  padding: 1.3em .72em 1em;
  border: 0;
  border-left: 1px solid rgba(243, 227, 191, .9);
  border-right: 1px solid rgba(243, 227, 191, .9);
  background: linear-gradient(180deg, rgba(46, 92, 56, 0), rgba(46, 92, 56, .34) 28%, rgba(46, 92, 56, .34) 72%, rgba(46, 92, 56, 0));
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-take-fall,
  .fx-a.fx-take-flip,
  .fx-a.fx-take-peek,
  .fx-a.fx-take-flap,
  .fx-a.fx-take-cross,
  .fx-take-mote,
  .fx-take-drop { animation: none; }
  /* leaves hang where they were mid-fall */
  .fx-a.fx-take-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-take-flip { transform: rotate(var(--r0, 0deg)); }
  .fx-a.fx-take-cross { transform: translate(calc(var(--x, 0px) + var(--dx, 0px) * .5), calc(var(--y, 0px) + var(--dy, 0px) * .5)); }
}
