/* JuliaMono, the one monospace font with every character the decorated
   source uses (combining underline, raised letters, APL glyphs, box
   drawing), from its own release on jsDelivr (SIL Open Font License), so
   the page does not depend on it being installed. */
@font-face {
  font-family: JuliaMono;
  src: url("https://cdn.jsdelivr.net/gh/cormullion/juliamono@v0.63.2/webfonts/JuliaMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f8fafc; --panel: #ffffff; --ink: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --accent: #1e3a5f; --gold: #d4a017; --err: #b91c1c;
  --code: #f1f5f9; --brand: #7c3aed;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --panel: #111a2c; --ink: #e2e8f0; --muted: #94a3b8;
          --line: #1f2a40; --accent: #93b4dc; --err: #f87171; --code: #0f1828;
          --brand: #a78bfa; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
header { display: flex; gap: 20px; align-items: center; padding: 16px 24px; border-bottom: 1px solid var(--line); background: var(--panel); }
header img { height: 64px; border-radius: 6px; }
header h1 { margin: 0; font-size: 1.5rem; color: var(--brand); }
header p { margin: 4px 0 0; color: var(--muted); }
main { display: grid; grid-template-columns: 280px 1fr; gap: 0; min-height: calc(100vh - 140px); }
nav { border-right: 1px solid var(--line); background: var(--panel); }
nav ul { list-style: none; margin: 0; padding: 8px; }
.library-toggle { display: none; }
nav li { padding: 10px 12px; border-radius: 8px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
nav li:hover { background: var(--code); }
nav li.current { background: var(--accent); color: var(--bg); }
nav li.current .summary, nav li.current .alias { color: var(--bg); }
nav .name { font-weight: 600; }
nav .summary { grid-column: 1 / 3; font-size: 0.8rem; color: var(--muted); }
code, pre, textarea { font-family: "JuliaMono", "SF Mono", Menlo, Consolas, monospace; }
.alias { color: var(--gold); margin-left: 8px; font-size: 0.9em; }
section { padding: 16px 28px; min-width: 0; }
section h2 { margin: 0; }
section .summary { color: var(--muted); }
pre { background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
pre.import { display: inline-block; margin: 0 0 12px; padding: 6px 12px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.tab { border: none; border-bottom: 3px solid transparent; border-radius: 0; background: none; }
button.tab.current { border-bottom-color: var(--gold); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
button.chip.current, button.run { background: var(--accent); color: var(--bg); border-color: var(--accent); }
textarea.editor { width: 100%; font-size: 0.92rem; line-height: 1.4; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--code); color: var(--ink); resize: vertical; }
.actions { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 0.85rem; }
.run-timing { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
pre.err { color: var(--err); }
.pictures svg { width: 100%; max-width: 768px; height: auto; margin: 6px 0; }
.pictures figure { margin: 12px 0; }
.pictures img { width: auto; max-width: 100%; height: auto; image-rendering: auto; }
.pictures figcaption { font-size: .85em; color: var(--muted); margin: 4px 0; }
.preview-label { color: var(--muted); font-size: .85rem; margin: 12px 0 4px; }
.preview-label a { color: var(--accent); }
.program-source, .quick-output { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 12px 0; }
.program-source summary, .quick-output summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.scene-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin: 18px 0 32px; }
.scene-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--ink); background: var(--panel); }
.scene-card:hover, .scene-card:focus-visible { border-color: var(--accent); box-shadow: 0 3px 14px #0002; }
.scene-card:first-child { grid-column: 1 / -1; }
.scene-image { height: 170px; display: flex; align-items: center; justify-content: center; background: #303b4e; }
.scene-image img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; }
.scene-card:first-child .scene-image { height: auto; min-height: 160px; padding: 12px; }
.scene-card:first-child img { max-height: 320px; }
.scene-caption { display: flex; flex-direction: column; gap: 5px; padding: 12px 16px; }
.scene-caption span { color: var(--muted); font-size: .85rem; }
.docs table { border-collapse: collapse; margin: 10px 0; }
.docs th, .docs td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.docs code { background: var(--code); padding: 1px 4px; border-radius: 4px; }
.docs pre code { background: none; padding: 0; }
.docs a { color: var(--accent); }
footer { padding: 14px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }
footer a { color: var(--accent); }
@media (max-width: 760px) {
  main { grid-template-columns: 1fr; }
  nav { border-right: none; border-bottom: 1px solid var(--line); }
  header img { height: 44px; }
  header p { display: none; }
  section > .summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  section { padding: 12px 16px; }
  .library-toggle { display: flex; width: calc(100% - 16px); margin: 8px; }
  .library-list { display: none; }
  .library-list.open { display: block; }
  .scene-gallery { grid-template-columns: 1fr; gap: 12px; }
  .scene-image { height: auto; min-height: 100px; padding: 8px; }
  .scene-image img { max-height: 240px; }
}

/* X_eTaL in rendered form, with the live demo's token colors. */
:root { --mono: JuliaMono, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --c-builtin: #1c5fd4; --c-userfunc: #2b8a3e; --c-libfunc: #0b7f8c; --c-arg: #a61e8f;
  --c-num: #9c6500; --c-string: #8a6d00; --c-symbol: #0b7285; --c-macro: #9c6500; --c-error: #c92a2a; }
@media (prefers-color-scheme: dark) {
  :root { --c-builtin: #5b9cff; --c-userfunc: #3fbf5f; --c-libfunc: #22b8c8; --c-arg: #d25fd2;
    --c-num: #e0b400; --c-string: #e8d27a; --c-symbol: #7fbfff; --c-macro: #e0b400; --c-error: #ff6b6b; }
}
code, pre, textarea { font-family: var(--mono); }
pre.xtl, code.xtl { font-family: var(--mono); }
pre.xtl { font-size: 0.95rem; line-height: 1.45; }
.c-builtin { color: var(--c-builtin); }
.c-userfunc { color: var(--c-userfunc); }
.c-libfunc { color: var(--c-libfunc); }
.c-lambdaarg { color: var(--c-arg); }
.c-number, .c-exponent { color: var(--c-num); }
.c-string { color: var(--c-string); }
.c-notation { color: var(--c-string); } .c-notation .katex { font-size: 1.05em; }
.c-symbol { color: var(--c-symbol); }
.c-quote { font-weight: bold; }
.c-comment { color: var(--muted); }
.c-macro { color: var(--c-macro); font-weight: bold; }
.c-error { color: var(--c-error); }
pre .result { color: var(--muted); }
pre.typed { color: var(--ink); }
.import pre.xtl { display: inline-block; margin: 0 0 12px; padding: 6px 12px; }
.edit { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.edit .pane { min-width: 0; }
.edit pre.xtl { margin: 0; min-height: 100%; }
.edit .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.types .typeline { font-family: var(--mono); padding: 4px 0; border-bottom: 1px solid var(--line); }
.types .ttype { color: var(--muted); }
@media (max-width: 900px) { .edit { grid-template-columns: 1fr; } }

/* The landing page. */
.landing .lead { font-size: 1.05rem; }
.landing h3 { margin: 22px 0 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
button.card { text-align: left; display: grid; gap: 4px; padding: 10px 12px; }
button.card .name { font-weight: 600; }
button.card .summary { font-size: 0.82rem; color: var(--muted); }
table.layers { border-collapse: collapse; margin: 8px 0 4px; }
table.layers th, table.layers td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
nav li.start { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 6px; }
.landing .more { margin-top: 22px; color: var(--muted); }
.landing a, .more a { color: var(--accent); }
.expansion { margin: 8px 0; }
.expansion .label { font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
button:disabled { opacity: 0.45; cursor: default; }
pre.xtl .changed { display: inline-block; width: 100%; background: rgba(212, 160, 23, 0.18); border-left: 3px solid var(--gold); padding-left: 6px; margin-left: -9px; }
.expansion pre.xtl { white-space: pre-wrap; word-break: break-all; }
pre.out .math { display: block; font-family: serif; white-space: normal; }
pre.out .math .katex-display { margin: 0.3em 0; }
/* A symbol Equations' e:t_exSymbols< marks (\htmlClass{sym sym-NAME}): lit on hover. */
pre.out .math .sym { border-radius: 3px; }
pre.out .math .sym:hover { background: rgba(212, 160, 23, 0.28); }
