/* ============================================================
   AQA GCSE Computer Science (8525) — course + lesson styles
   Linked by app/gcse-cs/layout.tsx (so both the syllabus landing and
   every lesson get it). Mirrors the structure of the sibling courses'
   lesson CSS (.lesson-header, .lesson-section, .task, .callout, table.ref,
   details, .lesson-foot) so the lesson-builder skill produces lessons with
   the same chrome. Adds the CS-specific surfaces: pre.pseudocode, the
   key-term/tech-term/key-point/beyond-spec/exam-tip callouts, the exam-q +
   markscheme reveal, trace/truth tables, and the spec-ref badge.
   AQA pseudo-code is plain styled text (no renderer); Python uses <PyCode>
   (the code-block--py styles are copied from the Python course).
   ============================================================ */

:root {
  --cs:       #6366F1;   /* indigo — course brand */
  --cs-dark:  #4338CA;
  --cs-soft:  #EEF0FE;
  --cs-ink:   #1E1B4B;
}

.lesson {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: #FBFBFE;
  color: var(--ink, #0F172A);
  margin: 0;
  line-height: 1.55;
}

/* Per-unit accent (Unit N = spec 3.N) */
.lesson--unit-1 { --lvl: #6366F1; --lvl-soft: #EEF0FE; }  /* 3.1 Algorithms      */
.lesson--unit-2 { --lvl: #2563EB; --lvl-soft: #E7F0FE; }  /* 3.2 Programming     */
.lesson--unit-3 { --lvl: #0891B2; --lvl-soft: #E2F6FB; }  /* 3.3 Data rep        */
.lesson--unit-4 { --lvl: #0D9488; --lvl-soft: #E2F7F4; }  /* 3.4 Computer systems*/
.lesson--unit-5 { --lvl: #16A34A; --lvl-soft: #E6F8ED; }  /* 3.5 Networks        */
.lesson--unit-6 { --lvl: #D97706; --lvl-soft: #FEF1E0; }  /* 3.6 Cyber security  */
.lesson--unit-7 { --lvl: #EA580C; --lvl-soft: #FEEDE2; }  /* 3.7 Databases/SQL   */
.lesson--unit-8 { --lvl: #E11D48; --lvl-soft: #FDE7ED; }  /* 3.8 Impacts         */

/* ---------- Header ---------- */
.lesson-header {
  background: linear-gradient(135deg, var(--lvl, var(--cs)) 0%, var(--cs-dark) 100%);
  color: #fff;
  padding: 44px 32px 38px;
  border-bottom: 6px solid rgba(255,255,255,0.25);
}
.lesson-header .lesson-crumbs {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255,255,255,0.85); margin: 0 0 14px;
}
.lesson-header .lesson-crumbs a { color: rgba(255,255,255,0.9); text-decoration: none; }
.lesson-header .lesson-crumbs a:hover { color: #fff; text-decoration: underline; }
.lesson-header .lesson-crumbs .sep { opacity: 0.55; }
.lesson-header .lesson-crumbs .here { color: #fff; font-weight: 600; }
.lesson-header .lesson-tag {
  display: inline-block; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(255,255,255,0.22); padding: 5px 12px; border-radius: 999px;
  margin-bottom: 14px; backdrop-filter: blur(4px);
}
.lesson-header h1 {
  font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 800;
  letter-spacing: -0.02em; margin: 0 0 6px; max-width: 900px;
}
.lesson-header .lesson-sub { font-size: 0.95rem; opacity: 0.9; margin: 0; }

/* The AQA spec reference badge */
.spec-ref {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.78rem; font-weight: 700;
  background: var(--cs-soft); color: var(--cs-dark);
  border: 1px solid #D7DAFB; border-radius: 8px;
  padding: 4px 10px; margin: 0 0 4px;
}

/* ---------- Main column ---------- */
.lesson main { max-width: 880px; margin: 0 auto; padding: 30px 24px 80px; }

/* ---------- Sections ---------- */
.lesson-section {
  background: #fff; border: 1px solid #E6E7FB; border-radius: 16px;
  padding: 26px 28px 22px; margin-bottom: 22px; position: relative; overflow: hidden;
}
.lesson-section::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--lvl, var(--cs));
}
.lesson-section h2 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.01em;
  margin: 0 0 14px; color: var(--cs-ink);
}
.lesson-section h2 .time {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.7rem; font-weight: 600;
  background: var(--cs-soft); color: var(--cs-dark);
  padding: 3px 10px; border-radius: 999px; margin-left: auto;
}
.lesson-section h3 { font-size: 1.02rem; font-weight: 700; margin: 18px 0 8px; color: var(--cs-ink); }
.lesson-section p, .lesson-section li, .lesson-section dd { font-size: 0.95rem; }
.lesson-section ul, .lesson-section ol { padding-left: 22px; }
.lesson-section li { margin-bottom: 6px; }

/* ---------- AQA pseudo-code block ---------- */
.pseudocode-label, .code-block-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: #6B7280; margin: 14px 0 4px;
}
pre.pseudocode {
  font-family: 'JetBrains Mono', 'Courier New', ui-monospace, monospace;
  font-size: 0.88rem; line-height: 1.6;
  background: #FCFCFF; color: #1E1B4B;
  border: 1px solid #D7DAFB; border-left: 4px solid var(--cs);
  border-radius: 10px; padding: 14px 18px; overflow-x: auto;
  margin: 4px 0 12px; white-space: pre; tab-size: 2;
}

/* ---------- Python code blocks (PyCode) — copied from the Python course ---------- */
pre.code-block {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.86rem;
  background: #0b1020; color: #d4d4d4; border-radius: 10px;
  padding: 14px 18px; overflow-x: auto; line-height: 1.6; margin: 4px 0 12px;
}
pre.code-block .out { color: #94A3B8; }
pre.code-block--py { background: #000000; color: #d4d4d4; border: 1px solid #2d2d2d; }
pre.code-block--py .py-kw      { color: #569cd6; }
pre.code-block--py .py-builtin { color: #4ec9b0; }
pre.code-block--py .py-fn      { color: #dcdcaa; }
pre.code-block--py .py-name    { color: #9cdcfe; }
pre.code-block--py .py-string  { color: #ce9178; }
pre.code-block--py .py-number  { color: #b5cea8; }
pre.code-block--py .py-comment { color: #6a9955; font-style: italic; }
pre.code-block--py .py-op      { color: #d4d4d4; }
pre.code-block--output { background: #111827; color: #FBBF24; border-left: 4px solid #F59E0B; }

/* ---------- Inline code ---------- */
.lesson code:not(pre code) {
  background: var(--cs-soft); padding: 2px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.85em; color: var(--cs-ink);
}

/* ---------- Callouts (mirror the textbook learning features) ---------- */
.keyterm, .techterm, .keypoint, .beyond-spec, .exam-tip, .callout {
  border-radius: 10px; padding: 12px 16px; margin: 14px 0; font-size: 0.92rem;
}
.keyterm   { background: #ECFDF3; border-left: 4px solid #16A34A; }      /* Important words (green) */
.keyterm strong   { color: #166534; }
.techterm  { background: #EFF6FF; border-left: 4px solid #2563EB; }      /* Tech terms (blue)       */
.techterm strong  { color: #1E40AF; }
.keypoint  { background: var(--cs-soft); border-left: 4px solid var(--cs); }
.keypoint strong  { color: var(--cs-dark); }
.beyond-spec { background: #F8FAFC; border-left: 4px solid #94A3B8; color: #475569; }
.beyond-spec strong { color: #334155; }
.exam-tip  { background: #FEF3C7; border-left: 4px solid #F59E0B; }
.exam-tip strong  { color: #92400E; }
.callout   { background: #FEF3C7; border-left: 4px solid #F59E0B; }
.callout strong { color: #92400E; }
.callout ul, .keyterm ul, .keypoint ul { margin: 6px 0 0; }

/* ---------- Exam Practice questions ---------- */
.exam-q {
  border: 1px solid #E6E7FB; border-radius: 12px;
  padding: 14px 16px 12px; margin: 14px 0; background: #FCFCFF;
}
.exam-q .exam-q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.exam-q .cmd {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  background: var(--cs); color: #fff; padding: 3px 9px; border-radius: 6px;
}
.exam-q .marks {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.78rem; font-weight: 700;
  color: var(--cs-dark); margin-left: auto;
}
.exam-q p { margin: 0 0 6px; }
details.markscheme {
  background: #ECFDF3; border: 1px solid #BBF7D0; border-radius: 8px;
  padding: 8px 14px; margin-top: 8px;
}
details.markscheme summary { cursor: pointer; font-weight: 700; color: #166534; font-size: 0.9rem; }
details.markscheme[open] summary { margin-bottom: 6px; }
details.markscheme ul { margin: 4px 0 0; padding-left: 20px; }
details.markscheme li { font-size: 0.9rem; }

/* ---------- Tables: reference / trace / truth ---------- */
table.ref, table.trace-table, table.truth-table {
  width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.9rem;
}
table.ref th, table.ref td,
table.trace-table th, table.trace-table td,
table.truth-table th, table.truth-table td {
  text-align: left; padding: 8px 12px; border: 1px solid #E2E4FA; vertical-align: top;
}
table.ref thead th, table.trace-table thead th, table.truth-table thead th {
  background: var(--cs-soft); color: var(--cs-dark); font-weight: 700; letter-spacing: 0.02em;
}
table.trace-table td, table.truth-table td {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.85rem; text-align: center;
}
table.trace-table th:last-child, table.trace-table td:last-child { text-align: left; }

/* ---------- Diagrams (flowcharts, gates, architecture) ---------- */
figure.cs-diagram {
  background: #fff; border: 1px solid #E6E7FB; border-radius: 14px;
  padding: 16px; margin: 14px 0; text-align: center;
}
figure.cs-diagram svg { max-width: 100%; height: auto; }
figure.cs-diagram figcaption { margin-top: 10px; font-size: 0.9rem; color: #64748B; text-align: left; }

/* ---------- Try-It tasks ---------- */
.task { border: 1px solid #E6E7FB; border-radius: 12px; padding: 14px 18px; margin: 12px 0; background: #FCFCFF; }
.task-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px; margin-bottom: 8px;
}
.task--easy    .task-tag { background: #DCFCE7; color: #166534; }
.task--medium  .task-tag { background: #FEF3C7; color: #92400E; }
.task--stretch .task-tag { background: #FEE2E2; color: #991B1B; }

/* ---------- Key-terms glossary card ---------- */
dl.key-terms { background: var(--cs-soft); border-radius: 12px; padding: 16px 20px; margin: 14px 0 0; }
dl.key-terms dt { font-weight: 700; color: var(--cs-dark); margin-top: 8px; }
dl.key-terms dt:first-child { margin-top: 0; }
dl.key-terms dd { margin: 2px 0 0 0; color: var(--ink, #0F172A); }

/* ---------- Reveal blocks ---------- */
.lesson details:not(.markscheme) {
  background: var(--cs-soft); border-radius: 10px; padding: 10px 16px; margin: 12px 0;
}
.lesson details:not(.markscheme) summary { cursor: pointer; font-weight: 700; color: var(--cs-dark); }
.lesson details:not(.markscheme)[open] summary { margin-bottom: 8px; }

/* ---------- Footer + prev/next nav ---------- */
.lesson .site-footer { text-align: center; padding: 24px; border-top: 1px solid #E6E7FB; background: #fff; }
.lesson .site-footer .muted { color: #94A3B8; font-size: 0.88rem; }
.lesson-foot { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin: 36px 0 8px; }
.lesson-foot__btn {
  flex: 1; min-width: 220px; padding: 16px 18px; border: 1px solid #E2E8F0; background: #fff;
  border-radius: 14px; text-decoration: none; color: var(--ink, #0F172A); display: block;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.lesson-foot__btn:hover {
  transform: translateY(-2px); border-color: var(--cs);
  box-shadow: 0 10px 24px -16px rgba(99,102,241,0.5); text-decoration: none;
}
.lesson-foot__btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.lesson-foot__dir {
  display: block; font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  letter-spacing: 0.1em; text-transform: uppercase; color: #64748B; margin-bottom: 4px;
}
.lesson-foot__title { display: block; font-weight: 700; font-size: 1rem; color: var(--ink, #0F172A); }
.lesson-foot__btn--next { text-align: right; }
@media (max-width: 720px) { .lesson-foot { flex-direction: column; } .lesson-foot__btn--next { text-align: left; } }

/* The syllabus landing (app/gcse-cs/page.tsx) uses the Hub's shared course-page
   styles (.course-page, .hero/.hero--gcse, .level, .lesson-card) from
   public/styles.css — the same pattern as the Scratch and EV3 landings. */
