/* ---------- Page background grid ---------- */
body {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 28px 28px;
}

.card {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Home ---------- */
.home { max-width: 1040px; margin: 0 auto; padding: 40px 20px 80px; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: center; margin-bottom: 40px; }
.hero-kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }
.hero h1 { font-size: clamp(32px, 5vw, 50px); letter-spacing: -0.035em; margin-bottom: 14px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 17px; color: var(--ink-2); max-width: 56ch; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-demo { padding: 16px; }
.hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero-stats .metric { min-width: 0; padding: 6px 8px; }
.hero-demo .viz-label { font-size: 12.5px; min-height: 30px; padding: 4px 10px; line-height: 20px; }

.week { position: relative; padding-left: 26px; margin-bottom: 30px; }
.week::before { content: ""; position: absolute; left: 5px; top: 22px; bottom: -14px; width: 2px; background: var(--line-soft); }
.week-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px -26px; }
.week-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink-3); flex: none; }
.week-dot.is-started { background: var(--accent); border-color: var(--accent); }
.week-label { font-family: var(--font-mono); font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.week-theme { font-size: 13px; color: var(--ink-3); min-width: 0; }
.week-count { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); white-space: nowrap; }
@media (max-width: 640px) { .week-theme { display: none; } }
.week-list { display: grid; gap: 12px; }

/* ---------- Lesson ---------- */
.lesson {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 400px;
  gap: var(--gap);
  padding: var(--gap);
  height: calc(100vh - var(--topbar-h));
  height: calc(100dvh - var(--topbar-h));
}
.lesson > * { min-height: 0; }
.course { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.lesson-main { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.lesson-side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.lesson-head { padding: 2px 4px 0; }
.crumb { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.crumb a { text-decoration: none; }
.crumb a:hover { color: var(--ink); text-decoration: underline; }
.lesson-title-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lesson-title-row h1 { font-size: 28px; letter-spacing: -0.03em; }
.lesson-chips { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.lesson-summary { color: var(--ink-2); font-size: 14px; margin: 4px 0 0; }

.stage { flex: 1; min-height: 340px; display: flex; flex-direction: column; overflow: hidden; }
.lesson-side .narration { flex: 1; min-height: 0; }

.drawer-scrim { display: none; }

@media (max-width: 1280px) {
  .lesson { grid-template-columns: minmax(0, 1fr) 380px; }
  .course {
    position: fixed; z-index: 40; top: var(--topbar-h); left: 0; bottom: 0; width: 290px;
    padding: 16px; background: var(--bg); border-right: 1.5px solid var(--line);
    transform: translateX(-102%); transition: transform .25s ease;
  }
  .course.is-open { transform: none; box-shadow: var(--shadow-soft); }
  .drawer-scrim.is-open { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; z-index: 35; background: rgba(0,0,0,.25); }
}

@media (max-width: 900px) {
  .lesson { grid-template-columns: minmax(0, 1fr); height: auto; padding: 12px 16px 40px; }
  .stage { min-height: 380px; flex: none; }
  .stage .stage-canvas { min-height: 400px; }
  .lesson-side .narration { flex: none; }
  .lesson-chips { margin-left: 0; }
  .hero { grid-template-columns: 1fr; }
  .lesson-title-row h1 { font-size: 23px; }
}
