/*
 * Gistful for GitHub - frontend styles.
 * Based on GistPress by Brady Vercher and Gary Jones.
 *
 * Everything is driven by custom properties on .gistful, so a theme can
 * override any of them. Light values are the default; dark values apply with
 * data-scheme="dark", or with data-scheme="auto" under prefers-color-scheme.
 * Syntax colours follow the GitHub Primer palette (values only); the token
 * selectors mirror GitHub's own gist stylesheet, so every pl-* class it
 * emits is coloured.
 */

.gistful {
	--gistful-bg: #fff;
	--gistful-fg: #1f2328;
	--gistful-border: #d0d7de;
	--gistful-meta-bg: #f6f8fa;
	--gistful-meta-fg: #57606a;
	--gistful-line-num-fg: #6e7781;
	--gistful-line-highlight: #ffc;
	--gistful-line-highlight-fg: #1f2328;
	--gistful-link: #0969da;
	--gistful-pl-c: #6e7781;
	--gistful-pl-k: #cf222e;
	--gistful-pl-s: #0a3069;
	--gistful-pl-c1: #0550ae;
	--gistful-pl-en: #8250df;
	--gistful-pl-ent: #116329;
	--gistful-pl-v: #953800;
	--gistful-pl-smi: #24292f;
	--gistful-pl-e: #8250df;
	--gistful-pl-bu: #82071e;
	--gistful-pl-ii-fg: #f6f8fa;
	--gistful-pl-ii-bg: #82071e;
	--gistful-pl-c2-fg: #f6f8fa;
	--gistful-pl-c2-bg: #cf222e;
	--gistful-pl-ml: #3b2300;
	--gistful-pl-mh: #0550ae;
	--gistful-pl-md-fg: #82071e;
	--gistful-pl-md-bg: #ffebe9;
	--gistful-pl-mi1-fg: #116329;
	--gistful-pl-mi1-bg: #dafbe1;
	--gistful-pl-mc-fg: #953800;
	--gistful-pl-mc-bg: #ffd8b5;
	--gistful-pl-mi2-fg: #eaeef2;
	--gistful-pl-mi2-bg: #0550ae;
	--gistful-pl-mdr: #8250df;
	--gistful-pl-ba: #57606a;
	--gistful-pl-sg: #8c959f;

	margin: 0 0 1em;
	color: var(--gistful-fg);
}

.gistful[data-scheme="dark"] {
	--gistful-bg: #0d1117;
	--gistful-fg: #e6edf3;
	--gistful-border: #30363d;
	--gistful-meta-bg: #161b22;
	--gistful-meta-fg: #8b949e;
	--gistful-line-num-fg: #6e7681;
	--gistful-line-highlight: #3d3a1c;
	--gistful-line-highlight-fg: #e6edf3;
	--gistful-link: #58a6ff;
	--gistful-pl-c: #8b949e;
	--gistful-pl-k: #ff7b72;
	--gistful-pl-s: #a5d6ff;
	--gistful-pl-c1: #79c0ff;
	--gistful-pl-en: #d2a8ff;
	--gistful-pl-ent: #7ee787;
	--gistful-pl-v: #ffa657;
	--gistful-pl-smi: #c9d1d9;
	--gistful-pl-e: #d2a8ff;
	--gistful-pl-bu: #f85149;
	--gistful-pl-ii-fg: #f0f6fc;
	--gistful-pl-ii-bg: #8e1519;
	--gistful-pl-c2-fg: #f0f6fc;
	--gistful-pl-c2-bg: #b62324;
	--gistful-pl-ml: #f2cc60;
	--gistful-pl-mh: #1f6feb;
	--gistful-pl-md-fg: #ffdcd7;
	--gistful-pl-md-bg: #67060c;
	--gistful-pl-mi1-fg: #aff5b4;
	--gistful-pl-mi1-bg: #033a16;
	--gistful-pl-mc-fg: #ffdfb6;
	--gistful-pl-mc-bg: #5a1e02;
	--gistful-pl-mi2-fg: #c9d1d9;
	--gistful-pl-mi2-bg: #1158c7;
	--gistful-pl-mdr: #d2a8ff;
	--gistful-pl-ba: #8b949e;
	--gistful-pl-sg: #484f58;
}

@media (prefers-color-scheme: dark) {
	.gistful[data-scheme="auto"] {
		--gistful-bg: #0d1117;
		--gistful-fg: #e6edf3;
		--gistful-border: #30363d;
		--gistful-meta-bg: #161b22;
		--gistful-meta-fg: #8b949e;
		--gistful-line-num-fg: #6e7681;
		--gistful-line-highlight: #3d3a1c;
		--gistful-line-highlight-fg: #e6edf3;
		--gistful-link: #58a6ff;
		--gistful-pl-c: #8b949e;
		--gistful-pl-k: #ff7b72;
		--gistful-pl-s: #a5d6ff;
		--gistful-pl-c1: #79c0ff;
		--gistful-pl-en: #d2a8ff;
		--gistful-pl-ent: #7ee787;
		--gistful-pl-v: #ffa657;
		--gistful-pl-smi: #c9d1d9;
		--gistful-pl-e: #d2a8ff;
		--gistful-pl-bu: #f85149;
		--gistful-pl-ii-fg: #f0f6fc;
		--gistful-pl-ii-bg: #8e1519;
		--gistful-pl-c2-fg: #f0f6fc;
		--gistful-pl-c2-bg: #b62324;
		--gistful-pl-ml: #f2cc60;
		--gistful-pl-mh: #1f6feb;
		--gistful-pl-md-fg: #ffdcd7;
		--gistful-pl-md-bg: #67060c;
		--gistful-pl-mi1-fg: #aff5b4;
		--gistful-pl-mi1-bg: #033a16;
		--gistful-pl-mc-fg: #ffdfb6;
		--gistful-pl-mc-bg: #5a1e02;
		--gistful-pl-mi2-fg: #c9d1d9;
		--gistful-pl-mi2-bg: #1158c7;
		--gistful-pl-mdr: #d2a8ff;
		--gistful-pl-ba: #8b949e;
		--gistful-pl-sg: #484f58;
	}
}

.gistful .gist {
	margin: 0;
}

.gistful .gist-file {
	margin-bottom: 1em;
	border: 1px solid var(--gistful-border);
	border-radius: 6px;
	background: var(--gistful-bg);
	overflow: hidden;
}

/* Horizontal scrollbar always reachable (fix #83); tabindex is added by the renderer. */
.gistful .gist-data {
	overflow-x: auto;
	background: var(--gistful-bg);
	color: var(--gistful-fg);
}

.gistful .gist-data:focus-visible {
	outline: 2px solid var(--gistful-link);
	outline-offset: -2px;
}

.gistful .blob-wrapper,
.gistful .file {
	margin: 0;
}

.gistful table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	border-spacing: 0;
	background: transparent;
}

.gistful tr,
.gistful td {
	border: 0;
	background: transparent;
}

.gistful .blob-num {
	box-sizing: border-box;
	width: 1%;
	min-width: 50px;
	padding: 0 10px;
	color: var(--gistful-line-num-fg);
	font: 12px/20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	text-align: right;
	white-space: nowrap;
	vertical-align: top;
	user-select: none;
}

.gistful .blob-num::before {
	content: attr(data-line-number);
}

.gistful .blob-code {
	padding: 0 10px;
	color: var(--gistful-fg);
	font: 12px/20px ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
	white-space: pre;
	vertical-align: top;
}

.gistful .blob-code pre,
.gistful .blob-code code {
	display: inline;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	white-space: pre;
}

/* Highlighted lines. An explicit highlight_color attribute adds an inline
 * background; otherwise this variable decides, per scheme. */
.gistful .line-highlight td {
	background-color: var(--gistful-line-highlight);
}

.gistful .line-highlight .blob-code {
	color: var(--gistful-line-highlight-fg);
}

.gistful .pl-c {
	color: var(--gistful-pl-c);
}

.gistful .pl-c1,
.gistful .pl-s .pl-v {
	color: var(--gistful-pl-c1);
}

.gistful .pl-e,
.gistful .pl-en {
	color: var(--gistful-pl-en);
}

.gistful .pl-smi,
.gistful .pl-s .pl-s1 {
	color: var(--gistful-pl-smi);
}

.gistful .pl-ent {
	color: var(--gistful-pl-ent);
}

.gistful .pl-k {
	color: var(--gistful-pl-k);
}

.gistful .pl-s,
.gistful .pl-pds,
.gistful .pl-s .pl-pse .pl-s1,
.gistful .pl-sr,
.gistful .pl-sr .pl-sre,
.gistful .pl-sr .pl-sra {
	color: var(--gistful-pl-s);
}

.gistful .pl-v,
.gistful .pl-smw {
	color: var(--gistful-pl-v);
}

.gistful .pl-bu {
	color: var(--gistful-pl-bu);
}

.gistful .pl-ii {
	background-color: var(--gistful-pl-ii-bg);
	color: var(--gistful-pl-ii-fg);
}

.gistful .pl-c2 {
	background-color: var(--gistful-pl-c2-bg);
	color: var(--gistful-pl-c2-fg);
}

.gistful .pl-c2::before {
	content: "^M";
}

/* Escapes inside a regular expression. */
.gistful .pl-sr .pl-cce {
	color: var(--gistful-pl-ent);
	font-weight: 700;
}

/* Markdown and diff tokens. */
.gistful .pl-ml {
	color: var(--gistful-pl-ml);
}

.gistful .pl-mh,
.gistful .pl-mh .pl-en,
.gistful .pl-ms {
	color: var(--gistful-pl-mh);
	font-weight: 700;
}

.gistful .pl-mi {
	color: var(--gistful-fg);
	font-style: italic;
}

.gistful .pl-mb {
	color: var(--gistful-fg);
	font-weight: 700;
}

.gistful .pl-md {
	background-color: var(--gistful-pl-md-bg);
	color: var(--gistful-pl-md-fg);
}

.gistful .pl-mi1 {
	background-color: var(--gistful-pl-mi1-bg);
	color: var(--gistful-pl-mi1-fg);
}

.gistful .pl-mc {
	background-color: var(--gistful-pl-mc-bg);
	color: var(--gistful-pl-mc-fg);
}

.gistful .pl-mi2 {
	background-color: var(--gistful-pl-mi2-bg);
	color: var(--gistful-pl-mi2-fg);
}

.gistful .pl-mdr {
	color: var(--gistful-pl-mdr);
	font-weight: 700;
}

.gistful .pl-ba {
	color: var(--gistful-pl-ba);
}

.gistful .pl-sg {
	color: var(--gistful-pl-sg);
}

.gistful .pl-corl {
	color: var(--gistful-pl-s);
	text-decoration: underline;
}

/* Copy buttons (added by assets/js/copy.js when the gist has data-copy="1"). */
.gistful .gistful-copy-bar {
	display: flex;
	justify-content: flex-end;
	padding: 4px 8px;
	border-bottom: 1px solid var(--gistful-border);
	background: var(--gistful-meta-bg);
}

.gistful .gistful-copy-bar--all {
	margin-bottom: 6px;
	padding: 0;
	border: 0;
	background: transparent;
}

.gistful .gistful-copy {
	margin: 0;
	padding: 2px 10px;
	border: 1px solid var(--gistful-border);
	border-radius: 6px;
	background: var(--gistful-bg);
	color: var(--gistful-link);
	font: 600 12px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	cursor: pointer;
}

.gistful .gistful-copy:hover {
	border-color: var(--gistful-link);
}

.gistful .gistful-copy:focus-visible {
	outline: 2px solid var(--gistful-link);
	outline-offset: 1px;
}

.gistful .gistful-copy[data-state="failed"] {
	color: var(--gistful-pl-k);
}

.gistful .gistful-copy-status {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.gistful .gist-meta {
	padding: 10px;
	border-top: 1px solid var(--gistful-border);
	background: var(--gistful-meta-bg);
	color: var(--gistful-meta-fg);
	font: 12px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.gistful .gist-meta a {
	color: var(--gistful-link);
	font-weight: 600;
	text-decoration: none;
}

.gistful .gist-meta a:hover {
	text-decoration: underline;
}

.gistful .gistful-unsupported {
	margin-bottom: 1em;
	padding: 10px 12px;
	border: 1px solid var(--gistful-border);
	border-radius: 6px;
	background: var(--gistful-meta-bg);
	color: var(--gistful-meta-fg);
}

.gistful .gistful-unsupported__name {
	color: var(--gistful-fg);
	font-weight: 600;
}

.gistful .gistful-unsupported a {
	color: var(--gistful-link);
}
