:root {
  --ink: #f3efe6;
  --gust: 0;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  overflow: hidden;
  background: #1c2430;
  color: var(--ink);
  font-family: Georgia, "Palatino Linotype", Palatino, "Times New Roman", serif;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.porch-frame {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 54%;
  pointer-events: none;
  z-index: 1;
}

.porch-branches {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 54%;
  pointer-events: none;
  z-index: 2;
  transform-origin: 8% 0%;
  animation: branch-sway 6.4s ease-in-out infinite;
}

.porch-lantern {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 54%;
  pointer-events: none;
  z-index: 2;
}

.porch-lantern-a {
  transform-origin: 65% 0%;
  animation: lantern-sway-a 5.6s ease-in-out infinite;
}

.porch-lantern-b {
  transform-origin: 83% 0%;
  animation: lantern-sway-b 6.8s ease-in-out infinite;
}

#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 3;
}

.zen-volume {
  position: fixed;
  z-index: 4;
  left: 0.85rem;
  bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #f3efe6;
  filter:
    drop-shadow(0 1px 1px #000)
    drop-shadow(0 4px 10px rgba(0, 0, 0, 0.55));
}

.zen-sound,
.zen-full {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: inherit;
  cursor: pointer;
}

.zen-sound svg,
.zen-full svg {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  margin: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.zen-sound .icon-speaker {
  fill: currentColor;
  stroke: none;
}

.zen-sound .icon-waves {
  display: none;
}

.zen-sound .icon-mute {
  display: block;
}

.zen-sound.is-on .icon-waves {
  display: block;
}

.zen-sound.is-on .icon-mute {
  display: none;
}

.zen-sound:focus,
.zen-full:focus,
.zen-volume-label input:focus {
  outline: none;
}

.zen-sound:focus-visible,
.zen-full:focus-visible,
.zen-volume-label input:focus-visible {
  outline: 2px solid rgba(255, 228, 186, 0.9);
  outline-offset: 3px;
}

.zen-full .icon-exit {
  display: none;
}

.zen-full.is-on .icon-enter {
  display: none;
}

.zen-full.is-on .icon-exit {
  display: block;
}

.zen-volume:not(.is-on) .zen-sound {
  animation: sound-hint 2.8s ease-in-out infinite;
}

.zen-volume-label {
  display: flex;
  align-items: center;
  margin: 0;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.zen-volume-label input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 7.6rem;
  height: 1.35rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.zen-volume-label input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(243, 239, 230, 0.38);
}

.zen-volume-label input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #f3efe6;
  box-shadow: 0 0 0 2px rgba(28, 22, 16, 0.55);
}

.zen-volume-label input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(243, 239, 230, 0.38);
}

.zen-volume-label input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 0;
  border-radius: 50%;
  background: #f3efe6;
  box-shadow: 0 0 0 2px rgba(28, 22, 16, 0.55);
}

@keyframes branch-sway {
  0%,
  100% {
    transform: rotate(calc(0.2deg + var(--gust) * 0.5deg));
  }
  35% {
    transform: rotate(calc(1.9deg + var(--gust) * 3.4deg));
  }
  70% {
    transform: rotate(calc(-0.7deg - var(--gust) * 1.5deg));
  }
}

@keyframes lantern-sway-a {
  0%,
  100% {
    transform: rotate(calc(0.1deg + var(--gust) * 0.35deg));
  }
  40% {
    transform: rotate(calc(1.25deg + var(--gust) * 2.4deg));
  }
  72% {
    transform: rotate(calc(-0.55deg - var(--gust) * 1.2deg));
  }
}

@keyframes lantern-sway-b {
  0%,
  100% {
    transform: rotate(calc(-0.1deg - var(--gust) * 0.3deg));
  }
  38% {
    transform: rotate(calc(-1.15deg - var(--gust) * 2.2deg));
  }
  74% {
    transform: rotate(calc(0.5deg + var(--gust) * 1.1deg));
  }
}

@keyframes sound-hint {
  0%,
  100% {
    opacity: 0.58;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .zen-volume:not(.is-on) .zen-sound {
    animation: none;
  }

  .porch-branches {
    animation: none;
  }

  .porch-lantern-a,
  .porch-lantern-b {
    animation: none;
  }
}
