/* kids-nav.css: owned by area N, navigation and home (tools/kids/FUN.md sections 2 and 5; CONTRACT section 16b). Class prefix kn-.
 * The tab bar, the Leave key, the Games screen and My sky. Light theme only. Targets follow the band (--kids-target: 64 / 56 / 44 px).
 * Pictures come from LR.fx (their colours are the --kx-* tokens of kids-fx.css: text on a colour or its tint is --ink or the colour's -deep). Nothing here moves
 * except calm loops that stand still under prefers-reduced-motion. */

/* ============================================================ the tab bar (22-nav.js) */
:root { --kn-tab-h: 60px; --kn-bar-h: 0px; --kn-pic: 32px; }
html[data-band="little"] { --kn-tab-h: 68px; --kn-pic: 44px; }
html[data-band="readers"] { --kn-tab-h: 62px; --kn-pic: 34px; }
html[data-band="big"] { --kn-tab-h: 56px; --kn-pic: 30px; }
/* the page keeps clear of the bar: its height is reserved at the foot of the page, the focus and scrollIntoView keep clear of it, a toast sits above it */
html.kn-tabs-on { --kn-bar-h: calc(var(--kn-tab-h) + 14px + env(safe-area-inset-bottom, 0px)); padding-bottom: 0; scroll-padding-bottom: calc(var(--rbar-space, 0px) + var(--kn-bar-h) + 16px); }
html.kn-tabs-on body { padding-bottom: var(--kn-bar-h); }
html.kn-tabs-on .scr { padding-bottom: var(--s4); }                  /* the bar's room is reserved on the body: the page needs no foot of its own */
html.kn-tabs-on:not(.has-layer) .lr-toast { bottom: calc(var(--kn-bar-h) + 12px + var(--rbar-space, 0px)); }

.kn-tabs {
  position: fixed; inset-inline: 0; bottom: 0; z-index: var(--z-top, 40);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  background: var(--raised); border-top: 2px solid var(--rule); box-shadow: 0 -10px 22px -16px rgb(12 21 18 / .5);
}
.kn-tabs[hidden] { display: none !important; }
.kn-tabs__list { list-style: none; margin: 0 auto; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; max-width: 40rem; }
.kn-tabs__list > li { min-width: 0; }
.kn-tab {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-width: 0; min-height: var(--kn-tab-h); padding: 3px 2px 4px; box-sizing: border-box;
  color: var(--ink-soft); text-decoration: none; text-align: center; border: 2px solid transparent; border-radius: 18px;
  font: 700 var(--t-sm)/1.1 var(--font-body); -webkit-tap-highlight-color: transparent;
}
.kn-tab__pic { display: grid; place-items: center; --kx-art-size: var(--kn-pic); }
.kn-tab__pic .kx-art { filter: saturate(.5) opacity(.78); }
.kn-tab__t { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .kn-tab:not([aria-current="page"]):hover { background: var(--hover-mix); } }
/* the current tab is filled: the colour's tint, a deep rim and lip, the picture in full colour and a little larger */
.kn-tab[aria-current="page"] { background: var(--kx-c-tint); border-color: var(--kx-c-deep); border-bottom-width: 4px; color: var(--kx-c-deep); }
.kn-tab[aria-current="page"] .kx-art { filter: none; }
.kn-tab[aria-current="page"] .kn-tab__pic { transform: scale(1.1); }
.kn-tab:focus-visible { outline: 3px solid var(--lapis); outline-offset: 1px; }
/* N-4 / KIDS-N-2: a short window (a phone on its side, a small tablet) gives the chrome's height back: the bar is one line (a picture and its word side by side; Little ones the picture only) and exactly the
   band's target tall (64 / 56 / 44 px), with thinner padding; the top bar of a Big reader is 56 px, the page's own padding is halved. Nothing under the band's target. */
@media (max-height: 520px) {
  html.kn-tabs-on { --kn-bar-h: calc(var(--kids-target) + 8px + env(safe-area-inset-bottom, 0px)); }
  .kn-tabs { padding: 3px 8px calc(3px + env(safe-area-inset-bottom, 0px)); }
  .kn-tab { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px; min-height: var(--kids-target); padding: 2px 6px; }
  .kn-tab__t { max-width: calc(100% - var(--kn-pic) - 8px); }
  .kn-tab[aria-current="page"] { border-bottom-width: 2px; }
  html[data-band="big"] { --topbar-base: 56px; }
  html.kn-tabs-on .scr { padding-block: var(--s2); }
}
/* Little ones read no word: the picture only (the name is the link's label and is spoken when it is pressed) */
html[data-band="little"] .kn-tab__t { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
html[data-band="little"] .kn-tab { min-height: var(--kids-target); }
html[data-band="little"] .kn-tabs__list { gap: 10px; }

/* ============================================================ the top bar's three things, and the Leave key in its first place */
.topbar .kn-house { display: none; flex: none; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--raised);
  border: 2px solid var(--kx-mint-deep); box-shadow: 0 2px 0 var(--kx-mint-deep); --kx-art-size: 70%; }
.topbar .kn-house .kx-art { width: 70%; height: 70%; }
html[data-nav="leave"] .topbar .tb-logo { display: none; }
html[data-nav="leave"] .topbar .kn-house { display: grid; }
html[data-nav="leave"] .topbar .tb-brand { gap: 10px; }
html[data-band="readers"] .topbar .kn-house { width: 56px; height: 56px; }
html[data-band="little"] .topbar .kn-house { width: 64px; height: 64px; border-radius: 18px; }
html[data-band="readers"] { --topbar-base: 64px; }
/* KIDS-N-8: Readers' targets are 56 px (PLAN 3.1): the name, the reader and Grown-ups are as tall as the Leave house beside them (the bar is 64 px for Readers) */
html[data-band="readers"] .topbar .tb-btn { min-width: 56px; height: 56px; }
html[data-band="readers"] .topbar .tb-brand { min-height: 56px; }
@media (hover: hover) { html[data-nav="leave"] .topbar .tb-brand:hover .kn-house { background: var(--kx-mint-tint); } }
html[data-nav="leave"] .topbar .tb-brand:focus-visible .kn-house { outline: 3px solid var(--on-cover); outline-offset: 2px; }
/* Little ones read no word in the bar: the star mark (or the house) and the two keys; the name stays for a screen reader */
html[data-band="little"] .topbar .tb-word, html[data-band="little"] .topbar .tb-title { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
html[data-band="little"] .topbar .tb-logo { width: 44px; height: 44px; }
html[data-band="little"] .topbar .tb-brand { min-height: 64px; min-width: 64px; }

/* the one question: leave a game that is under way? Stay first and large, Leave beside it; Little ones see two pictures */
.kn-ask { text-align: center; }
.kn-ask .sheet__body { display: grid; gap: var(--s4); justify-items: center; padding-block: var(--s4); }
.kn-ask__h { margin: 0; font: 700 var(--t-h2)/1.2 var(--font-display); }
.kn-ask__keys { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s4); width: 100%; }
.kn-ask__keys .key { min-width: max(9rem, var(--kids-target)); min-height: max(var(--kids-target), 60px); justify-content: center; font-size: var(--t-btn-kid); }
html[data-band="little"] .kn-ask__keys .key { min-width: 108px; min-height: 84px; }
html[data-band="little"] .kn-ask__keys .key .icon { width: 40px; height: 40px; }

@media print { .kn-tabs { display: none !important; } html.kn-tabs-on body { padding-bottom: 0; } }

/* ============================================================ a game's card (Games and the Home row; 65-sessions.js gameCard) */
.kn-games { display: grid; gap: var(--s4); max-width: 64rem; margin-inline: auto; }
.kn-games__h { margin: 0; }
.kn-games .kh-lead { margin: 0; }
.kn-games__grid { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kn-games__grid > li { min-width: 0; display: flex; }
@container app (min-width: 560px) { .kn-games__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container app (min-width: 860px) { .kn-games__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s4); } }
.kn-gcard {
  position: relative; display: grid; grid-template-rows: auto auto 1fr; justify-items: center; align-content: start; gap: 4px; width: 100%; min-width: 0; min-height: 11.5rem; box-sizing: border-box;
  padding: 14px 8px 12px; text-align: center; text-decoration: none; cursor: pointer; font: inherit; color: var(--ink);
  background: var(--kx-c-tint); border: 2px solid var(--kx-c); border-bottom: 6px solid var(--kx-c-deep); border-radius: 24px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
@media (hover: hover) { .kn-gcard:not(.is-locked):hover { background: color-mix(in oklab, var(--kx-c-tint), var(--kx-c) 28%); } }
.kn-gcard:not(.is-locked):active { border-bottom-width: 4px; padding-bottom: 14px; }
.kn-gcard:focus-visible { outline: 3px solid var(--lapis); outline-offset: 3px; }
.kn-gcard__pic { position: relative; display: grid; place-items: center; width: 100%; height: 92px; --kx-art-size: 86px; }
.kn-gcard__t { font: 800 var(--t-h3)/1.15 var(--font-display); color: var(--kx-c-deep); text-wrap: balance; overflow-wrap: anywhere; }
.kn-gcard__sub { font: 700 var(--t-sm)/1.25 var(--font-body); color: var(--ink); }
.kn-gcard__new { display: inline-block; align-self: start; padding: 1px 12px 2px; border-radius: var(--r-pill); background: var(--kx-c-deep); color: var(--kx-on-deep); font: 800 var(--t-sm)/1.35 var(--font-body); }
/* a game not yet open: grey and quiet, a lock on its picture and what opens it */
.kn-gcard.is-locked { background: #F2F4F3; border-color: var(--rule); border-bottom-color: var(--edge); color: var(--ink-soft); cursor: default; }
.kn-gcard.is-locked .kn-gcard__t { color: var(--ink-soft); }
.kn-gcard.is-locked .kn-gcard__sub { color: var(--ink-soft); }
.kn-gcard.is-locked .kn-gcard__pic .kx-art { filter: grayscale(.85) opacity(.5); }
.kn-gcard__lock { position: absolute; inset-inline-end: 14%; bottom: 0; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--raised); border: 2px solid var(--edge); color: var(--ink-soft); }
.kn-gcard__lock .icon { width: 18px; height: 18px; }
/* Little ones: a picture, and one small sign under it: a new star, a ribbon and the best, or the number of the session that opens it */
html[data-band="little"] .kn-gcard { min-height: 10.5rem; justify-items: center; }
html[data-band="little"] .kn-gcard__pic { height: 104px; --kx-art-size: 98px; }
.kn-gcard__best { display: inline-flex; align-items: center; gap: 4px; font: 800 1.375rem/1 var(--font-display); color: var(--kx-c-deep); }
.kn-gcard__sub.kn-gcard__best { font: 700 var(--t-sm)/1.25 var(--font-body); color: var(--ink); }
.kn-gcard__at { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 6px; border-radius: 12px; background: var(--raised); border: 2px solid var(--edge); color: var(--ink-soft); font: 800 1.25rem/1 var(--font-display); }
/* the smaller card of the Home row */
.kn-gcard--sm { min-height: 9rem; padding: 10px 6px 10px; gap: 2px; border-radius: 22px; }
.kn-gcard--sm .kn-gcard__pic { height: 72px; --kx-art-size: 68px; }
.kn-gcard--sm .kn-gcard__t { font-size: var(--t-body); }
.kn-gcard--sm .kn-gcard__sub { font-size: var(--t-cap); }
html[data-band="little"] .kn-gcard--sm { min-height: 8.5rem; }
html[data-band="little"] .kn-gcard--sm .kn-gcard__pic { height: 84px; --kx-art-size: 80px; }
@media (prefers-reduced-motion: no-preference) { .kn-gcard.is-new:not(.is-locked) .kn-gcard__pic .kx-art { animation: kx-pulse 2.4s ease-in-out infinite alternate; } }

/* ============================================================ My sky (66-sky.js): the night, ten pictures drawn in stars, the star count and the bests under it */
.kn-sky { position: relative; display: grid; gap: var(--s4); max-width: 72rem; margin-inline: auto; }
/* the night is behind the whole page (a fixed layer on <body>); everything with words sits on a card of its own */
.kn-sky__bg { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; background: #3F3B9E; }
.kn-sky__bg .kx-scene [data-focus="1"], .kn-sky__bg .kx-scene circle[r="110"] { display: none; }   /* the scene's own moon: this sky has its crescent among the pictures */
.kn-sky__veil { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgb(26 20 84 / 0) 0%, rgb(26 20 84 / .28) 45%, rgb(26 20 84 / .6) 100%); }
html.kn-sky-on body { background: #3F3B9E; }
.kn-sky__top { display: grid; gap: 4px; justify-items: start; padding: var(--s3) var(--s4); background: #fff; color: var(--ink); border: 2px solid var(--rule); border-radius: 22px; }
.kn-sky__top.is-quiet { padding: 0; border: 0; background: transparent; }
.kn-sky__h { margin: 0; }
.kn-sky__lead { margin: 0; font: 500 var(--t-body)/1.4 var(--font-body); color: var(--ink-soft); }
.kn-sky__figs { list-style: none; margin: 0; padding: var(--s2) 0 var(--s3); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4) var(--s2); align-items: start; }
@container app (min-width: 640px) { .kn-sky__figs { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s5) var(--s3); } }
.kn-sky__fig { display: flex; justify-content: center; min-width: 0; }
.kn-sky__fig:last-child:nth-child(odd) { grid-column: 1 / -1; }
@container app (min-width: 640px) { .kn-sky__fig:last-child:nth-child(odd) { grid-column: auto; } }
.kn-con {
  appearance: none; background: transparent; border: 0; margin: 0; padding: 6px; width: 100%; max-width: 210px; display: grid; justify-items: center; gap: 2px; color: #fff; cursor: pointer;
  border-radius: 24px; translate: var(--kn-dx, 0px) var(--kn-dy, 0px); -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.kn-con:focus-visible { outline: 3px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 6px var(--lapis); }
.kn-con__svg { display: block; width: 100%; height: auto; aspect-ratio: 1; overflow: visible; }
.kn-con.is-chosen .kn-con__svg { filter: drop-shadow(0 0 7px rgb(255 232 140 / .85)); }
.kn-con.is-here:not(.is-chosen) .kn-con__svg { filter: drop-shadow(0 0 5px rgb(255 255 255 / .55)); }
.kn-con__n { display: inline-flex; align-items: baseline; gap: 6px; padding: 2px 12px 3px; border-radius: var(--r-pill); background: rgb(255 255 255 / .94); color: var(--ink); font: 700 var(--t-sm)/1.3 var(--font-body); }
.kn-con__num { font: 800 var(--t-body)/1.2 var(--font-display); }
.kn-con.is-complete .kn-con__n { background: #FFF3B8; }
.kn-con__line { fill: none; stroke: #FFF3B8; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.kn-con__line.is-guide { stroke: rgb(255 255 255 / .34); stroke-width: 1; stroke-dasharray: 1.2 2.6; }
.kn-con__halo { fill: rgb(255 214 90 / .34); transform-box: fill-box; transform-origin: center; }
.kn-con__core { fill: #FFD54F; stroke: #FFF6C9; stroke-width: .8; stroke-linejoin: round; }
.kn-con__slot { fill: rgb(255 255 255 / .16); stroke: rgb(255 255 255 / .95); stroke-width: 1.1; stroke-dasharray: 2.2 2.2; }
/* KIDS-N-4: a session whose first day is done is HALF lit (a solid pale-gold ring and a small core: a session takes two days); the star the reader is on breathes */
.kn-con__halo.is-half { fill: rgb(255 214 90 / .24); }
.kn-con__halo.is-next { fill: rgb(255 255 255 / .2); }
.kn-con__ring { fill: rgb(255 214 90 / .2); stroke: #FFE98A; stroke-width: 1.3; }
.kn-con__core.is-half { fill: #FFD54F; stroke: #FFF6C9; stroke-width: .6; }
.kn-con__small { fill: rgb(255 255 255 / .78); }
.kn-con__small.is-lit { fill: #FFE98A; stroke: none; }
/* what the chosen picture says: on a card of its own (text never sits straight on the night) */
.kn-sky__say { display: grid; gap: 4px; justify-items: start; min-height: 0; padding: var(--s3) var(--s4); background: #fff; color: var(--ink); border: 2px solid var(--rule); border-radius: 20px; }
.kn-sky__say:empty { display: none; }
/* KIDS-N-3: once a picture was tapped the card rides above the tab bar (it sticks to the bottom of the screen until the page scrolls to its own place), so what the tap said is always on the screen */
.kn-sky__say.is-float { position: sticky; bottom: calc(var(--kn-bar-h, 0px) + 8px); z-index: 3; box-shadow: 0 8px 22px rgb(10 8 50 / .4); }
.kn-sky__say p { margin: 0; }
.kn-sky__say-t { font: 600 var(--t-body)/1.3 var(--font-body); }
.kn-sky__say-l { font: 500 var(--t-body)/1.4 var(--font-body); color: var(--ink-soft); }
.kn-sky__cert { margin-top: var(--s2); min-height: var(--kids-target); }
.kn-sky__under { display: grid; gap: var(--s4); grid-template-columns: minmax(0, 1fr); align-items: start; padding: var(--s4); background: #fff; color: var(--ink); border: 2px solid var(--rule); border-radius: 24px; }
@container app (min-width: 760px) { .kn-sky__under { grid-template-columns: auto minmax(0, 1fr); } .kn-sky__certs { grid-column: 1 / -1; } }
.kn-stat { display: inline-flex; align-items: center; gap: 10px; padding: 10px 20px 10px 14px; background: var(--kx-c-tint); border: 2px solid var(--kx-c); border-bottom: 5px solid var(--kx-c-deep); border-radius: 22px; color: var(--ink); }
.kn-stat__n { font: 800 2.25rem/1 var(--font-display); color: var(--kx-c-deep); }
.kn-stat__t { font: 700 var(--t-body)/1 var(--font-body); }
.kn-sky__h2 { margin: 0 0 var(--s2); font: 700 var(--t-h3)/1.2 var(--font-display); }
.kn-sky__none { margin: 0; color: var(--ink-soft); }
.kn-bests, .kn-certs { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2); }
.kn-best { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; background: var(--kx-c-tint); border: 2px solid var(--kx-c); border-radius: 18px; color: var(--ink); }
.kn-best__t { display: grid; }
.kn-best__name { font: 800 var(--t-sm)/1.2 var(--font-display); color: var(--kx-c-deep); }
.kn-best__v { font: 700 var(--t-sm)/1.25 var(--font-body); }
html[data-band="little"] .kn-best__v.num { font: 800 1.5rem/1 var(--font-display); color: var(--kx-c-deep); }
.kn-certkey { display: inline-flex; align-items: center; gap: 8px; min-height: var(--kids-target); padding: 4px 16px 4px 10px; background: var(--kx-c-tint); border: 2px solid var(--kx-c-deep); border-radius: 18px; color: var(--kx-c-deep); text-decoration: none; font: 800 var(--t-sm)/1.2 var(--font-display); }
@media (hover: hover) { .kn-certkey:hover { background: color-mix(in oklab, var(--kx-c-tint), var(--kx-c) 30%); } }
/* the small sky of Today's end: the level's picture with its newest star, on the night */
.kn-skymini { display: inline-flex; align-items: center; gap: 10px; min-height: var(--kids-target); padding: 6px 14px 6px 8px; background: #2D2A78; color: #fff; border: 2px solid #4B40A4; border-radius: 22px; text-decoration: none; font: 700 var(--t-sm)/1.25 var(--font-body); }
.kn-skymini__pic { display: block; width: 86px; height: 86px; flex: none; }
.kn-skymini .kn-con__svg { width: 100%; height: 100%; }
.kn-skymini .icon { flex: none; width: 22px; height: 22px; color: #fff; }
.kn-skymini:focus-visible { outline: 3px solid var(--lapis); outline-offset: 3px; }
@media (max-height: 700px) { .kn-skymini__pic { width: 64px; height: 64px; } }
@media (prefers-reduced-motion: reduce) { .kn-con__halo { animation: none !important; } }
