/* Reference-table styling inspired by late-1970s technical manuals. */
:root {
  --monster-ink: #25221c;
  --monster-rule: #403a2e;
  --monster-paper: #fbf7e9;
  --monster-band: #d8b85a;
  --monster-row: #f3ecd7;
  --monster-subheading: #1f5f99;
  --monster-mono: "Pet Me", "Courier New", Courier, monospace;
}

/* Furo stores the selected theme on the body.  Keep the custom reference
   tables and code facsimiles in step with it instead of leaving light-theme
   ink on Furo's dark page background. */
body[data-theme="dark"] {
  --monster-ink: #f3ecd7;
  --monster-rule: #bba86f;
  --monster-paper: #202426;
  --monster-band: #66592f;
  --monster-row: #292d2f;
  --monster-subheading: #82bff0;
}

@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --monster-ink: #f3ecd7;
    --monster-rule: #bba86f;
    --monster-paper: #202426;
    --monster-band: #66592f;
    --monster-row: #292d2f;
    --monster-subheading: #82bff0;
  }
}

/* Fourth-level Markdown headings introduce individual command references.
   Blue separates them from the bold EXAMPLE labels within each reference. */
article[role="main"] h3,
article[role="main"] h3 code {
  color: var(--monster-subheading);
}

/* Inline C64 keycaps retain the silhouette of the physical keyboard without
   disturbing the surrounding text's line spacing. */
img.c64-keycap {
  display: inline-block;
  width: auto;
  height: 1.2em;
  margin: 0 0.05em;
  vertical-align: -0.1em;
}

/* Screen captures are VIC-20 pixel art: scale them without interpolation and
   frame them like the code samples they illustrate. */
article[role="main"] figure.screenshot img {
  image-rendering: pixelated;
  border: 2px solid var(--monster-rule);
}

article[role="main"] figure.screenshot figcaption {
  margin-top: 0.5rem;
  color: var(--monster-ink);
  font-size: 0.88rem;
  font-style: italic;
}

/* Furo places the document body directly in article[role="main"]. */
article[role="main"] table.docutils {
  display: table;
  width: 100%;
  margin: 1.75rem 0 2rem;
  border-collapse: collapse;
  border-top: 3px solid var(--monster-rule);
  border-bottom: 3px solid var(--monster-rule);
  color: var(--monster-ink);
  font-size: 0.92rem;
  line-height: 1.42;
  box-shadow: none;
}

article[role="main"] table.docutils tbody {
  background: var(--monster-paper);
}

article[role="main"] table.docutils thead {
  background: var(--monster-band);
  border-bottom: 2px solid var(--monster-rule);
}

article[role="main"] table.docutils th {
  padding: 0.65rem 0.8rem 0.58rem;
  border: 0;
  color: var(--monster-ink);
  font-family: var(--monster-mono);
  font-size: 0.82em;
  font-weight: 700;
  letter-spacing: 0.09em;
  line-height: 1.25;
  text-transform: uppercase;
}

article[role="main"] table.docutils td {
  padding: 0.58rem 0.8rem;
  border: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--monster-rule) 32%, transparent);
  vertical-align: top;
}

article[role="main"] table.docutils code {
  color: inherit;
}

article[role="main"] table.docutils tbody tr:nth-child(odd) {
  background: var(--monster-row);
}

article[role="main"] table.docutils tbody tr:last-child td {
  border-bottom: 0;
}

/* Commands, keys, and other leading identifiers read like a terminal label. */
article[role="main"] table.docutils td:first-child {
  font-family: var(--monster-mono);
  font-weight: 700;
  white-space: nowrap;
}

/* Code samples use the same warm paper, dark ink, and square rules as tables. */
article[role="main"] .highlight {
  margin: 1.5rem 0;
  border: 2px solid var(--monster-rule);
  border-left: 0.5rem solid var(--monster-band);
  border-radius: 0;
  background: var(--monster-paper);
  box-shadow: none;
}

article[role="main"] .highlight pre {
  margin: 0;
  padding: 1rem 1.15rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--monster-ink);
  font-family: var(--monster-mono);
  font-size: 0.9rem;
  line-height: 1.5;
}

article[role="main"] .highlight span {
  color: inherit !important;
  font-style: inherit;
  font-weight: inherit;
}

article[role="main"] .example {
  margin: 1rem 0;
}

article[role="main"] .example-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
}

article[role="main"] .example > :last-child {
  margin-bottom: 0;
}

/* Keep examples and code facsimiles mechanical and boxy. Warnings retain the
   theme's rounded shape so they remain visually distinct from ordinary notes. */
article[role="main"] .admonition.note,
article[role="main"] pre.literal-block,
article[role="main"] .code-block-caption {
  border-radius: 0;
}

/* Furo's smooth Material-style glyphs clash with the bitmap type and square
   manual furniture. Use compact terminal-like status badges instead. */
article[role="main"] .admonition.note > .admonition-title::before,
article[role="main"] .admonition.warning > .admonition-title::before {
  box-sizing: border-box;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid currentColor;
  background: none;
  font-family: var(--monster-mono);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 0.85rem;
  text-align: center;
  -webkit-mask-image: none;
  mask-image: none;
}

article[role="main"] .admonition.note > .admonition-title::before {
  content: "i";
  color: var(--color-admonition-title--note);
}

article[role="main"] .admonition.warning > .admonition-title::before {
  content: "!";
  color: var(--color-admonition-title--warning);
}

@media (max-width: 700px) {
  article[role="main"] table.docutils {
    display: block;
    overflow-x: auto;
    font-size: 0.85rem;
  }
}
