/*
Theme Name: Painter Notebook
Theme URI:
Author: Aggelos
Description: Minimal, hand-made block theme for a painter's portfolio. Works, series, studio journal, about and contact. Requires the Painter Core must-use plugin and Secure Custom Fields.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 8.1
Version: 0.1.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: painter-notebook
*/

/* ---------- Paper grain. Replace assets/images/paper.webp with a scan of the painter's own paper or linen
   (tileable, 256–512px, mostly transparent so the Paper colour shows through). ---------- */
body {
	background-image: url("assets/images/paper.webp");
	background-repeat: repeat;
	-webkit-font-smoothing: antialiased;
	font-optical-sizing: auto;
}

/* ---------- Header navigation: hand-drawn underline on the current item ---------- */
.wp-block-navigation .wp-block-navigation-item__content {
	position: relative;
	padding-block: 0.625rem;
}
.wp-block-navigation .current-menu-item > .wp-block-navigation-item__content::after,
.wp-block-navigation .current-menu-ancestor > .wp-block-navigation-item__content::after,
.wp-block-navigation .wp-block-navigation-item__content[aria-current="page"]::after,
.painter-is-works-section .wp-block-navigation .painter-nav-works > .wp-block-navigation-item__content::after,
.painter-is-journal-section .wp-block-navigation .painter-nav-journal > .wp-block-navigation-item__content::after {
	content: "";
	position: absolute;
	left: -4px;
	right: -4px;
	bottom: 0;
	height: 10px;
	background-color: var(--wp--preset--color--accent);
	-webkit-mask: url("assets/images/underline.svg") no-repeat center / 100% 100%;
	mask: url("assets/images/underline.svg") no-repeat center / 100% 100%;
	pointer-events: none;
}

/* ---------- Handwritten text (block style "Handwritten" on paragraph, heading) ---------- */
.is-style-handwritten {
	font-family: var(--wp--preset--font-family--hand);
	font-size: 1.875rem;
	line-height: 1.1;
	color: var(--wp--preset--color--accent);
	font-style: normal;
}

/* ---------- Text link style (block style "Underlined" on button) ---------- */
.wp-block-button.is-style-text-link .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--ink);
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--ink);
	padding: 0.375rem 0;
}
.wp-block-button.is-style-text-link .wp-block-button__link:hover {
	color: var(--wp--preset--color--accent);
	border-bottom-color: var(--wp--preset--color--accent);
	background: transparent;
}

/* ---------- Work grid: masonry with columns, images never cropped ---------- */
.wp-block-post-template.is-style-masonry,
.painter-masonry .wp-block-post-template {
	display: block;
	columns: 3 260px;
	column-gap: var(--wp--preset--spacing--40);
}
.painter-masonry .wp-block-post-template > li {
	break-inside: avoid;
	margin: 0 0 var(--wp--preset--spacing--40);
}
.painter-work-card .wp-block-post-featured-image img {
	/* No aspect-ratio override: the browser derives it from the width/height
	   attributes, so lazy-loaded images reserve the right space before loading. */
	width: 100%;
	height: auto !important;
	object-fit: contain !important;
	contain-intrinsic-size: none;
}
.painter-work-card .wp-block-post-featured-image {
	margin-bottom: 0.625rem;
}
.painter-work-card .wp-block-post-title {
	display: inline;
	font-size: var(--wp--preset--font-size--small);
	font-style: italic;
	line-height: 1.5;
	margin: 0;
}
.painter-work-card .painter-caption {
	display: inline;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.5;
	margin: 0;
}
.painter-work-card .painter-caption::before {
	content: ", ";
}

/* ---------- Status labels ---------- */
.painter-status {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}
.painter-status--sold {
	color: var(--wp--preset--color--accent);
}
.painter-status--available::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: var(--wp--preset--color--available);
}
.painter-work-card .painter-status {
	display: inline;
	font-size: var(--wp--preset--font-size--small);
	margin: 0;
}
.painter-work-card .painter-status::before {
	content: " · ";
	width: auto;
	height: auto;
	border-radius: 0;
	background: none;
	color: var(--wp--preset--color--muted);
}
.painter-work-card .painter-status--available {
	display: none; /* grid shows only sold / collection; "available" is the default and stays quiet */
}

/* ---------- Single work: metadata list ---------- */
.painter-meta {
	border-top: 1px solid var(--wp--preset--color--rule);
	padding-top: var(--wp--preset--spacing--30);
}
.painter-meta__grid {
	display: grid !important;
	grid-template-columns: 110px 1fr;
	gap: 0.75rem 1rem;
}
.painter-meta__grid > * {
	margin: 0 !important;
}
.painter-meta .painter-meta__label {
	color: var(--wp--preset--color--muted);
	margin: 0;
}
.painter-meta .painter-meta__value {
	margin: 0;
	font-size: inherit;
	color: var(--wp--preset--color--ink);
}
.painter-hero-image img {
	max-height: 85vh;
	width: auto;
	max-width: 100%;
	margin-inline: auto;
	display: block;
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

/* Full-screen lightbox: neutral ground, never paper colour, so colour can be judged */
.wp-lightbox-overlay .scrim {
	background-color: #1a1a1a !important;
	opacity: 0.96 !important;
}
.wp-lightbox-overlay .close-button {
	color: #f5f5f3;
}

/* ---------- Rules ---------- */
.painter-rule-top {
	border-top: 1px solid var(--wp--preset--color--rule);
}
.painter-rule-bottom {
	border-bottom: 1px solid var(--wp--preset--color--rule);
}

/* ---------- Image placeholders shown only in the editor when no image is set ---------- */
.wp-block-post-featured-image:empty {
	display: none;
}

/* ---------- Forms (contact page): match the design regardless of form plugin ---------- */
.painter-form input[type="text"],
.painter-form input[type="email"],
.painter-form select,
.painter-form textarea {
	font: inherit;
	font-size: 1.0625rem;
	color: var(--wp--preset--color--ink);
	background: #fffdf8;
	border: 1px solid #b9ae9b;
	border-radius: 0;
	padding: 0.75rem 0.875rem;
}
.painter-form input:focus-visible,
.painter-form select:focus-visible,
.painter-form textarea:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}
.painter-form button[type="submit"],
.painter-form input[type="submit"] {
	font: inherit;
	font-size: 1.125rem;
	min-height: 48px;
	padding: 0.85rem 2rem;
	border: 1px solid var(--wp--preset--color--ink);
	border-radius: 0;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--ground);
	cursor: pointer;
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
	.wp-block-site-title {
		font-size: 2.5rem !important;
	}
	.painter-meta__grid {
		grid-template-columns: 96px 1fr;
	}
}

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

/* ---------- Series navigation ([painter_series_nav]) ---------- */
.painter-series-nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	font-size: 1rem;
}
.painter-series-nav a {
	display: inline-block;
	padding: 0.5rem 0;
	color: var(--wp--preset--color--muted);
}
.painter-series-nav a[aria-current="page"] {
	color: var(--wp--preset--color--ink);
	border-bottom: 1px solid var(--wp--preset--color--ink);
}
.painter-series-nav a:hover {
	color: var(--wp--preset--color--accent);
}

/* ---------- Work card caption: title, year · size, status on one flowing line ---------- */
.painter-card-caption {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
}
.painter-card-caption > * {
	margin: 0 !important;
	white-space: pre-wrap;
}

/* ---------- Contact form panel ---------- */
.wp-block-group.painter-form {
	border: 1px solid var(--wp--preset--color--rule);
	padding: var(--wp--preset--spacing--40);
}
