/* ══════════════════════════════════════════════════════
   Scratch Student Pages — BBC Bitesize-inspired styles
   Shared across week1.html – week6.html
══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bbc-navy:    #1E1248;
  --bbc-purple:  #3F2D82;
  --subject:     #007BBD;
  --subject-lt:  #E8F4FB;
  --yellow:      #FFD230;
  --yellow-lt:   #FFFBDE;
  --yellow-bd:   #E6B800;
  --green:       #0D7F4A;
  --green-lt:    #E6F4EC;
  --green-bd:    #9AE6B4;
  --orange:      #C95D00;
  --orange-lt:   #FFF0E6;
  --orange-bd:   #F7A832;
  --red:         #B91C1C;
  --red-lt:      #FEF2F2;
  --red-bd:      #FECACA;
  --white:       #FFFFFF;
  --offwhite:    #F6F6F6;
  --border:      #DDDDDD;
  --text:        #141414;
  --text-mid:    #404040;
  --text-muted:  #636363;
  --radius:      4px;
  --radius-md:   8px;
  --radius-lg:   12px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'BBC Reith', 'Helvetica Neue', Arial, Helvetica, sans-serif;
  background: var(--offwhite);
  color: var(--text);
  font-size: 17px;
  line-height: 1.65;
}

a { color: var(--subject); }
a:hover { color: var(--bbc-purple); }
code {
  font-family: 'Courier New', Consolas, monospace;
  font-size: 0.9em;
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.35em;
}

/* ── Top nav ────────────────────────────────────────── */
.top-nav {
  background: var(--bbc-navy);
  padding: 0 1.25rem;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: sticky;
  top: 0;
  z-index: 200;
}
.nav-bitesize {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  opacity: 0.9;
}
.nav-bitesize:hover { color: var(--yellow); opacity: 1; }
.nav-spacer { flex: 1; }
.nav-links { display: flex; gap: 1rem; align-items: center; }
.nav-links a {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; }

/* ── Breadcrumb ─────────────────────────────────────── */
.breadcrumb-bar {
  background: var(--bbc-purple);
  padding: 0 1.25rem;
}
.breadcrumb {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 40px;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 0;
}
.breadcrumb a, .breadcrumb span {
  color: rgba(255,255,255,0.72);
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
}
.breadcrumb a:hover { color: #fff; text-decoration: underline; }
.bc-sep { color: rgba(255,255,255,0.38); margin: 0 0.45rem; }
.bc-current { color: #fff; font-weight: 700; }

/* ── Lesson header band ─────────────────────────────── */
.lesson-header {
  color: #fff;
  padding: 1.75rem 1.25rem 1.5rem;
}
.lesson-header-inner { max-width: 900px; margin: 0 auto; }
.lesson-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 2px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.22rem 0.65rem;
  margin-bottom: 0.75rem;
}
.lesson-header h1 {
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}
.lesson-header .lesson-intro {
  font-size: 1rem;
  opacity: 0.92;
  max-width: 600px;
  line-height: 1.55;
}

/* ── Step progress bar ──────────────────────────────── */
.step-progress-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: sticky;
  top: 52px;
  z-index: 100;
}
.step-pills {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 0.25rem;
  height: 48px;
}
.step-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--white);
  color: var(--text-muted);
  text-decoration: none;
  padding: 0 0.7rem;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  cursor: pointer;
}
.step-pill:hover { border-color: var(--subject); color: var(--subject); }
.step-pill.done   { background: var(--green);   border-color: var(--green);   color: #fff; }
.step-pill.active {
  background: var(--subject);
  border-color: var(--subject);
  color: #fff;
  transform: scale(1.15);
  box-shadow: 0 0 0 3px rgba(0,123,189,0.22);
  z-index: 1;
  position: relative;
}
.step-pill.checkpoint { border-style: dashed; }
.step-progress-sep { width: 20px; height: 2px; background: var(--border); flex-shrink: 0; }

/* ── Page body ──────────────────────────────────────── */
.page-body {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* ── Step cards ─────────────────────────────────────── */
.step-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  scroll-margin-top: 110px;
}
.step-card-top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.step-title-wrap { flex: 1; }
.step-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.step-subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}
.step-tick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.step-tick input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
  cursor: pointer;
}

.step-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* "What to do" action list */
.action-list {
  padding-left: 1.5rem;
  font-size: 0.95rem;
  color: var(--text-mid);
}
.action-list li { margin-bottom: 0.55rem; }
.action-list li::marker { color: var(--subject); font-weight: 700; }
.action-list strong { color: var(--text); }

/* ── What you should see (teal left border) ─────────── */
.should-see {
  border-left: 4px solid var(--subject);
  background: var(--subject-lt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
}
.should-see .ss-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--subject);
  margin-bottom: 0.35rem;
}
.should-see p, .should-see ul { color: var(--text-mid); }
.should-see ul { padding-left: 1.25rem; margin-top: 0.25rem; }
.should-see li { margin-bottom: 0.2rem; }

/* ── Watch out (yellow) ─────────────────────────────── */
.watch-out {
  border-left: 4px solid var(--yellow-bd);
  background: var(--yellow-lt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
}
.watch-out .wo-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7A5200;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.watch-out p, .watch-out ul { color: var(--text-mid); }
.watch-out ul { padding-left: 1.25rem; margin-top: 0.25rem; }
.watch-out li { margin-bottom: 0.3rem; }

/* ── Checkpoint card ────────────────────────────────── */
.checkpoint-card {
  background: var(--white);
  border: 2px solid var(--green-bd);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.25rem;
  scroll-margin-top: 110px;
}
.cp-head {
  background: var(--green);
  color: #fff;
  padding: 0.7rem 1.25rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.cp-body { padding: 1.1rem 1.25rem; }
.cp-body > p { font-size: 0.9rem; color: var(--text-mid); margin-bottom: 0.75rem; }
.checklist {
  list-style: none;
  padding: 0;
  margin-bottom: 1rem;
}
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: 0.9rem;
  color: var(--text-mid);
  margin-bottom: 0.4rem;
}
.checklist li::before {
  content: '✓';
  color: var(--green);
  font-weight: 800;
  margin-top: 0.1rem;
  flex-shrink: 0;
}

/* ── Recovery section ───────────────────────────────── */
.recovery {
  border-left: 4px solid var(--orange-bd);
  background: var(--orange-lt);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 0.85rem 1rem;
  font-size: 0.88rem;
  margin-top: 0.85rem;
}
.recovery .rec-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--orange);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.recovery p, .recovery ol, .recovery ul { color: var(--text-mid); }
.recovery ol, .recovery ul { padding-left: 1.2rem; margin-top: 0.3rem; }
.recovery li { margin-bottom: 0.3rem; }

/* ── Completion card ────────────────────────────────── */
.completion-card {
  background: linear-gradient(135deg, var(--green) 0%, #1EA870 100%);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 1.75rem 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
}
.completion-card .cc-icon { font-size: 2.5rem; margin-bottom: 0.5rem; display: block; }
.completion-card h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 0.5rem; }
.completion-card p { opacity: 0.92; font-size: 0.95rem; max-width: 500px; margin: 0 auto 1.25rem; }

/* ── Next lesson nav ────────────────────────────────── */
.lesson-nav-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.lesson-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.lesson-nav-btn.prev {
  background: var(--white);
  border: 2px solid var(--border);
  color: var(--text-mid);
}
.lesson-nav-btn.prev:hover { border-color: var(--subject); color: var(--subject); }
.lesson-nav-btn.next {
  background: var(--subject);
  color: #fff;
  border: 2px solid var(--subject);
}
.lesson-nav-btn.next:hover { background: var(--bbc-purple); border-color: var(--bbc-purple); }

/* ── Scratch block chips ────────────────────────────── */
.sb {
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  padding: 0.18rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #fff;
  white-space: nowrap;
  vertical-align: middle;
}
.sb.motion  { background: #4C97FF; }
.sb.looks   { background: #9966FF; }
.sb.sound   { background: #CF63CF; }
.sb.events  { background: #FFAB19; color: #333; }
.sb.control { background: #FFAB19; color: #333; }
.sb.sensing { background: #5CB1D6; }
.sb.ops     { background: #59C059; }
.sb.vars    { background: #FF8C1A; }
.sb.lists   { background: #FF661A; }

/* ── Area label (for Scratch UI regions) ────────────── */
.area-label {
  display: inline-block;
  font-weight: 700;
  font-size: 0.88em;
  padding: 0.1em 0.45em;
  border-radius: 3px;
  border: 1.5px solid currentColor;
}
.area-stage    { color: #4C97FF; }
.area-sprites  { color: #59C059; }
.area-palette  { color: #9966FF; }
.area-scripts  { color: #FF8C1A; }
.area-costumes { color: #CF63CF; }

/* ── Inline block palette guide ─────────────────────── */
.block-guide {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text-mid);
  margin: 0.5rem 0;
}
.block-guide-item { display: flex; align-items: center; gap: 0.45rem; }
.color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Scratch UI diagram (text-based) ────────────────── */
.scratch-ui-diagram {
  background: #1E1E2E;
  border-radius: var(--radius-md);
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 120px;
  grid-template-rows: auto auto;
  gap: 4px;
  font-size: 0.75rem;
  color: #CBD5E1;
  max-width: 440px;
}
.sui-stage  { background: #2563EB22; border: 1px dashed #4C97FF; padding: 0.5rem; border-radius: 4px; text-align: center; color: #93C5FD; grid-row: 1; grid-column: 1; min-height: 80px; display: grid; place-items: center; }
.sui-palette { background: #9966FF22; border: 1px dashed #9966FF; padding: 0.5rem; border-radius: 4px; text-align: center; color: #C4B5FD; grid-row: 1/3; grid-column: 2; }
.sui-scripts { background: #FF8C1A22; border: 1px dashed #FF8C1A; padding: 0.5rem; border-radius: 4px; text-align: center; color: #FED7AA; grid-row: 2; grid-column: 1; min-height: 60px; display: grid; place-items: center; }

/* ── Footer ─────────────────────────────────────────── */
footer {
  background: var(--bbc-navy);
  color: rgba(255,255,255,0.55);
  text-align: center;
  padding: 1.5rem 1.25rem;
  font-size: 0.8rem;
  margin-top: 1rem;
}
footer strong { color: #fff; }

/* ── Print ──────────────────────────────────────────── */
@media print {
  .top-nav, .breadcrumb-bar, .step-progress-bar { display: none; }
  .step-card, .checkpoint-card { break-inside: avoid; }
}

/* ── Step card "done" state ─────────────────────────── */
.step-card.is-done .step-num { opacity: 0.55; }
.step-card.is-done .step-title { text-decoration: line-through; color: var(--text-muted); }
