:root {
  color-scheme: dark;
  background: #062842;
  font-family: system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: #031727;
}

.reef-scene {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background-color: #062842;
  background-image: url("./assets/reef-background.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: cover;
}

@media (min-width: 600px) {
  body {
    display: grid;
    place-items: center;
  }

  .reef-scene {
    width: min(100vw, 56.25dvh);
    height: auto;
    aspect-ratio: 9 / 16;
  }
}

.reef-scene__shelves {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.reef-scene__shelves[data-shadow-debug="true"]::after {
  position: absolute;
  z-index: 5;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  padding: 10px 12px;
  border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 10px;
  background: rgb(0 12 28 / 82%);
  color: #fff;
  content: "BLUE = DEEP SHADOW  |  RED = UPPER SHADOW";
  font-size: 12px;
  letter-spacing: 0.06em;
  text-align: center;
}

.reef-shelf {
  position: absolute;
  display: block;
  max-width: none;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.reef-shelf-shadow {
  position: absolute;
  display: block;
  max-width: none;
  background-color: var(--shadow-color);
  filter: blur(var(--shadow-blur));
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: 100% 100%;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  opacity: var(--shadow-opacity);
  user-select: none;
  -webkit-user-drag: none;
  animation: reef-shadow-sway 8s ease-in-out infinite alternate;
}

@keyframes reef-shadow-sway {
  from {
    transform:
      translate(-50%, -50%)
      translate(var(--shadow-sway-x), var(--shadow-sway-y))
      rotate(var(--shelf-rotation))
      scale(var(--shadow-scale));
  }

  to {
    transform:
      translate(-50%, -50%)
      translate(
        calc(0px - var(--shadow-sway-x)),
        calc(0px - var(--shadow-sway-y))
      )
      rotate(var(--shelf-rotation))
      scale(var(--shadow-scale));
  }
}

@media (prefers-reduced-motion: reduce) {
  .reef-shelf-shadow {
    animation: none;
  }
}

.reef-shelf-shadow--deep {
  z-index: 1;
}

.reef-shelf--deep {
  z-index: 2;
}

.reef-shelf-shadow--upper {
  z-index: 3;
}

.reef-shelf--upper {
  z-index: 4;
}
