 :root {
  --purple: #32105f;
  --purple-deep: #21083e;
  --pink: #ff3f8f;
  --pink-soft: #ff9dc5;
  --cream: #fff9e9;
  --ink: #5d2948;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: 'Poppins', sans-serif; background: var(--purple-deep); color: white; overflow-x: hidden; }
button { font: inherit; }
.page { min-height: 100svh; width: 100%; display: none; position: relative; overflow: hidden; padding: clamp(24px, 5vw, 70px); }
.page.active { display: flex; animation: pageIn .7s ease both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.eyebrow { font: 500 10px 'DM Mono', monospace; letter-spacing: .22em; text-transform: uppercase; opacity: .75; }
.hero-page { align-items: center; justify-content: space-between; gap: 5vw; background: radial-gradient(ellipse at 75% 50%, #57158b 0%, #391067 44%, #23083f 100%); }
.hero-copy { width: 52%; max-width: 650px; z-index: 2; }
h1, h2 { font-family: 'Playfair Display', serif; font-weight: 500; line-height: 1.08; }
h1 { font-size: clamp(42px, 7vw, 92px); margin: 22px 0; }
h1 em, h2 em { color: var(--pink-soft); font-weight: 500; }
.pink { color: var(--pink); }
.hero-subtitle { max-width: 440px; color: #ead9f7; line-height: 1.9; font-size: clamp(13px, 1.4vw, 16px); }
.primary-btn { border: 0; background: linear-gradient(100deg, #ff4a91, #ff6fa6); color: white; border-radius: 999px; padding: 13px 22px; box-shadow: 0 7px 28px #ff3f8f40; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 32px #ff3f8f70; }
.primary-btn span { margin-left: 14px; }
.tiny-note { color: #c6a7dd; font-size: 10px; margin-top: 22px; }
.heart-stage { width: 42%; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 360px; position: relative; }
.heart-glow { position: absolute; width: min(32vw, 360px); aspect-ratio: 1; background: #ff2588; filter: blur(75px); opacity: .28; border-radius: 50%; }
.big-heart { font-size: clamp(650px, 24vw, 650px); color: var(--pink); line-height: 1; text-shadow: 0 0 18px #ff3f8f, 0 0 55px #ff1685, 0 0 100px #ff1685aa; animation: heartbeat 1.8s ease-in-out infinite; z-index: 1; }
@keyframes heartbeat { 0%,100% { transform: scale(1); } 8% { transform: scale(1.06); } 16% { transform: scale(1); } 24% { transform: scale(1.04); } 32% { transform: scale(1); } }
.love-caption { color: #ff5b9f; letter-spacing: .2em; font: 500 clamp(18px, 2.2vw, 27px) 'DM Mono', monospace; text-shadow: 0 0 18px #ff3f8f88; margin: 8px 0; }
.micro-caption { color: #e5cbe9; font-size: 20px; letter-spacing: .1em; }
.page-count { position: absolute; bottom: 22px; right: 28px; font: 11px 'DM Mono', monospace; opacity: .65; }
.page-count span { opacity: .5; margin: 0 7px; }
.scrapbook-page { color: #66364f; background: #f7dce5; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }
.scrapbook-page::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .4; background-image: radial-gradient(#fff 1px, transparent 1px); background-size: 17px 17px; }
.scrap-heading { text-align: center; z-index: 1; }
.scrap-heading .eyebrow { color: #a66a83; }
.scrap-heading h2, .letter-intro h2 { font-size: clamp(35px, 5vw, 60px); margin: 8px 0 10px; }
.scrap-heading h2 em { color: #c76c8e; }
.scrap-heading p:not(.eyebrow) { font-size: 12px; color: #95657b; }
.photo-collage { position: relative; width: min(760px, 90vw); height: clamp(260px, 44vh, 420px); z-index: 1; }
.polaroid { position: absolute; background: #fffdf8; padding: 9px 9px 28px; width: 27%; box-shadow: 0 10px 28px #783d5526; }
.polaroid img { display: block; width: 100%; height: 100%; object-fit: cover; aspect-ratio: 1 / 1.08; }
.polaroid figcaption { position: absolute; bottom: 8px; left: 5px; right: 5px; text-align: center; color: #966a7b; font: italic 11px 'Playfair Display', serif; }
.photo-placeholder { display: none; aspect-ratio: 1 / 1.08; background: linear-gradient(145deg, #f6e7e6, #d8dce2); color: #986c82; align-items: center; justify-content: center; flex-direction: column; gap: 5px; text-align: center; padding: 8px; }
.photo-placeholder span { font-size: 26px; color: #d76f96; }
.photo-placeholder b { font-size: 11px; font-weight: 500; }
.photo-placeholder small { font: 8px 'DM Mono', monospace; overflow-wrap: anywhere; }
.photo-one { left: 10%; top: 4%; }
.photo-two { right: 10%; top: 2%; }
.photo-three { left: 27%; bottom: 0; width: 25%; }
.photo-four { right: 24%; bottom: 5%; width: 24%; }
.tilt-left { transform: rotate(-8deg); } .tilt-right { transform: rotate(7deg); } .tilt-right-small { transform: rotate(5deg); } .tilt-left-small { transform: rotate(-6deg); }
.tape { position: absolute; width: 65px; height: 20px; background: #d5c49b99; z-index: 3; }
.tape-one { top: 2%; left: 17%; transform: rotate(-28deg); } .tape-two { top: 3%; right: 17%; transform: rotate(25deg); }
.scribble-heart { position: absolute; right: 4%; bottom: 15%; color: #d783a1; font-size: 42px; transform: rotate(15deg); }
.scrap-footer { display: flex; align-items: center; gap: 25px; z-index: 1; flex-wrap: wrap; justify-content: center; }
.scrap-footer p { font: italic 19px 'Playfair Display', serif; margin: 0; color: #9a5c78; }
.scrap-footer p span { color: #bd7894; }
.scrapbook-page .primary-btn { background: #b95d83; box-shadow: 0 7px 20px #b95d8333; }
.relationship-counter { flex: 0 0 100%; width: 100%; margin: 0; text-align: center; color: #9a5c78; font: 500 43px 'DM Mono', monospace; letter-spacing: .03em; }
.letter-page { background: radial-gradient(ellipse at 50% 50%, #fff8d9 0%, #fff3d6 36%, #f2cbd1 72%, #b94362 120%); color: #713d4d; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.letter-intro .eyebrow { color: #a36b79; }
.letter-intro h2 em { color: #a84d6a; }
.letter-intro > p:last-child { color: #a56e7e; font: 13px 'Playfair Display', serif; }
.envelope-button { position: relative; display: block; border: 0; background: transparent; width: min(300px, 76vw); height: 190px; margin: 28px auto 12px; cursor: pointer; perspective: 800px; filter: drop-shadow(0 13px 15px #6e25352c); }
.envelope-back { position: absolute; inset: 20px 0 0; background: #e6c6b7; border: 1px solid #cba597; }
.letter-paper { position: absolute; left: 9%; right: 9%; top: 14px; height: 145px; background: #fffaf0; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 8px; transition: transform .8s ease; color: #87505a; z-index: 1; box-shadow: 0 0 8px #8a4b4b12; }
.letter-heart { color: #b83b55; font-size: 24px; }
.letter-paper strong { font: italic 19px 'Playfair Display', serif; }
.letter-paper small, .letter-hint { font: 10px 'Playfair Display', serif; }
.letter-hint { color: #b76c7b; }
.envelope-flap { position: absolute; top: 20px; left: 0; width: 0; height: 0; border-left: 150px solid transparent; border-right: 150px solid transparent; border-top: 100px solid #f1d8c7; transform-origin: top; transition: transform .6s ease; z-index: 4; }
.envelope-front { position: absolute; inset: 20px 0 0; background: linear-gradient(140deg, transparent 49.5%, #d6b1a5 50%), linear-gradient(220deg, transparent 49.5%, #e4c5b7 50%), linear-gradient(0deg, #e8cabc 0 50%, transparent 50%); z-index: 3; pointer-events: none; }
.seal { position: absolute; top: 83px; left: calc(50% - 17px); width: 34px; height: 34px; display: grid; place-items: center; background: #a92e4b; color: #ffe5e7; border-radius: 50%; z-index: 5; box-shadow: 0 2px 5px #76283b55; }
.envelope-button.opened .envelope-flap { transform: rotateX(180deg); z-index: 0; }
.envelope-button.opened .letter-paper { transform: translateY(-80px); }
.envelope-help { font-size: 11px; color: #a56b7b; }
.letter-modal { position: fixed; inset: 0; z-index: 20; background: #210826c9; display: grid; place-items: center; padding: 18px; overflow-y: auto; }
.letter-modal[hidden] { display: none; }
.letter-modal-card { width: min(600px, 100%); max-height: 92svh; overflow-y: auto; position: relative; padding: clamp(25px, 5vw, 48px); background: #fff9eb; color: #69394e; border: 1px solid #edc7cc; box-shadow: 0 20px 80px #0003; }
.close-modal { position: absolute; top: 12px; right: 15px; border: 0; background: transparent; color: #8d5264; font-size: 30px; cursor: pointer; }
.letter-modal-card h2 { font-size: clamp(28px, 5vw, 42px); color: #9c3e60; }
.letter-message { font: 15px/1.9 'Playfair Display', serif; }
.signature { color: #a64e6e; margin-top: 22px; }
.final-note { padding: 12px; color: #a33d67; background: #ffe4eb; border-radius: 10px; font-family: 'Playfair Display', serif; }
.music-toggle { position: fixed; top: 16px; right: 16px; z-index: 10; border: 1px solid #ffffff40; background: #ffffff18; color: white; border-radius: 999px; padding: 9px 13px; cursor: pointer; backdrop-filter: blur(8px); font-size: 14px; }
.music-toggle span { font-size: 10px; margin-left: 5px; }
.floating-hearts { position: fixed; inset: 0; pointer-events: none; z-index: 9; overflow: hidden; }
.floating-heart { position: absolute; bottom: -40px; color: #ff4d95; opacity: .7; animation: floatUp linear forwards; text-shadow: 0 0 10px #ff3f8f77; }
@keyframes floatUp { to { transform: translateY(-110vh) rotate(25deg); opacity: 0; } }
@media (max-width: 700px) {
  .page { padding: 30px 22px 55px; }
  .hero-page { flex-direction: column; justify-content: center; text-align: center; gap: 8px; }
  .hero-copy { width: 100%; }
  .hero-subtitle { margin-left: auto; margin-right: auto; }
  .heart-stage { width: 100%; min-height: 220px; }
  .big-heart { font-size: clamp(135px, 40vw, 210px); }
  .heart-glow { width: 220px; }
  .scrapbook-page { gap: 8px; }
  .photo-collage { height: 330px; width: 100%; }
  .polaroid { width: 35%; padding: 6px 6px 24px; }
  .photo-one { left: 3%; top: 6%; } .photo-two { right: 3%; top: 5%; }
  .photo-three { left: 19%; bottom: 3%; width: 33%; } .photo-four { right: 10%; bottom: 4%; width: 32%; }
  .tape-one { left: 9%; } .tape-two { right: 9%; }
  .photo-placeholder b { font-size: 9px; } .photo-placeholder small { font-size: 7px; }
  .scrap-footer { gap: 13px; }
  .scrap-footer p { font-size: 16px; }
  .letter-intro h2 { font-size: 42px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}


/* The welcome heart bursts into glowing fragments before the scrapbook page appears. */
.heart-shatter-overlay {
  position: fixed;
  z-index: 50;
  width: 1px;
  height: 1px;
  pointer-events: none;
  filter: drop-shadow(0 0 12px #ff3f8f);
}
.heart-shard {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--size);
  height: calc(var(--size) * 1.25);
  background: var(--shard-color);
  clip-path: polygon(50% 0, 100% 70%, 35% 100%, 0 30%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(.25) rotate(0deg);
  animation: heartShardBurst 720ms cubic-bezier(.15,.7,.25,1) forwards;
}
.big-heart.heart-shattering {
  animation: heartCoreShatter 420ms ease-in forwards !important;
}
@keyframes heartShardBurst {
  0% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.18) rotate(var(--spin)); }
}
@keyframes heartCoreShatter {
  0% { opacity: 1; transform: scale(1); filter: brightness(1.8); }
  45% { opacity: .85; transform: scale(1.08) rotate(-3deg); filter: brightness(2.2); }
  100% { opacity: 0; transform: scale(.12) rotate(16deg); filter: brightness(2.8); }
}
@media (prefers-reduced-motion: reduce) {
  .heart-shard { animation-duration: 1ms; }
  .big-heart.heart-shattering { animation-duration: 1ms !important; }
}


/* Interactive full-size photo preview; original scrapbook layout stays intact. */
.polaroid img { cursor: zoom-in; transition: transform .25s ease, filter .25s ease; }
.polaroid img:hover { filter: saturate(1.08); }
.photo-lightbox[hidden] { display: none; }
.photo-lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(20, 5, 30, .94); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 55px 18px 24px; }
.photo-lightbox img { display: block; max-width: min(92vw, 900px); max-height: 78svh; object-fit: contain; border: 8px solid #fff9eb; border-radius: 3px; box-shadow: 0 20px 70px #0008; }
.photo-lightbox p { margin: 0; color: #ffd8e7; font: italic 20px 'Playfair Display', serif; }
.photo-lightbox-close { position: absolute; top: 12px; right: 20px; border: 0; background: transparent; color: white; font-size: 42px; cursor: pointer; }
@media (max-width: 700px) { .relationship-counter { font-size: clamp(16px, 4vw, 24px); letter-spacing: 0; } }
