/* Motion + polish layer for the public page. Loaded after site.css.
   Every animation lives inside "no-preference" or is switched off for
   people who ask their device to reduce motion. */
:root { --ease: cubic-bezier(.22, .8, .3, 1); }
html { scroll-padding-top: 64px; }
section[id] { scroll-margin-top: 64px; }

/* ---------- subtle page background ---------- */
body {
  background:
    radial-gradient(1100px 500px at 85% -5%, rgba(154,146,181,.10), transparent 60%),
    radial-gradient(900px 500px at 5% 40%, rgba(120,150,190,.08), transparent 60%),
    var(--paper);
  background-attachment: fixed;
}
.section--tint { background: linear-gradient(180deg, rgba(239,236,245,.55), rgba(239,236,245,.25)); }
.center--tight { margin: 0 0 18px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- buttons ---------- */
.btn { transition: background .25s, color .25s, transform .25s var(--ease), box-shadow .25s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(63,91,130,.22); }
.btn:active { transform: translateY(0); box-shadow: none; }

/* ---------- hero ---------- */
.hero { padding-top: 84px; padding-bottom: 80px; min-height: min(100vh, 980px); display: grid; align-content: center; }
.hero__inner { padding-bottom: 8px; }
.hero__age { margin: 0 0 20px; font-style: italic; color: var(--copper); font-size: 1.2rem; }
.hero__age span { font-style: normal; font-weight: 600; font-size: 1.5rem; }
.hero__actions { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* portrait with soft pulsing rings */
.portrait-wrap { position: relative; width: clamp(200px, 55vw, 300px); margin: 0 auto 34px; }
.portrait-wrap .portrait { width: 100%; margin: 0; }
.portrait-wrap::before, .portrait-wrap::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 1px solid rgba(155,107,79,.45); pointer-events: none;
}
.portrait-wrap::after { inset: -26px; border-color: rgba(154,146,181,.45); }

/* name letters */
.name-word { display: inline-block; white-space: nowrap; }
.name-letter { display: inline-block; }

/* scroll cue */
.scrollcue { position: absolute; left: 50%; bottom: 18px; width: 26px; height: 42px; margin-left: -13px; border: 1.5px solid rgba(155,107,79,.6); border-radius: 14px; z-index: 2; }
.scrollcue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--copper); }

/* petals */
.petals { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.petal { position: absolute; top: -30px; width: var(--s); height: calc(var(--s) * 1.45); background: var(--c); opacity: 0; border-radius: 150% 0 150% 0; }

/* ---------- sticky nav ---------- */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 60; transform: translateY(-110%); transition: transform .45s var(--ease);
  background: rgba(250,249,246,.88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.nav.is-visible { transform: none; }
.nav__inner { display: flex; align-items: center; gap: 16px; max-width: var(--maxw); margin: 0 auto; padding: 8px var(--gutter); }
.nav__brand { font-size: 1.2rem; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav__links { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav__links::-webkit-scrollbar { display: none; }
.nav__links a { font-family: var(--font-label); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; text-decoration: none; color: var(--ink); padding: 9px 11px; border-radius: 99px; white-space: nowrap; transition: background .25s, color .25s; }
.nav__links a:hover { background: var(--lavender-tint); }
.nav__links a.is-active { background: var(--lavender-tint); color: var(--slate-blue); }
@media (max-width: 640px) { .nav__brand { display: none; } .nav__links { margin-left: 0; } }

/* ---------- section titles ---------- */
.section__title::after { content: ""; display: block; height: 1px; width: 120px; margin: 14px auto 0; background: linear-gradient(90deg, transparent, var(--copper), transparent); }

/* ---------- cards ---------- */
.service, .tribute { transition: transform .4s var(--ease), box-shadow .4s, border-color .4s; }
.service:hover, .tribute:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(63,91,130,.12); border-color: var(--lavender); }
.story--text { font-size: 1.22rem; }
.story--dropcap p:first-child::first-letter { float: left; font-size: 3.6em; line-height: .85; padding: .06em .12em 0 0; color: var(--copper); }

/* ---------- gallery ---------- */
.chip { transition: background .25s, border-color .25s, transform .25s var(--ease); }
.chip:hover { transform: translateY(-2px); border-color: var(--lavender); }
.gallery__item { transition: transform .45s var(--ease), box-shadow .45s; }
.gallery__item:hover { transform: translateY(-5px); box-shadow: 0 16px 30px rgba(63,91,130,.25); z-index: 1; position: relative; }
.gallery__item img { opacity: 0; transition: opacity .7s ease, transform .9s var(--ease); }
.gallery__item img.loaded { opacity: 1; }
.gallery__item:hover img { transform: scale(1.07); }

/* ---------- form ---------- */
.field input[type="text"], .field textarea { transition: border-color .25s, box-shadow .25s, background .25s; }
.field input[type="text"]:focus, .field textarea:focus { outline: none; border-color: var(--slate-blue); box-shadow: 0 0 0 4px rgba(63,91,130,.12); background: #fff; }
.check { width: 72px; height: 72px; margin: 0 auto 8px; fill: none; stroke: #2e7d32; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.check circle { stroke-dasharray: 152; stroke-dashoffset: 152; }
.check path { stroke-dasharray: 40; stroke-dashoffset: 40; }

/* ---------- lightbox ---------- */
.lightbox__stage { overflow: hidden; }
.lightbox__play { top: 8px; right: 64px; font-size: 1rem; }
.lightbox__progress { position: absolute; left: 0; top: 0; height: 3px; width: 0; background: rgba(255,255,255,.75); z-index: 3; }

/* ---------- footer candle ---------- */
.footer { padding-top: 40px; }
.footer .footer__quote { max-width: 28em; margin: 0 auto 18px; text-align: center; font-style: italic; font-size: 1.2rem; }
.candle { position: relative; width: 70px; height: 120px; margin: 0 auto 14px; }
.candle__body { position: absolute; left: 50%; bottom: 0; width: 22px; height: 62px; margin-left: -11px; border-radius: 4px 4px 3px 3px; background: linear-gradient(90deg, #efe3c9, #fbf5e6 45%, #e6d8b8); box-shadow: inset 0 3px 4px rgba(155,107,79,.18); }
.candle__wick { position: absolute; left: 50%; bottom: 62px; width: 2px; height: 9px; margin-left: -1px; background: #4a3b30; }
.candle__flame { position: absolute; left: 50%; bottom: 69px; width: 14px; height: 30px; margin-left: -7px; border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%; background: linear-gradient(#fff8d6 0%, #f8c64f 55%, #e8862b 100%); transform-origin: 50% 100%; box-shadow: 0 0 18px 6px rgba(245,185,66,.5); }
.candle__glow { position: absolute; left: 50%; bottom: 46px; width: 130px; height: 130px; margin-left: -65px; border-radius: 50%; background: radial-gradient(circle, rgba(255,214,120,.35), transparent 68%); pointer-events: none; }

/* ---------- floating buttons / toast ---------- */
.music, .totop { position: fixed; bottom: 16px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line); background: #fff; color: var(--slate-blue); cursor: pointer; z-index: 55; box-shadow: 0 6px 18px rgba(63,91,130,.18); font-size: 1.2rem; display: grid; place-items: center; transition: transform .25s var(--ease), opacity .3s; }
.music { left: 16px; }
.totop { right: 16px; opacity: 0; pointer-events: none; transform: translateY(10px); }
.totop.show { opacity: 1; pointer-events: auto; transform: none; }
.music:hover, .totop:hover { transform: translateY(-3px); }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 16px; }
.eq i { display: block; width: 3px; height: 6px; border-radius: 2px; background: currentColor; }
.music.playing .eq i:nth-child(1) { animation: eq 0.9s ease-in-out infinite; }
.music.playing .eq i:nth-child(2) { animation: eq 0.9s ease-in-out .2s infinite; }
.music.playing .eq i:nth-child(3) { animation: eq 0.9s ease-in-out .4s infinite; }
.pubtoast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; background: #2d2d33; color: #fff; padding: 11px 20px; border-radius: 10px; z-index: 120; max-width: 90vw; font-size: 1rem; transition: opacity .3s, transform .4s var(--ease); pointer-events: none; }
.pubtoast.show { opacity: 1; transform: translate(-50%, 0); }

/* =====================================================================
   MOTION (only when the visitor has NOT asked for reduced motion)
   ===================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
  @keyframes riseScale { from { opacity: 0; transform: translateY(24px) scale(.94); } to { opacity: 1; transform: none; } }
  @keyframes letterIn { from { opacity: 0; transform: translateY(.55em) rotate(2deg); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
  @keyframes floralIn { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: scale(1); } }
  @keyframes sway { from { transform: rotate(-1.6deg) scale(1); } to { transform: rotate(1.8deg) scale(1.03); } }
  @keyframes ring { 0%, 100% { transform: scale(1); opacity: .95; } 50% { transform: scale(1.04); opacity: .3; } }
  @keyframes fall { 0% { transform: translate3d(0, -40px, 0) rotate(0); opacity: 0; } 10% { opacity: .6; } 90% { opacity: .45; } 100% { transform: translate3d(var(--x), 1000px, 0) rotate(560deg); opacity: 0; } }
  @keyframes cue { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(14px); opacity: 0; } 100% { opacity: 0; } }
  @keyframes flicker { 0%, 100% { transform: scale(1, 1) rotate(-1deg); } 20% { transform: scale(.93, 1.07) rotate(1.8deg); } 45% { transform: scale(1.05, .95) rotate(-1.4deg); } 70% { transform: scale(.96, 1.05) rotate(1deg); } }
  @keyframes glow { 0%, 100% { opacity: .8; transform: scale(1); } 50% { opacity: 1; transform: scale(1.08); } }
  @keyframes eq { 0%, 100% { height: 5px; } 50% { height: 16px; } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
  @keyframes pop { from { opacity: 0; transform: scale(.94) translateY(10px); } to { opacity: 1; transform: none; } }
  @keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
  @keyframes kb { 0% { opacity: 0; transform: scale(1); } 10% { opacity: 1; } 100% { opacity: 1; transform: scale(1.09); } }
  @keyframes photoIn { from { opacity: 0; transform: scale(1.025); } to { opacity: 1; transform: none; } }
  @keyframes prog { from { width: 0; } to { width: 100%; } }

  /* hero entrance */
  .js .hero__eyebrow { opacity: 0; animation: rise 1s var(--ease) .1s forwards; }
  .js .portrait-wrap { opacity: 0; animation: riseScale 1.3s var(--ease) .3s forwards; }
  .js .name-letter { opacity: 0; animation: letterIn .8s var(--ease) calc(.7s + var(--n) * 55ms) forwards; }
  .js .hero__dates { opacity: 0; animation: rise 1s var(--ease) 1.5s forwards; }
  .js .hero__age { opacity: 0; animation: rise 1s var(--ease) 1.7s forwards; }
  .js .hero__tagline { opacity: 0; animation: rise 1s var(--ease) 1.9s forwards; }
  .js .hero__actions { opacity: 0; animation: rise 1s var(--ease) 2.1s forwards; }
  .js .scrollcue { opacity: 0; animation: rise 1s ease 2.6s forwards; }
  .scrollcue span { animation: cue 2s ease-in-out 3s infinite; }

  .hero__floral { animation: floralIn 1.8s var(--ease) both, sway 10s ease-in-out 1.8s infinite alternate; }
  .hero__floral--tl { transform-origin: 0 0; }
  .hero__floral--tr { transform-origin: 100% 0; animation-duration: 1.8s, 12s; }
  .hero__floral--bl { transform-origin: 0 100%; animation-duration: 1.8s, 13s; }
  .hero__floral--br { transform-origin: 100% 100%; animation-duration: 1.8s, 11s; }

  .portrait-wrap::before { animation: ring 5.5s ease-in-out infinite; }
  .portrait-wrap::after { animation: ring 5.5s ease-in-out 1.4s infinite; }
  .petal { animation: fall var(--d) linear var(--delay) infinite; }

  /* scroll reveals */
  .js .reveal { opacity: 0; transform: translateY(28px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--rd, 0s); }
  .js .reveal.in { opacity: 1; transform: none; }
  .js .section__title.reveal::after { width: 0; transition: width 1.3s var(--ease) .25s; }
  .js .section__title.reveal.in::after { width: 120px; }

  /* footer candle */
  .candle__flame { animation: flicker 2.6s ease-in-out infinite; }
  .candle__glow { animation: glow 3.2s ease-in-out infinite; }

  /* thank-you checkmark */
  .thanks:not([hidden]) { animation: pop .6s var(--ease) both; }
  .thanks:not([hidden]) .check circle { animation: draw .8s ease .15s forwards; }
  .thanks:not([hidden]) .check path { animation: draw .5s ease .8s forwards; }

  /* lightbox */
  .lightbox:not([hidden]) { animation: lbIn .3s ease both; }
  .lightbox__img { animation: photoIn .6s var(--ease) both; }
  .lightbox.is-playing .lightbox__img { animation: kb 7s ease-out both; }
  .lightbox.is-playing .lightbox__progress { animation: prog var(--dur, 5.5s) linear forwards; }
}

@media (prefers-reduced-motion: reduce) {
  .petals, .scrollcue { display: none; }
  .check circle, .check path { stroke-dashoffset: 0; }
  .gallery__item img { opacity: 1; }
}

@media (max-width: 640px) {
  .hero { padding-top: 64px; min-height: auto; }
  .story--dropcap p:first-child::first-letter { font-size: 3em; }
}
