/* --- Basic Setup & New Color Variables --- */
:root {
  --bg-color: #0d1b2a; /* Deep night blue */
  --card-bg: #1b263b; /* Lighter blue for cards */
  --text-color: #e0e1dd; /* Off-white / light grey */
  --primary-color: #778da9; /* Muted steel blue */
  --highlight-color: #ffc107; /* Gold/Yellow for accents */
  --font-heading: "Playfair Display", serif;
  --font-body: "Poppins", sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
/* Replace with this new code */
/* Replace with these TWO new blocks */

body {
  /* The body now ONLY has the solid color that will be visible later */
  background-color: var(--bg-color);
  position: relative; /* This is important for positioning the pseudo-element */

  /* These lines stay the same */
  color: var(--text-color);
  font-family: var(--font-body);
  line-height: 1.8;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: absolute; /* This makes the background scroll with the page */
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh; /* Make it the height of the screen */
  z-index: -1; /* Place it behind all content */

  /* The background image and overlay are now applied here */
  background-image: linear-gradient(
      rgba(18, 18, 18, 0.85),
      rgba(18, 18, 18, 0.85)
    ),
    url("photo7.jpg");
  background-size: cover;
  background-position: center center;

  /* This is the key for the smooth fade-out effect */
  transition: opacity 1.5s ease;
  opacity: 1; /* It starts fully visible */
}

/* This new class will be added by JavaScript to hide the background */
body.background-hidden::before {
  opacity: 0; /* Fade it out completely */
}

/* --- Entry Page Styles & Animations --- */
#splash-screen {
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  /* Animated Gradient Background */
  background: linear-gradient(315deg, #0d1b2a, #1b263b, #415a77);
  background-size: 400% 400%;
  animation: gradientAnimation 15s ease infinite;
  transition: opacity 0.8s ease-out;
}

@keyframes gradientAnimation {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

#splash-screen.fade-out {
  opacity: 0;
}

.splash-content {
  transform: translateY(-20px);
}

.splash-name {
  font-family: var(--font-heading);
  font-size: clamp(3rem, 10vw, 6rem);
  color: var(--text-color);
  font-weight: 700;
  margin-bottom: 2rem;
  /* Glowing Text Animation */
  animation: glow 2.5s ease-in-out infinite alternate;
}

@keyframes glow {
  from {
    text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px var(--highlight-color);
  }
  to {
    text-shadow: 0 0 20px #fff, 0 0 30px var(--highlight-color),
      0 0 40px var(--highlight-color);
  }
}

#enter-btn {
  background: transparent;
  color: var(--text-color);
  border: 2px solid var(--primary-color);
  padding: 1rem 2.5rem;
  font-family: var(--font-body);
  font-size: 1rem;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.4s ease;
}

#enter-btn:hover {
  background-color: var(--primary-color);
  color: var(--bg-color);
  box-shadow: 0 0 20px var(--primary-color);
}

/* --- Main "Sorry" Page Styles --- */
#main-content.hidden {
  display: none;
}
#main-content {
  opacity: 0;
  transition: opacity 1s ease-in;
}
#main-content.visible {
  opacity: 1;
}

/* --- General Layout & Typography --- */
h1,
h2 {
  font-family: var(--font-heading);
  color: var(--highlight-color);
  font-weight: 700;
  margin-bottom: 1rem;
}
h1 {
  font-size: clamp(2.5rem, 8vw, 5rem);
  text-align: center;
}
h2 {
  font-size: clamp(2rem, 6vw, 3rem);
}
p {
  max-width: 650px;
  margin: 0 auto;
  font-weight: 300;
}
.subtitle {
  font-size: 1.2rem;
  color: var(--primary-color);
  text-align: center;
}

/* --- Section Layout --- */
.fullscreen-section {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 2rem;
}
.content-section {
  padding: 120px 2rem;
  max-width: 900px;
  margin: 0 auto;
  position: relative;
  border-bottom: 1px solid #1b263b;
}

/* --- New Scroll Animations --- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(50px) scale(0.95);
  transition: opacity 0.8s ease-out,
    transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* --- Intro Section --- */
#intro .scroll-down-prompt {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--primary-color);
  font-size: 0.8rem;
  animation: bounce 2s infinite;
}
#intro .arrow {
  font-size: 1.5rem;
  line-height: 1;
}
@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

/* --- Memories Gallery --- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}
.gallery-item {
  background-color: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #415a77;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}
.gallery-item:hover {
  transform: translateY(-10px) scale(1.03);
  box-shadow: 0 0 25px var(--primary-color);
}
.gallery-item img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
  filter: saturate(0.9);
  transition: filter 0.4s ease;
}
.gallery-item:hover img {
  filter: saturate(1.2);
}
.gallery-item .caption {
  padding: 1rem;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--primary-color);
  text-align: center;
}

/* --- Response Section --- */
#response button {
  background-color: var(--highlight-color);
  color: var(--bg-color);
  border: none;
  padding: 1rem 2rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 2rem;
  transition: background-color 0.3s ease, transform 0.3s ease;
}
#response button:hover {
  background-color: #ffda79;
  transform: scale(1.05);
}
#response-final.hidden {
  display: none;
}

/* --- ENHANCED "Scattered Photos" Timeline Section --- */
#timeline .subtitle {
  max-width: 500px;
  margin-top: 1rem;
  font-size: 1rem;
}

.polaroid-stack {
  margin-top: 4rem;
  display: flex;
  flex-wrap: wrap; /* Allows photos to wrap to the next line */
  justify-content: center; /* Centers the rows of photos */
  gap: 1rem; /* Adjusts space between photos */
}

.polaroid-container {
  perspective: 1000px;
  width: 300px; /* Give a fixed width to each container */
}

.polaroid-photo {
  background-color: #f4f3ef;
  color: #333;
  padding: 15px 15px 60px 15px;
  border-radius: 4px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  position: relative;

  /* The animation transition now includes the delay */
  transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1),
    box-shadow 0.5s ease;
  transform-style: preserve-3d;
}

/* REPLACE IT WITH THIS NEW RULE */
.polaroid-photo img {
    /* 1. Define a fixed, square box for the photo to live in */
    width: 100%; /* This makes it fill the available horizontal space inside the padding */
    height: 260px; /* THIS IS THE KEY: We force every photo area to be the same height */

    /* 2. This is the magic property that fixes everything */
    object-fit: cover; /* This makes the image fill the box without stretching */
    object-position: center; /* This ensures the center of the image is prioritized */

    /* These lines are the same as before */
    display: block;
    border: 1px solid #e0e0e0;
}

.polaroid-caption {
  position: absolute;
  bottom: 15px;
  left: 15px;
  right: 15px;
  text-align: center;
  /* The new handwritten font */
  font-family: "Caveat", cursive;
  font-size: 1.5rem;
  font-weight: 700;
  color: #444;
}

/* --- The Animation Logic --- */

/* The starting (hidden) state is the same */
.polaroid-container.animate-on-scroll {
  opacity: 0;
  transform: translateY(100px);
  transition: opacity 1s ease, transform 1s ease;
}
.polaroid-container.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* This is where the magic happens: creating the scattered look and cascading animation */

/* First photo in each row of 3 */
.polaroid-container:nth-child(3n-2) {
  transition-delay: 0s; /* No delay */
}
.polaroid-container:nth-child(3n-2) .polaroid-photo {
  transform: rotateZ(-8deg) translateY(-10px);
}

/* Second (middle) photo in each row */
.polaroid-container:nth-child(3n-1) {
  transition-delay: 0.15s; /* Small delay */
}
.polaroid-container:nth-child(3n-1) .polaroid-photo {
  transform: rotateZ(2deg) translateY(5px);
}

/* Third photo in each row */
.polaroid-container:nth-child(3n) {
  transition-delay: 0.3s; /* Longest delay */
}
.polaroid-container:nth-child(3n) .polaroid-photo {
  transform: rotateZ(8deg) translateY(-5px);
}

/* When the parent is visible, ALL photos flatten out */
.polaroid-container.animate-on-scroll.visible .polaroid-photo {
  transform: rotateZ(0deg) translateY(0);
}

/* Enhanced hover effect to bring photo to the front */
.polaroid-photo:hover {
  transform: scale(1.1) rotateZ(0deg) !important; /* Straightens and enlarges */
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
  z-index: 10; /* Lifts it above the others */
}

/* --- ENHANCED "Signed Letter" Promise Section --- */
.letter-section {
    /* We remove the background color from the section itself */
    padding: 100px 2rem;
    position: relative;
}

/* We apply the paper style to the content-wrapper instead */
.letter-section .content-wrapper {
    background-color: #fdfdfa; /* Paper color */
    color: #333;
    padding: 4rem 2rem;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 800px;
    margin: 0 auto;
    /* Subtle paper texture */
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23e8e8e8" fill-opacity="0.4"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.letter-section h2 {
    color: var(--highlight-color);
}

.letter-section p {
    color: #444;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.signature {
    font-family: 'Sacramento', cursive;
    font-size: 3.5rem;
    text-align: center;
    color: #555;
    transform: rotate(-3deg);
}

/* --- ENHANCED "Signed Letter" Promise Section --- */
.letter-section {
    /* We remove the background color from the section itself */
    padding: 100px 2rem;
    position: relative;
}

/* We apply the paper style to the content-wrapper instead */
.letter-section .content-wrapper {
    background-color: #fdfdfa; /* Paper color */
    color: #333;
    padding: 4rem 2rem;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 800px;
    margin: 0 auto;
    /* Subtle paper texture */
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23e8e8e8" fill-opacity="0.4"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}

.letter-section h2 {
    color: var(--highlight-color);
}

.letter-section p {
    color: #444;
    font-size: 1.1rem;
    margin-bottom: 3rem;
}

.signature {
    font-family: 'Sacramento', cursive;
    font-size: 3.5rem;
    text-align: center;
    color: #555;
    transform: rotate(-3deg);
}

/* Form styling inside the envelope */
#feedback-form {
  width: 100%;
  opacity: 0; /* Hidden until animated in */
  transition: opacity 0.5s ease 0.5s; /* Fade in after flap opens */
}
#feedback-form.visible {
  opacity: 1;
}
#feedback-form textarea {
  height: 15vh;
}

/* Add this code near the top of your style.css file */

/* --- Vinyl Music Player --- */
#music-control {
  position: fixed;
  top: 25px;
  right: 25px;
  z-index: 1000;
  cursor: pointer;
  width: 60px;
  height: 60px;
  opacity: 0.7;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#music-control:hover {
  opacity: 1;
  transform: scale(1.1);
}

.vinyl-record {
  width: 100%;
  height: 100%;
  background: #2c2c2c;
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
  /* This creates the subtle groove lines on the record */
  background-image: repeating-radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.05) 0,
    rgba(255, 255, 255, 0.05) 1px,
    transparent 1px,
    transparent 3px
  );
  display: flex;
  justify-content: center;
  align-items: center;
}

/* The spinning animation */
#music-control.playing .vinyl-record {
  animation: spin 4s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.vinyl-label {
  width: 25px;
  height: 25px;
  background: var(--highlight-color);
  border-radius: 50%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  /* The small hole in the middle */
  border: 2px solid var(--bg-color);
}

.play-icon,
.pause-icon {
  position: absolute;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* The Play Icon (a triangle) */
.play-icon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid var(--bg-color);
  margin-left: 3px;
  opacity: 0;
  transform: scale(0.8);
}

/* The Pause Icon (two bars) */
.pause-icon {
  width: 10px;
  height: 10px;
  display: flex;
  justify-content: space-between;
  opacity: 0;
  transform: scale(0.8);
}
.pause-icon::before,
.pause-icon::after {
  content: "";
  width: 3px;
  height: 100%;
  background-color: var(--bg-color);
}

/* Logic for showing/hiding the icons */
#music-control.paused .play-icon {
  opacity: 1;
  transform: scale(1);
}
#music-control.playing .pause-icon {
  opacity: 1;
  transform: scale(1);
}



/* ======================================================== */
/* --- ULTIMATE FINAL SEQUENCE STYLES (Promise & Form) --- */
/* ======================================================== */

/* This is the main container that creates the "sticky" scrolling effect */
#final-sequence {
    position: relative;
    height: 300vh; /* Make the scroll area 3x the screen height for the animation */
}

/* --- Promise "Letter" Section --- */
.letter-section {
    height: 100vh; /* Takes up one full screen height */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}
.letter-section .content-wrapper {
    background-color: #fdfdfa;
    color: #333;
    padding: 4rem 2rem;
    border-radius: 8px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    max-width: 800px;
    margin: 0 auto;
    background-image: url('data:image/svg+xml,%3Csvg width="60" height="60" viewBox="0 0 60 60" xmlns="http://www.w3.org/2000/svg"%3E%3Cg fill="none" fill-rule="evenodd"%3E%3Cg fill="%23e8e8e8" fill-opacity="0.4"%3E%3Cpath d="M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z"/%3E%3C/g%3E%3C/g%3E%3C/svg%3E');
}
.letter-section h2 { color: var(--highlight-color); }
.letter-section p { color: #444; font-size: 1.1rem; margin-bottom: 3rem; }
.signature {
    font-family: 'Sacramento', cursive;
    font-size: 3.5rem;
    text-align: center;
    color: #555;
    transform: rotate(-3deg);
}

/* --- Envelope Section --- */
/* This section will stick to the screen while its contents animate */
.envelope-section {
    position: sticky;
    top: 0;
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* The background will darken during the animation */
.envelope-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    opacity: 0; /* Starts transparent */
    transition: opacity 0.5s ease;
    z-index: -1;
}
.envelope-section.is-animating::before {
    opacity: 1; /* Becomes opaque dark */
}

.envelope-container {
    position: relative;
    width: clamp(300px, 90vw, 600px);
    /* The scale will be controlled by JavaScript */
    transform: scale(0.7);
    opacity: 0;
}

.envelope-flap {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    background-color: #c7a17a; 
    transform-origin: top center;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
    transition: transform 1.2s cubic-bezier(0.68, -0.55, 0.27, 1.55) 0.5s;
    z-index: 12;
}

.envelope-container.open .envelope-flap {
    transform: rotateX(180deg);
}

/* The rest of the envelope styles are mostly the same */
.envelope-body { position: relative; width: 100%; padding-top: 60%; background-color: #d4af37; z-index: 10; }
.envelope-content { position: absolute; top: 10%; left: 5%; right: 5%; bottom: 5%; background-color: #fdfdfa; padding: 2rem; box-shadow: inset 0 0 20px rgba(0,0,0,0.1); z-index: 11; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; color: #333; }
#response-initial { cursor: pointer; transition: opacity 0.5s ease; }
#response-initial.hidden { display: none; }
#wax-seal { width: 100px; height: 100px; margin: 0 auto; transition: transform 0.3s ease; }
#wax-seal svg { fill: #a12a2a; }
#wax-seal:hover { transform: scale(1.1); }
.seal-text { margin-top: 1rem; color: #555; font-family: var(--font-heading); }
#feedback-form { width: 100%; opacity: 0; transition: opacity 0.5s ease 0.5s; }
#feedback-form.hidden { display: none; }
#feedback-form.visible { opacity: 1; }
#feedback-form textarea { height: 15vh; }
#response-final.hidden { display: none; }