/* "Методът Монтесори" as observing the child (parts/method.php): a magnifying glass goes slowly over the heading and
   enlarges the words under it (a second copy of the words, scaled round the lens' centre and cut to its circle); the
   four planes of development rise as steps with a ball hopping up them; the two sayings in speech bubbles; a bulb that
   lights over "Знаете ли, че?". */

@property --mx { syntax: '<length-percentage>'; inherits: true; initial-value: 14%; }
@property --my { syntax: '<length-percentage>'; inherits: true; initial-value: 30%; }

.mth { position: relative; padding: 30px 0 80px; overflow: hidden; }
.bg .mth .mth__words, .bg .mth .mth__bubble, .bg .mth .mth__fact-title, .bg .mth .mth__step b, .bg .mth .mth__step em { font-family: 'Neucha', Arial, sans-serif; }

/* ---------- The heading under the magnifying glass ---------- */
.mth__lead { position: relative; display: grid; max-width: 1000px; padding: 30px 20px 40px; opacity: 0; transform: translateY(24px); transition: opacity .8s, transform 1s cubic-bezier(.34, 1.3, .64, 1); }
.mth__lead.is-in { opacity: 1; transform: none; animation: mth-scan 18s ease-in-out 1.2s infinite alternate; }
.mth__lead > * { grid-area: 1 / 1; }
.mth .mth__words { margin: 0; font: 400 38px/1.4 'Cabin Sketch', Arial, sans-serif; text-align: center; color: #3c4741; }
/* the enlarged copy: only what is inside the lens shows */
.mth .mth__words--big { color: #2b5f8a; background: #fffdf6; transform: scale(1.32); transform-origin: var(--mx) var(--my); clip-path: circle(60px at var(--mx) var(--my)); /* the whole glass inside the rim: no ring of the small words under it */ opacity: 0; transition: opacity .8s 1s; pointer-events: none; }
.mth__lens { position: relative; opacity: 0; transition: opacity .8s 1s; pointer-events: none; }
.mth__lead.is-in .mth__words--big, .mth__lead.is-in .mth__lens { opacity: 1; }
.mth__lens::before { content: ''; position: absolute; left: var(--mx); top: var(--my); width: 138px; height: 138px; margin: -69px 0 0 -69px; border: 9px solid #a8713c; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 45%), rgba(190, 225, 250, .12); box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .5), 0 10px 18px -6px rgba(60, 40, 20, .45); }
.mth__lens::after { content: ''; position: absolute; left: var(--mx); top: var(--my); width: 18px; height: 78px; margin-left: -9px; border-radius: 9px; background: linear-gradient(90deg, #8a5a2c, #c38a52 50%, #8a5a2c); transform-origin: 50% 0; transform: rotate(-45deg) translateY(66px); box-shadow: 0 6px 10px -4px rgba(60, 40, 20, .5); }
@keyframes mth-scan {
	0% { --mx: 14%; --my: 28%; }
	20% { --mx: 46%; --my: 22%; }
	40% { --mx: 84%; --my: 34%; }
	60% { --mx: 62%; --my: 62%; }
	80% { --mx: 30%; --my: 70%; }
	100% { --mx: 12%; --my: 52%; }
}

/* ---------- The cards ---------- */
.mth__flow { display: flex; flex-direction: column; gap: 56px; margin-top: 30px; }
.mth__card { position: relative; padding: 30px 36px; border-radius: 28px; background: #fff; box-shadow: 0 22px 36px -22px rgba(60, 40, 20, .5); border-left: 6px solid var(--c); }
.mth .mth__card p { margin: 0; font-size: 18px; line-height: 1.8; color: #3c4741; }
.mth__card--plain { width: 76%; opacity: 0; transform: translateX(-50px); transition: opacity .7s, transform 1s cubic-bezier(.34, 1.3, .64, 1); }
.mth__card--plain.is-right { align-self: flex-end; border-left: 0; border-right: 6px solid var(--c); transform: translateX(50px); }
.mth__card--plain.is-in { opacity: 1; transform: none; }

/* ---------- The four planes: steps that rise, a ball that hops up them ---------- */
.mth__planes { display: grid; grid-template-columns: 1fr 1.05fr; gap: 44px; align-items: center; }
.mth__planes .mth__card { opacity: 0; transform: translateX(-40px); transition: opacity .7s, transform 1s cubic-bezier(.34, 1.3, .64, 1); }
.mth__planes.is-in .mth__card { opacity: 1; transform: none; }
.mth__steps { position: relative; display: flex; align-items: flex-end; gap: 10px; height: 330px; padding-bottom: 46px; }
.mth__step { position: relative; flex: 1; height: calc((var(--k) + 1) * 64px); border-radius: 12px 12px 4px 4px; background: linear-gradient(var(--c), color-mix(in srgb, var(--c) 80%, #000)); box-shadow: inset 0 6px 0 rgba(255, 255, 255, .25), 0 14px 20px -12px rgba(60, 40, 20, .5); transform-origin: 50% 100%; transform: scaleY(0); transition: transform .8s cubic-bezier(.34, 1.4, .64, 1) calc(.3s + var(--k) * .25s); }
.mth__planes.is-in .mth__step { transform: none; }
.mth .mth__step b { display: block; padding-top: 12px; font: 400 26px/1 'Cabin Sketch', Arial, sans-serif; text-align: center; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.mth .mth__step em { position: absolute; left: -6px; right: -6px; top: 100%; margin-top: 10px; font: 400 18px/1.15 'Cabin Sketch', Arial, sans-serif; font-style: normal; text-align: center; color: #3c4741; }
.mth__ball { position: absolute; left: 12.5%; bottom: calc(46px + 64px); width: 42px; height: 42px; margin-left: -21px; background: url('../images/ball.svg') no-repeat center / contain; opacity: 0; }
.mth__planes.is-in .mth__ball { animation: mth-hop 7s ease-in-out 2s infinite; }
@keyframes mth-hop {
	0% { left: 12.5%; bottom: 110px; opacity: 0; transform: rotate(0); }
	6% { opacity: 1; }
	12% { left: 25%; bottom: 210px; transform: rotate(120deg); }
	18% { left: 37.5%; bottom: 174px; transform: rotate(240deg) scale(1.1, .9); }
	27% { left: 50%; bottom: 274px; transform: rotate(360deg); }
	33% { left: 62.5%; bottom: 238px; transform: rotate(480deg) scale(1.1, .9); }
	42% { left: 75%; bottom: 338px; transform: rotate(600deg); }
	48% { left: 87.5%; bottom: 302px; transform: rotate(720deg) scale(1.1, .9); }
	54% { left: 87.5%; bottom: 330px; transform: rotate(720deg); }
	60% { left: 87.5%; bottom: 302px; transform: rotate(720deg); }
	80% { left: 87.5%; bottom: 302px; opacity: 1; transform: rotate(720deg); }
	88%, 100% { left: 87.5%; bottom: 302px; opacity: 0; transform: rotate(720deg); }
}

/* ---------- The two sayings ---------- */
.mth__quotes { display: flex; align-items: center; gap: 40px; }
.mth__bubbles { flex: none; display: flex; flex-direction: column; gap: 30px; width: 400px; }
.mth .mth__bubble { position: relative; align-self: flex-start; padding: 22px 30px; border-radius: 34px; background: var(--c); color: #fff; font: 400 30px/1.25 'Cabin Sketch', Arial, sans-serif; box-shadow: 0 16px 26px -16px rgba(60, 40, 20, .6); opacity: 0; transform: scale(.4) rotate(-6deg); transform-origin: 20% 100%; transition: opacity .4s calc(.3s + var(--k) * .5s), transform .7s cubic-bezier(.34, 1.7, .64, 1) calc(.3s + var(--k) * .5s); }
.mth .mth__bubble:nth-child(2) { align-self: flex-end; transform-origin: 80% 100%; }
.mth__bubble::after { content: ''; position: absolute; left: 36px; bottom: -16px; border: 10px solid transparent; border-top: 14px solid var(--c); border-left-width: 4px; }
.mth__bubble:nth-child(2)::after { left: auto; right: 36px; border-left-width: 10px; border-right-width: 4px; }
.mth__quotes.is-in .mth__bubble { opacity: 1; transform: none; animation: mth-float 3.6s ease-in-out calc(1.4s + var(--k) * .9s) infinite alternate; }
@keyframes mth-float { from { translate: 0 0; } to { translate: 0 -8px; } }
.mth__quotes .mth__card { flex: 1; min-width: 0; opacity: 0; transform: translateX(40px); transition: opacity .7s .2s, transform 1s cubic-bezier(.34, 1.3, .64, 1) .2s; }
.mth__quotes.is-in .mth__card { opacity: 1; transform: none; }

/* ---------- Did you know? ---------- */
.mth__fact { position: relative; align-self: center; max-width: 960px; padding: 40px 46px 34px 140px; border-radius: 30px; background: linear-gradient(135deg, #fffbe3, #fff3c4); box-shadow: 0 22px 36px -22px rgba(120, 90, 0, .45); opacity: 0; transform: translateY(40px); transition: opacity .7s, transform 1s cubic-bezier(.34, 1.3, .64, 1); }
.mth__fact.is-in { opacity: 1; transform: none; }
.mth .mth__fact-title { margin: 0 0 14px; font: 400 36px/1.2 'Cabin Sketch', Arial, sans-serif; color: #d79a00; }
.mth .mth__fact p { margin: 0 0 12px; font-size: 17px; line-height: 1.8; color: #4f4a32; }
.mth .mth__fact p:last-child { margin-bottom: 0; }
/* the bulb: grey, then it lights and its rays turn */
.mth__bulb { position: absolute; left: 44px; top: 40px; width: 62px; height: 78px; border-radius: 50% 50% 44% 44% / 56% 56% 44% 44%; background: radial-gradient(circle at 38% 32%, #fff 0 14%, #e4e7ea 40%, #cfd5da); transition: background .2s 1s, box-shadow .6s 1s; }
.mth__bulb::before { content: ''; position: absolute; left: 18px; bottom: -16px; width: 26px; height: 20px; border-radius: 3px 3px 8px 8px; background: repeating-linear-gradient(#7d8790 0 4px, #a3acb4 4px 7px); }
.mth__bulb::after { content: ''; position: absolute; left: 50%; top: 42%; width: 170px; height: 170px; margin: -85px 0 0 -85px; border-radius: 50%; background: repeating-conic-gradient(rgba(255, 200, 40, .5) 0 8deg, transparent 8deg 30deg); -webkit-mask: radial-gradient(circle, transparent 0 46px, #000 47px 80px, transparent 82px); mask: radial-gradient(circle, transparent 0 46px, #000 47px 80px, transparent 82px); opacity: 0; transition: opacity .6s 1.1s; }
.mth__fact.is-in .mth__bulb { background: radial-gradient(circle at 38% 32%, #fff 0 18%, #fff2a8 42%, #ffd23f); box-shadow: 0 0 30px 12px rgba(255, 210, 63, .55); }
.mth__fact.is-in .mth__bulb::after { opacity: 1; animation: mth-rays 14s linear 1.2s infinite; }
@keyframes mth-rays { to { rotate: 360deg; } }

/* ---------- Smaller screens ---------- */
@media only screen and (max-width: 1100px) {
	.mth .mth__words { font-size: 32px; }
	.mth__planes { grid-template-columns: 1fr; }
	.mth__steps { max-width: 560px; width: 100%; margin: 0 auto; }
	.mth__quotes { flex-direction: column; align-items: stretch; }
	.mth__bubbles { width: auto; max-width: 520px; align-self: center; }
}
@media only screen and (max-width: 768px) {
	.mth .mth__words { font-size: 25px; }
	.mth .mth__words--big { clip-path: circle(46px at var(--mx) var(--my)); }
	.mth__lens::before { width: 106px; height: 106px; margin: -53px 0 0 -53px; border-width: 7px; }
	.mth__lens::after { width: 14px; height: 60px; margin-left: -7px; transform: rotate(-45deg) translateY(50px); }
	.mth__flow { gap: 44px; }
	.mth__card, .mth__card--plain, .mth__card--plain.is-right { width: auto; padding: 24px 22px; border-right: 0; border-left: 6px solid var(--c); }
	.mth .mth__card p { font-size: 16px; }
	.mth__steps { gap: 6px; height: 300px; }
	.mth__step { height: calc((var(--k) + 1) * 56px); }
	.mth .mth__step b { font-size: 19px; }
	.mth .mth__step em { font-size: 14px; }
	.mth__planes.is-in .mth__ball { animation-name: mth-hop-s; }
	@keyframes mth-hop-s {
		0% { left: 12.5%; bottom: 102px; opacity: 0; transform: rotate(0); }
		6% { opacity: 1; }
		12% { left: 25%; bottom: 190px; transform: rotate(120deg); }
		18% { left: 37.5%; bottom: 158px; transform: rotate(240deg) scale(1.1, .9); }
		27% { left: 50%; bottom: 246px; transform: rotate(360deg); }
		33% { left: 62.5%; bottom: 214px; transform: rotate(480deg) scale(1.1, .9); }
		42% { left: 75%; bottom: 302px; transform: rotate(600deg); }
		48%, 80% { left: 87.5%; bottom: 270px; opacity: 1; transform: rotate(720deg); }
		88%, 100% { left: 87.5%; bottom: 270px; opacity: 0; transform: rotate(720deg); }
	}
	.mth .mth__bubble { font-size: 23px; padding: 18px 22px; }
	.mth__fact { padding: 120px 22px 26px; }
	.mth__bulb { left: 50%; top: 26px; margin-left: -31px; }
	.mth .mth__fact-title { font-size: 28px; text-align: center; }
	.mth .mth__fact p { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
	.mth *, .mth *::before, .mth *::after { animation: none !important; transition: none !important; }
	.mth__lead, .mth__card, .mth__card--plain, .mth__planes .mth__card, .mth__step, .mth__bubble, .mth__quotes .mth__card, .mth__fact { opacity: 1 !important; transform: none !important; }
	.mth__words--big, .mth__lens { display: none; }
}
