/* 洗う節の洗濯機の絵（washer-figure.mjs の SVG）。前開きの洗濯機の丸い窓の奥で、ドラムが行って戻り、
   枕が壁を上っては水へ落ち、水面が傾き、泡が上る。8秒で1巡。動きは transform と opacity だけ。
   washer.js が画面にある間だけ .is-running を付けて動かす（それまでと画面の外では止まったまま）。
   動きを減らす設定では止まった1枚（ドラムは止まり、枕は底の水の中、泡は浮いたまま）。
   置き場所は .gb-wash__detail の先頭（PC は見出しと横並び、スマホは手順のすぐ後ろ）。 */
.gb-washer {
  display: grid;
  grid-template-columns: minmax(0, 240px) auto;
  justify-content: start;
  align-items: end;
  column-gap: 14px;
  margin-top: 30px;
}
.gb-wash__detail > .gb-washer {
  margin: 0 0 14px;
}
.gb-washer__art {
  display: block;
  width: 100%;
  height: auto;
}
.gb-washer figcaption {
  grid-column: 1 / -1;
}
/* a link-like button (the page has one kind of button, the navy one; the rest are underlined) */
.gb-washer__toggle {
  min-height: 44px;
  margin-bottom: -10px;
  white-space: nowrap;
  padding: 0 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 13px/1 var(--sans);
  letter-spacing: 0.08em;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.gb-washer__toggle:focus-visible {
  outline: 3px solid #ad6a35;
  outline-offset: 2px;
}

/* the drum, the pillow's ride and the water turn about the door's centre (the SVG's 120, 171) */
.gb-washer__drum,
.gb-washer__ride,
.gb-washer__tilt {
  transform-box: view-box;
  transform-origin: 120px 171px;
}
.gb-washer__tumble,
.gb-washer__bubble {
  transform-box: fill-box;
  transform-origin: center;
}
.gb-washer__drum {
  animation: gb-washer-drum 8s ease-in-out infinite;
}
.gb-washer__tilt {
  animation: gb-washer-tilt 8s ease-in-out infinite;
}
.gb-washer__ride {
  animation: gb-washer-ride 8s ease-in-out infinite;
}
.gb-washer__tumble {
  animation: gb-washer-tumble 8s ease-in-out infinite;
}
.gb-washer__slosh {
  animation: gb-washer-slosh 3.5s ease-in-out infinite alternate;
}
.gb-washer__slosh--front {
  animation-direction: alternate-reverse;
}
.gb-washer__foam {
  animation: gb-washer-foam 2.6s ease-in-out infinite alternate;
}
.gb-washer__bubble {
  animation: gb-washer-bubble 4.4s linear infinite;
}
.gb-washer__bubble--1 {
  animation-duration: 3.8s;
  animation-delay: -1.6s;
}
.gb-washer__bubble--2 {
  animation-delay: -3s;
}
.gb-washer__bubble--3 {
  animation-duration: 5s;
  animation-delay: -0.6s;
}
.gb-washer__bubble--4 {
  animation-duration: 4s;
  animation-delay: -2.4s;
}
.gb-washer__bubble--5 {
  animation-duration: 4.8s;
  animation-delay: -4s;
}
/* still until washer.js finds the picture on screen; off screen and after the visitor's pause
   it holds where it is (no jump back) */
.gb-washer .gb-washer__art * {
  animation-play-state: paused;
}
.gb-washer.is-running .gb-washer__art * {
  animation-play-state: running;
}
@media (prefers-reduced-motion: reduce) {
  .gb-washer .gb-washer__art * {
    animation: none !important;
  }
}

/* the drum turns one way, rests, turns back, rests (as a front loader does) */
@keyframes gb-washer-drum {
  0% {
    transform: rotate(0deg);
  }
  40%,
  50% {
    transform: rotate(105deg);
  }
  90%,
  100% {
    transform: rotate(0deg);
  }
}
/* the water leans the way the drum drags it */
@keyframes gb-washer-tilt {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(4deg);
  }
  45% {
    transform: rotate(0deg);
  }
  70% {
    transform: rotate(-4deg);
  }
  95%,
  100% {
    transform: rotate(0deg);
  }
}
/* the pillow rides up the wall with the drum and drops back into the water */
@keyframes gb-washer-ride {
  0% {
    transform: rotate(0deg);
  }
  27% {
    transform: rotate(30deg);
    animation-timing-function: ease-in;
  }
  35% {
    transform: rotate(-4deg);
    animation-timing-function: ease-in-out;
  }
  43%,
  50% {
    transform: rotate(0deg);
  }
  77% {
    transform: rotate(-30deg);
    animation-timing-function: ease-in;
  }
  85% {
    transform: rotate(4deg);
    animation-timing-function: ease-in-out;
  }
  93%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes gb-washer-tumble {
  0% {
    transform: rotate(0deg);
  }
  27% {
    transform: rotate(6deg);
    animation-timing-function: ease-in;
  }
  35% {
    transform: rotate(-10deg);
    animation-timing-function: ease-in-out;
  }
  45%,
  50% {
    transform: rotate(0deg);
  }
  77% {
    transform: rotate(-6deg);
    animation-timing-function: ease-in;
  }
  85% {
    transform: rotate(10deg);
    animation-timing-function: ease-in-out;
  }
  95%,
  100% {
    transform: rotate(0deg);
  }
}
@keyframes gb-washer-slosh {
  to {
    transform: translateX(-10px);
  }
}
@keyframes gb-washer-foam {
  to {
    transform: translateY(-1.5px);
  }
}
@keyframes gb-washer-bubble {
  0% {
    transform: translateY(22px);
    opacity: 0;
  }
  18%,
  78% {
    opacity: 1;
  }
  100% {
    transform: translateY(-26px);
    opacity: 0;
  }
}
