/* =====================================================================
   AIKA shared theme — aika-theme.css — v2.69.0-uiux (2026-09-21)
   SPEC: research/AIKA_UIUX_REDESIGN_SPEC_2026-09-21.md §2 (commit 3568c6c)
   James #58630 GO: G-1 = Option A (--lotus-500 = #ff8aa3), G-4 CTA law.
   Lotus hex declared per §2.3.1 hex hygiene: THIS FILE USES #ff8aa3 ONLY.
   No LM Hub hexes (#e879a0 / #d4557f) appear anywhere in this stylesheet.

   ONE SOURCE OF TOKENS (§2.1.1). Pages alias their legacy names to these.
   Zero invented hexes: every value below is live in static/*.html or is an
   alpha derivation of a live token.

   LIVE-SOURCE CITATIONS (§2.2.1) — grep of web/static/*.html @ HEAD 32f6f97:
     --bg      #0f1117  index.html:22  dashboard.html:11  progress.html:18  leaderboard.html:13  join.html:36  login.html:28  everyday.html:22  la.html:22  landing.html:39
     --surface #1a1d2e  index.html:23  dashboard.html:11  progress.html:18  leaderboard.html:14  join.html:37  login.html:28  everyday.html:22  la.html:22  landing.html:39(--bg2/--surface-solid)
     --text    #e8eaf6  index.html:30  dashboard.html:13  progress.html:20  leaderboard.html:21  join.html:44  login.html:30  everyday.html:24  la.html:24  landing.html:41
     --muted   #7986cb  index.html:31  dashboard.html:13  progress.html:20  leaderboard.html:22  join.html:45  everyday.html:24  la.html:24   (login/landing use #9aa3d4)
     --success #00e676  index.html:29  dashboard.html:13  progress.html:20  leaderboard.html:20  join.html:43  login.html:30  everyday.html:23  la.html:23  landing.html:41
     --danger  #ff5c7c  index.html:32  dashboard.html:13  progress.html:20  leaderboard.html:23  join.html:46  login.html:30  everyday.html:24  la.html:24  landing.html:41
     --gold    #ffd700  index.html:28  dashboard.html:13  progress.html:20  leaderboard.html:19  join.html:42  login.html:29  everyday.html:23  la.html:23  landing.html:40
     --accent  #00d4ff  index.html:27  dashboard.html:12  progress.html:19  leaderboard.html:18  join.html:41  login.html:29  everyday.html:23  la.html:23  landing.html:40  → demoted to --info
     #ff8aa3 (Lotus)    live 13× pre-redesign (SPEC §1.1) e.g. dashboard.html / index.html illustration + accent uses → promoted to --lotus-500
     retired purples    #6c63ff #8b7fff #4f46e5 #a855f7 (--primary/--primary-2, every page) → illustration art only (.illus scope), never chrome

   CONTRAST RECEIPTS (WCAG 2.x relative luminance; L(bg)=0.00565, L(surface)=0.01296)
     white   on bg 18.87 / surface 16.68  ✓ body ✓ UI      → display + primary CTA fill
     text    on bg 15.75 / surface 13.92  ✓                → body
     muted #7986cb on bg 5.46 / surface 4.83 ✓ body (≥4.5) → kept live value (SPEC §2.2 fallback rgba(232,234,246,.72) NOT needed)
     lotus-500 #ff8aa3 on bg 8.46 / surface 7.48 ✓         → pink text on dark only; focus ring ≥3:1 ✓
     gold    on bg 13.45 / surface 11.89  ✓                → earned rewards only
     success on bg 11.31 / surface 9.99   ✓ + icon + text
     danger  on bg 6.36 / surface 5.62    ✓ + icon + text
     info    on bg 10.66 / surface 9.42   ✓ charts / glyphs only
     lotus-ink #0f1117 on lotus-500 fill 8.46 ✓            → the ONLY text colour on pink
     lotus-ink on gold fill 13.45 ✓                        → reward chips
     text on lotus-100 tint over surface ≈11.3 ✓           → hover / tint
     FORBIDDEN: white on #ff8aa3 (2.23) · pink on white (≈2.2) — no rule in this file produces either.
   ===================================================================== */

:root {
  /* palette */
  --bg:         #0f1117;
  --surface:    #1a1d2e;
  --surface-2:  #232741;                 /* live (dashboard/progress/login) card-on-card step */
  --white:      #ffffff;
  --text:       #e8eaf6;
  --muted:      #7986cb;
  --lotus-500:  #ff8aa3;                 /* Option A — James #58630 G-1 */
  --lotus-100:  rgba(255,138,163,.12);   /* alpha of --lotus-500 */
  --lotus-ink:  var(--bg);
  --gold:       #ffd700;
  --success:    #00e676;
  --danger:     #ff5c7c;
  --info:       #00d4ff;                 /* was --accent; demoted */
  --line:       rgba(232,234,246,.10);   /* alpha of --text; hairlines */
  --line-strong:rgba(232,234,246,.18);

  /* legacy aliases — keep old per-page names resolving, pointed at canonical tokens */
  --accent:     var(--info);

  /* scales (§2.1.2): kid default; body.scale-adult overrides */
  --fs-base:    18px;
  --r-sm:       12px;
  --r:          16px;
  --r-lg:       20px;
  --cta-h:      48px;

  /* motion (§6.1) */
  --t-fast:     120ms;
  --t-base:     160ms;
  --t-slow:     200ms;
  --t-celebrate:1.5s;
  --ease:       cubic-bezier(.2,.8,.2,1);
}
body.scale-adult {
  --fs-base: 16px;
  --r-sm:    8px;
  --r:       10px;
  --r-lg:    12px;
}

/* ---------- base ---------- */
html { color-scheme: dark; }
body.aika-theme {
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
body.aika-theme h1, body.aika-theme .display { color: var(--white); font-weight: 800; letter-spacing: -0.01em; }
body.aika-theme h2 { color: var(--white); font-weight: 700; }
body.aika-theme .muted { color: var(--muted); }
body.aika-theme a { color: var(--text); }
body.aika-theme a:focus-visible,
body.aika-theme button:focus-visible,
body.aika-theme [tabindex]:focus-visible,
body.aika-theme input:focus-visible,
body.aika-theme select:focus-visible,
body.aika-theme textarea:focus-visible {
  outline: 3px solid var(--lotus-500);
  outline-offset: 2px;                   /* 2px --bg gap (§2.6.4) */
  border-radius: var(--r-sm);
}

/* ---------- §2.6 CTA law ---------- */
.btn-primary,
.aika-theme .btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--cta-h); padding: 0 24px;
  border-radius: 999px;                  /* pill — distinguishable from H1 by shape (§2.6.3) */
  background: var(--white); color: var(--lotus-ink);
  font-weight: 600; font-size: min(1rem, 18px); line-height: 1.2;   /* medium weight ≤18px (§2.6.3) */
  border: 0; text-decoration: none; cursor: pointer;
  transition: background var(--t-base) var(--ease), opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
  position: relative; isolation: isolate;
}
.btn-primary::after {                    /* hover = --lotus-100 tint composited over white; ink stays ≥15:1 */
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--lotus-100); opacity: 0; z-index: -1;
  transition: opacity var(--t-base) var(--ease);
}
.btn-primary:hover::after { opacity: 1; }
.btn-primary:active { opacity: .92; }    /* pressed = surface-tinted white 92% (§2.6.4) */
.btn-primary[disabled], .btn-primary[aria-disabled="true"] {
  background: var(--muted); color: var(--bg); opacity: .6; cursor: not-allowed;
}
.btn-secondary,
.aika-theme .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: var(--cta-h); padding: 0 22px;
  border-radius: 999px; background: transparent; color: var(--text);
  border: 1px solid var(--muted); font-weight: 600; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.btn-secondary:hover { background: var(--lotus-100); border-color: var(--line-strong); }

/* ---------- surfaces ---------- */
.aika-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
}
.aika-card--earned { border-color: var(--gold); }               /* boss / earned frame (§4.2) */
.aika-tag-gold {                                                /* "+N Neurons" earned tag */
  display: inline-flex; align-items: center; gap: .35em; border-radius: 999px;
  background: var(--gold); color: var(--lotus-ink); font-weight: 700; font-size: .85em; padding: .15em .7em;
}
.aika-badge-free {                                              /* §5.4 FREE badge */
  display: inline-flex; align-items: center; gap: .35em; border-radius: 999px;
  background: var(--lotus-100); color: var(--text); border: 1px solid var(--line-strong);
  font-weight: 700; font-size: .8em; padding: .2em .75em; letter-spacing: .02em;
}
.aika-note {                                                    /* AI disclosure chip (§4.1.3) */
  display: flex; align-items: flex-start; gap: .5em;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  padding: .55em .9em; font-size: .9em; color: var(--text);
}

/* ---------- chips (§4.1.6) — kind by label + shape + icon, never colour alone ---------- */
.aika-chip {
  display: inline-flex; align-items: center; gap: .4em; min-height: 40px; padding: 0 .9em;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-strong);
  font: inherit; font-size: .92em; cursor: pointer;
  transition: background var(--t-base) var(--ease), border-color var(--t-base) var(--ease);
}
.aika-chip:hover { background: var(--lotus-100); }
.aika-chip--lesson { border-radius: var(--r-sm); }              /* rounded rectangle, label "Lesson" */
.aika-chip--foryou { border-radius: 999px; }                    /* pill, sparkle icon, label "For you" */
.aika-chip .kind { font-size: .75em; color: var(--muted); font-weight: 700; text-transform: none; }

/* ---------- progress ring / strip ---------- */
.aika-ring { --p: 0; width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--lotus-500) calc(var(--p) * 1%), var(--surface-2) 0);
  display: grid; place-items: center; }
.aika-ring::after { content: ""; width: 70%; height: 70%; border-radius: 50%; background: var(--surface); }
.aika-strip { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .9em; }
.aika-strip .item { display: inline-flex; align-items: center; gap: .4em; }
.aika-track { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.aika-track > i { display: block; height: 100%; background: var(--lotus-500); border-radius: inherit; transition: width var(--t-slow) var(--ease); }

/* ---------- bubbles (§4.1.2) ---------- */
.aika-bubble--aika { background: var(--surface); color: var(--text); border-inline-start: 3px solid var(--lotus-500); }
.aika-bubble--kid  { background: var(--lotus-100); color: var(--text); }

/* ---------- motion (§6) ---------- */
.aika-fade-in { animation: aikaFadeIn var(--t-base) var(--ease) both; }
@keyframes aikaFadeIn { from { opacity: 0; } to { opacity: 1; } }
.aika-reveal { opacity: 0; transform: translateY(8px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.aika-reveal.in { opacity: 1; transform: none; }
.aika-pulse-gold { animation: aikaGoldPulse 300ms var(--ease) 1; }
@keyframes aikaGoldPulse { 50% { transform: scale(1.15); } }
.aika-thinking { animation: aikaThink 1.2s ease-in-out infinite; }
@keyframes aikaThink { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.aika-ack {                                                     /* §6.2.7 single consolidated acknowledgment */
  position: fixed; inset-inline-end: 16px; bottom: 16px; z-index: 9999; max-width: 340px;
  background: var(--surface); color: var(--text); border: 1px solid var(--gold); border-radius: var(--r);
  padding: .8rem 1rem .8rem 1rem; font-size: .95em; line-height: 1.45; box-shadow: 0 8px 28px rgba(0,0,0,.45);
  animation: aikaFadeIn var(--t-slow) var(--ease) both;
}
.aika-ack ul { margin: .35em 0 0; padding-inline-start: 1.1em; }
.aika-ack .close { position: absolute; top: 4px; inset-inline-end: 6px; background: none; border: 0; color: var(--text); font-size: 1.1em; cursor: pointer; min-width: 32px; min-height: 32px; }
.aika-ack-inline { color: var(--text); font-size: .9em; border-inline-start: 3px solid var(--gold); padding: .3em .8em; margin: .4em 0; background: var(--surface); border-radius: var(--r-sm); }

@media (prefers-reduced-motion: reduce) {
  .aika-theme *, .aika-theme *::before, .aika-theme *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .aika-reveal { opacity: 1; transform: none; }
  .aika-thinking { animation: none; opacity: 1; }
}

/* ---------- RTL ---------- */
[dir="rtl"] .aika-bubble--aika { border-inline-start: 3px solid var(--lotus-500); } /* logical prop already mirrors; explicit for clarity */

/* ---------- illustration scope: retired purples allowed ONLY here (§2.2) ---------- */
.illus { --illus-a: #6c63ff; --illus-b: #8b7fff; --illus-c: #4f46e5; --illus-d: #a855f7; }
