/* GitHub gist embeds (<script src="https://gist.github.com/...js">) inject their own
   light stylesheet after ours, so everything here is !important. The goal is for a
   gist to read like one of the theme's code windows and follow the active theme
   (tokens.css), instead of a white box in the middle of a dark post. */

.gist { font-size: 12.5px; line-height: 1.55; font-family: var(--font) !important; }
/* gists bring fixed-width markup; never let them force the body to scroll sideways */
.gist, .gist .gist-file, .gist .gist-data { max-width: 100%; overflow-x: auto; }
.gist .gist-file {
  margin: 0 !important;
  border: 1px solid var(--border) !important;
  border-radius: 6px !important;
  overflow: hidden;
  font-family: var(--font) !important;
  /* Markdown gists (.md) render through GitHub's markdown-body, which reads these
     variables; current names first, legacy fallbacks that the same rules still use. */
  --bgColor-default: var(--bar) !important;
  --bgColor-muted: var(--win) !important;
  --bgColor-neutral-muted: var(--pill) !important;
  --fgColor-default: var(--fg-2) !important;
  --fgColor-muted: var(--muted) !important;
  --fgColor-accent: var(--accent) !important;
  --borderColor-default: var(--border) !important;
  --borderColor-muted: var(--border) !important;
  --color-canvas-default: var(--bar) !important;
  --color-canvas-subtle: var(--win) !important;
  --color-neutral-muted: var(--pill) !important;
  --color-fg-default: var(--fg-2) !important;
  --color-fg-muted: var(--muted) !important;
  --color-accent-fg: var(--accent) !important;
  --color-accent-emphasis: var(--accent) !important;
  --color-border-default: var(--border) !important;
  --color-border-muted: var(--border) !important;
  --color-danger-fg: var(--red) !important;
}

/* code body */
.gist .gist-data,
.gist .highlight,
.gist .blob-wrapper { background: var(--bar) !important; border: 0 !important; }
.gist .gist-data { border-bottom: 1px solid var(--border) !important; }
.gist table, .gist tbody, .gist tr, .gist td { background: transparent !important; border: 0 !important; }
.gist .blob-code, .gist .blob-code-inner {
  color: var(--fg-2) !important;
  font-family: var(--font) !important;
  font-size: 12.5px !important;
  line-height: 1.55 !important;
  padding: 1px 12px !important;
}
.gist .blob-num {
  color: var(--muted) !important;
  background: transparent !important;
  border: 0 !important;
  padding: 1px 10px !important;
  font-family: var(--font) !important;
  font-size: 12.5px !important;
  line-height: 1.55 !important;
}
.gist .blob-num::before { color: var(--muted) !important; }

/* footer strip ("view raw · hosted with ❤ by GitHub") styled like a window title bar */
.gist .gist-meta {
  background: var(--win) !important;
  color: var(--muted) !important;
  font-family: var(--font) !important;
  font-size: 11px !important;
  padding: 8px 14px !important;
}
.gist .gist-meta a { color: var(--fg-2) !important; }
.gist .gist-meta a:hover { color: var(--accent) !important; }

/* rendered markdown gists */
.gist .markdown-body, .gist .Box-body.readme {
  background: var(--bar) !important;
  color: var(--fg-2) !important;
  font-family: var(--font) !important;
  font-size: 13.5px !important;
  padding: 16px 18px !important;
}
.gist .markdown-body :is(h1, h2, h3, h4, h5, h6) { color: var(--fg) !important; border-color: var(--border) !important; }
.gist .markdown-body a { color: var(--accent) !important; }
.gist .markdown-body :is(code, pre) { background: var(--pill) !important; color: var(--fg-2) !important; }

/* syntax tokens (GitHub's .pl-* classes) on the same palette as code.css */
.gist .pl-c, .gist .pl-c span { color: var(--muted) !important; font-style: italic !important; }
.gist .pl-c1, .gist .pl-cce, .gist .pl-ml { color: var(--amber) !important; }
.gist .pl-k, .gist .pl-ko, .gist .pl-kos, .gist .pl-en, .gist .pl-sf { color: var(--purple) !important; }
.gist .pl-s, .gist .pl-s1, .gist .pl-pds, .gist .pl-sr, .gist .pl-e { color: var(--green) !important; }
.gist .pl-ent { color: var(--red) !important; }
.gist .pl-v, .gist .pl-vpf, .gist .pl-smi, .gist .pl-sc { color: var(--cyan) !important; }
.gist .pl-corl { color: var(--accent) !important; }
.gist .pl-mh, .gist .pl-mh .pl-en, .gist .pl-ms { color: var(--fg) !important; font-weight: 700 !important; }
.gist .pl-mi { font-style: italic !important; }
.gist .pl-mb { font-weight: 700 !important; }
.gist .pl-ii, .gist .pl-bu { color: var(--red) !important; }
.gist .pl-mi1, .gist .pl-mdht { color: var(--green) !important; background: transparent !important; }
.gist .pl-md, .gist .pl-mdhf { color: var(--red) !important; background: transparent !important; }
