/* "Средата" as the house and its yard (parts/environment.php): the house of the site builds itself beside the
   opening while its sentences light up as they are read; the freedoms are kites in the sky, each tied with a string
   to its limit standing on the grass; the results are told in the yard, where the ball rolls and the birds fly over. */

.env { position: relative; overflow: hidden; }
.bg .env__title, .bg .env__sub, .bg .kite__mark { font-family: 'Neucha', Arial, sans-serif; }

/* ---------- The opening: the house builds itself, the sentences light up ---------- */
.env__home { position: relative; padding: 40px 0 70px; }
.env__text { padding: 40px 46px; border-radius: 30px; background: #fff; box-shadow: 0 24px 40px -26px rgba(60, 40, 20, .5); opacity: 0; transform: translateY(30px); transition: opacity .7s, transform .9s cubic-bezier(.34, 1.3, .64, 1); }
.env__text::after { content: ''; display: block; clear: both; }
.is-in .env__text { opacity: 1; transform: none; }
.env__text p { margin: 0 0 14px; font-size: 18px; line-height: 1.85; color: #3c4741; }
.env__text p:last-child { margin-bottom: 0; }
/* a sentence waits pale until the reader reaches it, then a marker runs under the one being read */
.env__text .s { color: #b9ada1; background: linear-gradient(transparent 62%, rgba(255, 228, 0, .5) 62%, rgba(255, 228, 0, .5) 92%, transparent 92%) no-repeat 0 0 / 0 100%; transition: color .6s, background-size 1.1s cubic-bezier(.4, 0, .2, 1); }
.env__text .s.is-read { color: #3c4741; }
.env__text .s.is-now { background-size: 100% 100%; }
.env__house { position: relative; float: right; width: 400px; height: 343px; margin: -10px -10px 20px 36px; shape-outside: inset(0 0 0 0 round 30px); }
.env__house-img { position: absolute; inset: 0; background: url('../images/montessorihouse.svg') no-repeat center bottom / contain; clip-path: inset(100% 0 0 0); }
.is-in .env__house-img { animation: env-build 2.6s cubic-bezier(.45, 0, .2, 1) .5s forwards; }
@keyframes env-build { to { clip-path: inset(0 0 0 0); } }
.env__fan { position: absolute; left: 58%; top: 52.3%; width: 6.43%; height: 7.83%; background: url('../images/fan.svg') no-repeat center / contain; opacity: 0; animation: env-spin 1.4s linear infinite; }
.is-in .env__fan { opacity: 1; transition: opacity .4s 2.4s; }
@keyframes env-spin { to { transform: rotate(360deg); } }
.env__smoke { position: absolute; left: 62%; top: 2%; opacity: 0; }
.is-in .env__smoke { opacity: 1; transition: opacity .6s 3s; }
.env__smoke i { position: absolute; width: 16px; height: 16px; border-radius: 50%; background: rgba(214, 205, 196, .95); opacity: 0; animation: env-puff 3.2s ease-out infinite; }
.env__smoke i:nth-child(2) { animation-delay: 1.07s; } .env__smoke i:nth-child(3) { animation-delay: 2.14s; }
@keyframes env-puff { 0% { transform: translate(0, 0) scale(.4); opacity: 0; } 20% { opacity: .95; } 100% { transform: translate(34px, -76px) scale(2.3); opacity: 0; } }

/* ---------- The sky: kites for the freedoms, tied to their limits on the grass ---------- */
.env__sky { position: relative; padding: 70px 0 0; background: linear-gradient(#6fbdf6, #bfe3fb 60%, #e3f3fd); overflow: hidden; }
.env__clouds { position: absolute; z-index: 0; left: 0; top: 40px; width: 3840px; height: 190px; background: url('../images/clouds1.svg') repeat-x 0 0 / 1920px 190px; animation: env-clouds 80s linear infinite; pointer-events: none; }
.env__clouds--back { top: 0; height: 140px; background-image: url('../images/clouds2.svg'); background-size: 1920px 140px; opacity: .6; animation-duration: 140s; }
@keyframes env-clouds { from { transform: translateX(0); } to { transform: translateX(-1920px); } }
.env__title { position: relative; z-index: 1; margin: 0 auto 30px; font: 400 40px/1.25 'Cabin Sketch', Arial, sans-serif; text-align: center; color: #fff; text-shadow: 0 2px 10px rgba(0, 70, 140, .35); opacity: 0; transform: translateY(20px); transition: opacity .8s, transform .8s; }
.env__title.is-in { opacity: 1; transform: none; }

.env__kites { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 0 30px; padding-bottom: 46px; }
.env__strings { position: absolute; z-index: 0; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.env__strings path { fill: none; stroke: #6a5646; stroke-width: 1.6; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.is-up .env__strings path { stroke-dashoffset: 0; transition: stroke-dashoffset 1.6s cubic-bezier(.25, .8, .35, 1); }
.env .env__sub { grid-row: 2; grid-column: 1 / -1; justify-self: center; position: relative; z-index: 1; max-width: 760px; margin: 90px 0 36px; padding: 10px 28px; border-radius: 30px; background: rgba(255, 255, 255, .8); font: 400 26px/1.35 'Cabin Sketch', Arial, sans-serif; text-align: center; color: #3c4741; opacity: 0; transition: opacity .8s 1.6s; }
.bg .env .env__sub { font-family: 'Neucha', Arial, sans-serif; }
.is-up .env__sub { opacity: 1; }

/* a kite: the diamond, its tail and the card with the freedom; it rises from its limit and plays in the wind */
.kite { grid-row: 1; grid-column: var(--col); position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: flex-end; }
.kite__fly { position: relative; transform: translateY(320px) scale(.4); opacity: 0; transition: transform 1.8s cubic-bezier(.25, .8, .35, 1), opacity .5s; transition-delay: calc(.3s + var(--k) * .3s); }
.is-up .kite__fly { transform: none; opacity: 1; }
.kite__sway { transform-origin: 50% 100%; animation: env-sway calc(2.6s + var(--k) * .45s) ease-in-out infinite alternate; }
.kite:hover .kite__sway { animation-duration: .7s; }
@keyframes env-sway { from { transform: rotate(calc(var(--sw, 4deg) * -1)); } to { transform: rotate(var(--sw, 4deg)) translateY(-8px); } }
.kite__shape { position: relative; display: block; width: 84px; height: 108px; margin: 0 auto; clip-path: polygon(50% 0, 100% 38%, 50% 100%, 0 38%); background: conic-gradient(from 0deg at 50% 38%, var(--c) 0 25%, color-mix(in srgb, var(--c) 65%, #fff) 0 50%, var(--c) 0 75%, color-mix(in srgb, var(--c) 65%, #fff) 0 100%); filter: drop-shadow(0 6px 6px rgba(0, 50, 100, .2)); }
.kite__sticks::before, .kite__sticks::after { content: ''; position: absolute; background: rgba(90, 60, 40, .55); }
.kite__sticks::before { left: calc(50% - 1px); top: 0; width: 2px; height: 100%; }
.kite__sticks::after { left: 0; top: calc(38% - 1px); width: 100%; height: 2px; }
.kite__tail { position: relative; display: block; width: 2px; height: 34px; margin: 0 auto; background: #6a5646; transform-origin: 50% 0; animation: env-tail .9s ease-in-out infinite alternate; }
.kite__tail i { position: absolute; left: -7px; width: 16px; height: 8px; background: linear-gradient(90deg, var(--c) 0 45%, transparent 45% 55%, var(--c) 55%); clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 50% 50%, 0 100%); }
.kite__tail i:nth-child(1) { top: 4px; } .kite__tail i:nth-child(2) { top: 14px; } .kite__tail i:nth-child(3) { top: 24px; }
@keyframes env-tail { from { transform: skewX(-14deg); } to { transform: skewX(14deg); } }
.kite__card { position: relative; padding: 22px 20px 20px; border-radius: 22px; background: #fff; box-shadow: 0 18px 30px -20px rgba(0, 50, 100, .5); border-top: 5px solid var(--c); text-align: center; }
.kite__card p, .limit__card p { margin: 0; font-size: 16px; line-height: 1.6; color: #3c4741; }
.kite__card p { font-size: 18px; font-weight: 600; }
.kite__mark { position: absolute; left: -12px; top: -16px; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: var(--c); color: #fff; font: 400 24px/1 'Cabin Sketch', Arial, sans-serif; box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 70%, #000); }
.kite[style*="#ffe400"] .kite__mark, .limit[style*="#ffe400"] .kite__mark { color: #3c4741; }
.kite__anchor { position: absolute; left: 50%; bottom: 0; width: 0; height: 0; }

/* a limit: a card on the grass with the peg the string is tied to */
.limit { grid-row: 3; grid-column: var(--col); align-self: end; position: relative; z-index: 1; padding-top: 22px; opacity: 0; transform: translateY(40px); transition: opacity .6s, transform .9s cubic-bezier(.34, 1.4, .64, 1); transition-delay: calc(var(--k) * .3s); }
.is-up .limit { opacity: 1; transform: none; }
.limit__peg { position: absolute; z-index: 2; left: 50%; top: 0; width: 12px; height: 34px; margin-left: -6px; border-radius: 4px 4px 2px 2px; background: linear-gradient(90deg, #8b5e3c, #b5835a 60%, #8b5e3c); box-shadow: 0 3px 4px rgba(0, 0, 0, .2); }
.limit__card { position: relative; padding: 24px 20px 20px; border-radius: 22px; background: #fff; box-shadow: 0 18px 30px -20px rgba(40, 70, 20, .55); border-bottom: 5px solid var(--c); }
.limit__card .kite__mark { width: 32px; height: 32px; font-size: 20px; }
.env__grass { position: absolute; z-index: 0; left: 0; right: 0; bottom: 0; height: 130px; background: url('../images/background-grass-top.svg') repeat-x center top / 960px 35px, linear-gradient(transparent 28px, #7ad068 28px); }

/* ---------- The yard: the results, the ball and the birds ---------- */
.env__yard { position: relative; padding: 80px 0 0; }
.env__result { position: relative; z-index: 2; max-width: 920px; padding: 36px 44px; border-radius: 30px; background: #fff; box-shadow: 0 24px 40px -26px rgba(60, 40, 20, .5); opacity: 0; transform: translateY(30px) scale(.97); transition: opacity .7s, transform .9s cubic-bezier(.34, 1.3, .64, 1); }
.env__yard.is-in .env__result { opacity: 1; transform: none; }
.env__result p { margin: 0 0 12px; font-size: 19px; line-height: 1.8; color: #3c4741; }
.env__result p:last-child { margin-bottom: 0; }
.env__sun { position: absolute; z-index: 1; right: 9%; top: 30px; width: 70px; height: 72px; background: url('../images/sun.svg') no-repeat center / contain; filter: drop-shadow(0 0 16px rgba(255, 228, 0, .8)); animation: env-spin 14s linear infinite; }
/* the flying bird of the site (it looks left) crosses from right to left now and then, flapping */
.env__birds i { position: absolute; z-index: 3; left: 100%; top: 40px; width: 86px; height: 48px; animation: env-fly 19s linear infinite; }
.env__birds i::before { content: ''; position: absolute; inset: 0; background: url('../images/bird-2.svg') no-repeat center / contain; transform-origin: 50% 32%; animation: env-wings .42s ease-in-out infinite alternate; }
.env__birds i:nth-child(2) { top: 96px; width: 62px; height: 35px; animation-delay: -7s; animation-duration: 23s; }
.env__birds i:nth-child(3) { top: 10px; width: 50px; height: 28px; animation-delay: -14s; animation-duration: 27s; }
.env__birds i:nth-child(2)::before { animation-delay: -.2s; } .env__birds i:nth-child(3)::before { animation-delay: -.1s; animation-duration: .36s; }
@keyframes env-wings { from { transform: scaleY(1); } to { transform: scaleY(.62) translateY(3px); } }
@keyframes env-fly { 0% { transform: translate(0, 0); } 15% { transform: translate(-30vw, -24px); } 30% { transform: translate(-60vw, 10px); } 45% { transform: translate(-90vw, -16px); } 55%, 100% { transform: translate(calc(-100vw - 200px), 0); } }
.env__ground { position: relative; z-index: 1; height: 330px; margin-top: -30px; }
.env__yard-img { position: absolute; left: 50%; bottom: 0; width: 1920px; height: 375px; margin-left: -960px; background: url('../images/house-yard.svg') no-repeat center bottom; }
/* the ball rolls across the yard and back, squashing at the ends */
.env__ball { position: absolute; z-index: 2; left: calc(50% - 470px); bottom: 34px; width: 48px; height: 48px; animation: env-roll 7s ease-in-out infinite alternate; }
.env__ball i { display: block; width: 100%; height: 100%; background: url('../images/ball.svg') no-repeat center / contain; animation: env-ball 7s ease-in-out infinite alternate; }
@keyframes env-roll { 0% { transform: translateX(0) scale(.85, 1.12); } 5% { transform: translateX(10px) scale(1, 1); } 95% { transform: translateX(calc(min(940px, 100vw - 60px) - 10px)) scale(1, 1); } 100% { transform: translateX(min(940px, 100vw - 60px)) scale(.85, 1.12); } }
@keyframes env-ball { from { transform: rotate(0); } to { transform: rotate(1080deg); } }

/* ---------- Smaller screens ---------- */
@media only screen and (max-width: 1100px) {
	.env__kites { grid-template-columns: repeat(2, 1fr); gap: 0 26px; }
	.env .env__sub { grid-row: 1; margin: 0 0 20px; }
	.kite { grid-row: var(--row2); grid-column: var(--col2); padding-top: 40px; --sw: 2.5deg; }
	.limit { grid-row: var(--row2l); grid-column: var(--col2); margin-top: 70px; }
	.env__house { width: 320px; height: 274px; }
}
@media only screen and (max-width: 768px) {
	.env__home { padding: 24px 0 50px; }
	.env__text { padding: 24px 22px; }
	.env__text p { font-size: 17px; }
	.env__house { float: none; width: 280px; height: 240px; margin: 0 auto 16px; }
	.env__sky { padding-top: 50px; }
	.env__title { font-size: 30px; }
	.env__kites { display: flex; flex-direction: column; padding-bottom: 60px; }
	.env .env__sub { order: 1; margin: 0 0 10px; font-size: 21px; }
	.kite { order: var(--ok); padding-top: 50px; --sw: 1.8deg; }
	.limit { order: var(--ol); margin-top: 60px; }
	.kite__fly { transform: translateY(160px) scale(.5); }
	.env__result { padding: 24px 22px; }
	.env__result p { font-size: 17px; }
	.env__ground { height: 230px; }
	.env__yard-img { width: 1229px; height: 240px; margin-left: -760px; background-size: contain; }
	.env__ball { left: 20px; bottom: 22px; width: 38px; height: 38px; }
	.env__birds i { top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
	.env *, .env *::before, .env *::after { animation: none !important; transition: none !important; }
	.env__text, .env__title, .kite__fly, .limit, .env__sub, .env__result, .env__fan, .env__smoke { opacity: 1 !important; transform: none !important; }
	.env__house-img { clip-path: none !important; }
	.env__text .s { color: #3c4741 !important; }
	.env__strings path { stroke-dashoffset: 0 !important; }
	.env__birds, .env__smoke { display: none; }
}
