/* =====================================================================
   HOUSE OF ANIE — animações (CSS)
   As sequências maiores (envelope, pena) são controladas em js/animations.js
   ===================================================================== */

@keyframes candle-breathe { 0%, 100% { opacity: .9; transform: scale(1); } 40% { opacity: 1; transform: scale(1.03); } 70% { opacity: .82; transform: scale(.99); } }
@keyframes flame-flicker {
  0%, 100% { transform: translateX(-50%) scale(1, 1) rotate(0); }
  20% { transform: translateX(-50%) scale(.94, 1.06) rotate(-2deg); }
  45% { transform: translateX(-50%) scale(1.04, .95) rotate(1.5deg); }
  70% { transform: translateX(-50%) scale(.97, 1.04) rotate(-1deg); }
}
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@keyframes envelope-idle { 0%, 100% { transform: rotate(-2.2deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-3px); } }
@keyframes seal-glow { 0%, 100% { filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); } 50% { filter: drop-shadow(0 0 14px rgba(255, 190, 120, .75)) drop-shadow(0 3px 3px rgba(0, 0, 0, .45)); } }
@keyframes seal-wait { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes sig-wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ready-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }

/* Tela inicial */
.entry .envelope { animation: envelope-idle 6s ease-in-out infinite; }
.entry.is-loading .seal-half { animation: seal-wait 1.1s ease-in-out infinite; }
.entry-head, .unlock { animation: fade-up .9s var(--ease-paper) both; }
.unlock { animation-delay: .25s; }
.shake { animation: shake .42s ease-in-out; }

/* Durante a abertura */
.entry.is-opening .envelope { animation: none; }
@keyframes fade-out { to { opacity: 0; transform: translateY(14px); } }
.entry.is-opening .unlock, .entry.is-opening .entry-head { animation: fade-out .7s var(--ease-paper) forwards; pointer-events: none; }
.entry.is-opening .seal-half { animation: seal-glow 1.2s ease-in-out 1; }

/* Escrita com pena: cada palavra é revelada por máscara */
.ink .w { display: inline-block; clip-path: inset(-20% 100% -30% 0); color: var(--ink-wet); transition: color 1.6s ease-out; }
.ink .w.is-done { clip-path: none; color: inherit; }
.ink .w.is-wet { color: var(--ink-wet); }
.ink.is-written .w { clip-path: none; color: inherit; transition: none; }
.ink { white-space: normal; }

/* Elementos que aparecem quando a pena chega neles */
[data-reveal] { opacity: 0; transform: translateY(6px); transition: opacity .8s var(--ease-paper), transform .8s var(--ease-paper); }
[data-reveal].is-live { opacity: 1; transform: none; }
.skill-stages svg { transform: scale(.85); }
.skill.is-live .skill-stages svg { transform: scale(1); }
.skill.is-live .skill-stages svg:nth-child(2) { transition-delay: .15s; }
.skill.is-live .skill-stages svg:nth-child(3) { transition-delay: .3s; }
.skill.is-live .skill-stages svg:nth-child(4) { transition-delay: .45s; }
.skill:not(.is-live) .skill-stages svg.on { color: rgba(151, 153, 82, .22); }
.signature-img { clip-path: inset(0 100% 0 0); }
.is-live .signature-img, .signature-img.is-live { animation: sig-wipe 2.2s cubic-bezier(.45, .05, .4, 1) forwards; }
.chapter.is-complete .signature-img { animation: none; clip-path: none; }
.chapter.is-complete [data-reveal] { opacity: 1; transform: none; }
.chapter.is-complete .skill-stages svg { transform: none; }
.ctl.is-ready { animation: ready-pulse 1.8s ease-in-out 3; }

/* Acessibilidade: menos movimento */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .15s !important; }
  .room-glow, .flame { animation: none !important; }
  .ink .w { clip-path: none; color: inherit; }
  [data-reveal] { opacity: 1; transform: none; }
  .signature-img { clip-path: none; }
}
