/* AlphabetsLearn shared kid theme – used by every page */
/* Self-hosted Baloo 2 (no render-blocking Google Fonts request). "optional" avoids layout shift. */
@font-face { font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: optional;
    src: url(/assets/fonts/baloo2-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-style: normal; font-weight: 500 800; font-display: optional;
    src: url(/assets/fonts/baloo2-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
:root {
    --k-sun: #ffcf3f;
    --k-orange: #cc4a0c;
    --k-red: #d61f45;
    --k-pink: #ff8fd0;
    --k-purple: #7c3aed;
    --k-blue: #1d6fd1;
    --k-sky: #bfe8ff;
    --k-green: #15803d;
    --k-mint: #c9f7dc;
    --k-ink: #2d2a4a;
    --k-ink-soft: #5b587a;
    --k-card: #ffffff;
    --k-radius: 22px;
    --k-shadow: 0 6px 0 rgba(45, 42, 74, .12), 0 12px 24px rgba(45, 42, 74, .08);
    --k-font: 'Baloo 2', 'Quicksand', 'Nirmala UI', 'Noto Sans', system-ui, sans-serif;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body.kids {
    margin: 0;
    font-family: var(--k-font);
    color: var(--k-ink);
    background: linear-gradient(180deg, #bfe8ff 0%, #e6f6ff 35%, #fff7d6 100%) fixed;
    min-height: 100vh;
    overflow-x: hidden;
    padding-top: 60px;
}
body.kids img, body.kids video, body.kids canvas { max-width: 100%; }
body.kids *, body.kids *::before, body.kids *::after { box-sizing: border-box; }
body.kids button, body.kids input, body.kids select, body.kids textarea { font-family: inherit; }
body.kids :focus-visible { outline: 4px solid var(--k-purple); outline-offset: 2px; border-radius: 12px; }

/* ---------- Floating sky decorations ---------- */
.k-sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.k-sky span { position: absolute; font-size: 2.4rem; opacity: .55; animation: k-drift 28s linear infinite; }
.k-sky span:nth-child(1) { top: 8%;  left: -10%; animation-duration: 38s; }
.k-sky span:nth-child(2) { top: 22%; left: -10%; animation-duration: 52s; animation-delay: -20s; font-size: 3rem; }
.k-sky span:nth-child(3) { top: 60%; left: -10%; animation-duration: 45s; animation-delay: -8s; }
.k-sky span:nth-child(4) { top: 78%; left: -10%; animation-name: k-rise; animation-duration: 18s; left: 85%; }
.k-sky span:nth-child(5) { top: 90%; left: 10%; animation-name: k-rise; animation-duration: 22s; animation-delay: -9s; }
.k-sky span:nth-child(6) { top: 40%; left: -10%; animation-duration: 60s; animation-delay: -35s; font-size: 2rem; }
@keyframes k-drift { from { transform: translateX(0); } to { transform: translateX(120vw); } }
@keyframes k-rise { 0% { transform: translateY(20vh) rotate(-6deg); opacity: 0; } 15% { opacity: .6; } 100% { transform: translateY(-110vh) rotate(6deg); opacity: 0; } }

/* ---------- Top bar ---------- */
.k-topbar {
    position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 900;
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem max(16px, env(safe-area-inset-left));
    background: #fff; margin: 0; border: 0; text-align: left; font-family: var(--k-font); line-height: 1.2;
    box-shadow: 0 4px 0 rgba(45, 42, 74, .08);
}
.k-brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; color: var(--k-ink); font-weight: 800; font-size: 1.25rem; white-space: nowrap; }
.k-brand img { width: 40px; height: 40px; border-radius: 12px; animation: k-wiggle 4s ease-in-out infinite; }
.k-brand b { color: var(--k-orange); }
.k-nav { display: flex; gap: .35rem; margin: 0 0 0 auto; padding: 0; flex-wrap: nowrap; background: none; border: 0; }
.k-topbar a, .k-topbar button { float: none; width: auto; margin: 0; letter-spacing: normal; text-transform: none; }
.k-nav a {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .45rem .8rem; border-radius: 999px;
    text-decoration: none; color: var(--k-ink); font-weight: 700; font-size: .98rem;
    transition: transform .15s, background .15s;
    white-space: nowrap;
}
.k-nav a:hover { background: #fff1c2; transform: translateY(-2px) rotate(-2deg); }
.k-nav a.on { background: var(--k-sun); box-shadow: 0 3px 0 #e0a800; }
.k-burger {
    display: none; margin-left: auto;
    border: 0; background: var(--k-orange); color: #fff;
    font-size: 1.1rem; font-weight: 800; padding: .5rem .9rem; border-radius: 999px;
    box-shadow: 0 4px 0 #9a3708; cursor: pointer;
}
.k-burger:active { transform: translateY(3px); box-shadow: 0 1px 0 #9a3708; }

@media (max-width: 1220px) {
    .k-burger { display: inline-flex; align-items: center; gap: .35rem; }
    .k-nav {
        position: absolute; top: calc(100% + 6px); right: 12px; left: 12px; z-index: 950;
        flex-direction: column; gap: .25rem; padding: .75rem;
        background: #fff; border-radius: var(--k-radius); box-shadow: var(--k-shadow);
        max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain;
        transform: translateY(-12px) scale(.96); opacity: 0; pointer-events: none;
        transition: transform .2s, opacity .2s;
    }
    .k-nav.open { transform: none; opacity: 1; pointer-events: auto; }
    .k-nav a { font-size: 1.1rem; padding: .7rem 1rem; }
}

/* ---------- Generic kid components ---------- */
.k-wrap { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 1rem 16px 2rem; }
.k-card { background: var(--k-card); border-radius: var(--k-radius); box-shadow: var(--k-shadow); padding: 1.25rem; }
.k-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 48px; padding: .6rem 1.2rem; border: 0; border-radius: 999px;
    background: var(--k-orange); color: #fff; font-weight: 800; font-size: 1.05rem;
    box-shadow: 0 5px 0 #9a3708; cursor: pointer; text-decoration: none;
    transition: transform .12s, box-shadow .12s, filter .12s;
}
.k-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.k-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #9a3708; }
.k-btn.blue { background: var(--k-blue); box-shadow: 0 5px 0 #14529c; }
.k-btn.green { background: var(--k-green); box-shadow: 0 5px 0 #0f5c2c; }
.k-btn.purple { background: var(--k-purple); box-shadow: 0 5px 0 #5b21b6; }
.k-btn.pink { background: var(--k-red); box-shadow: 0 5px 0 #a3132f; }

.k-footer {
    position: relative; z-index: 1;
    margin-top: 2rem; padding: 1.5rem 16px calc(1.5rem + env(safe-area-inset-bottom));
    text-align: center; color: #fff; font-weight: 600;
    background: linear-gradient(180deg, #15803d, #116b33);
    border-radius: 40px 40px 0 0;
}
.k-footer::before { content: "🌷 🌼 🌻 🌸 🌷 🌼 🌻"; display: block; font-size: 1.4rem; margin-top: -2.4rem; margin-bottom: .6rem; letter-spacing: .3rem; }
.k-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1rem; margin-top: .6rem; }
.k-footer a { color: #fff; }

/* ---------- Celebration ---------- */
.k-confetti { position: fixed; top: -20px; z-index: 3000; pointer-events: none; font-size: 1.6rem; animation: k-fall linear forwards; }
@keyframes k-fall { to { transform: translateY(110vh) rotate(720deg); opacity: .8; } }
.k-toast {
    position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 3001;
    transform: translateX(-50%); background: #fff; color: var(--k-ink);
    font-weight: 800; font-size: 1.3rem; padding: .7rem 1.4rem; border-radius: 999px;
    box-shadow: var(--k-shadow); animation: k-pop .4s cubic-bezier(.3,1.6,.5,1);
    max-width: calc(100vw - 32px); text-align: center;
}
@keyframes k-pop { from { transform: translateX(-50%) scale(.3); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@keyframes k-wiggle { 0%, 90%, 100% { transform: rotate(0); } 93% { transform: rotate(-10deg); } 96% { transform: rotate(10deg); } }
@keyframes k-bounce-in { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
    .k-sky, .k-confetti { display: none !important; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Calm first paint: endless decorative animations only run once html.anim is set (see kids.js) ---------- */
html:not(.anim) .k-brand img, html:not(.anim) .hero h1 .rainbow span, html:not(.anim) .star-pill span,
html:not(.anim) .more-langs, html:not(.anim) .draw-hero h1, html:not(.anim) .ref-char, html:not(.anim) .book .cv,
html:not(.anim) .globe, html:not(.anim) .hero-flag, html:not(.anim) .k-footer::before { animation: none !important; }
