:root {
  --blue: #3a5eac;
  --grey-white: #fff8e8;
  --red: #f37d3e;
  --yellow: #fdcf32;
  --pink: #f0aac4;
  --dark-pink: #96526b;
  --light-pink: #edc4d3;
  --green: #519281;
  --light-blue: #bbdff8;
  --black: #252422;

  --boarder-radius: 20px;
}

body {
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-image: url(img/Studio\ 5\ _Layout\ \(1\).png);
}

/* Used this as a simple way to help manage and adjust responsiveness 
across different screen sizes. */
.main-layout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transform-origin: center;
}

/* for the svg icons */
path {
  fill: var(--shape-color, var(--blue));
}

/* ---------------------------------------- */
/* Tutorial*/
/* ---------------------------------------- */

.tutorial-ghost {
  position: fixed;
  width: 210px;
  height: 100px;
  pointer-events: none;
  z-index: 999;
  opacity: 0;
  left: 72vw;
  top: 34vh;
}

.tutorial-ghost svg {
  width: 100%;
  height: 100%;
  display: block;
}

.tutorial-ghost svg path {
  fill: var(--black);
  opacity: 0.25;
}

/* Using CSS animation to animate the tutorial since it seemed 
like the most straightforward method of giving a guide. I also 
asked chatgpt and it agreed with me.*/
.tutorial-ghost.playing {
  animation: dragTutorial 4s ease-in-out infinite;
}

/* had this so that when the blocks will fit into the grid 
without using js or anything no matter the browser size. 
I did using Js initially but it was so complicated that I just stoped and adjust
the positioning manually in CSS instead. */
@keyframes dragTutorial {
  0% {
    left: 72vw;
    top: 34vh;
    rotate: 45deg;
    opacity: 1;
  }

  70% {
    left: 20.3vw;
    top: 40vh;
    rotate: 0deg;
    opacity: 1;
  }

  100% {
    left: 20.3vw;
    top: 40vh;
    rotate: 0deg;
    opacity: 0;
  }
}

@media (max-width: 1550px), (max-height: 820px) {
  @keyframes dragTutorial {
    0% {
      left: 72vw;
      top: 33vh;
      rotate: 45deg;
      opacity: 1;
    }

    70% {
      left: 455px;
      top: 370px;
      rotate: 0deg;
      opacity: 1;
    }

    100% {
      left: 455px;
      top: 370px;
      rotate: 0deg;
      opacity: 0;
    }
  }
}

@media (max-width: 1350px), (max-height: 720px) {
  @keyframes dragTutorial {
    0% {
      left: 100vw;
      top: 32vh;
      rotate: 45deg;
      opacity: 1;
    }

    70% {
      left: 455px;
      top: 38.5vh;
      rotate: 0deg;
      opacity: 1;
    }

    100% {
      left: 455px;
      top: 38.5vh;
      rotate: 0deg;
      opacity: 0;
    }
  }
}

@media (max-width: 1100px), (max-height: 620px) {
  @keyframes dragTutorial {
    0% {
      left: 120vw;
      top: 31vh;
      rotate: 45deg;
      opacity: 1;
    }

    70% {
      left: 455px;
      top: 38.5vh;
      rotate: 0deg;
      opacity: 1;
    }

    100% {
      left: 455px;
      top: 38.5vh;
      rotate: 0deg;
      opacity: 0;
    }
  }
}

/* to showcase the play button as the next step. 
I wanted to do it as an overlay but this animation 
looked better and was easier to achieve */
#play-pause-loop.present {
  background-color: var(--blue);

  filter: drop-shadow(0px 0px 5px rgba(3, 165, 234, 1));

  animation: pulsePlay 2s ease-in-out infinite;
}

#play-pause-loop.present svg path {
  fill: var(--grey-white);
}

@keyframes pulsePlay {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.3);
  }

  0% {
    transform: scale(1);
  }
}

/* ---------------------------------------- */
/* Square Grid */
/* ---------------------------------------- */

/* Experimented with the colour palette quite a bit to find colours 
that best matched the playful and soft characteristics of the project. */

#square-container {
  background-color: var(--grey-white);
  width: 1120px;
  height: 680px;
  border-radius: var(--boarder-radius);

  display: flex;
  justify-content: center;
  align-items: center;

  margin-left: 0;
  overflow: hidden;
}

#grid-container {
  display: grid;
  grid-template-columns: repeat(10, 100px);
  grid-template-rows: repeat(6, 100px);
  gap: 10px;
}

.square {
  background-color: var(--light-pink);
  border-radius: var(--boarder-radius);
  position: relative;
  overflow: visible;
}

.square.col-active {
  background-color: var(--pink);
}

/* ---------------------------------------- */
/* Shape Container*/
/* ---------------------------------------- */

.right {
  width: 340px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: -60px;
}

.shape-container {
  background-color: var(--grey-white);
  width: 100%;
  height: 550px;
  border-radius: var(--boarder-radius);
  margin-left: 0;

  position: relative;
  overflow: hidden;
}

.shape {
  cursor: grab;
  /* opacity: 0.95; */
  position: absolute;
  filter: drop-shadow(5px 5px 5px rgba(44, 44, 44, 0.4));
}

.shape svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shape {
  opacity: 1;
}

.shape.dragging {
  opacity: 1 !important;
  cursor: grabbing;
}

.rotation-hover {
  opacity: 0.95 !important;
}

/* ---------------------------------------- */
/* Shape*/
/* ---------------------------------------- */

#rectangle {
  width: 210px;
  height: 100px;
  border-radius: var(--boarder-radius);
}

#triangle {
  width: 100px;
  height: 100px;
}

#circle {
  width: 100px;
  height: 100px;
  border-radius: 50px;
}

/* hide the original shapes, they are just used as templates to clone from */
#rectangle-0,
#rectangle-90,
#triangle-0,
#triangle-90,
#triangle-180,
#triangle-270,
#circle,
#bridge-0,
#bridge-90,
#bridge-180,
#bridge-270 {
  display: none;
}

/* ---------------------------------------- */
/* Shadow Preview */
/* ---------------------------------------- */

/* .rotation-hover {
  opacity: 0.85;
} */

.rotation-preview-shape {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.25;
  filter: drop-shadow(0px 0px 8px rgba(37, 36, 34, 0.45));
}

.rotation-preview-shape svg {
  width: 100%;
  height: 100%;
}

.rotation-preview-shape path {
  fill: var(--shape-color);
}

/* ---------------------------------------- */
/* Loop controls */
/* ---------------------------------------- */

.loop-controls {
  width: 100%;
  margin-top: 1px;

  display: flex;
  flex-direction: column;
  gap: 8px;
  font-family: Arial, Helvetica, sans-serif;
}

.loop-bpm-row {
  background-color: var(--grey-white);
  border-radius: 10px;
  padding: 10px 14px;

  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 1px;
}

.loop-label {
  grid-column: 2;
  grid-row: 1;
  font-size: 16px;
  line-height: 1;
  color: black;
  text-align: right;
}

#loop-bpm-val {
  grid-column: 2;
  grid-row: 2;
  font-size: 28px;
  line-height: 0.8;
  color: black;
  text-align: right;

  width: 48px;
  min-width: 48px;
  display: inline-block;
}

#loop-bpm {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 100%;
  accent-color: var(--blue);

  width: 220px;
  flex: 0 0 220px;
}

.left-btn {
  display: flex;
  flex-direction: row;
  scale: 0.9;
}

.control-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.menu-btn {
  cursor: pointer;
  width: 68px;
  height: 68px;
  background-color: var(--grey-white);
  border-radius: 50%;

  display: flex;
  align-items: center;
  justify-content: center;

  transition: transform 0.2s ease;
}

.helpbtn {
  scale: 0.8;
  display: flex;
  flex-direction: row;
  justify-content: flex-end;

  margin-right: -40px;
}

.menu-btn:hover {
  transform: scale(1.1);
  background-color: var(--light-pink);
}

#volume-btn,
#reset-btn {
  margin-right: 12px;
}

#play-pause-loop {
  margin-left: auto;
  z-index: 100;
}

.shape path {
  fill: var(--shape-color, var(--blue));
}

#helpBtn svg path {
  fill: none;
}

.menu-btn svg path {
  fill: none;
}

#play-pause-loop svg path {
  fill: var(--blue);
}

/* --------------------------------------- */
/* RANGE iNPUT */
/* --------------------------------------- */
/* Got this from the slider design website https://range-input-css.netlify.app/ */
/*********** Baseline, reset styles ***********/
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  width: 25rem;
}

/* Removes default focus */
input[type="range"]:focus {
  outline: none;
}

/******** Chrome, Safari, Opera and Edge Chromium styles ********/
/* slider track */
input[type="range"]::-webkit-slider-runnable-track {
  background-color: #3b5eac;
  border-radius: 0.5rem;
  height: 0.75rem;
}

/* slider thumb */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; /* Override default look */
  appearance: none;
  margin-top: -8px; /* Centers thumb on the track */
  background-color: var(--pink);
  border-radius: 25%;
  height: 2rem;
  width: 1rem;
}

input[type="range"]:focus::-webkit-slider-thumb {
  outline: 3px solid #f288b0;
  outline-offset: 0.125rem;
}

/*********** Firefox styles ***********/
/* slider track */
input[type="range"]::-moz-range-track {
  background-color: #3b5eac;
  border-radius: 0.5rem;
  height: 1rem;
}

/* slider thumb */
input[type="range"]::-moz-range-thumb {
  background-color: #f288b0;
  border: none; /*Removes extra border that FF applies*/
  border-radius: 25%;
  height: 2rem;
  width: 1rem;
}

input[type="range"]:focus::-moz-range-thumb {
  outline: 3px solid #f288b0;
  outline-offset: 0.125rem;
}

#volume-slider {
  writing-mode: vertical-lr;
  direction: rtl;

  width: 20px;
  height: 120px;
  z-index: 10000;

  accent-color: var(--blue);
}

/* ---------------------------------------- */
/* Sizing controls */
/* ---------------------------------------- */

/* This handles the responsiveness of the website, helping to adjust the size of the elements based on the browser size */

@media (max-width: 1550px), (max-height: 820px) {
  .main-layout {
    transform: scale(0.85);
  }
}

@media (max-width: 1350px), (max-height: 720px) {
  .main-layout {
    transform: scale(0.75);
  }
}

@media (max-width: 1100px), (max-height: 620px) {
  .main-layout {
    transform: scale(0.65);
  }
}

/* ---------------------------------------- */
/* Warning Screen */
/* ---------------------------------------- */

/* Using CSS to hide and unhide the website based on the browser size */
.screen-warning {
  display: none;
}

@media (max-width: 1000px), (max-height: 600px) {
  .main-layout {
    display: none;
  }

  .screen-warning {
    font-family: Arial, Helvetica, sans-serif;
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 999;

    background: var(--light-blue);
    color: var(--black);

    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
  }

  .warning-box {
    max-width: 400px;
  }

  .warning-box h2 {
    font-size: 28px;
    margin-bottom: 12px;
  }

  .warning-box p {
    font-size: 16px;
    opacity: 0.8;
  }
}

/* ---------------------------------------- */
/* Introduction Screen */
/* ---------------------------------------- */

/* A little logo animation to set the tone and give some context 
into what the website is about. Having a little clue or teaser into what the website is about*/
@media (max-width: 1000px), (max-height: 600px) {
  #intro-screen {
    display: none;
  }

  .screen-warning {
    z-index: 10000;
  }
}

#intro-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  background: transparent;
  overflow: hidden;
  pointer-events: none;
}

/* top and bottom curtain to reveal the website */
#intro-screen::before,
#intro-screen::after {
  content: "";
  position: absolute;
  left: 0;

  width: 100%;
  height: 50%;

  background-image: url(img/Background-2.png);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  z-index: -1;

  animation: curtainOpen 1.4s ease forwards;
  animation-delay: 5.25s;
}

#intro-screen::before {
  top: 0;
  transform-origin: top center;
}

#intro-screen::after {
  bottom: 0;
  transform-origin: bottom center;
}

/* Using CSS animation to animate the logo instead of using a 
video and import it to the website. Or even using GSAP to animate it as it seemed a bit overkill for a somewhat simple animation */

@keyframes curtainOpen {
  to {
    transform: scaleY(0);
  }
}

/* logo layout */
.intro-logo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.intro-logo {
  display: flex;

  animation: logoUp 1.2s ease forwards;
  animation-delay: 5.25s;
}

.intro-logo img {
  width: 150px;
}

.beats {
  width: 130px;
  margin-top: 5px;
  margin-right: 10px;

  opacity: 0;

  animation:
    beatsEnter 1.25s ease forwards,
    beatsDown 1.2s ease forwards;

  animation-delay: 1.2s, 5.25s;
}

.warning {
  font-family: Arial, Helvetica, sans-serif;
  color: var(--dark-pink);
  font-weight: lighter;
  position: absolute;
  bottom: 200px;
  opacity: 0;

  text-align: center;

  animation:
    volWord 1s ease forwards,
    beatsDown 1.2s ease forwards;
  animation-delay: 2.5s, 5.25s;
}

/* letters drop one by one */
.letter {
  opacity: 0;
  transform: translateY(-200px);

  animation: dropIn 1s ease forwards;
}

.k {
  animation-delay: 0s;
}

.l {
  animation-delay: 0.25s;
}

.o {
  animation-delay: 0.5s;
}

.t {
  animation-delay: 0.75s;
}

.z {
  animation-delay: 1s;
}

/* animations */
@keyframes dropIn {
  0% {
    opacity: 0;
    transform: translateY(-250px) rotate(-10deg);
  }

  70% {
    opacity: 1;
    transform: translateY(20px) rotate(4deg);
  }

  100% {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

@keyframes beatsEnter {
  0% {
    opacity: 0;
    transform: translateX(-250px) rotate(-10deg);
  }

  70% {
    opacity: 1;
    transform: translateX(20px) rotate(4deg);
  }

  100% {
    opacity: 1;
    transform: translateX(0) rotate(0);
  }
}

@keyframes logoUp {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(-600px);
    opacity: 0;
  }
}

@keyframes beatsDown {
  0% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(600px);
    opacity: 0;
  }
}

@keyframes volWord {
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
  }
}
