/* =========================================================
   Birthday card — "sticker book" theme
   ========================================================= */

:root {
  --cream: #fff7ee;
  --cream-2: #ffeedd;
  --ink: #2b1740;
  --ink-soft: #5b4a6e;
  --pink: #ff4f9a;
  --pink-2: #ff9cc8;
  --pink-3: #ffe0ee;
  --sun: #ffcb3d;
  --sun-2: #fff0b8;
  --sky: #4fc3f7;
  --sky-2: #d9f3ff;
  --mint: #34d399;
  --mint-2: #d5f7ea;
  --grape: #8b5cf6;
  --grape-2: #ebe2ff;
  --peach: #ff9f6b;
  --wa: #25d366;

  --radius: 22px;
  --line: 3px;
  --shadow: 6px 6px 0 var(--ink);
  --shadow-sm: 4px 4px 0 var(--ink);

  --f-display: 'Fredoka', 'Nunito', ui-rounded, system-ui, sans-serif;
  --f-body: 'Nunito', ui-rounded, system-ui, -apple-system, sans-serif;
  --f-hand: 'Caveat', 'Bradley Hand', cursive;

  --gutter: max(18px, env(safe-area-inset-left));
  --vh: 1vh;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--cream);
}

body {
  margin: 0;
  font-family: var(--f-body);
  color: var(--ink);
  background-color: var(--cream);
  background-image:
    radial-gradient(rgba(43, 23, 64, 0.07) 1.4px, transparent 1.5px);
  background-size: 22px 22px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body.is-locked { overflow: hidden; height: 100%; }

/* Slide-in animations start off-screen; never let them widen the page
   (iOS Safari zooms out instead of honouring body overflow-x). */
#card { position: relative; overflow-x: hidden; }
@supports (overflow-x: clip) { #card { overflow-x: clip; } }

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-appearance: none; appearance: none; }
[hidden] { display: none !important; }

/* ---------- shared bits ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 28px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn--sun { background: var(--sun); }
.btn--yes { background: var(--pink); color: #fff; font-size: 1.35rem; padding: 18px 36px; }
.btn--no { background: #fff; font-size: 1rem; padding: 12px 22px; }
.btn--wa { background: var(--wa); color: #fff; width: 100%; }

.round-btn {
  width: 52px; height: 52px;
  border-radius: 50%;
  border: var(--line) solid var(--ink);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: 1.3rem;
  font-weight: 800;
  touch-action: manipulation;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.round-btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 6px 16px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 0.95rem;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.sticker-tag {
  display: inline-block;
  padding: 4px 14px;
  margin-bottom: 14px;
  font-family: var(--f-hand);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  background: var(--pink-2);
  border: 2px solid var(--ink);
  border-radius: 10px;
  transform: rotate(-4deg);
}
.sticker-tag--sky { background: var(--sky); }
.sticker-tag--grape { background: var(--grape-2); }
.sticker-tag--mint { background: var(--mint); }
.sticker-tag--peach { background: var(--peach); }

.section {
  position: relative;
  padding: 88px var(--gutter);
  max-width: 1040px;
  margin: 0 auto;
}

.sec-head { text-align: center; max-width: 560px; margin: 0 auto 40px; }
.sec-title {
  margin: 0 0 10px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2rem, 8.5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sec-sub { margin: 0 0 6px; font-size: 1.05rem; color: var(--ink-soft); font-weight: 700; text-wrap: balance; }

.date-pill {
  display: inline-block;
  padding: 6px 16px;
  margin: 4px 0 8px;
  font-family: var(--f-display);
  font-weight: 600;
  color: var(--ink);
  background: var(--sun);
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-2deg);
}

/* ---------- gate ---------- */

.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--pink);
  overflow: hidden;
  text-align: center;
  color: #fff;
}
.gate__rays {
  position: absolute;
  left: 50%; top: 50%;
  width: 260vmax; height: 260vmax;
  margin: -130vmax 0 0 -130vmax;
  background: repeating-conic-gradient(from 0deg, rgba(255, 255, 255, 0.13) 0deg 10deg, transparent 10deg 20deg);
  animation: spin 40s linear infinite;
}
.gate__inner { position: relative; display: flex; flex-direction: column; align-items: center; }
.gate__title {
  margin: 0 0 8px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 10vw, 3.6rem);
  line-height: 1;
  text-shadow: 4px 4px 0 var(--ink);
  -webkit-text-stroke: 1.5px var(--ink);
}
.gate__sub { margin: 18px 0 22px; font-weight: 800; font-size: 1.05rem; max-width: 300px; }
.gate__cta { animation: pulse 1.6s ease-in-out infinite; }

/* gift box */
.gift {
  position: relative;
  width: 190px; height: 200px;
  margin-top: 26px;
  border: 0; padding: 0; background: none;
  animation: wobble 2.2s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.gift__box {
  position: absolute; left: 10px; right: 10px; bottom: 16px; height: 120px;
  background: var(--sun);
  border: var(--line) solid var(--ink);
  border-radius: 10px;
  box-shadow: inset -14px 0 0 rgba(0, 0, 0, 0.08);
}
.gift__ribbon, .gift__lid::after {
  position: absolute; top: -3px; bottom: -3px; left: 50%;
  width: 30px; margin-left: -15px;
  background: var(--sky);
  border-left: var(--line) solid var(--ink);
  border-right: var(--line) solid var(--ink);
}
.gift__lid {
  position: absolute; left: 0; right: 0; bottom: 130px; height: 44px; z-index: 2;
  background: var(--sun);
  border: var(--line) solid var(--ink);
  border-radius: 10px;
}
.gift__lid::after { content: ''; }
.gift__bow { position: absolute; left: 50%; bottom: 100%; width: 0; height: 0; }
.gift__bow i {
  position: absolute; bottom: -4px;
  width: 46px; height: 34px;
  background: var(--sky);
  border: var(--line) solid var(--ink);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}
.gift__bow i:first-child { right: 0; transform: rotate(-24deg); transform-origin: 100% 100%; }
.gift__bow i:last-child { left: 0; transform: rotate(24deg); transform-origin: 0 100%; }
.gift__shadow {
  position: absolute; bottom: 0; left: 20px; right: 20px; height: 14px;
  background: rgba(43, 23, 64, 0.3); border-radius: 50%;
  filter: blur(2px);
}

/* ---------- chrome ---------- */

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 6px; z-index: 60;
  background: rgba(255, 255, 255, 0.6);
}
.progress span {
  display: block; height: 100%; width: 100%;
  background: linear-gradient(90deg, var(--pink), var(--sun), var(--mint), var(--sky), var(--grape));
  transform: scaleX(0); transform-origin: 0 50%;
}

.music-btn {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 70;
  display: flex; align-items: center; gap: 6px;
  height: 52px; padding: 0 16px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  touch-action: manipulation;
}
.music-btn__icon { font-size: 1.2rem; }
.music-btn__bars { display: flex; align-items: flex-end; gap: 3px; height: 18px; }
.music-btn__bars i { width: 4px; height: 100%; background: var(--pink); border-radius: 2px; transform-origin: bottom; animation: eq 0.9s ease-in-out infinite; }
.music-btn__bars i:nth-child(2) { animation-delay: -0.3s; background: var(--grape); }
.music-btn__bars i:nth-child(3) { animation-delay: -0.6s; background: var(--sky); }
.music-btn__bars i:nth-child(4) { animation-delay: -0.15s; background: var(--mint); }
.music-btn.is-off .music-btn__bars i { animation: none; transform: scaleY(0.2); }

.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.fx-spark {
  position: absolute; left: 0; top: 0;
  font-size: 20px; line-height: 1;
  will-change: transform, opacity;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 90px var(--gutter) 110px;
  overflow: hidden;
  text-align: center;
}
.hero__blobs span {
  position: absolute; border-radius: 50%; filter: blur(50px); opacity: 0.55;
  animation: drift 14s ease-in-out infinite alternate;
}
.hero__blobs span:nth-child(1) { width: 60vmax; height: 60vmax; left: -25vmax; top: -20vmax; background: var(--pink-2); }
.hero__blobs span:nth-child(2) { width: 50vmax; height: 50vmax; right: -22vmax; top: 10vh; background: var(--sun-2); animation-delay: -4s; }
.hero__blobs span:nth-child(3) { width: 45vmax; height: 45vmax; left: 10vw; bottom: -25vmax; background: var(--sky-2); animation-delay: -8s; }

.hero__content { position: relative; z-index: 3; max-width: 760px; pointer-events: none; }
.hero__content .eyebrow { pointer-events: auto; }
.hero__title { margin: 0; font-family: var(--f-display); font-weight: 700; line-height: 0.95; }
.hero__line {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  font-size: clamp(1.6rem, 8vw, 3.4rem);
}
.hero__line .tile {
  display: inline-grid; place-items: center;
  min-width: 1.15em; padding: 0.12em 0.16em 0.18em;
  color: var(--ink);
  border: var(--line) solid var(--ink);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.hero__line .space { width: 100%; height: 0; }
.hero__name {
  display: block;
  margin-top: 14px;
  font-size: clamp(3.6rem, 22vw, 10rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--pink);
  -webkit-text-stroke: 3px var(--ink);
  text-shadow: 6px 6px 0 var(--ink);
  paint-order: stroke fill;
}
.hero__name .nm-word { display: block; white-space: nowrap; }
.hero__name .ch { display: inline-block; }
.hero__sub { margin: 22px auto 0; max-width: 460px; font-size: 1.1rem; font-weight: 800; color: var(--ink-soft); text-wrap: balance; }
.hero__hint { margin: 16px 0 0; font-family: var(--f-hand); font-size: 1.5rem; color: var(--grape); }

.balloons { position: absolute; inset: 0; z-index: 2; }
.balloon {
  position: absolute;
  bottom: -160px;
  width: 64px; height: 80px;
  border: 0; padding: 0; background: none;
  touch-action: manipulation;
}
.balloon__body {
  position: absolute; inset: 0;
  border: var(--line) solid var(--ink);
  border-radius: 50% 50% 48% 52% / 58% 58% 42% 42%;
  background: var(--c, var(--pink));
  box-shadow: inset -8px -6px 0 rgba(0, 0, 0, 0.12);
}
.balloon__body::before {
  content: ''; position: absolute; left: 22%; top: 16%;
  width: 22%; height: 26%; border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  transform: rotate(25deg);
}
.balloon__body::after {
  content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 10px solid var(--ink);
}
.balloon__string {
  position: absolute; left: 50%; top: 100%; width: 2px; height: 70px; margin-left: -1px;
  background: var(--ink); opacity: 0.6; transform-origin: top;
  animation: sway 2s ease-in-out infinite alternate;
}

.scroll-cue {
  position: absolute; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 3;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-family: var(--f-hand); font-size: 1.3rem; font-weight: 700;
}
.scroll-cue i {
  width: 26px; height: 42px; border: var(--line) solid var(--ink); border-radius: 20px; position: relative; background: #fff;
}
.scroll-cue i::after {
  content: ''; position: absolute; left: 50%; top: 7px; width: 6px; height: 9px; margin-left: -3px;
  background: var(--pink); border-radius: 3px; animation: wheel 1.4s ease-in-out infinite;
}

/* ---------- marquee ---------- */

.marquee {
  position: relative; z-index: 4;
  padding: 14px 0;
  border-top: var(--line) solid var(--ink);
  border-bottom: var(--line) solid var(--ink);
  overflow: hidden;
  transform: rotate(-2.5deg) scale(1.06);
  white-space: nowrap;
}
.marquee--pink { background: var(--pink); color: #fff; }
.marquee--sun { background: var(--sun); transform: rotate(2deg) scale(1.06); }
.marquee__track { display: inline-flex; will-change: transform; }
.marquee__track span {
  padding: 0 18px;
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ---------- stats ---------- */

.stats-sec { padding-top: 96px; padding-bottom: 40px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; max-width: 820px; margin: 0 auto; }
.stat {
  padding: 22px 16px 18px;
  text-align: center;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stat:nth-child(4n+1) { background: var(--pink-3); transform: rotate(-2deg); }
.stat:nth-child(4n+2) { background: var(--sun-2); transform: rotate(1.5deg); }
.stat:nth-child(4n+3) { background: var(--sky-2); transform: rotate(-1deg); }
.stat:nth-child(4n+4) { background: var(--mint-2); transform: rotate(2deg); }
.stat__num { font-family: var(--f-display); font-weight: 700; font-size: clamp(2.4rem, 11vw, 3.4rem); line-height: 1; }
.stat__label { margin-top: 6px; font-weight: 800; font-size: 0.95rem; color: var(--ink-soft); }

/* ---------- cake ---------- */

.cake-stage { display: grid; place-items: center; padding: 70px 0 10px; }
.cake { position: relative; width: 280px; max-width: 86vw; }
.cake__candles {
  position: absolute; left: 12%; right: 12%; bottom: calc(100% - 2px); z-index: 3;
  display: flex; justify-content: space-around; align-items: flex-end;
}
.candle {
  position: relative;
  width: 22px; height: 64px;
  border: var(--line) solid var(--ink);
  border-radius: 6px 6px 2px 2px;
  background: repeating-linear-gradient(-45deg, #fff 0 7px, var(--pink-2) 7px 14px);
  padding: 0;
  touch-action: manipulation;
}
.candle::before { /* bigger tap target */
  content: ''; position: absolute; left: -14px; right: -14px; top: -60px; bottom: -6px;
}
.candle__wick { position: absolute; left: 50%; bottom: 100%; width: 3px; height: 9px; margin-left: -1.5px; background: var(--ink); }
.candle__flame {
  position: absolute; left: 50%; bottom: calc(100% + 6px);
  width: 20px; height: 32px; margin-left: -10px;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 50% 72%, #fff 0 18%, var(--sun) 30%, #ff8a3d 70%);
  box-shadow: 0 0 18px 6px rgba(255, 190, 70, 0.55);
  transform-origin: 50% 90%;
  animation: flicker 0.18s ease-in-out infinite alternate;
}
.candle.is-out .candle__flame { animation: none; opacity: 0; transform: scale(0.1); transition: 0.3s ease; }
.candle__smoke {
  position: absolute; left: 50%; bottom: calc(100% + 8px);
  width: 10px; height: 10px; margin-left: -5px;
  border-radius: 50%; background: rgba(120, 110, 130, 0.5);
  opacity: 0;
}
.candle.is-out .candle__smoke { animation: smoke 1.4s ease-out forwards; }

.cake__tier {
  position: relative;
  border: var(--line) solid var(--ink);
  border-radius: 18px 18px 10px 10px;
}
.cake__tier--top {
  height: 76px; margin: 0 9%;
  background: var(--pink-2);
  z-index: 2;
}
.cake__tier--bottom {
  height: 104px; margin-top: -3px;
  background: var(--grape-2);
  z-index: 1;
}
.drip {
  position: absolute; left: -3px; right: -3px; top: -3px; height: 34px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 18px 18px 0 0;
  border-bottom: 0;
  -webkit-mask: radial-gradient(circle at 12px 100%, transparent 11px, #000 12px) 0 0 / 24px 100%;
  mask: radial-gradient(circle at 12px 100%, transparent 11px, #000 12px) 0 0 / 24px 100%;
}
.sprinkles {
  position: absolute; inset: 14px 12px;
  background-image:
    radial-gradient(circle, var(--pink) 3px, transparent 3.5px),
    radial-gradient(circle, var(--sky) 3px, transparent 3.5px),
    radial-gradient(circle, var(--sun) 3px, transparent 3.5px),
    radial-gradient(circle, var(--mint) 3px, transparent 3.5px);
  background-size: 46px 34px, 52px 40px, 38px 44px, 60px 30px;
  background-position: 0 0, 18px 12px, 9px 22px, 30px 5px;
}
.cake__plate {
  height: 18px; margin: -3px -8% 0;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}
.cake-done {
  max-width: 420px; margin: 34px auto 0; padding: 18px 20px;
  text-align: center; font-weight: 800; font-size: 1.1rem;
  background: var(--sun-2);
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cake-done p { margin: 0; }

/* ---------- memories (swipe deck) ---------- */

.deck {
  position: relative;
  width: min(330px, 82vw);
  aspect-ratio: 4 / 5;
  margin: 20px auto 0;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}
@supports not (aspect-ratio: 1) { .deck { height: 420px; } }
.polaroid {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  padding: 12px 12px 0;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  will-change: transform;
  cursor: grab;
}
.polaroid:active { cursor: grabbing; }
.polaroid__img {
  flex: 1; min-height: 0;
  border: 2px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
  background: var(--cream-2);
}
.polaroid__img img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.polaroid__cap {
  min-height: 66px;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  padding: 6px 4px 10px;
  text-align: center;
  font-family: var(--f-hand);
  font-size: 1.55rem;
  line-height: 1.05;
}
.polaroid__date { font-family: var(--f-body); font-size: 0.78rem; font-weight: 800; color: var(--ink-soft); margin-top: 3px; letter-spacing: 0.04em; }
.polaroid__tape {
  position: absolute; top: -14px; left: 50%; width: 92px; height: 28px; margin-left: -46px;
  background: rgba(255, 203, 61, 0.75);
  border: 2px solid rgba(43, 23, 64, 0.25);
  transform: rotate(-4deg);
}
.polaroid--empty .polaroid__img {
  display: grid; place-items: center;
  font-size: 4.5rem;
  background: linear-gradient(135deg, var(--pink-3), var(--sky-2));
}

.deck-ctrl { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 34px; }
.deck-count { font-family: var(--f-display); font-weight: 600; font-size: 1.2rem; min-width: 70px; text-align: center; }

.film { margin: 64px calc(var(--gutter) * -1) 0; display: grid; gap: 14px; }
.film__row { overflow: hidden; }
.film__track { display: inline-flex; gap: 14px; will-change: transform; }
.film__item {
  flex: 0 0 auto;
  width: 132px; height: 132px;
  padding: 0;
  border: var(--line) solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.film__item:nth-child(odd) { transform: rotate(-3deg); }
.film__item:nth-child(even) { transform: rotate(2.5deg); }
.film__item img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- memes ---------- */

.memes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px;
  max-width: 960px;
  margin: 0 auto;
}
.meme {
  margin: 0;
  padding: 12px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.meme:nth-child(3n+1) { --tilt: -2.5deg; background: var(--pink-3); }
.meme:nth-child(3n+2) { --tilt: 2deg; background: var(--sky-2); }
.meme:nth-child(3n+3) { --tilt: -1deg; background: var(--sun-2); }
.meme__img {
  border: 2px solid var(--ink);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  aspect-ratio: 4 / 3;
}
.meme__img img { width: 100%; height: 100%; object-fit: cover; }
.meme figcaption {
  padding: 12px 6px 4px;
  font-family: var(--f-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.25;
  text-align: center;
}

/* ---------- letter ---------- */

.envelope {
  position: relative;
  width: min(340px, 86vw);
  height: 230px;
  margin: 130px auto 0;
  cursor: pointer;
  outline: none;
  perspective: 1200px;
  -webkit-perspective: 1200px;
}
.envelope__back, .envelope__front, .envelope__flap {
  position: absolute; left: 0; right: 0;
  border: var(--line) solid var(--ink);
}
.envelope__back { inset: 0; background: #ff7fb4; border-radius: 12px; box-shadow: var(--shadow); }
.envelope__front {
  inset: 0; z-index: 3;
  border-radius: 12px;
  background:
    linear-gradient(to top right, var(--pink) 49.6%, transparent 50%) left / 50.5% 100% no-repeat,
    linear-gradient(to top left, #ff6aa8 49.6%, transparent 50%) right / 50.5% 100% no-repeat;
  border-color: transparent;
  pointer-events: none;
}
.envelope__flap {
  top: 0; height: 60%; z-index: 4;
  border: 0;
  background: none;
  transform-origin: 50% 0;
  -webkit-transform-origin: 50% 0;
  transform-style: preserve-3d;
}
.envelope__flap::before {
  content: ''; position: absolute; inset: 0;
  background: #ff86ba;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 100%);
  filter: drop-shadow(0 3px 0 var(--ink));
  -webkit-filter: drop-shadow(0 3px 0 var(--ink));
}
.envelope__seal {
  position: absolute; left: 50%; top: 52%; z-index: 5;
  width: 58px; height: 58px; margin: -29px 0 0 -29px;
  display: grid; place-items: center;
  font-size: 1.6rem;
  background: var(--sun);
  border: var(--line) solid var(--ink);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  animation: pulse 1.6s ease-in-out infinite;
}
.letter {
  position: absolute; left: 6%; right: 6%; top: 8px; bottom: 8px; z-index: 2;
  padding: 22px 20px 26px;
  background: #fffdf8;
  border: var(--line) solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
}
.envelope.is-open { cursor: default; height: auto; width: min(560px, 100%); }
.envelope.is-open .envelope__back,
.envelope.is-open .envelope__front,
.envelope.is-open .envelope__flap,
.envelope.is-open .envelope__seal { display: none; }
.envelope.is-open .letter {
  position: relative; left: auto; right: auto; top: auto; bottom: auto;
  padding: 26px 22px 30px;
  box-shadow: var(--shadow);
  transform: none;
}
.letter__gif { width: 132px; height: 100px; object-fit: cover; margin: 0 auto 16px; border: 2px solid var(--ink); border-radius: 12px; }
/* Long paragraphs in a plain rounded font: handwriting is hard to read on phones. */
.letter__body {
  font-family: var(--f-body);
  font-size: 1.06rem;
  font-weight: 600;
  line-height: 1.75;
  text-align: left;
  color: var(--ink);
  overflow-wrap: break-word;
}
.letter__body p { margin: 0 0 1em; }
.letter__body p:first-child {
  font-family: var(--f-hand);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--pink);
}
.letter__body p:last-child { margin-bottom: 0; }
.letter__sign { margin: 22px 0 0; text-align: right; font-family: var(--f-hand); font-weight: 700; font-size: 1.8rem; line-height: 1.2; color: var(--pink); }

/* ---------- reasons (flip cards) ---------- */

.reasons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  max-width: 820px;
  margin: 0 auto;
}
@media (min-width: 720px) { .reasons { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; } }
.flip {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 0; padding: 0; background: none;
  perspective: 900px;
  -webkit-perspective: 900px;
  touch-action: manipulation;
}
@supports not (aspect-ratio: 1) { .flip { height: 200px; } }
.flip__inner {
  position: absolute; inset: 0;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flip.is-flipped .flip__inner { transform: rotateY(180deg); }
.flip__face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 14px;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip__front {
  background: var(--c, var(--pink));
  color: var(--ink);
  font-family: var(--f-display);
  font-weight: 700;
}
.flip__front b { font-size: 2.8rem; line-height: 1; }
.flip__front small { font-size: 0.85rem; font-weight: 600; opacity: 0.8; }
.flip__back {
  transform: rotateY(180deg);
  background: #fff;
  text-align: center;
}
.flip__back span { font-size: 2rem; }
.flip__back p { margin: 0; font-weight: 800; font-size: 1rem; line-height: 1.3; }

/* ---------- scratch ---------- */

.scratch {
  position: relative;
  width: min(360px, 88vw);
  aspect-ratio: 16 / 11;
  margin: 0 auto;
  border: var(--line) solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  background: #fff;
}
@supports not (aspect-ratio: 1) { .scratch { height: 240px; } }
.scratch__under {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  padding: 20px;
  text-align: center;
  background: radial-gradient(circle at 50% 40%, #fff 0, var(--pink-3) 70%);
}
.scratch__emoji { font-size: 3rem; line-height: 1; }
.scratch__under p { margin: 0; font-family: var(--f-display); font-weight: 700; font-size: 1.4rem; line-height: 1.2; text-wrap: balance; }
.scratch__canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.scratch.is-done .scratch__canvas { transition: opacity 0.6s ease; opacity: 0; pointer-events: none; }

/* ---------- programme ---------- */

.timeline {
  position: relative;
  list-style: none;
  margin: 0 auto;
  padding: 0 0 0 56px;
  max-width: 560px;
}
.timeline__path { position: absolute; left: 0; top: 0; width: 56px; height: 100%; overflow: visible; }
.timeline__path path { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 2 10; }
.tl-item { position: relative; padding-bottom: 26px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item__dot {
  position: absolute; left: -56px; top: 8px;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 1.4rem;
  background: var(--c, var(--sun));
  border: var(--line) solid var(--ink);
  border-radius: 50%;
  box-shadow: 3px 3px 0 var(--ink);
}
.tl-item__card {
  padding: 16px 18px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.tl-item__time {
  display: inline-block; margin-bottom: 4px; padding: 2px 10px;
  font-family: var(--f-display); font-weight: 600; font-size: 0.9rem;
  background: var(--c, var(--sun)); border: 2px solid var(--ink); border-radius: 999px;
}
.tl-item__title { margin: 2px 0 2px; font-family: var(--f-display); font-weight: 700; font-size: 1.3rem; line-height: 1.2; }
.tl-item__desc { margin: 0; font-weight: 700; color: var(--ink-soft); }
.tl-item__place { margin: 6px 0 0; font-weight: 800; font-size: 0.92rem; }
.tl-item__place a { color: var(--grape); }

/* ---------- rsvp ---------- */

.rsvp-sec { padding-bottom: 120px; }
.rsvp {
  position: relative;
  max-width: 520px;
  margin: 30px auto 0;
  padding: 26px 20px 30px;
  text-align: center;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
}
.rsvp::before {
  content: '💌'; position: absolute; top: -30px; right: -6px;
  font-size: 3rem; transform: rotate(14deg);
  animation: bob 2.4s ease-in-out infinite;
}
.rsvp__waiting { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 12px; font-family: var(--f-hand); font-size: 1.35rem; }
.rsvp__waiting img { width: 160px; height: 130px; object-fit: cover; border: 2px solid var(--ink); border-radius: 14px; transform: rotate(-3deg); }
.rsvp__q { margin: 6px 0 22px; font-family: var(--f-display); font-weight: 700; font-size: clamp(1.7rem, 7.5vw, 2.3rem); line-height: 1.1; text-wrap: balance; }
.rsvp__field { margin: 0 0 18px; text-align: left; }
.rsvp__label { display: block; margin: 0 0 8px; font-family: var(--f-display); font-weight: 600; font-size: 1.05rem; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  font-weight: 800; font-size: 0.95rem;
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 999px;
  touch-action: manipulation;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.chip[aria-checked='true'] { background: var(--pink); color: #fff; box-shadow: 3px 3px 0 var(--ink); transform: translate(-2px, -2px); }
.rsvp textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit; font-size: 16px; font-weight: 700;
  color: var(--ink);
  background: var(--cream);
  border: 2px solid var(--ink);
  border-radius: 14px;
  resize: vertical;
  -webkit-appearance: none;
}
.rsvp textarea:focus { outline: 3px solid var(--pink-2); outline-offset: 1px; }
.rsvp__actions {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 16px;
  margin-top: 26px;
  min-height: 80px;
}
.btn--yes { animation: pulse 1.4s ease-in-out infinite; }
.btn--no.is-runaway { position: absolute; z-index: 5; transition: left 0.25s ease, top 0.25s ease; }
.rsvp__tease { min-height: 1.6em; margin: 14px 0 0; font-family: var(--f-hand); font-size: 1.45rem; color: var(--grape); }

/* ---------- footer ---------- */

.footer { padding: 40px var(--gutter) max(110px, calc(80px + env(safe-area-inset-bottom))); text-align: center; font-weight: 800; color: var(--ink-soft); }
.footer p { margin: 0; }
.footer__heart { font-size: 2rem; margin-top: 8px !important; animation: beat 1.2s ease-in-out infinite; }

/* ---------- lightbox / success ---------- */

.lightbox, .success {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 24px;
  background: rgba(43, 23, 64, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.lightbox figure {
  margin: 0; max-width: min(520px, 100%);
  padding: 12px 12px 4px;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.lightbox img { max-height: 70vh; max-height: 70svh; margin: 0 auto; border-radius: 4px; }
.lightbox figcaption { padding: 10px 4px; text-align: center; font-family: var(--f-hand); font-size: 1.6rem; line-height: 1.1; }
.lightbox__close {
  position: absolute; top: max(16px, env(safe-area-inset-top)); right: 16px;
  width: 48px; height: 48px;
  background: #fff; border: var(--line) solid var(--ink); border-radius: 50%;
  font-weight: 800; font-size: 1.1rem;
}

.success { z-index: 95; background: rgba(255, 79, 154, 0.88); }
.success__card {
  width: min(400px, 100%);
  padding: 22px 20px 20px;
  text-align: center;
  background: #fff;
  border: var(--line) solid var(--ink);
  border-radius: 28px;
  box-shadow: 8px 8px 0 var(--ink);
}
.success__card img { width: 100%; max-height: 210px; object-fit: cover; border: 2px solid var(--ink); border-radius: 16px; }
.success__card h2 { margin: 16px 0 4px; font-family: var(--f-display); font-weight: 700; font-size: 2rem; line-height: 1.1; }
.success__card p { margin: 0 0 18px; font-weight: 800; color: var(--ink-soft); }
.success__count { margin: 12px 0 0 !important; font-size: 0.9rem; }

/* ---------- keyframes ---------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } }
@keyframes wobble {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(-7deg) translateY(-6px); }
  20% { transform: rotate(6deg); }
  30% { transform: rotate(-4deg) translateY(-3px); }
  40% { transform: rotate(2deg); }
  50% { transform: rotate(0); }
}
@keyframes drift { to { transform: translate(6vw, 4vh) scale(1.12); } }
@keyframes sway { from { transform: rotate(-8deg); } to { transform: rotate(8deg); } }
@keyframes wheel { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }
@keyframes eq { 0%, 100% { transform: scaleY(0.3); } 50% { transform: scaleY(1); } }
@keyframes flicker { from { transform: scale(1, 1) rotate(-3deg); } to { transform: scale(0.92, 1.08) rotate(3deg); } }
@keyframes smoke { 0% { opacity: 0.8; transform: translateY(0) scale(1); } 100% { opacity: 0; transform: translateY(-60px) scale(3); } }
@keyframes bob { 0%, 100% { transform: rotate(14deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-8px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
