/* Theme tokens consumed by the existing classroom and diagrams. */
:root {
  --page: #eaf0f7;
  --paper: #f6f9fd;
  --paper-raised: #fff;
  --paper-sunk: #e9eff7;
  --paper-sunk-strong: #dbe5f0;
  --line: #d0dce8;
  --line-soft: #e0e8f1;
  --line-strong: #aebfd2;
  --ink: #182c43;
  --ink-2: #344b64;
  --ink-3: #536982;
  --ink-4: #677c92;
  --stage: #f2f7fd;
  --grid-line: #c8d7e7;
  --coral: #10766d;
  --coral-deep: #095e56;
  --coral-300: #8fd8ca;
  --coral-200: #b5e7db;
  --coral-100: #d2f1e9;
  --coral-50: #e7f8f4;
  --coral-ink: #084f49;
  --code-bg: #172840;
  --code-kw: #9eead8;
  --code-str: #f1ce89;
  --code-type: #b8c9fb;
  --shadow-coral: 0 1px 0 #ffffff38 inset, 0 4px 10px -4px #095e5673;
  --grain: .16;
}

:root[data-theme='dark'] {
  --page: #0b1422;
  --paper: #111e2f;
  --paper-raised: #192a3e;
  --paper-sunk: #1b2d45;
  --paper-sunk-strong: #223750;
  --line: #294058;
  --line-soft: #21354b;
  --line-strong: #45617e;
  --ink: #edf5ff;
  --ink-2: #c6d6e9;
  --ink-3: #a4b9d2;
  --ink-4: #8ca3be;
  --stage: #0e1b2d;
  --grid-line: #263c54;
  --coral: #147a70;
  --coral-deep: #50c9b8;
  --coral-300: #3b9f92;
  --coral-200: #285b59;
  --coral-100: #1d4548;
  --coral-50: #153437;
  --coral-ink: #adf2e6;
  --code-bg: #0d1928;
  --code-kw: #9eead8;
  --mark-ink: #fff;
  --shadow-coral: 0 1px 0 #ffffff2e inset, 0 6px 16px -6px #147a7080;
}

:root :is(.scene, .cube-glyph, .stairs) {
  --iso-top: #f3f7ff;
  --iso-left: #d2dff2;
  --iso-blush: #b9e5e9;
  --iso-blush-soft: #dcf1f5;
  --iso-blush-deep: #89ced5;
  --out-top: #e0e8f2;
  --out-side: #cbd7e6;
  --out-dark: #9eb0c5;
  --out-line: #8499b2;
  --out-text: #4f6784;
  --out-floor: #a8b9cc;
  --cast: #234966;
}

/* Diagram faces remain light in dark mode so dark labels on the faces stay legible. */
:root[data-theme='dark'] :is(.scene, .cube-glyph, .stairs) {
  --iso-top: #d8e8fb;
  --iso-left: #a7bfdf;
  --iso-blush: #a2ddd8;
  --iso-blush-soft: #c5ede9;
  --iso-blush-deep: #7ac4bf;
  --obj-ink: #182c43;
  --floor-ink: #c5d9f2;
  --coral: #268f83;
  --coral-deep: #228477;
  --coral-300: #82cfc4;
  --coral-200: #a8e3da;
  --coral-ink: #073f39;
  --out-top: #afc2da;
  --out-side: #94acc7;
  --out-dark: #748ca9;
  --out-line: #778eab;
  --out-text: #425975;
  --out-floor: #6986a6;
  --cast: #070f1b;
}

:root[data-theme='dark'] .scene--bare {
  --out-top: #314962;
  --out-side: #243a53;
  --out-line: #597999;
  --out-text: #a4b9d2;
}

.spot { fill: color-mix(in srgb, var(--coral) 16%, transparent); }

.lesson-observation {
  display: block;
  border-inline-start: 3px solid var(--coral);
  border-radius: 0.25rem;
  background: var(--coral-50);
  color: var(--coral-ink);
  padding: 0.5rem 0.65rem;
  font-weight: 600;
}

.lesson__head h2 { overflow-wrap: anywhere; }

/* Keep longer chapter names readable in the narrow course sidebar. */
.tree__row {
  min-height: 35px;
  height: auto;
  padding-block: 0.35rem;
}

.tree__title {
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Keep classroom controls and site navigation distinct, including on narrow screens. */
#app .topbar {
  height: auto;
  min-height: 64px;
  padding: .6rem clamp(.75rem, 2vw, 1.5rem);
  gap: .75rem;
  background: var(--paper-raised);
}

.topbar .site-title {
  flex: none;
  min-width: 0;
  margin: 0;
  font: inherit;
  color: var(--ink);
}

.topbar .site-title .brand { gap: .55rem; }
.topbar .site-title .brand__mark { flex: none; }
.topbar .site-title .brand__name {
  display: block;
  font-size: clamp(1rem, 2vw, 1.3rem);
  line-height: 1.15;
  letter-spacing: -.03em;
}

#app .topbar__menu { margin-inline-end: 0; }
#app .topbar__tools { margin-inline-start: auto; }
.topbar .course-info-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-height: 38px;
  padding-inline: .65rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  color: var(--ink-2);
  background: var(--paper);
  font-size: .875rem;
  font-weight: 650;
  text-align: center;
}
.topbar .course-info-button:hover { background: var(--paper-sunk); color: var(--ink); }

@media (width <= 720px) {
  #app .topbar { flex-wrap: wrap; gap: .5rem; }
  .topbar .site-title .brand__mark { width: 28px; height: 28px; }
  .topbar .site-title .brand__name { white-space: normal; }
}

@media (width <= 540px) {
  #app .topbar__tools { flex: 1 0 100%; justify-content: flex-start; }
  #app .topbar__tools .search { flex: 1 1 0; justify-content: flex-start; padding-inline: .55rem; }
  .topbar .course-info-button { flex: 0 1 auto; }
  #app .topbar__tools .search__hint {
    display: block;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (width <= 639px) {
  #app[data-classroom-offscreen] .step-card__nav { visibility: hidden; }
}
