@import url("https://fonts.googleapis.com/css2?family=Fredericka+the+Great&family=Permanent+Marker&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Fredericka+the+Great&family=Permanent+Marker&family=Montserrat:wght@400;500;600;700&display=swap");

body {
  margin: 0;
  overflow: hidden;
  font-family: "Montserrat", sans-serif;
}

#container {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#background {
  width: 100%;
  height: 100%;
  background-image: url("./hj.webp");
  background-size: cover;
  background-position: center;
}

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0;
  transition: opacity 1s;
  pointer-events: none;
}

#pageOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: black;
  opacity: 0;
  transition: opacity 1s;
  pointer-events: none;
  z-index: 199;
}

#newImage {
  position: absolute;
  display: none;
  height: 100%;
  width: auto;
  top: 0;
  left: 0;
  cursor: grab;
  z-index: 1;
}

#imageZonesContainer {
  position: absolute;
  display: none;
  height: 100%;
  width: auto;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
}

#changeBtn {
  position: fixed;
  top: calc(50% - 130px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 70px;
  background-color: #fff;
  color: #608bc7;
  border: 2px #608bc7 solid;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  z-index: 10;
}

#changeBtn:hover {
  background-color: #608bc7;
  color: #fff;
}

#welcomeText {
  position: fixed;
  top: calc(50% - 300px);
  left: 50%;
  transform: translateX(-50%);
  color: #608bc7;
  font-size: 90px;
  font-weight: 400;
  display: inline-block;
  white-space: nowrap;
  text-align: center;
  z-index: 10;
  opacity: 1;
  transition: opacity 1s;
  font-family: "Fredericka the Great", serif;
  letter-spacing: 2px;
}

#welcomeText.hidden {
  opacity: 0;
  pointer-events: none;
}

#progressBar {
  position: fixed;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 300px;
  height: 20px;
  background-color: rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  overflow: hidden;
  display: none;
  z-index: 10;
  border: 2px solid white;
}

#progressFill {
  width: 0%;
  height: 100%;
  background-color: #608bc7;
  transition: width 0.5s ease, background-color 0.5s ease;
}

#progressFill.complete {
  background-color: #4caf50;
}

#checkmark {
  position: fixed;
  top: 8px;
  left: calc(50% + 160px);
  font-size: 24px;
  color: #4caf50;
  display: none;
  z-index: 10;
}

.interactive-zone {
  position: absolute;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.3s;
  pointer-events: auto;
}

.focus-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.focus-image.visible {
  display: block;
  opacity: 1;
}

.food-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  display: none;
  z-index: 100;
  transition: background-color 0.8s ease-out;
}

.food-background.active {
  background-color: rgba(0, 0, 0, 0.8);
}

.food-overlay {
  position: fixed;
  top: 100%;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 101;
  transition: top 0.8s ease-out;
  pointer-events: none;
  box-sizing: border-box;
}

.food-overlay.active {
  top: 20%;
}

.food-overlay img {
  max-width: 70%;
  max-height: 70%;
  object-fit: contain;
  pointer-events: auto;
}

.start-button {
  position: fixed;
  top: calc(50% - 100px);
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 60px;
  background-color: #fff;
  color: #608bc7;
  border: 2px #608bc7 solid;
  cursor: pointer;
  font-size: 18px;
  font-weight: bold;
  z-index: 102;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-out, background-color 0.3s;
}

.start-button:hover {
  background-color: #608bc7;
  color: #fff;
}

.start-button.visible {
  opacity: 1;
}

.start-button.completed {
  background-color: #9e9e9e;
  color: white;
  cursor: default;
}

.start-button.completed:hover {
  background-color: #9e9e9e;
  border: 2px #9e9e9e solid;
}

.overlay-title {
  position: fixed;
  top: calc(50% - 290px);
  left: 50%;
  transform: translateX(-50%);
  color: #608bc7;
  font-size: 80px;
  font-weight: 400;
  text-align: center;
  z-index: 102;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-out;
  font-family: "Fredericka the Great", serif;
  letter-spacing: 2px;
}

.overlay-subtitle {
  position: fixed;
  top: calc(50% - 180px);
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 20px;
  text-align: center;
  z-index: 102;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-out;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
  max-width: 600px;
  font-family: "Montserrat", sans-serif;
}

.overlay-title.visible,
.overlay-subtitle.visible {
  opacity: 1;
}

.overlay-title.completed,
.overlay-subtitle.completed {
  color: #9e9e9e;
}

.interactive-zone.completed {
  pointer-events: none;
  opacity: 0.5;
}

.back-button {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 10px 20px;
  background-color: #fff;
  color: #608bc7;
  border: 2px #608bc7 solid;
  cursor: pointer;
  font-size: 16px;
  z-index: 201;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-out;
}

.back-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-button:hover {
  background-color: #608bc7;
  color: #fff;
}

.content-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: white;
  display: none;
  z-index: 200;
  padding: 40px;
  box-sizing: border-box;
  overflow-y: auto;
}

.content-page h1 {
  font-size: 48px;
  margin: 0 0 30px 0;
  text-align: left;
}

.content-page p {
  font-size: 24px;
  text-align: left;
  max-width: 800px;
  margin-bottom: 40px;
}

.images-container {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 20px;
}

.image-wrapper {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  opacity: 0;
  transform: scale(0.8);
  transition: transform 0.3s ease, opacity 0.5s ease;
}

.image-wrapper[data-index="0"] {
  top: 100px;
  left: 10px;
}

.image-wrapper[data-index="1"] {
  top: 200px;
  left: 350px;
}

.image-wrapper[data-index="2"] {
  top: 100px;
  left: 650px;
}

.image-wrapper[data-index="3"] {
  top: 200px;
  left: 1100px;
}

.image-caption {
  background-color: #608bc7;
  color: white;
  padding: 8px 12px;
  font-size: 22px;
  text-align: center;
  max-width: fit-content;
  margin-top: 50px;
  font-family: Arial, sans-serif;
  font-weight: 500;
  order: 1;
}

.image-wrapper:hover {
  transform: scale(0.85) rotate(0deg);
  z-index: 10;
}

.image-wrapper.visible {
  opacity: 1;
  transform: scale(1) rotate(-2deg);
}

.image-wrapper img {
  width: 260px;
  height: 360px;
  object-fit: cover;
  cursor: pointer;
  filter: grayscale(100%) sepia(30%) brightness(0.8) blur(2px);
  transition: filter 0.8s ease;
  position: relative;
  display: block;
  border: 2px #608bc7 solid;
  background: white;
  padding: 10px 20px 80px 35px;
}

.image-wrapper.visible img {
  animation: memoryReveal 1.5s ease-out forwards;
}

@keyframes memoryReveal {
  0% {
    filter: grayscale(100%) sepia(30%) brightness(0.8) blur(2px);
    opacity: 0.6;
  }

  50% {
    filter: grayscale(50%) sepia(15%) brightness(0.9) blur(1px);
    opacity: 0.8;
  }

  100% {
    filter: grayscale(0%) sepia(0%) brightness(1) blur(0px);
    opacity: 1;
  }
}

.image-wrapper img:hover {
  filter: grayscale(0%) sepia(0%) brightness(1.05) blur(0px);
  transition: all 0.3s ease;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3), 0 15px 30px rgba(0, 0, 0, 0.2);
}

.image-wrapper:hover {
  transform: scale(1.05) rotate(0deg) translateY(-5px);
  transition: all 0.3s ease;
  z-index: 10;
}

.polaroid-date {
  background-color: transparent;
  color: #608bc7;
  padding: 0;
  margin-top: -50px;
  font-size: 18px;
  text-align: center;
  max-width: 280px;
  font-family: "Permanent Marker", cursive;
  position: relative;
  z-index: 1;
}

@keyframes fallDown {
  to {
    transform: translateY(120vh) rotate(10deg);
    opacity: 0;
  }
}

.image-wrapper.fall {
  animation: fallDown 1s ease-in forwards;
}

.final-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 52px;
  font-family: "Fredericka the Great", serif;
  color: #608bc7;
  text-align: center;
  opacity: 0;
  z-index: 300;
  transition: opacity 1s ease;
}

.final-text.visible {
  opacity: 1;
}

#finalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 150;
  transition: background-color 0.8s ease-out;
}

#finalOverlay.active {
  background-color: rgba(0, 0, 0, 0.7);
}

#finalMessage {
  color: white;
  text-align: center;
  max-width: 700px;
  padding: 40px;
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

#finalMessage.visible {
  opacity: 1;
}

#finalMessage h2 {
  font-size: 42px;
  margin-bottom: 30px;
}

#finalMessage p {
  font-size: 24px;
  line-height: 1.6;
  margin-bottom: 40px;
}

#finalEndBtn {
  padding: 15px 40px;
  background-color: #608bc7;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

#finalEndBtn:hover {
  background-color: #4a6fa5;
}

#closeInstruction {
  position: fixed;
  top: 20px;
  right: 20px;
  color: white;
  font-size: 18px;
  z-index: 102;
  display: none;
  opacity: 0;
  transition: opacity 0.5s ease-out;
}

#closeInstruction.visible {
  opacity: 1;
}
