/* Global Styles */

html {
  box-sizing: border-box;
}

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

img {
  display: block;
}

/* Container */

body {
  margin: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
}

body.debug {
  width: 475px;
  height: 475px;
  margin: 2rem auto;
}

main {
  width: 100%;
  height: 100%;
  aspect-ratio: 1/1;
  overflow: hidden;
  background-color: #32124f;
  position: relative;
  overflow: hidden;
}

/* Controls / Header */

.controls {
  padding: 1rem;
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.help {
  padding: 1rem;
  position: absolute;
  bottom: 1rem;
  right: 1rem;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  appearance: none;
  padding: 0;
  background-color: transparent;
  background-color: none;
  border: 0;
  transition: scale 0.2s ease;
  cursor: pointer;
}

.help > div {
  display: none;
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 275px;
  text-align: center;
  background-color: rgb(256, 256, 256, 0.35);
  border: 2px solid #32124f;
  color: #32124f;
  padding: 12px;
  border-radius: 16px;
  font-weight: bold;
}

.help img {
  width: 32px;
  height: 32px;
  transition: scale 0.2s ease;
}


.help:hover > div {
  display: block;
}

.help:hover img {
  transform: scale(1.1);
}

.toggle {
  display: flex;
  border-radius: 2rem;
  outline: none;
  background: none;
  background-color: rgb(256, 256, 256, 0.35);
  appearance: none;
  border: 2px solid #32124f;
  padding: 0.3rem 0.5rem;
  gap: .5rem;
  cursor: pointer;
  position: relative;
}

.toggle-icon {
  width: 2.5rem;
  height: 2.5rem;
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2;
  padding: .25rem;
}

.toggle-icon .toggle-image {
  height: 2rem;
  width: 2rem;
  background: center center no-repeat;
  background-size: contain;
  pointer-events: none;
}

.toggle-icon.active::before {
  content: "";
  width: 2.5rem;
  height: 2.5rem;
  background-color: #e5d2ec;
  position: absolute;
  display: block;
  top: 0;
  left: 0;
  /* top: .3rem;
  left: .5rem; */
  z-index: -1;
  border-radius: 100%;
  /* transition: left .2s ease-in-out; */
  /* animation: shiftLeft .2s linear 0;
  animation-iteration-count: 1;
  animation-fill-mode: forwards; */
}

.icon-geisha .toggle-image {
  background-image: url(../images/geisha.png);
}

.icon-pixel .toggle-image {
  background-image: url(../images/pixel.png);
}

.icon-kaiju .toggle-image {
  background-image: url(../images/kaiju.png);
}

.icon-zoom .toggle-image {
  background-image: url(../images/magnifying-glass.png);
  transition: opacity 1s ease-out;
  opacity: 1;
  width: 1.5rem;
  height: 1.5rem;
}

.kaiju .icon-zoom, .geisha .icon-zoom, .pixel .icon-zoom {
  opacity: 1;
}

.pixel .toggle:active .icon-pixel,
.kaiju .toggle:active .icon-kaiju,
.geisha .toggle:active .icon-geisha {
  animation: bounce .2s linear 0;
  animation-iteration-count: 1;
}

.kaiju .toggle:hover .icon-geisha,
.geisha .toggle:hover .icon-kaiju {
  border-radius: 100%;
}

@keyframes bounce {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes shiftRight {
  0% {
    left: 0.5rem;
    width: 2.5rem;
  }
  50% {
    width: 4rem;
  }
  100% {
    width: 2.5rem;
    left: calc(100% - 3rem);
  }
}

@keyframes shiftLeft {
  0% {
    left: calc(100% - 3rem);
    width: 2.5rem;
  }
  50% {
    width: 4rem;
  }
  100% {
    width: 2.5rem;
    left: 0.5rem;
  }
}

.icon-zoom:hover,
.pixel .toggle .icon-pixel,
.kaiju .toggle .icon-kaiju,
.geisha .toggle .icon-geisha {
  animation: bounce 0.2s linear 0;
  animation-iteration-count: 1;
  border-radius: 100%;
}

/* Viewer */

.viewer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.viewer-content {
  display: none;
  position: relative;
  width: 100%;
  height: 100%;
  z-index: 0;
  background-color: #c182eb;
}

.viewer-content-pfp {
  background: url(../images/pfp.png) center center no-repeat transparent;
  background-size: cover;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  /* transition: left 0.6s ease-in-out; */
  animation-fill-mode: forwards;
}

.viewer-content-battle {
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  /* display: flex; */
}

.viewer-content-battle img.foreground {
  box-shadow: 0 0 20px rgba(50, 18, 79, 0.75);
  position: relative;
  z-index: 1;
  max-width: 100%;
}

.viewer-content-battle img.background {
  box-shadow: 0 0 20px rgba(50, 18, 79, 0.75);
  filter: blur(5px);
  position: absolute;
  left: 50%;
  top: 50%;
  display: block;
  height: 100%;
  transform: translate(-50%, -50%);
  max-width: none;
  z-index: 0;
  opacity: 0.35;
}

.viewer-content-pixel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  /* transition: left 0.6s ease-in-out;
  animation-fill-mode: forwards; */
}

/* Display Logic */

.kaiju .viewer .viewer-content-battle {
  display: flex;
}

.kaiju .viewer .viewer-content-pfp {
  display: block;
  left: 100%;
}

.geisha .viewer .viewer-content-pfp {
  display: block;
}

.pixel .viewer .viewer-content-pixel {
  display: block;
}

/* Loading */

.loading {
  display: none;
  background-color: #471a6f;
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 10;
  top: 0;
  left: 0;
  padding: 3rem;
  animation: fadeOut .5s ease-out;
  animation-delay: 3s;
  animation-fill-mode: forwards;
  /* display: flex; */
  justify-content: center;
  align-items: center;
}

.loading:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 11;
  top: 0;
  left: 0;
  background-color: #471a6f;
  opacity: 0.9;
  animation: slideDown 3s ease-in-out;
  animation-fill-mode: forwards;
}

.loading img {
  /* opacity: 0; */
  /* animation: fadein 1s; */
  max-width: 200px;
}


@keyframes slideDown {
  from { top: 0; }
  to   { top: 100%; }
}


@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* Pixel */

.pixel canvas.hex-bg {
  background-color: #d9c6e9;
  image-rendering: pixelated;
  image-rendering: -webkit-optimize-contrast;
}

.pixel canvas {
  background: url(../images/pixel-bg.png) repeat #d9c6e9;
  image-rendering: pixelated;
  image-rendering: -webkit-optimize-contrast;
}

.pixel-controls-wrapper {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.pixel-controls {  
  background-color: rgba(255, 255, 255, 0.5);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 100%;
  padding: 12px;
  border: 2px solid #32124f;
}

.pixel-controls-row {
  display: flex;
}

.pixel-controls button {
  appearance: none;
  padding: 0;
  background-color: transparent;
  background-color: none;
  border: 0;
  transition: scale 0.2s ease;
  cursor: pointer;
}

.pixel-controls button:hover {
  transform: scale(1.1);
}

.pixel-controls button img {
  display: block;
  width: 20px;
  height: 20px; 
}

.pixel-controls-row .tl {
  transform: rotate(45deg);
}

.pixel-controls-row .tr {
  transform: rotate(-45deg);
}

.pixel-controls-row .bl {
  transform: rotate(-45deg);
}

.pixel-controls-row .br {
  transform: rotate(45deg);
}

.pixel-controls .pixel-controls-row div.small img {
  width: 14px;
  height: 14px;
  opacity: 0.5;
}

.pixel-controls-row .small {
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
}
