:root {
  --ink: #14213d;
  --muted: #5b6680;
  --bg: #fffdf8;
  --surface: #ffffff;
  --soft: #f5f1e8;
  --line: #ece6da;
  --brand: #2f6fdf;
  --brand-dark: #1e4fb0;
  --sun: #ffd23f;
  --sun-dark: #e6b800;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 8px 24px rgba(20, 33, 61, .08);
  --head: "Fredoka", "Nunito", system-ui, sans-serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; font-family: var(--body); font-size: 17px; line-height: 1.65; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-soft { background: var(--soft); }
.eyebrow { display: inline-block; font-weight: 800; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 12px; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 560px; }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 44px; }
.section-head .lead { margin: 0 auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: #fff; padding: 8px 14px; border-radius: 8px; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 253, 248, .9); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.logo { font-family: var(--head); font-weight: 600; font-size: 1.45rem; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 10px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 1.05rem; }
.nav-links { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav-links a { display: block; padding: 8px 14px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: .95rem; }
.nav-links a:hover { background: var(--soft); }
.nav-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; }
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; background: var(--bg); border-bottom: 1px solid var(--line); padding: 10px 20px 18px; }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 8px; font-size: 1.05rem; }
}

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 26px; border-radius: 999px; font-family: var(--body); font-weight: 800; font-size: 1rem; text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(47, 111, 223, .3); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-sun { background: var(--sun); color: var(--ink); box-shadow: 0 6px 16px rgba(230, 184, 0, .3); }
.btn-sun:hover { background: #ffdb66; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Hero */
.hero { padding: clamp(40px, 7vw, 88px) 0; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero-media { position: relative; }
.hero-media img { border-radius: 28px; box-shadow: var(--shadow); aspect-ratio: 4 / 3.4; object-fit: cover; width: 100%; }
.hero-badge { position: absolute; left: -18px; bottom: 28px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 16px; display: flex; gap: 12px; align-items: center; font-weight: 800; font-size: .95rem; }
.hero-badge span { font-size: 1.6rem; }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-badge { left: 12px; bottom: 12px; }
}

/* Book cards */
.books-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 28px; }
.book-card { text-decoration: none; color: inherit; display: flex; flex-direction: column; }
.book-card .cover { transition: transform .2s, box-shadow .2s; }
.book-card:hover .cover { transform: translateY(-4px) rotate(-.6deg); box-shadow: 0 16px 36px rgba(20, 33, 61, .18); }
.book-card h3 { margin: 16px 0 4px; font-size: 1.12rem; }
.book-card p { color: var(--muted); font-size: .95rem; margin: 0 0 8px; }
.book-card .more { font-weight: 800; color: var(--brand); font-size: .92rem; margin-top: auto; }
.cover { aspect-ratio: 2 / 3; width: 100%; border-radius: 6px 14px 14px 6px; box-shadow: var(--shadow); object-fit: cover; background: var(--soft); }
.cover-placeholder { display: flex; flex-direction: column; justify-content: space-between; padding: 22px 18px; color: #fff; position: relative; overflow: hidden; }
.cover-placeholder::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: rgba(0, 0, 0, .15); }
.cover-placeholder::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.cover-placeholder strong { font-family: var(--head); font-weight: 600; font-size: 1.35rem; line-height: 1.15; }
.cover-placeholder small { font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: .7rem; opacity: .85; }
.tag { display: inline-block; background: var(--soft); color: var(--muted); font-weight: 800; font-size: .78rem; padding: 4px 10px; border-radius: 999px; }

/* Feature cards */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; }
.feature-icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font-size: 1.6rem; margin-bottom: 16px; }
.feature p { color: var(--muted); margin: 0; }
@media (max-width: 860px) { .features { grid-template-columns: 1fr; } }

/* About */
.about-grid { display: grid; grid-template-columns: 380px 1fr; gap: 56px; align-items: center; }
.about-grid img { border-radius: 28px; box-shadow: var(--shadow); aspect-ratio: 1; object-fit: cover; }
.about-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 24px; }
.about-photos img { border-radius: 16px; aspect-ratio: 4 / 3; object-fit: cover; box-shadow: none; }
@media (max-width: 860px) { .about-grid { grid-template-columns: 1fr; gap: 32px; } .about-grid > img { max-width: 320px; } }

/* CTA band */
.cta-band { background: var(--brand); color: #fff; border-radius: 28px; padding: clamp(32px, 6vw, 56px); display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; opacity: .9; }

/* Book page */
.book-hero { padding: clamp(32px, 6vw, 72px) 0; }
.book-hero-grid { display: grid; grid-template-columns: 360px 1fr; gap: 56px; align-items: start; }
.book-hero .cover { max-width: 360px; }
.book-hero .subtitle { font-family: var(--head); font-size: 1.3rem; color: var(--muted); margin: -6px 0 18px; }
.breadcrumb { font-size: .9rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); }
.learn-list { list-style: none; padding: 0; margin: 20px 0 28px; display: grid; gap: 10px; }
.learn-list li { display: flex; gap: 12px; align-items: flex-start; }
.learn-list li::before { content: "✓"; flex: none; width: 26px; height: 26px; border-radius: 50%; background: #e3f5ec; color: #1f9d6b; display: grid; place-items: center; font-weight: 800; font-size: .85rem; margin-top: 2px; }
.store-note { font-size: .88rem; color: var(--muted); margin-top: 14px; }
.store-note a { margin-right: 8px; }
.coming-soon { background: var(--soft); border-radius: 14px; padding: 14px 18px; color: var(--muted); font-weight: 700; }
@media (max-width: 860px) { .book-hero-grid { grid-template-columns: 1fr; gap: 32px; } .book-hero .cover { max-width: 260px; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: clamp(28px, 5vw, 48px); }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .panel-grid { grid-template-columns: 1fr; } }
.review-panel { background: linear-gradient(135deg, #fff7d6, #fff); border-color: #f5e6a8; }
.stars { font-size: 1.6rem; letter-spacing: 4px; margin-bottom: 8px; }
.wide-photo { border-radius: 28px; aspect-ratio: 16 / 7; object-fit: cover; width: 100%; box-shadow: var(--shadow); }

/* Prose (privacy) */
.prose { max-width: 720px; }
.prose h2 { font-size: 1.4rem; margin-top: 1.6em; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 48px 0 36px; margin-top: 40px; }
.footer-grid { display: flex; justify-content: space-between; gap: 28px; flex-wrap: wrap; }
.footer-grid p { color: var(--muted); margin: 6px 0 0; max-width: 360px; font-size: .95rem; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-weight: 700; }
.footer-links a { color: var(--ink); text-decoration: none; }
.footer-links a:hover { color: var(--brand); }
.copyright { color: var(--muted); font-size: .85rem; margin-top: 28px; }

:focus-visible { outline: 3px solid var(--sun-dark); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ===== Animations ===== */
@keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes drift { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(30px, -20px) scale(1.08); } 66% { transform: translate(-20px, 15px) scale(.95); } }
@keyframes twinkle { 0%, 100% { opacity: .25; transform: scale(.8) rotate(0); } 50% { opacity: 1; transform: scale(1.15) rotate(20deg); } }
@keyframes marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }
@keyframes shine { from { left: -60%; } to { left: 130%; } }
@keyframes gradient { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* Hero entrance */
.hero { position: relative; overflow: hidden; }
.hero-grid > div:first-child > * { animation: rise .8s cubic-bezier(.2, .7, .2, 1) both; }
.hero-grid > div:first-child > *:nth-child(2) { animation-delay: .1s; }
.hero-grid > div:first-child > *:nth-child(3) { animation-delay: .2s; }
.hero-grid > div:first-child > *:nth-child(4) { animation-delay: .3s; }
.hero-media { animation: rise 1s .2s cubic-bezier(.2, .7, .2, 1) both; }
.hero-media img { animation: float 7s ease-in-out 1.2s infinite; }
.hero-badge { animation: pop .6s .9s cubic-bezier(.2, .7, .2, 1) both; }
.hero h1 .accent { background: linear-gradient(90deg, var(--brand), #7b4ddb, #e5484d, var(--brand)); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradient 8s ease infinite; }

/* Hero decorations */
.hero-deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.hero .container { position: relative; z-index: 1; }
.blob { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .45; animation: drift 16s ease-in-out infinite; }
.blob.b1 { width: 380px; height: 380px; background: #cfe0ff; top: -120px; right: 8%; }
.blob.b2 { width: 300px; height: 300px; background: #ffe9a8; bottom: -100px; left: -60px; animation-delay: -5s; }
.blob.b3 { width: 220px; height: 220px; background: #ffd6d6; top: 40%; left: 45%; animation-delay: -10s; opacity: .3; }
.star { position: absolute; color: var(--sun-dark); font-size: 1.4rem; animation: twinkle 3.5s ease-in-out infinite; }
.star.s1 { top: 14%; left: 48%; }
.star.s2 { top: 72%; left: 52%; font-size: 1rem; animation-delay: -1.2s; color: var(--brand); }
.star.s3 { top: 10%; right: 4%; font-size: 1.1rem; animation-delay: -2.3s; color: #e5484d; }

/* Marquee */
.marquee { background: var(--ink); color: #fff; overflow: hidden; padding: 16px 0; }
.marquee-track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee span { font-family: var(--head); font-size: 1.2rem; white-space: nowrap; padding: 0 22px; }
.marquee span.dot { color: var(--sun); padding: 0; }

/* Header on scroll */
.site-header { transition: box-shadow .3s, background .3s; }
.site-header.scrolled { box-shadow: 0 6px 24px rgba(20, 33, 61, .08); background: rgba(255, 253, 248, .97); }

/* Button shine */
.btn { position: relative; overflow: hidden; }
.btn::after { content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg); pointer-events: none; }
.btn:hover::after { animation: shine .7s ease; }

/* Scroll reveal (only when JS is running) */
.js .reveal { opacity: 0; transform: translateY(32px); transition: opacity .7s cubic-bezier(.2, .7, .2, 1), transform .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* 3D book tilt */
.book-card { perspective: 900px; }
.book-card .tilt { position: relative; border-radius: 6px 14px 14px 6px; transition: transform .25s ease, box-shadow .25s; }
.book-card .tilt::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at var(--mx, 50%) var(--my, 0%), rgba(255, 255, 255, .35), transparent 55%); opacity: 0; transition: opacity .25s; pointer-events: none; }
.book-card:hover .tilt::after { opacity: 1; }
.book-card:hover .cover { transform: none; }

/* Feature hover */
.feature { transition: transform .25s, box-shadow .25s; }
.feature:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.feature:hover .feature-icon { animation: pop .5s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ===== 3D ===== */
.hero-3d { position: relative; aspect-ratio: 4 / 3.4; width: 100%; }
.hero-3d img { position: absolute; inset: 0; height: 100%; transition: opacity .6s; }
.hero-3d canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; transition: opacity 1s; touch-action: pan-y; }
.hero-3d.ready canvas { opacity: 1; }
.hero-3d.ready img { opacity: 0; visibility: hidden; }

/* CSS 3D book on book pages */
@keyframes book-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.book3d { --w: 340px; --t: 34px; width: var(--w); max-width: 100%; perspective: 1400px; animation: book-float 6s ease-in-out infinite; margin: 10px 0 30px; }
.book3d-inner { position: relative; width: var(--w); transform-style: preserve-3d; transform: rotateY(-30deg) rotateX(5deg); transition: transform .9s cubic-bezier(.2, .7, .2, 1); }
.book3d:hover .book3d-inner { transform: rotateY(-6deg) rotateX(2deg); }
.book3d-inner > .cover { position: relative; z-index: 1; max-width: none; width: 100%; transform: translateZ(calc(var(--t) / 2)); border-radius: 3px 8px 8px 3px; box-shadow: inset 4px 0 8px rgba(0, 0, 0, .18); }
.book3d-inner::before { content: ""; position: absolute; top: 5px; bottom: 5px; left: calc(var(--w) - var(--t) / 2 - 4px); width: var(--t); transform: rotateY(90deg); background: repeating-linear-gradient(90deg, #fffdf7 0 2px, #e6dece 2px 3px); }
.book3d-inner::after { content: ""; position: absolute; inset: 0; transform: translateZ(calc(var(--t) / -2)); background: var(--c); border-radius: 3px 8px 8px 3px; box-shadow: -18px 22px 50px rgba(20, 33, 61, .35); }
@media (max-width: 860px) { .book3d { --w: 230px; --t: 26px; margin: 0 auto 10px; } }
@media (prefers-reduced-motion: reduce) { .book3d-inner { transform: rotateY(-18deg); } }

/* ===== Illustrations ===== */
.feature-img { width: 84px; height: 84px; object-fit: contain; margin: -6px 0 14px; filter: drop-shadow(0 8px 12px rgba(20, 33, 61, .12)); transition: transform .3s cubic-bezier(.2, .7, .2, 1); }
.feature:hover .feature-img { transform: translateY(-6px) rotate(-6deg) scale(1.08); }
.mascots { width: 220px; margin: 0 auto 18px; animation: float 5s ease-in-out infinite; filter: drop-shadow(0 16px 18px rgba(20, 33, 61, .15)); }
.section-soft { position: relative; isolation: isolate; }
.section-soft::before { content: ""; position: absolute; inset: 0; z-index: -1; background: url(/img/pattern.webp) repeat; background-size: 380px; opacity: .35; }
