/* The wider site's look on Zensical: header bar, colours and fonts. Kept the same as the site's own stylesheet. */
:root { --bg:#fbfaf7;--surface:#fff;--surface-2:#f3f1ec;--ink:#1c2226;--muted:#5a656e;--line:#e2ded6;--accent:#0d6a6e;--accent-soft:#e3f0ef;--rust:#a8502a; color-scheme: light; --serif:"Source Serif 4",Georgia,"Times New Roman",serif; --sans:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg:#101416;--surface:#161b1e;--surface-2:#1c2226;--ink:#e6e9ea;--muted:#9ba7ae;--line:#2a3237;--accent:#5fc3c0;--accent-soft:#15302f;--rust:#e08a5f; color-scheme: dark; } }
:root[data-theme="dark"] { --bg:#101416;--surface:#161b1e;--surface-2:#1c2226;--ink:#e6e9ea;--muted:#9ba7ae;--line:#2a3237;--accent:#5fc3c0;--accent-soft:#15302f;--rust:#e08a5f; color-scheme: dark; }
:root, [data-md-color-scheme] {
  --md-default-bg-color: var(--bg); --md-default-fg-color: var(--ink); --md-default-fg-color--light: var(--muted); --md-default-fg-color--lighter: var(--muted); --md-default-fg-color--lightest: var(--line);
  --md-primary-fg-color: var(--bg); --md-primary-bg-color: var(--ink); --md-primary-bg-color--light: var(--muted);
  --md-accent-fg-color: var(--accent); --md-accent-fg-color--transparent: var(--accent-soft); --md-accent-bg-color: var(--bg);
  --md-typeset-color: var(--ink); --md-typeset-a-color: var(--accent); --md-code-bg-color: var(--surface-2); --md-code-fg-color: var(--ink);
  --md-footer-bg-color: var(--bg); --md-footer-fg-color: var(--muted);
  --md-text-font-family: var(--sans); --md-code-font-family: "JetBrains Mono",ui-monospace,Consolas,monospace;
}
body { background: var(--bg); color: var(--ink); font-family: var(--sans); }
.aa-header { background: var(--bg); border-bottom: 1px solid var(--line); position: relative; z-index: 5; }
.aa-bar { max-width: 61rem; margin: 0 auto; padding: 11px 0.2rem; display: flex; align-items: center; gap: 16px; font-size: 15px; line-height: 1.5; }
.aa-brand { font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--ink) !important; white-space: nowrap; }
.aa-brand span { color: var(--accent); }
.aa-nav { margin-left: auto; display: flex; gap: 2px; align-items: center; }
.aa-nav a { color: var(--muted); padding: 6px 10px; border-radius: 6px; }
.aa-nav a:hover { color: var(--ink); background: var(--surface-2); }
.aa-nav a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.aa-icon { background: none; border: 1px solid var(--line); color: var(--muted); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.aa-icon:hover { color: var(--ink); border-color: var(--muted); }
.aa-icon svg { width: 18px; height: 18px; }
.aa-menu { display: none; }
@media (max-width: 820px) {
  .aa-menu { display: inline-grid; margin-left: auto; }
  .aa-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px; z-index: 6; }
  .aa-nav.open { display: flex; }
}
.md-header { background: var(--bg); color: var(--ink); box-shadow: none; border-bottom: 1px solid var(--line); }
.md-header--shadow { box-shadow: none; }
.md-header__inner { align-items: center; }
.aa-crumb { flex: 1; min-width: 0; font-size: 14px; color: var(--muted); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aa-crumb a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.md-search__form { background: var(--surface-2); border-radius: 8px; }
.md-search__form:hover { background: var(--surface-2); }
.md-search__input, .md-search__input::placeholder, .md-search__icon { color: var(--muted) !important; }
.md-main { background: var(--bg); }
.md-typeset h1, .md-typeset h2, .md-typeset h3 { font-family: var(--serif); font-weight: 600; color: var(--ink); letter-spacing: -0.01em; line-height: 1.22; }
.md-typeset h4 { font-family: var(--sans); font-weight: 600; color: var(--ink); }
.md-typeset a { text-decoration: underline; text-underline-offset: 2px; }
.md-typeset .headerlink { text-decoration: none; }
.md-nav__link--active, .md-nav__item .md-nav__link--active { color: var(--accent); }
.md-nav__title { color: var(--muted); }
.md-typeset table:not([class]) th { background: var(--surface-2); color: var(--ink); }
.md-typeset table:not([class]) { background: var(--surface); border: 1px solid var(--line); }
.aa-footer { border-top: 1px solid var(--line); margin-top: 32px; color: var(--muted); }
.aa-footer .aa-bar { flex-wrap: wrap; justify-content: space-between; font-size: 14px; padding-top: 24px; padding-bottom: 32px; }
.aa-footer a { color: var(--muted); text-decoration: underline; }
@media print { .aa-header, .aa-footer, .md-header { display: none !important; } }
.md-sidebar__scrollwrap { padding-top: 4px; }
@media (max-width: 1240px) { .aa-bar { padding-left: 16px; padding-right: 16px; } }

/* Buttons: readable before hover, in both themes */
.md-typeset .md-button, .md-typeset .md-button:visited { color: var(--accent); border: 1px solid var(--accent); background: transparent; text-decoration: none; border-radius: 8px; }
.md-typeset .md-button:hover, .md-typeset .md-button:focus { color: var(--bg); background: var(--accent); border-color: var(--accent); }
.md-typeset .md-button--primary, .md-typeset .md-button--primary:visited { color: var(--bg); background: var(--accent); }
.md-typeset .md-button--primary:hover { color: var(--bg); background: var(--ink); border-color: var(--ink); }
/* Links keep their colour wherever they sit */
.md-typeset a, .md-typeset .example a, .md-typeset .reference-entry a { color: var(--accent); }
.md-typeset a:hover { color: var(--rust); }
.md-typeset .example { background: var(--surface-2); color: var(--ink); border-left-color: var(--accent); }
.md-typeset .footnote-ref a, .md-typeset sup a { color: var(--accent); }
/* Tables wrap to the column width; a table too wide for a phone scrolls inside its own box */
.md-typeset table:not([class]) { min-width: 0; display: table; width: 100%; }
.md-typeset table:not([class]) th, .md-typeset table:not([class]) td { white-space: normal; overflow-wrap: break-word; }
.md-typeset .center table:not([class]) { width: auto; margin-inline: auto; }
.md-typeset__scrollwrap, .md-typeset__table { max-width: 100%; overflow-x: auto; }
/* Long equations scroll inside themselves */
.md-typeset mjx-container[display="true"] { display: block; max-width: 100%; overflow-x: auto; overflow-y: hidden; min-width: 0 !important; }
.md-typeset .arithmatex { max-width: 100%; }
/* The sidebar title stays solid while the list scrolls under it */
.md-sidebar--primary .md-nav__title { background: var(--bg); box-shadow: 0 0 .4rem .4rem var(--bg); }
.md-nav__link { color: var(--ink); }
.md-nav__link--active, .md-nav__link:hover { color: var(--accent); }
@media (max-width: 600px) {
  .md-typeset mjx-container:not([display="true"]) { display: inline-block; max-width: 100%; overflow-x: auto; overflow-y: hidden; vertical-align: middle; }
}
.md-typeset .center table:not([class]) { width: 100%; font-size: .72rem; }
.md-typeset .center table:not([class]) th, .md-typeset .center table:not([class]) td { padding: .5em .45em; }
.md-typeset .example .center table:not([class]) { font-size: .62rem; }
.md-typeset .example .center table:not([class]) th, .md-typeset .example .center table:not([class]) td { padding: .45em .25em; }
.md-typeset .example .center table:not([class]) mjx-container { font-size: 92% !important; }
.md-typeset .example .md-typeset__scrollwrap { margin-inline: 0; }
.md-typeset table:not([class]) th, .md-typeset table:not([class]) td { min-width: 0; }

/* Side panels can be hidden, for reading or teaching at any zoom */
.aa-side { flex: none; display: none; }
@media (min-width: 76.25em) { .aa-side { display: inline-grid; } }
html.aa-panels-hidden .md-sidebar { display: none; }
html.aa-panels-hidden .md-content { max-width: 52rem; margin-inline: auto; }
/* Reading on from one page to the next */
.aa-pager { width: 100%; box-sizing: border-box; max-width: 61rem; margin: 2rem auto 0; padding: 0 .2rem; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 15px; line-height: 1.4; }
.aa-pager a { color: var(--accent); flex: 1 1 240px; max-width: 48%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; }
.aa-pager a.next { text-align: right; margin-left: auto; }
.aa-pager a:hover { border-color: var(--accent); }
.aa-pager span { display: block; color: var(--muted); font-size: 13px; }
@media (max-width: 600px) { .aa-pager a { max-width: 100%; } }

/* Admin edit bar: shown only in admin mode (site.js, ?admin=on) */
.admin-edit { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; max-width: calc(100vw - 32px);
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 4px 16px rgba(0,0,0,.12); font-family: var(--sans); font-size: 13px; }
.admin-edit[hidden] { display: none; }
.admin-edit span:first-child { font-weight: 600; color: var(--rust); }
.admin-edit a { color: var(--accent); }
.admin-src { color: var(--muted); font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
@media print { .admin-edit { display: none !important; } }
