/* =========================================================================
   Godot Game Development — lesson-page chrome
   Loaded by each level's layout.tsx. Accent colour is driven by a per-level
   class on the page root (.level--gd1 … .level--gd4, plus optional-module
   classes .level--gd-gmp/gfx/gai/gsp) so a single stylesheet styles every
   level. Mirrors public/webapp/webapp_styles.css.
   ========================================================================= */

.lesson-page {
  --accent:       #478CBF;   /* L1 Godot blue — overridden below */
  --accent-deep:  #356C94;
  --accent-soft:  #EAF3F9;
  --accent-edge:  #B9D5E7;
  --ink:          #0F172A;
  --muted:        #64748B;
  --border:       #E2E8F0;

  color: var(--ink);
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Core level accents */
.level--gd1 { --accent: #478CBF; --accent-deep: #356C94; --accent-soft: #EAF3F9; --accent-edge: #B9D5E7; }
.level--gd2 { --accent: #7C3AED; --accent-deep: #6D28D9; --accent-soft: #F5F3FF; --accent-edge: #DDD6FE; }
.level--gd3 { --accent: #FB923C; --accent-deep: #EA7C1F; --accent-soft: #FFF7ED; --accent-edge: #FED7AA; }
.level--gd4 { --accent: #F43F5E; --accent-deep: #E11D48; --accent-soft: #FFF1F3; --accent-edge: #FECDD3; }

/* Optional-module accents */
.level--gd-gmp { --accent: #0EA5E9; --accent-deep: #0284C7; --accent-soft: #F0F9FF; --accent-edge: #BAE6FD; }
.level--gd-gfx { --accent: #D946EF; --accent-deep: #C026D3; --accent-soft: #FDF4FF; --accent-edge: #F5D0FE; }
.level--gd-gai { --accent: #F59E0B; --accent-deep: #D97706; --accent-soft: #FFFBEB; --accent-edge: #FDE68A; }
.level--gd-gsp { --accent: #14B8A6; --accent-deep: #0D9488; --accent-soft: #F0FDFA; --accent-edge: #99F6E4; }

/* ---------- hero ---------- */

.lesson-hero {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
  padding: 32px 24px 36px;
}
.lesson-hero__inner { max-width: 820px; margin: 0 auto; }
.lesson-hero__crumbs { font-size: 0.85rem; color: var(--muted); margin: 0 0 16px; }
.lesson-hero__crumbs a { color: var(--accent-deep); text-decoration: none; }
.lesson-hero__crumbs a:hover { text-decoration: underline; }
.lesson-hero__crumbs .sep { margin: 0 8px; color: var(--accent-edge); }
.lesson-hero__crumbs .here { color: var(--ink); font-weight: 600; }

.lesson-hero__num {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-deep);
  background: #fff;
  border: 1px solid var(--accent-edge);
  border-radius: 999px;
  padding: 4px 12px;
}
.lesson-hero__title {
  margin: 12px 0 8px;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.lesson-hero__sub {
  margin: 0 0 16px;
  font-size: 1.05rem;
  color: #334155;
  max-width: 620px;
  line-height: 1.55;
}
.lesson-hero__meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.lesson-hero__meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
}

/* ---------- body shell ---------- */

.lesson-body {
  flex: 1;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: grid;
  gap: 28px;
}

.lesson-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.lesson-section__head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 22px;
  background: var(--accent-soft);
  border-bottom: 1px solid var(--accent-edge);
}
.lesson-section__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-weight: 800;
  font-size: 0.85rem;
  color: #fff;
  background: var(--accent-deep);
  border-radius: 50%;
  flex-shrink: 0;
}
.lesson-section__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  flex: 1;
  min-width: 0;
}
.lesson-section__time {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-deep);
  background: #fff;
  border: 1px solid var(--accent-edge);
  border-radius: 6px;
  padding: 3px 10px;
  white-space: nowrap;
}

.lesson-section__body { padding: 22px; line-height: 1.65; color: #1E293B; }
.lesson-section__body > * + * { margin-top: 14px; }
.lesson-section__body p { margin: 0; }
.lesson-section__body h3 {
  margin: 22px 0 10px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
}
.lesson-section__body h4 {
  margin: 14px 0 6px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}
.lesson-section__body ul,
.lesson-section__body ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.lesson-section__body li { line-height: 1.55; }
.lesson-section__body strong { color: var(--ink); }
.lesson-section__body a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lesson-section__body code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: #F1F5F9;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.lesson-section__body kbd {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.82em;
  background: #fff;
  border: 1px solid #94A3B8;
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 7px;
  color: #334155;
}
.lesson-section__body details {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
}
.lesson-section__body details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent-deep);
}
.lesson-section__body details[open] > summary { margin-bottom: 10px; }

.lesson-section--homework .lesson-section__head {
  background: linear-gradient(135deg, var(--accent-soft) 0%, #fff 100%);
}

/* ---------- code blocks ---------- */
/* GDScript / GLSL / output / plain. No tokenizer yet — the --lang modifiers
   are style anchors for when one lands. GDScript uses tabs, so preserve them. */

.code-block {
  background: #0F172A;
  color: #E2E8F0;
  border-radius: 10px;
  padding: 14px 18px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
  -moz-tab-size: 2;
}
.code-block code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}
.code-block--plain { background: #1E293B; color: #CBD5E1; }     /* buggy / no-cue code */
.code-block--output { background: #0B1020; color: #86EFAC; }    /* console / logs / results */

/* ---------- Godot custom widgets ---------- */

/* Two-up comparison card (e.g. CharacterBody2D vs RigidBody2D) */
.godot-twocol {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.godot-twocol__item {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
}
.godot-twocol__item h4 { margin: 0 0 6px; color: var(--accent-deep); }
.godot-twocol__item p { margin: 6px 0 0; }
@media (max-width: 620px) { .godot-twocol { grid-template-columns: 1fr; } }

/* Numbered editor steps */
.godot-steps {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px 16px 38px !important;
}
.godot-steps li::marker { color: var(--accent-deep); font-weight: 800; }

/* Scene-tree display — indented node hierarchy (whitespace preserved) */
.godot-tree {
  background: #0F172A;
  color: #E2E8F0;
  border-radius: 10px;
  padding: 14px 18px;
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.godot-tree code { background: transparent; border: 0; padding: 0; font-size: inherit; color: inherit; }

/* Inspector property rows — label (left) / value (right) */
.godot-inspector {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.godot-inspector__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}
.godot-inspector__row:first-child { border-top: 0; }
.godot-inspector__row > span:first-child { color: var(--muted); font-weight: 600; }
.godot-inspector__row > span:last-child {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  color: var(--ink);
}

/* Input Map actions / key bindings */
.godot-keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none !important;
  padding-left: 0 !important;
}
.godot-keys > li {
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  color: var(--accent-deep);
  border-radius: 8px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Try-It-Yourself task cards */
.godot-tasks {
  display: grid;
  gap: 14px;
  list-style: none !important;
  padding-left: 0 !important;
}
.godot-tasks > li {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 14px 16px;
}
.godot-tasks > li h4 { margin: 0 0 6px; color: var(--accent-deep); }
.godot-tasks > li ul { padding-left: 22px; }

/* Mini-Challenge answer reveal */
.godot-answer {
  background: var(--accent-soft) !important;
  border-color: var(--accent-edge) !important;
}

/* Recap list */
.godot-recap {
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: 10px;
  padding: 14px 20px 14px 38px !important;
  display: grid;
  gap: 8px;
}
.godot-recap li::marker { color: var(--accent-deep); font-weight: 800; }

/* Figure — inline SVG sketch / editor or game screenshot */
.godot-figure {
  background: #F8FAFC;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  margin: 0;
}
.godot-figure svg,
.godot-figure img { max-width: 100%; height: auto; border-radius: 6px; }
.godot-figure figcaption { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }

/* Prev / next lesson nav */
.lesson-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  font-weight: 600;
}
.lesson-nav__prev { color: var(--muted); }
.lesson-nav__next {
  color: var(--accent-deep);
  text-decoration: none;
  padding: 8px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: 8px;
}
.lesson-nav__next:hover { background: var(--accent-edge); }

/* mobile tweaks */
@media (max-width: 720px) {
  .lesson-hero { padding: 28px 18px 30px; }
  .lesson-hero__title { font-size: 1.85rem; }
  .lesson-body { padding: 24px 18px 56px; }
  .lesson-section__head { padding: 14px 16px; }
  .lesson-section__body { padding: 18px; }
}
