/* The Tessera manual, drawn like tesserawm.org: the house wallpaper behind
   tiles with Tessera's gaps and borders, the nav as a tab band, and the page
   you're reading as the focused tile. The tokens below are the site's Orpiment
   values from site/style.css, limited to the roles this page uses. */
:root {
  color-scheme: dark;
  --field-top: #1F1C12;
  --bg0: #0E0E0C;
  --bg1: #141412;
  --bg2: #1B1B18;
  --edge1: #34332D;
  --fg0: #E6E2D5;
  --fg1: #ABA79A;
  --fg2: #989485;
  --focus: #EDBB45;
  --focus-hi: #EED497;
  --second: #78B6F2;
  --inactive: #4C493E;
  --unfocused: #252420;
  --ok: #6FD3A0;
  --warn: #F59A5B;
  --on-accent: #0E0E0C;
  --faces-keyword: #EDBB45;
  --faces-special-form: #78B6F2;
  --faces-string: #6FD3A0;
  --faces-comment: #989485;
  --faces-number: #F59A5B;
  --faces-constant: #F59A5B;
  --faces-punct: #A09C8F;
  --ramp-0: #78B6F2;
  --ramp-1: #F4A281;
  --ramp-2: #CCD364;
  --ramp-3: #49C179;
  --ramp-4: #44E0E9;

  /* Tessera's default metrics (inner gap 6, border 1) at 2x. */
  --gap: 12px;
  --border: 2px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Cantarell, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 56px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--bg0);
  color: var(--fg0);
  font: 1.0625rem/1.65 var(--sans);
  -webkit-text-size-adjust: 100%;
}
@supports (background: color-mix(in srgb, currentColor 12%, transparent)) {
  body {
    background-image:
      radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--focus) 12%, transparent) 0, transparent 1100px),
      linear-gradient(225deg, var(--field-top) 0%, var(--bg0) 72%);
    background-attachment: fixed;
  }
}

a { color: var(--second); text-underline-offset: 0.18em; }
a:hover { color: var(--focus-hi); }
:focus-visible { outline: var(--border) solid var(--focus); outline-offset: 3px; }

.skip { position: absolute; left: -10000px; }
.skip:focus {
  left: var(--gap);
  top: var(--gap);
  z-index: 2;
  padding: 0.5rem 1rem;
  background: var(--bg0);
}

/* sigil-doc gives every heading a permalink whose label is for screen readers.
   The label stays in the accessibility tree and off the screen, and the # shows
   only when you reach for the heading. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.permalink {
  margin-left: 0.4em;
  color: var(--fg2);
  font-weight: 400;
  text-decoration: none;
  opacity: 0;
}
h2:hover .permalink, h3:hover .permalink, h4:hover .permalink,
.permalink:hover, .permalink:focus-visible { opacity: 1; }
@media (hover: none) { .permalink { opacity: 0.4; } }

/* The tab band, as on the site. */
/* shared-navigation:start */
.strip {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: var(--gap) var(--gap) 0;
  background: var(--bg1);
}
.tab {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-width: max-content;
  padding: 0.45em 0.6em calc(0.45em - 1px);
  border-bottom: 1px solid var(--inactive);
  color: var(--fg1);
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: var(--fg0); }
.tab.selected {
  padding-bottom: calc(0.45em - 2px);
  border-bottom: 2px solid var(--focus);
  color: var(--fg0);
  font-weight: 600;
}
.mark {
  flex: none;
  width: 0.6em;
  height: 0.6em;
  background: var(--mark);
}
.ma { --mark: var(--ramp-0); }
.mb { --mark: var(--ramp-1); }
.mc { --mark: var(--ramp-2); }
.md { --mark: var(--ramp-3); }
.me { --mark: var(--ramp-4); }
@media (max-width: 520px) {
  .strip { padding-inline: 8px; }
  .tab { flex-basis: calc(33.333% - 2px); font-size: 0.75rem; padding-inline: 0.4em; }
}
/* shared-navigation:end */

/* The contents and the page are two tiles on a workspace. */
.workspace {
  display: grid;
  gap: var(--gap);
  padding: var(--gap);
}
.layout {
  grid-template-columns: 17rem minmax(0, 1fr);
  align-items: start;
  max-width: 84rem;
  margin: 0 auto;
}
.tile {
  margin: 0;
  border: var(--border) solid var(--unfocused);
  background: var(--bg1);
}
.tile.focused { border-color: var(--focus); }

.contents {
  position: sticky;
  top: 56px;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
  padding: 1rem;
  font-size: 0.9375rem;
  line-height: 1.4;
}
.brand { display: block; margin-bottom: 1rem; }
.lockup { display: block; width: 100%; max-width: 12rem; height: auto; }
.contents-group p {
  margin: 1.25rem 0 0.4rem;
  color: var(--fg1);
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.contents ul { margin: 0; padding: 0; list-style: none; }
.contents li { margin: 0; }
.contents li a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-left: var(--border) solid transparent;
  color: var(--fg0);
  text-decoration: none;
}
.contents li a:hover { color: var(--focus-hi); }
.contents li a[aria-current] {
  border-left-color: var(--focus);
  background: var(--bg2);
  font-weight: 600;
}
.mobile-contents { display: none; }
.mobile-contents summary { cursor: pointer; color: var(--fg1); font-family: var(--mono); }

main { min-width: 0; background: var(--bg0); padding: clamp(1.25rem, 4vw, 3rem) clamp(1rem, 4vw, 3rem); }
article { max-width: 44rem; margin: 0 auto; }

h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--fg0);
}
h2 { margin: 3rem 0 0.75rem; font-size: 1.75rem; line-height: 1.2; letter-spacing: -0.01em; }
h3 { margin: 2rem 0 0.5rem; font-size: 1.2rem; line-height: 1.3; }
.anchor { display: block; scroll-margin-top: 14rem; }

article ul, article ol { padding-left: 1.2em; }
article li { margin: 0.4em 0; }
article li::marker { color: var(--focus); }
em { color: var(--focus-hi); font-style: italic; }

code, kbd, pre { font-family: var(--mono); font-size: 0.9em; font-variant-ligatures: none; }
code { color: var(--fg0); }
p code, li code, td code, figcaption code {
  padding: 0.05em 0.3em;
  background: var(--bg2);
  overflow-wrap: anywhere;
}
kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--edge1);
  border-bottom-width: 2px;
  border-radius: 3px;
  background: var(--bg2);
  color: var(--fg0);
  white-space: nowrap;
}

pre {
  margin: 1.25rem 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: var(--bg1);
  border: 1px solid var(--edge1);
  line-height: 1.5;
}
pre code { color: var(--fg0); font-size: 0.875rem; }
.tok-keyword { color: var(--faces-keyword); }
.tok-special { color: var(--faces-special-form); }
.tok-string { color: var(--faces-string); }
.tok-number, .tok-boolean, .tok-quote { color: var(--faces-number); }
.tok-comment { color: var(--faces-comment); }
.tok-paren { color: var(--faces-punct); }

/* A checked example: its name and result are quiet next to the code. */
.example pre { margin-top: 0.25rem; }

figure { margin: 1.75rem 0; }
.shot { border: var(--border) solid var(--unfocused); background: var(--bg1); }
.shot img { display: block; width: 100%; height: auto; background: var(--bg0); }
figcaption { padding: 0.75rem 1rem 0.9rem; color: var(--fg1); font-size: 0.9375rem; line-height: 1.5; }

table { display: block; overflow-x: auto; margin: 1.25rem 0; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.45; }
th, td { padding: 0.5rem 0.75rem 0.5rem 0; text-align: left; vertical-align: top; border-bottom: 1px solid var(--edge1); }
th { color: var(--fg1); font-weight: 600; }
td p { margin: 0; }

.admonition {
  margin: 1.5rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg1);
  border-left: var(--border) solid var(--focus);
}
.admonition.warning { border-left-color: var(--warn); }
.admonition p { margin: 0.5rem 0; }
.admonition-title { font-weight: 600; }

/* The way on, at the end of every page. */
.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--gap);
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--edge1);
}
.pager a { display: block; max-width: 48%; color: var(--second); text-decoration: none; }
.pager a:hover { color: var(--focus-hi); }
.pager-next { margin-left: auto; text-align: right; }
.pager-label { display: block; color: var(--fg1); font-family: var(--mono); font-size: 0.8125rem; }

.foot {
  margin-top: 1rem;
  padding: 1rem var(--gap) 2rem;
  color: var(--fg1);
  font-size: 0.9375rem;
  text-align: center;
}
.foot p { margin: 0; }
.foot-badge { display: flex; justify-content: center; padding: 13px; margin-top: 1rem; }
.created-with-sigil { display: block; flex: none; line-height: 0; }
.created-with-sigil img { display: block; }

@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .contents { position: static; max-height: none; overflow: visible; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
  .brand { margin: 0; }
  .lockup { max-width: 9rem; }
  .desktop-contents { display: none; }
  .mobile-contents { display: block; flex: 1 1 100%; }
  .mobile-contents[open] summary { margin-bottom: 0.5rem; }
}
@media (max-width: 520px) {
  .workspace { padding: 8px; gap: 8px; }
  main { padding: 1.25rem 0.875rem; }
  pre { padding: 0.75rem; }
  .pager a { max-width: 100%; }
}

/* A screenshot is a link to its image. manual.js opens it in this dialog. */
.shot-link { display: block; cursor: zoom-in; }
.shot-link:focus-visible { outline: var(--border) solid var(--focus); outline-offset: 2px; }
.lightbox {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  padding: 1rem;
  border: 0;
  background: transparent;
  cursor: zoom-out;
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: rgb(14 14 12 / 0.92); }
.lightbox img { max-width: 100%; max-height: 100%; }
