/*
 * Tamilcube Academy — player + hub styles (Phase 0 spike).
 * Brand palette aligned to the Tamilcube Star Junior sibling app:
 *   mango #FFB347 (primary) · sky #5BC0EB · leaf #9BC53D · sun #FFD93D
 *   on warm ivory #FDF9F4. Kid-first: big rounded cards, >=64px tap targets,
 *   per-step hue, reduced-motion-safe.
 */

.tca-app, .tca-player, .tca-home {
  --tca-mango: #FFB347; --tca-sky: #5BC0EB; --tca-leaf: #9BC53D;
  --tca-sun: #FFD93D;   --tca-coral: #F78BA8; --tca-purple: #B190F5;
  --tca-ivory: #FDF9F4; --tca-ink: #1C1310;
  --tca-radius: 24px; --tca-gap: 16px;
  font-family: "Nunito", "Baloo 2", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--tca-ink);
  /* Full-bleed to match the host theme's stretched (builder) pages. */
  width: 100%; max-width: none; margin: 0 auto; padding: 16px;
}

/* ---- Host-theme content-width override --------------------------------- *
 * The host theme (Astra on staging) caps single post / CPT content to a
 * narrow reading column, while its own builder pages render full-width. Make
 * Academy's plugin-rendered CPT pages match those full-width pages — but ONLY
 * on Academy surfaces, scoped to the `tca-app` body class we add for
 * course/lesson/topic singulars (AppBodyClass), so marketing/home/other pages
 * keep the theme's own width. Width-only & additive: a selector that doesn't
 * match a given theme is a harmless no-op (can never narrow another page).    */
body.tca-app .site-content .ast-container,
body.tca-app .site-content #primary,
body.tca-app .site-content .entry-content,
body.tca-app .site-content .ast-article-single { max-width: 100%; width: 100%; padding-left: 0; padding-right: 0; }

/* 8-hue palette for course/skill identity. */
.tca-hue-1 { --hue: #FFB347; } .tca-hue-2 { --hue: #5BC0EB; }
.tca-hue-3 { --hue: #9BC53D; } .tca-hue-4 { --hue: #FFD93D; }
.tca-hue-5 { --hue: #F78BA8; } .tca-hue-6 { --hue: #B190F5; }
.tca-hue-7 { --hue: #4FC3B1; } .tca-hue-8 { --hue: #FFA07A; }

/* ---- Home -------------------------------------------------------------- */
.tca-home__title { font-size: 2rem; font-weight: 800; text-align: center; }
.tca-home__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--tca-gap); }
.tca-course-card {
  display: flex; flex-direction: column; justify-content: space-between;
  min-height: 168px; padding: 22px; border-radius: var(--tca-radius);
  background: var(--hue, #FFB347); color: #fff; text-decoration: none;
  box-shadow: 0 6px 0 rgba(0,0,0,.12); font-weight: 800;
}
.tca-course-card__title { font-size: 1.35rem; }
.tca-course-card__go { align-self: flex-end; font-size: 1.1rem; }

/* ---- Player shell ------------------------------------------------------ */
.tca-head {
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  margin-bottom: 16px;
}
.tca-back { color: var(--tca-ink); text-decoration: none; font-weight: 800; }
/* NB: `.tca-dots`/`.tca-dot` are owned by the native Preact bundle (styles.css);
 * the old spike progress-dot rules were removed from here to avoid leaking onto
 * native lesson pages (they turned the labelled step pills into ellipses). */
.tca-stars { font-weight: 800; white-space: nowrap; }
.tca-live { position: absolute; left: -9999px; }

.tca-stage { --hue: var(--tca-mango); text-align: center; }
.tca-step--sun    { --hue: var(--tca-sun); }
.tca-step--sky    { --hue: var(--tca-sky); }
.tca-step--mango  { --hue: var(--tca-mango); }
.tca-step--leaf   { --hue: var(--tca-leaf); }
.tca-step--coral  { --hue: var(--tca-coral); }
.tca-step--purple { --hue: var(--tca-purple); }

/* Hued step hero with bobbing mascot. */
.tca-stephero {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: var(--hue); border-radius: var(--tca-radius);
  padding: 16px 20px; margin-bottom: 20px; box-shadow: 0 5px 0 rgba(0,0,0,.10);
}
.tca-step-count { margin-left: auto; font-weight: 800; color: #1C1310; white-space: nowrap; }

/* ---- Topic page chrome (shortcode content + our nav) ------------------- */
.tca-topic-body { text-align: left; margin: 0 auto; }
.tca-topic-body img { max-width: 100%; height: auto; }
.tca-topicnav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 26px; }
.tca-prev {
  display: inline-block; padding: 14px 24px; min-height: 52px; border-radius: 999px;
  background: #EFE8DD; color: #1C1310; font-weight: 800; text-decoration: none;
}
.tca-backlink { display: block; text-align: center; margin-top: 14px; color: #5BC0EB; font-weight: 700; }

/* ---- Lesson outline (table of contents) ------------------------------- */
.tca-toc { display: flex; flex-direction: column; gap: 10px; }
.tca-toc-row {
  --hue: var(--tca-purple);
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  background: #fff; border-radius: 16px; padding: 14px 18px; color: var(--tca-ink);
  box-shadow: 0 3px 0 rgba(0,0,0,.07); border-left: 8px solid var(--hue);
}
.tca-toc-num {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%; background: var(--hue);
  color: #1C1310; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.tca-toc-title { flex: 1; font-weight: 700; }
.tca-toc-go { color: #9aa; font-size: 1.3rem; }
.tca-outline__start { text-align: center; }
.tca-mascot { font-size: 2.6rem; line-height: 1; animation: tca-bob 1.8s ease-in-out infinite; }
.tca-stephero__txt { display: flex; flex-direction: column; }
.tca-step-label { font-size: 1.4rem; font-weight: 800; color: #1C1310; }
.tca-step-hint  { font-size: 1rem; color: #2c2418; }
.tca-act-title { font-size: 1.2rem; font-weight: 800; margin: 18px 0 12px; }
.tca-intro { font-size: 1.05rem; color: #555; margin-bottom: 12px; }

/* ---- Cards ------------------------------------------------------------- */
.tca-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--tca-gap); }
.tca-grid--letters { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 640px) { .tca-grid, .tca-grid--letters, .tca-home__grid { grid-template-columns: repeat(2, 1fr); } }

.tca-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-height: 128px; padding: 14px; border: 0; cursor: pointer;
  border-radius: var(--tca-radius); background: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,.08); transition: transform .12s ease;
}
.tca-card:hover { transform: translateY(-2px); }
.tca-card:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0,0,0,.08); }
.tca-card.is-heard { outline: 4px solid var(--tca-leaf); outline-offset: 2px; background: #F4FAE6; }
.tca-card__img { width: 88px; height: 88px; object-fit: contain; }
.tca-card__ph { width: 88px; height: 88px; display: flex; align-items: center; justify-content: center; font-size: 2.4rem; opacity: .5; }
.tca-card__tamil { font-size: 1.5rem; font-weight: 800; }
.tca-card__en { font-size: .9rem; color: #667; }
.tca-card--letter { min-height: 136px; }
.tca-letter { font-size: 3rem; font-weight: 800; line-height: 1; }

/* ---- Buttons / embeds -------------------------------------------------- */
.tca-next, .tca-markdone, .tca-worksheet {
  display: inline-block; margin-top: 24px; padding: 16px 34px;
  min-height: 58px; border: 0; border-radius: 999px; cursor: pointer;
  font-size: 1.2rem; font-weight: 800; text-decoration: none;
  background: var(--tca-mango); color: #1C1310; box-shadow: 0 5px 0 rgba(0,0,0,.15);
}
.tca-markdone { background: var(--tca-leaf); color: #fff; }
.tca-worksheet { background: var(--tca-sun); color: #1C1310; }
.tca-next:disabled { background: #EADFCE; color: #B3A48F; box-shadow: none; cursor: not-allowed; }
/* Embedded activity (tracing / game) reported done — invite the next tap. */
.tca-next--ready { background: var(--tca-leaf); color: #fff; animation: tca-bob .9s ease-in-out infinite; }
.tca-embed, .tca-teaching { margin: 0 auto; max-width: 760px; }
.tca-embed-missing { color: #b00; }
.tca-videowrap { position: relative; width: 100%; max-width: 640px; margin: 0 auto; aspect-ratio: 16 / 9; }
.tca-videowrap .tca-video { position: absolute; inset: 0; width: 100%; height: 100%; }
.tca-video { width: 100%; max-width: 640px; border: 0; border-radius: var(--tca-radius); }

/* ---- Finish + celebration --------------------------------------------- */
.tca-finish { text-align: center; padding: 30px 0; }
.tca-finish__art { font-size: 3rem; }
.tca-finish .tca-next, .tca-finish .tca-back { display: block; max-width: 320px; margin: 16px auto; }
.tca-burst {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
  font-size: 5rem; pointer-events: none; animation: tca-pop .9s ease forwards;
}
@keyframes tca-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  40% { opacity: 1; transform: translate(-50%, -50%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1); }
}
@keyframes tca-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@media (prefers-reduced-motion: reduce) {
  .tca-card, .tca-card:hover, .tca-card:active, .tca-mascot, .tca-next--ready { transition: none; transform: none; animation: none; }
  .tca-burst { animation: none; opacity: .9; }
}
