/* ================================================================
   Sacred Garden — motion & atmosphere enhancements
   ================================================================ */

:root {
  --ss-cream: #f9f0e0;
  --ss-ink: #6c513f;
  --ss-gold: #a67d2b;
  --ss-soft: #8a6b4f;
  --ss-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ss-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
}

/* ---- paper grain + warm vignette ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99990;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 99989;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(166, 125, 43, 0.07), transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(90, 15, 27, 0.05), transparent 50%);
}

/* ---- reading progress ---- */
#ssProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 100000;
  background: linear-gradient(90deg, #c8ab6d, #a67d2b, #8a6b4f);
  box-shadow: 0 0 12px rgba(166, 125, 43, 0.45);
  transform-origin: left center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
}

body.wei-revealed #ssProgress {
  opacity: 1;
}

/* ---- ambient floating motes ---- */
#ssMotes {
  position: fixed;
  inset: 0;
  z-index: 99991;
  pointer-events: none;
  overflow: hidden;
  opacity: 0;
  transition: opacity 1.4s ease;
}

body.wei-revealed #ssMotes {
  opacity: 1;
}

#ssMotes span {
  position: absolute;
  bottom: -8%;
  width: 5px;
  height: 5px;
  border-radius: 50% 50% 45% 55%;
  background: radial-gradient(circle at 30% 30%, #f0c27a, #c45c26 70%);
  opacity: 0;
  animation: ssMoteDrift linear infinite;
  filter: blur(0.2px);
}

@keyframes ssMoteDrift {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.6);
    opacity: 0;
  }
  8% { opacity: 0.55; }
  70% { opacity: 0.35; }
  100% {
    transform: translate3d(var(--mx), -110vh, 0) rotate(360deg) scale(1);
    opacity: 0;
  }
}

/* ---- hero atmosphere ---- */
#ssHero .ss-hero-video video {
  transform: scale(1.04);
  transform-origin: center center;
  animation: ssHeroBreath 18s ease-in-out infinite alternate;
  will-change: transform;
}

@keyframes ssHeroBreath {
  from { transform: scale(1.02) translateY(0); }
  to   { transform: scale(1.08) translateY(-1.5%); }
}

#ssHero .ss-hero-panel {
  animation: ssPanelFloat 10s ease-in-out 2s infinite;
}

@keyframes ssPanelFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}

.wei-revealed #ssHero .ss-hero-video {
  animation: ssHeroReveal 1.8s var(--ss-ease) both;
}

@keyframes ssHeroReveal {
  from { opacity: 0; filter: blur(6px) saturate(0.85); }
  to   { opacity: 1; filter: blur(0) saturate(1); }
}

/* soft light sweep across names after reveal */
.wei-revealed #ssHero .ss-hero-names::after {
  content: "";
  position: absolute;
  inset: -10% -20%;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 240, 210, 0.35) 48%,
    transparent 62%
  );
  background-size: 220% 100%;
  animation: ssNameSweep 5.5s ease-in-out 3s infinite;
  pointer-events: none;
  mix-blend-mode: soft-light;
}

@keyframes ssNameSweep {
  0%, 100% { background-position: 120% 0; opacity: 0; }
  40%      { opacity: 1; }
  55%      { background-position: -20% 0; opacity: 0.8; }
}

#ssHero .ss-hero-names {
  position: absolute;
}

/* ---- save the date card ---- */
#ssRevealWrap {
  transition: transform 0.7s var(--ss-ease), box-shadow 0.7s ease;
  animation: ssCardFloat 7s ease-in-out infinite;
}

@keyframes ssCardFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

#ssSaveDate .ss-sd-title {
  position: relative;
}

#ssSaveDate.ss-revealed .ss-sd-title {
  animation: ssTitleBloom 1.1s var(--ss-ease) both;
}

@keyframes ssTitleBloom {
  from { letter-spacing: 0.28em; opacity: 0.5; }
  to   { letter-spacing: 0.15em; opacity: 1; }
}

#ssRevealBtn {
  position: relative;
  overflow: hidden;
}

#ssRevealBtn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,0.35) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: none;
}

#ssRevealBtn:hover::after {
  animation: ssBtnSheen 0.9s ease;
}

@keyframes ssBtnSheen {
  to { transform: translateX(120%); }
}

/* ---- countdown ---- */
#ssCountdown.ss-cd-live .ss-cd-orn span {
  animation: ssDiamondPulse 2.8s ease-in-out infinite;
}

@keyframes ssDiamondPulse {
  0%, 100% { transform: rotate(45deg) scale(1); box-shadow: 0 0 0 0 rgba(200, 171, 109, 0); }
  50%      { transform: rotate(45deg) scale(1.25); box-shadow: 0 0 0 8px rgba(200, 171, 109, 0); }
}

#ssCountdown.ss-cd-live .time-block {
  position: relative;
}

#ssCountdown.ss-cd-live .time-block::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 12px;
  background: radial-gradient(circle, rgba(166, 125, 43, 0.12), transparent 70%);
  opacity: 0;
  animation: ssBlockGlow 4s ease-in-out infinite;
  pointer-events: none;
}

#ssCountdown.ss-cd-live #tb-days::before  { animation-delay: 0s; }
#ssCountdown.ss-cd-live #tb-hours::before { animation-delay: 0.5s; }
#ssCountdown.ss-cd-live #tb-mins::before  { animation-delay: 1s; }
#ssCountdown.ss-cd-live #tb-secs::before  { animation-delay: 1.5s; }

@keyframes ssBlockGlow {
  0%, 100% { opacity: 0; }
  50%      { opacity: 1; }
}

/* ---- events: richer entrances ---- */
#ssEvents .ss-ev-garland img {
  transform-origin: center top;
  animation: ssGarlandSway 8s ease-in-out infinite;
}

@keyframes ssGarlandSway {
  0%, 100% { transform: rotate(-0.4deg) translateY(0); }
  50%      { transform: rotate(0.5deg) translateY(3px); }
}

/* Head stays visible by default — animate only when .is-in is applied */
#ssEvents .ss-ev-head.is-in {
  animation: ssHeadIn 0.9s var(--ss-ease) both;
}

#ssEvents .ss-ev-orn i {
  transform-origin: center;
  transition: transform 1s var(--ss-ease) 0.25s;
}

#ssEvents .ss-ev-head.is-in .ss-ev-orn i {
  animation: ssOrnGrow 0.9s var(--ss-ease) 0.2s both;
}

@keyframes ssHeadIn {
  from { opacity: 0.2; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes ssOrnGrow {
  from { transform: scaleX(0.2); opacity: 0.4; }
  to   { transform: scaleX(1); opacity: 1; }
}

/*
  CRITICAL: original template leaves cards at opacity:0 until .ss-in-view.
  That gate was getting stuck — force content visible, animate as enhancement only.
*/
#ssEvents .ss-ev-card {
  opacity: 1 !important;
  transform: none !important;
}

#ssEvents .ss-ev-card.ss-in-view .ss-ev-art {
  animation: ssArtIn 1.25s var(--ss-ease-out) both;
}

#ssEvents .ss-ev-card--flip.ss-in-view .ss-ev-art {
  animation-name: ssArtInFlip;
}

#ssEvents .ss-ev-card.ss-in-view .ss-ev-info {
  animation: ssInfoIn 1.15s var(--ss-ease-out) 0.12s both;
}

#ssEvents .ss-ev-card.ss-in-view .ss-ev-rule {
  animation: ssRuleDraw 0.9s var(--ss-ease) 0.45s both;
}

@keyframes ssEvRise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ssArtIn {
  from { transform: translateX(-18px) scale(0.98); filter: blur(2px); }
  to   { transform: none; filter: none; }
}

@keyframes ssArtInFlip {
  from { transform: translateX(18px) scale(0.98); filter: blur(2px); }
  to   { transform: none; filter: none; }
}

@keyframes ssInfoIn {
  from { transform: translateY(12px); }
  to   { transform: none; }
}

@keyframes ssRuleDraw {
  from { width: 0; opacity: 0; }
  to   { width: clamp(34px, 9vw, 60px); opacity: 0.8; }
}

#ssEvents .ss-ev-art {
  position: relative;
  overflow: hidden;
}

#ssEvents .ss-ev-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 248, 230, 0.35) 50%, transparent 60%);
  transform: translateX(-120%);
  pointer-events: none;
}

#ssEvents .ss-ev-card.ss-in-view .ss-ev-art::after {
  animation: ssArtSheen 2.2s ease 0.8s both;
}

@keyframes ssArtSheen {
  to { transform: translateX(120%); }
}

#ssEvents .ss-ev-art img {
  transition: transform 1.2s var(--ss-ease);
}

#ssEvents .ss-ev-card:hover .ss-ev-art img {
  transform: scale(1.03);
}

#ssEvents .ss-ev-dir {
  position: relative;
  transition: color 0.3s ease, letter-spacing 0.35s ease, border-color 0.3s ease;
}

#ssEvents .ss-ev-dir:hover {
  letter-spacing: 0.22em;
}

#ssEvents .ss-ev-dir svg {
  transition: transform 0.35s var(--ss-ease);
}

#ssEvents .ss-ev-dir:hover svg {
  transform: translateY(-2px);
}

/* ---- gallery ---- */
#ssGallery.is-in .ss-ga-eyebrow {
  animation: ssHeadIn 0.8s var(--ss-ease) 0.05s both;
}
#ssGallery.is-in .ss-ga-title {
  animation: ssHeadIn 0.9s var(--ss-ease) 0.15s both;
}
#ssGallery.is-in .ss-ga-instruction {
  animation: ssHeadIn 0.9s var(--ss-ease) 0.28s both;
}

#ssGallery .ss-ga-seal {
  animation: ssSealRock 5.5s ease-in-out infinite;
}

@keyframes ssSealRock {
  0%, 100% { transform: translateX(-50%) rotate(-4deg); }
  50%      { transform: translateX(-50%) rotate(3deg) translateY(-3px); }
}

#ssGallery .ss-ga-stack {
  transition: transform 0.8s var(--ss-ease);
}

#ssGallery.is-in .ss-ga-stack {
  animation: ssStackIn 1.1s var(--ss-ease-out) both;
}

@keyframes ssStackIn {
  from { opacity: 0; transform: translateY(28px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

/* ---- RSVP — never leave the envelope invisible ---- */
#ssRsvp .ss-rs-env {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
  transition: filter 0.9s ease;
  filter: drop-shadow(0 22px 40px rgba(90, 40, 20, 0.18));
}

#ssRsvp.is-in .ss-rs-env {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

#ssRsvp .ss-rs-send {
  position: relative;
  overflow: hidden;
  transition: transform 0.35s var(--ss-ease), letter-spacing 0.35s ease, background 0.35s ease;
}

#ssRsvp .ss-rs-send:hover {
  transform: translateY(-2px);
  letter-spacing: 0.18em;
}

#ssRsvp .ss-rs-choice label {
  transition: transform 0.3s var(--ss-ease), border-color 0.3s ease, background 0.3s ease;
}

#ssRsvp .ss-rs-choice input:checked + label {
  transform: scale(1.03);
}

/* ---- audio button pulse ring ---- */
#weiAudioBtn {
  transition: opacity 0.4s ease, transform 0.35s var(--ss-ease), box-shadow 0.35s ease !important;
}

#weiAudioBtn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(90, 15, 27, 0.35);
  animation: ssAudioRing 2.8s ease-out infinite;
  pointer-events: none;
}

@keyframes ssAudioRing {
  0%   { transform: scale(0.85); opacity: 0.7; }
  100% { transform: scale(1.35); opacity: 0; }
}

#weiAudioBtn:hover {
  transform: scale(1.08);
  box-shadow: 0 8px 18px rgba(90, 15, 27, 0.28);
}

/* ---- welcome tap glow ---- */
#weiOverlay #weiTapLabel {
  text-shadow: 0 0 18px rgba(166, 125, 43, 0.25);
}

/* ---- date-reveal celebration flash ---- */
#ssSpark {
  position: fixed;
  inset: 0;
  z-index: 99995;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 50% 40%, rgba(255, 220, 160, 0.35), transparent 55%);
  transition: opacity 0.8s ease;
}

#ssSpark.is-on {
  opacity: 1;
  animation: ssSparkFade 1.6s ease forwards;
}

@keyframes ssSparkFade {
  0%   { opacity: 0; }
  25%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---- reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #ssHero .ss-hero-video video,
  #ssHero .ss-hero-panel,
  #ssRevealWrap,
  #ssEvents .ss-ev-garland img,
  #ssGallery .ss-ga-seal,
  #weiAudioBtn::before,
  #ssMotes span,
  .wei-revealed #ssHero .ss-hero-names::after {
    animation: none !important;
  }
  #ssEvents .ss-ev-card,
  #ssEvents .ss-ev-card.ss-in-view .ss-ev-art,
  #ssEvents .ss-ev-card.ss-in-view .ss-ev-info {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  body::before,
  body::after,
  #ssMotes,
  #ssProgress {
    display: none;
  }
}
