/* All ritual coordinates originate at the wick and scale with the candle. */
.candle-button { overflow: visible; }
.candle-button[aria-disabled="true"] { cursor: progress; }
.candle-ritual { position: absolute; left: 77px; bottom: 177px; width: 0; height: 0; pointer-events: none; z-index: 4; }
.candle-ritual svg { display: block; max-width: none; stroke: none; stroke-width: 1; fill: none; }
.ritual-matchbox { position: absolute; left: -152px; top: -30px; width: 140px; height: 160px; opacity: 0; filter: drop-shadow(3px 7px 6px #59415c20); }
.ritual-matchbox svg { width: 140px; height: 160px; }
.ritual-match { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; }
.match-stick { position: absolute; left: -9px; top: -44px; width: 100px; height: 62px; overflow: visible; }
.match-head { transition: fill .15s; }
.match-fire { position: absolute; left: -9px; bottom: 1px; width: 18px; height: 32px; opacity: 0; transform-origin: 50% 100%; }
.match-fire > span { display: block; width: 100%; height: 100%; border-radius: 53% 47% 43% 47% / 74% 74% 26% 26%; background: radial-gradient(ellipse at 48% 88%, #fffef0 0 17%, #ffe7a0 39%, #efb064 68%, #d98749 95%); box-shadow: 0 0 9px #f5c67d99, 0 0 25px #f0bc693b; transform-origin: bottom; }
.match-sparks { position: absolute; left: 0; top: 0; }
.match-sparks i { position: absolute; left: 0; top: 0; width: 2px; height: 2px; background: #ffdfa0; border-radius: 50%; box-shadow: 0 0 4px #ffc266; opacity: 0; --spark-x: -15px; --spark-y: -23px; }
.match-sparks i:nth-child(2) { --spark-x: 9px; --spark-y: -30px; }
.match-sparks i:nth-child(3) { --spark-x: -22px; --spark-y: -8px; }
.match-sparks i:nth-child(4) { --spark-x: 17px; --spark-y: -16px; }
.match-sparks i:nth-child(5) { --spark-x: -6px; --spark-y: -36px; }
.candle-scene.is-striking .ritual-matchbox { animation: matchbox-appear 2.6s ease both; }
.candle-scene.is-striking .ritual-match { animation: match-journey 2.6s linear both; }
.candle-scene.is-striking .match-fire { animation: match-ignite 2.6s linear both; }
.candle-scene.is-striking .match-fire > span { animation: match-flicker .23s ease-in-out infinite alternate; }
.candle-scene.is-striking .match-head { animation: match-char 2.6s both; }
.candle-scene.is-striking .match-sparks i { animation: match-spark .38s .76s ease-out both; }
.candle-scene .flame-wrap { transition: opacity .3s, transform .5s cubic-bezier(.2,.7,.3,1); }
.candle-scene .wick { z-index: 2; }
.candle-scene .wick::after { content: ''; position: absolute; top: -1px; left: 0; width: 3px; height: 4px; border-radius: 50%; background: #d68b67; opacity: 0; box-shadow: 0 0 6px #df925e; }
.candle-scene.is-lit .wick::after { opacity: .7; }
.candle-breath { position: absolute; left: -151px; top: -38px; width: 150px; height: 70px; opacity: 0; }
.candle-breath path { fill: none; stroke: #b2a0bd; stroke-width: 1.2; stroke-dasharray: 150; stroke-dashoffset: 150; }
.candle-scene.is-blowing .candle-breath { animation: candle-breath .65s ease-out both; }
.candle-scene.is-blowing .candle-breath path { animation: breath-stroke .65s ease-out both; }
.candle-scene.is-blowing .flame-wrap { animation: candle-blow-out .6s ease-in forwards; transition: none; }
.candle-scene.is-blowing .flame { animation: none; }
.candle-smoke { position: absolute; left: -50px; top: -169px; width: 120px; height: 170px; overflow: visible; opacity: 0; }
.smoke-wisp { --smoke-density: .72; transform-origin: 50px 166px; opacity: 0; stroke-dasharray: 210; stroke-dashoffset: 210; }
.candle-scene.is-smoking .candle-smoke { opacity: 1; }
.candle-scene.is-smoking .smoke-wisp { animation: smoke-rise 2.9s ease-out both; }
.candle-scene.is-smoking .smoke-wisp-two { --smoke-density: .32; animation-delay: .2s; animation-duration: 3s; }
.candle-scene.is-smoking .smoke-wisp-three { --smoke-density: .28; animation-delay: .45s; animation-duration: 2.6s; }
.candle-scene.is-smoking .wick::after { animation: wick-cool 1.8s ease-out both; }
.candle-hint { min-height: 29px; text-align: center; }
@keyframes matchbox-appear {
  0% { opacity: 0; transform: translate(-10px, 12px) rotate(-6deg); }
  12%, 63% { opacity: 1; transform: none; }
  86%, 100% { opacity: 0; transform: translate(-8px, 12px) rotate(-4deg); }
}
@keyframes match-journey {
  0%, 6% { opacity: 0; transform: translate(-87px, 116px); }
  15% { opacity: 1; transform: translate(-78px, 108px); }
  22% { opacity: 1; transform: translate(-67px, 92px); }
  30% { opacity: 1; transform: translate(-36px, 35px); }
  38% { opacity: 1; transform: translate(-32px, 17px); }
  48% { opacity: 1; transform: translate(-23px, 6px); }
  60%, 73% { opacity: 1; transform: translate(-1px, 3px); }
  85% { opacity: .9; transform: translate(29px, -17px); }
  100% { opacity: 0; transform: translate(57px, -32px); }
}
@keyframes match-ignite {
  0%, 28% { opacity: 0; transform: scale(.15); }
  31% { opacity: 1; transform: scale(1.25, 1.1); }
  37%, 80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.5); }
}
@keyframes match-char { 0%, 29% { fill: #b62f42; } 35%, 100% { fill: #594744; } }
@keyframes match-flicker { from { transform: rotate(-4deg) scaleY(.94); } to { transform: rotate(5deg) scaleY(1.06); } }
@keyframes match-spark { 0% { opacity: 0; transform: scale(.3); } 12% { opacity: 1; } 100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) scale(.1); } }
@keyframes candle-breath { 0% { opacity: 0; transform: translateX(-14px); } 35% { opacity: .5; } 100% { opacity: 0; transform: translateX(17px); } }
@keyframes breath-stroke { to { stroke-dashoffset: -150; } }
@keyframes candle-blow-out {
  0% { opacity: 1; transform: scale(1); }
  28% { opacity: 1; transform: skewX(-22deg) rotate(18deg) scale(1.05,.88); }
  52% { opacity: .85; transform: skewX(-32deg) rotate(43deg) scale(1.1,.7); }
  78% { opacity: .4; transform: rotate(65deg) scale(.7,.35); }
  100% { opacity: 0; transform: rotate(78deg) scale(.2,.06); }
}
@keyframes smoke-rise {
  0% { opacity: 0; stroke-dashoffset: 210; transform: translate(0, 0) scale(.55,.65); }
  12% { opacity: var(--smoke-density); }
  40% { opacity: var(--smoke-density); stroke-dashoffset: 0; transform: translate(4px,-4px) scale(.85,.9) skewX(-4deg); }
  70% { opacity: calc(var(--smoke-density) * .5); stroke-dashoffset: 0; transform: translate(-5px,-22px) scale(1.13,1.08) skewX(6deg); }
  100% { opacity: 0; stroke-dashoffset: -20; transform: translate(13px,-53px) scale(1.4,1.25) skewX(-3deg); }
}
@keyframes wick-cool { 0%, 15% { opacity: .85; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .candle-ritual { display: none; }
  .candle-scene .flame-wrap, .candle-scene .flame { animation: none !important; transition: none !important; }
}
