/* ─────────────────────────────────────────────────────────────────────────────
   LEARNER SHELL, PROTOTYPE

   One shell for every logged-in learner screen. Bottom tabs on a phone, a left
   rail on a laptop, from the same markup. This file exists so the four
   prototype screens share one copy of the shell rather than four, which is also
   how it should ship: a helper, not a paste.

   NOT the public site. Marketing and SEO pages keep .site-nav and .site-footer,
   because Google needs those. A logged-in child gets this instead, and never a
   "Log in" button or a hamburger.

   Page-specific styles stay in the page. Anything in here is shared.

   Author: WAJD AI
   ──────────────────────────────────────────────────────────────────────────── */

:root {
  --k-bg: #f4f6fb;
  --k-line: #e4e7f2;
  --k-ink: #1a1a3e;
  --k-mid: #5b6076;
  --k-soft: #8b90a8;
  --k-radius: 20px;
  --tab-h: 66px;
  --top-h: 58px;
}

/* Gated behind .k-on, which the shell adds ONLY once a learner is resolved.
   Seven of the pages this file now loads on are indexed public pages. A crawler
   or a logged-out visitor must see them exactly as they are today, so nothing
   here may touch the page until we know a child is looking at it. */
body.k-on {
  background: var(--k-bg);
  font-family: 'Nunito', sans-serif;
  color: var(--k-ink);
  /* Children need larger body text than adults. NN/g puts older children at
     12pt and younger at 14pt. 17px base, nothing user-facing under 14px. */
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}
/* The page's own nav and footer are replaced, not merely covered. */
body.k-on .site-nav, body.k-on .site-footer { display: none !important; }
/* Some pages carry their own minimal chrome (onboarding uses <nav class="nav">)
   rather than the estate nav. The shell replaces that too. */
body.k-on > nav, body.k-on nav.nav { display: none !important; }
/* Focus mode also drops the page's own heading: the focus bar names the activity,
   and two titles is one too many on a phone. */
body.k-focus-mode .page-head { display: none !important; }

/* ── Shell ─────────────────────────────────────────────────────────────────── */
.k-shell { max-width: 1120px; margin: 0 auto; }
.k-main { padding: 14px 18px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); }

/* ── Header: three elements, nothing else. No hamburger, no log in. ────────── */
.k-top {
  height: var(--top-h); display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 18px; background: #fff; border-bottom: 1px solid var(--k-line);
  position: sticky; top: 0; z-index: 30;
}
/* min-height 44px on every tappable thing, including the logo. */
.k-brand { display: flex; align-items: center; gap: 9px; text-decoration: none; min-height: 44px; }
.k-brand img { width: 30px; height: 30px; }
.k-brand b { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--navy); }
.k-brand b span { color: #2dadff; }
.k-av {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #fff; font-family: 'Poppins', sans-serif; font-weight: 800; font-size: .95rem;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
}

/* ── Page heading, shared by every screen. ─────────────────────────────────── */
.k-hi { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.k-hi > div:first-child { min-width: 0; }
/* One line, always. A wrapped heading pushes the content that matters down. */
.k-hi h1 {
  font-family: 'Poppins', sans-serif; font-size: 1.32rem; font-weight: 800;
  color: var(--navy); line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.k-hi .sub { color: var(--k-soft); font-size: .88rem; font-weight: 700; margin-top: 2px; }

/* Streak chip. The only status the child sees outside Progress. */
.k-streak {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: #fff; border: 1px solid var(--k-line); border-radius: 999px;
  padding: 8px 14px 8px 11px; text-decoration: none; min-height: 44px;
}
.k-streak svg { color: var(--yellow); width: 18px; height: 18px; }
.k-streak.cold svg { color: #c4c8d6; }
.k-streak b { font-family: 'Poppins', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--navy); }
.k-streak small { font-size: .78rem; font-weight: 800; color: var(--k-soft); }

/* ── Section label ────────────────────────────────────────────────────────── */
.k-h {
  font-size: .74rem; font-weight: 800; letter-spacing: .7px; text-transform: uppercase;
  color: var(--k-soft); margin-bottom: 10px;
}
.k-h.spaced { margin-top: 26px; }

/* ── Row: the workhorse list item. ────────────────────────────────────────── */
.k-row {
  display: flex; align-items: center; gap: 14px; background: #fff;
  border: 1px solid var(--k-line); border-radius: 16px; padding: 14px 16px;
  text-decoration: none; color: inherit; margin-bottom: 10px; min-height: 68px;
}
.k-row .ic {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--c2, #eef1f8); color: var(--c1, var(--blue));
}
.k-row .ic svg { width: 22px; height: 22px; }
.k-row .tx { flex: 1; min-width: 0; }
.k-row .tx b {
  display: block; font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: 1rem; color: var(--navy);
}
.k-row .tx small { display: block; font-size: .85rem; color: var(--k-soft); font-weight: 700; margin-top: 2px; }
.k-row .chev { color: #c4c8d6; flex-shrink: 0; }
.k-row .chev svg { width: 20px; height: 20px; display: block; }
/* Thin progress line under a row, for anything part-finished. */
.k-row .tx .line { display: block; height: 6px; border-radius: 99px; background: #eef1f8; margin-top: 8px; overflow: hidden; }
.k-row .tx .line i { display: block; height: 100%; border-radius: 99px; background: var(--c1, var(--blue)); }

/* ── Three small numbers, not four big cards. ─────────────────────────────── */
.k-week {
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff; border: 1px solid var(--k-line); border-radius: 16px;
  overflow: hidden; text-decoration: none; color: inherit;
}
.k-week div { padding: 15px 8px; text-align: center; border-left: 1px solid var(--k-line); }
.k-week div:first-child { border-left: 0; }
.k-week b {
  display: block; font-family: 'Poppins', sans-serif; font-weight: 800;
  font-size: 1.32rem; color: var(--navy); line-height: 1;
}
.k-week small { display: block; font-size: .74rem; font-weight: 800; color: var(--k-soft); margin-top: 5px; }

/* ── Bottom tabs: four destinations, thumb height, always there. ──────────── */
.k-tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255,255,255,.97); border-top: 1px solid var(--k-line);
  padding-bottom: env(safe-area-inset-bottom);
  backdrop-filter: saturate(180%) blur(8px);
}
.k-tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; height: var(--tab-h); text-decoration: none; color: var(--k-soft);
  font-size: .72rem; font-weight: 800;
}
.k-tab svg { width: 23px; height: 23px; }
.k-tab.on { color: var(--blue); }
.k-tab.on svg { stroke-width: 2.4; }

/* ── Laptop and up: the tab bar becomes a rail, the column becomes two.
   The mobile constraint is what keeps the desktop layout calm too. ────────── */
@media (min-width: 900px) {
  .k-top { padding: 0 32px; }
  .k-shell { display: grid; grid-template-columns: 218px 1fr; gap: 0; }
  .k-tabs {
    position: sticky; top: var(--top-h); bottom: auto; height: calc(100vh - var(--top-h));
    display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
    grid-template-columns: none; border-top: 0; border-right: 1px solid var(--k-line);
    background: #fff; padding: 18px 12px; backdrop-filter: none;
  }
  .k-tab {
    flex-direction: row; justify-content: flex-start; gap: 13px; height: 50px;
    padding: 0 16px; border-radius: 12px; font-size: .95rem;
  }
  .k-tab.on { background: rgba(59,91,219,.08); }
  .k-main { padding: 28px 34px 60px; }
  .k-hi h1 { font-size: 1.7rem; }
  /* Two columns where a screen has a secondary stack. */
  .k-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; align-items: start; }
  .k-grid .k-h.spaced:first-child { margin-top: 0; }
}

/* ── Prototype controls. Not part of the design, dev only. ────────────────── */
.k-dev {
  max-width: 1120px; margin: 30px auto 0; padding: 18px 18px 30px;
  border-top: 1px dashed #c8cde0;
}
.k-dev p { font-size: .8rem; color: var(--k-soft); font-weight: 700; margin-bottom: 10px; }
.k-dev button {
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .85rem; cursor: pointer;
  background: #fff; border: 1px solid var(--k-line); border-radius: 999px;
  padding: 9px 16px; margin: 0 6px 6px 0; color: var(--k-mid);
}
.k-dev button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
@media (min-width: 900px) { .k-dev { padding-left: 252px; } }

/* ── FOCUS MODE ──────────────────────────────────────────────────────────────
   Timed activities strip the tab bar. What replaces it is one exit, the
   activity name, and how far through they are. Nothing else: no logo link, no
   avatar, no tabs, because every one of those is a way to lose the thread.

   The exit stays large and obvious. Removing navigation to protect focus is
   legitimate; hiding the way out is not.
   ─────────────────────────────────────────────────────────────────────────── */
.k-focus {
  position: sticky; top: 0; z-index: 30;
  background: #fff; border-bottom: 1px solid var(--k-line);
}
/* Three tracks, so the title stays optically centred whatever sits on the left:
   a 46px X on a normal activity, or a wider "Sign out" on a mandatory gate.
   The equal 1fr side tracks do the balancing that a fixed-width spacer cannot. */
.k-focus-row {
  height: var(--top-h); display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 10px; padding: 0 10px 0 6px;
  max-width: 720px; margin: 0 auto;
}
.k-focus-side { display: flex; align-items: center; min-width: 0; }
.k-focus-side.right { justify-content: flex-end; }
.k-exit {
  width: 46px; height: 46px; flex-shrink: 0; border: 0; cursor: pointer;
  background: none; border-radius: 50%; color: var(--k-mid);
  display: flex; align-items: center; justify-content: center;
}
.k-exit:hover { background: var(--k-bg); color: var(--k-ink); }
.k-exit svg { width: 22px; height: 22px; }
.k-focus-tx { flex: 1; min-width: 0; text-align: center; }
.k-focus-tx b {
  display: block; font-family: 'Poppins', sans-serif; font-weight: 700;
  font-size: 1rem; color: var(--navy);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.k-focus-tx small { display: block; font-size: .78rem; font-weight: 800; color: var(--k-soft); margin-top: 1px; }
/* Sign out on a mandatory gate. Quiet, but a real target and never below the
   fold, which is where it sat when it lived at the bottom of the card. */
.k-signout {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  background: none; color: var(--k-mid); border-radius: 999px;
  min-height: 44px; padding: 0 12px;
  font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .88rem;
}
.k-signout:hover { background: var(--k-bg); color: var(--k-ink); }
.k-signout svg { width: 18px; height: 18px; flex-shrink: 0; }
/* The word stays on ordinary phones (375 to 430px), because a lone door icon is
   not obviously "sign out". Only genuinely tiny screens drop it. */
@media (max-width: 339px) { .k-signout span { display: none; } }
.k-focus-bar { height: 4px; background: #eef1f8; }
.k-focus-bar i { display: block; height: 100%; background: var(--cyan); transition: width .3s ease; }

/* No tab bar means no reserved space for one, on any screen size. */
body.k-focus-mode .k-main { padding-bottom: 40px; }
body.k-focus-mode .k-shell { display: block; max-width: 720px; }

/* ── ADOPTED PAGES ───────────────────────────────────────────────────────────
   The eleven real pages keep their own .page-head for the logged-out, indexed
   version. Once the shell is on, that hero collapses to its heading: the sales
   paragraph, the eyebrow and the decorative art are all aimed at a parent who
   is deciding, not a child who has already signed in and wants to work.

   Functional controls inside the head survive, because they are navigation, not
   decoration: the Learn/Practise toggle on courses, the back link on revise.

   Anything genuinely informational marks itself .k-keep, as privacy's
   "last updated" line does.
   ─────────────────────────────────────────────────────────────────────────── */
body.k-on .page-head {
  background: none !important; color: inherit !important;
  padding: 0 !important; margin: 0 0 14px !important; border: 0 !important;
  min-height: 0 !important; text-align: left !important;
}
body.k-on .page-head .hero-split { display: block !important; }
body.k-on .page-head .hero-split-art,
body.k-on .page-head .section-label,
body.k-on .page-head .eyebrow,
body.k-on .page-head p:not(.k-keep) { display: none !important; }
body.k-on .page-head h1 {
  font-family: 'Poppins', sans-serif; font-size: 1.32rem; font-weight: 800;
  color: var(--navy) !important; line-height: 1.2; margin: 0 !important;
}
body.k-on .page-head p.k-keep {
  color: var(--k-soft) !important; font-size: .88rem; font-weight: 700; margin-top: 3px !important;
}
body.k-on .page-head .explore-toggle { margin-top: 13px; }

/* Adopted pages often centre their own wrapper and add their own page padding.
   The shell already owns both, so neutralise the double dose. */
body.k-on .k-main > .wrap,
body.k-on .k-main > .section { padding-left: 0; padding-right: 0; max-width: none; }

/* The heading and any functional control inside an adopted head were styled for
   a dark, centred hero. On the shell's light background they need re-grounding,
   or the inactive segment of a toggle becomes white text on near-white. */
body.k-on .page-head h1,
body.k-on .page-head .hero-split > div { text-align: left !important; }
body.k-on .page-head .explore-toggle { background: #fff; border: 1px solid var(--k-line); }
body.k-on .page-head .et-seg { color: var(--k-mid); min-height: 40px; display: inline-flex; align-items: center; }
body.k-on .page-head .et-seg.active { background: var(--navy); color: #fff; }
body.k-on .page-head .et-seg:not(.active):hover { color: var(--navy); }

/* Adopted pages pad their sections for a marketing rhythm. Inside the shell that
   rhythm becomes dead space a child has to scroll past. */
body.k-on .k-main .section { padding-top: 18px !important; padding-bottom: 18px !important; }

/* Light-variant doodles (-w) and the ghost wordmark badge exist only to read
   against a dark hero. The adopted head is light, so they would be white on
   near-white. They are decoration, so they go rather than get recoloured. */
body.k-on .page-head img[src$="-w.svg"],
body.k-on .page-head .wb { display: none !important; }

/* my-progress carries its own back strip ("← Dashboard | My progress | Profile →").
   The shell replaces that, so it goes. Scoped to a direct child of the main
   column: dashboard uses .bar for a progress meter INSIDE a card, and that must
   survive. */
body.k-on .k-main > .bar { display: none !important; }

/* ── THE HELPER LEAVING ──────────────────────────────────────────────────────
   When a child enters a timed activity the voice helper does not blink out, it
   lets go and floats off like a balloon: a small dip as it lifts, then up and
   away with a drift and a slow spin, shrinking as it climbs.

   Not an always-on animation. It plays once, on the way out, and only when the
   helper was already on screen. Reduced-motion users get no flight at all;
   learner-shell.js removes the node outright for them.

   Every property is !important because voice.css is injected at runtime and
   therefore lands after this file in the cascade.
   ─────────────────────────────────────────────────────────────────────────── */
.wv-launcher.wajd-balloon-away {
  animation: wajd-balloon-away 1.7s cubic-bezier(.35, .05, .5, 1) forwards !important;
  pointer-events: none !important;
  transform-origin: 50% 100% !important;
}
/* The round button becomes a balloon: a touch taller than it is wide, with the
   familiar pinched knot at the bottom. */
.wv-launcher.wajd-balloon-away .wv-fab {
  border-radius: 50% 50% 48% 48% / 55% 55% 45% 45% !important;
  /* NO transition here. A browser cannot interpolate between the circle's
     single `50%` and this eight-value elliptical form, so a transition simply
     holds the start value for its whole duration and the shape never arrives,
     because the balloon has already flown off. It snaps instead, which reads
     better anyway: a balloon takes its shape the instant it is released. */
  position: relative !important;
}
.wv-launcher.wajd-balloon-away .wv-fab::after {
  content: '' !important;
  position: absolute !important;
  left: 50% !important; bottom: -5px !important;
  width: 8px !important; height: 8px !important;
  margin-left: -4px !important;
  background: inherit !important;
  clip-path: polygon(50% 100%, 0 0, 100% 0) !important;
}
/* The teaser card is not part of the balloon; drop it immediately. */
.wv-launcher.wajd-balloon-away .wv-teaser { display: none !important; }

@keyframes wajd-balloon-away {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 1; }
  12%  { transform: translate(0, 8px) scale(1.06, .93) rotate(0deg); opacity: 1; }
  30%  { transform: translate(-10px, -18vh) scale(.94, 1.05) rotate(-4deg); opacity: 1; }
  60%  { transform: translate(14px, -55vh) scale(.72) rotate(5deg); opacity: .85; }
  85%  { transform: translate(-8px, -88vh) scale(.5) rotate(-6deg); opacity: .4; }
  100% { transform: translate(0, -115vh) scale(.32) rotate(3deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wv-launcher.wajd-balloon-away { animation: none !important; opacity: 0 !important; }
}


/* Sign out at the foot of the laptop rail, under More. Hidden on a phone, where
   the bar is exactly four thumb targets and a fifth would crowd them: there it
   stays inside More, and on the profile screen. */
.k-rail-out { display: none; }
@media (min-width: 900px) {
  .k-rail-out {
    display: flex; align-items: center; gap: 13px; margin-top: auto;
    height: 50px; padding: 0 16px; border: 0; cursor: pointer;
    background: none; color: var(--k-soft); border-radius: 12px;
    font-family: 'Nunito', sans-serif; font-weight: 800; font-size: .95rem;
    width: 100%; text-align: left;
  }
  .k-rail-out:hover { background: var(--k-bg); color: var(--k-ink); }
  .k-rail-out svg { width: 23px; height: 23px; flex-shrink: 0; }
}

/* ── SUBJECT VERDICT ROW ─────────────────────────────────────────────────────
   Shared by the dashboard and the progress page so one score cannot render two
   different ways. Word first, bar second, number last and small. The row wraps
   on a narrow screen so the bar is never crushed between the name, the pill and
   the percentage.
   ─────────────────────────────────────────────────────────────────────────── */
body.k-on .srow {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px;
  text-decoration: none; color: inherit;
}
body.k-on .srow .nm { width: 130px; font-weight: 700; color: var(--navy); font-size: .9rem; flex-shrink: 0; }
body.k-on .srow .track {
  flex: 1 1 160px; min-width: 120px; height: 10px;
  background: var(--k-bg); border-radius: 6px; overflow: hidden;
}
body.k-on .srow .track i { display: block; height: 100%; border-radius: 6px; }
body.k-on .srow .pc { width: 52px; text-align: right; font-weight: 800; font-size: .85rem; color: var(--k-mid); flex-shrink: 0; }
body.k-on .srow .verdict {
  font-size: .7rem; font-weight: 800; letter-spacing: .3px; text-transform: uppercase;
  border-radius: 999px; padding: 3px 10px; flex-shrink: 0;
}
body.k-on .srow .verdict.solid { background: rgba(47,158,110,.13); color: #227d55; }
body.k-on .srow .verdict.ok    { background: rgba(245,166,35,.15); color: #9a6410; }
body.k-on .srow .verdict.work  { background: rgba(207,90,134,.13); color: #a8386a; }
@media (max-width: 560px) { body.k-on .srow .nm { width: 96px; font-size: .82rem; } }
