@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;500;600;700&family=Literata:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
:root{--ink:#244d42;--muted:#798278;--paper:#faf7ef;--accent:#ad4f36}*{box-sizing:border-box}body{margin:0;background:var(--paper);color:var(--ink);font-family:Comfortaa,system-ui,sans-serif}button,a,select{-webkit-tap-highlight-color:transparent}button,select{font:inherit}button{cursor:pointer}button:focus-visible,a:focus-visible,select:focus-visible{outline:3px solid #c98835;outline-offset:5px}button:disabled{opacity:.3;cursor:default}button{color:inherit}header{max-width:1280px;margin:auto;display:flex;align-items:center;justify-content:space-between;padding:25px 40px;border-bottom:1px solid #dddccf}.brand{font-weight:700;text-decoration:none;color:var(--ink);font-size:19px}.brand-icon{font-size:30px;vertical-align:middle;margin-right:8px}.header-note{font-size:11px;color:var(--muted)}.small{background:transparent;border:1px solid #d4d7c9;border-radius:24px;padding:11px 18px;font-size:12px}.intro{padding:65px 0 45px}.eyebrow{letter-spacing:2px;font-size:10px;font-weight:700;color:var(--accent)}h1,h2,h3{font-family:Literata,Georgia,serif}h1{font-size:58px;line-height:1.2;font-weight:500;margin:22px 0}h1 span{display:block;font-style:italic;color:#8b9c7b}.intro p{font-size:14px;line-height:1.9;color:#6d786e}main{max-width:1160px;margin:auto;padding:0 30px}.shelf-heading{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #dddccf;margin-bottom:26px}.shelf-heading h2{font-size:23px;font-weight:500}.shelf-heading span{font-size:11px;color:var(--muted)}.story-card{padding:0;background:#fffcf6;text-align:left;display:grid;grid-template-columns:360px 1fr;border:1px solid #e3dfd1;border-radius:16px;overflow:hidden;width:100%;max-width:850px;box-shadow:0 8px 30px #2a4d4110;transition:transform .2s}.story-card:hover{transform:translateY(-4px)}.scene{background-image:url('assets/mitten.png');background-size:300% 300%;background-position:var(--x) var(--y);background-repeat:no-repeat;aspect-ratio:1}.cover{position:relative}.cover-label{position:absolute;bottom:18px;left:18px;background:#faf7efe8;padding:10px;border-radius:5px;font-size:8px;letter-spacing:1px}.card-copy{padding:40px;display:flex;flex-direction:column;justify-content:center}.tags{font-size:9px;letter-spacing:1px;color:var(--accent)}.tags span{float:right;color:var(--muted);letter-spacing:0}.card-copy h3{font-size:38px;margin:20px 0 8px;font-weight:500}.card-copy p{font-size:13px;line-height:1.8;color:#6d786e}.card-link{margin-top:25px;font-size:13px;font-weight:700}.card-link b{float:right}.shelf-foot{font-size:11px;color:var(--muted);margin:30px 0 60px}footer{max-width:1200px;margin:35px auto 0;padding:25px 30px;display:flex;justify-content:space-between;border-top:1px solid #dddccf;font-size:10px;color:var(--muted)}.book-top{display:flex;align-items:center;justify-content:space-between;margin-top:28px}.book-top>span{font-size:9px;letter-spacing:2px;color:var(--muted)}.text-button{border:0;background:transparent;padding:8px 0;font-size:11px}.title-line{display:flex;justify-content:space-between;align-items:center}.title-line h1{font-size:37px;margin:16px 0 25px}.title-line>span{font-size:12px;color:var(--muted)}.book{display:grid;grid-template-columns:1fr 1fr;background:#fffdf7;border-radius:7px 14px 14px 7px;overflow:hidden;box-shadow:0 18px 45px #293e3020,0 5px 0 -1px #e5e0d3,0 9px 0 -2px #f7f4eb;border:1px solid #e4dfd1}.page{position:relative;padding:36px 40px 48px;background:linear-gradient(90deg,#e9e4d780,transparent 7%,transparent)}.page h2{font-size:27px;font-weight:500;line-height:1.3;margin:14px 0 22px}.story-text{font-family:Literata,Georgia,serif;font-size:18px;line-height:1.6;color:#414a3e}.story-text p{margin:0 0 9px}.story-text p.dialogue{color:#665f4e}.page-number{position:absolute;bottom:15px;left:50%;font-family:Literata,serif;font-size:12px;color:#a4a58f}.controls{display:flex;align-items:center;justify-content:space-between;max-width:600px;margin:28px auto 15px}.nav{border:1px solid #d5d8ca;background:transparent;width:45px;height:45px;border-radius:50%;font-size:22px}.audio-controls{display:flex;gap:8px;align-items:center}.play{border:0;background:var(--ink);color:#fffdf5;border-radius:30px;padding:16px 25px;font-size:13px;box-shadow:0 4px 10px #244d4220}.speed-label select{border:0;background:transparent;font-size:10px;color:#657461;max-width:105px}.dots{display:flex;gap:8px;justify-content:center}.dots button{border:0;border-radius:10px;background:#d7dbcf;width:8px;height:8px;padding:0}.dots button[aria-current=true]{width:23px;background:var(--accent)}.status{min-height:22px;text-align:center;font-size:11px;color:var(--muted);line-height:1.7}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}#ending{text-align:center;font-family:Literata,serif;margin:20px}#ending button{margin-left:15px}.turn{animation:turn .35s ease}@keyframes turn{from{opacity:.3;transform:translateX(8px)}to{opacity:1;transform:none}}[hidden]{display:none!important}@media(min-width:900px){.book .scene{height:100%;min-height:480px;aspect-ratio:auto}}@media(max-width:800px){header{padding:20px}.header-note{display:none}main{padding:0 20px}.intro{padding:40px 0 25px}h1{font-size:43px}.story-card{grid-template-columns:1fr 1fr}.card-copy{padding:25px}.card-copy h3{font-size:30px}.tags span{float:none;display:block;margin-top:10px}.page{padding:25px 25px 40px}.page h2{font-size:24px}.story-text{font-size:16px}.book-top>span{display:none}}@media(max-width:600px){.brand{font-size:15px}header .small{font-size:10px;padding:9px 12px}h1{font-size:37px}.intro p{font-size:12px}.shelf-heading{align-items:flex-start;flex-direction:column;padding-bottom:15px;gap:0}.shelf-heading h2{margin-bottom:10px}.story-card{grid-template-columns:1fr}.cover{aspect-ratio:1.2}.card-copy{padding:24px}.tags span{float:right;margin:0}.card-copy h3{margin-top:12px}.card-link{margin-top:10px}.book{grid-template-columns:1fr}.book .scene{aspect-ratio:1}.page{padding:26px 25px 40px;background:none;min-height:250px}.story-text{font-size:18px}.title-line h1{font-size:32px}.controls{gap:8px}.play{padding:14px 18px;font-size:12px}.audio-controls{gap:4px}.speed-label select{max-width:82px;font-size:9px}.nav{width:38px;height:38px;flex-shrink:0}.book-top{margin-top:16px}#fullscreen span{display:none}.status{font-size:10px}footer{font-size:9px}.desktop{display:none}}@media(prefers-reduced-motion:reduce){*{animation:none!important;transition:none!important}}:fullscreen{background:var(--paper);overflow:auto}

/* Cloth covers, paper leaves, and a visible binding. */
body{background:#e9e3d5;background-image:radial-gradient(ellipse at 50% 30%,#fbf7ed 0%,transparent 75%)}
#catalog .intro{text-align:center;padding-top:48px}#catalog .shelf-heading{max-width:850px;margin-left:auto;margin-right:auto}.shelf-foot{text-align:center}
.story-card{display:block;position:relative;width:320px;max-width:90%;margin:35px auto 60px;border:0;border-radius:4px 14px 14px 4px;background:#245144;color:#eadbb9;padding:16px 22px 20px 30px;overflow:visible;transform:rotate(-3deg);box-shadow:2px 3px #183c31,5px 5px #f2e9d8,8px 8px #cbbda2,12px 16px 28px #37302140;isolation:isolate}.story-card:hover{transform:rotate(0deg) translateY(-6px)}.book-spine{position:absolute;left:8px;top:0;bottom:0;width:10px;border-left:1px solid #adc29b50;border-right:1px solid #0b2c2580;background:linear-gradient(90deg,#163c30,#396951,#214e40)}.cover{aspect-ratio:auto;background:none;border:1px solid #b8a67990;padding:25px 15px 20px;display:flex;align-items:center;flex-direction:column;min-height:410px}.cover-kicker{font-size:8px;letter-spacing:1.8px;text-align:center;line-height:1.9}.cover h3{font-size:37px;font-weight:500;margin:16px 0 22px;color:#f0e4c4}.cover-art{width:100%;height:215px;object-fit:contain;background:#f0e8d7;border:4px solid #c3b184;border-radius:45% 45% 4px 4px;pointer-events:none}.cover-bottom{font-family:Literata,serif;font-style:italic;font-size:12px;margin-top:23px}.book-edge{position:absolute;right:-7px;top:8px;bottom:4px;width:6px;z-index:-1;background:repeating-linear-gradient(0deg,#d2c9b5 0 1px,#f7f0df 1px 3px);border-radius:0 8px 6px 0}
.book{position:relative;perspective:2000px;overflow:visible;isolation:isolate;border:8px solid #325449;border-radius:12px;background:#fff9ec;box-shadow:0 2px 0 #d7cfba,0 5px 0 #fff6e2,0 7px 0 #cec3a8,0 10px 0 #eee2c9,0 14px 0 -1px #25483c,0 24px 45px #3e332c40;touch-action:pan-y;user-select:none}.book:after{content:'';position:absolute;top:0;bottom:0;left:calc(50% - 14px);width:28px;background:linear-gradient(90deg,transparent,#6e5d3c30 42%,#4e412344 50%,#8e7c4a20 58%,transparent);pointer-events:none;z-index:2}#illustration,.turn-illustration{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:30px 26px;min-width:0;background:linear-gradient(90deg,#fff9eb,#f6eddc);border-radius:3px 0 0 3px}#scene-image,.turn-scene-image{display:block;width:100%;height:auto;max-height:480px;object-fit:contain;pointer-events:none}.picture-caption{font-family:Literata,serif;font-style:italic;font-size:11px;color:#a1957d}.page{background:linear-gradient(90deg,#f3e9d5,#fffaf0 9%,#fffaf0 97%,#efe3cb);min-height:540px;padding:35px 32px 45px}.page h2{font-size:26px}.story-text{font-size:17px;line-height:1.55}.page-number{color:#8c826a}.turn-leaf{position:absolute;top:0;bottom:0;width:50%;z-index:5;transform-style:preserve-3d;pointer-events:none}.turn-leaf.forward{left:50%;transform-origin:left center;animation:flip-forward .68s ease-in-out both}.turn-leaf.backward{left:0;transform-origin:right center;animation:flip-backward .68s ease-in-out both}.turn-leaf> :first-child{height:100%;width:100%;overflow:hidden;backface-visibility:hidden;background-color:#fff9ed}.turn-leaf #illustration,.turn-leaf>div:not(.leaf-back){padding:30px 26px}.leaf-back{position:absolute;inset:0;background:linear-gradient(90deg,#e5d7ba,#fff6e3 15%,#f5e7cc);backface-visibility:hidden;transform:rotateY(180deg);display:flex;align-items:center;justify-content:center;font-size:50px;color:#d2bd8d;box-shadow:0 0 25px #63523830}.turn-leaf img{max-width:100%;max-height:480px;object-fit:contain}.turn-leaf .page{position:absolute;inset:0}@keyframes flip-forward{0%{transform:rotateY(0deg)}100%{transform:rotateY(-180deg)}}@keyframes flip-backward{0%{transform:rotateY(0deg)}100%{transform:rotateY(180deg)}}.play:disabled{opacity:.65;box-shadow:none}.speed-label:has(select:disabled){display:none}.dots button{width:12px;height:12px}.dots{gap:12px}
@media(max-width:800px){.page{padding:28px 25px 42px}.story-text{font-size:16px}#illustration,.turn-illustration{padding:22px 18px}.page h2{font-size:23px}.book{border-width:6px}}
@media(max-width:600px){main{padding:0 15px}.book{display:block;border-left-width:10px;border-radius:5px 12px 12px 5px}.book:after{left:0;width:15px;background:linear-gradient(90deg,#78613b30,transparent)}#illustration,.turn-illustration{padding:20px 22px 8px;background:#fff9eb}#scene-image,.turn-scene-image{height:230px;width:100%;object-fit:contain}.picture-caption{display:none}.page{min-height:0;padding:19px 24px 35px;background:linear-gradient(90deg,#f3e9d5,#fff9eb 6%)}.page h2{font-size:24px;margin:10px 0 16px}.story-text{font-size:17px;line-height:1.6}.turn-leaf{width:100%;left:0!important}.turn-leaf.forward{transform-origin:left}.turn-leaf.backward{transform-origin:right}.turn-leaf>.book{border:0;box-shadow:none;margin:0;min-height:100%}.turn-leaf>.book:after{display:none}.turn-leaf .page{position:relative;inset:auto}.turn-leaf>div:not(.leaf-back){padding:0}.turn-leaf img{height:230px}.cover{min-height:410px}.cover-art{height:215px}.intro h1{font-size:34px}}

@media(max-width:600px){
.book.mobile-turn-out,.book.mobile-turn-in{transform-origin:center;backface-visibility:hidden;will-change:transform;pointer-events:none}
.book.mobile-turn-out{animation:mobile-page-out .34s ease-in both}
.book.mobile-turn-in{animation:mobile-page-in .34s ease-out both}
@keyframes mobile-page-out{from{transform:perspective(1400px) rotateY(0deg)}to{transform:perspective(1400px) rotateY(calc(-90deg * var(--turn-direction,1)))}}
@keyframes mobile-page-in{from{transform:perspective(1400px) rotateY(calc(90deg * var(--turn-direction,1)))}to{transform:perspective(1400px) rotateY(0deg)}}
}
/* Paper edges replace the colored cover border around the open spread. */
.book{border:1px solid #d8cdb7;border-radius:3px 8px 8px 3px;background:#fff9ec;box-shadow:0 2px 0 #ece2cd,0 3px 0 #cfc3aa,0 5px 0 #faf1de,0 6px 0 #d7cbb4,0 8px 0 #f5ebd7,0 9px 0 #cdbfa4,0 20px 35px #55482d26}
@media(max-width:600px){.book{border:1px solid #ddd0b7;border-left:2px solid #d1c1a1;border-radius:2px 7px 7px 2px;box-shadow:1px 1px 0 #f5ecd9,2px 3px 0 #d7cab0,3px 5px 0 #fcf4e3,4px 7px 0 #d9cbb1,0 15px 28px #55482d25}.book:after{width:12px;background:linear-gradient(90deg,#8f775121,transparent)}}

/* One paper surface and one measured size for every spread. */
.book{height:var(--book-height,auto);background:linear-gradient(90deg,#f4ead6 0%,#fffaef 8%,#fffaef 92%,#f4ead6 100%)}
#illustration,.page{background:transparent}
#scene-image,.turn-scene-image{height:480px;max-height:none;object-fit:contain}
.book-measure{position:fixed!important;left:-100000px!important;top:0!important;height:auto!important;visibility:hidden!important;pointer-events:none!important;animation:none!important;transform:none!important;box-shadow:none!important}
@media(max-width:600px){
.book{display:grid;grid-template-columns:1fr;grid-template-rows:258px minmax(0,1fr);min-height:0;background:linear-gradient(90deg,#f4ead6,#fffaef 8%,#fffaef 95%,#f5ecd9)}
#illustration,.turn-illustration{height:258px;padding:20px 22px 8px;background:transparent}
#scene-image,.turn-scene-image{height:230px;max-height:230px}
.page{background:transparent;min-height:0}
.book-measure{grid-template-rows:258px auto}
}

.story-shelf{display:flex;flex-wrap:wrap;align-items:flex-start;justify-content:center;gap:55px;max-width:900px;margin:auto}.story-shelf .story-card{margin:35px 0 60px;flex-shrink:0}.story-card.duckling{background:#657c8c;color:#f4e7ca;transform:rotate(3deg)}.duckling .book-spine{background:linear-gradient(90deg,#3f586c,#7c94a5,#5f788b)}.duckling .cover h3{font-size:32px;text-align:center}.duckling .cover{min-height:410px}.story-card.duckling:hover{transform:rotate(0deg) translateY(-6px)}.dots{flex-wrap:wrap;max-width:400px;margin-left:auto;margin-right:auto}.title-line h1{overflow-wrap:anywhere}@media(max-width:600px){.story-shelf{gap:0}.story-shelf .story-card{margin-bottom:35px}.title-line h1{font-size:30px}.title-line>span{white-space:nowrap;margin-left:12px}}

/* The turning leaf owns the image until the new spread is committed. */
.turn-source-hidden{visibility:hidden}
.turn-leaf>.turn-illustration{display:flex;height:100%;padding:30px 26px;background:transparent}
@media(max-width:800px){.turn-leaf>.turn-illustration{padding:22px 18px}}

/* Compact reading spreads for iPhone browser viewports. */
@media(max-width:600px){
body:has(#reader:not([hidden])) header{padding:8px 15px}
#reader .book-top{margin-top:5px}
#reader .title-line h1{font-size:25px;line-height:1.2;margin:8px 0 13px}
#reader .title-line>span{font-size:11px}
.book{--illustration-height:clamp(112px,22svh,160px);grid-template-rows:var(--illustration-height) minmax(0,1fr)}
#illustration{height:var(--illustration-height);padding:10px 18px 4px;gap:0}
#scene-image{height:calc(var(--illustration-height) - 14px);max-height:calc(var(--illustration-height) - 14px)}
.page{padding:12px 20px 28px}
.page .eyebrow{font-size:8px;letter-spacing:1.2px}
.page h2{font-size:21px;line-height:1.25;margin:7px 0 10px}
.story-text{font-size:16px;line-height:1.45}
.story-text p{margin-bottom:7px}
.page-number{bottom:8px;font-size:11px}
.book-measure{grid-template-rows:var(--illustration-height) auto}
.controls{margin:17px auto 11px;gap:6px}
.nav{width:42px;height:42px}
.play{padding:13px 14px;font-size:11px}
#stop{padding:10px}
.speed-label select{max-width:75px;font-size:9px}
.dots{gap:9px}
.status{margin:9px 0;font-size:10px}
}

/* Let shorter text give its spare paper space to the illustration. */
@media(max-width:600px){
.book{--illustration-height:210px}
#illustration{padding:6px 10px 2px}
#scene-image{height:calc(var(--illustration-height) - 8px);max-height:calc(var(--illustration-height) - 8px)}
.page{padding:9px 17px 24px}
.page h2{font-size:19px;line-height:1.2;margin:5px 0 7px}
.story-text{font-size:14px;line-height:1.3}
.story-text p{margin-bottom:4px}
}


/* The reading stage fills the visible browser, with navigation included. */
@media(max-width:600px){
#reader-stage{height:var(--reader-height,100svh);display:flex;flex-direction:column;gap:6px;padding:6px 0 10px;box-sizing:border-box}
#reader-stage>.book{flex:none;min-height:0}
#reader-stage>.controls{flex:none;width:100%;height:48px;margin:0}
#reader-stage>.dots{flex:none;min-height:24px;align-items:center;margin:0 auto}
#reader-stage>.status{flex:none;height:30px;margin:0;display:flex;align-items:center;justify-content:center;font-size:9px;line-height:1.3}
#reader-stage>#ending{flex:none;height:28px;margin:0;font-size:12px;display:flex;align-items:center;justify-content:center}
#reader-stage>#ending[hidden]{display:flex!important;visibility:hidden}
.story-text{font-size:15px;line-height:1.35}
.page{overflow:auto;overscroll-behavior:contain}
.book-measure .page{overflow:visible}
}

/* Keep the paper content at the top of its allocated space. */
#illustration,.turn-illustration{justify-content:flex-start}
#scene-image,.turn-scene-image{object-position:center top}
.page{align-content:start;text-align:left}

.story-card.pigs{background:#b76b43;color:#fff0ce;transform:rotate(-2deg)}
.pigs .book-spine{background:linear-gradient(90deg,#884626,#ce895a,#a75f36)}
.pigs .cover h3{font-size:32px;text-align:center}
.story-card.pigs:hover{transform:rotate(0deg) translateY(-6px)}

.story-card.kotyhoroshko{background:#797547;color:#f8eac6;transform:rotate(2deg)}
.kotyhoroshko .book-spine{background:linear-gradient(90deg,#55552e,#99935c,#6f6b3d)}
.kotyhoroshko .cover h3{font-size:31px;text-align:center}
.story-card.kotyhoroshko:hover{transform:rotate(0deg) translateY(-6px)}

.story-card.thumbelina{background:#a77688;color:#ffedce;transform:rotate(-2deg)}
.thumbelina .book-spine{background:linear-gradient(90deg,#744c61,#bd92a1,#98677d)}
.thumbelina .cover h3{font-size:31px;text-align:center}
.story-card.thumbelina:hover{transform:rotate(0deg) translateY(-6px)}

/* Searchable story pages share the existing reader. */
a.story-card{text-decoration:none}
.full-story{max-width:900px;margin:36px auto;padding:0 24px;color:var(--ink);line-height:1.8}
.full-story summary{cursor:pointer;font-weight:700;padding:14px 0}
.full-story h2{font-size:26px}.full-story h3{font-size:20px;margin-top:28px}
.full-story p{font-family:Literata,Georgia,serif;font-size:17px}
.full-story nav{margin-top:28px}.full-story a{color:inherit}
