/*
Theme Name: Gest
Theme URI: https://pawelgolinski.pl
Author: Paweł Goliński
Author URI: https://pawelgolinski.pl
Description: Block theme for Paweł Goliński: one site, two sides. A crossroads front page with the avatar split in half leads to the composer portfolio (paper, ink and carmine; Bodoni Moda and Jost) and to the programmer side (dark terminal, phosphor green; monospace).
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
Version: 2.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: gest
Tags: block-theme, full-site-editing, one-column, custom-colors, editor-style
*/

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

html {
	scroll-behavior: smooth;
	scroll-padding-top: 6rem;
}

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

body.gest-strona-programista,
body.gest-strona-rozdroze {
	background-color: var(--wp--preset--color--noc);
	color: var(--wp--preset--color--kreda);
}

/* Sticky header (sticky must sit on the template part wrapper, not inside it). */
header.wp-block-template-part {
	position: sticky;
	top: 0;
	z-index: 100;
}

.admin-bar header.wp-block-template-part {
	top: var(--wp--admin--admin-bar--height, 32px);
}

@media (max-width: 600px) {
	.admin-bar header.wp-block-template-part {
		top: 0;
	}
}

/* Embeds never overflow on small screens. */
.wp-block-embed iframe {
	max-width: 100%;
}

.wp-block-embed.wp-has-aspect-ratio iframe {
	width: 100%;
}

/* Colour slugs of the first version of the theme, still used in saved page content. */
.has-koniak-color { color: var(--wp--preset--color--karmin) !important; }
.has-wielbladzi-color { color: var(--wp--preset--color--cynober) !important; }
.has-popiel-color { color: var(--wp--preset--color--grafit) !important; }

/* ---------------------------------------------------------------------------
   Focus: always visible, in the colour of the surrounding text
--------------------------------------------------------------------------- */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.wp-element-button:focus-visible,
.wp-block-button__link:focus-visible {
	outline: 2px solid var(--wp--preset--color--atrament);
	outline-offset: 3px;
}

.is-style-sekcja-atrament .wp-element-button:focus-visible,
.is-style-sekcja-atrament .wp-block-button__link:focus-visible,
.is-style-sekcja-karmin .wp-element-button:focus-visible,
.is-style-sekcja-karmin .wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--papier);
}

.is-style-sekcja-noc .wp-element-button:focus-visible,
.is-style-sekcja-noc .wp-block-button__link:focus-visible,
.is-style-sekcja-panel .wp-element-button:focus-visible,
.is-style-sekcja-panel .wp-block-button__link:focus-visible {
	outline-color: var(--wp--preset--color--fosfor);
}

/* ---------------------------------------------------------------------------
   Crossroads: the split face on the front page (and the 404 page)
--------------------------------------------------------------------------- */

.rozdroze {
	position: relative;
	isolation: isolate;
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: 100vh;
	min-height: 100svh;
	overflow: hidden;
	background: linear-gradient(90deg, var(--wp--preset--color--noc) 50%, var(--wp--preset--color--papier) 50%);
}

.admin-bar .rozdroze {
	min-height: calc(100svh - var(--wp-admin--admin-bar--height, 32px));
}

.rozdroze > * {
	margin-block: 0 !important;
}

.rozdroze__pol {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	gap: 0.6rem;
	min-width: 0;
	padding: clamp(1rem, 4vw, 3.5rem);
	padding-bottom: clamp(2.5rem, 9vh, 5.5rem);
}

.rozdroze__pol > * {
	margin: 0 !important;
}

.rozdroze__pol--dev {
	align-items: flex-start;
	text-align: left;
	color: var(--wp--preset--color--kreda);
	font-family: var(--wp--preset--font-family--mono);
}

.rozdroze__pol--kompozytor {
	align-items: flex-end;
	text-align: right;
	color: var(--wp--preset--color--atrament);
}

.rozdroze__etykieta {
	font-size: var(--wp--preset--font-size--x-small);
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.rozdroze__pol--dev .rozdroze__etykieta {
	color: var(--wp--preset--color--fosfor);
	letter-spacing: 0.04em;
	text-transform: none;
	font-size: var(--wp--preset--font-size--small);
}

.rozdroze__pol--kompozytor .rozdroze__etykieta {
	color: var(--wp--preset--color--karmin);
}

.rozdroze__tytul {
	font-size: clamp(1.4rem, 5.2vw, 4rem) !important;
	line-height: 1 !important;
	overflow-wrap: anywhere;
}

.rozdroze__pol--dev .rozdroze__tytul {
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 600;
	letter-spacing: -0.03em;
}

.rozdroze__pol--kompozytor .rozdroze__tytul {
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
	font-weight: 400;
	overflow-wrap: normal;
	hyphens: none;
}

.rozdroze__tytul a {
	color: inherit;
	text-decoration: none;
}

/* The whole half is the link (stretched link keeps one accessible name). */
.rozdroze__tytul a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 5;
	cursor: pointer;
}

.rozdroze__tytul a:focus-visible {
	outline: none;
}

.rozdroze__tytul a:focus-visible::after {
	outline: 3px solid currentColor;
	outline-offset: -0.75rem;
}

.rozdroze__pol--dev .rozdroze__tytul a:focus-visible::after {
	outline-color: var(--wp--preset--color--fosfor);
}

.rozdroze__pol--dev .rozdroze__tytul a::before {
	content: "> ";
	color: var(--wp--preset--color--fosfor);
}

.rozdroze__opis {
	max-width: 22ch;
	font-size: clamp(0.8125rem, 1.6vw, 1.0625rem);
	line-height: 1.45;
}

.rozdroze__pol--dev .rozdroze__opis {
	color: var(--wp--preset--color--mgla);
}

.rozdroze__pol--kompozytor .rozdroze__opis {
	color: var(--wp--preset--color--grafit);
}

/* The other half dims while one is hovered or focused. */
.rozdroze__pol::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 4;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.45s ease;
}

.rozdroze__pol--dev::before {
	background: var(--wp--preset--color--noc);
}

.rozdroze__pol--kompozytor::before {
	background: var(--wp--preset--color--papier);
}

.rozdroze:has(.rozdroze__pol--kompozytor:hover) .rozdroze__pol--dev::before,
.rozdroze:has(.rozdroze__pol--kompozytor:focus-within) .rozdroze__pol--dev::before,
.rozdroze:has(.rozdroze__pol--dev:hover) .rozdroze__pol--kompozytor::before,
.rozdroze:has(.rozdroze__pol--dev:focus-within) .rozdroze__pol--kompozytor::before {
	opacity: 0.6;
}

.rozdroze__twarz {
	position: absolute;
	z-index: -1;
	left: 50%;
	top: 46%;
	width: min(70vh, 92vw);
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.rozdroze__twarz .gest-twarz {
	display: block;
	width: 100%;
	height: 100%;
}

.rozdroze__imie {
	position: absolute;
	z-index: 3;
	top: clamp(1rem, 5vh, 3rem);
	left: 0;
	right: 0;
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 0;
	font-size: clamp(1.25rem, 4.4vw, 3.25rem);
	font-weight: 400;
	line-height: 1;
	pointer-events: none;
}

.rozdroze__imie-dev {
	justify-self: end;
	padding-right: 0.35em;
	color: var(--wp--preset--color--fosfor);
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 600;
	letter-spacing: -0.03em;
}

.rozdroze__imie-kompozytor {
	justify-self: start;
	padding-left: 0.35em;
	color: var(--wp--preset--color--atrament);
	font-family: var(--wp--preset--font-family--display);
}

.rozdroze--404 .rozdroze__imie-kompozytor {
	font-style: italic;
}

.rozdroze__podpowiedz {
	position: absolute;
	z-index: 3;
	left: 0;
	right: 0;
	bottom: 0.75rem;
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small);
	pointer-events: none;
}

.rozdroze__podpowiedz span:first-child {
	justify-self: end;
	padding-right: 1rem;
	color: var(--wp--preset--color--mgla);
	font-family: var(--wp--preset--font-family--mono);
}

.rozdroze__podpowiedz span:last-child {
	justify-self: start;
	padding-left: 1rem;
	color: var(--wp--preset--color--grafit);
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

@media (max-width: 600px) {
	.rozdroze__podpowiedz {
		display: none;
	}
}

@media (max-width: 480px) {
	.rozdroze__pol--dev .rozdroze__tytul a::before {
		content: none;
	}
}

/* Phones: name on top, the face right under it, the two doors at the bottom. */
@media (max-width: 781px) {
	.rozdroze__imie {
		top: clamp(1.25rem, 4svh, 2rem);
		font-size: clamp(1.75rem, 8.5vw, 2.5rem);
	}

	.rozdroze__twarz {
		top: calc(clamp(1.25rem, 4svh, 2rem) + clamp(1.75rem, 8.5vw, 2.5rem) + 0.75rem);
		width: min(100vw, 56svh);
		transform: translateX(-50%);
	}

	.rozdroze__pol {
		padding-inline: 1rem;
		padding-bottom: clamp(1.5rem, 5svh, 2.5rem);
	}

	.rozdroze__tytul {
		font-size: clamp(1.35rem, 6.6vw, 2rem) !important;
		overflow-wrap: normal;
	}

	/* "Programista" in monospace must fit half of a 320–375 px screen. */
	.rozdroze__pol--dev .rozdroze__tytul {
		font-size: clamp(1.05rem, 5.4vw, 2rem) !important;
		letter-spacing: -0.04em;
	}

	.rozdroze__opis {
		font-size: 0.8125rem;
	}
}

/* ---------------------------------------------------------------------------
   The face (SVG drawn by gest_face_svg())
--------------------------------------------------------------------------- */

.gest-twarz {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.gest-twarz__okrag {
	fill: none;
	stroke-width: 2;
	vector-effect: non-scaling-stroke;
}

.gest-twarz__dev .gest-twarz__okrag {
	stroke: var(--wp--preset--color--krawedz);
	stroke-dasharray: 4 8;
}

.gest-twarz__piksel {
	fill: var(--wp--preset--color--fosfor);
}

.gest-twarz__kontur {
	fill: none;
	stroke: var(--wp--preset--color--fosfor);
	stroke-width: 1.5;
	vector-effect: non-scaling-stroke;
	opacity: 0.7;
}

.gest-twarz__kompozytor .gest-twarz__okrag {
	stroke: var(--wp--preset--color--atrament);
	stroke-width: 1;
}

.gest-twarz__pieciolinia line {
	stroke: var(--wp--preset--color--atrament);
	stroke-width: 1;
	vector-effect: non-scaling-stroke;
	opacity: 0.45;
}

.gest-twarz__tusz {
	fill: var(--wp--preset--color--atrament);
}

/* Half faces in the two hero bands: the cut edge faces the text. */
.gest-otwarcie__twarz .gest-twarz {
	max-height: min(70vh, 520px);
	width: auto;
	max-width: 100%;
}

.gest-otwarcie:not(.gest-otwarcie--dev) .gest-otwarcie__twarz .gest-twarz {
	margin-right: auto;
}

.gest-otwarcie--dev .gest-otwarcie__twarz .gest-twarz {
	margin-left: auto;
}

/* Phones: a small half face that sits on the text edge, never pushing the headline off screen. */
@media (max-width: 781px) {
	.gest-otwarcie > .wp-block-columns {
		gap: var(--wp--preset--spacing--40);
	}

	.gest-otwarcie__twarz .gest-twarz {
		max-height: 200px;
		margin: 0 !important;
	}

	.gest-otwarcie--dev .gest-otwarcie__twarz .gest-twarz {
		max-height: 150px;
	}

	.gest-otwarcie--dev h1 {
		font-size: clamp(2rem, 9.5vw, 2.5rem) !important;
	}

	.gest-otwarcie--dev .has-large-font-size {
		font-size: 1.0625rem !important;
	}
}

/* ---------------------------------------------------------------------------
   Headers and navigation
--------------------------------------------------------------------------- */

.gest-logo img {
	display: block;
	min-width: 140px;
	height: auto;
}

.gest-naglowek .wp-block-navigation a {
	color: inherit;
	text-decoration: none;
}

.gest-naglowek .wp-block-navigation a:hover {
	text-decoration: underline;
	text-underline-offset: 0.45em;
	text-decoration-thickness: 1px;
}

.gest-naglowek--kompozytor .wp-block-navigation .current-menu-item > a,
.gest-naglowek--kompozytor .wp-block-navigation a[aria-current="page"] {
	text-decoration: underline;
	text-decoration-color: var(--wp--preset--color--karmin);
	text-underline-offset: 0.45em;
	text-decoration-thickness: 2px;
}

.gest-naglowek--programista .wp-block-navigation .current-menu-item > a,
.gest-naglowek--programista .wp-block-navigation a[aria-current="page"] {
	color: var(--wp--preset--color--fosfor);
}

.gest-naglowek--programista .wp-block-navigation {
	letter-spacing: 0;
}

/* The switch to the other side looks like the other side. */
.gest-naglowek--kompozytor .gest-przelacznik > a {
	padding: 0.3rem 0.6rem;
	border-radius: 4px;
	background: var(--wp--preset--color--noc);
	color: var(--wp--preset--color--fosfor) !important;
	font-family: var(--wp--preset--font-family--mono);
	letter-spacing: 0;
}

.gest-naglowek--programista .gest-przelacznik > a {
	padding: 0.3rem 0.7rem;
	background: var(--wp--preset--color--papier);
	color: var(--wp--preset--color--atrament) !important;
	font-family: var(--wp--preset--font-family--display);
	font-style: italic;
}

.gest-naglowek .gest-przelacznik > a:focus-visible {
	outline-color: currentColor;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: var(--wp--preset--spacing--50);
}

.gest-naglowek--kompozytor .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	letter-spacing: 0;
}

.gest-naglowek--programista .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
	font-size: var(--wp--preset--font-size--large);
}

/* Programmer wordmark with a blinking cursor. */
.gest-znak-dev {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono);
	font-size: 1.0625rem;
	font-weight: 600;
	white-space: nowrap;
}

.gest-znak-dev a {
	color: var(--wp--preset--color--kreda) !important;
	text-decoration: none;
}

.gest-znak-dev__prompt {
	color: var(--wp--preset--color--fosfor);
}

.gest-kursor {
	color: var(--wp--preset--color--fosfor);
	animation: gest-mrugniecie 1.1s steps(1) infinite;
}

@keyframes gest-mrugniecie {
	50% {
		opacity: 0;
	}
}

/* Room for the PL / EN switcher that will come later. */
.gest-lang-slot:empty {
	display: none;
}

/* ---------------------------------------------------------------------------
   Composer side
--------------------------------------------------------------------------- */

/* Cards with a thin top rule (vermilion on ink, carmine on paper). */
.gest-card {
	border-top: 1px solid var(--wp--preset--color--karmin);
	padding-top: var(--wp--preset--spacing--30);
}

.is-style-sekcja-atrament .gest-card {
	border-top-color: var(--wp--preset--color--cynober);
}

/* A stave: five hairlines instead of one. */
.wp-block-separator.gest-pieciolinia {
	height: 33px;
	border: 0 !important;
	background: repeating-linear-gradient(180deg, var(--wp--preset--color--atrament) 0 1px, transparent 1px 8px);
	opacity: 0.35;
}

/* Score title page: thin carmine rule under the title. */
.gest-score-title {
	text-align: center;
}

.gest-score-title::after {
	content: "";
	display: block;
	width: 4rem;
	height: 1px;
	margin: var(--wp--preset--spacing--40) auto 0;
	background: var(--wp--preset--color--karmin);
}

/* Simple lists: hairline between rows. */
.gest-lista .wp-block-post {
	border-bottom: 1px solid var(--wp--preset--color--pieciolinia);
	padding-block: var(--wp--preset--spacing--30);
}

.gest-lista .wp-block-post:first-child {
	border-top: 1px solid var(--wp--preset--color--pieciolinia);
}

.gest-lista .wp-block-post-title a {
	color: inherit;
	text-decoration: none;
}

.gest-lista .wp-block-post-title a:hover {
	text-decoration: underline;
}

.gest-utwory {
	list-style: none;
	padding-left: 0;
}

.gest-utwory li {
	border-bottom: 1px solid var(--wp--preset--color--pieciolinia);
	padding-block: 0.75rem;
}

/* Work details table on work pages. */
.gest-metryczka table {
	border-collapse: collapse;
}

.gest-metryczka th,
.gest-metryczka td {
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--pieciolinia);
	padding: 0.6rem 0;
	text-align: left;
	vertical-align: top;
}

.gest-metryczka th {
	width: 35%;
	padding-right: 1rem;
	font-size: var(--wp--preset--font-size--x-small);
	font-weight: 500;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

/* Editor-only hint for empty image placeholders. */
.gest-editor-note {
	font-size: var(--wp--preset--font-size--small);
	opacity: 0.8;
}

/* ---------------------------------------------------------------------------
   Programmer side
--------------------------------------------------------------------------- */

.is-style-komentarz.wp-block-post-date::before,
.is-style-komentarz.wp-block-post-terms::before {
	content: "// ";
}

.is-style-komentarz a {
	color: inherit !important;
}

.gest-terminal-linia {
	color: var(--wp--preset--color--kreda);
	overflow-wrap: anywhere;
}

.gest-terminal-linia__prompt {
	color: var(--wp--preset--color--fosfor);
}

/* Application cards drawn as terminal windows. */
.gest-okno {
	height: 100%;
	padding: 0 var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
	border: 1px solid var(--wp--preset--color--krawedz);
	border-radius: 10px;
	background: var(--wp--preset--color--panel);
	transition: border-color 0.25s ease, transform 0.25s ease;
}

.gest-okno:hover {
	border-color: var(--wp--preset--color--fosfor);
	transform: translateY(-2px);
}

.gest-okno > * {
	margin: 0;
}

.gest-okno__pasek {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin: 0 calc(-1 * var(--wp--preset--spacing--40)) var(--wp--preset--spacing--30) !important;
	padding: 0.6rem var(--wp--preset--spacing--40);
	border-bottom: 1px solid var(--wp--preset--color--krawedz);
	color: var(--wp--preset--color--mgla);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--x-small);
}

.gest-okno__kropki,
.gest-okno__kropki::before,
.gest-okno__kropki::after {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--wp--preset--color--krawedz);
}

.gest-okno__kropki {
	position: relative;
	margin-right: 28px;
}

.gest-okno__kropki::before,
.gest-okno__kropki::after {
	content: "";
	position: absolute;
	top: 0;
}

.gest-okno__kropki::before {
	left: 14px;
}

.gest-okno__kropki::after {
	left: 28px;
	background: var(--wp--preset--color--fosfor);
}

.gest-okno__tagi {
	margin-top: auto !important;
	padding-top: var(--wp--preset--spacing--20);
}

/* Blog list as a log. */
.gest-log .wp-block-post {
	padding-block: var(--wp--preset--spacing--40);
	border-bottom: 1px solid var(--wp--preset--color--krawedz);
}

.gest-log .wp-block-post:first-child {
	border-top: 1px solid var(--wp--preset--color--krawedz);
}

.gest-log .wp-block-post-title {
	margin-block: 0.25rem 0.5rem;
}

.gest-log .wp-block-post-title a {
	color: var(--wp--preset--color--kreda);
	text-decoration: none;
}

.gest-log .wp-block-post-title a:hover {
	color: var(--wp--preset--color--fosfor);
	text-decoration: underline;
}

.gest-log .wp-block-post-excerpt__excerpt {
	margin: 0;
}

/* Post content on the programmer side. */
.gest-strona-programista .wp-block-post-content :where(h2, h3, h4) {
	font-family: var(--wp--preset--font-family--mono);
	font-weight: 600;
	letter-spacing: -0.01em;
}

.gest-strona-programista .wp-block-post-content :where(h2)::before {
	content: "## ";
	color: var(--wp--preset--color--fosfor);
}

.gest-strona-programista :where(p, li) code {
	padding: 0.1em 0.35em;
	border-radius: 4px;
	background: var(--wp--preset--color--panel);
	color: var(--wp--preset--color--fosfor);
	font-family: var(--wp--preset--font-family--mono);
	font-size: 0.9em;
}

.gest-strona-programista .wp-block-separator {
	border-color: var(--wp--preset--color--krawedz);
	color: var(--wp--preset--color--krawedz);
}

.gest-strona-programista .wp-block-quote {
	border-left-color: var(--wp--preset--color--fosfor);
	font-family: var(--wp--preset--font-family--text);
	font-style: normal;
}

.gest-strona-programista .wp-block-image img {
	border-radius: 6px;
}

.gest-strona-programista .wp-block-post-navigation-link a,
.gest-strona-programista .wp-block-query-pagination a {
	color: var(--wp--preset--color--blekit);
}

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

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

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}

	.gest-kursor {
		animation: none;
	}

	.gest-okno:hover {
		transform: none;
	}
}
