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

body {
  font-family: 'Georgia', serif;
  background: #f6f1ec;
  color: #2c2c2c;
  overflow: hidden;
}

/* INTRO SECTION */
.intro {
  position: fixed;
  width: 100%;
  height: 100vh;
  background: linear-gradient(135deg, #f4eae4, #e9ddd6);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  transition: opacity 1s ease, visibility 1s ease;
  z-index: 10;
}

/* 3D WRAPPER */
.envelope-wrapper {
  width: 50vw;
  height: 33vw;
  max-width: 700px;
  max-height: 460px;
  min-width: 280px;
  min-height: 185px;
  perspective: 1600px;
  cursor: pointer;
}

/* 3D OBJECT */
.envelope {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.2s ease;
}

.envelope.flipped {
  transform: rotateY(180deg);
}

/* SIDES */
.side {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 16px;
}

/* FRONT */
.front {
  background: linear-gradient(145deg, #ffffff, #f1e8e1);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-radius: 16px;
}

.front.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease;
}

/* Show front when ready */
.front.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.5s ease;
}

.address {
  text-align: center;
}

.address p {
  font-size: 14px;
  letter-spacing: 3px;
  color: #888;
}

.address h2 {
  margin-top: 10px;
  font-size: 32px;
  font-weight: normal;
  color: #3e3e3e;
}

/* BACK */
.back {
  background: #d1cec2;
  transform: rotateY(180deg);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

/* BACK BODY */
.back-body {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 75%;
  background: #d1cec2;
  border-radius: 0 0 16px 16px;
  z-index: 1;
}

/* FLAP */
.flap {
  position: absolute;
  top: 0;
  width: 100%;
  height: 65%;
  background: #ccc6b0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top;
  transition: transform 1.2s ease;
  z-index: 3;
}

/* Open flap */
.envelope.open .flap {
  transform: rotateX(180deg);
}

.click-text {
  margin-top: 30px;
  font-size: 14px;
  letter-spacing: 3px;

  /* Hide initially until API loads */
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.5s ease;
}

/* Show when ready */
.click-text.visible {
  visibility: visible;
  opacity: 1;
}

/* LETTER */
.letter {
  position: absolute;
  width: 90%;           /* wider */
  max-width: 650px;
  height: 80%;          /* taller */
  max-height: 500px;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(100%);
  background: #fffaf0;  /* warm card color */
  border-radius: 20px;
  padding: 40px 35px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
  transition: transform 1.4s ease;
  z-index: 2;
  
  /* Optional: paper texture */
  background-image: url('images/paper-texture.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.letter::before,
.letter::after {
  content: '';
  position: absolute;
  width: 60px;
  height: 60px;
  background-image: url('images/flower.png'); /* flower image */
  background-size: contain;
  background-repeat: no-repeat;
  z-index: 3;
}

/* Top-left */
letter::before { top: 15px; left: 15px; }

/* Bottom-right */
.letter::after { bottom: 15px; right: 15px; }

.letter h3 {
  margin-bottom: 25px;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: 2px;
  color: #4b3f36;
}

.letter p {
  font-size: 22px;
  line-height: 1.6;
  margin-bottom: 15px;
  color: #5c4a3c;
}

.letter span {
  font-size: 16px;
  letter-spacing: 1.5px;
  color: #7a6b5c;
}

.envelope.show-letter .letter {
  transform: translateX(-50%) translateY(-10%);
}

/* MAIN CONTENT */
.main-content {
  opacity: 0;
  transition: opacity 1.5s ease;
  padding: 10vh 5vw;
}

.main-content.visible {
  opacity: 1;
}

section {
  margin-bottom: 12vh;
}

.hero {
  text-align: center;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
}

.date {
  margin-top: 1rem;
  font-size: clamp(14px, 2vw, 20px);
  letter-spacing: 2px;
}

.countdown-section {
  text-align: center;
}

#countdown {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 3rem;
}

.time-box {
  text-align: center;
}

.time-box span {
  font-size: clamp(28px, 5vw, 52px);
  display: block;
}

.time-box small {
  letter-spacing: 2px;
  font-size: 12px;
  color: #777;
}

.gallery {
  text-align: center;
  margin-bottom: 100px;
}

.images {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
  flex-wrap: wrap;
}

.images img {
  width: 300px;
  border-radius: 10px;
  transition: transform 0.4s ease;
}

.images img:hover {
  transform: scale(1.05);
}

.rsvp {
  text-align: center;
  margin-bottom: 120px;
}

form {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

input,
select {
  padding: 12px;
  border-radius: 6px;
  border: 1px solid #ccc;
}

button {
  padding: 12px;
  background: #b7a387;
  border: none;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
}

button:hover {
  background: #b5aa9b;
}

/* Pop up */
.popup {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background-color: #4caf50; /* Green */
  color: white;
  padding: 15px 25px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
  font-family: sans-serif;
  font-size: 1rem;
}
.popup.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

/* Map Styling */
.date-map {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.map-container {
    width: 100%;
    max-width: 500px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}