/*
Theme Name: T8wn
Theme URI: https://t8wn.com/
Author: JMP $EA31
Description: Text-mode theme for T8wn: Turbo Vision style windows, menu bar, status bar and dialogs in the 16 VGA colors.
Version: 0.4.1
Requires at least: 6.6
Requires PHP: 8.1
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: t8wn
*/

/* Surfaces: each window style sets its own colors */
:root,
.is-style-t8-window {
	--t8-bg: #0000AA;
	--t8-fg: #AAAAAA;
	--t8-frame: #FFFFFF;
	--t8-heading: #FFFFFF;
	--t8-strong: #FFFFFF;
	--t8-em: #55FFFF;
	--t8-meta: #00AAAA;
	--t8-link: #FFFF55;
	--t8-hover-bg: #00AAAA;
	--t8-hover-fg: #000000;
}

.is-style-t8-dialog {
	--t8-bg: #AAAAAA;
	--t8-fg: #000000;
	--t8-frame: #FFFFFF;
	--t8-heading: #000000;
	--t8-strong: #000000;
	--t8-em: #0000AA;
	--t8-meta: #000000;
	--t8-link: #0000AA;
	--t8-hover-bg: #00AA00;
	--t8-hover-fg: #000000;
}

.is-style-t8-alert {
	--t8-bg: #AA0000;
	--t8-fg: #FFFFFF;
	--t8-frame: #FFFFFF;
	--t8-heading: #FFFF55;
	--t8-strong: #FFFF55;
	--t8-em: #FFFF55;
	--t8-meta: #FFFFFF;
	--t8-link: #FFFF55;
	--t8-hover-bg: #FFFF55;
	--t8-hover-fg: #000000;
}

/* Screen */
html {
	background: #000000;
	scrollbar-color: #00AAAA #0000AA;
}

body {
	margin: 0;
	background-color: #0000AA;
	background-image: repeating-conic-gradient(#000000 0% 25%, transparent 0% 50%);
	background-size: 4px 4px;
	font-synthesis: none;
	-webkit-font-smoothing: none;
	-moz-osx-font-smoothing: grayscale;
}

::selection {
	background: #00AAAA;
	color: #000000;
}

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.wp-site-blocks > * {
	margin-block: 0;
}

.t8-desktop {
	flex: 1;
	padding: 24px 16px 32px;
}

.t8-desktop > .wp-block-columns {
	max-width: 1280px;
	margin-inline: auto;
	gap: 0 16px;
}

.t8-page {
	max-width: calc(90ch + 64px);
	margin-inline: auto;
}

.t8-wide {
	max-width: 1280px;
	margin-inline: auto;
}

.t8-wide > .wp-block-columns {
	gap: 0 16px;
}

/* Text */
h1, h2, h3, h4, h5, h6 {
	color: var(--t8-heading);
	font-size: 16px;
	font-weight: normal;
	line-height: 20px;
}

.wp-block-post-content h1 {
	font-size: 32px;
	line-height: 40px;
}

.wp-block-post-content h2 {
	text-transform: uppercase;
}

strong, b {
	font-weight: normal;
	color: var(--t8-strong);
}

em, i, cite {
	font-style: normal;
	color: var(--t8-em);
}

a {
	color: var(--t8-link);
	text-decoration: none;
}

.wp-block-post-content a,
.wp-block-post-excerpt a,
.wp-block-comment-content a {
	text-decoration: underline;
	text-underline-offset: 3px;
}

a:hover,
a:focus-visible {
	background: var(--t8-hover-bg);
	color: var(--t8-hover-fg);
	outline: none;
}

.t8-meta,
.wp-block-post-date,
.wp-block-post-terms,
.wp-block-comment-date {
	color: var(--t8-meta);
}

ul.wp-block-list {
	list-style: "■ ";
	padding-left: 2ch;
}

.wp-block-list li::marker {
	color: var(--t8-em);
}

body .wp-block-quote {
	border: 0;
	border-left: 1ch solid var(--t8-em);
	margin: 20px 0;
	padding: 0 0 0 2ch;
	color: var(--t8-em);
}

body .wp-block-separator {
	border-width: 2px 0 0;
	border-style: solid;
	border-color: var(--t8-fg);
	opacity: 1;
	height: 0;
	margin: 20px 0;
}

pre, code, kbd, samp {
	font-family: inherit;
	font-size: inherit;
}

pre,
body .wp-block-code,
body .wp-block-preformatted {
	background: #000000;
	color: #AAAAAA;
	border: 0;
	border-radius: 0;
	padding: 0 1ch;
	overflow-x: auto;
}

body .wp-block-code,
body .wp-block-code code {
	white-space: pre;
	overflow-wrap: normal;
}

body .wp-block-preformatted.t8-art {
	width: fit-content;
	max-width: 100%;
	margin-inline: auto;
	padding: 8px 1ch;
	line-height: 16px;
	white-space: pre;
}

body .wp-block-preformatted.t8-plain {
	background: none;
	color: inherit;
	padding: 0;
	white-space: pre-wrap;
}

pre mark {
	color: inherit;
}

:not(pre) > code {
	background: #000000;
	color: #AAAAAA;
	padding: 0 1ch;
}

body .wp-block-table table {
	border-collapse: collapse;
}

body .wp-block-table th,
body .wp-block-table td {
	border: 2px solid var(--t8-fg);
	padding: 0 1ch;
}

body .wp-block-table thead {
	border-bottom: 0;
}

body .wp-block-table thead th {
	background: #00AAAA;
	color: #000000;
}

/* Windows: double frame, title on the frame, block shadow */
.is-style-t8-window,
.is-style-t8-dialog,
.is-style-t8-alert {
	position: relative;
	background-color: var(--t8-bg);
	color: var(--t8-fg);
	border: 6px double var(--t8-frame);
	box-shadow: 0 0 0 8px var(--t8-bg), 16px 16px 0 8px #000000;
	margin: 24px 24px 40px 8px;
	padding: 0 2ch 12px;
}

.is-style-t8-window:not(:has(> .t8-title:first-child)),
.is-style-t8-dialog:not(:has(> .t8-title:first-child)),
.is-style-t8-alert:not(:has(> .t8-title:first-child)) {
	padding-top: 12px;
}

.t8-title {
	width: fit-content;
	max-width: calc(100% - 4ch);
	margin: -13px auto 12px;
	padding: 0 1ch;
	background: var(--t8-bg);
	color: var(--t8-heading);
	font-size: 16px;
	line-height: 20px;
	text-align: center;
	text-transform: none;
}

.wp-block-post-content h2.t8-title {
	text-transform: none;
}

.t8-title a {
	color: inherit;
}

:is(.is-style-t8-window, .is-style-t8-dialog, .is-style-t8-alert) :is(.is-style-t8-window, .is-style-t8-dialog, .is-style-t8-alert):last-child {
	margin-bottom: 32px;
}

.t8-title + *,
.t8-title + .wp-block-post-content > :first-child {
	margin-top: 0;
}

.wp-block-post-content > :last-child {
	margin-bottom: 0;
}

.is-style-t8-window > :last-child,
.is-style-t8-dialog > :last-child,
.is-style-t8-alert > :last-child {
	margin-bottom: 0;
}

/* Menu bar */
.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 100;
}

.t8-menubar {
	background: #AAAAAA;
	color: #000000;
	gap: 0;
	min-height: 20px;
	padding: 0 1ch;
}

.t8-menubar .wp-block-site-title {
	margin: 0;
	font-size: 16px;
	line-height: 20px;
}

.t8-menubar .wp-block-site-title a::before {
	content: "≡ ";
}

body .t8-menubar .wp-block-navigation,
body .t8-menubar .wp-block-navigation__container,
body .t8-menubar .wp-block-page-list {
	gap: 0;
	font-size: 16px;
}

.t8-menubar a,
body .t8-menubar .wp-block-navigation-item__content {
	display: inline-block;
	color: #000000;
	padding: 0 1ch;
	line-height: 20px;
	text-decoration: none;
}

.t8-menubar a::first-letter {
	color: #AA0000;
}

.t8-menubar a:hover,
.t8-menubar a:focus-visible {
	background: #00AA00;
	color: #000000;
}

body .t8-menubar .wp-block-navigation__submenu-container {
	background: #AAAAAA;
	color: #000000;
	border: 2px solid #000000;
	box-shadow: 16px 16px 0 #000000;
	min-width: 24ch;
	padding: 4px 0;
}

body .t8-menubar .wp-block-navigation__responsive-container-open,
body .t8-menubar .wp-block-navigation__responsive-container-close {
	color: #000000;
	background: none;
	font: inherit;
	line-height: 20px;
	padding: 0 1ch;
}

body .t8-menubar .wp-block-navigation__responsive-container-open svg {
	display: none;
}

body .t8-menubar .wp-block-navigation__responsive-container-open::before {
	content: "M";
	color: #AA0000;
}

body .t8-menubar .wp-block-navigation__responsive-container-open::after {
	content: "enu";
}

body .t8-menubar .wp-block-navigation__responsive-container-open:hover,
body .t8-menubar .wp-block-navigation__responsive-container-open:focus-visible {
	background: #00AA00;
}

body .t8-menubar .wp-block-navigation__responsive-container.is-menu-open {
	background: #AAAAAA;
	color: #000000;
	padding: 24px 16px;
}

/* Status bar */
.wp-site-blocks > footer.wp-block-template-part {
	position: sticky;
	bottom: 0;
	z-index: 100;
}

.t8-statusbar {
	background: #AAAAAA;
	color: #000000;
	gap: 0 2ch;
	min-height: 20px;
	padding: 0 1ch;
}

.t8-statusbar p,
.t8-statusbar .wp-block-loginout {
	margin: 0;
}

.t8-statusbar .t8-keys {
	gap: 0;
}

.t8-statusbar a {
	display: inline-block;
	color: #000000;
	padding: 0 1ch;
	text-decoration: none;
}

.t8-statusbar a:hover,
.t8-statusbar a:focus-visible {
	background: #00AA00;
	color: #000000;
}

.t8-key,
.t8-statusbar .wp-block-loginout a::before {
	color: #AA0000;
}

.t8-statusbar .wp-block-loginout a::before {
	content: "F2 ";
}

/* Buttons and fields */
.wp-element-button,
.wp-block-button__link,
input[type="submit"],
input[type="button"],
input[type="reset"] {
	background: #00AA00;
	color: #000000;
	border: 0;
	border-radius: 0;
	box-shadow: 1ch 8px 0 #000000;
	cursor: pointer;
	font: inherit;
	line-height: 20px;
	padding: 0 2ch;
	position: relative;
	text-decoration: none;
}

.wp-element-button:hover,
.wp-block-button__link:hover,
input[type="submit"]:hover,
.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible,
input[type="submit"]:focus-visible {
	background: #00AA00;
	color: #FFFFFF;
	outline: none;
}

.wp-element-button:not(input):active,
.wp-block-button__link:not(input):active {
	box-shadow: none;
	transform: translate(1ch, 8px);
}

/* Pressed buttons keep their old area clickable, else a click on the top edge is lost */
.wp-element-button:active::after,
.wp-block-button__link:active::after {
	content: "";
	position: absolute;
	inset: -8px 0 0 -1ch;
}

input[type="submit"]:active {
	box-shadow: none;
}

.wp-block-buttons {
	margin-bottom: 8px;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea,
select {
	background: #000000;
	color: #FFFFFF;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	font: inherit;
	line-height: 20px;
	padding: 0 1ch;
}

:focus-visible {
	outline: 2px solid #FFFF55;
	outline-offset: 0;
}

body .wp-block-search__inside-wrapper {
	border: 0;
	padding: 0;
	gap: 2ch;
}

body .wp-block-search__input {
	min-width: 0;
	border: 0;
}

/* Lists of posts, pagination, comments */
.wp-block-latest-posts.wp-block-latest-posts__list {
	padding: 0;
}

.wp-block-latest-posts__list li::before {
	content: "► ";
	color: var(--t8-meta);
}

.wp-block-latest-posts__post-date {
	display: inline;
	margin-left: 1ch;
	color: var(--t8-meta);
	font-size: inherit;
}

.wp-block-query-pagination {
	gap: 2ch;
	margin: 0 24px 24px 8px;
}

.wp-block-query-pagination a,
.wp-block-query-pagination .page-numbers.current {
	display: inline-block;
	background: #AAAAAA;
	color: #000000;
	padding: 0 1ch;
	box-shadow: 1ch 8px 0 #000000;
}

.wp-block-query-pagination .page-numbers.current {
	background: #00AAAA;
}

.wp-block-comment-template {
	padding: 0;
	list-style: none;
}

.wp-block-comment-template li {
	margin: 0 0 20px;
}

/* Docs: page tree, breadcrumbs, previous/next, screen previews */
.t8-tree ul {
	list-style: none;
	margin: 0;
	padding: 0 0 0 2ch;
}

.t8-tree > ul {
	padding-left: 0;
}

.t8-tree a {
	display: block;
	color: #000000;
	padding: 0 1ch;
}

.t8-tree-mark {
	display: inline-block;
	width: 2ch;
	color: #0000AA;
}

.t8-tree .is-current > a,
.t8-tree a.t8-tree-root.is-current {
	background: #00AAAA;
	color: #000000;
}

.t8-tree a:hover,
.t8-tree a:focus-visible {
	background: #00AA00;
	color: #000000;
}

.t8-tree-root {
	margin-bottom: 4px;
}

.t8-breadcrumbs {
	color: var(--t8-meta);
	margin: 0 0 20px;
}

.t8-docs-nav {
	display: flex;
	justify-content: space-between;
	gap: 2ch;
	flex-wrap: wrap;
	border-top: 2px solid var(--t8-fg);
	margin-top: 32px;
	padding-top: 12px;
}

.t8-docs .t8-docs-main,
.t8-docs .t8-docs-side {
	min-width: 0;
}

@media (min-width: 782px) {
	.t8-docs .t8-docs-side {
		order: -1;
	}

	.t8-docs .t8-docs-side .is-style-t8-dialog {
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 44px);
	}
}

body .wp-block-preformatted.t8-screen {
	width: fit-content;
	max-width: 100%;
	margin-inline: 0;
	padding: 0;
	background: none;
	line-height: 16px;
	white-space: pre;
	overflow-x: auto;
}

.t8-caption {
	color: var(--t8-meta);
	margin-bottom: 4px;
}

.t8-caption + .wp-block-preformatted {
	margin-top: 0;
}

/* Narrow screens: thinner shadows and margins */
@media (max-width: 599px) {
	.t8-desktop {
		padding: 16px 8px 24px;
	}

	.is-style-t8-window,
	.is-style-t8-dialog,
	.is-style-t8-alert {
		box-shadow: 0 0 0 4px var(--t8-bg), 8px 8px 0 4px #000000;
		margin: 20px 12px 28px 4px;
		padding: 0 1ch 8px;
	}

	.wp-site-blocks > header.wp-block-template-part {
		top: 0;
	}
}
