/* The online Akili User Guide (Akili-Wiki#396). The PDF's palette, in both display schemes. */
:root {
  --bg: #ffffff;
  --ink: #22313a;
  --muted: #5e6e74;
  --teal: #1f5a63;
  --line: #cbd6d9;
  --panel: #f4f7f8;
  --head: #e4eef0;
  --note-bg: #eef3f6; --note-line: #587887;
  --tip-bg: #eaf5ee; --tip-line: #2e7d4f;
  --important-bg: #fff5e3; --important-line: #c27c0e;
  --caution-bg: #fdedec; --caution-line: #b3261e;
  --about-bg: #eaf3f4; --about-line: #1f5a63;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141a1d;
    --ink: #e3e9eb;
    --muted: #9fb0b6;
    --teal: #7fcdd8;
    --line: #37474e;
    --panel: #1b2327;
    --head: #223036;
    --note-bg: #1d2a31; --note-line: #7fa2b3;
    --tip-bg: #1a2c22; --tip-line: #63b586;
    --important-bg: #332a18; --important-line: #e0a84a;
    --caution-bg: #351f1e; --caution-line: #e57b72;
    --about-bg: #182b2e; --about-line: #7fcdd8;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--teal); }
code { font-family: ui-monospace, Consolas, "SF Mono", Menlo, monospace; font-size: 0.92em; overflow-wrap: anywhere; }
h1, h2, h3 { color: var(--teal); line-height: 1.25; scroll-margin-top: 16px; }
h1 { font-size: 2rem; margin: 0 0 16px; }
h2 { font-size: 1.4rem; margin: 40px 0 10px; }
h3 { font-size: 1.1rem; margin: 28px 0 8px; color: var(--ink); }
h2 .anchor, h3 .anchor { margin-left: 8px; opacity: 0; text-decoration: none; font-weight: normal; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }
p, ul, ol { margin: 0 0 12px; }
li { margin-bottom: 6px; }
li > p { margin: 6px 0; }
li > ul { margin: 6px 0 0; }
mark { background: #ffe66d; color: #5a3e00; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 2; }
.skip:focus { left: 16px; }

.top {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 20px;
  max-width: 1200px; margin: 0 auto; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; }
.edition { color: var(--muted); flex: 1; white-space: nowrap; }
.pdf { white-space: nowrap; }

.layout {
  display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 32px;
  max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px;
}
.side { position: sticky; top: 0; align-self: start; max-height: 100vh; overflow: auto; padding-top: 8px; }
main { min-width: 0; max-width: 760px; }

.search label { display: block; font-weight: 600; margin-bottom: 6px; }
.search input {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--ink);
  /* The border is the field's only boundary, so it needs 3:1 against the page: --muted gives
     that in both schemes; --line does not. */
  background: var(--bg); border: 1px solid var(--muted); border-radius: 6px;
}
.results { list-style: none; margin: 8px 0 16px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.results li { margin: 0; border-top: 1px solid var(--line); }
.results li:first-child { border-top: 0; }
.results a { display: block; padding: 8px 10px; text-decoration: none; color: var(--ink); }
.results a:hover, .results a:focus { background: var(--head); }
.results .title { display: block; font-weight: 600; color: var(--teal); }
.results .chapter { display: block; font-size: 0.85rem; color: var(--muted); }
.results .extract { display: block; font-size: 0.9rem; margin-top: 2px; }
.results .none { padding: 8px 10px; color: var(--muted); }

.contents summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.chapters { list-style: none; margin: 0; padding: 0; }
.chapters > li { margin: 0 0 4px; }
.chapters a { text-decoration: none; display: block; padding: 3px 8px; border-radius: 4px; }
.chapters a:hover, .chapters a:focus { background: var(--head); }
.chapters li.current > a { font-weight: 700; background: var(--head); }
.chapters ul { list-style: none; margin: 2px 0 8px; padding-left: 14px; border-left: 2px solid var(--line); }
.chapters ul a { font-size: 0.92rem; color: var(--ink); }
main .chapters ul { font-size: 0.95rem; }

.callout {
  margin: 16px 0; padding: 12px 16px; border-left: 4px solid var(--note-line);
  background: var(--note-bg); border-radius: 0 6px 6px 0;
}
/* Note and Important headings use --ink: their line colours are below 4.5:1 on their light backgrounds. */
.callout .callout-head { font-weight: 700; margin-bottom: 4px; color: var(--ink); }
.callout.tip { background: var(--tip-bg); border-color: var(--tip-line); }
.callout.tip .callout-head { color: var(--tip-line); }
.callout.important { background: var(--important-bg); border-color: var(--important-line); }
.callout.caution { background: var(--caution-bg); border-color: var(--caution-line); }
.callout.caution .callout-head { color: var(--caution-line); }
.callout.about { background: var(--about-bg); border-color: var(--about-line); }
.callout.about .callout-head { color: var(--about-line); }
.callout > :last-child { margin-bottom: 0; }

.table-wrap { overflow-x: auto; margin: 0 0 16px; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { border: 1px solid var(--line); padding: 6px 10px; vertical-align: top; text-align: left; }
th { background: var(--head); }

figure { margin: 20px 0; text-align: center; }
figure img { max-width: 100%; height: auto; border: 1px solid var(--line); background: #fff; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 6px; text-align: left; }
.figure-pair { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.figure-pair figure { flex: 1 1 260px; margin: 12px 0; }
.figure-pair img { max-width: 100% !important; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager a[rel="next"] { margin-left: auto; }
.foot { max-width: 1200px; margin: 0 auto; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; }

@media (max-width: 899px) {
  .layout { grid-template-columns: 1fr; gap: 16px; }
  .side { position: static; max-height: none; }
  .contents { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; }
  .contents summary { margin-bottom: 0; }
  .contents[open] summary { margin-bottom: 8px; }
  h1 { font-size: 1.6rem; }
  .edition { order: 3; flex-basis: 100%; }
  figure img { max-width: 100% !important; }
}
