/* Source-grounded closing blocks. All copy and controls are live HTML. */
.md-learning,.md-story-footer{position:relative;isolation:isolate;color:#452b1c;background:#fffdf9;font-family:var(--md-font-body);font-size:var(--md-type-body);line-height:1.5}
.md-learning *,.md-story-footer *{box-sizing:border-box}
.md-learning-art,.md-footer-art{position:absolute;inset:0;width:100%;height:100%;object-fit:fill;z-index:-1;pointer-events:none}
.md-learning{min-height:50vw;display:flex;align-items:center;padding:7vw 7.5% 10vw}
.md-learning-copy{width:51%;max-width:850px}
.md-home .md-learning h2{font-family:var(--md-font-display);font-size:clamp(38px,4.2vw,72px);font-weight:400;line-height:1.12;letter-spacing:0;margin:0 0 28px}
.md-home .md-learning p{margin:0 0 24px;font-size:var(--md-type-body);line-height:1.6}
.md-story-button{display:inline-flex;align-items:center;justify-content:center;gap:18px;min-height:56px;padding:16px 28px;border:0;border-radius:999px;background:#e97699;color:#fff!important;font:700 var(--md-type-button)/1.3 var(--md-font-body);text-decoration:none;cursor:pointer;transition:background-color .18s,box-shadow .18s,transform .18s}
.md-story-button>img{filter:brightness(0) invert(1);flex-shrink:0}
.md-story-button:is(:hover,:active){background:#f69fba;color:#4f2938!important;box-shadow:0 8px 22px #a7547933;transform:translateY(-2px)}
.md-story-button:is(:hover,:active)>img{filter:none}
.md-story-button:focus-visible,.md-story-footer a:focus-visible,.md-learning a:focus-visible{outline:3px solid #275f8a;outline-offset:5px}
.md-learning-contact{margin-top:14px;background:#fffdf9;padding:18px 22px;border:1px solid #eadcd0;border-radius:18px;box-shadow:0 8px 24px #452b1c0f}
.md-home .md-learning-contact p{font-size:var(--md-type-caption);margin:0 0 8px}
.md-learning-contact a{display:block;width:fit-content;margin-top:8px;text-underline-offset:4px}
.md-story-footer{--md-footer-green:#d0deb5;margin:0;overflow:hidden;min-height:58.6vw;padding-bottom:25px;background:var(--md-footer-green)}
.md-footer-scene{position:relative;isolation:isolate;overflow:hidden}
.md-footer-art{height:auto}
.md-footer-invitation{min-height:40vw;padding:5vw 6.3% 5.5vw}
.md-footer-invitation h2{font:400 clamp(36px,3.7vw,64px)/1.12 var(--md-font-display);letter-spacing:0;max-width:51%;margin:0 0 20px}
.md-footer-invitation p{font:400 clamp(26px,2.6vw,42px)/1.25 'Caveat',cursive;max-width:51%;margin:0 0 26px}
.md-footer-columns{display:grid;grid-template-columns:1fr 1fr 1.15fr;width:84%;margin:0 auto;padding:2vw 0 1.5vw}
.md-footer-columns>section{min-width:0;padding:0 2.8vw}
.md-footer-columns>section+section{border-left:1px solid #a4b280}
.md-footer-columns h3{font:400 clamp(27px,2.4vw,40px)/1.2 var(--md-font-display);margin:0 0 22px}
.md-footer-groups{padding:0;margin:0;list-style:none}
.md-footer-groups li+li{margin-top:14px}
.md-footer-groups a{display:flex;flex-wrap:wrap;gap:0 6px;text-decoration:none;line-height:1.5}
.md-footer-groups strong{text-decoration:underline;text-underline-offset:4px;color:#4e6030}
.md-footer-groups span{font-size:var(--md-type-caption)}
.md-story-footer a{color:inherit;text-underline-offset:4px}
.md-footer-phones a{display:block;font-size:clamp(19px,1.6vw,27px);font-weight:700;text-decoration:none;white-space:nowrap;line-height:1.6}
.md-footer-socials{display:grid;grid-template-columns:repeat(5,minmax(0,44px));gap:clamp(4px,1vw,12px);margin:18px 0 12px}
.md-footer-socials a{display:grid;place-items:center;width:100%;aspect-ratio:1;border-radius:50%;background:#4267a9;transition:transform .18s,box-shadow .18s}
.md-footer-socials .md-social-odnoklassniki{background:#e86e17}.md-footer-socials .md-social-vk{background:#2787bf}.md-footer-socials .md-social-instagram{background:#d83e76}
.md-footer-socials img{width:24px;height:24px;max-width:24px;aspect-ratio:1;object-fit:contain;flex:none;filter:brightness(0) invert(1)}
.md-footer-socials a:hover{transform:translateY(-3px);box-shadow:0 6px 15px #452b1c30}
.md-footer-socials .md-social-email{background:#71844a;color:#fff}
.md-footer-offer{display:flex;align-items:center;gap:18px;background:#fffdf4d9;padding:20px;border-radius:16px;text-decoration:none;line-height:1.45}
.md-footer-offer img{flex-shrink:0;opacity:.7}
.md-footer-offer span{font-size:var(--md-type-body)}
.md-footer-more{display:flex;align-items:center;justify-content:center;gap:12px;margin:18px 0 0;font-weight:600}
.md-footer-links{display:flex;justify-content:center;gap:12px 28px;flex-wrap:wrap;margin:20px 8% 0;font-size:var(--md-type-caption)}
.md-footer-links nav{display:flex;justify-content:center;gap:12px 28px;flex-wrap:wrap}
.md-footer-links>a{text-decoration:none}.md-footer-links small{flex-basis:100%;text-align:center;font-size:12px}
@media(max-width:1000px){.md-learning{min-height:540px;padding:65px 6% 100px}.md-learning-copy{width:52%}.md-home .md-learning h2{font-size:42px}.md-story-footer{background:var(--md-footer-green)}.md-footer-art{height:auto}.md-footer-invitation{min-height:35vw;padding:35px 5% 65px}.md-footer-invitation h2{font-size:36px}.md-footer-invitation p{font-size:28px}.md-footer-columns{width:92%;padding:32px 0 0}.md-footer-columns>section{padding:0 16px}.md-footer-columns h3{font-size:28px}.md-footer-offer{padding:16px;gap:10px}.md-footer-offer img{width:30px}.md-footer-groups a{display:block}.md-footer-groups span{display:block}}
@media(max-width:650px){.md-learning{display:flex;flex-direction:column-reverse;padding:0;min-height:0;background:#fffcf5}.md-learning-art{position:relative;inset:auto;width:100%;height:auto;z-index:0}.md-learning-copy{width:100%;padding:42px 7% 0}.md-home .md-learning h2{font-size:var(--md-type-heading);margin-bottom:20px}.md-home .md-learning p{margin-bottom:22px}.md-learning-details{margin-bottom:18px}.md-story-button{min-height:52px;padding:14px 24px}.md-story-footer{display:flex;flex-direction:column;padding-bottom:28px}.md-footer-scene{display:flex;flex-direction:column}.md-footer-art{position:relative;inset:auto;z-index:0;order:2;width:100%;height:auto;margin-bottom:-10px}.md-footer-invitation{order:1;min-height:0;background:#fffdf9;padding:38px 7% 8px}.md-footer-invitation h2,.md-footer-invitation p{max-width:100%}.md-footer-invitation h2{font-size:var(--md-type-heading)}.md-footer-invitation p{font-size:30px}.md-footer-invitation .md-story-button{max-width:100%}.md-footer-columns{order:3;grid-template-columns:1fr;width:86%;padding:0}.md-footer-columns>section{padding:24px 0}.md-footer-columns>section+section{border-left:0;border-top:1px solid #a4b280}.md-footer-columns h3{font-size:30px;margin-bottom:16px}.md-footer-groups a{display:flex;gap:8px}.md-footer-groups span{display:inline}.md-footer-phones a{font-size:24px}.md-footer-socials{gap:16px}.md-footer-offer{padding:18px;max-width:400px}.md-footer-offer img{width:40px}.md-footer-more{justify-content:flex-start}.md-footer-links{order:4;margin:16px 7% 0;justify-content:flex-start;gap:12px 20px}}
@media(max-width:650px){.md-footer-art{height:37vw;object-fit:cover;object-position:center top}}
@media(prefers-reduced-motion:reduce){.md-story-button,.md-footer-socials a{transition:none}.md-story-button:is(:hover,:active),.md-footer-socials a:hover{transform:none}}

/* Owner refinement: one large existing watercolor cloud, only for home learning. */
.md-home .md-learning{display:grid;place-items:center;width:min(1000px,94%);min-height:0;aspect-ratio:1000/744;margin:40px auto;padding:13% 10% 9%;background:none;text-align:center}
.md-learning .md-learning-art{position:absolute;inset:0;width:100%;height:100%;z-index:-1;filter:drop-shadow(0 9px 12px #657f9024)}
.md-learning .md-learning-copy{width:100%;max-width:670px;padding:0}
.md-home .md-learning-copy>.md-story-button:focus{outline:none}
.md-home .md-learning-copy>.md-story-button:focus-visible{text-decoration:underline;text-underline-offset:4px}
.md-home .md-learning h2{font-size:clamp(36px,3.6vw,58px);margin-bottom:22px}
.md-learning-dialog{width:min(580px,calc(100% - 32px));max-height:calc(100svh - 40px);padding:28px;border:1px solid #e4d5d2;border-radius:24px;background:#fffdf9;color:#452b1c;text-align:left;box-shadow:0 20px 70px #24364240}
.md-learning-dialog::backdrop{background:#22364280}
.md-learning-dialog form{display:flex;justify-content:flex-end;margin:0 0 20px}
.md-dialog-close{border:1px solid #d6bcb2;border-radius:999px;padding:10px 18px;background:#fff3f5;color:#452b1c;font:inherit;cursor:pointer}
.md-home .md-learning-dialog h2{font-size:36px}
.md-home-offer{display:flex;align-items:center;justify-content:center;gap:30px;margin:0 auto 30px;width:92%;padding:25px 5%;border-radius:24px;background:#fdf0f4;color:#d95483}
.md-home-offer>img{flex-shrink:0;filter:invert(44%) sepia(28%) saturate(1413%) hue-rotate(294deg) brightness(95%)}
.md-home .md-home-offer p{margin:0;max-width:760px;font:400 clamp(26px,2.7vw,42px)/1.2 var(--md-font-display)}
@media(max-width:650px){.md-home .md-learning{width:100%;overflow:clip;aspect-ratio:auto;min-height:460px;padding:85px 12% 65px;margin:20px auto}.md-home .md-learning .md-learning-art{inset:0 auto 0 -15%;width:130%;max-width:none}.md-home .md-learning h2{font-size:34px}.md-home .md-learning p{font-size:16px}.md-learning-dialog{padding:20px}.md-home .md-learning-dialog h2{font-size:30px}.md-home-offer{gap:16px;padding:22px 6%}.md-home-offer>img{width:38px;height:38px}.md-home .md-home-offer p{font-size:26px}}

/* The original invitation illustration ends before the uniform green footer. */
.md-story-footer{min-height:0}
.md-footer-scene{background:#fffdf9 url('homepage/footer-background.webp') center top/100% auto no-repeat}
.md-story-footer .md-footer-invitation{min-height:38vw;padding:5vw 6.3% 6vw;background:transparent}
.md-footer-columns,.md-footer-links{background:var(--md-footer-green)}
@media(max-width:1000px) and (min-width:651px){.md-story-footer .md-footer-invitation{min-height:42vw;padding:30px 5% 50px}.md-footer-invitation h2{font-size:clamp(28px,3.7vw,37px)}}
@media(max-width:650px){
 .md-footer-scene{background:#fffdf9}
 .md-footer-scene::after{content:"";display:block;width:100%;height:69vw;background:url('homepage/footer-background.webp') right top/180% auto no-repeat;order:2}
 .md-story-footer .md-footer-invitation{min-height:0;background:#fffdf9;padding:34px 7% 12px}
}

/* Live lettering on the empty board in footer-background.webp (1638 × 960).
   On mobile the same artwork is right-aligned at 180%, below the invitation. */
.md-story-footer .md-footer-sign{
 position:absolute;z-index:2;left:87.9%;top:19.2vw;width:9.3%;height:5.6vw;
 display:flex;flex-direction:column;justify-content:center;margin:0;padding:0;
 color:#735033;text-align:center;transform:rotate(8deg);
 font:400 clamp(11px,1.45vw,28px)/1.04 var(--md-font-display);
}
@media(max-width:650px){
 .md-story-footer .md-footer-sign{
  top:auto;bottom:24.36vw;left:78.22%;width:16.74%;height:10.08vw;
  font-size:clamp(10px,2.61vw,17px);
 }
}

/* Reuse the homepage's existing smooth SVG wave, not a new illustration.
   Only decorative pseudo-elements are masked; content and controls stay intact. */
:root{
 --md-section-wave:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 32' preserveAspectRatio='none'%3E%3Cpath fill='white' d='M0 0H1440V15C1290 54 1210-11 1060 10S800 29 660 12 405 0 270 17 95 39 0 14Z'/%3E%3C/svg%3E");
 --md-section-wave-height:clamp(14px,2vw,32px);
}
/* Explicit full-width surfaces only: never nested price panels, cards or iframes. */
body #main :is(.mdh-activities,.mdh-video,.mdh-day,.mda-unhurried,.mda-traditions,.mda-teachers,.mda-gardens,.mdap-stories,.mdh-map,.mdn-top,.md-tour-intro),body #main>.page-top{position:relative}
body #main>.page-top::after,
body #main :is(.mdh-hero:not(.mdap-home-hero),.mda-hero,.mdp-hero,.mdc-hero,.md-tour-intro)::after,
body #main :is(.mdh-activities,.mdh-video,.mdh-day,.mda-together,.mda-unhurried,.mda-traditions,.mda-advantages,.mda-teachers,.mda-gardens,.mdap-stories,.mdc-question,.md-tour-visit,.mdh-map,.mdn-top,.md-tour-intro,.mda-hero,.mdp-hero,.mdc-hero)::before,
.mdn-meadow::before,
.md-story-footer::before{
 content:"";display:block;position:absolute;left:0;right:0;height:var(--md-section-wave-height);
 pointer-events:none;z-index:7;
 -webkit-mask:var(--md-section-wave) center/100% 100% no-repeat;
 mask:var(--md-section-wave) center/100% 100% no-repeat;
}
/* A bottom wave uses the following section's paper colour. */
body #main>.page-top::after,
body #main :is(.mdh-hero:not(.mdap-home-hero),.mda-hero,.mdp-hero,.mdc-hero,.md-tour-intro)::after{
 top:auto;bottom:-1px;transform:scaleY(-1);background:var(--md-next-paper,#fff);
}
body #main .md-garden-hero{--md-next-paper:#fffdf9}
body #main .mda-hero{--md-next-paper:#fffdf8;--md-previous-paper:#fff}
body #main .mdp-hero{--md-previous-paper:#fff}
body #main .mdc-hero{--md-next-paper:#fcf9f0;--md-previous-paper:#fff}
body #main>.page-top{--md-next-paper:#fff}
body #main .md-tour-intro{--md-next-paper:#fffdf8;--md-previous-paper:#fff}
.mdn-meadow::before{top:-1px;background:#fffdf8}
/* Top edges sit in existing section padding; no added height or layout shift. */
body #main :is(.mdh-activities,.mdh-video,.mdh-day,.mda-together,.mda-unhurried,.mda-traditions,.mda-advantages,.mda-teachers,.mda-gardens,.mdap-stories,.mdc-question,.md-tour-visit,.mdh-map,.mdn-top,.md-tour-intro,.mda-hero,.mdp-hero,.mdc-hero)::before{
 top:-1px;bottom:auto;background:var(--md-previous-paper,#fff);
}
body #main .mdh-activities{--md-previous-paper:#fffdfb}
body #main .mdh-video{--md-previous-paper:#edf7fb}
body #main .mdh-day{--md-previous-paper:#fffaf2}
body #main .mda-together{--md-previous-paper:#fffdf8}
body #main .mda-unhurried{--md-previous-paper:#fcf8ef}
body #main .mda-traditions{--md-previous-paper:#edf7fb}
body #main .mda-advantages{--md-previous-paper:#fbf6e9}
body #main .mda-reviews{--md-previous-paper:#fffdf8}
body #main .mda-gardens{--md-previous-paper:#fcf7ed}
body #main .mdap-stories{--md-previous-paper:#fcfbf7}
body #main .mdc-question{--md-previous-paper:#fcf9f0}
body #main .md-tour-visit{--md-previous-paper:#fffdf8}
body #main .mdh-map{--md-previous-paper:#fff}
body #main .mdn-top{--md-previous-paper:#fff}
/* Let the next cream surface reach over the meadow without replacing its art. */
body #main .mda-teachers::before{
 top:calc(1px - var(--md-section-wave-height));background:#fffdf8;transform:scaleY(-1);
}
/* Shared footer: the curved lip extends above the scene on every template. */
.md-story-footer{overflow:visible}
.md-story-footer::before{
 top:calc(1px - var(--md-section-wave-height));background:#fffdf9;transform:scaleY(-1);
}
.md-home ~ .md-story-footer .md-footer-invitation,
body:has(.md-home) .md-footer-invitation{position:relative;overflow:visible}
body:has(.md-home) .md-footer-invitation::before{
 content:"";display:block;position:absolute;left:0;right:0;top:0;height:var(--md-section-wave-height);background:#fffdf9;pointer-events:none;z-index:2;
 -webkit-mask:var(--md-section-wave) center/100% 100% no-repeat;
 mask:var(--md-section-wave) center/100% 100% no-repeat;
}
.md-footer-scene::before{
 content:"";position:absolute;bottom:0;left:0;right:0;height:var(--md-section-wave-height);
 z-index:1;pointer-events:none;background:linear-gradient(transparent,var(--md-footer-green));
}

/* Keep adaptation artwork in place while its copy follows the viewport grid. */
@media(min-width:651px) and (max-width:1000px){body #main.md-home:not(.md-gardens-index) .mdh-adaptation>.mdh-adaptation-copy{left:calc(5vw - 30px);padding-inline:0}}
@media(max-width:650px){body #main.md-home:not(.md-gardens-index) .mdh-adaptation>.mdh-adaptation-copy{left:-3px;width:calc(100% + 6px);padding-inline:0}}

/* Preserve the original handwritten invitation against the shared prose scale. */
body #footer .md-footer-invitation > p{font-family:'Caveat',cursive!important;font-size:clamp(26px,2.6vw,42px)!important;line-height:1.25!important}
@media(max-width:1000px){body #footer .md-footer-invitation > p{font-size:28px!important}}
@media(max-width:650px){body #footer .md-footer-invitation > p{font-size:30px!important}}

/* Copyright, central navigation, and privacy follow the shared page frame. */
body .md-footer-links{width:var(--md-frame);margin-inline:auto;display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:24px}
body .md-footer-links>nav{justify-self:center;display:flex;flex-wrap:wrap;justify-content:center;gap:18px}
body .md-footer-links>a:first-child{justify-self:start}
body .md-footer-links>a:last-child{justify-self:end;text-align:right}
@media(max-width:1000px){body .md-footer-links{grid-template-columns:1fr;gap:18px}body .md-footer-links>a:first-child,body .md-footer-links>a:last-child{justify-self:center;text-align:center}}
body .md-sadovnica-tip{max-height:min(70vh,600px);overflow-y:auto}

/* The shared day rhythm and groups meadow ends in the site's soft paper wave. */
body #main.md-home:not(.md-gardens-index) .mdh-day-rhythm-groups::after{
 content:"";position:absolute;left:0;right:0;bottom:-1px;
 height:var(--md-section-wave-height);background:#fffdf9;transform:scaleY(-1);
 pointer-events:none;z-index:2;
 -webkit-mask:var(--md-section-wave) center/100% 100% no-repeat;
 mask:var(--md-section-wave) center/100% 100% no-repeat;
}
body #main.md-home:not(.md-gardens-index) .mdh-day+.mdh-video::before{display:none}

/* Fit live lettering into the board at every artwork scale. */
body .md-story-footer .md-footer-sign,body .md-story-footer .md-footer-sign span{font-size:1.12vw!important;line-height:1.05!important}
@media(max-width:650px){body .md-story-footer .md-footer-sign,body .md-story-footer .md-footer-sign span{font-size:2.02vw!important}}
