/* k9s, stock skin. The colours are the named ones its skin file uses. */

:root {
	--bg: #000000;
	--fg: #1e90ff;          /* dodgerblue */
	--label: #ffa500;       /* orange */
	--white: #ffffff;
	--num: #ff00ff;         /* fuchsia */
	--aqua: #00ffff;
	--papaya: #ffefd5;      /* papayawhip */
	--steel: #4682b4;       /* steelblue */
	--done: #808080;
	--modify: #adff2f;      /* greenyellow */
	--new: #87cefa;         /* lightskyblue */
	--err: #ff4500;         /* orangered */
	--cadet: #5f9ea0;       /* cadetblue */
}

/* :skin <name> swaps the palette, k9s style. */
:root[data-skin=dracula] {
	--bg: #282a36; --fg: #bd93f9; --label: #ffb86c; --white: #f8f8f2; --num: #ff79c6; --aqua: #8be9fd;
	--papaya: #f1fa8c; --steel: #6272a4; --done: #6272a4; --modify: #50fa7b; --new: #8be9fd; --err: #ff5555; --cadet: #6272a4;
}
:root[data-skin=gruvbox] {
	--bg: #282828; --fg: #83a598; --label: #fe8019; --white: #ebdbb2; --num: #d3869b; --aqua: #8ec07c;
	--papaya: #fabd2f; --steel: #458588; --done: #928374; --modify: #b8bb26; --new: #83a598; --err: #fb4934; --cadet: #689d6a;
}
:root[data-skin=solarized] {
	--bg: #002b36; --fg: #268bd2; --label: #cb4b16; --white: #eee8d5; --num: #d33682; --aqua: #2aa198;
	--papaya: #b58900; --steel: #268bd2; --done: #586e75; --modify: #859900; --new: #6c71c4; --err: #dc322f; --cadet: #93a1a1;
}
:root[data-skin=nord] {
	--bg: #2e3440; --fg: #81a1c1; --label: #d08770; --white: #eceff4; --num: #b48ead; --aqua: #88c0d0;
	--papaya: #ebcb8b; --steel: #5e81ac; --done: #4c566a; --modify: #a3be8c; --new: #8fbcbb; --err: #bf616a; --cadet: #81a1c1;
}

* { box-sizing: border-box; }

html, body { margin: 0; background: var(--bg); }

body {
	color: var(--fg);
	font: 14px/1.4 "JetBrains Mono", "DejaVu Sans Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

a { color: inherit; }
pre { margin: 0; font: inherit; }

.k9s {
	display: grid;
	grid-template-rows: auto auto 1fr auto;
	height: 100vh;
	padding: 6px 10px 4px;
}
/* Fixed rows, so the hidden prompt does not shift the frame up a slot */
.top { grid-row: 1; }
.prompt { grid-row: 2; }
.frame { grid-row: 3; }
.bottom { grid-row: 4; }

/* Header: cluster info, key hints, logo */
.top {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 0 4ch;
	align-items: start;
	margin-bottom: 8px;
}
.info { display: grid; grid-template-columns: auto auto; gap: 0 1ch; margin: 0; }
.info dt { color: var(--label); }
.info dd { margin: 0; color: var(--white); white-space: nowrap; }
.menu { display: flex; gap: 0 4ch; }
.menu > div { display: flex; flex-direction: column; }
.menu a, .menu span { color: var(--white); text-decoration: none; white-space: nowrap; }
.menu a:hover { color: var(--aqua); }
.menu .num { color: var(--num); font-weight: normal; }
.menu .key { color: var(--fg); font-weight: normal; }
.logo { color: var(--label); text-decoration: none; line-height: 1.15; }
.logo:hover { color: #ffb733; }

/* The command and filter prompt */
.prompt {
	display: flex;
	gap: 1ch;
	align-items: center;
	margin-bottom: 6px;
	padding: 1px 1ch;
	border: 1px solid var(--fg);
	color: var(--cadet);
}
.prompt[hidden] { display: none; }
.prompt .mode { color: var(--fg); }
.prompt input {
	flex: 1;
	border: 0;
	outline: 0;
	background: transparent;
	color: var(--cadet);
	font: inherit;
	caret-color: var(--aqua);
}

/* The view frame with its title set into the top border */
.frame {
	position: relative;
	min-height: 0;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--fg);
	padding: 10px 1ch 4px;
}
.frame:focus-within, .frame:hover { border-color: var(--aqua); }
.frame-title {
	position: absolute;
	top: -0.75em;
	left: 50%;
	transform: translateX(-50%);
	margin: 0;
	padding: 0 1ch;
	background: var(--bg);
	font: inherit;
	white-space: nowrap;
}
.f-name { color: var(--aqua); }
.f-ns { color: var(--num); }
.f-count { color: var(--papaya); }
.view { flex: 1; min-height: 0; overflow: auto; outline: 0; }

/* Resource tables */
.k-table { width: 100%; border-collapse: collapse; }
.k-table th {
	padding: 0 1ch;
	text-align: left;
	color: var(--white);
	font-weight: bold;
	white-space: nowrap;
}
.k-table .sort { color: var(--label); }
.k-table td { padding: 0 1ch; white-space: nowrap; }
.k-table tbody tr { position: relative; color: var(--aqua); }
.k-table td a { text-decoration: none; }
.k-table td:first-child a::after { content: ""; position: absolute; inset: 0; }
.k-table tr.st-done { color: var(--done); }
.k-table tr.st-pend { color: var(--modify); }
.k-table tr.st-new { color: var(--new); }
.k-table tbody tr:hover, .k-table tbody tr.cursor { background: var(--aqua); color: var(--bg); }
.k-table tr.st-done.cursor, .k-table tr.st-done:hover { background: var(--done); }
.k-table tr.st-pend.cursor, .k-table tr.st-pend:hover { background: var(--modify); }
.k-table tr.st-new.cursor, .k-table tr.st-new:hover { background: var(--new); }

/* describe and yaml views */
.describe { white-space: pre-wrap; color: var(--papaya); }
.y-key { color: var(--steel); }
.y-val { color: var(--papaya); }
.y-dash { color: var(--white); }
.y-none { color: var(--done); }
.describe a { color: var(--fg); }

/* logs view, for blog posts */
.logs { max-width: 100ch; color: var(--white); }
.logs p { margin: 0 0 1em; }
.logs .log-head { color: var(--done); }
.logs .log-head b { color: var(--aqua); font-weight: normal; }
.logs .lede { color: var(--papaya); }
.logs h1, .logs h2, .logs h3 { margin: 1.4em 0 .5em; font-size: 1em; color: var(--aqua); }
.logs h1::before, .logs h2::before, .logs h3::before { content: "# "; color: var(--done); }
.logs strong { color: var(--papaya); }
.logs a { color: var(--fg); }
.logs code { color: var(--papaya); }
.logs pre { margin: 0 0 1em; padding-left: 2ch; border-left: 1px solid var(--done); color: var(--papaya); overflow-x: auto; }
.logs img { display: block; max-width: min(100%, 60ch); height: auto; margin: .5em 0 1em; border: 1px solid var(--done); }
.logs ul, .logs ol { margin: 0 0 1em; padding-left: 3ch; }
.logs blockquote { margin: 0 0 1em; padding-left: 2ch; border-left: 1px solid var(--done); color: var(--papaya); }
.logs hr { border: 0; border-top: 1px dashed var(--done); }
.logs + .describe { margin-top: 1em; }

.foot-note { color: var(--done); }
.foot-note a { color: var(--fg); }
.flash-err { color: var(--err); }
.flash.warn { color: var(--label); }

/* xray, events, logs, pulses */
.xray { color: var(--done); }
.xray a { color: var(--aqua); text-decoration: none; }
.xray a:hover { text-decoration: underline; }
.x-root { color: var(--label); }
.x-kind { color: var(--white); }
.x-leaf { color: var(--done); }
.xray .st-run { color: var(--aqua); }
.xray .st-pend { color: var(--modify); }
.xray .st-new { color: var(--new); }
.xray .st-done { color: var(--done); }
.k-table td.wrap { white-space: normal; }
.k-table tr.ev-warn { color: var(--label); }
.k-table tr.ev-warn.cursor, .k-table tr.ev-warn:hover { background: var(--label); }
.logstream { color: var(--white); white-space: pre-wrap; }
.logstream .ts { color: var(--done); }
.logstream .sha { color: var(--label); }
.pulse { margin-bottom: 1.2em; }
.pulse-head { margin: 0 0 .2em; color: var(--white); }
.pulse pre { line-height: 1.05; color: var(--aqua); }
.p-mem pre { color: var(--num); }
.p-cpu-gaming-pc pre { color: var(--modify); }
.p-cpu-raspberrypi pre { color: var(--new); }
.p-cpu-optiplex-7040 pre { color: var(--papaya); }
.axis { color: var(--done); }
.k-table tr.st-err { color: var(--err); }
.k-table tr.st-err.cursor, .k-table tr.st-err:hover { background: var(--err); }
.k-table td.spark { letter-spacing: -0.05em; }
.p-bench pre { color: var(--modify); }

/* Dialogs: help, delete and the shell */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1rem; background: rgba(0, 0, 0, .55); }
.dialog {
	position: relative;
	min-width: min(44ch, 100%);
	max-width: min(96ch, 100%);
	max-height: 90vh;
	overflow: auto;
	padding: 14px 2ch 10px;
	border: 1px solid var(--aqua);
	background: var(--bg);
	color: var(--white);
}
.dialog-title {
	position: sticky;
	top: -14px;
	margin: -14px auto 8px;
	width: fit-content;
	padding: 0 1ch;
	background: var(--bg);
	color: var(--aqua);
	font: inherit;
}
.help-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 0 4ch; }
.help-grid h3 { margin: 0 0 .3em; font: inherit; color: var(--label); }
.help-grid p { margin: 0; white-space: nowrap; }
.help .num { color: var(--num); font-weight: normal; }
.help .key { color: var(--fg); font-weight: normal; }
.confirm p { margin: .4em 0; text-align: center; }
.confirm .buttons { display: flex; gap: 2ch; justify-content: center; margin-top: .8em; }
.confirm button {
	padding: 0 2ch;
	border: 0;
	background: var(--fg);
	color: var(--bg);
	font: inherit;
	cursor: pointer;
}
.confirm button:focus, .confirm button:hover { background: var(--label); outline: 0; }
.shell { width: min(96ch, 100%); }
.shell-out { min-height: 14em; max-height: 60vh; overflow-y: auto; white-space: pre-wrap; }
.shell-out .echo { color: var(--white); }
.shell-out .dim { color: var(--done); }
.shell-out .err { color: var(--err); }
.shell-out .ok, .shell-out .dir { color: var(--aqua); }
.shell-out .yaml { color: var(--papaya); }
.shell-out .fetch { color: var(--label); }
.shell-line { display: flex; margin: .2em 0 0; }
.ps1 { color: var(--modify); white-space: pre; }
.shell-line input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--white); font: inherit; caret-color: var(--aqua); }
.art { margin: 4px 0 18px; color: var(--label); line-height: 1.15; overflow-x: auto; }

/* Crumbs and flash line */
.bottom { display: flex; justify-content: space-between; gap: 2ch; margin-top: 4px; }
.crumb { margin-right: 1ch; padding: 0 1ch; background: var(--aqua); color: var(--bg); }
.crumb.active { background: var(--label); }
.flash { color: var(--done); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flash.err { color: var(--err); }

@media (max-width: 900px) {
	.logo { display: none; }
	.top { grid-template-columns: auto 1fr; }
}

@media (max-width: 640px) {
	body { font-size: 12px; }
	.k9s { height: auto; min-height: 100vh; }
	.top { grid-template-columns: 1fr; gap: 8px; }
	.menu > div:last-child { display: none; }
	.view { overflow: visible; overflow-x: auto; }
}
