/*
 * Copied from the Zig Language Reference stylesheet
 * (https://ziglang.org/documentation/master/), MIT-licensed.
 * Cheatsheet-specific additions live at the bottom of this file.
 */
:root{
   --nav-width: 26em;
   --nav-margin-l: 1em;
}
body{
  font-family: system-ui, -apple-system, Roboto, "Segoe UI", sans-serif;
  margin: 0;
  line-height: 1.5;
}
header {
  padding: 0 1em;
}
#contents {
  max-width: 60em;
  margin: auto;
  padding: 0 1em;
}
#navigation {
  padding: 0 1em;
}
table ul {
  list-style-type: none;
  padding: 0em;
}
table li {
  padding-bottom: 1em;
  line-height:1.2em;
}
table, th, td {
  border-collapse: collapse;
  border: 1px solid grey;
}
th, td {
  padding: 0.5em;
}
th[scope=row] {
    text-align: left;
    font-weight: normal;
}

@media screen and (min-width: 1025px) {
  header {
    margin-left: calc(var(--nav-width) + var(--nav-margin-l));
  }
  header h1 {
    margin: auto;
    max-width: 30em;
  }
  #navigation {
    overflow: auto;
    width: var(--nav-width);
    height: 100vh;
    position: fixed;
    top:0;
    left:0;
    bottom:0;
    padding: unset;
    margin-left: var(--nav-margin-l);
  }
  #navigation nav ul {
    padding-left: 1em;
  }
  #contents-wrapper {
    margin-left: calc(var(--nav-width) + var(--nav-margin-l));
  }
}

a:hover,a:focus {
  background: #fff2a8;
}
dt {
  font-weight: bold;
}
.sgr-1m {
  font-weight: bold;
}
.sgr-2m {
  color: #575757;
}
.sgr-31_1m {
  color: #b40000;
}
.sgr-32_1m {
  color: green;
}
.sgr-36_1m {
  color: #005C7A;
}
.file {
  font-weight: bold;
  border: unset;
}
code {
  background: #f8f8f8;
  border: 1px dotted silver;
  padding-left: 0.3em;
  padding-right: 0.3em;
}
pre > code {
  display: block;
  overflow: auto;
  padding: 0.5em;
  border: 1px solid #eee;
  line-height: normal;
}
samp {
  background: #fafafa;
}
pre > samp {
  display: block;
  overflow: auto;
  padding: 0.5em;
  border: 1px solid #eee;
  line-height: normal;
}
kbd {
  font-weight: normal;
}
.table-wrapper {
  width: 100%;
  margin: 1em auto;
  overflow-x: auto;
}

.tok-kw {
    color: #333;
    font-weight: bold;
}
.tok-str {
    color: #d14;
}
.tok-builtin {
    color: #005C7A;
}
.tok-comment {
    color: #545454;
    font-style: italic;
}
.tok-fn {
    color: #900;
    font-weight: bold;
}
.tok-null {
    color: #005C5C;
}
.tok-number {
    color: #005C5C;
}
.tok-type {
    color: #458;
    font-weight: bold;
}

figure {
  margin: auto 0;
}
figure pre {
  margin-top: 0;
}

figcaption {
  padding-left: 0.5em;
  font-size: small;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
}
figcaption.zig-cap {
  background: #fcdba5;
}
figcaption.c-cap {
  background: #a8b9cc;
  color: #000;
}
figcaption.peg-cap {
  background: #fcdba5;
}
figcaption.javascript-cap {
  background: #365d95;
  color: #fff;
}
figcaption.shell-cap {
  background: #ccc;
  color: #000;
}

aside {
  border-left: 0.25em solid #f7a41d;
  padding: 0 1em 0 1em;
}

h1 a, h2 a, h3 a, h4 a, h5 a {
  text-decoration: none;
  color: #333;
}

a.hdr {
  visibility: hidden;
}
h1:hover > a.hdr, h2:hover > a.hdr, h3:hover > a.hdr, h4:hover > a.hdr, h5:hover > a.hdr {
  visibility: visible;
}

th pre code {
    background: none;
}

@media (prefers-color-scheme: dark) {
  body{
      background:#121212;
      color: #ccc;
  }
  a {
      color: #88f;
  }
  a:hover,a:focus {
      color: #000;
  }
  table, th, td {
      border-color: grey;
  }
  .sgr-2m {
      color: grey;
  }
  .sgr-31_1m {
      color: red;
  }
  .sgr-32_1m {
      color: #00B800;
  }
  .sgr-36_1m {
      color: #0086b3;
  }
  code {
    background: #222;
    border-color: #444;
  }
  pre > code {
      color: #ccc;
      background: #222;
      border: unset;
  }
  samp {
    background: #000;
    color: #ccc;
  }
  pre > samp {
    border: unset;
  }
  .tok-kw {
      color: #eee;
  }
  .tok-str {
      color: #2e5;
  }
  .tok-builtin {
      color: #ff894c;
  }
  .tok-comment {
      color: #aa7;
  }
  .tok-fn {
      color: #B1A0F8;
  }
  .tok-null {
      color: #ff8080;
  }
  .tok-number {
      color: #ff8080;
  }
  .tok-type {
      color: #68f;
  }
  h1 a, h2 a, h3 a, h4 a, h5 a {
      color: #aaa;
  }
  figcaption.zig-cap {
      background-color: #b27306;
      color: #000;
  }
  figcaption.peg-cap {
      background-color: #b27306;
      color: #000;
  }
  figcaption.shell-cap {
    background: #2a2a2a;
    color: #fff;
  }
}

/*
 * --- Cheatsheet additions (not part of the Zig stylesheet) ---
 * Code-block captions carry the fence language plus a copy button; languages
 * without a dedicated *-cap colour above fall back to the default below.
 */
figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ccc;
  color: #000;
  padding-right: 0.3em;
}
figcaption .lang {
  text-transform: capitalize;
}
button.copy {
  font: inherit;
  font-size: small;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  padding: 0 0.4em;
}
button.copy:hover,
button.copy:focus {
  text-decoration: underline;
}
button.copy.copied {
  color: green;
}
/* Keep the § anchor visible while its link is being copied. */
a.hdr:focus,
a.hdr.copied {
  visibility: visible;
}
#navigation > nav {
  margin-bottom: 1em;
}
/* One section shown at a time (script in the page). The .js gate keeps every
   section visible when JavaScript is unavailable. */
.js section[data-section]:not(.active) {
  display: none;
}
#navigation a.active {
  font-weight: bold;
}
figure {
  margin: 1em 0;
}

@media (prefers-color-scheme: dark) {
  figcaption {
    background: #2a2a2a;
    color: #fff;
  }
  button.copy.copied {
    color: #00B800;
  }
}
