/* Google stuff*/
@import url('https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap');

/* Defualt styles */
*, ::after, ::before {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  font-family: 'Roboto', sans-serif;
  font-size: clamp(12px, 100%, 14px);
}

button {
  border: none;
  background-color: transparent;
  cursor: pointer;
}

button svg {
  width: 100%;
  height: 100%;
  fill: #fff;
  pointer-events: none;
}

a, a:visited {
  color: #fff;
}

a:first-of-type {
  margin-right: 1rem;
}

a:last-of-type {
  margin-right: 0;
}

p {
  margin: 0;
}

body {
  margin: 0;
  overflow: hidden;
}

/* Custom styles */
.button {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background-color: rgb(102, 51, 153);
}

#content {
  display: flex;
  flex-flow: column nowrap;
  align-items: center;
}

/* Landing */
#text-box {
  position: relative;
  width: 375px;
  min-height: 100vh;
  align-content: center;
  text-align: center;
}

#text-box .text,
#canvas-box .text {
  position: absolute;
  width: inherit;
  left: 50%;
  top: 50%;
  padding: 0 1rem;
  font-size: 1.5rem;
  line-height: 2rem;
  transform: translate(-50%, -50%);
  text-align: center;
}

#text-box .text {
  position: absolute;
  display: none;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#text-box .text[data-show] {
  display: unset;
  animation: text-out 3000ms forwards;
}

#text-box .text:not(:last-child)[data-show="1"] {
  display: unset;
  animation: text-in-out 6000ms forwards;
}

#text-box .text:last-child[data-show="1"] {
  display: unset;
  animation: text-in 6000ms forwards;
}

#text-box .text:last-child .button {
  animation: button-shake 4500ms infinite forwards;
}

#text-box .text .highlight {
  padding: 2.5px 5px;
  background-color: rebeccapurple;
  color: #fff;
}

@keyframes text-in-out {
  0% {
    opacity: 0;
  }
  8.3%, 91.7% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes text-in {
  0% {
    opacity: 0;
  }
  8.3% {
    opacity: 1;
  }
}

@keyframes text-out {
  83.34% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes button-shake {
  0% {
    transform: rotate(0deg);
  }
  89.99% {
    transform: rotate(0deg);
  }
  90%, 94%, 98% {
    transform: rotate(10deg);
  }
  92%, 96% {
    transform: rotate(-10deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

/* Canvas */
#canvas-box {
  position: relative;
  width: 100vw;
  height: 100vh;
  perspective-origin: -150%;
  overflow: hidden;
}

#canvas-box::after {
  content: "Please put your device in landscape mode 🙂";
  align-content: center;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  color: #FFF;
  font-size: 2rem;
  text-align: center;
  background-color: rebeccapurple;
}

#canvas-box:has(> .help-box[data-show='1'])::after {
  content: "";
  display: unset;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background-color: rgba(0, 0, 0, 0.5);
  animation: dialog-in-out 4000ms forwards;
}

#canvas-box .help-box {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: fit-content;
  font-size: 1.5rem;
  text-align: center;
  white-space: pre-wrap;
  color: #fff;
  z-index: 1;
  touch-action: none;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#canvas-box .help-box[data-show='1'] {
  display: block;
  animation: dialog-in-out 4000ms forwards;
}

@keyframes dialog-in-out {
  0% {
    opacity: 0;
  }
  10%, 90% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

#canvas-box #canvas {
  width: 100%;
  height: 100%;
  background-color: orange;
  touch-action: none;
}

#canvas-box .control-box {
  position: absolute;
  display: flex;
  flex-flow: row nowrap;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  gap: 1rem;
  bottom: calc(100% - 3rem - 20px);
}

#canvas-box .control-box .breadcrumbs {
  margin-right: auto;
  color: white;
  cursor: pointer;
  font-size: 1.25rem;
}

#canvas-box .control-box .button {
  width: 2rem;
  height: 2rem;
}

#canvas-box .control-box svg {
  width: 100%;
  height: 100%;
}

#canvas-box .hint-box {
  position: absolute;
  display: none;
  flex-flow: column nowrap;
  justify-content: center;
  align-content: center;
  gap: 15px;
  height: 13.25rem;
  aspect-ratio: 3/4;
  border-radius: 1rem;
  border: solid 0.25rem #8547C2;
  padding: 20px 10px;
  background-color: rebeccapurple;
  color: #fff;
  font-size: 10px;
  text-align: center;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  hyphens: auto;
  z-index: 1;
  touch-action: none;
  pointer-events: none;
  transform: translate(-50%, -100%) perspective(500px) rotateX(-5deg);
}

#canvas-box .hint-box a {
  touch-action: auto;
  pointer-events: auto;
}

#canvas-box .hint-box[data-show] {
  display: flex;
}

#canvas-box .hint-box[data-show='65'] {
  transform: translate(-50%, -100%) perspective(500px) rotateX(-5deg);
}

#canvas-box .hint-box[data-show='768'],
#canvas-box .hint-box[data-show='769'],
#canvas-box .hint-box[data-show='770'] {
  transform: translate(-50%, -100%) perspective(500px) rotateX(-5deg) rotateY(-5deg);
}

#canvas-box .hint-box .rating {
  display: flex;
  flex-flow: row nowrap;
  justify-content: center;
  font-size: 1rem;
  gap: 0.5rem;
}

#canvas-box .hint-box[data-show='65'] > .rating,
#canvas-box .hint-box[data-show='768'] > .rating,
#canvas-box .hint-box[data-show='769'] > .rating,
#canvas-box .hint-box[data-show='770'] > .rating {
  display: none;
}

#canvas-box .hint-box .rating > * {
  width: 10px;
  height: 10px;
  border: solid 0.25px #fff;
  border-radius: 50%;
}

#canvas-box .hint-box .rating > *[data-toggled='1'] {
  background-color: #fff;
}

/* Footer */
#footer {
  display: flex;
  flex-flow: column wrap;
  gap: 2rem;
  width: 100vw;
  height: 100vh;
  justify-content: center;
  align-items: center;
}

#footer #return {
  z-index: 100;
}

#footer #contact-box {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  padding: 0 1rem;
}

#footer #contact-box > *:first-child {
  position: relative;
  grid-row: 1 / span 2;
  place-self: end;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  border-radius: 50%;
  width: 128px;
  height: 128px;
  background-color: rebeccapurple;
  overflow-x: clip;
}

#footer #contact-box > *:first-child::after {
  position: absolute;
  content: '';
  width: 100%;
  height: 100%;
  background-color: #fff;
  /* Dunno where that extra pixel below is comming from ¯\_(ツ)_/¯ */
  clip-path: path('M 0,64 L 0,129 L 129,129 L 128,64 A 64 64 0 0 1 0 64');
  clip-rule: evenodd;
}

#footer #contact-box > *:nth-child(2) {
  width: 100%;
  place-self: end;
  padding-left: 2rem;
  padding-bottom: 0.5rem;
  border-bottom: solid 2px rebeccapurple;
  text-align: right;
}

#footer #contact-box > *:nth-child(3) {
  width: 100%;
  padding-left: 2rem;
  padding-top: 0.5rem;
  border-top: solid 2px rebeccapurple;
  text-align: right;
}

#footer #contact-box > *:nth-child(3) a:first-of-type {
  margin-right: 0.5rem;
}

#footer #contact-box > *:nth-child(3) svg {
  width: 24px;
  height: 24px;
  margin-top: 0.5rem;
  fill: rebeccapurple;
}

#footer #contact-box .img {
  display: none;
  position: absolute;
  width: 100%;
  object-fit: cover;
}

#footer #contact-box .img[data-show] {
  display: unset;
  animation: img-out 15000ms forwards;
}

#footer #contact-box .img[data-show='1'] {
  display: unset;
  animation: img-in-out 15000ms forwards;
}

@keyframes img-in-out {
  0% {
    opacity: 0;
  }
  6.66%, 93.33% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes img-out {
  93.33% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@media screen and (min-width: 724px) {
  :root{font-size: clamp(12px, 100%, 18px);}
  #text-box{width: 30rem;}
  #canvas-box .hint-box {height: 22.5rem; font-size: 1rem; font-size: 1rem;}
  #canvas-box .hint-box .rating > * {width: 1.25rem; height: 1.25rem; border: solid 0.1rem #fff;}
  #footer #contact-box > *:first-child {width: 256px; height: 256px;}
  #footer #contact-box *:first-child::after {
    clip-path: path('M 0,128 L 0,258 L 258,258 L 258,128 A 128 128 0 0 1 0 128');
    clip-rule: evenodd;
  }
  #footer #contact-box > *:nth-child(3) svg {width: 36px; height: 36px;}
  .button {width: 3rem; height: 3rem;}
}
@media only screen and (orientation: landscape) {
  #canvas-box::after {
    display: none;
  }
}
