@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@400;500;600;700&family=Great+Vibes&display=swap');

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #211333;
  color: #fff2ff;
  font-family: 'Cormorant Garamond', serif;
  text-align: center;
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: 0.3s;
}

/* OPENING */

.intro {
  min-height: 100vh;
  padding: 30px 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 30%, #c9a5ec, transparent 55%),
    linear-gradient(145deg, #e9d8ff, #b998dc, #76539f);
  color: #fff;
  position: relative;
  overflow: hidden;
}

.sparkles {
  font-size: 25px;
  letter-spacing: 10px;
  margin-bottom: 20px;
  animation: sparkle 2s infinite alternate;
}

.crown {
  font-size: 75px;
  animation: float 3s ease-in-out infinite;
}

.intro .small-title {
  letter-spacing: 5px;
  font-size: 12px;
  margin-top: 30px;
}

.intro h1 {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(45px, 9vw, 80px);
  margin: 15px 0;
  text-shadow: 0 3px 15px #8b62ad;
}

.intro h2 {
  font-size: clamp(23px, 5vw, 35px);
}

.intro-text {
  font-size: 21px;
  max-width: 350px;
  line-height: 1.5;
}

.intro button,
.navigation button {
  background: #f3e5ff;
  color: #68458e;
  padding: 16px 30px;
  border-radius: 40px;
  font-size: 18px;
  box-shadow: 0 5px 20px #65418a66;
}

.intro button:hover,
.navigation button:hover {
  transform: scale(1.06);
  background: white;
}

.bottom-text {
  margin-top: 45px;
  font-style: italic;
}

/* CASTLE */

.hidden {
  display: none !important;
}

.castle {
  min-height: 100vh;
  background: #241536;
  overflow: hidden;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  padding: 17px;
  background: #493365;
  font-size: 16px;
}

.scene {
  position: relative;
  min-height: 570px;
  overflow: hidden;
  background: linear-gradient(#d2b8eb, #755596);
}

.hallway {
  position: absolute;
  inset: 0;
  perspective: 650px;
  overflow: hidden;
  background: linear-gradient(90deg, #48315e, #9b79bd, #48315e);
}

.ceiling {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 23%;
  background: #c8a9e5;
  clip-path: polygon(0 0,100% 0,70% 100%,30% 100%);
}

.left-wall,
.right-wall {
  position: absolute;
  top: 15%;
  bottom: 0;
  width: 30%;
  background: linear-gradient(90deg, #553b70, #b99bd7);
  border: 3px solid #d7b8f3;
}

.left-wall {
  left: 0;
  clip-path: polygon(0 0,100% 25%,100% 75%,0 100%);
}

.right-wall {
  right: 0;
  clip-path: polygon(0 25%,100% 0,100% 100%,0 75%);
}

.floor {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 35%;
  background: linear-gradient(#80609e, #39234f);
  clip-path: polygon(30% 0,70% 0,100% 100%,0 100%);
}

.door {
  position: absolute;
  width: 28%;
  height: 55%;
  top: 20%;
  left: 36%;
  border: 7px solid #f0d6ff;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(135deg, #9e75c1, #54346f);
  box-shadow: 0 0 35px #f0d5ff;
  transition: transform 1s, opacity 1s;
  transform-origin: left;
}

.door-knob {
  position: absolute;
  right: 13%;
  top: 55%;
  width: 9px;
  height: 9px;
  background: #f9dc9b;
  border-radius: 50%;
}

.hall-light {
  position: absolute;
  top: 35%;
  left: 48%;
  font-size: 40px;
  color: #fff4ce;
  text-shadow: 0 0 25px white;
}

/* ROOMS */

.room-content {
  position: relative;
  z-index: 3;
  min-height: 570px;
  padding: 30px 15px;
  background: linear-gradient(#38234cdd, #38234cdd);
  opacity: 0;
  animation: appear 1.3s forwards;
}

.room-content h1 {
  font-family: 'Great Vibes', cursive;
  font-size: clamp(40px, 8vw, 60px);
  color: #f2d9ff;
  margin: 10px 0;
}

.room-content > p {
  font-size: 20px;
}

.photo-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 190px));
  justify-content: center;
  gap: 20px;
  margin: 35px auto;
}

.photo-frame {
  background: #f8edff;
  padding: 9px 9px 17px;
  color: #68458e;
  box-shadow: 0 5px 20px #170a28;
  transform: rotate(-2deg);
  transition: 0.3s;
  cursor: pointer;
}

.photo-frame:nth-child(even) {
  transform: rotate(2deg);
}

.photo-frame:hover {
  transform: scale(1.07) rotate(0);
}

.photo-frame img {
  width: 100%;
  height: 155px;
  object-fit: cover;
  background: #d7b9ed;
}

.photo-frame p {
  margin: 10px 0 0;
  font-style: italic;
}

/* LETTER */

.letter {
  background: #f8edff;
  color: #63447c;
  max-width: 500px;
  margin: 25px auto;
  padding: 30px;
  border: 5px double #c19ce2;
  border-radius: 5px;
  line-height: 1.8;
  font-size: 19px;
}

/* MUSIC */

.song {
  background: #f6eaff;
  color: #68458e;
  max-width: 420px;
  margin: 15px auto;
  padding: 18px;
  border-radius: 15px;
}

.song audio {
  width: 100%;
}

/* CERTIFICATE */

.certificate {
  background: #f8edff;
  color: #65418a;
  max-width: 500px;
  margin: 30px auto;
  padding: 30px 15px;
  border: 7px double #c59bdf;
  outline: 2px solid #f3d99c;
  outline-offset: -15px;
}

.certificate h2 {
  font-family: 'Great Vibes', cursive;
  font-size: 42px;
}

.certificate .name {
  font-size: 40px;
  color: #9869b8;
  font-family: 'Great Vibes', cursive;
}

/* NAVIGATION */

.navigation {
  padding: 25px 10px;
}

.room-hint {
  color: #d9c0f2;
  font-style: italic;
  padding-bottom: 20px;
}

.popup {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #160b22ee;
  align-items: center;
  justify-content: center;
  padding: 25px;
}

.popup img {
  max-width: 90%;
  max-height: 85vh;
  border: 7px solid #ead5ff;
  border-radius: 10px;
}

.close-popup {
  position: absolute;
  top: 20px;
  right: 25px;
  font-size: 40px;
  cursor: pointer;
}

/* ANIMATIONS */

@keyframes sparkle {
  from { opacity: .5; }
  to { opacity: 1; }
}

@keyframes float {
  50% { transform: translateY(-12px); }
}

@keyframes appear {
  to { opacity: 1; }
}

.walking {
  animation: walk 1s ease-in-out;
}

@keyframes walk {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.08); filter: brightness(1.5); }
  100% { transform: scale(1); filter: brightness(1); }
}

@media(max-width: 450px) {
  .photo-gallery {
    gap: 10px;
  }

  .photo-frame img {
    height: 125px;
  }

  .scene, .room-content {
    min-height: 620px;
  }
}

/* REALISTIC FIRST PERSON WALKING */

.scene.walking .room-content {
  animation: roomFade 1.5s forwards;
}

.scene.walking .hallway {
  animation: walkForward 1.5s ease-in forwards;
}

.scene.walking .door {
  animation: doorApproach 1.5s ease-in forwards;
}

@keyframes roomFade {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes walkForward {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.3);
    filter: brightness(1.15);
  }
  100% {
    transform: scale(2.5);
    filter: brightness(1.8);
  }
}

@keyframes doorApproach {
  0% {
    transform: scale(1);
  }
  70% {
    transform: scale(1.8);
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

/* REALISTIC FIRST PERSON WALKING */

.scene.walking .room-content {
  animation: roomFade 1.5s forwards;
}

.scene.walking .hallway {
  animation: walkForward 1.5s ease-in forwards;
}

.scene.walking .door {
  animation: doorApproach 1.5s ease-in forwards;
}

@keyframes roomFade {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes walkForward {
  0% {
    transform: scale(1);
    filter: brightness(1);
  }
  50% {
    transform: scale(1.3);
    filter: brightness(1.15);
  }
  100% {
    transform: scale(2.5);
    filter: brightness(1.8);
  }
}

@keyframes doorApproach {
  0% {
    transform: scale(1);
  }
  70% {
    transform: scale(1.8);
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}