/* juliaTDGL documentation site: one stylesheet, colour tokens on :root, dark theme by prefers-color-scheme. */
:root {
  --bg: #ffffff; --bg-soft: #f5f7fa; --fg: #1d232b; --muted: #5b6573; --line: #dde2e8;
  --accent: #4063d8; --accent-soft: #e8edfb; --code-bg: #f2f4f7; --warn: #b4541a;
  --side-w: 11rem; --toc-w: 12.5rem; --max-w: 66rem;
}
/* dark: the system's choice unless the page's switch says light; or the switch says dark */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181d; --bg-soft: #1b2027; --fg: #e3e7ec; --muted: #9aa5b2; --line: #2d343d;
    --accent: #8aa4f0; --accent-soft: #1f2840; --code-bg: #1e242b; --warn: #e39a6b;
  }
}
:root[data-theme="dark"] {
  --bg: #14181d; --bg-soft: #1b2027; --fg: #e3e7ec; --muted: #9aa5b2; --line: #2d343d;
  --accent: #8aa4f0; --accent-soft: #1f2840; --code-bg: #1e242b; --warn: #e39a6b;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: system-ui, sans-serif; line-height: 1.6; }
a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }
code, pre { font-family: ui-monospace, monospace; font-size: 0.9em; }
code { background: var(--code-bg); padding: 0.08em 0.3em; border-radius: 4px; }
pre { background: var(--code-bg); padding: 0.9rem 1rem; border-radius: 8px; overflow-x: auto; line-height: 1.45; }
pre code { background: none; padding: 0; }

/* header */
.top { display: flex; align-items: center; gap: 0.8rem; padding: 0.6rem 1rem; border-bottom: 1px solid var(--line);
       background: var(--bg); position: sticky; top: 0; z-index: 5; }
.top img { width: 2.2rem; height: 2.2rem; color: var(--fg); }
.top .name { font-weight: 650; font-size: 1.15rem; color: var(--fg); text-decoration: none; }
.top .ver { color: var(--muted); font-size: 0.9rem; }
.top .theme { margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--fg);
              font-size: 0.9rem; padding: 0.2rem 0.55rem; cursor: pointer; }
.top .gh { border: 1px solid var(--line); border-radius: 6px; padding: 0.25rem 0.7rem; text-decoration: none;
           color: var(--fg); font-size: 0.9rem; }

/* layout */
.wrap { display: flex; }
nav.side { width: var(--side-w); flex: none; position: sticky; top: 4rem; align-self: flex-start; height: calc(100vh - 4rem);
           overflow-y: auto; padding: 0.9rem 0.6rem 2rem 0.8rem; border-right: 1px solid var(--line); background: var(--bg-soft); font-size: 0.92rem; }
nav.side ul { list-style: none; margin: 0; padding: 0; }
nav.side li { margin: 0.02rem 0; }
nav.side a { color: var(--fg); text-decoration: none; display: block; padding: 0.12rem 0.5rem; border-radius: 5px; line-height: 1.4; }
nav.side a:hover { background: var(--accent-soft); }
nav.side li.here > a { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
nav.side ul.sub { margin: 0.15rem 0 0.4rem 0.6rem; border-left: 2px solid var(--line); }
nav.side ul.sub a { font-size: 0.88rem; color: var(--muted); }
details.menu { display: none; }
main { flex: 1; min-width: 0; padding: 1.4rem 2.2rem 3rem; }
main > article { max-width: var(--max-w); }
h1 { font-size: 1.9rem; line-height: 1.25; margin: 0.3rem 0 1rem; }
h2 { font-size: 1.4rem; margin: 2.2rem 0 0.7rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.12rem; margin: 1.6rem 0 0.5rem; }
.lead { font-size: 1.08rem; color: var(--muted); }
figure { margin: 1.4rem 0; }
figure img { max-width: 100%; height: auto; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
figure img.plain { border: none; background: none; }
figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }
table { border-collapse: collapse; width: 100%; margin: 1rem 0; font-size: 0.93rem; display: block; overflow-x: auto; }
th, td { border-bottom: 1px solid var(--line); padding: 0.4rem 0.6rem; text-align: left; vertical-align: top; }
th { background: var(--bg-soft); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.card { border: 1px solid var(--line); border-radius: 8px; padding: 0.9rem 1rem; background: var(--bg-soft); }
.card h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.card p { margin: 0; font-size: 0.93rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.box { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 0.7rem 1rem; border-radius: 0 6px 6px 0; margin: 1rem 0; }
.box.warn { border-left-color: var(--warn); }
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 1.5rem; align-items: center; }
.hero .logo { width: 9rem; color: var(--fg); }
.buttons a { display: inline-block; margin: 0.3rem 0.4rem 0.3rem 0; padding: 0.45rem 0.9rem; border-radius: 6px;
             border: 1px solid var(--accent); text-decoration: none; }
.buttons a.primary { background: var(--accent); color: var(--bg); }
.pn { display: flex; justify-content: space-between; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); gap: 1rem; }
footer { color: var(--muted); font-size: 0.85rem; padding: 1.2rem 2rem; border-top: 1px solid var(--line); }
.mjx-chtml { font-size: 105% !important; }
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; }

/* phones: one column, the menu folds */
@media (max-width: 720px) {
  nav.side { display: none; }
  details.menu { display: block; border-bottom: 1px solid var(--line); background: var(--bg-soft); padding: 0.5rem 16px; }
  details.menu ul { list-style: none; padding-left: 0.5rem; }
  details.menu a { text-decoration: none; display: block; padding: 0.2rem 0; }
  main { padding: 1rem 16px 2rem; }
  .hero, .two { grid-template-columns: 1fr; }
  h1 { font-size: 1.55rem; }
  footer { padding: 1rem 16px; }
}
figure.svg svg { width: 100%; max-width: 40rem; height: auto; color: var(--fg); display: block; }

/* wordmark logo: the dots of the j and the i are vortices */
.top svg.wm { width: auto; height: 2.7rem; display: block; }
.top svg.wm .k { fill: var(--fg); } .top svg.wm .b { fill: var(--accent); }

/* anchors: leave room for the sticky header so a jumped-to heading stays visible */
[id] { scroll-margin-top: 5rem; }

/* the right-hand index of the page: its sections, the one being read lit */
aside.toc { width: var(--toc-w); flex: none; position: sticky; top: 4rem; align-self: flex-start; max-height: calc(100vh - 4rem);
            overflow-y: auto; padding: 1.4rem 0.8rem 2rem 0.4rem; font-size: 0.85rem; }
aside.toc p { margin: 0 0 0.5rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
              font-size: 0.75rem; }
aside.toc ul { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
aside.toc a { display: block; padding: 0.08rem 0 0.08rem 0.65rem; margin-left: -2px; border-left: 2px solid transparent;
              color: var(--muted); text-decoration: none; line-height: 1.3; }
aside.toc a:hover { color: var(--fg); }
aside.toc a.on { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
@media (max-width: 1100px) { aside.toc { display: none; } }
