@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Montserrat", sans-serif;
  background-color: #f4efe1;
  overflow-x: hidden;
  color: #00007c;
}

a {
  text-decoration: none;
  color: #00007c;
}

/* --- HEADER --- */
header {
  padding: 30px 50px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  justify-content: space-between;
}

.logo a {
  font-weight: 600;
  font-size: 1.2rem;
  justify-content: center;
  align-items: center;
}

.white {
  color: #00007c;
  background-color: #fff;
}

.blu {
  color: #fff;
  background-color: #00007c;
}

.gold {
  color: #e6d48a;
}

/* --- MAIN LAYOUT --- */
.content {
  min-height: 100vh;
  padding: 120px 50px 50px 50px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  position: relative;
}

.text-wrapper {
  text-align: right;
  margin-bottom: 40px;
  z-index: 10;
  position: relative;
}

h1 {
  font-size: 8vw;
  line-height: 1;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* Underline Effect */
.highlight-trigger {
  position: relative;
  cursor: pointer;
  display: inline-block;
}

.highlight-trigger:before {
  content: "";
  position: absolute;
  width: 0%;
  height: 3px;
  background-color: #00007c;
  left: 0;
  bottom: 0;
  transition: width 0.5s ease;
}

.highlight-trigger:hover:before {
  width: 100%;
}

/* --- IMAGE STACK --- */
.img_container {
  position: relative;
  width: 100%;
  max-width: 1400px; /* Increased to fit 4 images: (280px * 4) + (20px gaps * 3) = 1180px + buffer */
  height: 350px;
  margin-bottom: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1000px;
  overflow: visible; /* Allow images to be visible outside container */
}

.img_stack {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  overflow: visible; /* Ensure images aren't clipped */
}

.img_stack img {
  position: absolute;
  width: 280px;
  height: 350px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  transform-origin: center bottom;
  /* Performance optimizations */
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
}

/* Hint text */
.instruction-hint {
  position: absolute;
  bottom: -25px;
  right: 0;
  font-size: 12px;
  opacity: 0.5;
  pointer-events: none;
}

/* --- BOTTOM TEXT --- */
.bottom_text {
  width: 100%;
  text-align: right;
  margin-top: auto;
}

.bottom_text h5 {
  font-size: 1.2rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* --- TRANSITION SECTION --- */
.transition-section {
  padding: 100px 50px;
  text-align: right;
  background-color: #00007c;
}

.transition-text h2 {
  font-size: 4vw;
  text-transform: uppercase;
  margin: 10px 0;
  color: #f4efe1;
}

/* --- BALLOON AND SPARKLE ANIMATIONS --- */
.balloon-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

.balloon {
  position: absolute;
  width: 40px;
  height: 52px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
}

/* Blue balloon colors matching theme */
.balloon-1 {
  background: linear-gradient(135deg, #0047ab 0%, #0066cc 100%);
}

.balloon-2 {
  background: linear-gradient(135deg, #00a3e0 0%, #0088cc 100%);
}

.balloon-3 {
  background: linear-gradient(135deg, #3e4db3 0%, #5a67d8 100%);
}

/* Balloon string */
.balloon::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 30px;
  background: rgba(0, 0, 124, 0.3);
}

/* Balloon highlight */
.balloon::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 12px;
  width: 10px;
  height: 12px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  filter: blur(2px);
}

/* Float animation */
@keyframes float-up {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  10% {
    opacity: 0.9;
  }
  90% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(-120vh) translateX(var(--drift))
      rotate(var(--rotation));
    opacity: 0;
  }
}

/* Sparkles */
.sparkle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  pointer-events: none;
  z-index: 6;
  overflow: hidden;
}

.sparkle {
  position: absolute;
  width: 8px;
  height: 8px;
  background: #ffd700;
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2% 35%,
    39% 35%
  );
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 0 3px #ffd700);
}

@keyframes sparkle-twinkle {
  0%,
  100% {
    opacity: 0;
    transform: scale(0) rotate(0deg);
  }
  50% {
    opacity: 1;
    transform: scale(1.5) rotate(180deg);
  }
}

/* Confetti burst */
.confetti {
  position: absolute;
  width: 8px;
  height: 12px;
  opacity: 0;
}

@keyframes confetti-fall {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

/* --- FOURTH SECTION (8 IMAGES) --- */
.sec4-images {
  max-width: 1300px; /* Increased to fit 4 images spread out: (240px * 4) + (30px gaps * 3) */
  height: 750px; /* Increased to fit 2 rows with more spacing: (300px * 2) + 150px gap */
  overflow: visible;
  margin-bottom: 80px; /* More bottom margin for spacing */
}

.sec4-images .img_stack img {
  width: 240px;
  height: 300px;
}

/* --- MOBILE OPTIMIZATION --- */
@media (max-width: 768px) {
  header {
    padding: 20px;
  }

  .content {
    padding: 100px 20px 40px 20px;
    align-items: center;
  }

  .text-wrapper,
  .bottom_text,
  .transition-section {
    text-align: center;
    align-items: center;
  }

  #wrap {
    line-height: 5vh;
  }

  .bottom_text {
    margin-top: 10vh;
  }

  h1 {
    font-size: 48px;
  }

  .img_container {
    height: 700px; /* Increased for 2x2 grid on mobile */
    margin: 30px 0;
    max-width: 100%;
    overflow: visible;
  }

  .img_stack img {
    width: 220px;
    height: 280px;
    /* Reduced shadow for better mobile performance */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  }

  .transition-text h2 {
    font-size: 28px;
    color: #f4efe1;
  }

  /* Smaller balloons and sparkles on mobile */
  .balloon {
    width: 30px;
    height: 40px;
  }

  .sparkle {
    width: 6px;
    height: 6px;
  }

  .confetti {
    width: 6px;
    height: 10px;
  }

  /* Fourth section specific - 8 image grid on mobile */
  .sec4-images {
    height: 1100px; /* Increased for 2x4 grid (4 rows) with more spacing */
    overflow: visible;
    margin-bottom: 60px;
  }

  .sec4-images .img_stack img {
    width: 160px;
    height: 200px;
  }
}

/* --- PERFORMANCE OPTIMIZATIONS FOR MOBILE --- */
@media (max-width: 768px) {
  /* Reduce animations complexity on mobile */
  * {
    -webkit-tap-highlight-color: transparent;
  }

  /* Optimize image rendering */
  img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }

  /* Reduce motion for users who prefer it */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }

    .balloon-container,
    .sparkle-container {
      display: none;
    }
  }
}
