/* ══════════ Rasmalai · base ══════════ */
:root {
  color-scheme: only light;
  --pink-50:  #fff3f8;
  --pink-100: #ffe3ef;
  --pink-200: #ffd6e7;
  --pink-300: #ffb8d4;
  --pink-400: #ff8fb8;
  --rose:     #d6336c;
  --rose-dark:#a61e4d;
  --ink:      #5a2a3c;
  --ink-soft: #8a5468;
  --paper:    #fffdfa;
  --gold:     #f5a623;
  --shadow:   0 10px 30px rgba(214, 51, 108, .14);
  --serif: "Georgia", "Times New Roman", serif;
  --script: "Snell Roundhand", "Savoye LET", "Brush Script MT", "Segoe Script", cursive;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink);
  background: linear-gradient(160deg, var(--pink-100), var(--pink-200) 40%, #ffe9f2 70%, var(--pink-100));
  background-size: 100% 400%;
  animation: bg-drift 18s ease-in-out infinite alternate;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
@keyframes bg-drift {
  from { background-position: 0% 0%; }
  to   { background-position: 0% 100%; }
}

/* hearts canvas sits behind everything */
#hearts {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

main { position: relative; z-index: 2; }

/* ══════════ Entrance gate ══════════ */
#gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #ffd6e7, #ffc2db 50%, #ffe3ef);
  cursor: pointer;
  transition: opacity .9s ease, visibility .9s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
#gate.gone { opacity: 0; visibility: hidden; }

.gate-inner { text-align: center; padding: 0 1.2rem; }
.gate-tease {
  font-size: clamp(.82rem, 3.6vw, .95rem);
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  line-height: 1.3;
  margin-bottom: 2.4rem;
  transition: opacity .6s ease;
}
.gate-tease-sub {
  font-family: var(--script);
  font-size: clamp(1.35rem, 5.6vw, 1.8rem);
  font-weight: 400;
  color: var(--rose);
  margin-top: 6.4rem;
  transition: opacity .6s ease;
}
/* fade the top text away the moment the envelope is tapped */
body.opened .gate-tease,
body.opened .gate-tease-sub { opacity: 0; }
.gate-hint {
  margin-top: 1.8rem;
  font-size: .85rem;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--ink-soft);
  animation: hint-pulse 1.6s ease-in-out infinite;
}
@keyframes hint-pulse { 50% { opacity: .35; } }

/* envelope */
.envelope {
  position: relative;
  width: 290px;
  height: 190px;
  margin: 0 auto;
  filter: drop-shadow(0 24px 36px rgba(166, 30, 77, .28)) drop-shadow(0 4px 10px rgba(166, 30, 77, .12));
  animation: env-bob 3.2s ease-in-out infinite;
  transition: transform .25s ease;
}
#gate:active .envelope { transform: scale(.97); }
@keyframes env-bob { 50% { transform: translateY(-8px); } }

.envelope > div { position: absolute; }
.env-back {
  inset: 0;
  background: linear-gradient(180deg, #ffffff, #faf6f8);
  border-radius: 14px;
  z-index: 1;
}
.env-letter {
  left: 14px; right: 14px; top: 45%;
  height: 54%;
  background: linear-gradient(180deg, #ffeaf3, #ffdcea);
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -2px 8px rgba(214, 51, 108, .08);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12px;
  font-family: var(--script);
  font-size: 1.4rem;
  color: var(--rose);
  transition: transform 1.3s cubic-bezier(.2,.7,.3,1.15) .55s;
  z-index: 2;
}
/* left + right pocket folds */
.env-sides { inset: 0; z-index: 3; }
.env-sides::before, .env-sides::after {
  content: "";
  position: absolute;
  inset: 0;
}
.env-sides::before {
  clip-path: polygon(0 10%, 50% 54%, 0 100%);
  background: linear-gradient(100deg, #ffffff 30%, #f2ebef 90%);
  border-radius: 0 0 0 14px;
}
.env-sides::after {
  clip-path: polygon(100% 10%, 50% 54%, 100% 100%);
  background: linear-gradient(260deg, #ffffff 30%, #f2ebef 90%);
  border-radius: 0 0 14px 0;
}
/* bottom fold */
.env-front {
  inset: 0;
  clip-path: polygon(-1% 101%, 50% 46%, 101% 101%);
  background: linear-gradient(180deg, #fbf7f9, #efe8ec);
  border-radius: 0 0 14px 14px;
  z-index: 4;
}
/* top flap */
.env-flap {
  left: 0; right: 0; top: 0;
  height: 56%;
  background: linear-gradient(180deg, #ffffff 35%, #f0e8ec);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: 14px 14px 0 0;
  transform-origin: top center;
  transition: transform 1s cubic-bezier(.6,0,.4,1);
  z-index: 5;
}
/* wax seal */
.env-seal {
  left: 50%; top: 54%;
  transform: translate(-50%, -50%) rotate(-4deg);
  width: 62px; height: 62px;
  background: radial-gradient(circle at 32% 28%, #ff8ab5, #e0417a 55%, #c02a5f 100%);
  border-radius: 46% 54% 50% 50% / 52% 48% 52% 48%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(140, 20, 60, .5);
  box-shadow:
    0 5px 12px rgba(166, 30, 77, .4),
    inset 0 2px 4px rgba(255, 255, 255, .4),
    inset 0 -4px 8px rgba(140, 20, 60, .45);
  z-index: 7;
  transition: transform .5s, opacity .5s;
  animation: seal-pulse 2.8s ease-in-out infinite;
}
.env-seal::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, .28);
  border-bottom-color: rgba(140, 20, 60, .3);
}
@keyframes seal-pulse {
  50% { transform: translate(-50%, -50%) rotate(-4deg) scale(1.06); }
}
.envelope.open .env-flap { transform: rotateX(180deg); z-index: 1; }
.envelope.open .env-seal { transform: translate(-50%, -50%) scale(0); opacity: 0; animation: none; }
.envelope.open .env-letter { transform: translateY(-124px); }
.envelope.open { animation: none; }

.hidden-before-open { visibility: hidden; }
body.opened .hidden-before-open { visibility: visible; }

/* ══════════ Music button ══════════ */
#music-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 1.5rem;
  color: var(--rose);
  display: none;
  align-items: center;
  justify-content: center;
  gap: 2px;
  -webkit-tap-highlight-color: transparent;
}
body.opened #music-btn { display: flex; }
#music-btn .mb-note { font-size: 1rem; transition: opacity .3s; }
#music-btn[aria-pressed="true"] .mb-heart { animation: soft-pulse 2.4s ease-in-out infinite; }
#music-btn[aria-pressed="false"] { opacity: .75; }
#music-btn[aria-pressed="false"] .mb-note { opacity: .25; }

@keyframes soft-pulse {
  50% { transform: scale(1.08); }
}

/* ══════════ Sections ══════════ */
.section {
  max-width: 640px;
  margin: 0 auto;
  padding: 4.5rem 1.4rem;
}
.section.wide { max-width: 1050px; }

h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 5.5vw, 2.3rem);
  text-align: center;
  color: var(--rose-dark);
  margin-bottom: .5rem;
}
.section-sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: .95rem;
  margin-bottom: 2.4rem;
}

/* scroll reveals */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2,.65,.3,1);
}
.reveal.visible { opacity: 1; transform: none; }

/* ══════════ Hero ══════════ */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.2rem 3rem;
  position: relative;
}
.hero-top {
  font-size: 1rem;
  color: var(--ink-soft);
  letter-spacing: .04em;
  margin-bottom: 1rem;
}
.hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 6.2vw, 3rem);
  color: var(--rose-dark);
  font-weight: 600;
  white-space: nowrap;
}
.hero h1 .num { color: var(--rose); }
.hero-name {
  font-family: var(--script);
  font-size: clamp(4rem, 18vw, 8.5rem);
  line-height: 1.15;
  color: var(--rose);
  text-shadow: 0 8px 30px rgba(214, 51, 108, .25);
  margin: .5rem 0 .8rem;
  animation: name-glow 3.5s ease-in-out infinite;
}
@keyframes name-glow {
  50% { text-shadow: 0 8px 45px rgba(214, 51, 108, .5); }
}
.hero-sub { color: var(--ink-soft); font-size: .95rem; max-width: 30ch; margin: 0 auto; }

.scroll-cue {
  position: absolute;
  bottom: max(2rem, env(safe-area-inset-bottom));
  left: 50%;
  translate: -50% 0;
  color: var(--ink-soft);
  font-size: .8rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-align: center;
}
.chevron {
  font-size: 1.6rem;
  line-height: 1;
  animation: cue-bounce 1.6s ease-in-out infinite;
}
@keyframes cue-bounce { 50% { transform: translateY(7px); } }

/* ══════════ Hinge / chat ══════════ */
.hinge-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 1.6rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}
.hinge-label {
  font-size: .72rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #9b6a7d;
  margin-bottom: .55rem;
}
.hinge-prompt {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1.45;
  color: #3d1f2c;
}

.chat { display: flex; flex-direction: column; gap: .55rem; margin-bottom: 2.2rem; }
.bubble {
  max-width: 82%;
  padding: .8rem 1.05rem;
  border-radius: 20px;
  font-size: .98rem;
  line-height: 1.45;
  box-shadow: 0 3px 10px rgba(90, 42, 60, .07);
}
.bubble.me {
  align-self: flex-end;
  background: linear-gradient(135deg, #83355c, #6b2a52);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.bubble.her {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border-bottom-left-radius: 6px;
}
.chat-caption {
  text-align: center;
  font-family: var(--script);
  font-size: 1.35rem;
  color: var(--rose);
  margin-top: .7rem;
}
.aside {
  text-align: center;
  font-family: var(--script);
  font-size: 1.6rem;
  color: var(--rose);
}

/* ══════════ Letter ══════════ */
.letter-card {
  background: var(--paper);
  border-radius: 8px;
  padding: 2.2rem 1.7rem;
  box-shadow: var(--shadow);
  border-top: 6px solid var(--pink-300);
  background-image: repeating-linear-gradient(
    transparent, transparent 1.9rem, rgba(255, 143, 184, .16) 1.9rem, rgba(255, 143, 184, .16) calc(1.9rem + 1px)
  );
}
.letter-card p { margin-bottom: 1.15rem; line-height: 1.9; font-size: 1rem; }
.letter-hi { font-family: var(--script); font-size: 2rem; color: var(--rose); }
.letter-sign { font-family: var(--script); font-size: 1.7rem; color: var(--rose); text-align: right; margin-bottom: 0 !important; }

/* ══════════ Polaroid gallery ══════════ */
.polaroids {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.1rem;
}
@media (min-width: 700px) {
  .polaroids { gap: 1.6rem; }
}
.polaroid {
  background: #fff;
  min-width: 0;
  padding: .55rem .55rem 0;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(90, 42, 60, .15);
  cursor: zoom-in;
  transition: transform .35s ease, box-shadow .35s ease, opacity .8s ease;
}
.polaroid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
  border-radius: 2px;
  background: var(--pink-100);
}
.polaroid figcaption {
  font-family: var(--script);
  font-size: 1.02rem;
  color: var(--ink);
  text-align: center;
  padding: .5rem .1rem .6rem;
  line-height: 1.25;
}
@media (min-width: 700px) {
  .polaroid figcaption { font-size: 1.12rem; }
}
.polaroid:nth-child(4n+1) { transform: rotate(-2.2deg); }
.polaroid:nth-child(4n+2) { transform: rotate(1.6deg); }
.polaroid:nth-child(4n+3) { transform: rotate(-1.2deg); }
.polaroid:nth-child(4n+4) { transform: rotate(2.4deg); }
.polaroid:hover { transform: rotate(0) scale(1.04); box-shadow: 0 14px 34px rgba(214, 51, 108, .28); z-index: 3; }
.polaroid.reveal { opacity: 0; }
.polaroid.reveal.visible { opacity: 1; }

/* ══════════ Reviews ══════════ */
.rating { text-align: center; margin-bottom: 2rem; }
.stars { font-size: 2.2rem; letter-spacing: .1em; line-height: 1; }
.star { color: var(--gold); text-shadow: 0 2px 10px rgba(245, 166, 35, .5); }
.star.extra { animation: star-glow 1.4s ease-in-out infinite alternate; }
.star.partial {
  background: linear-gradient(90deg, var(--gold) 88%, #e8d7be 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}
@keyframes star-glow {
  from { filter: brightness(1); }
  to   { filter: brightness(1.45) drop-shadow(0 0 6px rgba(245,166,35,.8)); }
}
.rating-num { font-size: 1.5rem; margin-top: .4rem; }
.rating-num strong { color: var(--rose); font-size: 2rem; }
.rating-note { color: var(--ink-soft); font-size: .88rem; margin-top: .2rem; }

.review-card {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1.5rem 1.5rem 1.3rem;
  margin-bottom: 1.2rem;
}
.review-stars { color: var(--gold); font-size: 1.15rem; margin-bottom: .6rem; }
.review-stars .star-part {
  font-style: normal;
  background: linear-gradient(90deg, var(--gold) 88%, #ecdcc3 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.review-stars span { color: var(--ink-soft); font-size: .85rem; margin-left: .4rem; }
.review-text {
  font-family: var(--serif);
  font-size: 1.35rem;
  color: #3d1f2c;
  line-height: 1.4;
  margin-bottom: .7rem;
}
.review-by { color: var(--ink-soft); font-size: .88rem; }

.evidence-title {
  text-align: center;
  font-family: var(--script);
  font-size: 1.5rem;
  color: var(--rose);
  margin: 2.2rem 0 1.2rem;
}
.evidence {
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  flex-wrap: wrap;
}
.evidence .polaroid { width: min(44%, 220px); }
.evidence .polaroid:first-child { transform: rotate(-3deg); }
.evidence .polaroid:last-child  { transform: rotate(2.5deg); }

/* ══════════ Finale ══════════ */
#finale { text-align: center; padding-bottom: 5.5rem; }
.big-heart {
  font-size: clamp(6rem, 28vw, 10rem);
  color: var(--rose);
  line-height: 1;
  cursor: pointer;
  user-select: none;
  animation: heart-glow 3.5s ease-in-out infinite alternate;
  text-shadow: 0 14px 50px rgba(214, 51, 108, .4);
  -webkit-tap-highlight-color: transparent;
  transition: transform .25s ease;
}
.big-heart:active { transform: scale(1.08); }
@keyframes heart-glow {
  from { text-shadow: 0 14px 40px rgba(214, 51, 108, .3); }
  to   { text-shadow: 0 14px 70px rgba(214, 51, 108, .65); }
}
.finale-line {
  margin-top: 1.2rem;
  white-space: nowrap;
  font-size: clamp(1.3rem, 5.6vw, 2.2rem);
}

/* ══════════ Footer ══════════ */
footer {
  text-align: center;
  padding: 3rem 1.5rem calc(3.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(255, 143, 184, .25));
}
.foot-main {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--rose-dark);
  max-width: 44ch;
  margin: 0 auto .8rem;
  line-height: 1.6;
}
.foot-sub { color: var(--ink-soft); font-size: .82rem; }

/* ══════════ Lightbox ══════════ */
#lightbox[hidden] { display: none; }
#lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(61, 15, 33, .9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
#lightbox img {
  max-width: 94vw;
  max-height: 88vh;
  border-radius: 8px;
  box-shadow: 0 20px 80px rgba(0,0,0,.5);
  background: #fff;
  padding: 6px;
}
.lb-close {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  right: 18px;
  color: #fff;
  font-size: 1.6rem;
  opacity: .8;
}

/* ══════════ Reduced motion ══════════ */
@media (prefers-reduced-motion: reduce) {
  body, .envelope, .gate-hint, .chevron, .hero-name, .big-heart, .env-seal,
  #music-btn[aria-pressed="true"] .mb-heart, .star.extra { animation: none !important; }
  .big-heart:active { transform: none; }
  .reveal { transition: opacity .4s ease; transform: none; }
  html { scroll-behavior: auto; }
}
