/* ==========================================================================
   LESSON KIT — every programme's lessons in Scratch's clothes (2026-10-18)
   --------------------------------------------------------------------------
   Scratch's lesson page is the reference: a coloured header band with a
   level stripe under it, a warm off-white page, white cards with a coloured
   left bar, Baloo 2 headings and Nunito prose at a size a child reads without
   leaning in, and challenges that are their own tinted box getting hotter
   gold → orange → red, with violet for the Extra.

   This sheet gives the same look to every OTHER programme, in that
   programme's own colour. It does not touch Scratch: /scratch/lesson.css is
   the original and stays as it is. It applies only inside a wrapper carrying
   `.lesson-kit`, which each programme's level layout (or lesson view) adds:

     .lesson.lesson-kit       the "header" family — Arduino, EV3, GCSE, IGCSE:
                              <header class="lesson-header"> + <main> of
                              <section class="lesson-section"><h2>
     .lesson-page.lesson-kit  the "hero" family — Python, WebApp, AI, Godot,
                              Pygame, Roblox, Minecraft, 3D Design, Blender:
                              <header class="lesson-hero"> + main.lesson-body
                              of sections with .lesson-section__head/__body

   No lesson page changed for this: both families already mark their parts
   the same way, so the kit restyles the markup they have. Challenge boxes key
   off the section ids every programme shares (#challenge-1..3, #extra).

   🔥 SPECIFICITY IS DELIBERATE. Every rule starts `.lesson-kit.lesson-kit`
   (0,2,0) so it beats the course sheets' single-class rules whatever order
   the browser loads them in — those are hoisted by React and arrive after
   this one. Do not "tidy" the doubled class away.

   Tokens, set per programme below:
     --kit       the programme's colour (per level where the programme has one)
     --kit-dark  its deep shade, for the header gradient and headings
     --kit-soft  its pale tint, for chips and rules
     --kit-ink   heading ink
   ========================================================================== */

/* ---------- tokens ---------- */

/* The hero family already carries its per-level colour as --accent. */
.lesson-page.lesson-kit {
  --kit: var(--accent, #6366F1);
  --kit-dark: var(--accent-dark, var(--accent-deep, color-mix(in srgb, var(--kit) 75%, #000)));
  --kit-soft: var(--accent-soft, color-mix(in srgb, var(--kit) 12%, #fff));
  --kit-ink: color-mix(in srgb, var(--kit-dark) 45%, #0F172A);
}
/* The header family names its colour per course. */
.lesson.lesson-kit.kit--arduino { --kit: #00979D; --kit-dark: #006D71; --kit-soft: #E0F2F3; --kit-ink: #0B3A3C; }
.lesson.lesson-kit.kit--ev3     { --kit: #D8232A; --kit-dark: #9E1216; --kit-soft: #FDE9E9; --kit-ink: #2A0608; }
.lesson.lesson-kit.kit--cs      { --kit: #6366F1; --kit-dark: #4338CA; --kit-soft: #EEF0FE; --kit-ink: #1E1B4B; }

/* Level stripes, as Scratch's. Arduino's own were scoped to `body.lesson`,
   which never matched (the wrapper is a div), so they are set here. */
.lesson-kit.lesson-kit.lesson--level-1 { --lvl: #10B981; --lvl-soft: #E7FBF3; }
.lesson-kit.lesson-kit.lesson--level-2 { --lvl: #3B82F6; --lvl-soft: #E8F1FE; }
.lesson-kit.lesson-kit.lesson--level-3 { --lvl: #F59E0B; --lvl-soft: #FEF4E0; }
.lesson-kit.lesson-kit.lesson--level-4 { --lvl: #EC4899; --lvl-soft: #FDE8F1; }

.lesson-kit.lesson-kit {
  --font-kid: 'Nunito', 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-kid-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  font-family: var(--font-kid);
  /* Scratch's cream, warmed toward the programme's own colour. */
  background: color-mix(in srgb, var(--kit) 3%, #FFFCF6);
  color: #0F172A;
  line-height: 1.7;
}

/* ---------- the header band ---------- */

/* Scratch's header runs full width with its words on the left; the hero
   family centred them in an 880px column. Same as Scratch now. */
.lesson-kit.lesson-kit .lesson-hero__inner {
  max-width: none;
  margin: 0;
  padding: 48px 32px 40px;
}

.lesson-kit.lesson-kit .lesson-header,
.lesson-kit.lesson-kit .lesson-hero {
  background: linear-gradient(135deg, var(--kit) 0%, var(--kit-dark) 100%);
  color: #fff;
  border-bottom: 6px solid var(--lvl, color-mix(in srgb, var(--kit-dark) 70%, #000));
}
.lesson-kit.lesson-kit .lesson-hero::before,
.lesson-kit.lesson-kit .lesson-hero::after { display: none; }
.lesson-kit.lesson-kit .lesson-header h1,
.lesson-kit.lesson-kit .lesson-hero__title {
  font-family: var(--font-kid-head);
  font-size: clamp(1.9rem, 4.4vw, 2.9rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  color: #fff;
}
.lesson-kit.lesson-kit .lesson-hero__crumbs,
.lesson-kit.lesson-kit .lesson-hero__crumbs a,
.lesson-kit.lesson-kit .lesson-hero__crumbs .sep,
.lesson-kit.lesson-kit .lesson-hero__crumbs .here,
.lesson-kit.lesson-kit .lesson-crumbs,
.lesson-kit.lesson-kit .lesson-crumbs a { color: rgba(255, 255, 255, 0.88); }
.lesson-kit.lesson-kit .lesson-hero__crumbs .here,
.lesson-kit.lesson-kit .lesson-crumbs .here { color: #fff; font-weight: 700; }
.lesson-kit.lesson-kit .lesson-hero__num,
.lesson-kit.lesson-kit .lesson-header .lesson-tag {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border: 0;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}
.lesson-kit.lesson-kit .lesson-hero__sub,
.lesson-kit.lesson-kit .lesson-header .lesson-sub {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.08rem;
  opacity: 1;
}
.lesson-kit.lesson-kit .lesson-hero__sub code,
.lesson-kit.lesson-kit .lesson-header .lesson-sub code {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.lesson-kit.lesson-kit .lesson-hero__meta-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
}
.lesson-kit.lesson-kit .lesson-hero__meta-pill a { color: #fff; }

/* ---------- section cards ---------- */

.lesson-kit.lesson-kit .lesson-section {
  position: relative;
  overflow: hidden;
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--kit) 14%, #F3E5C9);
  border-radius: 16px;
  box-shadow: none;
  padding: 28px 28px 24px 32px;
  margin-bottom: 22px;
  scroll-margin-top: 90px;
}
.lesson-kit.lesson-kit .lesson-section::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--lvl, var(--kit));
}

/* The hero family's section head: no tinted strip, the title is the
   landmark, with a rule under it — Scratch's section title. */
.lesson-kit.lesson-kit .lesson-section__head {
  background: none;
  margin: 0 0 20px;
  padding: 0 0 14px;
  border: 0;
  border-bottom: 3px solid var(--lvl-soft, var(--kit-soft));
  align-items: center;
  gap: 12px;
}
.lesson-kit.lesson-kit .lesson-section__num {
  flex: none;
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--kit-soft);
  color: var(--kit-dark);
  border: 0;
  font-family: var(--font-kid-head);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
}
.lesson-kit.lesson-kit .lesson-section__time,
.lesson-kit.lesson-kit .lesson-section h2 .time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--kit-soft);
  color: var(--kit-dark);
  padding: 4px 12px;
  border-radius: 999px;
  margin-left: auto;
  align-self: center;
}

/* Titles: large, rounded, in the programme's ink — findable while scrolling. */
.lesson-kit.lesson-kit .lesson-section__title,
.lesson-kit.lesson-kit .lesson-section > h2 {
  font-family: var(--font-kid-head);
  font-size: clamp(1.6rem, 3vw, 2.05rem);
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--kit-ink);
}
.lesson-kit.lesson-kit .lesson-section > h2 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 20px;
  padding: 0 0 14px;
  border-bottom: 3px solid var(--lvl-soft, var(--kit-soft));
}
.lesson-kit.lesson-kit .lesson-section h3,
.lesson-kit.lesson-kit .lesson-section h4 {
  font-family: var(--font-kid-head);
  letter-spacing: 0;
  color: var(--kit-ink);
}
.lesson-kit.lesson-kit .lesson-section h3 { font-size: 1.3rem; font-weight: 700; margin: 28px 0 10px; }
.lesson-kit.lesson-kit .lesson-section h4 { font-size: 1.12rem; font-weight: 700; margin: 20px 0 8px; color: var(--kit-dark); }
.lesson-kit.lesson-kit .lesson-section h3:first-child { margin-top: 0; }

/* Body copy: Scratch's 17px and generous leading. */
.lesson-kit.lesson-kit .lesson-section p,
.lesson-kit.lesson-kit .lesson-section li,
.lesson-kit.lesson-kit .lesson-section dd,
.lesson-kit.lesson-kit .callout {
  font-size: 1.06rem;
  line-height: 1.7;
}
.lesson-kit.lesson-kit .lesson-section li { margin-bottom: 8px; }
.lesson-kit.lesson-kit details summary { font-family: var(--font-kid-head); font-size: 1.05rem; }

/* Lists: /styles.css removes markers site-wide; a child following steps needs
   them back. Only plain lists inside a section — styled lists keep theirs. */
.lesson-kit.lesson-kit .lesson-section ul:not([class]) { list-style: disc; padding-left: 24px; }
.lesson-kit.lesson-kit .lesson-section ol:not([class]) { list-style: decimal; padding-left: 26px; }
.lesson-kit.lesson-kit .lesson-section ul:not([class]) > li,
.lesson-kit.lesson-kit .lesson-section ol:not([class]) > li { display: list-item; }
.lesson-kit.lesson-kit .lesson-section :is(ul, ol):not([class]) > li::marker { color: var(--lvl, var(--kit)); font-weight: 800; }

/* ---------- challenge boxes — Scratch's ladder, by section id ---------- */

.lesson-kit.lesson-kit #challenge-1 { --chal: #D97706; --chal-ink: #7C3E06; --chal-soft: #FFF8EC; --chal-edge: #FBBF24; }
.lesson-kit.lesson-kit #challenge-2 { --chal: #EA580C; --chal-ink: #7C2D12; --chal-soft: #FFF4EC; --chal-edge: #FB923C; }
.lesson-kit.lesson-kit #challenge-3 { --chal: #DC2626; --chal-ink: #7F1D1D; --chal-soft: #FFF2F2; --chal-edge: #F87171; }
.lesson-kit.lesson-kit :is(#extra, #extra-challenge, #mission) {
  --chal: #7C3AED; --chal-ink: #4C1D95; --chal-soft: #F7F3FF; --chal-edge: #A78BFA;
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) {
  background: var(--chal-soft);
  border-color: var(--chal-edge);
  padding-left: 36px;
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission)::before {
  width: 8px;
  background: var(--chal);
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) :is(.lesson-section__title, h2, h3, h4) {
  color: var(--chal-ink);
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) :is(.lesson-section__head, h2) {
  border-bottom-color: var(--chal-edge);
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) .lesson-section__num {
  background: var(--chal);
  color: #fff;
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) :is(.lesson-section__time, h2 .time) {
  background: #fff;
  color: var(--chal-ink);
  border: 2px solid var(--chal-edge);
}
.lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) li::marker { color: var(--chal); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .lesson-kit.lesson-kit .lesson-section { padding: 22px 18px 20px 22px; }
  .lesson-kit.lesson-kit .lesson-hero__inner { padding: 32px 20px 28px; }
  /* Badge and minutes share the first row; the title gets a row of its own
     instead of being squeezed between them into one word per line. */
  .lesson-kit.lesson-kit .lesson-section__head { flex-wrap: wrap; row-gap: 8px; }
  .lesson-kit.lesson-kit .lesson-section__title { flex: 1 0 100%; order: 3; font-size: 1.5rem; }
  .lesson-kit.lesson-kit .lesson-section > h2 { font-size: 1.5rem; }
  .lesson-kit.lesson-kit :is(#challenge-1, #challenge-2, #challenge-3, #extra, #extra-challenge, #mission) { padding-left: 24px; }
}
