/* kids-foundation.css: owned by the foundation agents (tools/kids/CONTRACT.md section 0). Class prefix kf-.
 * Tokens that follow the reader's band, the highlight of what is sounding, focus rings, the Grown-ups button, the band picker.
 * Light theme only. Arabic that may wrap keeps line-height 1.9 to 2.1. */

/* ---- tokens: <html data-band> follows the current reader (LR.kids.setBand, a profile switch, boot). Readers is the default. ---- */
:root {
  --kids-target: 56px;                          /* the smallest tap target of a child's control */
  --kids-letter: 7.5rem;                        /* a big letter or syllable on a meet card (120px and up on a phone) */
  --kids-word: 2.75rem;                         /* a word to read */
  --kids-gap: 14px;
}
html[data-band="little"] {
  --kids-target: 64px;
  --kids-letter: 9rem;
  --kids-word: 3.5rem;
  --kids-gap: 18px;
}
html[data-band="readers"] {
  --kids-target: 56px;
  --kids-letter: 7.5rem;
  --kids-word: 2.75rem;
  --kids-gap: 14px;
}
html[data-band="big"] {
  --kids-target: 44px;
  --kids-letter: 6rem;
  --kids-word: 2.25rem;
  --kids-gap: 12px;
}
@media (min-width: 900px) {
  html[data-band="little"] { --kids-letter: 11rem; }
  html[data-band="readers"] { --kids-letter: 9rem; }
  html[data-band="big"] { --kids-letter: 7rem; }
}
/* a landscape screen is short: the card scales with the height so a warm-up step and its Back / Next bar share the first screen (1024x768, 1280x720, 1366x768) */
@media (min-width: 900px) {
  html[data-band="little"] { --kids-letter: clamp(6rem, calc(52vh - 16.7rem), 11rem); }
  html[data-band="readers"] { --kids-letter: clamp(6.5rem, calc(60vh - 18rem), 9rem); }
}
/* what a child taps and the letter a card shows follow the band */
.kf-tap { min-height: var(--kids-target); min-width: var(--kids-target); }
.kf-letter { font-family: var(--font-ar); font-size: var(--kids-letter); line-height: 1.9; font-weight: 400; }
.kf-word { font-family: var(--font-ar); font-size: var(--kids-word); line-height: 2; }

/* ---- what is sounding: a steady ring and a pale fill, never a flash (LR.audio.attach adds .is-sounding) ---- */
.is-sounding {
  background-color: var(--pointer-soft);
  outline: 3px solid var(--pointer-ring) !important;
  outline-offset: 2px;
}
[role="button"][tabindex], [data-kf-hear] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[role="button"][tabindex] { border-radius: var(--r-chip); }

/* ---- focus rings: a keyboard user always sees where they are ---- */
.kf-band input:focus-visible + label,
[role="button"][tabindex]:focus-visible,
[data-kf-hear]:focus-visible,
.tb-grownups:focus-visible {
  outline: 3px solid var(--lapis);
  outline-offset: 2px;
}
.is-sounding:focus-visible { outline-color: var(--lapis) !important; box-shadow: 0 0 0 5px var(--pointer-ring); }

/* ---- the Grown-ups button in the top bar: small, outlined, a picture of a tall and a short figure (no lock, no faces) ---- */
.tb-grownups { border: 1.5px solid color-mix(in oklab, var(--on-cover) 55%, transparent); padding: 0 9px; text-decoration: none; color: var(--on-cover); }
.tb-grownups__word { display: none; }
.tb-grownups .icon { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* the word shows once the bar is wide enough for the Lessons crumb too */
@container bar (min-width: 1000px) {
  .tb-grownups { padding: 0 12px; }
  .tb-grownups__word { display: inline; }
}
/* phones: the wordmark keeps its room beside the new key (a slimmer side margin and key, a smaller wordmark; the logo too on the narrowest) */
@container bar (max-width: 599px) {
  .tb-in { padding-inline: 12px; }
  .tb-word { font-size: .9375rem; }
  .tb-grownups { min-width: 44px; padding: 0 6px; }   /* KIDS-U-5: a 2-second hold on a 36 px key was too small a target: 44 px, as the other keys of the bar */
}
@container bar (max-width: 419px) {
  .tb-logo { width: 24px; height: 24px; }
}

/* ---- the reading group on the new-reader form (PLAN 3.1): three large choices ---- */
.scr-readers .kf-band { border: 0; margin: 0; padding: 0; min-width: 0; }
.scr-readers .kf-band__legend { padding: 0; margin-bottom: 8px; font: 700 var(--t-sm)/1.3 var(--font-body); }
.kf-band__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kf-band__opt { position: relative; display: block; min-width: 0; }
.kf-band__opt input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.kf-band__opt label {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 84px; padding: 10px 6px; min-width: 0;
  border: 2px solid var(--rule); border-radius: var(--r-key); background: var(--raised); color: var(--ink);
  cursor: pointer; text-align: center; -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .kf-band__opt label:hover { background: var(--hover-mix); } }
.kf-band__opt input:checked + label { border-color: var(--action); background: var(--ok-wash); box-shadow: inset 0 0 0 1px var(--action); }
.kf-band__icon { width: 30px; height: 30px; fill: var(--ink-soft); }
.kf-band__opt input:checked + label .kf-band__icon { fill: var(--action); }
.kf-band__name { font: 700 var(--t-sm)/1.2 var(--font-body); overflow-wrap: anywhere; }
.kf-band__age { font: 400 var(--t-cap)/1.2 var(--font-body); color: var(--ink-soft); overflow-wrap: anywhere; }

/* ======================================================================================================================================
 * The shared cards (45-cards.js: LR.cards), the stub game and Read to me (LR.games, LR.readToMe). Arabic in the mushaf font and large;
 * line-height 1.9 to 2.1; never padding, margin, border or inline-block on anything inside an Arabic word (each Arabic text is one element).
 * ====================================================================================================================================== */
.kf-rtm [hidden], .kf-stub [hidden] { display: none !important; }
.kf-card--xl { --kf-letter: 9rem; --kf-word: 4rem; --kf-ayah: 3rem; }
.kf-card--l { --kf-letter: max(var(--kids-letter), 7.5rem); --kf-word: var(--kids-word); --kf-ayah: 2.5rem; }
.kf-card--m { --kf-letter: 4.5rem; --kf-word: 2.25rem; --kf-ayah: 2rem; }
@media (min-width: 900px) {
  .kf-card--xl { --kf-letter: clamp(6rem, calc(52vh - 16.7rem), 11rem); --kf-word: 4.5rem; --kf-ayah: 3.5rem; }
  .kf-card--l { --kf-letter: max(var(--kids-letter), 8.5rem); --kf-word: calc(var(--kids-word) * 1.15); --kf-ayah: 3rem; }
  .kf-card--m { --kf-letter: 5.5rem; --kf-word: 2.75rem; --kf-ayah: 2.25rem; }
}
@media (min-width: 900px) and (max-height: 860px) {
  .kf-card--l { --kf-letter: max(var(--kids-letter), 7.5rem); }          /* a short landscape window: still 120 px, no more */
}
.kf-card {
  position: relative; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-width: max(var(--kids-target), 96px); max-width: 100%; min-height: var(--kids-target); padding: 10px 16px 12px;
  background: var(--raised); color: var(--ink); text-align: center;
  border: 2px solid var(--rule); border-bottom-width: 5px; border-radius: var(--r-panel);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.kf-card[role="button"] { cursor: pointer; border-color: var(--edge); }
@media (hover: hover) { .kf-card[role="button"]:hover { background: var(--hover-mix); } }
.kf-card[role="button"]:active { transform: translateY(2px); border-bottom-width: 3px; }
.kf-card .kf-ar { display: block; max-width: 100%; margin: 0; padding-block: 0; direction: rtl; overflow-wrap: normal; word-break: keep-all; }
.kf-letter { font-size: var(--kf-letter, 7.5rem); line-height: 1.6; }   /* one glyph and its mark, never wrapped: 1.6 + .1em above and below holds the font's 1.76em */
.kf-letter.ar-dots, .kf-word.ar-dots, .kf-form__ar.ar-dots { font-family: var(--font-dots); }   /* a lone yaa keeps its two dots */
.kf-card .kf-letter { padding-block: .1em; }
.kf-card .kf-letter.ar-dots { padding-block: .12em .45em; }   /* Amiri Quran (the dotted yaa) is taller: 2.1em */
/* a word, a letter name or a shape that ends in a yaa is drawn whole in Amiri Quran (45-cards.js ar()): it draws about 15% larger and its
   content area is 2.1em, so the size follows the face and the padding holds the marks (line-height 1.9 to 2.1 for Arabic that may wrap) */
.kf-card .kf-ar.ar-dots:not(.kf-letter) { padding-block: .1em .3em; }
.kf-wordar.ar-dots { font-size: calc(var(--kf-word, 2.75rem) * .87); line-height: 2.05; }
.kf-name.ar-dots { font-size: 1.4rem; line-height: 2.05; }
.kf-card--m .kf-name.ar-dots { font-size: 1.1rem; }
.kf-wordar { font-size: var(--kf-word, 2.75rem); line-height: 2; }
.kf-ayahar { font-size: var(--kf-ayah, 2.5rem); line-height: 2.05; text-align: center; }
.kf-name { font-size: 1.6rem; line-height: 2; color: var(--ink-soft); }
.kf-card--m .kf-name { font-size: 1.25rem; }
.kf-signar { font-size: calc(var(--kf-letter, 7.5rem) * .55); }
.kf-tl { font: 700 var(--t-sm)/1.3 var(--font-body); color: var(--ink-soft); }
.kf-en { font: 400 var(--t-sm)/1.35 var(--font-body); color: var(--ink-soft); max-width: 28ch; }
.kf-card--silent { border-color: var(--rule); }
.kf-sign__name { font: 700 var(--t-sm)/1.3 var(--font-body); }
.kf-sign__rule { font: 400 var(--t-cap)/1.4 var(--font-body); color: var(--ink-soft); max-width: 30ch; text-align: start; }
.kf-card--sign { align-items: center; max-width: 100%; }

/* the shapes of a letter, its dots */
.kf-forms { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; margin-top: 2px; }
.kf-form { display: grid; justify-items: center; gap: 0; }
.kf-form .kf-form__ar { font-size: 2.6rem; line-height: 1.9; }
.kf-form__cap { font: 400 var(--t-cap)/1.2 var(--font-body); color: var(--ink-soft); }
.kf-dots { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.kf-dots--above { flex-direction: column-reverse; }
.kf-dots__line { width: 36px; height: 4px; border-radius: 2px; background: var(--rule); }
.kf-dots__pips { display: flex; gap: 6px; }
.kf-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); }

/* rows */
.kf-row { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--kids-gap); margin: 0; padding: 0; max-width: 100%; }
.kf-row--m { gap: 8px; }
.kf-row--m .kf-card { min-width: 72px; padding: 8px 10px 10px; }

/* the meet content */
.kf-meet { display: grid; justify-items: center; gap: var(--kids-gap); max-width: 100%; }
.kf-meet__lead { margin: 0; font: 700 var(--t-body)/1.3 var(--font-body); color: var(--ink-soft); text-align: center; }
.kf-meet__title { font-family: var(--font-display); font-size: 1.25rem; color: var(--ink); }
.kf-rule { margin: 0; max-width: 46ch; font: 400 var(--t-body)/1.5 var(--font-body); text-align: center; text-wrap: pretty; }
.kf-marks { display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: var(--kids-gap); max-width: 100%; }
.kf-mark { display: grid; justify-items: center; gap: 2px; padding: 6px 18px; border: 2px solid var(--rule); border-radius: var(--r-panel); background: var(--raised); }
.kf-mark__glyph .kf-letter { font-size: calc(var(--kids-letter) * .85); }
.kf-mark__title { font: 700 var(--t-sm)/1.2 var(--font-body); color: var(--ink-soft); }
.kf-surah { display: grid; justify-items: center; gap: 4px; padding: 10px 18px 14px; max-width: 100%; border: 2px solid var(--rule); border-radius: var(--r-panel); background: var(--raised); }
.kf-surah__ar { font-size: calc(var(--kids-letter) * .55); line-height: 1.9; }
.kf-surah__name { font: 700 var(--t-body)/1.3 var(--font-body); }
.kf-surah__count { font: 400 var(--t-sm)/1.3 var(--font-body); color: var(--ink-soft); }
.kf-surah__hear { margin-top: 6px; }

/* the stub game and its round pips */
.kf-stub { display: grid; justify-items: center; gap: var(--kids-gap); padding: 8px 0 16px; max-width: 100%; }
.kf-stub__stage { display: grid; justify-items: center; max-width: 100%; }
.kf-stub__done, .kf-stub__empty { display: inline-flex; align-items: center; gap: 8px; margin: 0; font: 700 var(--t-body)/1.3 var(--font-body); }
.kf-stub .kf-next, .kf-rtm .key { min-width: var(--kids-target); min-height: var(--kids-target); }   /* Back, Next, Hear, ok, miss: the band's target (64 / 56 / 44) */
.kf-pips { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.kf-pip { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--edge); background: transparent; }
.kf-pip.is-done { background: var(--action); border-color: var(--action); }
.kf-pip.is-now { background: var(--gold); border-color: var(--gold-ink); }

/* Read to me */
.kf-rtm { display: grid; justify-items: center; gap: var(--kids-gap); max-width: 100%; }
.kf-rtm__steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.kf-rtm__n {
  appearance: none; min-width: var(--kids-target); min-height: var(--kids-target); padding: 0 6px; border: 2px solid var(--edge); border-radius: var(--r-chip);
  background: var(--raised); color: var(--ink); font: 700 var(--t-sm)/1 var(--font-body); cursor: pointer; touch-action: manipulation;
}
.kf-rtm__n.is-ok { background: var(--ok-wash); border-color: var(--action); }
.kf-rtm__n.is-miss { background: var(--l-wash); border-style: dashed; }
.kf-rtm__n[aria-current="step"] { box-shadow: 0 0 0 3px var(--gold); border-color: var(--ink); }
.kf-rtm__stage { display: grid; justify-items: center; max-width: 100%; min-height: 3rem; }
.kf-rtm__acts, .kf-rtm__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.kf-rtm__hear.primary { min-width: 140px; }
.kf-rtm__ok[aria-pressed="true"] { background: var(--action); color: var(--on-action); border-color: var(--action-lip); }
.kf-rtm__miss[aria-pressed="true"] { background: var(--gold); color: var(--on-gold); border-color: var(--gold-ink); }
.kf-rtm__status { margin: 0; font: 400 var(--t-sm)/1.3 var(--font-body); color: var(--ink-soft); }
.kf-rtm__summary { display: grid; justify-items: center; gap: 6px; padding: 12px 0; }
.kf-rtm__sum-line { margin: 0; font: 700 var(--t-body)/1.3 var(--font-body); }
.kf-rtm__sum-pct { margin: 0; font: 700 2.5rem/1.2 var(--font-display); }
.kf-rtm__empty { margin: 0; font: 400 var(--t-body)/1.4 var(--font-body); color: var(--ink-soft); }
@media (max-width: 480px) {
  .kf-rtm__acts .key { flex: 1 1 130px; }
  .kf-card { padding: 8px 12px 10px; }
}

/* ---- KIDS-7 / KIDS-8: the Little bar and the step chips follow the band's target (64 / 56 / 44 px), 8 to 12 px between neighbours.
   The top bar holds three things (22-nav.js removed Lessons, Aa and the stars chip): the name (or the Leave key), the reader's disc and Grown-ups. ---- */
html[data-band="little"] { --topbar-base: 72px; }
html[data-band="little"] .tb-btn { min-width: 64px; height: 64px; }
html[data-band="little"] .tb-right { gap: 12px; }
html[data-band="little"] .tb-in { gap: 8px; }
html[data-band="little"] .tb-reader { padding: 0 8px; }
html[data-band="little"] .tb-grownups__word { display: none; }   /* a Little reader reads no word in the bar (a wide bar shows "Grown-ups" to the others); the key keeps its name for a screen reader */
html[data-band="little"] .kh-steps { gap: 8px; }   /* a stray tap on a chip beside another jumps a step: keep them apart */
.kh-end .kh-end__keys .kh-end__map { min-height: var(--kids-target); justify-content: center; }

/* second review (KIDS2-2, KIDS2-3): an alif card or a syllable card was 96 px wide; CONTRACT section 5 says a letter card is at least 120 px on a phone */
.kf-card--letter, .kf-card--syllable { min-width: max(var(--kids-target), 120px); }
