/*
Theme Name: Jo Stephenson
Description: The 2010 "Jo Stephenson Sings" design (originally by Sam Starling), rebuilt as a lightweight block theme.
Version: 1.0.0
Requires at least: 6.6
Requires PHP: 8.1
Text Domain: jostephenson
License: GNU General Public License v2 or later
*/

/*
 * Layout: a centred 1000px stage.
 *   [ nav 190px ] [ content 530px ] [ Jo 200px ]
 * The header band is blue gingham; the page below is pale gingham.
 * Below 960px Jo moves up beside the logo and the nav becomes a row.
 */

html {
	overflow-y: scroll;
}

body {
	background: var(--wp--preset--color--base) url("assets/images/gingham-light.png");
}

.wp-site-blocks {
	/* Space for the footer to sit on white, as the original did. */
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}

.wp-site-blocks > main {
	flex: 1;
}

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

.js-header {
	background: url("assets/images/gingham.png");
}

.js-stage {
	position: relative;
	max-width: 1000px;
	margin-inline: auto;
}

.js-logo {
	margin: 0;
	padding-top: 2px;
	/* Tuck the tail of the stitched line under the page, as the original did. */
	margin-bottom: -12px;
}

.js-logo a {
	display: block;
	width: min(550px, 100%);
	aspect-ratio: 550 / 149;
	background: url("assets/images/logo.png") no-repeat 0 0 / contain;
	overflow: hidden;
	text-indent: 110%;
	white-space: nowrap;
}

.js-jo {
	position: absolute;
	right: 0;
	top: 42px;
	width: 200px;
	height: 321px;
	margin: 0;
	z-index: 2;
	pointer-events: none;
}

.js-jo img {
	display: block;
	width: 100%;
	height: auto;
}

/* ---------- Main three-column stage ---------- */

.js-main {
	display: grid;
	grid-template-columns: 190px minmax(0, 530px);
	column-gap: 35px;
	padding-top: 40px;
	padding-bottom: 60px;
	/* Leave the right-hand column clear for Jo: 1000 - 190 - 35 - 530. */
	padding-right: 245px;
}

.js-main > * {
	margin-block-start: 0;
}

/* ---------- Navigation ---------- */

.js-nav {
	align-self: start;
}

.js-nav .wp-block-navigation__container {
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

/*
 * The seven original pages use the 2010 lettering, redrawn as SVGs in
 * assets/images/nav/. Each word is a mask filled with a theme colour:
 * grey, red on hover, blue for the current page. The link text is still
 * there for screen readers and search engines, just not painted.
 */
.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content {
	--ink: var(--wp--preset--color--grey);
	position: relative;
	display: block;
	width: 190px;
	height: 30px;
	padding: 0;
	background: #fff;
	color: transparent !important;
	font-size: 14px;
	line-height: 30px;
	white-space: nowrap;
	overflow: hidden;
	text-decoration: none;
}

.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: var(--word);
	height: 30px;
	background-color: var(--ink);
	mask: var(--art) no-repeat 0 0 / contain;
	transition: background-color 0.15s;
}

.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content:hover,
.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content:focus-visible {
	--ink: var(--wp--preset--color--red);
}

.js-nav [class*="js-nav-"].current-menu-item > .wp-block-navigation-item__content,
.js-nav [class*="js-nav-"] > [aria-current="page"] {
	--ink: var(--wp--preset--color--blue);
}

/* --word is each word's width at 30px tall (SVG width × 30 / 128). */
.js-nav-about   { --art: url("assets/images/nav/about.svg");   --word: 134px; }
.js-nav-hire-jo { --art: url("assets/images/nav/hire-jo.svg"); --word: 145px; }
.js-nav-photos  { --art: url("assets/images/nav/photos.svg");  --word: 158px; }
.js-nav-songs   { --art: url("assets/images/nav/songs.svg");   --word: 134px; }
.js-nav-gigs    { --art: url("assets/images/nav/gigs.svg");    --word: 92px; }
.js-nav-contact { --art: url("assets/images/nav/contact.svg"); --word: 184px; }
.js-nav-album   { --art: url("assets/images/nav/album.svg");   --word: 133px; }

/*
 * Any page added to the menu later has no artwork, so it gets the nearest
 * web-font match: a light rounded face with a heavy outline, which leaves a
 * thin white line down each stroke like the original.
 */
.js-nav .wp-block-navigation-item:not([class*="js-nav-"]) > .wp-block-navigation-item__content {
	display: block;
	width: 190px;
	font-family: var(--wp--preset--font-family--nav);
	font-size: 35px;
	line-height: 30px;
	height: 30px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	text-decoration: none;
	color: #fff !important;
	-webkit-text-stroke: 5px var(--wp--preset--color--grey);
	paint-order: stroke fill;
	background: #fff;
	overflow: hidden;
}

.js-nav .wp-block-navigation-item:not([class*="js-nav-"]) > .wp-block-navigation-item__content:hover,
.js-nav .wp-block-navigation-item:not([class*="js-nav-"]) > .wp-block-navigation-item__content:focus-visible {
	-webkit-text-stroke-color: var(--wp--preset--color--red);
}

.js-nav .wp-block-navigation-item:not([class*="js-nav-"]).current-menu-item > .wp-block-navigation-item__content {
	-webkit-text-stroke-color: var(--wp--preset--color--blue);
}

/* ---------- Content ---------- */

.js-content .wp-block-post-title {
	margin-top: 0;
}

.js-content a {
	text-underline-offset: 0.15em;
}

.js-content .wp-block-gallery.has-nested-images figure.wp-block-image {
	flex-grow: 0;
}

.js-content .wp-block-gallery .wp-block-image img {
	padding: 6px;
	background: #fff;
	border: 1px solid #ddd;
}

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

.js-footer {
	background: #fff;
}

.js-footer .js-stage {
	padding-block: 1rem;
}

/* ---------- Narrow screens ---------- */

/* The three-column stage needs 1000px plus gutters. */
@media (max-width: 1039px) {
	.js-stage {
		padding-inline: 16px;
	}

	/* Logo and Jo side by side, both inside the gingham band. */
	.js-header .js-stage {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		gap: 12px;
		padding-top: 8px;
	}

	.js-logo {
		flex: 1 1 auto;
		max-width: 550px;
		margin-bottom: 8px;
	}

	.js-jo {
		position: static;
		flex: 0 0 auto;
		width: clamp(70px, 16vw, 130px);
		height: auto;
		margin-bottom: -1px;
	}

	.js-main {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 24px;
		padding-top: 20px;
		padding-right: 16px;
		max-width: calc(530px + 32px);
	}

	/* The nav becomes wrapped rows of words, each an easy tap target. */
	.js-nav .wp-block-navigation__container {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0 14px;
	}

	/* Word-width items, 44px tall for fingers, with the lettering centred. */
	.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content {
		width: var(--word);
		height: 44px;
		background: none;
	}

	.js-nav [class*="js-nav-"] > .wp-block-navigation-item__content::before {
		top: 7px;
	}

	.js-nav .wp-block-navigation-item:not([class*="js-nav-"]) > .wp-block-navigation-item__content {
		width: auto;
		height: 44px;
		line-height: 44px;
		background: none;
	}
}

@media (max-width: 480px) {
	.js-content .wp-block-post-title {
		font-size: 26px;
	}
}
