:root {
  --primary-color: #f9dbbd;
  --secondary-color: #59ffa0;
  --tertiary-color: #fb62f6;
  --quaternary-color: #f2ff49;
  --primary-font: "Press Start 2P", sans-serif;
  --secondary-font: "Poppins", sans-serif;
}

main {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
}

section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  position: relative;
  width: 100%;
}

/* I used repeating-linear gradient to create a vertical stripe pattern as the background for the movement section to reflect the designers artwork style. It repeats a 5px stripe in the primary color with a transparent gap going from left to right across the section. I used MDN for repeating-linear gradient to understand the syntax for controlling stripe width and repeated lines. Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/gradient/repeating-linear-gradient  */
.movement {
  background-image: repeating-linear-gradient(
    to right,
    var(--primary-color),
    var(--primary-color) 5px,
    transparent 5px,
    transparent 10px
  );
}

.movement::after {
  content: "&";
  position: absolute;
  bottom: 0;
  right: 50%;
  transform: translate(50%, 50%);
  font-family: var(--primary-font);
  font-size: 4rem;
  z-index: 1;
}
/* /* I used repeating-linear gradient to create a vertical stripe pattern as the background for the motion section to reflect the designers artwork style. It repeats a 5px stripe in the secondary color with a transparent gap going from left to right across the section. I used MDN for repeating-linear gradient to understand the syntax for controlling stripe width and repeated lines. Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/gradient/repeating-linear-gradient  */
.motion {
  background-image: repeating-linear-gradient(
    to right,
    var(--secondary-color),
    var(--secondary-color) 5px,
    transparent 5px,
    transparent 10px
  );
}
header {
  position: absolute;
  top: 0;
  height: 100%;
  width: 3rem;
  margin-inline: 2rem;
}
.movement header {
  left: 0;
}

.motion header {
  right: 0;
}

h1 {
  font-family: var(--primary-font);
  font-size: 2.5rem;
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, -50%) rotate(-90deg);
}

article {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  flex: 1;
  width: 100%;
}

.movement article {
  padding: 5rem 3rem 3rem 5rem;
}

.motion article {
  padding: 5rem 5rem 3rem;
}
.movement figure {
  height: 100%;
  width: 80%;
  /* this calculation is the aspect ratio for the max-width that should be based on the height of the entire viewport(100vh) minus the footer (17rem) and minus the article padding (8rem) which equals 25rem total. I had initially had the offset wrong and a tutor explained that available height needed to be multiplied by 2 for the aspect ratio. Width is 2x the available height, minus the gap (1rem) divided by the 5 columns.  */
  max-width: calc((2 * (100vh - 25rem) - 1rem) / 5);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  align-content: space-between;
}

/* n starts at 0, so n+11 targets every span from the 11th element onward (spans 11-20). I tried :nth-child(11) which only grabbed the single 11th element but I learned from a tutor that (n+11) is the correct way to select this range starting from a specific child. */
.movement figure span:nth-child(n + 11) {
  display: none;
}

.movement figure span {
  width: 100%;
  aspect-ratio: 1 / 1;
}
.square {
  background-color: var(--quaternary-color);
}

.circle {
  background-color: var(--secondary-color);
  border-radius: 50%;
}

@keyframes move-left {
  from {
    transform: translateX(0);
    background-color: var(--secondary-color);
    border-radius: 50%;
  }
  to {
    transform: translateX(calc(-100% - 1rem));
    background-color: var(--quaternary-color);
    border-radius: 0;
  }
}
@keyframes move-right {
  from {
    transform: translateX(0);
    background-color: var(--quaternary-color);
    border-radius: 0;
  }
  to {
    transform: translateX(calc(100% + 1rem));
    background-color: var(--secondary-color);
    border-radius: 50%;
  }
}
.slide-left {
  animation: move-left 0.5s ease-in-out;
}
.slide-right {
  animation: move-right 0.5s ease-in-out;
}
.motion article figure {
  width: calc(100% - 3rem);
  height: calc(33% - 1rem);
  position: relative;
}

/* /* I used repeating-linear gradient again here to create a striped pattern on the figure background. It repeats a 5px stripe in the secondary color and the 5px tertiary color going from top to bottom. I used MDN for repeating-linear gradient to understand the syntax for controlling stripe width and repeated lines. Source: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Values/gradient/repeating-linear-gradient  */
.figure-background {
  background-image: repeating-linear-gradient(
    to bottom,
    var(--secondary-color),
    var(--secondary-color) 5px,
    var(--tertiary-color) 5px,
    var(--tertiary-color) 10px
  );
  border-bottom: 0.5rem var(--tertiary-color) solid;
  height: 100%;
  width: 100%;
  position: relative;
  z-index: 2;
  transform: rotate(0deg) translateY(0rem);
  transform-origin: left bottom;
  transition: transform 0.5s ease-in-out;
}
.figure-background.animate {
  transform: rotate(-45deg) translateY(-3rem);
}
.motion figcaption {
  font-family: var(--primary-font);
  display: flex;
  flex-direction: column;
  text-align: center;
  gap: 1rem;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  white-space: nowrap;
  font-size: .75rem;
}

footer {
  display: flex;
  justify-content: center;
  padding: 2rem 2rem 4rem;
  width: 100%;
}

footer p {
 min-width: 70%;
  padding: 1.5rem;
  font-family: var(--secondary-font);
  flex-direction: column;
  display: flex;
  flex-wrap: wrap;
  text-align: center;
}

.motion footer a:hover{
  color: var(--primary-color);
}
.movement a:hover{
  color: var(--secondary-color);
}
.movement footer p {
  background-color: var(--quaternary-color);
}

.motion footer p {
  background-color: var(--tertiary-color);
}


/* I pulled these key breakpoints from https://dev.to/gerryleonugroho/responsive-design-breakpoints-2025-playbook-53ih */
/* Media Query for mobile devices */
@media (width >= 480px) {
  h1{
    font-size: 3rem;
    top: 50%;
  }
  .movement figure {
    grid-template-columns: repeat(4, 1fr);
  }

  .movement figure span:nth-child(n + 11) {
    display: inline-block;
  }
  .movement figure{
    height: 100%;
    width: 80%;
    max-width: calc((4 * (100vh - 21.5rem) - 1rem) / 5);
  }
  .motion article figure {
  width: calc(100% - 3rem);
  height: calc(33% - 1rem);
  position: relative;
}
.motion figcaption{
  font-size: 1rem;
}
}
/* Media Query for small laptops */
@media (width >= 1025px) {
  main {
    flex-direction: row;
  }
  section {
    width: 50%;
  }

  .movement::after {
    right: 0;
    bottom: 50%;
    transform: translate(50%, -50%);
    font-size: 4rem;
  }
}
/* Media Query for large laptops/desktops */
@media (width >= 1200px) {
  h1 {
    font-size: 5rem;
  }
  header {
    margin-inline: 2rem;
    width: 5rem;
  }

  .movement article {
    padding: 5rem 5rem 3rem 7rem;
  }

  .motion article {
    padding: 5rem 7rem 3rem;
  }
  .motion article figure {
    width: calc(100% - 4rem);
  }
}
