'use strict';
/**
 * Sau Wajah — the experience stylesheet.
 *
 * Ported from felisaans/cute-birthday-website css/style.css (MIT): the same
 * pastel palette, Poppins/Quicksand typography, polaroid slideshow, hanging
 * clothesline and letter card — re-expressed for a single-document, four-
 * scene microsite (the original blurred between four separate pages).
 */

:root {
  --white: #ffffff;
  --cream: #fffaf9;
  --pastel-pink: #ffd6e8;
  --pastel-pink-deep: #ff9fc7;
  --pastel-blue: #d6ecff;
  --pastel-blue-deep: #a8d8ff;
  --pastel-lavender: #e6d9ff;
  --pastel-lavender-deep: #c7a9ff;
  --text-dark: #5b4a5a;
  --text-soft: #8a7a91;
  --shadow-soft: 0 10px 30px rgba(200, 170, 200, 0.25);
  --sans: 'Poppins', system-ui, sans-serif;
  --heading: 'Quicksand', var(--sans);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body.sw {
  margin: 0;
  font-family: var(--sans);
  background: var(--white);
  color: var(--text-dark);
  overflow: hidden; /* each scene manages its own scroll */
  min-height: 100vh;
  position: relative;
}

/* ------------------------------------------------------------ floating bg */

#swFloatingBg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
#swFloatingBg .floaty {
  position: absolute;
  bottom: -40px;
  animation: sw-rise linear forwards;
}
@keyframes sw-rise {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.85; }
  90%  { opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(24deg); opacity: 0; }
}

/* ------------------------------------------------------------- page nav */

.sw-page-nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 40;
}
.sw-page-nav button {
  width: 11px;
  height: 11px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--pastel-lavender-deep);
  background: var(--white);
  cursor: pointer;
  transition: transform 0.25s ease, background 0.25s ease;
}
.sw-page-nav button.active { background: var(--pastel-pink-deep); border-color: var(--pastel-pink-deep); transform: scale(1.25); }

/* ---------------------------------------------------------------- scenes */

.sw-page {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(56px, 9vh, 96px) clamp(18px, 5vw, 48px) clamp(28px, 5vh, 48px);
  overflow-y: auto;
  overflow-x: hidden;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  pointer-events: none;
}
.sw-page.is-active { opacity: 1; transform: none; pointer-events: auto; }
.sw-page[hidden] { display: none; }

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

.sw-hero__content { text-align: center; max-width: 620px; }
.sw-gif-frame {
  display: inline-block;
  padding: 14px;
  background: var(--white);
  border: 1px solid #f3e2ec;
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  animation: sw-bob 3.6s ease-in-out infinite;
}
.sw-gif-frame svg { display: block; }
@keyframes sw-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.sw-cake .sw-flame { animation: sw-flicker 1.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes sw-flicker {
  0%,100% { transform: scaleY(1); opacity: 1; }
  50% { transform: scaleY(0.86) scaleX(1.06); opacity: 0.9; }
}

.sw-hero__title {
  margin: 26px 0 10px;
  font-family: var(--heading);
  font-weight: 800;
  font-size: clamp(1.9rem, 5.4vw, 3rem);
  line-height: 1.15;
  color: var(--text-dark);
}
.sw-hero__title .sw-hero__sparkle { display: inline-block; animation: sw-bob 2.4s ease-in-out infinite; }
.sw-hero__subtitle { margin: 0 0 26px; color: var(--text-soft); font-size: clamp(0.95rem, 2.4vw, 1.08rem); }

.sw-btn {
  display: inline-block;
  padding: 13px 34px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--pastel-pink-deep), var(--pastel-lavender-deep));
  color: #fff;
  font-family: var(--sans);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 12px 26px -14px rgba(255, 159, 199, 0.9);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.sw-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -14px rgba(255, 159, 199, 1); }
.sw-btn--ghost {
  background: var(--white);
  color: var(--text-soft);
  border: 1px solid #f0dfe9;
  box-shadow: none;
}

/* --------------------------------------------------------------- gallery */

.sw-heading {
  margin: 0 0 6px;
  font-family: var(--heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--text-dark);
}
.sw-sub { margin: 0 0 18px; color: var(--text-soft); font-size: 0.9rem; }

.sw-slideshow { position: relative; width: min(560px, 92vw); }
.sw-corner-deco { position: absolute; top: -18px; right: -6px; z-index: 3; }
.sw-bottom-left-deco { position: absolute; bottom: -12px; left: -10px; z-index: 3; }
.sw-sparkle { animation: sw-twinkle 2.2s ease-in-out infinite; }
.sw-sparkle--slow { animation-duration: 3.4s; }
@keyframes sw-twinkle { 0%,100% { transform: scale(1) rotate(0deg); opacity: 0.9; } 50% { transform: scale(0.8) rotate(24deg); opacity: 0.6; } }

.sw-slide-stage { display: flex; align-items: center; gap: 10px; }
.sw-photo-stage { position: relative; flex: 1; display: flex; justify-content: center; }
.sw-polaroid {
  --tilt: -3deg;
  width: min(300px, 68vw);
  background: var(--white);
  padding: 14px 14px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  transform: rotate(var(--tilt));
  transition: transform 0.4s ease, opacity 0.4s ease;
  cursor: pointer;
  position: relative;
}
.sw-polaroid.is-transitioning { opacity: 0; transform: rotate(var(--tilt)) translateX(-26px) scale(0.96); }
.sw-photo-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  background: var(--pastel-pink);
  display: flex;
}
.sw-photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sw-mini-heart {
  position: absolute;
  font-size: 18px;
  pointer-events: none;
  animation: sw-mini-heart 1s ease-out forwards;
}
@keyframes sw-mini-heart {
  0% { transform: translateY(0) scale(0.6); opacity: 1; }
  100% { transform: translateY(-46px) scale(1.2); opacity: 0; }
}

.sw-arrow {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: var(--white);
  color: var(--text-soft);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, color 0.2s ease;
  flex: 0 0 auto;
}
.sw-arrow:hover { transform: scale(1.08); color: var(--pastel-pink-deep); }

.sw-caption {
  margin: 20px auto 12px;
  max-width: 460px;
  text-align: center;
  color: var(--text-dark);
  font-size: 0.92rem;
  line-height: 1.6;
  transition: opacity 0.4s ease;
  min-height: 3em;
}
.sw-caption.is-transitioning { opacity: 0; }

.sw-dots { display: flex; justify-content: center; gap: 8px; }
.sw-dots .dot {
  width: 9px; height: 9px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--pastel-blue);
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}
.sw-dots .dot.active { background: var(--pastel-blue-deep); transform: scale(1.3); }
.sw-counter { text-align: center; margin: 10px 0 0; font-size: 0.74rem; letter-spacing: 0.12em; color: var(--text-soft); }

.sw-page-buttons { display: flex; gap: 12px; margin-top: 26px; }

/* --------------------------------------------------------------- reasons */

.sw-reasons { justify-content: flex-start; }
.sw-clothesline { position: relative; width: min(680px, 94vw); margin: 6px 0 26px; }
.sw-clothesline__rope {
  position: absolute;
  top: 14px; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, #e7cfe0 12%, #e7cfe0 88%, transparent);
  border-radius: 3px;
}
.sw-hanging {
  position: relative;
  display: flex;
  justify-content: center;
  gap: clamp(10px, 2.4vw, 22px);
  flex-wrap: wrap;
  padding-top: 16px;
}
.sw-hang-photo {
  position: relative;
  transform: rotate(var(--tilt, 0deg));
  margin-top: var(--drop, 8px);
  animation: sw-sway 5s ease-in-out infinite;
  animation-delay: var(--sway-delay, 0s);
  transform-origin: 50% -18px;
}
@keyframes sw-sway { 0%,100% { transform: rotate(var(--tilt)); } 50% { transform: rotate(calc(var(--tilt) * 0.55)); } }
.sw-hang-photo .clip {
  position: absolute;
  top: -12px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 22px;
  border-radius: 4px;
  z-index: 2;
}
.clip-pink { background: var(--pastel-pink-deep); }
.clip-blue { background: var(--pastel-blue-deep); }
.clip-lavender { background: var(--pastel-lavender-deep); }
.sw-mini-photo-frame {
  width: clamp(76px, 14vw, 108px);
  aspect-ratio: 1 / 1;
  background: var(--white);
  padding: 7px 7px 12px;
  border-radius: 6px;
  box-shadow: 0 8px 20px -8px rgba(200, 170, 200, 0.5);
  overflow: hidden;
  cursor: zoom-in;
}
.frame-pink { border-bottom: 3px solid var(--pastel-pink); }
.frame-blue { border-bottom: 3px solid var(--pastel-blue); }
.frame-lavender { border-bottom: 3px solid var(--pastel-lavender); }
.sw-mini-photo-frame img, .sw-mini-photo-frame svg { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 3px; }

.sw-reasons-wrap { position: relative; width: min(640px, 94vw); }
.sw-reasons-corner { position: absolute; top: -16px; right: 6px; z-index: 3; }
.sw-reasons-gif-top { text-align: center; padding: 14px 0 4px; }
.sw-reasons-box {
  background: var(--pastel-blue);
  background: linear-gradient(180deg, #eaf4ff, var(--pastel-blue));
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  height: min(420px, 52vh);
  overflow-y: auto;
  padding: 18px clamp(18px, 4vw, 34px) 26px;
  scrollbar-width: none;
}
.sw-reasons-box::-webkit-scrollbar { display: none; }
.sw-reasons-list { margin: 0; padding: 0 0 0 22px; }
.sw-reasons-list li { padding: 9px 0; border-bottom: 1px dashed rgba(168, 216, 255, 0.7); color: var(--text-dark); font-size: 0.95rem; line-height: 1.55; }
.sw-reasons-list li::marker { color: var(--pastel-blue-deep); font-weight: 700; }

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

.sw-letter { position: relative; }
#swConfettiCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 5; }
.sw-letter-card {
  position: relative;
  z-index: 6;
  width: min(620px, 94vw);
  background: var(--white);
  border: 1px solid #f3e2ec;
  border-radius: 26px;
  padding: clamp(24px, 4.5vw, 44px);
  box-shadow: var(--shadow-soft);
  text-align: center;
}
.sw-letter__title {
  margin: 0 0 16px;
  font-family: var(--heading);
  font-weight: 800;
  font-size: clamp(1.5rem, 4.2vw, 2.2rem);
  color: var(--text-dark);
}
.sw-celebration-frame { display: flex; justify-content: center; margin-bottom: 14px; }
.sw-bear-wave { animation: sw-wave 2.6s ease-in-out infinite; transform-origin: 66px 84px; }
@keyframes sw-wave { 0%,100% { transform: rotate(0deg); } 50% { transform: rotate(-8deg); } }
.sw-letter-box {
  background: var(--cream);
  border: 1px dashed #f0d9e6;
  border-radius: 16px;
  padding: 18px 20px;
  text-align: left;
  max-height: 40vh;
  overflow-y: auto;
}
.sw-letter-box p { margin: 0; font-size: 0.94rem; line-height: 1.75; white-space: pre-wrap; }
.sw-letter-box .cursor { display: inline-block; width: 0.55em; animation: sw-blink 0.9s steps(1) infinite; }
@keyframes sw-blink { 50% { opacity: 0; } }
.sw-signature { margin: 18px 0 0; font-family: var(--heading); font-weight: 600; color: var(--text-soft); }
.sw-signature__name { color: var(--pastel-pink-deep); }
.sw-footer { margin-top: 22px; font-size: 0.72rem; letter-spacing: 0.1em; color: var(--text-soft); }
.sw-footer a { color: inherit; }

/* ------------------------------------------------- floating widgets · music & note */

.sw-music-btn, .sw-note-btn {
  position: fixed;
  z-index: 60;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  background: var(--white);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
.sw-music-btn:hover, .sw-note-btn:hover { transform: scale(1.08); }
.sw-music-btn { right: 16px; bottom: 16px; }
.sw-note-btn { left: 16px; bottom: 16px; }
.sw-music-btn.playing { animation: sw-pulse 1.6s ease-in-out infinite; }
@keyframes sw-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,159,199,0.5); } 50% { box-shadow: 0 0 0 10px rgba(255,159,199,0); } }
.sw-music-note {
  position: absolute;
  top: -6px;
  pointer-events: none;
  animation: sw-note-float 1.4s ease-out forwards;
}
@keyframes sw-note-float {
  0% { transform: translateY(0) translateX(0); opacity: 1; }
  100% { transform: translateY(-34px) translateX(var(--drift, 0px)); opacity: 0; }
}

.sw-note-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(91, 74, 90, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sw-note-overlay.open { opacity: 1; visibility: visible; }
.sw-note-paper {
  width: min(420px, 92vw);
  background: var(--white);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 30px 60px -30px rgba(91, 74, 90, 0.6);
  position: relative;
  transform: translateY(12px);
  transition: transform 0.3s ease;
}
.sw-note-overlay.open .sw-note-paper { transform: none; }
.sw-note-close {
  position: absolute;
  top: 10px; right: 12px;
  border: 0;
  background: none;
  font-size: 1rem;
  color: var(--text-soft);
  cursor: pointer;
}
.sw-note-title { margin: 0 0 4px; font-family: var(--heading); color: var(--text-dark); }
.sw-note-hint { margin: 0 0 12px; font-size: 0.8rem; color: var(--text-soft); }
.sw-note-textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid #f0dfe9;
  border-radius: 12px;
  padding: 12px;
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--text-dark);
}
.sw-note-textarea:focus { outline: none; border-color: var(--pastel-pink-deep); box-shadow: 0 0 0 3px rgba(255,159,199,0.18); }
.sw-note-saved { display: inline-block; margin-top: 8px; font-size: 0.76rem; color: var(--pastel-blue-deep); opacity: 0; transition: opacity 0.3s ease; }
.sw-note-saved.show { opacity: 1; }

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

.sw-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(91, 74, 90, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.sw-lightbox.open { opacity: 1; visibility: visible; }
.sw-lightbox img { max-width: min(88vw, 640px); max-height: 82vh; border-radius: 16px; background: var(--white); padding: 10px; box-shadow: 0 30px 60px -30px rgba(91,74,90,0.7); }
.sw-lightbox-close {
  position: absolute;
  top: 18px; right: 22px;
  border: 0;
  border-radius: 50%;
  width: 40px; height: 40px;
  background: var(--white);
  color: var(--text-dark);
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------------------------------------------------------------- misc */

.sw-previewbadge {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 90;
  background: var(--pastel-lavender-deep);
  color: #fff;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .sw-page { transform: none; }
}
