/* ---------------------------------------------------------------------------
   screens.css — per-screen composition.
   --------------------------------------------------------------------------- */

/* ==========================================================================
   Welcome
   ========================================================================== */

.welcome .screen__scroll {
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--safe-bottom) + var(--space-5));
}

.welcome__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-top: var(--space-4);
  flex: 0 0 auto;
}

.welcome__mark {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: linear-gradient(180deg, #a8c46f, var(--moss-700));
  box-shadow:
    0 8px 16px -8px rgba(56, 84, 40, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  display: grid;
  place-items: center;
}

.welcome__mark svg {
  width: 26px;
  height: 26px;
}

.welcome__wordmark {
  font-size: 25px;
  font-weight: 900;
  letter-spacing: -0.035em;
  color: var(--moss-900);
}

.welcome__copy {
  text-align: center;
  padding-top: var(--space-5);
  flex: 0 0 auto;
}

.welcome__copy .title-hero {
  max-width: 15ch;
  margin: 0 auto;
  font-size: 34px;
}

.welcome__copy .body-text {
  max-width: 32ch;
  margin: var(--space-3) auto 0;
  font-size: var(--text-base);
  line-height: 1.5;
}

/* The diorama takes whatever height is left over, within sensible bounds. */
.welcome__stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 250px;
  margin-top: var(--space-3);
  margin-inline: calc(-1 * var(--app-gutter));
}

.welcome__scene {
  position: absolute;
  inset: 0;
}

.welcome__clouds {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.welcome__clouds .cloud {
  height: 20px;
}

.welcome__clouds .cloud--a {
  width: 86px;
  top: 16%;
  left: 8%;
}

.welcome__clouds .cloud--b {
  width: 62px;
  top: 32%;
  right: 9%;
  opacity: 0.8;
}

.welcome__clouds .cloud--c {
  width: 48px;
  top: 62%;
  left: 12%;
  opacity: 0.62;
  animation: wg-drift 30s ease-in-out infinite alternate;
}

.welcome__scene .scene__canvas {
  position: relative;
  z-index: 1;
}

.welcome__actions {
  flex: 0 0 auto;
  padding-top: var(--space-4);
}

.welcome__hint {
  margin-top: var(--space-3);
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-muted);
}

/* ==========================================================================
   Home
   ========================================================================== */

.home__top {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-top: var(--space-2);
}

.home__avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(180deg, #e8f0d6, #cfe0b0);
  box-shadow:
    0 6px 14px -6px rgba(58, 68, 44, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 0 0 3px rgba(255, 255, 255, 0.85);
}

.home__avatar svg {
  width: 100%;
  height: 100%;
}

.home__greeting {
  flex: 1;
  min-width: 0;
}

.home__greeting-eyebrow {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-muted);
}

.home__greeting-name {
  font-size: var(--text-xl);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--moss-900);
  line-height: 1.12;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Streak + XP card --- */

.home__streak {
  padding: var(--space-4) var(--space-5) var(--space-4);
}

.home__streak-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.home__streak-body {
  flex: 1;
  min-width: 0;
}

.home__streak-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--moss-900);
  letter-spacing: -0.01em;
}

.home__streak-sub {
  margin-top: 2px;
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink-muted);
}

.home__xp {
  margin-top: var(--space-4);
}

.home__xp-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--moss-700);
}

.home__xp-meta span:last-child {
  color: var(--ink-muted);
}

.home__mascot {
  width: 74px;
  height: 82px;
  flex: 0 0 auto;
  margin: -10px -8px -14px 0;
  pointer-events: none;
}

@media (max-width: 359px) {
  .home__mascot {
    display: none;
  }
}

/* --- Section heading --- */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-1);
}

.section-head__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--moss-700);
  text-decoration: none;
  padding: 0 var(--space-2);
  margin-right: calc(-1 * var(--space-2));
  border-radius: var(--radius-sm);
}

/* --- Course cards --- */

.home__cards {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.home__cards li {
  transition:
    opacity 320ms var(--ease-out),
    transform 320ms var(--spring-ease),
    filter 320ms var(--ease-out);
}

/* Chips de-emphasise rather than remove, so the list never jumps. */
.home__cards li[data-muted='true'] {
  opacity: 0.42;
  filter: saturate(0.5);
  transform: scale(0.985);
}

.home__cards li[hidden] {
  display: none;
}

.course-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4);
}

.course-card__art {
  position: relative;
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.6),
    0 6px 14px -7px rgba(58, 68, 44, 0.6);
}

.course-card__art svg {
  width: 46px;
  height: 46px;
}

.course-card__art--moss {
  background: linear-gradient(165deg, #dfebc7, #bfd39b);
}
.course-card__art--lavender {
  background: linear-gradient(165deg, #ebdffb, #cfb7ef);
}
.course-card__art--peach {
  background: linear-gradient(165deg, #fde3cd, #f6c096);
}
.course-card__art--sky {
  background: linear-gradient(165deg, #ddeef4, #b2d6e5);
}

.course-card__body {
  flex: 1;
  min-width: 0;
}

.course-card__title {
  font-size: var(--text-md);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--moss-900);
  line-height: 1.2;
}

.course-card__desc {
  margin-top: 3px;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--ink-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.course-card__foot {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: 10px;
}

.course-card__foot .progress {
  flex: 1;
}

.course-card__count {
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--moss-700);
  flex: 0 0 auto;
}

.course-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
}

/* ==========================================================================
   Machine Learning lesson
   ========================================================================== */

.ml__hero {
  position: relative;
  height: 208px;
  margin-inline: calc(-1 * var(--app-gutter));
  margin-top: var(--space-1);
}

.ml__hero-scene {
  position: absolute;
  inset: 0;
}

.ml__hero-plinth {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 74%;
  height: 30px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(58, 68, 44, 0.22), rgba(58, 68, 44, 0));
  pointer-events: none;
}

.ml__title-block {
  margin-top: var(--space-2);
}

.ml__title {
  font-size: var(--text-2xl);
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--moss-900);
}

.ml__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.ml__outcome-list {
  list-style: none;
  margin: var(--space-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ml__outcome-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.45;
  color: var(--ink);
}

.ml__outcome-list svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.ml__progress-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--moss-700);
}

/* ==========================================================================
   fBM Explorer
   ========================================================================== */

.fbm__stage {
  position: relative;
  height: 268px;
  margin-inline: calc(-1 * var(--app-gutter));
  border-radius: 0;
  overflow: hidden;
}

.fbm__scene {
  position: absolute;
  inset: 0;
}

.fbm__label {
  top: 14px;
  left: calc(var(--app-gutter) + var(--safe-left));
}

.fbm__label-value {
  font-variant-numeric: tabular-nums;
  color: var(--lavender-deep);
}

.fbm__legend {
  position: absolute;
  right: calc(var(--app-gutter) + var(--safe-right));
  bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-end;
  pointer-events: none;
}

.fbm__legend span {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  background: rgba(255, 250, 238, 0.8);
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.fbm__param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.fbm__param-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--moss-900);
}

.fbm__readout {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-weight: 900;
  color: var(--lavender-deep);
  font-size: var(--text-lg);
  font-variant-numeric: tabular-nums;
}

.fbm__readout small {
  font-size: var(--text-xs);
  font-weight: 800;
  color: var(--ink-muted);
}

.fbm__descriptor {
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--ink-muted);
  min-height: 2.9em;
}

.fbm__descriptor strong {
  color: var(--moss-900);
}

.fbm__explain h2 {
  font-size: var(--text-md);
  font-weight: 800;
  color: var(--moss-900);
  margin-bottom: var(--space-2);
}

.fbm__explain p + p {
  margin-top: var(--space-3);
}

.fbm__formula {
  display: block;
  margin-top: var(--space-3);
  padding: 11px var(--space-4);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f2e7d3, #f8f0e0);
  box-shadow: var(--shadow-sunk);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--moss-900);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.fbm__stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.fbm__stat {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  text-align: center;
  background: rgba(222, 208, 245, 0.36);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* Sentence case, not uppercase: the Greek letters in these labels lose their
   identity when transformed (β becomes an indistinguishable Β). */
.fbm__stat dt {
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--ink-muted);
  white-space: nowrap;
}

.fbm__stat dd {
  margin: 3px 0 0;
  font-size: var(--text-base);
  font-weight: 900;
  color: var(--lavender-ink);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Short-viewport accommodations
   ========================================================================== */

@media (max-height: 700px) {
  .welcome__stage {
    min-height: 200px;
  }

  .welcome__copy {
    padding-top: var(--space-3);
  }

  .ml__hero {
    height: 176px;
  }

  .fbm__stage {
    height: 230px;
  }
}

@media (max-height: 600px) {
  .welcome__stage {
    min-height: 172px;
  }

  .fbm__stage {
    height: 200px;
  }
}
