* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: #ffe4ec;
  color: #3d3535;
  font-family: Georgia, serif;
}

/* =========================
   PAGES
========================= */

.page {
  min-height: 100vh;
  padding: 60px 25px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  text-align: center;

  animation: fadeIn 0.7s ease;
}

/* IMPORTANT:
   Only the active page should be visible.
*/

.hidden {
  display: none !important;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* =========================
   HOME
========================= */

.small {
  font-family: Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 2px;
  opacity: 0.6;
}

.intro {
  max-width: 500px;
  line-height: 1.8;
  font-size: 18px;
}


/* =========================
   BUTTONS
========================= */

button {
  margin-top: 20px;
  padding: 14px 22px;

  background: white;
  color: #3d3535;

  border: 1px solid #3d3535;
  border-radius: 30px;

  cursor: pointer;

  font-family: inherit;
  font-size: 15px;

  transition:
    background 0.2s ease,
    color 0.2s ease,
    transform 0.2s ease;
}

button:hover {
  background: #3d3535;
  color: white;
  transform: translateY(-2px);
}


/* =========================
   MEMORY PAGE
========================= */

#memories h1 {
  font-size: 42px;
  font-weight: normal;
  margin-bottom: 30px;
}

.memoryButton {
  display: block;
  width: 280px;
}


/* =========================
   LETTER PAGE
========================= */

#letterPage {
  justify-content: flex-start;
  padding-top: 70px;
}

#letterPage h1 {
  font-size: 28px;
  font-weight: normal;
  margin-bottom: 10px;
}

.divider {
  font-size: 20px;
  margin-bottom: 25px;
  opacity: 0.6;
}


/* =========================
   LETTER
========================= */

#letter {
  max-width: 650px;
  width: 100%;

  background: #fffaf7;

  padding: 40px 45px;

  border-radius: 4px;

  box-shadow:
    0 8px 25px rgba(80, 50, 60, 0.12),
    inset 0 0 30px rgba(120, 90, 90, 0.05);

  text-align: left;

  line-height: 1.8;
  font-size: 17px;

  transform: rotate(-0.4deg);
}

#letter p {
  text-indent: 30px;
  margin-bottom: 25px;
}


/* =========================
   SHOOTING AREA
========================= */

#shootingGame {
  width: 100%;
  max-width: 650px;
  height: 330px;

  position: relative;

  margin-top: 40px;

  overflow: hidden;
}

.gameInstruction {
  text-align: center;
  font-size: 14px;
  opacity: 0.7;
  margin: 0;
}


/* =========================
   BASKETBALL HOOP
========================= */

#hoop {
  position: absolute;

  top: 45px;
  left: 50%;

  transform: translateX(-50%);

  width: 120px;
  height: 130px;
}


/* BACKBOARD */

.backboard {
  position: absolute;

  top: 0;
  left: 50%;

  transform: translateX(-50%);

  width: 70px;
  height: 55px;

  background: rgba(255, 255, 255, 0.7);

  border: 2px solid #3d3535;

  border-radius: 3px;
}


/* RIM */

.rim {
  position: absolute;

  top: 48px;
  left: 50%;

  transform: translateX(-50%);

  width: 78px;
  height: 13px;

  border: 4px solid #d94f7c;

  border-radius: 50%;

  z-index: 2;
}


/* NET */

.net {
  position: absolute;

  top: 60px;
  left: 50%;

  transform: translateX(-50%);

  width: 58px;
  height: 55px;

  border-left: 2px solid rgba(80, 50, 60, 0.3);
  border-right: 2px solid rgba(80, 50, 60, 0.3);
  border-bottom: 2px solid rgba(80, 50, 60, 0.3);

  clip-path: polygon(
    0 0,
    100% 0,
    80% 100%,
    20% 100%
  );
}


/* =========================
   PINK BASKETBALL
========================= */

#paperBall {
  position: absolute;

  bottom: 25px;
  left: 50%;

  width: 62px;
  height: 62px;

  transform:
    translateX(-50%)
    rotate(-8deg);

  background:
    radial-gradient(
      circle at 30% 25%,
      #ff9fba 0%,
      #f4779d 35%,
      #e65382 70%,
      #cc3f6d 100%
    );

  border-radius: 50%;

  box-shadow:
    5px 8px 12px rgba(70, 30, 45, 0.28),
    inset 7px 7px 10px rgba(255, 255, 255, 0.2),
    inset -8px -8px 12px rgba(90, 20, 45, 0.25);

  cursor: grab;

  z-index: 5;

  touch-action: none;

  user-select: none;

  overflow: hidden;
}


/* =========================
   BASKETBALL LINES
========================= */

#paperBall::before {
  content: "";

  position: absolute;

  width: 72px;
  height: 100px;

  left: -28px;
  top: -19px;

  border-right: 4px solid rgba(75, 25, 45, 0.75);

  border-radius: 50%;

  transform: rotate(25deg);
}

#paperBall::after {
  content: "";

  position: absolute;

  width: 72px;
  height: 100px;

  right: -28px;
  top: -19px;

  border-left: 4px solid rgba(75, 25, 45, 0.75);

  border-radius: 50%;

  transform: rotate(-25deg);
}

#paperBall .paper-fold {
  position: absolute;

  width: 90px;
  height: 30px;

  left: -14px;
  top: 14px;

  border-top: 4px solid rgba(75, 25, 45, 0.75);

  border-radius: 50%;

  transform: rotate(5deg);

  pointer-events: none;
}

#paperBall .fold-two,
#paperBall .fold-three,
#paperBall .fold-four,
#paperBall .fold-five {
  display: none;
}


/* =========================
   SHOOTING ANIMATION
========================= */

#paperBall.shooting {
  animation:
    paperShoot
    0.75s
    cubic-bezier(.2, .8, .3, 1)
    forwards;
}

@keyframes paperShoot {
  0% {
    bottom: 25px;

    transform:
      translateX(-50%)
      rotate(-8deg)
      scale(1);
  }

  45% {
    bottom: 135px;

    transform:
      translateX(-50%)
      rotate(160deg)
      scale(0.95);
  }

  75% {
    bottom: 200px;

    transform:
      translateX(-50%)
      rotate(280deg)
      scale(0.9);
  }

  100% {
    bottom: 205px;

    transform:
      translateX(-50%)
      rotate(360deg)
      scale(0.85);
  }
}


/* =========================
   FALL THROUGH HOOP
========================= */

#paperBall.falling {
  animation:
    paperFall
    1s
    cubic-bezier(.55, .05, .7, .2)
    forwards;
}

@keyframes paperFall {
  0% {
    bottom: 205px;

    transform:
      translateX(-50%)
      rotate(360deg)
      scale(0.85);

    opacity: 1;
  }

  35% {
    bottom: 145px;

    transform:
      translateX(-50%)
      rotate(450deg)
      scale(0.85);
  }

  70% {
    bottom: 65px;

    transform:
      translateX(-50%)
      rotate(540deg)
      scale(0.9);
  }

  100% {
    bottom: -30px;

    transform:
      translateX(-50%)
      rotate(650deg)
      scale(0.95);

    opacity: 0;
  }
}


/* =========================
   SUCCESS MESSAGE
========================= */

#shotMessage {
  min-height: 20px;

  margin: 5px 0 0;

  font-size: 15px;

  opacity: 0.75;
}


/* =========================
   BACK BUTTON
========================= */

.lockedBack {
  opacity: 0.35;
  pointer-events: none;
}

.lockedBack.unlocked {
  opacity: 1;
  pointer-events: auto;
}


/* =========================
   CRUMPLE LETTER
========================= */

#letterPage.crumpling #letter {
  animation:
    crumplePaper
    0.9s
    ease-in
    forwards;
}

#letterPage.crumpling #letterTitle,
#letterPage.crumpling .divider,
#letterPage.crumpling #shootingGame,
#letterPage.crumpling #shotMessage,
#letterPage.crumpling #backButton {
  animation:
    fadeAway
    0.5s
    ease-in
    forwards;
}

@keyframes crumplePaper {
  0% {
    transform:
      rotate(-0.4deg)
      scale(1);

    opacity: 1;
  }

  20% {
    transform:
      rotate(3deg)
      scale(0.92, 0.95);
  }

  40% {
    transform:
      rotate(-5deg)
      scale(0.78, 0.82);
  }

  60% {
    transform:
      rotate(7deg)
      scale(0.55, 0.6);
  }

  80% {
    transform:
      rotate(-10deg)
      scale(0.3, 0.35);

    opacity: 0.7;
  }

  100% {
    transform:
      rotate(15deg)
      scale(0.02);

    opacity: 0;
  }
}

@keyframes fadeAway {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}


/* =========================
   TULIPS
========================= */

.tulips {
  position: absolute;

  font-size: 28px;

  z-index: 5;

  pointer-events: none;

  letter-spacing: 4px;
}

.tulips-left {
  left: 20px;
  bottom: 20px;

  transform: rotate(-8deg);
}

.tulips-right {
  right: 20px;
  top: 20px;

  transform: rotate(8deg);
}


/* =========================
   MOBILE
========================= */

@media (max-width: 600px) {

  #letter {
    padding: 30px 25px;
    font-size: 16px;
  }

  #memories h1 {
    font-size: 32px;
  }

  .tulips {
    font-size: 22px;
  }

  #paperBall {
    width: 58px;
    height: 58px;
  }
}