/*
Theme Name: Afterimage
Theme URI: https://briangooding.com
Author: Brian Gooding
Author URI: https://briangooding.com
Description: A dark portfolio theme that presents photographs and instrumental music as one body of work, with a site-wide player and photograph-and-song pairings.
Version: 0.1.0
Requires at least: 6.4
Requires PHP: 7.4
License: GNU General Public License v3 or later
License URI: https://www.gnu.org/licenses/gpl-3.0.html
Text Domain: afterimage
*/

:root {
	--bg: #100f0e;
	--surface: #1a1816;
	--ink: #efe9e0;
	--text: #cdc6bb;
	--muted: #9b9489;
	--rule: #2d2a26;
	--wave: #4a4640;
	--signal: #f37e7e;
	--on-signal: #1a0d0d;
	--serif: "Newsreader", Georgia, "Times New Roman", serif;
	--sans: "Jost", "Century Gothic", "Helvetica Neue", Arial, sans-serif;
	--gutter: clamp(16px, 4vw, 56px);
	--measure: 68ch;
	--section: clamp(56px, 6vw, 88px);
	--gap: clamp(16px, 2vw, 28px);
	--row-gap: 40px;
	--head-gap: 24px;
	--dock-space: 0px;
	color-scheme: dark;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--sans);
	font-size: 1.0625rem;
	font-weight: 400;
	line-height: 1.65;
	padding-bottom: var(--dock-space);
	overflow-x: hidden;
}

.has-dock {
	--dock-space: 232px;
}

img,
video,
canvas {
	display: block;
	max-width: 100%;
}

img {
	height: auto;
}

a {
	color: inherit;
	text-decoration-color: var(--wave);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	transition: color 0.15s, text-decoration-color 0.15s;
}

a:hover {
	color: var(--signal);
	text-decoration-color: currentColor;
}

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

#content:focus {
	outline: 0;
}

h1,
h2,
h3,
h4 {
	color: var(--ink);
	font-family: var(--serif);
	font-weight: 300;
	line-height: 1.15;
	text-wrap: balance;
}

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

.skip-link:focus {
	position: fixed;
	top: 12px;
	left: 12px;
	z-index: 100;
	width: auto;
	height: auto;
	margin: 0;
	padding: 10px 16px;
	clip-path: none;
	background: var(--signal);
	color: var(--on-signal);
}

.eyebrow,
.meta {
	margin: 0;
	color: var(--muted);
	font-family: var(--sans);
	font-size: 0.8125rem;
	font-weight: 400;
	letter-spacing: 0.04em;
}

.meta__cats::before {
	content: "/";
	margin: 0 0.5em;
	color: var(--wave);
}

.meta a {
	text-decoration: none;
}

/* ---------- header ---------- */
.site-header {
	position: relative;
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 32px;
	padding: 22px var(--gutter);
}

.site-header__brand {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 16px;
}

.wordmark {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.5rem;
	font-weight: 300;
	line-height: 1.2;
	text-decoration: none;
	text-transform: lowercase;
}

.site-header__tagline {
	color: var(--muted);
	font-size: 0.8125rem;
}

.nav-toggle {
	display: none;
	padding: 8px 0 8px 16px;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	cursor: pointer;
}

.site-nav ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav a {
	display: block;
	padding: 6px 0;
	text-decoration: none;
	text-transform: lowercase;
}

#primary-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 0 26px;
}

#primary-menu > li {
	position: relative;
}

#primary-menu > li > a {
	color: var(--ink);
}

#primary-menu > li > a:hover,
#primary-menu > .current-menu-item > a {
	color: var(--signal);
}

#primary-menu > .menu-item-has-children > a::after {
	content: "";
	display: inline-block;
	width: 6px;
	height: 6px;
	margin-left: 8px;
	border-right: 1px solid currentColor;
	border-bottom: 1px solid currentColor;
	transform: translateY(-3px) rotate(45deg);
}

@media (min-width: 900px) {
	#primary-menu > li > .sub-menu {
		position: absolute;
		top: 100%;
		right: 0;
		display: none;
		grid-auto-flow: column;
		grid-auto-columns: max-content;
		gap: 40px;
		padding: 20px 24px;
		border: 1px solid var(--rule);
		background: var(--surface);
	}

	#primary-menu > li:hover > .sub-menu,
	#primary-menu > li:focus-within > .sub-menu,
	#primary-menu > li.is-open > .sub-menu {
		display: grid;
	}

	.site-nav .sub-menu .sub-menu a {
		padding: 3px 0;
	}
}

.site-nav .sub-menu > .menu-item-has-children > a {
	color: var(--muted);
	font-size: 0.8125rem;
	pointer-events: none;
}

@media (max-width: 899px) {
	.nav-toggle {
		display: block;
		margin-left: auto;
	}

	.site-header {
		align-items: center;
	}

	.site-header__brand {
		flex: 1;
		min-width: 0;
	}

	.site-nav {
		display: none;
		flex-basis: 100%;
		padding: 8px 0 12px;
		border-top: 1px solid var(--rule);
	}

	.site-nav.is-open {
		display: block;
	}

	#primary-menu {
		display: block;
	}

	#primary-menu a {
		padding: 10px 0;
	}

	#primary-menu > li > .sub-menu {
		display: none;
		padding: 0 0 8px 16px;
	}

	#primary-menu > li.is-open > .sub-menu {
		display: block;
	}
}

/* ---------- photographs and waveforms ---------- */
.photo-frame {
	position: relative;
	display: block;
	overflow: hidden;
	background: var(--surface);
}

.photo-frame img {
	width: 100%;
}

/* Photographs fading through while a song plays. Contain keeps the signature in frame. */
.photo-frame img.slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: var(--bg);
}

.wave {
	width: 100%;
	height: 44px;
	margin-top: 8px;
}

/* ---------- play button ---------- */
.play-button {
	display: inline-flex;
	flex: none;
	align-items: center;
	gap: 14px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	font: inherit;
	text-align: left;
	cursor: pointer;
}

.play-button__icon {
	position: relative;
	display: block;
	flex: none;
	width: 44px;
	height: 44px;
	border: 1px solid var(--signal);
	border-radius: 50%;
	transition: background 0.15s;
}

.play-button__icon::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 0;
	height: 0;
	margin: -7px 0 0 -4px;
	border-top: 7px solid transparent;
	border-bottom: 7px solid transparent;
	border-left: 11px solid var(--signal);
}

.play-button:hover .play-button__icon {
	background: var(--signal);
}

.play-button:hover .play-button__icon::before {
	border-left-color: var(--on-signal);
}

.play-button.is-playing .play-button__icon {
	background: var(--signal);
}

.play-button.is-playing .play-button__icon::before {
	width: 11px;
	height: 13px;
	margin: -6.5px 0 0 -5.5px;
	border: 0;
	border-right: 4px solid var(--on-signal);
	border-left: 4px solid var(--on-signal);
}

.play-button--large .play-button__icon {
	width: 60px;
	height: 60px;
}

/* ---------- lead ---------- */
.lead {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
	gap: var(--gap) calc(var(--gap) * 2);
	align-items: center;
	max-width: 1500px;
	margin: 0 auto;
	padding: var(--head-gap) var(--gutter) calc(var(--section) / 2);
}

.lead__photo {
	margin: 0;
}

.lead__title {
	margin: 14px 0 12px;
	font-size: clamp(2.75rem, 5.4vw, 5rem);
	line-height: 1.02;
	letter-spacing: -0.015em;
}

.lead__with {
	margin: 0 0 var(--head-gap);
	font-family: var(--serif);
	font-size: 1.1875rem;
	font-style: italic;
	font-weight: 300;
}

.lead__intro {
	max-width: 36ch;
	margin: var(--head-gap) 0 0;
	padding-top: var(--head-gap);
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-size: 0.9375rem;
}

@media (max-width: 899px) {
	.lead {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------- sections ---------- */
.section {
	max-width: 1500px;
	margin: 0 auto;
	padding: calc(var(--section) / 2) var(--gutter);
}

.section__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 4px 24px;
	margin-bottom: var(--head-gap);
	padding-bottom: 12px;
	border-bottom: 1px solid var(--rule);
}

.section__head h2 {
	margin: 0;
	font-size: clamp(1.625rem, 3vw, 2.25rem);
}

.section__head a {
	color: var(--muted);
	font-size: 0.9375rem;
}

/* ---------- pairings ---------- */
.pairing-list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: var(--row-gap) var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.pairing__row {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	margin-top: 8px;
}

.pairing > .photo-frame {
	cursor: pointer;
}

.pairing > .photo-frame img {
	transition: opacity 0.2s;
}

.pairing > .photo-frame:hover img {
	opacity: 0.85;
}

.pairing__open {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	line-height: inherit;
	text-align: left;
	cursor: pointer;
}

.pairing__open:hover {
	color: var(--signal);
}

.lead__title:focus {
	outline: 0;
}

.pairing__track {
	margin: 0 0 2px;
	font-size: 1.3125rem;
}

@media (max-width: 699px) {
	.pairing-list {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* ---------- moods ---------- */
.mood-list {
	columns: 2;
	column-gap: var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mood-list li {
	break-inside: avoid;
	border-bottom: 1px solid var(--rule);
}

.mood-list a {
	display: flex;
	align-items: baseline;
	gap: 12px;
	padding: 13px 0;
	text-decoration: none;
}

.mood-list__title {
	flex: 1;
	min-width: 0;
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.25rem;
	font-weight: 300;
	transition: color 0.15s;
}

.mood-list__title::before {
	content: "";
	display: inline-block;
	width: 9px;
	height: 9px;
	margin-right: 12px;
	border-radius: 50%;
	background: hsl(var(--h) 55% 60%);
	transform: translateY(-2px);
}

.mood-list a:hover .mood-list__title {
	color: var(--signal);
}

.mood-list__count {
	flex: none;
	color: var(--muted);
	font-size: 0.8125rem;
}

@media (max-width: 699px) {
	.mood-list {
		columns: 1;
	}
}

/* ---------- series ---------- */
.series__group {
	margin: var(--row-gap) 0 12px;
}

.series__group:first-of-type {
	margin-top: 0;
}

/* Each group fills the full width, whatever its number of series. */
.series-grid {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(0, 1fr);
	gap: var(--row-gap) var(--gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 699px) {
	.series-grid {
		grid-auto-flow: row;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.series-grid li:last-child:nth-child(odd) {
		grid-column: 1 / -1;
	}
}

.series-grid a {
	display: block;
	text-decoration: none;
}

.series-grid .photo-frame {
	aspect-ratio: 3 / 2;
}

.series-grid img {
	height: 100%;
	object-fit: cover;
	transition: opacity 0.2s;
}

.series-grid a:hover img {
	opacity: 0.8;
}

.series-grid__title {
	display: block;
	margin-top: 8px;
	color: var(--ink);
}

.series-grid a:hover .series-grid__title {
	color: var(--signal);
}

/* ---------- blog ---------- */
.post-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
	gap: var(--row-gap) var(--gap);
}

.card .photo-frame {
	aspect-ratio: 3 / 2;
	margin-bottom: 12px;
}

.card .photo-frame img {
	height: 100%;
	object-fit: cover;
}

.card__title {
	margin: 4px 0 8px;
	font-size: 1.3125rem;
}

.card__title a {
	text-decoration: none;
}

.card__excerpt p {
	margin: 0;
	font-size: 0.9375rem;
}

/* ---------- pages and articles ---------- */
.page-head {
	margin-bottom: 26px;
}

.page-head h1 {
	margin: 6px 0 0;
	font-size: clamp(2.25rem, 5vw, 3.75rem);
	letter-spacing: -0.01em;
}

.page-head__intro {
	max-width: var(--measure);
	margin-top: 10px;
	color: var(--muted);
}

.article {
	max-width: calc(var(--measure) + 2 * var(--gutter));
	margin: 0 auto;
	padding: clamp(20px, 4vw, 48px) var(--gutter) clamp(48px, 6vw, 88px);
}

.article--wide {
	max-width: 1500px;
}

.article--wide .entry-content > p,
.article--wide .entry-content > h2,
.article--wide .entry-content > h3,
.article--wide .entry-content > ul {
	max-width: var(--measure);
}

.entry-content {
	overflow-wrap: break-word;
}

.entry-content h2 {
	margin: 1.8em 0 0.5em;
	font-size: 1.875rem;
}

.entry-content h3 {
	margin: 1.6em 0 0.4em;
	font-size: 1.4375rem;
}

.entry-content img {
	height: auto;
}

.entry-content a {
	color: var(--ink);
	text-decoration-color: var(--signal);
}

.entry-content blockquote {
	margin: 1.6em 0;
	padding-left: 20px;
	border-left: 1px solid var(--signal);
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.25rem;
	font-weight: 300;
}

.entry-content pre {
	overflow-x: auto;
	padding: 18px;
	background: var(--surface);
}

.alignright {
	float: right;
	margin: 0.4em 0 1em 1.5em;
}

.alignleft {
	float: left;
	margin: 0.4em 1.5em 1em 0;
}

.aligncenter {
	display: block;
	margin-right: auto;
	margin-left: auto;
}

.wp-caption,
figure {
	max-width: 100%;
}

.wp-caption-text,
figcaption {
	color: var(--muted);
	font-size: 0.8125rem;
}

/* ---------- listen while you look ---------- */
.score {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 26px;
	padding: 12px 0;
	border-top: 1px solid var(--rule);
	border-bottom: 1px solid var(--rule);
}

.score p {
	margin: 0;
	line-height: 1.3;
}

.score .eyebrow {
	display: block;
}

.score__track {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.1875rem;
	font-weight: 300;
}

/* ---------- posts navigation, forms, comments ---------- */
.post-navigation .nav-links,
.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 16px;
	margin-top: 40px;
	padding-top: 18px;
	border-top: 1px solid var(--rule);
}

.post-navigation a {
	color: var(--ink);
	text-decoration: none;
}

.post-navigation .eyebrow {
	display: block;
}

.page-numbers.current {
	color: var(--signal);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="number"],
input[type="search"],
select,
textarea {
	max-width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--wave);
	border-radius: 0;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

input[type="submit"],
button[type="submit"],
.search-submit {
	padding: 10px 22px;
	border: 1px solid var(--signal);
	border-radius: 0;
	background: none;
	color: var(--signal);
	font: inherit;
	cursor: pointer;
}

input[type="submit"]:hover,
button[type="submit"]:hover,
.search-submit:hover {
	background: var(--signal);
	color: var(--on-signal);
}

/* ---------- footer ---------- */
.site-footer {
	display: grid;
	justify-items: center;
	gap: 14px;
	text-align: center;
	margin-top: calc(var(--section) / 2);
	padding: calc(var(--section) / 2) var(--gutter);
	border-top: 1px solid var(--rule);
	color: var(--muted);
	font-size: 0.9375rem;
}

.site-footer__invite {
	margin: 0;
	color: var(--ink);
	font-family: var(--serif);
	font-size: clamp(1.25rem, 2.4vw, 1.75rem);
	font-weight: 300;
	line-height: 1.25;
}

.site-footer__invite a {
	text-decoration-color: var(--signal);
}

.site-footer__links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 4px 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-footer__copyright {
	margin: 0;
	font-size: 0.8125rem;
	white-space: nowrap;
}


/* ---------- player ---------- */
/*
 * YouTube's terms require the player to stay visible at 200x200 or more and uncovered,
 * so the video tile is part of the dock rather than hidden behind custom controls.
 */
.dock {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 30;
	display: flex;
	align-items: stretch;
	border-top: 1px solid var(--wave);
	background: var(--surface);
}

.dock[hidden] {
	display: none;
}

.dock__video {
	position: relative;
	flex: none;
	width: 200px;
	height: 200px;
	background: #000;
}

.dock__video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	opacity: 0.55;
	transition: opacity 0.2s;
}

/* The album cover sits back so the photographs lead, and returns when pointed at. */
.dock__video:hover iframe,
.dock__video:focus-within iframe {
	opacity: 1;
}

.dock__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	justify-content: center;
	gap: 8px;
	min-width: 0;
	padding: 12px var(--gutter);
}

.dock__title,
.dock__source {
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.dock__title {
	color: var(--ink);
	font-family: var(--serif);
	font-size: 1.5rem;
	font-weight: 300;
	line-height: 1.25;
}

.dock__source {
	color: var(--muted);
	font-size: 0.875rem;
}

.dock__seek {
	display: flex;
	align-items: center;
	gap: 12px;
	color: var(--muted);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
}

.dock__wave {
	position: relative;
	flex: 1;
	min-width: 0;
	height: 44px;
}

.dock__wave .wave {
	margin: 0;
}

.dock__wave input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.dock__wave input:focus-visible {
	opacity: 0.35;
}

.dock__controls {
	display: flex;
	align-items: center;
	gap: 6px;
}

.dock__controls button {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--ink);
	cursor: pointer;
}

.dock__controls button:hover {
	background: var(--rule);
}

.dock__controls svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
}

.dock__controls .dock__play {
	border: 1px solid var(--signal);
	color: var(--signal);
}

.dock__controls .dock__play:hover {
	background: var(--signal);
	color: var(--on-signal);
}

.dock__external {
	margin-left: 10px;
	color: var(--muted);
	font-size: 0.875rem;
}

.dock__controls .dock__close {
	margin-left: auto;
	color: var(--muted);
}

/* On wider screens the player is a small corner card, so it stays off the photographs. */
@media (min-width: 900px) {
	.has-dock {
		--dock-space: 390px;
	}

	.dock {
		right: 16px;
		bottom: 16px;
		left: auto;
		flex-direction: column;
		width: 232px;
		border: 1px solid var(--rule);
	}

	.dock__video {
		width: 100%;
	}

	.dock__body {
		flex: none;
		gap: 6px;
		padding: 10px 12px;
	}

	.dock__title {
		font-size: 1.125rem;
		white-space: normal;
	}

	.dock__source {
		font-size: 0.75rem;
		line-height: 1.35;
		white-space: normal;
	}

	.dock__seek > span,
	.dock__external {
		display: none;
	}

	.dock__wave,
	.dock__wave .wave {
		height: 28px;
	}

	.dock__controls {
		gap: 2px;
	}

	.dock__controls button {
		width: 36px;
		height: 36px;
	}
}

@media (max-width: 699px) {
	.has-dock {
		--dock-space: 216px;
	}

	.dock__body {
		gap: 4px;
		padding: 8px 10px;
	}

	.dock__title {
		font-size: 1.0625rem;
	}

	.dock__source {
		font-size: 0.8125rem;
	}

	.dock__seek > span,
	.dock__external {
		display: none;
	}

	.dock__wave,
	.dock__wave .wave {
		height: 32px;
	}

	.dock__controls {
		gap: 0;
	}

	.dock__controls button {
		width: 36px;
		height: 36px;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
