/* Brotes: ink drawings that grow from the pointer when you click or tap (see brotes.js). */
body { position: relative; }
.brotes {
  position: absolute; inset: 0; z-index: 20;
  overflow: hidden; pointer-events: none;
}

.brote { position: absolute; pointer-events: none; }
.brote-in { width: 100%; height: 100%; transform-origin: 50% 50%; }
.k-suelo .brote-in { transform-origin: 50% 98%; }
.brote svg { display: block; width: 100%; height: 100%; overflow: visible; }
.brote path, .brote circle {
  fill: none; stroke: #111; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 1 1.05; stroke-dashoffset: 1;
  animation: k-trazo .55s cubic-bezier(.45, 0, .3, 1) both;
}
.brote .w { fill: #fff; fill-opacity: 0; animation-name: k-trazo, k-relleno; }
.brote .n { fill: #111; fill-opacity: 0; animation-name: k-trazo, k-relleno; }

/* grow with a little bounce, then a quiet idle movement of its own */
.brote-in {
  animation:
    k-brota .6s cubic-bezier(.3, 1.5, .6, 1) both,
    k-mece var(--ritmo, 3s) ease-in-out .6s infinite alternate;
}
.b-corazon .brote-in { animation-name: k-brota, k-late; animation-duration: .6s, 1.1s; }
.b-arcoiris .brote-in { animation-name: k-brota, k-respira; }
.b-conejo .brote-in { animation-name: k-brota, k-salta; animation-duration: .6s, 1.4s; animation-timing-function: cubic-bezier(.3, 1.5, .6, 1), ease-out; }
.b-pony .brote-in, .b-unicornio .brote-in { animation-name: k-brota, k-trota; animation-duration: .6s, .9s; }
.b-mariposa .brote-in { animation-name: k-brota, k-aletea; animation-duration: .6s, .22s; }
.b-pajaro .ala { transform-box: view-box; transform-origin: 56px 52px; animation: k-ala .3s ease-in-out .6s infinite alternate; }

/* birds and butterflies take off after a moment */
.k-vuela { animation: k-vuela var(--vuelo, 4s) cubic-bezier(.4, 0, .7, 1) var(--espera, 1s) forwards; }

.brote.chau { opacity: 0; transition: opacity .9s ease; }
.brote.chau-ya { opacity: 0; transition: opacity .3s ease; }

@keyframes k-trazo { to { stroke-dashoffset: 0; } }
@keyframes k-relleno { 0%, 40% { fill-opacity: 0; } 100% { fill-opacity: 1; } }
@keyframes k-brota { 0% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes k-mece { 0% { transform: rotate(-3deg); } 100% { transform: rotate(3deg); } }
@keyframes k-late { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(.96); } 45% { transform: scale(1.08); } }
@keyframes k-respira { 0% { transform: scale(1); } 100% { transform: scale(1.05) translateY(-2%); } }
@keyframes k-salta { 0%, 55%, 100% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(-12%) scale(.96, 1.05); } 40% { transform: translateY(0) scale(1.05, .95); } }
@keyframes k-trota { 0% { transform: translateY(0) rotate(-1.5deg); } 50% { transform: translateY(-4%) rotate(1.5deg); } 100% { transform: translateY(0) rotate(-1.5deg); } }
@keyframes k-aletea { 0% { transform: scaleX(1); } 100% { transform: scaleX(.35); } }
@keyframes k-ala { 0% { transform: rotate(8deg); } 100% { transform: rotate(-38deg) scaleY(.8); } }
@keyframes k-vuela {
  0% { transform: translate(0, 0); opacity: 1; }
  30% { transform: translate(calc(var(--dx) * .25), calc(var(--dy) * .2 - 20px)); }
  60% { transform: translate(calc(var(--dx) * .6), calc(var(--dy) * .55 + 10px)); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* reduced motion: drawings just appear and fade; nothing flies, draws in or wiggles */
@media (prefers-reduced-motion: reduce) {
  .brote path, .brote circle { animation: none; stroke-dashoffset: 0; fill-opacity: 1; }
  .brote-in, .b-pajaro .ala { animation: none !important; }
  .brote { animation: k-aparece .3s ease both !important; }
  .k-vuela { animation: k-aparece .3s ease both, k-desvanece .8s ease 2.5s forwards !important; }
}
@keyframes k-aparece { from { opacity: 0; } to { opacity: 1; } }
@keyframes k-desvanece { to { opacity: 0; } }
