:root {
  --paper: #f6ead9;
  --ink: #3b2b26;
  --muted: rgba(59, 43, 38, 0.72);
  --accent: #8f5f4d;
  --accent-soft: #e8cba7;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
  color: var(--ink);
  background:
    linear-gradient(rgba(248, 239, 223, 0.82), rgba(248, 239, 223, 0.9)),
    url("assets/bg.jpg") center/cover fixed;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }
.loading-screen,
.intro,
.success-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
}

.loading-screen {
  display: grid;
  place-items: center;
  background: #eeddc8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: opacity 0.7s ease;
}

.loading-screen.hidden,
.success-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro {
  display: grid;
  place-items: center;
  gap: 24px;
  padding: 24px;
  background: linear-gradient(180deg, #eedcc6, #e2ceb6);
}

.envelope {
  position: relative;
  width: min(440px, 92vw);
  height: 300px;
  background: #d2a778;
  border-radius: 16px;
  box-shadow: 0 30px 60px rgba(96, 62, 49, 0.18);
}

.flap {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  background: linear-gradient(180deg, #bd8f64, #e2b285);
  transform-origin: top;
  transition: transform 1.1s ease;
}

.letter-preview {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  top: 16%;
  padding: 24px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fffaf2, #f4e7d4);
  box-shadow: inset 0 0 0 1px rgba(85, 55, 40, 0.08);
  transform: translateY(0);
  transition: transform 1.2s ease;
}

body.intro-complete .flap { transform: rotateX(180deg); }
body.intro-complete .letter-preview { transform: translateY(-260px); }
body.intro-complete .intro { opacity: 0; pointer-events: none; transition: opacity 1s ease 1s; }

.intro h1,
.hero h2,
.section-heading h3,
.modal-card h3 {
  font-family: "Great Vibes", cursive;
  font-weight: 400;
}

.intro h1 { font-size: clamp(3rem, 7vw, 5rem); margin: 12px 0; }
.eyebrow { margin: 0; font-family: "Poppins", sans-serif; letter-spacing: 0.2em; text-transform: uppercase; font-size: 0.76rem; color: rgba(59, 43, 38, 0.62); }
.intro-actions,
.response-options,
.share-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

.page-shell.hidden { opacity: 0; transform: translateY(20px); }
.page-shell { transition: opacity 1s ease 0.9s, transform 1s ease 0.9s; }
body.intro-complete .page-shell { opacity: 1; transform: none; }

.section {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0;
}

.hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.hero-paper,
.paper-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.55), rgba(255,255,255,0.72)),
    radial-gradient(circle at top, rgba(255,255,255,0.7), transparent 45%);
  border-radius: 28px;
  padding: 34px;
  box-shadow: 0 30px 60px rgba(73, 48, 38, 0.12);
  border: 1px solid rgba(105, 75, 57, 0.12);
}

.hero-paper {
  width: min(760px, 100%);
  position: relative;
}

.hero-paper::after,
.paper-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(130, 97, 78, 0.08) 1px, transparent 1px);
  background-size: 100% 34px;
  opacity: 0.2;
  border-radius: inherit;
}

.hero h2 { font-size: clamp(3.2rem, 9vw, 6.2rem); margin: 12px 0; line-height: 0.95; }
.typed-line { min-height: 58px; font-size: 1.3rem; color: var(--muted); }
.quote-section { text-align: center; padding-top: 12px; }
.quote { font-size: clamp(1.7rem, 4vw, 2.9rem); margin: 0; color: #6c4335; }
.paper-card { position: relative; }
.paper-card p { font-size: 1.32rem; line-height: 1.8; color: var(--muted); }

.gallery {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.memory-card {
  min-height: 260px;
  padding: 18px;
  border: 12px solid #fff8f0;
  box-shadow: 0 24px 36px rgba(73, 48, 38, 0.1);
  background:
    linear-gradient(180deg, transparent, rgba(66, 44, 32, 0.75)),
    url("assets/bg.jpg") center/cover;
  display: flex;
  align-items: end;
  transform: rotate(var(--twist));
}

.memory-card:nth-child(1) { --twist: -3deg; }
.memory-card:nth-child(2) { --twist: 2deg; }
.memory-card:nth-child(3) { --twist: -1deg; }
.memory-card:nth-child(4) { --twist: 3deg; }
.memory-card span { color: #fff7f0; font-family: "Poppins", sans-serif; }

.response-choice,
.share-actions button,
.skip-button,
.cta-button,
.music-toggle {
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.response-choice,
.share-actions button,
.skip-button {
  padding: 13px 20px;
  font-family: "Poppins", sans-serif;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(105, 75, 57, 0.16);
}

.cta-button {
  padding: 14px 28px;
  color: #fffaf2;
  text-decoration: none;
  font-family: "Poppins", sans-serif;
  background: linear-gradient(135deg, var(--accent), #b68169);
}

.response-form label {
  display: block;
  margin-bottom: 16px;
  font-family: "Poppins", sans-serif;
  color: rgba(59, 43, 38, 0.74);
}

.response-form input,
.response-form textarea {
  width: 100%;
  margin-top: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(105, 75, 57, 0.18);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
  color: var(--ink);
}

.music-toggle {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  z-index: 10;
  background: linear-gradient(135deg, #8f5f4d, #d0a585);
  color: #fffaf2;
}

.success-modal {
  display: grid;
  place-items: center;
  background: rgba(77, 55, 44, 0.35);
  padding: 24px;
  transition: opacity 0.4s ease;
}

.modal-card {
  max-width: 460px;
  text-align: center;
}

.reveal {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.visible { opacity: 1; transform: none; }

@media (max-width: 768px) {
  .section { padding: 72px 0; }
  .hero-paper, .paper-card { padding: 26px; }
}
