/* ============================================================
   HARVEST · KID VIEW
   Activates when <body class="kid-mode"> — i.e. during the
   assessment proper (Sections B-G), not during welcome / intake
   / report. Optimized for K-5 children with a proctor present.

   Design principles (research-backed):
   - One focal element per screen
   - Sans-serif single-story 'a'/'g' (AbcPrint / Lexend)
   - 22-28pt prompts; 88px+ choice buttons
   - No timers/IDs visible to the child
   - Visual progress (dots), not numeric "Item N of M"
   - Neutral submit feedback (gentle pulse, no right/wrong cue)
   - Predictable layout every screen
   ============================================================ */

body.kid-mode {
  --kid-prompt-size: clamp(1.5rem, 2.6vw + 1rem, 2.25rem);  /* 24-36px */
  --kid-choice-min-h: 88px;
  --kid-choice-font: clamp(1.125rem, 1.4vw + 0.75rem, 1.5rem);
}

/* Hide adult chrome during assessment */
body.kid-mode .app-footer,
body.kid-mode .progress-strip {
  display: none;
}

/* Tighter, lower-profile header */
body.kid-mode .app-header {
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
}
body.kid-mode .brand-tagline {
  display: none;
}
body.kid-mode .brand-name {
  font-size: var(--fs-xl);
}

/* Stage card is more spacious */
body.kid-mode .stage {
  padding: clamp(20px, 4vw, 48px);
  min-height: 70vh;
}

/* ─── Item header — collapse adult metadata behind toggle ─── */
body.kid-mode .item-header {
  border-bottom: 1px solid var(--paper-deep);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-5);
}
body.kid-mode .item-id {
  /* Move item ID into a small expandable proctor info pill */
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  cursor: help;
  border: 1px solid var(--paper-deep);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-warm);
}
body.kid-mode .item-progress {
  /* numeric "Item N of M" hidden from kid; proctor still sees on hover */
  font-size: var(--fs-xs);
  color: var(--ink-faint);
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
}

/* Visual progress dots — placed in item header */
.kid-progress-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  justify-content: center;
  padding: 0 var(--sp-3);
}
.kid-progress-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper-deep);
  transition: background var(--t-med) var(--ease), transform var(--t-med) var(--ease);
}
.kid-progress-dot.done {
  background: var(--gold);
  transform: scale(0.85);
}
.kid-progress-dot.current {
  background: var(--green-rich);
  box-shadow: 0 0 0 4px rgba(95, 126, 90, 0.22);
  transform: scale(1.15);
}

/* ─── Prompt typography ─── */
body.kid-mode .item-prompt {
  font-family: var(--font-child);
  font-style: normal;
  font-size: var(--kid-prompt-size);
  font-weight: 400;
  text-align: center;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink);
  margin: var(--sp-3) auto var(--sp-6) auto;
  max-width: 22ch;
}

/* Large display words (CVC, sight words) — even bigger */
body.kid-mode .word-display-large {
  font-size: clamp(4rem, 14vw, 8rem);
  margin: var(--sp-4) 0 var(--sp-6);
}

/* ─── Choice buttons ─── */
body.kid-mode .item-choices {
  grid-template-columns: 1fr;
  gap: var(--sp-3);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
@media (min-width: 720px) {
  body.kid-mode .item-choices {
    grid-template-columns: 1fr 1fr;
  }
}
body.kid-mode .choice-btn {
  min-height: var(--kid-choice-min-h);
  font-size: var(--kid-choice-font);
  font-family: var(--font-child);
  border-width: 3px;
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-lg);
  transition: transform var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
body.kid-mode .choice-btn:hover:not(:disabled) {
  transform: translateY(-2px);
}
body.kid-mode .choice-btn.selected {
  background: var(--ok-pale);
  border-color: var(--green-rich);
  color: var(--green);
  box-shadow: var(--shadow-md);
}

/* ─── Math equation + math input ─── */
body.kid-mode .math-equation {
  font-size: clamp(3rem, 9vw, 5.5rem);
  margin: var(--sp-5) 0 var(--sp-6) 0;
}
body.kid-mode .math-equation input.form-input {
  font-size: inherit;
  font-family: var(--font-child);
  width: 4.5ch;
  text-align: center;
  border-width: 3px;
}

/* ─── Item controls (Skip / Submit) ─── */
body.kid-mode .item-controls {
  margin-top: var(--sp-6);
  padding-top: var(--sp-4);
}
body.kid-mode .submit-btn {
  font-size: var(--fs-lg);
  padding: 16px 36px;
  min-height: 60px;
  box-shadow: var(--shadow-md);
}
body.kid-mode .item-controls .btn-ghost {
  font-size: var(--fs-sm);
  color: var(--ink-mute);
}

/* ─── Submit micro-feedback (pulse + check, neutral) ─── */
@keyframes kidSubmitPulse {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06); box-shadow: 0 0 0 12px rgba(95, 126, 90, 0.18), var(--shadow-md); }
  100% { transform: scale(1); }
}
.kid-submit-feedback {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 600;
}
.kid-submit-feedback .check-bubble {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 251, 241, 0.96);
  border: 4px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  animation: kidCheckIn 600ms var(--ease-bounce) forwards;
}
.kid-submit-feedback svg {
  width: 64px;
  height: 64px;
  color: var(--green-rich);
}
@keyframes kidCheckIn {
  from { opacity: 0; transform: scale(0.5); }
  60%  { opacity: 1; transform: scale(1.05); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes kidCheckOut {
  to { opacity: 0; transform: scale(0.9); }
}

/* ─── Section intro (kid-friendly) ─── */
body.kid-mode .section-intro {
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
}
.section-icon {
  width: 96px;
  height: 96px;
  margin: 0 auto var(--sp-4) auto;
  color: var(--green);
}
.section-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}
.section-a .section-icon { color: var(--sec-a); }
.section-b .section-icon { color: var(--sec-b); }
.section-c .section-icon { color: var(--sec-c); }
.section-d .section-icon { color: var(--sec-d); }
.section-e .section-icon { color: var(--sec-e); }
.section-f .section-icon { color: var(--sec-f); }
.section-g .section-icon { color: var(--sec-g); }

.script-proctor {
  background: var(--paper-warm);
  border-left: 4px solid var(--gold);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  text-align: left;
  max-width: 600px;
  margin: var(--sp-4) auto;
  font-size: var(--fs-sm);
}
.script-proctor summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-warn);
  user-select: none;
}
.script-proctor[open] summary {
  margin-bottom: var(--sp-3);
}
.script-proctor .script {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.6;
}

.kid-ready {
  font-family: var(--font-child);
  font-size: var(--fs-xl);
  color: var(--ink-soft);
  text-align: center;
  margin: var(--sp-5) 0 var(--sp-3) 0;
}
.kid-section-title {
  font-family: var(--font-display);
  font-size: var(--fs-3xl);
  color: var(--green);
  text-align: center;
  margin-bottom: var(--sp-3);
}
.kid-instruction {
  font-family: var(--font-child);
  font-size: var(--fs-xl);
  text-align: center;
  color: var(--ink);
  max-width: 28ch;
  margin: 0 auto var(--sp-5) auto;
  line-height: 1.4;
}

/* ─── Proctor cue (shown beneath items that the proctor reads aloud) ─── */
.proctor-cue {
  background: var(--gold-pale);
  border: 1px dashed var(--gold);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: var(--fs-sm);
  color: var(--gold-rich);
  text-align: center;
  max-width: 500px;
  margin: var(--sp-3) auto;
  font-style: italic;
}
.proctor-cue::before {
  content: '🗣 ';
  font-style: normal;
}

.proctor-passage {
  background: var(--paper-warm);
  border-left: 5px solid var(--gold);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin: var(--sp-4) 0;
  font-family: var(--font-heading);
  font-size: var(--fs-base);
  line-height: 1.7;
}
.proctor-passage h3 {
  font-family: var(--font-display);
  color: var(--green);
  margin-bottom: var(--sp-3);
}
.proctor-passage p { margin-bottom: var(--sp-3); color: var(--ink); }
.proctor-passage-label {
  font-size: var(--fs-xs);
  color: var(--gold-rich);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

/* ─── Oral reading passage (Section C, 2026-10-19) ───
   The child reads the passage aloud from the screen, so it gets the child's typeface at a size
   a K-5 reader can track, with room between the lines for the parent's taps. The parent's
   helper bar (css/sections.css) keeps the adult typeface on purpose. */
body.kid-mode .orf-kid-line {
  font-size: clamp(1.25rem, 1.4vw + 0.9rem, 1.75rem);
}
body.kid-mode .orf-passage {
  font-size: clamp(1.25rem, 1.1vw + 1rem, 1.75rem);
  line-height: 2.1;
}
body.kid-mode .orf-passage h3 {
  font-size: clamp(1.5rem, 1.6vw + 1rem, 2rem);
}
/* Kindergarten and Grade 1 passages stay open above every question; Grade 2 and up fold. */
body.kid-mode .orf-reread-open {
  font-size: clamp(1.125rem, 1vw + 0.9rem, 1.5rem);
}
/* While the passage is on screen, the parent's pill at the bottom (Flag Help and the session
   clock) sits over the passage's lowest line. Its "Proctor: Parent" label is not needed there,
   so the pill narrows to what the parent uses and covers less of the text. Phones already hide
   the label (css/layout.css). */
body.kid-mode:has(.orf) .proctor-banner .proctor-status {
  display: none;
}

/* ─── Hide standard item-progress text inside kid mode header
       and replace with progress dots ─── */
body.kid-mode .item-progress.kid-hidden {
  display: none;
}

/* ─── Visual quantity rendering (replaces text dots like "● ● ●") ─── */
.kid-quantity {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: var(--sp-5) auto;
  max-width: 480px;
}
.kid-quantity .kid-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold-warm), var(--gold-rich));
  box-shadow: var(--shadow-sm);
}
.kid-quantity .kid-star {
  width: 40px;
  height: 40px;
  color: var(--gold);
}
.kid-quantity .kid-star svg { width: 100%; height: 100%; }

/* ─── Section transition (celebrate completion) ─── */
body.kid-mode .section-transition .check-icon {
  width: 132px;
  height: 132px;
}
body.kid-mode .section-transition h2 {
  font-family: var(--font-display);
  font-size: var(--fs-4xl);
}
body.kid-mode .section-transition p {
  font-family: var(--font-child);
  font-size: var(--fs-lg);
}

/* ─── Reduce motion safety ─── */
@media (prefers-reduced-motion: reduce) {
  .kid-submit-feedback .check-bubble {
    animation: none;
  }
  .kid-progress-dot {
    transition: none;
  }
}


/* ============================================================
   "Inside Faith Schooling" context rail (2026-09-16)

   Shown only while the assessment is running. Text only, no links, no images,
   no movement -- see the note above CONTEXT_RAIL in js/app.js for why each of
   those is deliberate.

   IT MUST NEVER OVERLAP THE ASSESSMENT. The stage is 900px wide and centred
   inside a 1280px shell, so a 220px rail pinned to the right edge only clears
   it above ~1372px of viewport. The gate below is 1400px: wide desktops get the
   rail, everything else gets a static strip in normal flow, in the space
   kid-mode already frees by hiding the footer. Neither can cover a question, an
   answer, the navigation or the progress dots.
   ============================================================ */

/* Hidden by default: it exists only during the assessment. */
.fs-context-rail { display: none; }

body.kid-mode .fs-context-rail {
  display: block;
  margin: var(--sp-6) auto 0;
  max-width: var(--max-w-stage);
  padding: var(--sp-4);
  border-top: 1px solid var(--paper-deep);
  opacity: 0.82;
}

.fs-context-rail-title {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 700;
  color: var(--ink-mute);
  margin-bottom: var(--sp-3);
}
.fs-context-rail-item { margin-bottom: var(--sp-3); }
.fs-context-rail-name {
  font-family: var(--font-display);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--green-rich);
}
.fs-context-rail-line {
  font-size: var(--fs-xs);
  line-height: 1.5;
  color: var(--ink-soft);
}
.fs-context-rail-foot {
  font-size: var(--fs-xs);
  color: var(--ink-mute);
  margin-top: var(--sp-3);
  padding-top: var(--sp-2);
  border-top: 1px solid var(--paper-deep);
}

/* On a wide desktop it becomes a narrow rail at the right edge, clear of the
   centred stage. Below this width it stays in normal flow, under the content. */
@media (min-width: 1400px) {
  body.kid-mode .fs-context-rail {
    position: fixed;
    top: 50%;
    right: var(--sp-4);
    transform: translateY(-50%);
    width: 220px;
    max-width: 220px;
    margin: 0;
    padding: var(--sp-4);
    border: 1px solid var(--paper-deep);
    border-radius: var(--r-md);
    background: var(--paper-warm);
    z-index: 5;
  }
}

/* A phone in landscape has no spare vertical room; the strip would push the
   answers off screen, which is exactly what it must not do. */
@media (max-height: 520px) {
  body.kid-mode .fs-context-rail { display: none; }
}

@media print {
  .fs-context-rail { display: none !important; }
}
