/* Runekeeper Manual. Follows the system appearance; kept plain so it reads like a Mac help page.
   The website shows the same page with its own header above (site.css sets --site-header-height). */

:root {
  color-scheme: light dark;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --background: #ffffff;
  --sidebar: #f5f5f7;
  --rule: #d2d2d7;
  --code-background: rgba(0, 0, 0, 0.05);
  --accent: #7a4fb0;
  --accent: -apple-system-control-accent;
  --hit: rgba(255, 214, 10, 0.45);
  /* Callout numbers: fixed, because scripts/manual-screenshots.py draws the same colour into the images. */
  --callout: #7a4fb0;
  --hit-current: rgba(255, 149, 0, 0.75);
  --toc-width: 240px;
  --site-header-height: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --background: #1e1e1e;
    --sidebar: #262626;
    --rule: #3a3a3c;
    --code-background: rgba(255, 255, 255, 0.08);
    --accent: #b38ae6;
    --accent: -apple-system-control-accent;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--site-header-height) + 16px); }

body {
  margin: 0;
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
}

/* Contents list on the left, like the sidebar of a help book; moves to the top in narrow windows. */
.toc {
  position: fixed;
  top: var(--site-header-height);
  bottom: 0;
  left: 0;
  width: var(--toc-width);
  overflow-y: auto;
  padding: 24px 16px;
  background: var(--sidebar);
  border-right: 1px solid var(--rule);
}

.toc-title {
  margin: 0 0 12px 8px;
  font-weight: 600;
  color: var(--secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* The other page (manual ↔ release notes), below the contents, lined up with the parts. */
.toc-other {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.toc-other a { font-weight: 500; }

.toc ol { list-style: none; margin: 0; padding: 0; }

.toc a {
  display: block;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.toc a:hover { background: var(--code-background); }

/* Parts with their topics below; only the part being read (or, while searching, every part with
   a match) shows its topics. */
.toc-part > a { font-weight: 500; }
.toc-part > ol { display: none; margin: 1px 0 6px 10px; }
.toc-part.open > ol { display: block; }
.toc-part > ol a { font-size: 13px; padding: 3px 8px; color: var(--secondary); }
.toc li.current > a { background: var(--code-background); color: var(--text); }

.search { margin: 0 0 12px; }

.search input {
  width: 100%;
  font: 13px -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: var(--background);
  border: 1px solid var(--rule);
  border-radius: 7px;
  padding: 5px 8px;
}

.search input:focus { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 0; }

.search-status { margin: 4px 0 0 8px; font-size: 12px; color: var(--secondary); min-height: 0; }
.search-status:empty { display: none; }

mark.hit { background: var(--hit); color: inherit; border-radius: 2px; }
mark.hit.current { background: var(--hit-current); }

main {
  margin-left: var(--toc-width);
  max-width: 820px;
  padding: 28px 40px 80px;
}

@media (max-width: 720px) {
  .toc { position: static; width: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  #toc-list { columns: 2; }
  .toc-part > ol, .toc-part.open > ol { display: none; }
  main { margin-left: 0; padding: 20px 20px 60px; }
}

h1 { font-size: 28px; line-height: 1.2; margin: 0 0 12px; }

/* App icon beside the title, as on the landing page of a Mac help book. */
.masthead { display: flex; align-items: center; gap: 20px; margin-bottom: 8px; }
.masthead img { flex: none; }
.masthead h1 { margin-bottom: 4px; }
.masthead .lead { margin: 0; }
.masthead .version { margin: 6px 0 0; font-size: 13px; color: var(--secondary); }

@media (max-width: 520px) {
  .masthead { flex-direction: column; align-items: flex-start; gap: 12px; }
}

h2 { font-size: 21px; margin: 44px 0 10px; padding-top: 20px; border-top: 1px solid var(--rule); }
h3 { font-size: 16px; margin: 26px 0 6px; }
h4 { font-size: 14px; margin: 20px 0 4px; }

section.part:first-of-type > h2 { border-top: 0; margin-top: 28px; }

.lead { font-size: 16px; color: var(--secondary); }

a { color: var(--accent); }

li { margin: 4px 0; }
li > ul { margin-top: 4px; }

code {
  font: 12.5px ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--code-background);
  padding: 1px 4px;
  border-radius: 4px;
}

kbd {
  font: 12px -apple-system, sans-serif;
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--background);
  white-space: nowrap;
}

table { width: 100%; border-collapse: collapse; margin: 12px 0; }

th, td { text-align: left; vertical-align: top; padding: 7px 10px; border-bottom: 1px solid var(--rule); }

th { font-size: 12px; font-weight: 600; color: var(--secondary); }

tr.group td { font-weight: 600; padding-top: 16px; border-bottom-width: 0; }

.shortcuts td:last-child { white-space: nowrap; width: 1%; }

dt { font-weight: 600; margin-top: 14px; }
dd { margin: 2px 0 0 0; color: var(--text); }

/* Screenshots: light and dark versions (<picture>), stored at twice their display size. */
figure.shot { margin: 18px 0 14px; }
figure.shot img { display: block; max-width: 100%; height: auto; filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.22)); }
figure.shot figcaption { margin-top: 8px; font-size: 13px; color: var(--secondary); }

/* Animated liquids: GIFs at 1.5 × their pixels, kept sharp like the app draws textures. */
figure.liquids { margin: 18px 0 14px; }
figure.liquids > div { display: flex; flex-wrap: wrap; gap: 16px; }
figure.liquids figure { margin: 0; }
figure.liquids img { display: block; width: 192px; height: 192px; image-rendering: pixelated; border-radius: 8px; }
figure.liquids figcaption { margin-top: 8px; font-size: 13px; color: var(--secondary); }

/* The sky as stored and in motion, side by side like the liquids: both 192 points high, 1.5 points
   per texture pixel, kept sharp. */
figure.sky { margin: 18px 0 14px; }
figure.sky > div { display: flex; flex-wrap: wrap; gap: 16px; }
figure.sky figure { margin: 0; }
figure.sky img { display: block; height: 192px; width: auto; image-rendering: pixelated; border-radius: 8px; }
figure.sky figcaption { margin-top: 8px; font-size: 13px; color: var(--secondary); }
figure.sky-layers figcaption { display: flex; }
figure.sky-layers figcaption span { flex: 1; }

/* The legend under a screenshot with numbered callouts; numbers drawn like the callouts. */
ol.callouts { list-style: none; counter-reset: callout; padding-left: 0; }
ol.callouts li { counter-increment: callout; position: relative; padding-left: 30px; }
ol.callouts li::before {
  content: counter(callout);
  position: absolute;
  left: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--callout);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

/* Third-party license texts: verbatim, wrapped, small. */
pre.license {
  font: 11.5px/1.45 ui-monospace, "SF Mono", Menlo, monospace;
  white-space: pre-wrap;
  background: var(--code-background);
  padding: 12px 14px;
  border-radius: 8px;
}
