/*
 * WordPress Syntax Highlighter (wpshl).
 *
 * Every colour and size is a custom property, written into the page from
 * Settings > Syntax Highlighter. The values here are only what is used if that
 * somehow goes missing.
 *
 * WHAT HOLDS WHAT. The outermost element -- the <pre>, or the .wsh-box around it
 * when there is a header -- is the FRAME: it carries the background colour, the
 * picture and the rounded corners, and it never scrolls. The <code> inside is the
 * only thing that scrolls. That is why the picture stays still while the text
 * moves over it, and why the language label stays in its corner.
 */

.wsh,
.wsh-box,
.wsh-tabs {
	--wsh-bg: #000f30;
	--wsh-veil: #ffffff;
	--wsh-text: #ffffff;
	--wsh-shadow: #18aaed;
	--wsh-comment: #8fb2d9;
	--wsh-keyword: #ffffff;
	--wsh-type: #a9d6ff;
	--wsh-function: #dcefff;
	--wsh-word: #dcefff;
	--wsh-meta: #9ccaf2;
	--wsh-string: #c4f0ff;
	--wsh-number: #b9dcff;
	--wsh-constant: #eaf6ff;
	--wsh-variable: #cfe4fa;
	--wsh-operator: #ffffff;
	--wsh-punctuation: #ffffff;
	--wsh-tab: 4;
	--wsh-title-size: 22px;
	--wsh-desc-indent: 4em;
	--wsh-max-height: none;
	--wsh-pad: 20px;
	--wsh-edge: 3px;
	--wsh-border: #18aaed;
	--wsh-keyword-weight: 700;
	--wsh-text-shadow: none;
	--wsh-image: none;
	--wsh-scrim: none;
	--wsh-image-min: 600px;
	--wsh-on-text: #000f30;
	--wsh-rule: rgba(255, 255, 255, 0.35);
	--wsh-tint: rgba(255, 255, 255, 0.16);
	--wsh-tabs-hover: rgba(255, 255, 255, 0.34);
	--wsh-tabline-idle: #4d576e;
	--wsh-tabline-hover: #2e3a55;
}

/*
 * The frame. Two background layers over the colour: the overlay (--wsh-scrim)
 * on top, the picture under it. The picture is as wide as the frame but never
 * narrower than --wsh-image-min, and it is pinned to the BOTTOM: a block taller
 * than the picture shows the background colour above it, which the picture's own
 * top edge fades into.
 */
pre.wsh,
pre.wp-block-code.wsh,
.wsh-box {
	border: 0;
	border-radius: 6px;
	background-color: var(--wsh-bg);
	background-image: var(--wsh-scrim), var(--wsh-image);
	background-repeat: no-repeat;
	background-position: center bottom;
	background-size: 100% 100%, max(100%, var(--wsh-image-min)) auto;
	color: var(--wsh-text);
	text-shadow: var(--wsh-text-shadow);
	/* The window's edge: down the left and along the bottom only, so it seems to
	   stand out of the page. A hard shadow rather than a border, because a border
	   on two sides of a rounded box tapers away to nothing at its corners. */
	box-shadow: calc(var(--wsh-edge) * -1) var(--wsh-edge) 0 0 var(--wsh-border);
}

/* under a header, the box is the frame and the <pre> is only a holder */
.wsh-box > pre.wsh,
.wsh-box > pre.wp-block-code.wsh {
	margin: 0;
	border-radius: 0 0 6px 6px;
	background: none;
	box-shadow: none;
}

/*
 * !important, here and on the <code> below, is deliberate. Nearly every theme has
 * rules of its own for "pre" and "code inside a post" -- no padding, a grey
 * background, a smaller font -- and they load after this file, so they win any
 * tie. These few properties are the STRUCTURE of the box; the colours are not
 * marked, and stay the settings' to decide.
 */
pre.wsh,
pre.wp-block-code.wsh {
	position: relative;
	margin-left: 0;
	margin-right: 0;
	padding: 0 !important;
	overflow: visible !important;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
	line-height: 1.55;
	text-align: left;
	direction: ltr;
	-moz-tab-size: var(--wsh-tab);
	tab-size: var(--wsh-tab);
	-webkit-hyphens: none;
	hyphens: none;
}

/* The one thing that scrolls: up and down always, sideways only if lines are not wrapped. */
pre.wsh > code,
pre.wp-block-code.wsh > code {
	display: block !important;
	box-sizing: border-box;
	max-height: var(--wsh-max-height);
	margin: 0 !important;
	padding: var(--wsh-pad) !important;
	border: 0 !important;
	border-radius: inherit;
	overflow-x: auto;
	overflow-y: auto;
	background-color: transparent !important;
	box-shadow: none !important;
	color: inherit;
	font: inherit !important;
	text-shadow: inherit;
	white-space: pre;
	word-break: normal;
	overflow-wrap: normal;
	word-wrap: normal;
	scrollbar-width: thin;
	scrollbar-color: var(--wsh-rule) transparent;
}

/* A long line carries on below itself, and there is nothing to scroll sideways to. */
pre.wsh.wsh-wrap > code,
pre.wp-block-code.wsh.wsh-wrap > code {
	overflow-x: hidden !important;
	white-space: pre-wrap !important;
	overflow-wrap: anywhere !important;
}

pre.wsh > code::-webkit-scrollbar {
	width: 8px;
	height: 8px;
	background: transparent;
}

pre.wsh > code::-webkit-scrollbar-thumb {
	border-radius: 4px;
	background: var(--wsh-rule);
}

/* The language's name, in the corner (when there is no header to put it in). */
pre.wsh.wsh-labelled[data-wsh-label]::before {
	content: attr(data-wsh-label);
	position: absolute;
	top: 0;
	right: 0;
	z-index: 1;
	padding: 0.2em 0.75em;
	border-radius: 0 6px 0 6px;
	background: var(--wsh-tint);
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0.04em;
	pointer-events: none;
	-webkit-user-select: none;
	user-select: none;
}

/*
 * Line numbers are drawn by CSS, so they are never part of what gets copied.
 * They sit in the <code>'s left padding, OUT of the flow of the text: a number
 * that took up room on the line would shift every tab stop on it. A wrapped line
 * has one number, beside its first row.
 *
 * The rule between numbers and code is a background on the <code>, not a border
 * on each number: it runs the full height whatever wraps, and like the picture it
 * stays put while the code scrolls.
 */
pre.wsh.wsh-numbered > code,
pre.wp-block-code.wsh.wsh-numbered > code {
	position: relative;
	/* the space around the code, then the numbers, then the rule, then the code */
	padding-left: calc(var(--wsh-pad) + 3.4em) !important;
	counter-reset: wsh-line;
	background-image: linear-gradient(var(--wsh-rule), var(--wsh-rule)) !important;
	background-repeat: no-repeat !important;
	background-position: calc(var(--wsh-pad) + 2.5em) 0 !important;
	background-size: 1px 100% !important;
}

pre.wsh.wsh-numbered .wsh-line::before {
	counter-increment: wsh-line;
	content: counter(wsh-line);
	position: absolute;
	left: 0;
	box-sizing: content-box;
	width: calc(var(--wsh-pad) + 1.85em);
	color: var(--wsh-text);
	font-weight: 400;
	font-style: normal;
	text-align: right;
	opacity: 0.6;
	-webkit-user-select: none;
	user-select: none;
}

/*
 * SELECTED TEXT. A browser's own highlight is a blue, and over a blue picture, behind
 * white letters, it cannot be seen: a reader dragging over a few lines to copy them
 * saw nothing happen. So the window has a highlight of its own: a slab of the TEXT
 * colour, the letters in the colour worked out to stand out from it (--wsh-on-text,
 * the Download button's two colours), and no shadow. It shows on any picture and in
 * every look. Every part inside the window is named (*), because a part's own
 * colour and shadow would otherwise win over what it inherits.
 */
pre.wsh::selection,
pre.wsh *::selection,
.wsh-box .wsh-header *::selection,
.wsh-box .wsh-footer *::selection,
.wsh-tabs .wsh-tab::selection {
	background-color: var(--wsh-text);
	color: var(--wsh-on-text);
	text-shadow: none;
}

/*
 * The parts of the code. `.wpshl-paint` is the editor's picture of the code, which
 * is the same HTML. The COLOUR OF EACH PART'S SHADOW is not here: it differs by
 * language, and is written into the page by WSH_Settings::shadow_css().
 */
.wsh .wsh-comment,
.wpshl-paint .wsh-comment { color: var(--wsh-comment); font-style: italic; }
.wsh .wsh-keyword,
.wpshl-paint .wsh-keyword { color: var(--wsh-keyword); font-weight: var(--wsh-keyword-weight); }
.wsh .wsh-type,
.wpshl-paint .wsh-type { color: var(--wsh-type); }
.wsh .wsh-function,
.wpshl-paint .wsh-function { color: var(--wsh-function); }
.wsh .wsh-word,
.wpshl-paint .wsh-word { color: var(--wsh-word); }
.wsh .wsh-meta,
.wpshl-paint .wsh-meta { color: var(--wsh-meta); }
.wsh .wsh-string,
.wpshl-paint .wsh-string { color: var(--wsh-string); }
.wsh .wsh-number,
.wpshl-paint .wsh-number { color: var(--wsh-number); }
.wsh .wsh-constant,
.wpshl-paint .wsh-constant { color: var(--wsh-constant); }
.wsh .wsh-variable,
.wpshl-paint .wsh-variable { color: var(--wsh-variable); }
.wsh .wsh-operator,
.wpshl-paint .wsh-operator { color: var(--wsh-operator); }
.wsh .wsh-punctuation,
.wpshl-paint .wsh-punctuation { color: var(--wsh-punctuation); }

/*
 * A block with a title, a description or a download link is wrapped in a box,
 * and the header sits on top of the <pre>:
 *
 *     .wsh-box > .wsh-header > .wsh-header-top > .wsh-title
 *                                              > .wsh-header-side > .wsh-langname, a.wsh-download
 *                            > .wsh-description
 *              > pre.wsh
 *
 * The header's words are in the site's own font; only the code is monospace.
 */
/* No band of colour and no line under it: the header is simply the top of the window. */
.wsh-box > .wsh-header {
	padding: var(--wsh-pad) var(--wsh-pad) 0;
	border: 0;
	background: none;
	line-height: 1.35;
	text-align: left;
}

.wsh-box .wsh-header-top {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4em 1em;
}

.wsh-box .wsh-title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: var(--wsh-title-size);
	font-weight: 700;
	overflow-wrap: anywhere;
}

.wsh-box .wsh-header-side {
	display: flex;
	/* on a phone the name and the two buttons are wider than the window: they go onto a
	   second row, to the right, rather than out through the window's side */
	flex-wrap: wrap;
	justify-content: flex-end;
	align-items: center;
	gap: 0.5em 0.8em;
	margin-left: auto;
}

.wsh-box .wsh-langname {
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

/*
 * The two buttons. !important throughout, as with the box's structure: themes
 * style every link and every <button> in a post -- their own colours, padding,
 * capitals, shadows -- and a button that takes on the theme's white-on-white is
 * a button nobody can see.
 *
 * Download is a slab of the text colour; its words are --wsh-on-text, worked out
 * to stand out from it.
 */
.wsh-box a.wsh-download,
.wsh-box a.wsh-download:visited {
	display: inline-block !important;
	margin: 0 !important;
	padding: 0.35em 0.9em !important;
	border: 1px solid var(--wsh-text) !important;
	border-radius: 999px !important;
	background: var(--wsh-text) !important;
	color: var(--wsh-on-text) !important;
	font-size: 0.8em !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	text-decoration: none !important;
	text-shadow: none !important;
	white-space: nowrap;
	box-shadow: none !important;
	opacity: 1;
}

.wsh-box a.wsh-download:hover,
.wsh-box a.wsh-download:focus {
	color: var(--wsh-on-text) !important;
	text-decoration: none !important;
	opacity: 0.85;
}

/* A Download made by copy.js needs copy.js: like the copy button, it is not offered without it. */
.wsh-box a.wsh-download.wsh-download-made,
.wsh-box a.wsh-download.wsh-download-made:visited {
	display: none !important;
}

.wsh-js .wsh-box a.wsh-download.wsh-download-made,
.wsh-js .wsh-box a.wsh-download.wsh-download-made:visited {
	display: inline-block !important;
}

/*
 * COPY TO CLIPBOARD: the text colour (pure white, in the blue looks) inside a
 * border of the same, on nothing. It needs copy.js, so it is shown only once that
 * script has run and marked the page (html.wsh-js).
 */
.wsh-box .wsh-copy {
	display: none !important;
}

.wsh-js .wsh-box .wsh-copy {
	display: inline-block !important;
	width: auto !important;
	min-width: 0 !important;
	min-height: 0 !important;
	margin: 0 !important;
	padding: 0.35em 0.9em !important;
	border: 1px solid var(--wsh-text) !important;
	border-radius: 4px !important;
	background: transparent !important;
	color: var(--wsh-text) !important;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif !important;
	font-size: 0.75em !important;
	font-weight: 600 !important;
	line-height: 1.4 !important;
	letter-spacing: 0.06em !important;
	text-transform: none !important;
	text-decoration: none !important;
	text-shadow: inherit;
	white-space: nowrap;
	box-shadow: none !important;
	cursor: pointer;
	opacity: 1 !important;
}

.wsh-js .wsh-box .wsh-copy:hover,
.wsh-js .wsh-box .wsh-copy:focus {
	background: var(--wsh-tabs-hover) !important;
	color: var(--wsh-text) !important;
}

.wsh-js .wsh-box .wsh-copy:focus-visible {
	outline: 2px solid var(--wsh-text);
	outline-offset: 2px;
}

/* the foot of the window, for the copy button in the very bottom right: a row ON the window, not a bar */
.wsh-box > .wsh-footer {
	display: none;
}

.wsh-js .wsh-box > .wsh-footer {
	display: flex;
	justify-content: flex-end;
	padding: 0 var(--wsh-pad) var(--wsh-pad);
	border: 0;
	background: none;
}

/*
 * THE FOOT THAT REPEATS THE TOP (.wsh-footer-full): the same row as the header's --
 * the file's name, the language's name, Download, the copy button -- with the
 * description ABOVE it, so that the two ends of the window mirror each other and
 * the copy button is still in the very bottom right. It is made of the header's own
 * parts, so it looks the same without a rule of its own. Unlike the foot that is
 * only a copy button, it has things to say with scripts off, and is always shown.
 */
.wsh-box > .wsh-footer.wsh-footer-full,
.wsh-js .wsh-box > .wsh-footer.wsh-footer-full {
	display: block;
	padding: 0 var(--wsh-pad) var(--wsh-pad);
	line-height: 1.35;
	text-align: left;
}

.wsh-box > .wsh-footer-full > .wsh-description {
	margin: 0 0 0.3em;
}

/* with a bar under it, the <pre> has no corners of its own to round; with none over it, it has the top ones */
.wsh-box > pre.wsh:not(:last-child) {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
}

.wsh-box > pre.wsh:first-child {
	border-top-left-radius: 6px;
	border-top-right-radius: 6px;
}

.wsh-box a.wsh-download:focus-visible {
	outline: 2px solid var(--wsh-text);
	outline-offset: 2px;
}

.wsh-box .wsh-description {
	margin-top: 0.3em;
	padding-left: var(--wsh-desc-indent);
	font-size: 0.95em;
	font-style: italic;
	overflow-wrap: anywhere;
}

/* no title above it: the description starts the header, and needs no gap */
.wsh-box .wsh-header > .wsh-description:first-child {
	margin-top: 0;
}

/*
 * TABS: several windows in one place, like a terminal's. No JavaScript: each tab
 * is a <label> for a hidden radio button, and the panel whose radio is checked is
 * the one shown.
 *
 *     .wsh-tabs > input.wsh-tab-radio (one per tab)
 *               > .wsh-tablist   > label.wsh-tab (one per tab)
 *               > .wsh-tabpanels > .wsh-tabpanel (one per tab) > .wsh-box or pre.wsh
 *
 * THE LINE OF TABS IS ABOVE THE WINDOW AND OUTSIDE IT -- by the author's order, and
 * the one thing besides the window's edge that is. It is exactly as wide as the
 * window, because the line and the window both fill .wsh-tabs. There are two ways
 * of it, chosen in the settings: EVERY NAME IN FULL, the tabs running on to as many
 * lines as that takes (.wsh-tabs-lines, further down); or ONE line, on which the
 * tabs narrow to fit and a name too long for its tab ends in "...".
 *
 * The rules that switch tabs are one per tab. The first sixteen are here; a window
 * with more has the rest written beside it by WSH_Plugin::tab_rules().
 *
 * Each panel holds a WHOLE window, frame and all: its own picture, edge, names and
 * buttons. .wsh-tabs is only what holds them, and has no look of its own.
 *
 * The tabs stand on the PAGE, whatever colour that is, so they are solid: the
 * chosen one the window's own background colour, so that it reads as part of the
 * window, the others that colour with the overlay colour stirred in
 * (--wsh-tabline-*, worked out by WSH_Settings::css()).
 */
.wsh-tabs {
	position: relative;
}

.wsh-tabs > .wsh-tabpanels > .wsh-tabpanel > .wsh-box,
.wsh-tabs > .wsh-tabpanels > .wsh-tabpanel > pre.wsh,
.wsh-tabs > .wsh-tabpanels > .wsh-tabpanel > pre.wp-block-code.wsh {
	/* a theme's margin above a <pre> would part the window from its tabs */
	margin: 0 !important;
	/* the first tab stands on this corner */
	border-top-left-radius: 0;
}

/* hidden from the eye, but still there for the keyboard: arrow keys change tab */
.wsh-tabs > .wsh-tab-radio {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

/*
 * ONE LINE, SHARED FAIRLY. A grid of one row, a column per tab, each column
 * `minmax(0, max-content)`: the line's width is dealt out to the tabs in equal
 * shares, and a tab stops taking once its whole name fits. So short names stay
 * whole, and only a name that wants more than its fair share is cut short with
 * "..." -- one long name cannot squeeze the others, as it would in a flex row,
 * where everything gives way in proportion.
 *
 * !important on what makes it one line: themes have rules for every <label> in a post.
 */
.wsh-tabs > .wsh-tablist {
	display: grid !important;
	grid-auto-flow: column !important;
	grid-auto-columns: minmax(0, max-content) !important;
	grid-template-columns: none !important;
	grid-template-rows: auto !important;
	justify-content: start !important;
	gap: 3px;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	background: none;
	overflow: hidden;
}

/* Skinny letters, but big ones: a narrow face where the reader has one, squeezed where it can be. */
.wsh-tabs .wsh-tab {
	display: block !important;
	box-sizing: border-box;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	margin: 0 !important;
	/* Padding cannot give way when the line is crowded, so little of the room either
	   side of a name is padding: most of it is the two spacers below, which can. */
	padding: 0.4em 0.3em 0.45em !important;
	border: 0 !important;
	border-radius: 6px 6px 0 0;
	background: var(--wsh-tabline-idle);
	color: var(--wsh-text);
	text-shadow: var(--wsh-text-shadow);
	font-family: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue Condensed", "Avenir Next Condensed", sans-serif-condensed, Arial, Helvetica, sans-serif;
	font-stretch: condensed;
	font-size: 1.3em;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-align: left;
	text-transform: none;
	overflow: hidden !important;
	text-overflow: ellipsis;
	white-space: nowrap !important;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
	transition: background-color 0.12s;
}

.wsh-tabs .wsh-tab::before,
.wsh-tabs .wsh-tab::after {
	content: "";
	display: inline-block;
	width: 0.7em;
}

.wsh-tabs .wsh-tab:hover {
	background: var(--wsh-tabline-hover);
}

/*
 * EVERY NAME IN FULL (the settings' "Every tab says its whole name"). Nothing here
 * works out how wide a name is: a tab is as wide as its name because the browser
 * measures the name, in whatever font the reader has, and a line that is full is
 * followed by another. Each full line is stretched to the window's width, so the
 * tabs stand as a block exactly as wide as the window; the last line is not
 * stretched (the ::after takes its spare room), so two left-over tabs do not become
 * two slabs. A window with few tabs looks as it always did.
 *
 * The room between lines is each tab's margin, not the line's gap: when the last
 * line is full to the pixel the ::after goes on to a line of its own, of no height,
 * and a gap above THAT would part the tabs from the window.
 *
 * Only a name wider than the whole window is still cut short.
 */
.wsh-tabs.wsh-tabs-lines > .wsh-tablist {
	display: flex !important;
	flex-flow: row wrap !important;
	justify-content: flex-start !important;
	align-items: stretch !important;
	gap: 0 3px;
}

.wsh-tabs.wsh-tabs-lines > .wsh-tablist::after {
	content: "";
	flex: 1000 1 0px;
}

.wsh-tabs.wsh-tabs-lines .wsh-tab {
	flex: 1 1 auto !important;
	max-width: 100% !important;
	margin-top: 3px !important;
}

/* A CROWD OF TABS (more than eight: WSH_Plugin::MANY_TABS) is a list to pick from more
   than it is a row of headings: smaller letters, closer together, so that the
   twenty-three licences of one page are three lines of tabs and not six. */
.wsh-tabs.wsh-tabs-lines.wsh-tabs-many .wsh-tab {
	padding: 0.4em 0.2em 0.45em !important;
	font-size: 1em;
}

.wsh-tabs.wsh-tabs-lines.wsh-tabs-many .wsh-tab::before,
.wsh-tabs.wsh-tabs-lines.wsh-tabs-many .wsh-tab::after {
	width: 0.45em;
}

.wsh-tabs .wsh-tabpanel {
	display: none;
}

.wsh-tab-radio:nth-of-type(1):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(1),
.wsh-tab-radio:nth-of-type(2):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(2),
.wsh-tab-radio:nth-of-type(3):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(3),
.wsh-tab-radio:nth-of-type(4):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(4),
.wsh-tab-radio:nth-of-type(5):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(5),
.wsh-tab-radio:nth-of-type(6):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(6),
.wsh-tab-radio:nth-of-type(7):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(7),
.wsh-tab-radio:nth-of-type(8):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(8),
.wsh-tab-radio:nth-of-type(9):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(9),
.wsh-tab-radio:nth-of-type(10):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(10),
.wsh-tab-radio:nth-of-type(11):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(11),
.wsh-tab-radio:nth-of-type(12):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(12),
.wsh-tab-radio:nth-of-type(13):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(13),
.wsh-tab-radio:nth-of-type(14):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(14),
.wsh-tab-radio:nth-of-type(15):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(15),
.wsh-tab-radio:nth-of-type(16):checked ~ .wsh-tabpanels > .wsh-tabpanel:nth-of-type(16) {
	display: block;
}

.wsh-tab-radio:nth-of-type(1):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(1),
.wsh-tab-radio:nth-of-type(2):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(2),
.wsh-tab-radio:nth-of-type(3):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(3),
.wsh-tab-radio:nth-of-type(4):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(4),
.wsh-tab-radio:nth-of-type(5):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(5),
.wsh-tab-radio:nth-of-type(6):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(6),
.wsh-tab-radio:nth-of-type(7):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(7),
.wsh-tab-radio:nth-of-type(8):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(8),
.wsh-tab-radio:nth-of-type(9):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(9),
.wsh-tab-radio:nth-of-type(10):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(10),
.wsh-tab-radio:nth-of-type(11):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(11),
.wsh-tab-radio:nth-of-type(12):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(12),
.wsh-tab-radio:nth-of-type(13):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(13),
.wsh-tab-radio:nth-of-type(14):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(14),
.wsh-tab-radio:nth-of-type(15):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(15),
.wsh-tab-radio:nth-of-type(16):checked ~ .wsh-tablist > .wsh-tab:nth-of-type(16) {
	/* the window's own colour, so that the tab is part of the window; a line of its edge colour along the top */
	background: var(--wsh-bg);
	box-shadow: inset 0 3px 0 var(--wsh-border);
	cursor: default;
}

.wsh-tab-radio:nth-of-type(1):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(1),
.wsh-tab-radio:nth-of-type(2):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(2),
.wsh-tab-radio:nth-of-type(3):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(3),
.wsh-tab-radio:nth-of-type(4):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(4),
.wsh-tab-radio:nth-of-type(5):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(5),
.wsh-tab-radio:nth-of-type(6):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(6),
.wsh-tab-radio:nth-of-type(7):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(7),
.wsh-tab-radio:nth-of-type(8):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(8),
.wsh-tab-radio:nth-of-type(9):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(9),
.wsh-tab-radio:nth-of-type(10):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(10),
.wsh-tab-radio:nth-of-type(11):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(11),
.wsh-tab-radio:nth-of-type(12):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(12),
.wsh-tab-radio:nth-of-type(13):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(13),
.wsh-tab-radio:nth-of-type(14):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(14),
.wsh-tab-radio:nth-of-type(15):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(15),
.wsh-tab-radio:nth-of-type(16):focus-visible ~ .wsh-tablist > .wsh-tab:nth-of-type(16) {
	outline: 2px solid var(--wsh-text);
	outline-offset: -4px;
}

/* Inside the editor the Code block is plain text, but it can wear the same frame. */
.editor-styles-wrapper pre.wp-block-code {
	border: 0;
	border-radius: 6px;
	background-color: var(--wsh-bg, #000f30);
	background-image: var(--wsh-scrim, none), var(--wsh-image, none);
	background-repeat: no-repeat;
	background-position: center bottom;
	background-size: 100% 100%, max(100%, var(--wsh-image-min, 600px)) auto;
	color: var(--wsh-text, #ffffff);
	text-shadow: var(--wsh-text-shadow, none);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;
	-moz-tab-size: var(--wsh-tab, 4);
	tab-size: var(--wsh-tab, 4);
	padding: var(--wsh-pad, 20px) !important;
	box-shadow: calc(var(--wsh-edge, 3px) * -1) var(--wsh-edge, 3px) 0 0 var(--wsh-border, #ace3f2);
	/* as on the page: no taller than this, scrolling up and down inside itself, never sideways */
	max-height: calc(var(--wsh-max-height, none) + 2.5em); /* "none" makes this invalid, which is no limit: right */
	overflow-x: hidden;
	overflow-y: auto;
	scrollbar-width: thin;
	scrollbar-color: var(--wsh-rule, rgba(255, 255, 255, 0.35)) transparent;
}

/*
 * WHAT IS DRAWN ON THE WINDOW, in the editor (editor.js). The rows are INSIDE the
 * <pre> that is the window, over its picture and within its padding; they have no
 * background, no border and no shadow of their own, so nothing of them can show
 * outside it. The <pre> is a column: the top row, the code, the bottom row.
 */
.editor-styles-wrapper pre.wp-block-code.wpshl-window {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > * {
	min-width: 0;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.4em 1em;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 16px;
	line-height: 1.35;
	white-space: normal;
	cursor: default;
	-webkit-user-select: none;
	user-select: none;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-row-top {
	grid-row: 1;
	margin-bottom: var(--wsh-pad, 20px);
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-row-bottom {
	grid-row: 3;
	justify-content: flex-end;
	margin-top: var(--wsh-pad, 20px);
}

/*
 * THE PAINT (editor.js). The text being typed and the highlighted picture of it
 * share one cell of the grid, so they lie exactly over each other, whatever is in
 * the rows above and below. For that they must be set in the same type and wrap at
 * the same places, which is why both are told everything, !important: a theme's
 * editor styles may have ideas about <code>.
 *
 * The picture is in front, and lets every click through to the text behind it.
 * While it is showing, the text itself is see-through -- there, to be typed in and
 * selected, with its caret -- and ONLY while it is showing: the rule hangs on
 * `.is-on`, which is set on the picture when it matches the text letter for letter.
 */
.editor-styles-wrapper pre.wp-block-code.wpshl-window > code,
.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint {
	grid-row: 2;
	grid-column: 1;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > code,
.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint > code {
	display: block !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	font: inherit !important;
	letter-spacing: normal !important;
	word-spacing: normal !important;
	text-indent: 0 !important;
	text-align: left !important;
	white-space: pre-wrap !important;
	overflow-wrap: anywhere !important;
	word-break: normal !important;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint {
	display: none;
	position: relative;
	z-index: 1;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	pointer-events: none;
	-webkit-user-select: none;
	user-select: none;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint.is-on {
	display: block;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint.is-on ~ code {
	color: transparent !important;
	text-shadow: none !important;
	caret-color: var(--wsh-text, #ffffff);
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint.is-on ~ code::selection,
.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-paint.is-on ~ code *::selection {
	color: transparent;
}

/*
 * SELECTED TEXT in the editor: the same highlight as on the page. The paint lies over
 * the text and knows nothing of what is selected under it, so while anything in the
 * window is selected the paint is taken off (editor.js, Paint) and it is the plain
 * text that is seen, highlighted; the colours come back when the selection is let go.
 */
.editor-styles-wrapper pre.wp-block-code.wpshl-window > code::selection,
.editor-styles-wrapper pre.wp-block-code.wpshl-window > code *::selection {
	background-color: var(--wsh-text, #ffffff);
	color: var(--wsh-on-text, #000f30);
	text-shadow: none;
}

.editor-styles-wrapper .wpshl-row-title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: var(--wsh-title-size, 22px);
	font-weight: 700;
	overflow-wrap: anywhere;
}

.editor-styles-wrapper .wpshl-row-side {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: flex-end;
	gap: 0.8em;
	margin-left: auto;
}

/* at the foot the description comes FIRST, above the row: the two ends of the window mirror each other */
.editor-styles-wrapper .wpshl-row-bottom > .wpshl-row-description {
	order: -1;
}

.editor-styles-wrapper .wpshl-row-description {
	flex: 0 0 100%;
	order: 3;
	box-sizing: border-box;
	padding-left: var(--wsh-desc-indent, 4em);
	font-size: 0.95em;
	font-style: italic;
	overflow-wrap: anywhere;
}

.editor-styles-wrapper .wpshl-pic-name {
	font-size: 0.85em;
	font-weight: 600;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.editor-styles-wrapper .wpshl-pic-download {
	padding: 0.35em 0.9em;
	border: 1px solid var(--wsh-text, #ffffff);
	border-radius: 999px;
	background: var(--wsh-text, #ffffff);
	color: var(--wsh-on-text, #000f30);
	font-size: 0.8em;
	font-weight: 600;
	line-height: 1.4;
	text-shadow: none;
	white-space: nowrap;
}

.editor-styles-wrapper .wpshl-pic-copy {
	padding: 0.35em 0.9em;
	border: 1px solid var(--wsh-text, #ffffff);
	border-radius: 4px;
	font-size: 0.75em;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.06em;
	white-space: nowrap;
}

/*
 * THE TABS WINDOW WHILE IT IS BEING EDITED looks and works as it does on the page
 * (editor.js, "wpshl tabs"): the line of tabs above the window, the chosen tab's
 * window under it, the others hidden. The line is INSIDE the block's own element,
 * so a theme sizes it with the window; the block itself is only what holds them,
 * and has no look of its own. NEW TAB stands at the end of the line; it is a
 * button of the editor's and no part of what is saved.
 *
 * The line is laid out as on the page, in whichever of the two ways the settings
 * say: every name in full on as many lines as that takes (.is-lines, below), or a
 * grid of one line that shares its width fairly, so short names stay whole and only
 * a name wanting more than its share is cut short.
 */
.editor-styles-wrapper .wp-block-wpshl-tabs {
	padding: 0;
	border: 0;
	background: none;
	box-shadow: none;
}

/* the window touches its tabs, and the first tab stands on its corner */
.editor-styles-wrapper .wp-block-wpshl-tabs pre.wp-block-code {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
	border-top-left-radius: 0;
}

.editor-styles-wrapper .wp-block-wpshl-tabs > .wpshl-tabline {
	display: flex;
	align-items: stretch;
	gap: 3px;
	margin: 0;
	padding: 0;
}

.editor-styles-wrapper .wpshl-tabline > .wpshl-tabline-tabs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, max-content);
	justify-content: start;
	gap: 3px;
	flex: 0 1 auto;
	min-width: 0;
	overflow: hidden;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-tab {
	-webkit-appearance: none;
	appearance: none;
	display: block;
	box-sizing: border-box;
	min-width: 0;
	margin: 0;
	padding: 0.4em 0.3em 0.45em;
	border: 0;
	border-radius: 6px 6px 0 0;
	background: var(--wsh-tabline-idle, #4d576e);
	color: var(--wsh-text, #ffffff);
	text-shadow: var(--wsh-text-shadow, none);
	font-family: "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", "Helvetica Neue Condensed", "Avenir Next Condensed", sans-serif-condensed, Arial, Helvetica, sans-serif;
	font-stretch: condensed;
	font-size: 1.3em;
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0.01em;
	text-align: left;
	text-transform: none;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 0.12s;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-tab::before,
.editor-styles-wrapper .wpshl-tabline .wpshl-tab::after {
	content: "";
	display: inline-block;
	width: 0.7em;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-tab:hover {
	background: var(--wsh-tabline-hover, #2e3a55);
}

/* EVERY NAME IN FULL, as on the page (see .wsh-tabs-lines). The tabs' own holder steps
   aside (display: contents), so that NEW TAB follows the last tab on whatever line that is. */
.editor-styles-wrapper .wp-block-wpshl-tabs > .wpshl-tabline.is-lines {
	flex-wrap: wrap;
	gap: 0 3px;
}

.editor-styles-wrapper .wpshl-tabline.is-lines > .wpshl-tabline-tabs {
	display: contents;
}

.editor-styles-wrapper .wpshl-tabline.is-lines::after {
	content: "";
	flex: 1000 1 0px;
}

.editor-styles-wrapper .wpshl-tabline.is-lines .wpshl-tab {
	flex: 1 1 auto;
	max-width: 100%;
	margin-top: 3px;
}

.editor-styles-wrapper .wpshl-tabline.is-lines .wpshl-newtab {
	margin-top: 3px;
	/* on a line of its own it has no tab beside it to be as tall as */
	min-height: 2.4em;
}

/* a crowd of tabs, as on the page (see .wsh-tabs-many) */
.editor-styles-wrapper .wpshl-tabline.is-lines.is-many .wpshl-tab {
	padding: 0.4em 0.2em 0.45em;
	font-size: 1em;
}

.editor-styles-wrapper .wpshl-tabline.is-lines.is-many .wpshl-tab::before,
.editor-styles-wrapper .wpshl-tabline.is-lines.is-many .wpshl-tab::after {
	width: 0.45em;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-tab.is-chosen {
	background: var(--wsh-bg, #000f30);
	box-shadow: inset 0 3px 0 var(--wsh-border, #18aaed);
	cursor: default;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-tab:focus-visible,
.editor-styles-wrapper .wpshl-tabline .wpshl-newtab:focus-visible {
	outline: 2px solid var(--wsh-text, #ffffff);
	outline-offset: -4px;
}

/* NEW TAB: where the next tab will stand. Never cut short, and plainly a button, not a file. */
.editor-styles-wrapper .wpshl-tabline .wpshl-newtab {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 0 auto;
	box-sizing: border-box;
	margin: 0;
	padding: 0 1em;
	border: 0;
	border-radius: 6px 6px 0 0;
	background: var(--wsh-border, #18aaed);
	color: var(--wsh-bg, #000f30);
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-shadow: none;
	white-space: nowrap;
	cursor: pointer;
}

.editor-styles-wrapper .wpshl-tabline .wpshl-newtab:hover,
.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-newtab-alone:hover {
	filter: brightness(1.15);
}

/*
 * NEW TAB ABOVE AN ORDINARY WINDOW, where its first tab would stand (editor.js,
 * growATab()). It is outside the window -- by the author's order -- but it is a child
 * of the window's own element, hung from its top edge, so it is wherever the window
 * is, at whatever width a theme gives it. WSH_Settings::css() lets the window show
 * what is outside it (overflow: visible) when no "tallest a block may be" is set.
 */
.editor-styles-wrapper pre.wp-block-code.wpshl-window {
	position: relative;
}

/* Room above for the button to stand in, clear of whatever comes before the window, and
   the corner it stands on squared off, as under a line of tabs. (A browser too old for
   :has() simply leaves the window where it was.) */
.editor-styles-wrapper pre.wp-block-code.wpshl-window:has(> .wpshl-newtab-alone) {
	margin-top: 44px !important;
	border-top-left-radius: 0;
}

.editor-styles-wrapper pre.wp-block-code.wpshl-window > .wpshl-newtab-alone {
	-webkit-appearance: none;
	appearance: none;
	position: absolute;
	left: 0;
	bottom: 100%;
	z-index: 1;
	box-sizing: border-box;
	margin: 0;
	padding: 0.4em 1em;
	border: 0;
	border-radius: 6px 6px 0 0;
	background: var(--wsh-border, #18aaed);
	color: var(--wsh-bg, #000f30);
	font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.06em;
	text-shadow: none;
	white-space: nowrap;
	cursor: pointer;
	-webkit-user-select: none;
	user-select: none;
}

/* On paper: everything, no scrolling, no picture, no glow. */
@media print {
	pre.wsh > code {
		max-height: none;
		overflow: visible;
		white-space: pre-wrap;
	}

	/* Paper is white whatever the screen was, so the inks go dark. !important,
	   because the colours on the page are written after this file. */
	.wsh,
	.wsh-box,
	.wsh-tabs {
		--wsh-text: #000000 !important;
		--wsh-comment: #555555 !important;
		--wsh-keyword: #000000 !important;
		--wsh-type: #1a3a5c !important;
		--wsh-function: #3d2a00 !important;
		--wsh-word: #3d2a00 !important;
		--wsh-meta: #003f3a !important;
		--wsh-string: #0f4d0f !important;
		--wsh-number: #6b1f06 !important;
		--wsh-constant: #6e0a3a !important;
		--wsh-variable: #25287a !important;
		--wsh-operator: #222222 !important;
		--wsh-punctuation: #222222 !important;
		--wsh-rule: rgba(0, 0, 0, 0.35) !important;
		--wsh-tint: rgba(0, 0, 0, 0.06) !important;
	}

	pre.wsh,
	pre.wp-block-code.wsh,
	.wsh-box {
		border: 1px solid #999999;
		background: #ffffff none;
		box-shadow: none;
		text-shadow: none;
	}

	/* every file, one after another; the tabs are a plain list of their names */
	.wsh-tabs .wsh-tabpanel {
		display: block !important;
	}

	.wsh-tabs .wsh-tab {
		border: 1px solid #999999 !important;
		background: none !important;
		box-shadow: none !important;
		text-shadow: none;
	}

	/* paper has no clipboard and no downloads */
	.wsh-box .wsh-copy,
	.wsh-box > .wsh-footer,
	.wsh-box a.wsh-download {
		display: none !important;
	}
}
