/*
Theme Name: Bowline
Description: A quiet, simple theme for a game and a few projects.
Version: 1.1.1
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: bowline
*/

/* Base ------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
}

body {
	background-image: radial-gradient(ellipse 70% 40rem at 50% -12rem, color-mix(in srgb, var(--wp--preset--color--accent) 10%, transparent), transparent 70%);
	background-repeat: no-repeat;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

::selection {
	background: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--base);
}

a {
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

:where(a, button):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 3px;
	border-radius: 2px;
}

section[id] {
	scroll-margin-top: 1.5rem;
}

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

.bw-header .wp-block-site-title a {
	color: var(--wp--preset--color--contrast);
}

/* Page content --------------------------------------------------------- */

.wp-block-post-content h2 {
	margin-block-start: var(--wp--preset--spacing--50);
	font-size: var(--wp--preset--font-size--large);
}

.wp-block-post-content li + li {
	margin-top: 0.5rem;
}

.wp-block-post-content > .alignwide,
.wp-block-post-content > .alignwide + * {
	margin-block-start: var(--wp--preset--spacing--50);
}

.wp-block-post-content .wp-block-image img {
	border-radius: 14px;
	box-shadow: 0 0 0 1px var(--wp--preset--color--line);
}

/* Front page: short lines set large, under the banner. */
.bw-home .wp-block-post-content > p {
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.3;
}

/* Haven Road page: the first line ("Keep the green.") reads as a subtitle. */
.bw-lead > p:first-child {
	color: var(--wp--preset--color--muted);
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--large);
}

/* Play card ------------------------------------------------------------- */

.bw-player {
	position: relative;
	width: min(100%, calc(80svh * 16 / 9));
	aspect-ratio: 16 / 9;
	margin-inline: auto;
	overflow: hidden;
	isolation: isolate;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 18px;
	background:
		radial-gradient(55% 75% at 50% 45%, color-mix(in srgb, var(--wp--preset--color--accent) 13%, transparent), transparent 75%),
		radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--wp--preset--color--contrast) 9%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
		var(--wp--preset--color--surface);
	box-shadow: 0 40px 100px -50px var(--wp--custom--shadow);
}

/* In the editor the HTML block is wrapped, so let the wrapper go wide too. */
.is-layout-constrained > .wp-block-html:has(.bw-player.alignwide) {
	max-width: var(--wp--style--global--wide-size);
}

.bw-player__poster {
	position: absolute;
	inset: 0;
	z-index: -1;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.7;
	transition: opacity 0.3s ease;
}

.bw-player:hover .bw-player__poster {
	opacity: 0.85;
}

.bw-player__start {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.1rem;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: 0.02em;
	text-decoration: none;
}

.bw-player__start:hover {
	color: var(--wp--preset--color--contrast);
}

.bw-player__start:focus-visible {
	outline-offset: -8px;
	border-radius: 12px;
}

.bw-player__icon {
	display: grid;
	place-items: center;
	width: 4.5rem;
	height: 4.5rem;
	border-radius: 50%;
	background: var(--wp--preset--color--contrast);
	box-shadow: 0 0 0 12px color-mix(in srgb, var(--wp--preset--color--contrast) 6%, transparent);
	transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

.bw-player__icon::before {
	content: "";
	width: 1.2rem;
	height: 1.35rem;
	margin-left: 0.25rem;
	background: var(--wp--preset--color--base);
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.bw-player__label {
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--wp--preset--color--base) 75%, transparent);
	backdrop-filter: blur(6px);
}

.bw-player__start:hover .bw-player__icon {
	transform: scale(1.06);
	background: var(--wp--preset--color--accent);
	box-shadow: 0 0 0 16px color-mix(in srgb, var(--wp--preset--color--accent) 12%, transparent);
}

/* With the game's title screen behind it, the screen speaks for itself: a small label in the corner, not the big button. */
.bw-player.has-poster .bw-player__poster,
.bw-player.has-poster:hover .bw-player__poster {
	opacity: 1;
	transition: transform 0.4s ease;
}

.bw-player.has-poster:hover .bw-player__poster {
	transform: scale(1.02);
}

.bw-player.has-poster .bw-player__start {
	align-items: flex-end;
	justify-content: flex-end;
	padding: clamp(0.75rem, 2vw, 1.25rem);
}

.bw-player.has-poster .bw-player__icon {
	display: none;
}

.bw-player.has-poster .bw-player__label {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.6rem 1.1rem;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
	box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
	transition: background-color 0.2s ease;
}

.bw-player.has-poster .bw-player__label::before {
	content: "";
	width: 0.6rem;
	height: 0.7rem;
	background: currentColor;
	clip-path: polygon(0 0, 100% 50%, 0 100%);
}

.bw-player.has-poster .bw-player__start:hover .bw-player__label {
	background: var(--wp--preset--color--accent);
}

/* On a phone the card is small: "Play" alone keeps clear of the title screen's own buttons. */
@media (max-width: 600px) {
	.bw-player.has-poster .bw-player__more {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

/* Store buttons (for when the store listings are live) ------------------ */

.bw-stores {
	gap: 0.75rem;
}

.bw-store .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	border: 1px solid var(--wp--preset--color--line);
	background: transparent;
	color: var(--wp--preset--color--contrast);
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.bw-store .wp-block-button__link::before {
	content: "";
	flex: none;
	width: 1.05em;
	height: 1.05em;
	background: currentColor;
	mask: var(--bw-icon) center / contain no-repeat;
}

.bw-store .wp-block-button__link:hover {
	border-color: var(--wp--preset--color--contrast);
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--base);
}

.bw-store--apple {
	--bw-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12.152 6.896c-.948 0-2.415-1.078-3.96-1.04-2.04.027-3.91 1.183-4.961 3.014-2.117 3.675-.546 9.103 1.519 12.09 1.013 1.454 2.208 3.09 3.792 3.039 1.52-.065 2.09-.987 3.935-.987 1.831 0 2.35.987 3.96.948 1.637-.026 2.676-1.48 3.676-2.948 1.156-1.688 1.636-3.325 1.662-3.415-.039-.013-3.182-1.221-3.22-4.857-.026-3.04 2.48-4.494 2.597-4.559-1.429-2.09-3.623-2.324-4.39-2.376-2-.156-3.675 1.09-4.61 1.09zM15.53 3.83c.843-1.012 1.4-2.427 1.245-3.83-1.207.052-2.662.805-3.532 1.818-.78.896-1.454 2.338-1.273 3.714 1.338.104 2.715-.688 3.559-1.701'/%3E%3C/svg%3E");
}

.bw-store--google {
	--bw-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M22.018 13.298l-3.919 2.218-3.515-3.493 3.543-3.521 3.891 2.202a1.49 1.49 0 0 1 0 2.594zM1.337.924a1.486 1.486 0 0 0-.112.568v21.017c0 .217.045.419.124.6l11.155-11.087L1.337.924zm12.207 10.065l3.258-3.238L3.45.195a1.466 1.466 0 0 0-.946-.179l11.04 10.973zm0 2.067l-11 10.933c.298.036.612-.016.906-.183l13.324-7.54-3.23-3.21z'/%3E%3C/svg%3E");
}

/* Projects --------------------------------------------------------------- */

.bw-projects__inner {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
	gap: 1.5rem 3rem;
	align-items: start;
}

.wp-block-group.bw-projects__inner > *,
.wp-block-group.bw-project-list > *,
.wp-block-group.bw-project > * {
	margin-block: 0;
}

.bw-projects__inner h2 {
	padding-top: 1.15rem;
}

.bw-project {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 15rem) minmax(0, 1fr) auto;
	gap: 0.35rem 2rem;
	align-items: baseline;
	padding-block: 1.5rem;
	border-top: 1px solid var(--wp--preset--color--line);
}

.bw-project:last-child {
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.bw-project h3 a {
	text-decoration: none;
	transition: color 0.2s ease;
}

.bw-project h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.bw-project p {
	color: var(--wp--preset--color--muted);
}

.bw-project .bw-project__meta {
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}

.bw-project:has(a) .bw-project__meta::after {
	content: "→";
	display: inline-block;
	margin-left: 0.75rem;
	letter-spacing: 0;
	transition: transform 0.2s ease, color 0.2s ease;
}

.bw-project:has(a:hover) .bw-project__meta::after {
	transform: translateX(4px);
	color: var(--wp--preset--color--accent);
}

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

.bw-footer {
	padding-top: var(--wp--preset--spacing--40);
	border-top: 1px solid var(--wp--preset--color--line);
	color: var(--wp--preset--color--muted);
}

.bw-footer a {
	text-decoration: none;
}

/* Small screens ---------------------------------------------------------- */

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

	.bw-projects__inner h2 {
		padding-top: 0;
	}

	.bw-project {
		grid-template-columns: minmax(0, 1fr) auto;
	}

	.bw-project > p:not(.bw-project__meta) {
		grid-row: 2;
		grid-column: 1 / -1;
	}
}
