/* muJS: lessons that teach JavaScript, with a code editor that runs the code. */
.hidden { display: none !important; }

/* Icon: SVG files from assets/js/icons.js are used as masks so they follow the text colour */

/* Buttons */

/* The page is the header, the sidebar, and the main, directly in the body. The padding and the gap are the ones of the body: the three elements have none. */

.logo-mark { background-image: url("favicon.png"); }   /* the logo of the app: its favicon (the rest is in assets/css/style.css) */

/* The sidebar holds the status line and the copyright at its end */

.section-title { color: var(--fg-1); font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; }

/* The lessons on one side, the lesson on the other */
.unit { display: flex; flex-direction: column; gap: var(--gap-extra-small); padding-block-end: var(--padding-small); }
.unit-title { display: flex; align-items: center; height: var(--height); padding: 0 var(--padding-medium); color: var(--fg-1); font-size: var(--font-size-extra-small); font-weight: 700; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-item { text-transform: none; }
.sidebar-item-number { flex: none; display: flex; align-items: center; justify-content: center; width: calc(var(--unit) * 8); height: calc(var(--unit) * 8); border: var(--border-width) solid var(--border); border-radius: var(--border-radius-small); color: var(--fg-1); font-size: var(--font-size-extra-small); }
.sidebar-item.on .sidebar-item-number { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.sidebar-item.done .sidebar-item-number { border-color: var(--ok); color: var(--ok); }
.sidebar-item.done.on .sidebar-item-number { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.sidebar-item-title { flex: 1; min-width: 0; font-size: var(--font-size-small); text-align: start; }
.summary-text { color: var(--fg-1); font-size: var(--font-size-small); }
.stepper { display: flex; gap: var(--gap-extra-small); }
.step { flex: 1; height: calc(var(--unit) * 2); background: var(--border); border-radius: var(--border-radius-small); }
.step.done { background: var(--ok); }
.step.on { background: var(--brand); }

/* The lesson is the part that has a border around it */
.main { padding: var(--padding-medium); }
.breadcrumbs { flex: 1; }
.breadcrumb { height: auto; font-size: var(--font-size-small); }
.lesson-counter { flex: none; color: var(--fg-1); font-size: var(--font-size-small); white-space: nowrap; }

.lesson-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: var(--gap-large); }
.lesson-text, .lesson-work { min-width: 0; display: flex; flex-direction: column; gap: var(--gap-small); }
.lesson-heading { display: flex; align-items: center; gap: var(--gap-medium); padding-block-end: var(--padding-small); }
.lesson-number { flex: none; display: flex; align-items: center; justify-content: center; width: calc(var(--unit) * 14); height: calc(var(--unit) * 14); background: var(--brand); color: var(--brand-ink); border-radius: var(--border-radius-medium); font-size: var(--font-size-large); font-weight: 700; }
.lesson-title { min-width: 0; font-size: var(--font-size-extra-large); font-weight: 700; overflow-wrap: anywhere; }
.lesson-explain { display: flex; flex-direction: column; gap: var(--gap-medium); font-size: var(--font-size-medium); line-height: 1.6; }

.task { display: flex; flex-direction: column; gap: var(--gap-small); padding: var(--padding-medium); border: var(--border-width) solid var(--brand); border-radius: var(--border-radius-medium); background: color-mix(in srgb, var(--brand) 10%, var(--bg)); }
.task .section-title { color: var(--brand); }
.lesson-task { font-size: var(--font-size-medium); line-height: 1.5; }

/* Code: the example, the editor (a text area over the same text with colours), and the colours of the words */
.code {
  margin: 0; padding: var(--padding-medium); font-family: var(--font-mono); font-size: calc(var(--font-size-small) * var(--editor-scale, 1)); line-height: 1.6; tab-size: 2;
  white-space: pre; color: var(--fg);
}

.editor { display: flex; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); background: var(--bg-1); overflow: hidden; min-width: 0; }
.editor-gutter { flex: none; padding: var(--padding-medium) var(--padding-small); min-width: calc(var(--unit) * 12); border-inline-end: var(--border-width) solid var(--border); font-family: var(--font-mono); font-size: calc(var(--font-size-small) * var(--editor-scale, 1)); line-height: 1.6; text-align: end; white-space: pre; color: var(--fg-1); }
.editor-scroll { flex: 1; min-width: 0; overflow-x: auto; }
.editor-stack { position: relative; min-width: 100%; width: max-content; }
.editor-highlight { min-height: calc(var(--unit) * 70); pointer-events: none; }
.editor-input {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; background: transparent; resize: none; overflow: hidden;
  color: transparent; caret-color: var(--fg);
}
.editor-input:focus-visible { outline-offset: calc(var(--border-width-thick) * -1); }
.editor-input::selection { background: color-mix(in srgb, var(--brand) 40%, transparent); }
.editor-hint { color: var(--fg-1); font-size: var(--font-size-extra-small); }
.token-comment { color: var(--fg-1); font-style: italic; }
.token-string { color: var(--green); }
.token-number, .token-literal { color: var(--yellow); }
.token-keyword { color: var(--blue); font-weight: 700; }
.token-global { color: color-mix(in srgb, var(--blue) 60%, var(--fg)); }
.token-call { color: var(--brand); }

.work-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(calc(var(--unit) * 50), 1fr)); gap: var(--gap-small); }

/* The console, like a terminal */
.terminal { display: flex; flex-direction: column; border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); overflow: hidden; min-width: 0; }
.terminal-bar { display: flex; align-items: center; height: calc(var(--unit) * 10); padding: 0 var(--padding-medium); border-bottom: var(--border-width) solid var(--border); background: var(--bg-1); }
.console { min-height: calc(var(--unit) * 24); max-height: calc(var(--unit) * 70); overflow: auto; padding: var(--padding-medium); font-family: var(--font-mono); font-size: calc(var(--font-size-small) * var(--editor-scale, 1)); line-height: 1.6; white-space: pre; }
.console-line { display: block; }
.console-line::before { content: "›"; margin-inline-end: var(--gap-medium); color: var(--brand); }
.console-line.error { color: var(--danger); }
.console-line.error::before { color: var(--danger); }
.console-empty { color: var(--fg-1); font-family: var(--font-sans); white-space: normal; }

/* The result of a check */
.outcome { display: flex; flex-direction: column; gap: var(--gap-small); padding: var(--padding-medium); border: var(--border-width) solid var(--border); border-radius: var(--border-radius-medium); }
.outcome.passed { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--bg)); }
.outcome.failed { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--bg)); }
.outcome-text { font-weight: 700; }
.outcome.passed .outcome-text { color: var(--ok); }
.outcome.failed .outcome-text { color: var(--danger); }
.tests { display: flex; flex-direction: column; gap: var(--gap-extra-small); }
.test { display: flex; align-items: baseline; gap: var(--gap-small); font-size: var(--font-size-small); }
.test > .icon { align-self: center; }
.test.passed > .icon { color: var(--ok); }
.test.failed > .icon { color: var(--danger); }
.test-text { min-width: 0; overflow-wrap: anywhere; }
.test-code { font-family: var(--font-mono); }
.test-detail { color: var(--fg-1); }

.sandbox-frame { display: none; }

/* Messages */
dialog { color: var(--fg); background: var(--bg); border: var(--border-width) solid var(--border); padding: 0; }
dialog::backdrop { background: color-mix(in srgb, var(--black) 70%, transparent); }

/* From a tablet up, the lessons stay beside the lesson; a wide screen puts the code beside what is learned */
@media (min-width: 48rem) {
  body { grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .header { grid-column: 1; grid-row: 1; }
  .sidebar { display: flex; position: static; grid-column: 1; grid-row: 2; }
  .footer { grid-column: 1; grid-row: 3; flex-direction: column; align-items: flex-start; }
  #status { white-space: normal; overflow-wrap: anywhere; }
  .main { grid-column: 2; grid-row: 1 / -1; }
  .menu-button { display: none; }
}
@media (min-width: 64rem) {
  .lesson-body { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Controls that keep their size have a set width: a multiple of the height (RULES.md, Control Width) */
