/* Shoji theme: page tint, the small motions of the room, and the sliding-screen cover. */

/* page tint: a faint grid of light, as if cast through a lattice */
.view[data-theme="shoji"] {
  --th: #b98a5e;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='264' height='168'%3E%3Cg fill='%23e2b072' fill-opacity='.075' transform='skewX(-22)'%3E%3Cpath d='M70 6h56v36H70zM136 6h56v36h-56zM202 6h56v36h-56zM268 6h56v36h-56zM70 48h56v36H70zM136 48h56v36h-56zM202 48h56v36h-56zM268 48h56v36h-56zM4 6h56v36H4zM4 48h56v36H4z'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- painting */
.fx-a.fx-shoji-bird {
  animation-name: fx-shoji-bird;
  animation-direction: normal;
  animation-timing-function: ease-in-out;
}
@keyframes fx-shoji-bird {
  0% { transform: translate(var(--ix, 60px), var(--iy, -70px)) scale(1.6); opacity: 0; }
  7%, 20% { transform: translate(0, 0) scale(1); opacity: 1; }
  21.4% { transform: translate(calc(var(--hx, -10px) * .5), calc(var(--hy, 0px) * .5 - 4px)) scale(1); }
  22.8%, 37% { transform: translate(var(--hx, -10px), var(--hy, 0px)) scale(1); }
  38.4% { transform: translate(calc(var(--hx, -10px) * 1.5), calc(var(--hy, 0px) * 1.5 - 4px)) scale(1); }
  39.8%, 55% { transform: translate(calc(var(--hx, -10px) * 2), calc(var(--hy, 0px) * 2)) scale(1); }
  56.4% { transform: translate(calc(var(--hx, -10px) * 1.5), calc(var(--hy, 0px) * 1.5 - 4px)) scale(1); }
  57.8%, 70% { transform: translate(var(--hx, -10px), var(--hy, 0px)) scale(1); opacity: 1; }
  78%, 100% { transform: translate(var(--ox, -90px), var(--oy, -70px)) scale(1.7); opacity: 0; }
}

.fx-a.fx-shoji-steam {
  animation-name: fx-shoji-steam;
  animation-direction: normal;
  animation-timing-function: linear;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
@keyframes fx-shoji-steam {
  0% { transform: translate(0, 0) scale(.7, .45); opacity: 0; }
  30% { opacity: .8; }
  100% { transform: translate(var(--dx, 2px), var(--dy, -8px)) scale(1.5, 1.2); opacity: 0; }
}

.fx-a.fx-shoji-breath {
  animation-name: fx-shoji-breath;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
@keyframes fx-shoji-breath {
  from { transform: scale(1, 1); }
  to { transform: scale(1.008, 1.04); }
}

.fx-a.fx-shoji-ear {
  animation-name: fx-shoji-ear;
  animation-direction: normal;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
@keyframes fx-shoji-ear {
  0%, 40%, 46%, 52%, 100% { transform: rotate(0deg); }
  43% { transform: rotate(-10deg); }
  49% { transform: rotate(-6deg); }
}

.fx-a.fx-shoji-petal {
  animation-name: fx-shoji-petal;
  animation-direction: normal;
  animation-timing-function: ease-in;
}
@keyframes fx-shoji-petal {
  0%, 60% { transform: translate(0, 0) rotate(0deg); opacity: 0; }
  66% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  94% { opacity: 1; }
  100% { transform: translate(var(--dx, 4px), var(--dy, 10px)) rotate(220deg); opacity: 0; }
}

/* ---- transition: two paper screens */
.fx-shoji-flood,
.fx-shoji-paper { position: absolute; inset: 0; }
.fx-shoji-flood {
  opacity: 0;
  background:
    radial-gradient(60% 120% at 50% 50%, rgba(255, 252, 238, .98), rgba(255, 245, 216, .9) 50%, rgba(255, 238, 200, .78));
}
.fx-shoji-door {
  position: absolute;
  top: 0;
  height: 100%;
  overflow: hidden;
  will-change: transform;
  box-shadow: 0 0 70px rgba(140, 100, 60, .3);
}
.fx-shoji-door--l { left: 0; z-index: 2; }
.fx-shoji-door--r { right: 0; z-index: 1; }

/* washi lit from behind: warmer low down, brightest a little right of centre */
.fx-shoji-paper {
  background-color: #fbeccb;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(46% 52% at 50% 48%, rgba(255, 253, 242, .95), rgba(255, 250, 232, .5) 60%, rgba(255, 250, 232, 0) 100%),
    radial-gradient(50% 60% at 78% 30%, rgba(255, 250, 226, .9), rgba(255, 246, 216, 0) 100%),
    linear-gradient(180deg, rgba(244, 204, 142, .28), rgba(244, 204, 142, 0) 24%, rgba(243, 192, 120, 0) 62%, rgba(240, 180, 104, .46)),
    linear-gradient(96deg, #f8e2ba, #fdefd0 48%, #fff5dc);
}
.fx-shoji-door--l .fx-shoji-paper { background-position: 0 0; }
.fx-shoji-door--r .fx-shoji-paper { background-position: 100% 0; }
.fx-shoji-paper::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--fx-u-grain), var(--fx-u-fibre);
  opacity: .55;
  mix-blend-mode: multiply;
}
.fx-shoji-shade { position: absolute; top: 0; height: 100%; will-change: transform; }
.fx-shoji-door--l .fx-shoji-shade { left: 0; }
.fx-shoji-door--r .fx-shoji-shade { right: 0; }
.fx-shoji-shade svg { display: block; overflow: hidden; filter: blur(1.2px); }
.fx-shoji-wood { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }

/* a breath of light where the screens meet, so the caption sits on clear paper */
.fx-shoji-bloom {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  width: 124vmin;
  height: 92vmin;
  transform: translate(-50%, -50%);
  opacity: 0;
  background: radial-gradient(closest-side, rgba(255, 251, 236, .97), rgba(255, 249, 230, .93) 34%, rgba(255, 246, 222, .6) 60%, rgba(255, 244, 214, 0) 100%);
}

/* caption: brushed in warm sumi on the paper, label between two fine wooden rules */
.fx-cap--shoji .fx-cap-glyph {
  color: #6a4a36;
  text-shadow:
    0 0 .04em rgba(255, 250, 234, .9),
    0 .02em .06em rgba(120, 82, 50, .28),
    0 0 .5em rgba(255, 246, 220, .9);
}
.fx-cap--shoji .fx-cap-label {
  padding: .72em 1.2em .72em 1.62em;
  border-radius: 0;
  border-top: 1px solid rgba(160, 114, 72, .9);
  border-bottom: 1px solid rgba(160, 114, 72, .9);
  background: linear-gradient(90deg, rgba(255, 248, 228, 0), rgba(255, 248, 228, .7) 30%, rgba(255, 248, 228, .7) 70%, rgba(255, 248, 228, 0));
  box-shadow: none;
  color: #6f4e36;
}
.fx-cap--shoji.fx-cap--tate .fx-cap-label {
  padding: 1.2em .7em .9em;
  border: 0;
  border-left: 1px solid rgba(160, 114, 72, .9);
  border-right: 1px solid rgba(160, 114, 72, .9);
  background: linear-gradient(180deg, rgba(255, 248, 228, 0), rgba(255, 248, 228, .7) 30%, rgba(255, 248, 228, .7) 70%, rgba(255, 248, 228, 0));
}

@media (prefers-reduced-motion: reduce) {
  .fx-a.fx-shoji-bird,
  .fx-a.fx-shoji-steam,
  .fx-a.fx-shoji-breath,
  .fx-a.fx-shoji-ear,
  .fx-a.fx-shoji-petal { animation: none; }
}
