/*
Theme Name: Blowery
Description: A sparse Bauhaus block theme for blowery.org.
Author: Ben Lowery
Version: 0.1.1
Requires at least: 7.0
Requires PHP: 8.3
License: GPL-2.0-or-later
Text Domain: blowery
*/

:root {
	--paper: var(--wp--preset--color--paper);
	--ink: var(--wp--preset--color--ink);
	--red: var(--wp--preset--color--red);
	--yellow: var(--wp--preset--color--yellow);
	--blue: var(--wp--preset--color--blue);
	--muted: var(--wp--preset--color--muted);
	--rule: var(--wp--preset--color--rule);
	--tint: #ebe6da;

	--rail: 7rem;
	--gap: 2.5rem;
	--col: 38rem;
	--offset: max(1.25rem, calc((100vw - var(--rail) - var(--gap) - var(--col)) / 2 - 4rem));
	--ease: cubic-bezier(.2, .8, .2, 1);

	color-scheme: light dark;
}

/* Dark: same primaries, lifted a little so they hold up on a dark page. */
@media (prefers-color-scheme: dark) {
	:root {
		--wp--preset--color--paper: #151412;
		--wp--preset--color--ink: #ece8de;
		--wp--preset--color--red: #e8473d;
		--wp--preset--color--yellow: #f2c230;
		--wp--preset--color--blue: #5b8be0;
		--wp--preset--color--muted: #9c978b;
		--wp--preset--color--rule: #34322d;
		--tint: #23221f;
	}

	:root .shape--square { mix-blend-mode: screen; }
	.entry-title a:hover { color: #151412; }
	.entry-content img { filter: brightness(.92); }
}

/* ---------- Page frame ---------- */

body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

.wp-site-blocks {
	padding: 0 1.25rem;
}

.wp-site-blocks > * {
	max-width: var(--col);
	margin-inline: auto;
}

::selection { background: var(--yellow); color: var(--ink); }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ---------- Header ---------- */

.site-header {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: end;
	gap: 0 1rem;
	padding: 1.5rem 0 1rem;
	border-bottom: 3px solid var(--ink);
	margin-bottom: var(--wp--preset--spacing--50);
}

.masthead {
	grid-column: 1;
	font-weight: 900;
	font-size: clamp(3.25rem, 15vw, 5rem);
	line-height: .8;
	letter-spacing: -.035em;
	color: var(--ink);
	text-decoration: none;
	view-transition-name: masthead;
	transition: color .3s var(--ease);
}

.masthead:hover { color: var(--red); }

.rail-rule { display: none; }

.shapes {
	grid-column: 2;
	grid-row: 1;
	position: relative;
	width: 8.35rem;
	height: 4.25rem;
}

.shape {
	position: absolute;
	display: block;
	transition: transform .5s var(--ease);
}

.shape--circle {
	width: 3.5rem; height: 3.5rem;
	border-radius: 50%;
	background: var(--red);
	left: 0; top: 0;
	view-transition-name: shape-circle;
}

.shape--square {
	width: 2.5rem; height: 2.5rem;
	background: var(--blue);
	mix-blend-mode: multiply;
	left: 2.6rem; top: 1.5rem;
	view-transition-name: shape-square;
}

.shape--triangle {
	width: 2.75rem; height: 2.5rem;
	background: var(--yellow);
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
	left: 5.6rem; top: 1.5rem;
	view-transition-name: shape-triangle;
}

/* Each kind of page gets its own arrangement; view transitions animate between them. */
.single .shape--circle { transform: translate(3.3rem, .6rem) scale(.8); }
.single .shape--square { transform: translate(-2.6rem, -.4rem); }
.single .shape--triangle { transform: rotate(180deg); }

.page .shape--circle { transform: translate(4.2rem, 1rem) scale(.6); }
.page .shape--square { transform: translate(-1.6rem, -1rem) rotate(45deg); }
.page .shape--triangle { transform: translate(-5.6rem, 0); }

.paged .shape--circle { transform: translate(1rem, 0); }
.paged .shape--square { transform: translate(-.5rem, 0) rotate(-12deg); }

.site-nav {
	grid-column: 1 / -1;
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1.25rem;
	margin-top: 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
}

.site-nav a { color: var(--ink); text-decoration: none; }
.site-nav a:hover { color: var(--red); }
.site-nav .site-nav__name { color: var(--red); }

/* Wide screens: the masthead stands on end in a rail at the left, Bauhaus-poster style. */
@media (min-width: 60rem) {
	.wp-site-blocks > * {
		margin-left: calc(var(--offset) + var(--rail) + var(--gap));
		margin-right: 1.25rem;
	}

	.rail-rule {
		display: block;
		position: fixed;
		top: 0; bottom: 0;
		margin: 0;
		left: calc(var(--offset) + var(--rail));
		width: 3px;
		background: var(--ink);
		view-transition-name: rail-rule;
	}

	.site-header {
		grid-template-columns: auto 1fr;
		border-bottom: 0;
		padding-top: 2.5rem;
	}

	.masthead {
		position: fixed;
		top: 2.25rem;
		left: var(--offset);
		width: var(--rail);
		display: flex;
		justify-content: center;
		font-size: 5.5rem;
		writing-mode: vertical-rl;
		transform: rotate(180deg);
	}

	.admin-bar .masthead { top: calc(2.25rem + var(--wp-admin--admin-bar--height, 32px)); }

	.shapes { grid-column: 1; }
	.site-nav { grid-column: 1 / -1; margin-top: 1.75rem; }
}

/* ---------- Posts ---------- */

.entry { margin-block-start: 0; }

.post-list .wp-block-post + .wp-block-post {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: var(--wp--preset--spacing--50);
	background: linear-gradient(var(--ink), var(--ink)) no-repeat 0 0 / 3rem 3px;
}

.entry-date {
	display: flex;
	align-items: center;
	gap: .65rem;
	margin-bottom: .6rem;
}

.entry-date::before {
	content: "";
	width: .7rem; height: .7rem;
	border-radius: 50%;
	background: var(--blue);
	flex: none;
}

.entry-date a { color: inherit; text-decoration: none; }
.entry-date a:hover { color: var(--blue); }

.entry-title { margin: 0 0 1.1rem; text-wrap: balance; }

.entry-title a {
	color: inherit;
	text-decoration: none;
	box-shadow: inset 0 -.16em var(--yellow);
	transition: box-shadow .3s var(--ease);
}

.entry-title a:hover { box-shadow: inset 0 -1.05em var(--yellow); }

/* ---------- Post content: written for twenty years of classic HTML ---------- */

.entry-content { overflow-wrap: break-word; }
.entry-content > * { margin-block: 0; }
.entry-content > * + * { margin-block-start: 1.1em; }

.entry-content a {
	color: inherit;
	text-decoration-color: var(--red);
	text-decoration-thickness: .07em;
	text-underline-offset: .2em;
	transition: color .2s, text-decoration-color .2s;
}

.entry-content a:hover { color: var(--red); }

.entry-content h2, .entry-content h3, .entry-content h4 { margin-top: 1.8em; }
.entry-content h2 { font-size: var(--wp--preset--font-size--large); }

.entry-content img { max-width: 100%; height: auto; }

.entry-content .wp-caption { max-width: 100%; width: auto !important; }
.entry-content .wp-caption a { text-decoration: none; }
.entry-content .wp-caption-text,
.entry-content figcaption {
	margin-top: .5rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--muted);
}

.entry-content .aligncenter { display: block; margin-inline: auto; }

@media (min-width: 40rem) {
	.entry-content .alignleft { float: left; margin: .3em 1.5em 1em 0; max-width: 50%; }
	.entry-content .alignright { float: right; margin: .3em 0 1em 1.5em; max-width: 50%; }
	.entry-content::after { content: ""; display: table; clear: both; }
}

.entry-content blockquote {
	margin-inline: 0;
	padding-left: 1.25rem;
	border-left: 4px solid var(--blue);
}

.entry-content blockquote > * + * { margin-top: .8em; }

.entry-content ul, .entry-content ol { padding-left: 1.25em; }
.entry-content li + li { margin-top: .3em; }
.entry-content ul { list-style: square; }
.entry-content ul li::marker { color: var(--red); }

.entry-content dl > dt { font-weight: 600; margin-top: 1em; }
.entry-content dl > dt:first-child { margin-top: 0; }
.entry-content dl > dd { margin: .2em 0 0; color: var(--muted); }

.entry-content code, .entry-content kbd {
	font-family: var(--wp--preset--font-family--mono);
	font-size: .85em;
	background: var(--tint);
	padding: .1em .3em;
}

.entry-content pre {
	font-family: var(--wp--preset--font-family--mono);
	font-size: .85em;
	line-height: 1.55;
	background: var(--tint);
	padding: 1rem 1.1rem;
	overflow-x: auto;
	white-space: pre;
}

.entry-content pre code { background: none; padding: 0; font-size: 1em; }

.entry-content table { border-collapse: collapse; width: 100%; font-size: .95em; display: block; overflow-x: auto; }
.entry-content th, .entry-content td { border-bottom: 1px solid var(--rule); padding: .4em .6em; text-align: left; }
.entry-content th { font-weight: 600; border-bottom: 2px solid var(--ink); }

.entry-content hr {
	border: 0;
	height: 3px;
	width: 3rem;
	background: var(--ink);
	margin-block: 2em;
}

.entry-content iframe { max-width: 100%; border: 0; }

.entry-content iframe[src*="youtube"],
.entry-content iframe[src*="vimeo"],
.entry-content .wp-block-embed iframe {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	display: block;
}

.entry-content .wp-block-embed { margin-inline: 0; }

.dead-embed {
	display: flex;
	gap: .65rem;
	align-items: center;
	font-size: var(--wp--preset--font-size--small);
	color: var(--muted);
}

.dead-embed::before {
	content: "";
	width: .8rem; height: .8rem;
	border: 2px solid var(--muted);
	flex: none;
}

/* ---------- Meta and navigation ---------- */

.entry-meta {
	margin-top: 2rem;
	gap: .5rem 1.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--muted);
}

.entry-meta a { color: inherit; text-decoration: none; }
.entry-meta a:hover { color: var(--red); }

.pager, .post-nav {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: 1rem;
	border-top: 3px solid var(--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	gap: 1.5rem;
}

.pager a, .post-nav a { color: var(--ink); text-decoration: none; }
.pager a:hover, .post-nav a:hover { color: var(--red); }
.post-nav .post-navigation-link-next { text-align: right; margin-left: auto; }

/* ---------- Comments ---------- */

.comments {
	margin-top: var(--wp--preset--spacing--50);
	padding-top: 1rem;
	border-top: 3px solid var(--ink);
}

.comments .wp-block-comments-title {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
	margin: 0 0 1.5rem;
}

.comments .wp-block-comment-template { list-style: none; padding: 0; margin: 0; }
.comments .wp-block-comment-template ol { list-style: none; padding-left: 1.25rem; border-left: 3px solid var(--rule); }
.comments .comment { margin: 0 0 1.75rem; }

.comment-meta {
	gap: .25rem 1rem;
	align-items: baseline;
	font-size: var(--wp--preset--font-size--small);
	margin-bottom: .35rem;
}

.comment-meta .wp-block-comment-author-name { font-weight: 600; }
.comment-meta .wp-block-comment-date { color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.comment-meta a { color: inherit; text-decoration: none; }
.comment-meta a:hover { color: var(--red); }

.comments .wp-block-comment-content { font-size: .95em; margin-top: .25rem; }
.comments .wp-block-comment-content p { margin: 0 0 .7em; }
.comments .wp-block-comment-content a { color: inherit; text-decoration-color: var(--red); }
.comments .wp-block-comment-reply-link { font-size: var(--wp--preset--font-size--small); }
.comments .wp-block-comment-reply-link a { color: var(--muted); }

.comments .comment-respond { margin-top: 2rem; }
.comments input[type="text"], .comments input[type="email"], .comments input[type="url"], .comments textarea {
	width: 100%;
	font: inherit;
	color: var(--ink);
	background: var(--tint);
	border: 2px solid var(--ink);
	padding: .5rem .65rem;
	border-radius: 0;
}
.comments input[type="submit"] {
	font: inherit;
	font-weight: 600;
	background: var(--ink);
	color: var(--paper);
	border: 0;
	padding: .55rem 1.2rem;
	cursor: pointer;
}
.comments input[type="submit"]:hover { background: var(--red); }

/* ---------- Archives page ---------- */

.archive-year { margin-top: var(--wp--preset--spacing--40); }

.archive-year__title {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	font-size: var(--wp--preset--font-size--large);
	padding-bottom: .4rem;
	border-bottom: 3px solid var(--ink);
	margin: 0 0 .75rem;
}

.archive-year__title span {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: .15em;
	text-transform: uppercase;
	color: var(--muted);
}

.archive-year ol { list-style: none; margin: 0; padding: 0; }
.archive-year li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 1rem; padding: .3rem 0; }

.archive-year time {
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
	padding-top: .15em;
}

.archive-year a { color: var(--ink); text-decoration: none; }
.archive-year a:hover { color: var(--red); }

/* ---------- Lists: category, tag, date, search ---------- */

.list-header { margin-bottom: var(--wp--preset--spacing--40); }
.list-header > * + * { margin-top: 1rem; }
.list-title { margin: 0; }
.list-title span { color: var(--blue); }
.list-description { color: var(--muted); }

.compact-list .wp-block-post-template { list-style: none; margin: 0; padding: 0; border-top: 3px solid var(--ink); }

.compact-item {
	display: grid;
	grid-template-columns: 7.5rem 1fr;
	gap: 1rem;
	align-items: baseline;
	padding: .55rem 0;
	border-bottom: 1px solid var(--rule);
}

.compact-item > * { margin: 0; }

.compact-date {
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
}

.compact-title {
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
	letter-spacing: 0;
	line-height: 1.35;
}

.compact-title a { color: var(--ink); text-decoration: none; }
.compact-title a:hover { color: var(--red); }

@media (max-width: 30rem) {
	.compact-item { grid-template-columns: 1fr; gap: .1rem; }
}

.no-results { color: var(--muted); }

.site-search .wp-block-search__inside-wrapper { gap: .5rem; }
.site-search .wp-block-search__input {
	font: inherit;
	background: var(--tint);
	color: var(--ink);
	border: 2px solid var(--ink);
	border-radius: 0;
	padding: .5rem .65rem;
}
.site-search .wp-block-search__button {
	font: inherit;
	font-weight: 600;
	background: var(--ink);
	color: var(--paper);
	border: 0;
	border-radius: 0;
	margin: 0;
	padding: .5rem 1.1rem;
	cursor: pointer;
}
.site-search .wp-block-search__button:hover { background: var(--red); }

/* Link posts on the home page have no title; a red triangle marks them instead of the blue dot. */
.post-list .category-links .entry-date::before {
	border-radius: 0;
	width: .75rem;
	background: var(--red);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}

/* More shape arrangements, one per kind of page. */
.archive .shape--circle, .search .shape--circle { transform: translate(5.2rem, .9rem) scale(.55); }
.archive .shape--triangle, .search .shape--triangle { transform: translate(-5.6rem, 0) rotate(90deg); }

.error404 .shape--circle { transform: translate(.4rem, 1.4rem) scale(.7); }
.error404 .shape--square { transform: translate(1.2rem, -1.2rem) rotate(28deg); }
.error404 .shape--triangle { transform: translate(-.4rem, .8rem) rotate(-150deg); }

/* ---------- Utilities ---------- */

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ---------- Footer ---------- */

.site-footer {
	margin-top: var(--wp--preset--spacing--60);
	padding-bottom: 3rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--muted);
}

.site-footer a { color: inherit; }
.site-footer a:hover { color: var(--red); }

.shape-mini {
	display: inline-block;
	width: .6rem; height: .6rem;
	background: var(--red);
	border-radius: 50%;
	margin-right: .6rem;
}

/* ---------- Motion ---------- */

@view-transition { navigation: auto; }

/*
 * The masthead, rule, shapes and nav are named, so they stay put (or glide) while
 * the page content underneath steps out and the new page rises in.
 */
.site-nav { view-transition-name: site-nav; }

::view-transition-group(*) {
	animation-duration: .5s;
	animation-timing-function: var(--ease);
}

::view-transition-group(shape-circle),
::view-transition-group(shape-square),
::view-transition-group(shape-triangle) {
	animation-duration: .7s;
	animation-timing-function: cubic-bezier(.34, 1.4, .5, 1);
}

::view-transition-old(root) {
	animation: .18s ease-in both page-out;
}

::view-transition-new(root) {
	animation: .42s var(--ease) .08s both page-in;
}

@keyframes page-out {
	to { opacity: 0; transform: translateY(-.6rem); }
}

@keyframes page-in {
	from { opacity: 0; transform: translateY(1.25rem); }
}

@media (prefers-reduced-motion: reduce) {
	@view-transition { navigation: none; }

	*, *::before, *::after {
		transition: none !important;
		animation: none !important;
	}
}
