/* The neuralmech pages in the look of the book websites (skill book-websites), shared with the PDE catalogue:
   the book's fonts (Times as TeX Gyre Termes, the typewriter txtt), neuralmech blue, the landing page with the
   cover, and the widget pages with the top bar, the outline on the left and the code beside its result */
@font-face { font-family: "Termes"; src: url(fonts/texgyretermes-regular.otf); }
@font-face { font-family: "Termes"; font-weight: 700; src: url(fonts/texgyretermes-bold.otf); }
@font-face { font-family: "Termes"; font-style: italic; src: url(fonts/texgyretermes-italic.otf); }
@font-face { font-family: "txtt"; src: url(fonts/txtt.otf); }
:root {
  --bg: #ffffff; --ink: #111111; --muted: #666666; --rule: #d6d6d6; --box: #f7f7f7; --link: #1f4e8c;
  --frame: #1f3f66; --tint: #e5edf5; --title: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131313; --ink: #e6e6e6; --muted: #9a9a9a; --rule: #333333; --box: #1b1b1b; --link: #8ab4ff;
    --frame: #3b5f88; --tint: #172029; --title: #f2f2f2;
  }
}
:root[data-theme="dark"] {
  --bg: #131313; --ink: #e6e6e6; --muted: #9a9a9a; --rule: #333333; --box: #1b1b1b; --link: #8ab4ff;
  --frame: #3b5f88; --tint: #172029; --title: #f2f2f2;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; overflow-x: hidden; background: var(--bg); color: var(--ink); font: 18px/1.55 "Termes", "Times New Roman", serif; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

/* the top bar of a widget page: the contents toggle, the title, previous and next, GitHub, light or dark */
.top {
  position: sticky; top: 0; z-index: 3; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--bg); border-bottom: 1px solid var(--rule); font-size: 17px;
}
.top .brand {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; text-decoration: none; font-size: 1.12em; font-weight: 700;
}
.top .brand span { margin-left: 0.6em; color: var(--muted); font-weight: 400; }
.top .grow { flex: 1; }
.pager { display: flex; gap: 14px; font-size: 0.95em; white-space: nowrap; }
.pager a { color: var(--link); text-decoration: none; }
.pager a.prev::before { content: "\2190  "; }
.pager a.next::after { content: "  \2192"; }
.gh { color: var(--muted); text-decoration: none; }
.gh:hover { color: var(--ink); }
.icon {
  width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--muted); font-size: 18px; line-height: 1;
}
.icon:hover { border-color: var(--rule); color: var(--ink); }

/* the contents on the left, the page on the right */
.frame { display: flex; min-height: calc(100vh - 48px); }
#outline {
  position: sticky; top: 48px; align-self: flex-start; flex: 0 0 300px; width: 300px; height: calc(100vh - 48px);
  overflow-y: auto; padding: 14px 0 40px; background: var(--bg); border-right: 1px solid var(--rule); font-size: 17px;
}
body.nav-closed #outline { display: none; }
#outline .ch { padding: 14px 16px 6px; color: color-mix(in srgb, var(--frame) 60%, var(--ink)); font-weight: 700; line-height: 1.25; }
#outline .ch span {
  display: block; color: var(--muted); font-size: 0.78em; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase;
}
#outline .ex {
  display: flex; gap: 0.2em; padding: 4px 16px; border-left: 3px solid transparent;
  color: var(--ink); font-size: 0.95em; line-height: 1.3; text-decoration: none;
}
#outline .ex:hover { background: var(--tint); }
#outline .ex.on { background: var(--tint); border-left-color: var(--link); font-weight: 600; }
#outline .n { flex: 0 0 3.6em; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
#main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
@media (max-width: 900px) {
  .top .brand span, .top .gh, .pager .t { display: none; }
  .pager { gap: 8px; }
  #outline { position: fixed; left: 0; z-index: 2; width: min(85vw, 300px); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25); }
  #main { padding: 16px 16px 48px; }
}

/* the landing page: no top bar, GitHub and light or dark in the corner, the cover beside the title */
.corner { position: absolute; top: 12px; right: 16px; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.corner .icon { font-size: 20px; }
#main.solo { padding-top: 48px; }
.home { max-width: 860px; margin: 0 auto; padding: 8px 24px 96px; }
.intro { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 36px; align-items: center; }
.cover { width: 100%; height: auto; box-shadow: 0 1px 8px #0004; }
.kicker { margin: 0; font-size: 17px; font-style: italic; color: var(--muted); }
.about h1 {
  margin: 6px 0 14px; padding: 8px 14px; border-radius: 8px; background: var(--frame); color: var(--title);
  font-size: 32px; font-weight: normal; line-height: 1.2;
}
.about h1 .sub { margin-left: 0.5em; font-size: 0.6em; opacity: 0.8; white-space: nowrap; }
.lede { margin: 0 0 16px; text-align: justify; hyphens: auto; }
.links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; font-size: 16px; }

/* one button family for both sites: outlined, 6 px corners */
.links .button {
  padding: 2px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--bg); color: var(--ink);
  line-height: 1.5; text-decoration: none;
}
.links .button:hover { border-color: var(--frame); }
/* a link with no address yet (aria-disabled): grayed out, not clickable */
.links .button[aria-disabled], .resources li > a[aria-disabled] { opacity: 0.45; cursor: default; pointer-events: none; }

/* the supplementary material: tinted cards, a title and one line each */
.resources { margin-top: 44px; }
.resources h2 { margin: 0 0 10px; font-size: 26px; }
.resources ol { list-style: none; margin: 0; padding: 0; }
.resources li { margin: 0 0 10px; }
.resources li > a {
  display: block; padding: 10px 16px; border: 1px solid var(--frame); border-radius: 8px; background: var(--tint);
  color: var(--ink); text-decoration: none;
}
.resources .t { display: block; color: var(--link); font-weight: 700; }
.resources .d { display: block; font-size: 0.85em; color: var(--muted); }

/* a widget: title, one line, the code beside its result; no box */
.xp { max-width: 1200px; margin: 0 auto; padding-top: 8px; }
.xp h1 {
  margin: 0 0 8px; padding: 7px 14px; border-radius: 8px; background: var(--frame); color: var(--title);
  font-size: 22px; line-height: 1.3;
}
.xp h1 .n { margin-right: 0.6em; color: var(--title); font-weight: normal; opacity: 0.7; }
.xp .lede { margin: 0 0 16px; }
.xp-grid { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.listing { flex: none; max-width: 100%; margin: 0; background: var(--box); border: 1px solid var(--frame); border-radius: 8px; overflow: hidden; }
.listing figcaption {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 7px 16px;
  background: var(--frame); color: var(--title); font-size: 15px; font-weight: bold;
}
.listing figcaption .file { margin-right: auto; }
.listing figcaption .file::before { content: "Listing: "; }
.listing figcaption button {
  padding: 0 12px; border: 1px solid currentColor; border-radius: 6px; background: none; color: inherit; font-weight: normal;
}
.listing figcaption .go { font-weight: bold; }
.listing figcaption button:disabled { opacity: 0.5; cursor: default; }
.source textarea {
  display: block; width: calc(87ch + 28px); max-width: 100%; margin: 0; padding: 12px 14px; border: 0; resize: none;
  background: var(--bg); color: var(--ink); font: 13px/1.5 "txtt", ui-monospace, monospace; white-space: pre; tab-size: 4;
}
.out { flex: 1 1 240px; max-width: 360px; margin: 0; }
.out canvas { display: block; width: 100%; aspect-ratio: 1; background: var(--box); }
.state, .log { margin: 6px 0 0; padding: 0; color: var(--muted); font: 13px/1.45 "txtt", ui-monospace, monospace; white-space: pre-wrap; }

@media (max-width: 640px) {
  body { font-size: 17px; }
  .home { padding-left: 0; padding-right: 0; }
  .intro { grid-template-columns: 1fr; gap: 20px; }
  .cover { width: 160px; }
}

/* the link to the legal notice: under the landing page, at the end of the outline */
.legal { color: var(--muted); font-size: 14px; text-decoration: none; }
.legal:hover { color: var(--ink); }
footer { margin-top: 48px; }
#outline .legal { display: block; padding: 24px 16px 0; }
.text h1 { margin: 24px 0 8px; font-size: 22px; }
.text a { color: var(--link); }
