/* Wagara theme: page tint, drifting leaf and scraps, and the gift-wrap cover. */

/* page tint: a very faint shippo lattice */
.view[data-theme="wagara"] {
  --th: #c8566b;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64'%3E%3Cg fill='none' stroke='%23c8566b' stroke-opacity='.05'%3E%3Ccircle r='45.25'/%3E%3Ccircle cx='64' r='45.25'/%3E%3Ccircle cy='64' r='45.25'/%3E%3Ccircle cx='64' cy='64' r='45.25'/%3E%3C/g%3E%3Cg fill='%23cfae78' fill-opacity='.1'%3E%3Ccircle r='1.6'/%3E%3Ccircle cx='64' r='1.6'/%3E%3Ccircle cy='64' r='1.6'/%3E%3Ccircle cx='64' cy='64' r='1.6'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting */
.fx-a.fx-wagara-fall {
  animation-name: fx-wagara-fall;
  animation-direction: normal;
  animation-timing-function: linear;
}
.fx-a.fx-wagara-flip {
  animation-name: fx-wagara-flip;
  animation-direction: normal;
  animation-timing-function: linear;
}
@keyframes fx-wagara-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, -80px)), calc(var(--y, 0px) + var(--dy, 400px))); opacity: 0; }
}
/* a flake turns over and shows its edge on the way */
@keyframes fx-wagara-flip {
  0% { transform: rotate(var(--r0, 0deg)) scaleY(1); }
  25% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .25)) scaleY(.25); }
  50% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .5)) scaleY(-.85); }
  75% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg) * .75)) scaleY(.25); }
  100% { transform: rotate(calc(var(--r0, 0deg) + var(--rot, 360deg))) scaleY(1); }
}
/* light walking over the gold lines of a sheet */
.fx-wagara-sheen {
  opacity: 0;
  animation: fx-wagara-sheen 21s ease-in-out infinite both;
}
@keyframes fx-wagara-sheen {
  0%, 10%, 100% { opacity: 0; }
  4.5% { opacity: .95; }
}

/* ---- transition */
.fx-wagara-cover,
.fx-wagara-back,
.fx-wagara-trim,
.fx-wagara-flakes { position: absolute; inset: 0; width: 100%; height: 100%; }
.fx-wagara-cover { z-index: 1; overflow: hidden; }
.fx-wagara-back { background: #fbf2e3; opacity: 0; }
.fx-wagara-flakes { z-index: 3; pointer-events: none; }
.fx-wagara-sheet {
  position: absolute;
  will-change: transform;
  box-shadow: 3px 7px 14px rgba(120, 72, 88, .36), 1px 2px 3px rgba(120, 72, 88, .2);
}
.fx-wagara-fuzz { position: absolute; inset: -3px; background: #fffbf3; }
.fx-wagara-face { position: absolute; inset: 3px; background-repeat: repeat, no-repeat; }
.fx-wagara-card { position: absolute; perspective: 2600px; }
.fx-wagara-lay {
  position: absolute;
  inset: 16px 12px 8px 16px;
  border-radius: 4px;
  box-shadow: 5px 12px 22px 2px rgba(120, 72, 88, .55), 1px 3px 5px rgba(120, 72, 88, .34);
}
.fx-wagara-half {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  backface-visibility: hidden;
  will-change: transform, opacity;
}
.fx-wagara-half--a { top: 0; transform-origin: 50% 100%; }
.fx-wagara-half--b { top: 50%; transform-origin: 50% 0; }
.fx-wagara-half svg { position: absolute; left: 0; top: 0; display: block; width: 100%; height: 200%; }
.fx-wagara-half--b svg { top: -100%; }
.fx-wagara-trim svg { display: block; width: 100%; height: 100%; }
.fx-wagara-deco { will-change: opacity, transform; }

/* caption: a rose-vermilion brush glyph on the card, the label in gold-brown between hairlines */
.fx-cap--wagara .fx-cap-glyph {
  color: #c9525e;
  text-shadow:
    0 0 .04em rgba(255, 252, 244, .9),
    0 .03em .1em rgba(160, 84, 70, .18);
}
.fx-cap--wagara .fx-cap-label {
  padding: .62em 1.1em .62em 1.52em;
  border-radius: 0;
  border-top: 1px solid rgba(207, 174, 120, .9);
  border-bottom: 1px solid rgba(207, 174, 120, .9);
  background: linear-gradient(90deg, rgba(243, 227, 191, 0), rgba(243, 227, 191, .5) 30%, rgba(243, 227, 191, .5) 70%, rgba(243, 227, 191, 0));
  box-shadow: none;
  color: #8f6a3a;
}
/* keep the upright pair on the card: centred as a row, still sharing a foot */
.fx-cap--wagara.fx-cap--tate { flex-wrap: wrap; align-content: center; }
.fx-cap--wagara.fx-cap--tate .fx-cap-label {
  padding: 1.1em .62em .8em;
  border: 0;
  border-left: 1px solid rgba(207, 174, 120, .9);
  border-right: 1px solid rgba(207, 174, 120, .9);
  background: linear-gradient(180deg, rgba(243, 227, 191, 0), rgba(243, 227, 191, .5) 30%, rgba(243, 227, 191, .5) 70%, rgba(243, 227, 191, 0));
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-wagara-fall,
  .fx-a.fx-wagara-flip,
  .fx-wagara-sheen { animation: none; }
  .fx-a.fx-wagara-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-wagara-flip { transform: rotate(var(--r0, 0deg)); }
}
