/* ==========================================================================
   Moment shared — utility chrome identical across every layout (preloader,
   music toggle, ambient canvases, lightbox, toast, reset, keyframes).
   Colors/fonts come from css/themes/<slug>.css; structure/composition of
   hero/gallery/story/letter lives in css/layouts/<layout>.css.
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(1000px 600px at 0% 15%, var(--bg-glow-2), transparent 55%),
    var(--cream);
  color: var(--choco);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }
body.no-scroll { overflow: hidden; }

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

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   PRELOADER / OPENING
   ========================================================================== */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background:
    radial-gradient(700px 500px at 50% 30%, var(--bg-glow-1), transparent 65%),
    var(--cream);
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}
#preloader.done { opacity: 0; visibility: hidden; pointer-events: none; }

.preloader-inner { text-align: center; padding: 0 24px; animation: rise 1.1s var(--ease) both; }

.ring {
  width: 116px; height: 116px;
  margin: 0 auto 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--rose);
  border-right-color: var(--gold);
  animation: spinRing 1.5s linear infinite;
  display: grid; place-items: center;
  box-shadow: 0 0 34px var(--ring-glow);
}
.ring-heart {
  font-size: 40px; color: var(--rose);
  animation: heartBeat 1.4s ease-in-out infinite;
  text-shadow: 0 4px 18px var(--ring-glow);
}

.preloader-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.8rem);
  letter-spacing: 0.04em;
  color: var(--choco);
}
.preloader-sub {
  margin: 14px auto 28px;
  max-width: 420px;
  font-size: 1.12rem;
  color: var(--choco-soft);
  font-style: italic;
}

.btn-open {
  font-size: 1.15rem;
  padding: 12px 46px;
  border-radius: 999px;
  color: var(--white);
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  letter-spacing: 0.22em;
  text-transform: uppercase;
  box-shadow: 0 12px 26px var(--rose-shadow);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.btn-open:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 16px 34px var(--rose-shadow); }
.btn-open:active { transform: translateY(0) scale(0.98); }

/* ==========================================================================
   MUSIC TOGGLE
   ========================================================================== */
.music-toggle {
  position: fixed;
  right: 22px; bottom: 22px;
  z-index: 60;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--choco), var(--choco-light));
  color: var(--gold-soft);
  font-size: 1.5rem;
  display: grid; place-items: center;
  box-shadow: 0 10px 24px var(--choco-shadow);
  transition: transform 0.3s var(--ease), opacity 0.3s;
  animation: popIn 0.6s var(--ease) both;
}
.music-toggle:hover { transform: scale(1.08); }
.music-toggle.playing { animation: spinRing 3s linear infinite; color: var(--gold-bright); }
.music-toggle.disabled { opacity: 0.45; cursor: not-allowed; }

/* ==========================================================================
   HERO CHIP (easter-egg heart) — visual identity shared by every layout;
   each layout CSS positions it (inline vs corner) to fit its composition.
   ========================================================================== */
.hero-chip {
  width: 78px; height: 78px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, var(--gold-soft), var(--gold) 70%);
  box-shadow: 0 10px 28px var(--gold-shadow);
  cursor: pointer;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
  animation: floaty 4.5s ease-in-out infinite;
}
.hero-chip:hover { transform: scale(1.1) rotate(8deg); box-shadow: 0 14px 36px var(--gold-shadow); }
.chip-heart { font-size: 32px; color: var(--white); text-shadow: 0 3px 12px var(--choco-shadow); }

.ornament-line {
  display: inline-block;
  width: 56px;
  height: 1px;
  background: currentColor;
  opacity: 0.6;
  vertical-align: middle;
  margin: 0 14px;
}

/* ==========================================================================
   CANVAS (petals/sparkles + confetti)
   ========================================================================== */
#petals, #confetti {
  position: fixed;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
}
#confetti { z-index: 90; }

/* ==========================================================================
   TOAST
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 92px; left: 50%;
  transform: translateX(-50%);
  z-index: 95;
  background: var(--choco);
  color: var(--gold-soft);
  padding: 12px 24px;
  border-radius: 999px;
  box-shadow: 0 12px 30px var(--choco-shadow);
  font-style: italic;
  animation: toastIn 0.4s var(--ease) both;
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: var(--lightbox-bg);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.35s var(--ease) both;
  padding: 40px 60px;
}
.lb-frame { max-width: min(88vw, 760px); text-align: center; }
.lb-frame img {
  max-height: 76vh;
  width: auto;
  margin: 0 auto;
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--gold-line-strong);
  opacity: 0;
  transform: scale(0.96);
  animation: lbIn 0.4s var(--ease) forwards;
}
.lb-frame figcaption {
  margin-top: 16px;
  color: var(--gold-soft);
  font-style: italic;
  font-size: 1.05rem;
}

.lb-close, .lb-prev, .lb-next {
  position: absolute;
  color: var(--gold-soft);
  font-size: 2.3rem;
  line-height: 1;
  transition: transform 0.3s, color 0.3s;
}
.lb-close { top: 18px; right: 26px; }
.lb-prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-close:hover, .lb-prev:hover, .lb-next:hover { color: #fff; transform: scale(1.2); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.2); }

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes spinRing { to { transform: rotate(360deg); } }
@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  14% { transform: scale(1.14); }
  28% { transform: scale(1); }
  42% { transform: scale(1.1); }
  70% { transform: scale(1); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}
@keyframes popIn {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbIn { to { opacity: 1; transform: scale(1); } }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 560px) {
  .lightbox { padding: 30px 18px; }
  .lb-close { top: 12px; right: 16px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
