/* ---------- Palette & tokens ---------- */
:root {
  color-scheme: light;
  --cream: #fff6f1;
  --cream-2: #fdeee9;
  --blush: #fadbe2;
  --rose: #f2a7bb;
  --rose-deep: #b4577a;      /* accessible text accent */
  --lavender: #dccdf4;
  --lavender-deep: #b9a2e6;
  --peach: #fde0cf;
  --peach-deep: #f7b89a;
  --ink: #4b3445;            /* soft plum, not black */
  --ink-soft: #7a6072;
  --paper: #fffdfb;
  --shadow: 0 18px 40px -18px rgba(180, 87, 122, .35), 0 4px 12px -4px rgba(75, 52, 69, .12);

  --font-display: 'Fredoka', ui-rounded, system-ui, sans-serif;
  --font-script: 'Caveat', 'Segoe Print', cursive;
  --font-body: 'DM Sans', system-ui, -apple-system, sans-serif;

  --gutter: clamp(16px, 5vw, 48px);
  --maxw: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.65;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 110% -10%, var(--lavender) 0%, transparent 60%),
    radial-gradient(900px 600px at -20% 20%, var(--peach) 0%, transparent 55%),
    linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 50%, #fbe6ee 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lavender-deep); outline-offset: 3px; border-radius: 6px; }

/* ---------- Scroll progress ---------- */
.progress { position: fixed; inset: 0 0 auto 0; height: 4px; z-index: 50; }
.progress span {
  display: block; height: 100%; width: 100%;
  transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--peach-deep), var(--rose), var(--lavender-deep));
  border-radius: 0 4px 4px 0;
}

/* ---------- Ambient floating decor ---------- */
.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.float { position: absolute; width: 22px; height: 22px; color: var(--c); opacity: .7; animation: bob 7s ease-in-out infinite; }
.f1 { top: 14%; left: 6%;  width: 18px; }
.f2 { top: 36%; right: 5%; width: 20px; animation-delay: -2s; }
.f3 { top: 62%; left: 4%;  width: 26px; animation-delay: -4s; }
.f4 { top: 82%; right: 9%; width: 16px; animation-delay: -1s; }
.f5 { top: 50%; left: 48%; width: 14px; opacity: .45; animation-delay: -3s; }
.f6 { top: 92%; left: 20%; width: 18px; animation-delay: -5s; }
@keyframes bob { 0%, 100% { translate: 0 0; rotate: -6deg; } 50% { translate: 0 -14px; rotate: 6deg; } }

main, .footer { position: relative; z-index: 1; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 72px var(--gutter) 96px;
  overflow: hidden;
}
.balloons { position: absolute; inset: 0; pointer-events: none; }
.balloon { position: absolute; width: 64px; height: 128px; color: var(--c); filter: drop-shadow(0 10px 14px rgba(180, 87, 122, .15)); animation: sway 6s ease-in-out infinite; transform-origin: 50% 100%; }
.b1 { left: 4%;  top: 8%;  width: 70px; height: 140px; }
.b2 { left: 14%; top: 58%; width: 52px; height: 104px; animation-delay: -1.5s; }
.b3 { right: 6%; top: 10%; width: 76px; height: 152px; animation-delay: -3s; }
.b4 { right: 16%; top: 62%; width: 50px; height: 100px; animation-delay: -4.2s; }
.b5 { left: 46%; top: -4%; width: 44px; height: 88px; opacity: .8; animation-delay: -2.2s; }
@keyframes sway { 0%, 100% { rotate: -4deg; translate: 0 0; } 50% { rotate: 4deg; translate: 0 -12px; } }

.hero__inner {
  position: relative;
  width: 100%; max-width: var(--maxw);
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
}
.hero__kicker {
  margin: 0 0 .25rem;
  font-weight: 500; letter-spacing: .18em; text-transform: uppercase; font-size: .8rem;
  color: var(--rose-deep);
}
.hero__name {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(5rem, 16vw, 11rem);
  line-height: .9;
  letter-spacing: -.02em;
  color: var(--ink);
}
.hero__name .char { display: inline-block; color: #e0789a; text-shadow: 0 6px 0 rgba(255, 255, 255, .9), 0 14px 28px rgba(180, 87, 122, .18); }
.hero__name .char:nth-child(4n+2) { color: #b48ae0; }
.hero__name .char:nth-child(4n+3) { color: #f0946f; }
.hero__name .char:nth-child(4n+4) { color: #d97fb3; }
.hero__headline {
  margin: .4rem 0 0;
  font-family: var(--font-script);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  line-height: 1;
  color: var(--rose-deep);
  rotate: -3deg;
  transform-origin: left center;
}
.hero__sub { max-width: 34ch; margin: 1.25rem 0 0; color: var(--ink-soft); }

.hero__stack { position: relative; aspect-ratio: 1.1 / 1; width: min(100%, 460px); justify-self: center; }
.hero__stack .pola { position: absolute; width: 48%; }
.hero__stack .pola:nth-child(1) { left: 0;   top: 14%; --tilt: -10deg; z-index: 1; }
.hero__stack .pola:nth-child(2) { right: 0;  top: 2%;  --tilt: 8deg;   z-index: 2; }
.hero__stack .pola:nth-child(3) { left: 27%; top: 30%; --tilt: -2deg;  z-index: 3; }

.age-badge {
  position: absolute; right: clamp(-8px, 1vw, 16px); bottom: clamp(-40px, -2vw, -8px);
  width: clamp(92px, 12vw, 132px); aspect-ratio: 1;
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff 0%, var(--blush) 60%, var(--rose) 100%);
  box-shadow: var(--shadow);
  z-index: 4;
  rotate: 10deg;
}
.age-badge::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .9); }
.age-badge__num { font-family: var(--font-display); font-weight: 700; font-size: clamp(2.6rem, 5vw, 3.6rem); color: var(--rose-deep); -webkit-text-stroke: 4px #fff; paint-order: stroke fill; }
.age-badge__spark { position: absolute; top: -6px; right: -4px; width: 28px; height: 28px; color: var(--c); animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { scale: .8; opacity: .7; } 50% { scale: 1.15; opacity: 1; } }

.scroll-cue {
  position: absolute; bottom: 22px; left: 50%; translate: -50% 0;
  display: grid; justify-items: center; gap: 6px;
  color: var(--ink-soft); text-decoration: none; font-size: .75rem; letter-spacing: .2em; text-transform: uppercase;
}
.scroll-cue i { width: 22px; height: 36px; border: 2px solid var(--rose); border-radius: 12px; position: relative; }
.scroll-cue i::after { content: ''; position: absolute; left: 50%; top: 7px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: var(--rose-deep); animation: wheel 1.8s ease-in-out infinite; }
@keyframes wheel { 0% { opacity: 0; translate: 0 0; } 30% { opacity: 1; } 100% { opacity: 0; translate: 0 12px; } }

/* ---------- Polaroid ---------- */
.polaroid {
  margin: 0;
  padding: 10px 10px 0;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--shadow);
  rotate: var(--tilt, 0deg);
  transition: rotate .5s cubic-bezier(.2, .8, .2, 1), translate .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s;
}
.polaroid__btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.polaroid__frame {
  position: relative;
  aspect-ratio: var(--ratio, 3 / 4);
  overflow: hidden;
  background-size: cover; background-position: center;
  background-color: var(--blush);
}
.polaroid__frame img {
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; scale: 1.06;
  transition: opacity .9s ease, scale 1.4s cubic-bezier(.2, .8, .2, 1);
}
.polaroid__frame img.is-loaded { opacity: 1; scale: 1; }
.polaroid figcaption {
  font-family: var(--font-script); font-weight: 500;
  font-size: clamp(1.15rem, 1rem + .6vw, 1.45rem);
  line-height: 1.1;
  text-align: center;
  padding: .55rem .25rem .75rem;
  color: var(--ink-soft);
  min-height: 2.6rem;
}
/* little washi tape strip */
.polaroid::before {
  content: '';
  position: absolute; top: -12px; left: 50%;
  width: 72px; height: 24px; translate: -50% 0; rotate: -3deg;
  background: color-mix(in srgb, var(--tape, var(--lavender)) 75%, transparent);
  border-radius: 2px;
  z-index: 2;
}
.pola { position: relative; margin: 0; }
.pola .polaroid { position: relative; }
.pola:nth-child(2) { --tape: var(--peach); }
.pola:nth-child(3) { --tape: var(--blush); }
@media (hover: hover) {
  .pola:hover { z-index: 5; }
  .pola:hover .polaroid { rotate: 0deg; translate: 0 -6px; box-shadow: 0 28px 50px -20px rgba(180, 87, 122, .45), 0 6px 16px -6px rgba(75, 52, 69, .15); }
}

/* ---------- Story / chapters ---------- */
.story {
  position: relative;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(40px, 8vw, 96px) var(--gutter) 40px;
}
.story__thread { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }
.story__thread::before {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(to bottom, var(--rose) 50%, transparent 50%);
  background-size: 2px 12px;
  opacity: .5;
}
.story__thread span {
  position: absolute; inset: 0;
  background: linear-gradient(to bottom, var(--peach-deep), var(--rose), var(--lavender-deep));
  transform-origin: top; transform: scaleY(0);
  border-radius: 2px;
}

.chapter {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(32px, 8vw, 120px);
  padding: clamp(48px, 9vh, 110px) 0;
}
.chapter__dot {
  position: absolute; left: 50%; top: 50%;
  width: 18px; height: 18px; translate: -50% -50%;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--rose);
  box-shadow: 0 0 0 6px rgba(242, 167, 187, .2);
  z-index: 1;
}
.chapter--flip .chapter__media { order: 2; }

.chapter__media { position: relative; display: grid; justify-items: center; }
.chapter--single .pola { width: min(100%, 380px); }
.chapter--pair .chapter__media { grid-template-columns: 1fr 1fr; align-items: start; }
.chapter--pair .pola:nth-child(1) { --tilt: -5deg; z-index: 1; margin-right: -14%; }
.chapter--pair .pola:nth-child(2) { --tilt: 4deg;  z-index: 2; margin-top: 22%; }
.chapter--trio .chapter__media { grid-template-columns: repeat(3, 1fr); align-items: start; }
.chapter--trio .pola { margin-inline: -9%; }
.chapter--trio .pola:nth-child(1) { --tilt: -7deg; margin-top: 14%; }
.chapter--trio .pola:nth-child(2) { --tilt: 2deg;  z-index: 2; }
.chapter--trio .pola:nth-child(3) { --tilt: 8deg;  margin-top: 18%; }

.chapter__text { max-width: 30rem; }
.chapter--flip .chapter__text { justify-self: end; }
.chapter__num {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .2em; text-transform: uppercase;
  color: var(--rose-deep);
  background: rgba(255, 255, 255, .7);
  padding: .3rem .75rem; border-radius: 999px;
  box-shadow: 0 2px 10px -4px rgba(180, 87, 122, .3);
}
.chapter__num svg { width: 12px; height: 12px; color: var(--peach-deep); }
.chapter__date {
  margin: 1rem 0 0;
  font-family: var(--font-script); font-weight: 700;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  color: var(--lavender-deep);
  line-height: 1;
  filter: saturate(1.1) brightness(.85);
}
.chapter__title {
  margin: .25rem 0 .75rem;
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -.01em;
}
.chapter__body { margin: 0; color: var(--ink-soft); }

/* ---------- Closing ---------- */
.closing {
  position: relative;
  display: grid; justify-items: center;
  padding: clamp(64px, 12vh, 140px) var(--gutter) clamp(64px, 10vh, 120px);
  text-align: center;
}
.cake { position: relative; width: min(260px, 70vw); margin-bottom: -28px; z-index: 2; }
.cake__body { width: 100%; height: auto; display: block; }
.candles { position: absolute; left: 0; right: 0; top: -6px; display: flex; justify-content: center; gap: 22px; }
.candle { position: relative; display: grid; justify-items: center; }
.candle b {
  font-family: var(--font-display); font-weight: 700; font-size: 4.2rem; line-height: .9;
  color: var(--lavender-deep);
  -webkit-text-stroke: 3px #fff; paint-order: stroke fill;
  text-shadow: 0 6px 12px rgba(180, 87, 122, .2);
}
.candle::before { content: ''; width: 2px; height: 12px; background: var(--ink-soft); order: -1; margin-bottom: -2px; }
.flame {
  order: -2;
  width: 16px; height: 24px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: radial-gradient(circle at 50% 70%, #fff7d6 0%, #ffd27a 45%, #ff9d7a 100%);
  box-shadow: 0 0 18px 6px rgba(255, 196, 120, .45);
  transform-origin: 50% 90%;
  animation: flicker 1.1s ease-in-out infinite alternate;
  transition: opacity .4s, scale .4s;
}
.candle:nth-child(2) .flame { animation-delay: -.5s; }
@keyframes flicker { 0% { rotate: -4deg; scale: 1 1; } 50% { scale: .92 1.08; } 100% { rotate: 5deg; scale: 1.05 .95; } }
.cake.is-out .flame { opacity: 0; scale: .2; animation: none; }
.cake.is-out .candle::after {
  content: ''; position: absolute; top: -18px; left: 50%; width: 6px; height: 22px; margin-left: -3px;
  border-radius: 50%; background: rgba(122, 96, 114, .25); filter: blur(3px);
  animation: smoke 1.6s ease-out forwards;
}
@keyframes smoke { to { translate: 6px -40px; opacity: 0; scale: 2 3; } }

.closing__card {
  position: relative;
  width: min(100%, 640px);
  padding: clamp(48px, 8vw, 72px) clamp(22px, 6vw, 56px) clamp(32px, 6vw, 48px);
  background: rgba(255, 253, 251, .85);
  backdrop-filter: blur(6px);
  border-radius: 28px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, .9);
}
.closing__title {
  margin: 0 0 1rem;
  font-family: var(--font-script); font-weight: 700;
  font-size: clamp(2.6rem, 2rem + 3vw, 4rem);
  line-height: 1;
  color: var(--rose-deep);
}
.closing__msg { margin: 0 auto; max-width: 46ch; font-size: 1.05em; }
.closing__sign { margin: 1.75rem 0 0; font-family: var(--font-script); font-size: 1.6rem; line-height: 1.2; color: var(--ink-soft); }

.wish-btn {
  margin-top: 2rem;
  padding: .95rem 1.8rem;
  border: 0; border-radius: 999px;
  font-family: var(--font-display); font-weight: 600; font-size: 1.1rem;
  color: #fff;
  background: linear-gradient(120deg, #e98fae, #c29be6);
  box-shadow: 0 12px 24px -10px rgba(180, 87, 122, .6);
  cursor: pointer;
  transition: translate .25s, box-shadow .25s, opacity .3s;
}
.wish-btn:hover { translate: 0 -2px; box-shadow: 0 16px 28px -10px rgba(180, 87, 122, .7); }
.wish-btn:active { translate: 0 1px; }
.wish-btn[disabled] { opacity: .5; cursor: default; }
.wish-done { min-height: 1.6em; margin: 1rem 0 0; font-family: var(--font-script); font-size: 1.7rem; color: var(--rose-deep); }

.footer { text-align: center; padding: 0 0 48px; }
.footer a { color: var(--ink-soft); font-size: .85rem; text-decoration: none; border-bottom: 1px dashed var(--rose); }

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0; padding: 12px 12px 0; max-width: min(92vw, 720px); max-height: 92svh;
  background: var(--paper); border-radius: 6px; box-shadow: var(--shadow);
  overflow: visible;
}
.lightbox::backdrop { background: rgba(75, 52, 69, .55); backdrop-filter: blur(4px); }
.lightbox img { max-height: calc(92svh - 90px); width: auto; margin: 0 auto; }
.lightbox__cap { margin: 0; padding: .6rem 0 .9rem; text-align: center; font-family: var(--font-script); font-size: 1.5rem; color: var(--ink-soft); }
.lightbox__close {
  position: absolute; top: -14px; right: -14px;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--rose); color: #fff; font-size: 1.6rem; line-height: 1; cursor: pointer;
  box-shadow: var(--shadow);
}
.lightbox[open] { animation: pop .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; scale: .92; } }

/* ---------- Pre-animation states (only when JS/GSAP is running) ---------- */
.js-anim .reveal, .js-anim [data-hero], .js-anim .hero__stack .pola, .js-anim .age-badge { visibility: hidden; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { padding-top: 56px; place-items: start center; }
  .hero__inner { grid-template-columns: 1fr; text-align: center; gap: 28px; }
  .hero__sub { margin-inline: auto; }
  .hero__headline { rotate: -2deg; transform-origin: center; }
  .hero__stack { width: min(86%, 340px); }
  .age-badge { right: 4%; bottom: -12px; }
  .b1 { left: -4%; top: 3%; } .b3 { right: -3%; top: 4%; }
  .b2, .b4 { top: auto; bottom: 8%; } .b5 { display: none; }

  .story__thread, .chapter__dot { display: none; }
  .chapter { grid-template-columns: 1fr; gap: 36px; padding: 44px 0; }
  .chapter--flip .chapter__media { order: 0; }
  .chapter__text, .chapter--flip .chapter__text { justify-self: center; text-align: center; }
  .chapter--single .pola { width: min(84%, 340px); }
  .chapter--pair .chapter__media, .chapter--trio .chapter__media { width: min(100%, 440px); margin-inline: auto; }
  .chapter--trio .chapter__media { grid-template-columns: 1fr 1fr; }
  .chapter--trio .pola { margin-inline: 0; }
  .chapter--trio .pola:nth-child(1) { margin: 0 -6% 0 0; }
  .chapter--trio .pola:nth-child(2) { margin-top: 18%; }
  .chapter--trio .pola:nth-child(3) { grid-column: 1 / -1; width: 58%; margin-top: -16%; z-index: 3; --tilt: -3deg; }
}
@media (max-width: 420px) {
  .polaroid { padding: 7px 7px 0; }
  .polaroid figcaption { font-size: 1.05rem; padding: .4rem .2rem .55rem; min-height: 2.2rem; }
  .polaroid::before { width: 52px; height: 18px; top: -9px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
