/* "Благотворителност" with hearts (parts/charity.php): the heading written out by hand under the waving flags with
   a beating heart and hearts rising behind; every good deed's picture comes alive and lets out hearts on a click. */

.give { position: relative; padding: 20px 0 80px; overflow: hidden; overflow: clip; display: flow-root; } /* clip: never scrolled sideways */
.bg .give__lead, .bg .deed__title { font-family: 'Neucha', Arial, sans-serif; }
/* hearts rising slowly behind everything */
.give__hearts i { position: absolute; z-index: 0; bottom: -40px; color: var(--c); font-size: var(--s); font-style: normal; line-height: 1; opacity: 0; animation: give-up var(--t) linear infinite; animation-delay: var(--d); pointer-events: none; }
@keyframes give-up { 0% { transform: translate(0, 0) rotate(-10deg); opacity: 0; } 10% { opacity: .35; } 50% { transform: translate(16px, -55vh) rotate(10deg); } 90% { opacity: .3; } 100% { transform: translate(-10px, -110vh) rotate(-8deg); opacity: 0; } }

/* ---------- The heading, written by hand ---------- */
.give__top { position: relative; z-index: 1; padding: 90px 0 30px; text-align: center; }
.give__flags { position: absolute; left: -2%; top: 0; width: 104%; height: 66px; background: url('../images/flags.svg') no-repeat center top / 100% 100%; transform-origin: top center; animation: give-flag 3s ease-in-out infinite alternate; }
@keyframes give-flag { from { transform: rotateX(30deg); } to { transform: rotateX(-30deg); } }
.give__lead { display: inline-flex; align-items: center; gap: 16px; margin: 0; font: 400 44px/1.25 'Cabin Sketch', Arial, sans-serif; color: #ff5736; }
.give__beat { flex: none; font-style: normal; font-size: 54px; line-height: 1; color: #ff5736; transform: scale(0); }
.is-in .give__beat { animation: give-pop .6s cubic-bezier(.34, 1.56, .64, 1) forwards, give-beat 1.4s ease-in-out .8s infinite; }
@keyframes give-pop { to { transform: scale(1); } }
@keyframes give-beat { 0%, 40%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 28% { transform: scale(1.08); } }
/* the words appear from left to right, as if written */
.give__ink { display: inline-block; clip-path: inset(-10% 100% -10% 0); }
.is-in .give__ink { animation: give-write 2.4s cubic-bezier(.45, .05, .55, .95) .3s forwards; }
@keyframes give-write { to { clip-path: inset(-10% -2% -10% 0); } }

/* ---------- The good deeds ---------- */
.give__grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 110px 34px; padding-top: 50px; }
.deed { position: relative; padding: 26px 34px 30px; border-radius: 30px; background: #fff; box-shadow: 0 24px 40px -26px rgba(60, 40, 20, .5); border-bottom: 6px solid var(--c); opacity: 0; transform: translateY(50px) rotate(calc(var(--k) * 2deg - 1deg)); transition: opacity .7s calc(var(--k) * .2s), transform 1s cubic-bezier(.34, 1.4, .64, 1) calc(var(--k) * .2s); }
.deed.is-in { opacity: 1; transform: none; }
.deed__title { margin: 6px 0 12px; font: 400 28px/1.25 'Cabin Sketch', Arial, sans-serif; color: var(--c); text-align: center; }
.deed p { margin: 0 0 10px; font-size: 16px; line-height: 1.75; color: #3c4741; }
.deed p:last-child { margin-bottom: 0; }
.deed__pic { position: relative; display: block; width: 260px; height: 190px; margin: -70px auto 0; padding: 0; border: 0; border-radius: 50%; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--c) 18%, #fff) 0 62%, transparent 63%); cursor: pointer; }
.deed__pic img { position: relative; z-index: 1; display: block; width: 100%; height: 100%; object-fit: contain; transform-origin: 50% 100%; }
/* each picture comes alive its own way */
.deed.is-in.deed--pic1 .deed__pic img { animation: give-wave 1.6s ease-in-out infinite alternate; }
.deed.is-in.deed--pic2 .deed__pic img { transform-origin: 60% 40%; animation: give-beat 1.6s ease-in-out infinite; }
.deed.is-in.deed--pic3 .deed__pic img { animation: give-bounce 2.2s cubic-bezier(.3, .7, .4, 1) infinite; }
.deed.is-in.deed--pic4 .deed__pic img { animation: give-sway 3s ease-in-out infinite alternate; }
.deed.is-in.deed--pic0 .deed__pic img { animation: give-bounce 2.6s ease-in-out infinite; }
@keyframes give-wave { 0% { transform: rotate(-2.5deg) skewX(2deg); } 100% { transform: rotate(2.5deg) skewX(-3deg); } }
@keyframes give-bounce { 0%, 60%, 100% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(-16px) scale(.97, 1.04); } 40% { transform: translateY(0) scale(1.05, .95); } }
@keyframes give-sway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }
/* the two pictures drawn for the site (parts/charity.php, mch_charity_drawing) */
.deed__svg { position: relative; z-index: 1; display: block; width: 100%; height: 100%; overflow: visible; }
/* (only the moving parts get a box of their own: the inner groups keep their own rotate(… x y)) */
.vol__heart, .vol__tool, .xmas__tree, .xmas__star, .xmas__gift, .xmas__balls circle { transform-box: fill-box; transform-origin: 50% 50%; }
/* the volunteers: the heart beats, their tools float round it */
.deed.is-in .vol__heart { animation: give-beat 1.6s ease-in-out infinite; }
.deed.is-in .vol__tool { animation: give-float 3.2s ease-in-out infinite alternate; }
.vol__tool--trowel { animation-delay: -.8s !important; }
.vol__tool--ball { animation-delay: -1.6s !important; animation-duration: 2.6s !important; }
.vol__tool--pencil { animation-delay: -2.4s !important; }
@keyframes give-float { from { transform: translate(0, 0) rotate(-6deg); } to { transform: translate(0, -9px) rotate(6deg); } }
.deed--vol .deed__pic:hover .vol__tool { animation-duration: 1s !important; }
/* the Christmas tree: it sways a little, its star twinkles, the baubles glint, snow falls */
.xmas__tree { transform-origin: 50% 100% !important; }
.deed.is-in .xmas__tree { animation: give-sway 4s ease-in-out infinite alternate; }
.deed.is-in .xmas__star { animation: give-star 2.4s ease-in-out infinite; }
@keyframes give-star { 0%, 100% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 0 rgba(255, 210, 60, 0)); } 50% { transform: scale(1.18) rotate(14deg); filter: drop-shadow(0 0 8px rgba(255, 210, 60, .9)); } }
.deed.is-in .xmas__balls circle { animation: give-glint 1.8s ease-in-out infinite alternate; }
.xmas__balls circle:nth-child(2n) { animation-delay: -.9s !important; }
.xmas__balls circle:nth-child(3n) { animation-delay: -.4s !important; }
@keyframes give-glint { from { opacity: 1; } to { opacity: .55; } }
.deed.is-in .xmas__gift { animation: give-hop 3s ease-in-out infinite; transform-origin: 50% 100% !important; }
.xmas__gift--small { animation-delay: -1.5s !important; }
@keyframes give-hop { 0%, 70%, 100% { transform: translateY(0) scale(1, 1); } 80% { transform: translateY(-7px) scale(.97, 1.03); } 90% { transform: translateY(0) scale(1.04, .96); } }
.deed__snow i { position: absolute; z-index: 2; top: 0; left: var(--x); width: var(--s); height: var(--s); border-radius: 50%; background: #fff; box-shadow: 0 0 0 1.5px rgba(82, 170, 232, .45); opacity: 0; animation: give-snow var(--t) linear var(--d) infinite; }
.deed__snow i:nth-child(1) { --x: 8%; --s: 7px; --t: 5.5s; --d: 0s; }
.deed__snow i:nth-child(2) { --x: 22%; --s: 5px; --t: 6.5s; --d: -2s; }
.deed__snow i:nth-child(3) { --x: 34%; --s: 8px; --t: 5s; --d: -3.5s; }
.deed__snow i:nth-child(4) { --x: 47%; --s: 5px; --t: 7s; --d: -1s; }
.deed__snow i:nth-child(5) { --x: 60%; --s: 6px; --t: 6s; --d: -4.5s; }
.deed__snow i:nth-child(6) { --x: 72%; --s: 8px; --t: 5.2s; --d: -2.6s; }
.deed__snow i:nth-child(7) { --x: 84%; --s: 5px; --t: 6.8s; --d: -.6s; }
.deed__snow i:nth-child(8) { --x: 93%; --s: 6px; --t: 5.8s; --d: -3.2s; }
.deed__snow i:nth-child(9) { --x: 15%; --s: 6px; --t: 6.2s; --d: -5s; }
@keyframes give-snow { 0% { transform: translate(0, -10px); opacity: 0; } 10% { opacity: 1; } 50% { transform: translate(8px, 90px); } 85% { opacity: 1; } 100% { transform: translate(-6px, 180px); opacity: 0; } }

/* little hearts rising from the hands */
.deed__rise i { position: absolute; z-index: 2; bottom: 55%; color: #ff5736; font-style: normal; font-size: 20px; line-height: 1; opacity: 0; animation: give-rise 3s ease-out infinite; }
.deed__rise i:nth-child(1) { left: 28%; } .deed__rise i:nth-child(2) { left: 50%; animation-delay: 1s; font-size: 15px; color: #ff7b05; } .deed__rise i:nth-child(3) { left: 70%; animation-delay: 2s; color: #8763be; }
.deed--vol .deed__rise i { bottom: 45%; }
@keyframes give-rise { 0% { transform: translateY(0) scale(.5); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(14px, -90px) scale(1.1); opacity: 0; } }
/* sparks twinkling round the gift */
.deed__sparks i { position: absolute; z-index: 2; color: #ffb300; font-style: normal; font-size: 20px; line-height: 1; animation: give-twinkle 1.6s ease-in-out infinite alternate; }
.deed__sparks i:nth-child(1) { left: 66%; top: 46%; } .deed__sparks i:nth-child(2) { left: 84%; top: 58%; animation-delay: -.5s; font-size: 14px; } .deed__sparks i:nth-child(3) { left: 72%; top: 86%; animation-delay: -1s; } .deed__sparks i:nth-child(4) { left: 92%; top: 78%; animation-delay: -.2s; font-size: 12px; }
@keyframes give-twinkle { from { transform: scale(.4) rotate(0); opacity: .3; } to { transform: scale(1.2) rotate(45deg); opacity: 1; } }
/* a butterfly round the tulips */
.deed__fly { position: absolute; z-index: 2; left: 50%; top: 40%; width: 64px; height: 64px; margin: -32px 0 0 -32px; offset-path: path('M -90 0 C -90 -60, 90 -60, 90 0 C 90 50, -90 50, -90 0'); offset-rotate: 0deg; animation: give-orbit 9s linear infinite; pointer-events: none; }
@keyframes give-orbit { to { offset-distance: 100%; } }

/* ---------- Smaller screens ---------- */
@media only screen and (max-width: 1100px) {
	.give__lead { font-size: 36px; }
	.deed__pic { width: 220px; height: 160px; }
}
@media only screen and (max-width: 768px) {
	.give__top { padding-top: 64px; }
	.give__flags { height: 44px; }
	.give__lead { gap: 10px; font-size: 27px; }
	.give__beat { font-size: 34px; }
	.give__grid { grid-template-columns: 1fr; gap: 90px; padding-top: 90px; }
	.deed { padding: 20px 22px 24px; }
	.deed__title { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
	.give *, .give *::before, .give *::after { animation: none !important; transition: none !important; }
	.deed { opacity: 1 !important; transform: none !important; }
	.give__ink { clip-path: none; } .give__beat { transform: none; }
	.give__hearts, .deed__rise, .deed__fly, .deed__snow { display: none; }
}
