/*
Theme Name: Jorge Castillo 2026
Theme URI: https://jorgecastillo.info
Author: LocalWebHub
Author URI: https://localwebhub.com
Description: Minimal gallery theme for the Spanish painter, graphic artist and sculptor Jorge Castillo (b. 1933). Self-hosted type, no jQuery, no comments, works shown whole on a paper ground.
Version: 1.0.0
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: jorgecastillo
*/

/* ---------------------------------------------------------------------------
   Design tokens
   Colours, type and spacing for the whole site. theme.json mirrors the
   palette and font families so the block editor offers the same choices.
--------------------------------------------------------------------------- */

:root {
	--color-paper: #f4f2ed;
	--color-wall: #ebe8e1;
	--color-white: #fff;
	--color-ink: #1c1b19;
	--color-ink-soft: #5e5b55;
	--color-ink-faint: #8f8b84;
	--color-line: rgba(28, 27, 25, .14);
	--color-line-strong: rgba(28, 27, 25, .4);

	--font-serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
	--font-sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

	/* Fluid type scale. Body is a hair over 17px on desktop, 16px on phones. */
	--text-display: clamp(3.25rem, 2rem + 6vw, 7rem);
	--text-h1: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);
	--text-h2: clamp(1.875rem, 1.3rem + 2vw, 3rem);
	--text-h3: clamp(1.375rem, 1.15rem + .8vw, 1.75rem);
	--text-lede: clamp(1.25rem, 1.05rem + .8vw, 1.625rem);
	--text-body: clamp(1rem, .95rem + .2vw, 1.0625rem);
	--text-small: .875rem;
	--text-eyebrow: .75rem;

	--leading-tight: 1.05;
	--leading-snug: 1.25;
	--leading-body: 1.6;

	--gutter: clamp(1.25rem, 4vw, 3.5rem);
	--section-pad: clamp(3.5rem, 6vw + 1rem, 8rem);
	--space-xs: .5rem;
	--space-s: 1rem;
	--space-m: 1.75rem;
	--space-l: 3rem;
	--space-xl: 5rem;

	--width-wide: 1440px;
	--width-content: 42rem;
	--width-measure: 64ch;

	--menu-height: 4.25rem;
	--radius: 2px;
	--ease: cubic-bezier(.2, .6, .2, 1);
}

/* ---------------------------------------------------------------------------
   Document
--------------------------------------------------------------------------- */

html {
	scroll-behavior: smooth;
	background: var(--color-paper);
}

body {
	background: var(--color-paper);
	color: var(--color-ink);
	font-family: var(--font-sans);
	font-size: var(--text-body);
	line-height: var(--leading-body);
	font-feature-settings: "kern" 1, "liga" 1;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	overflow-x: clip;
}

[id] {
	scroll-margin-top: calc(var(--menu-height) + 1rem);
}

::selection {
	background: var(--color-ink);
	color: var(--color-paper);
}

/* ---------------------------------------------------------------------------
   Typography
--------------------------------------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
	margin: 0;
	font-family: var(--font-serif);
	font-weight: 400;
	line-height: var(--leading-tight);
	letter-spacing: -.01em;
	text-wrap: balance;
}

h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4, h5, h6 { font-size: var(--text-lede); }

p {
	margin: 0 0 1.25em;
}

p:last-child {
	margin-bottom: 0;
}

a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: .18em;
	text-decoration-color: var(--color-line-strong);
	transition: text-decoration-color .25s var(--ease), color .25s var(--ease);
}

a:hover {
	text-decoration-color: currentColor;
}

a:focus-visible {
	outline: 2px solid var(--color-ink);
	outline-offset: 3px;
	border-radius: var(--radius);
}

strong, b {
	font-weight: 600;
}

em, i {
	font-style: italic;
}

blockquote {
	margin: var(--space-l) 0;
	padding: 0;
	border: 0;
	font-family: var(--font-serif);
	font-size: var(--text-lede);
	line-height: var(--leading-snug);
	font-style: italic;
	color: var(--color-ink);
}

blockquote p {
	margin-bottom: .75em;
}

blockquote cite {
	display: block;
	font-family: var(--font-sans);
	font-size: var(--text-small);
	font-style: normal;
	color: var(--color-ink-soft);
}

hr {
	height: 1px;
	margin: var(--space-l) 0;
	border: 0;
	background: var(--color-line);
}

ul, ol {
	margin: 0 0 1.25em;
	padding-left: 1.25em;
}

figure {
	margin: 0;
}

figcaption {
	font-size: var(--text-small);
	color: var(--color-ink-soft);
}

.eyebrow {
	display: block;
	margin-bottom: var(--space-s);
	font-family: var(--font-sans);
	font-size: var(--text-eyebrow);
	font-weight: 500;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--color-ink-soft);
}

.lede {
	font-family: var(--font-serif);
	font-size: var(--text-lede);
	line-height: var(--leading-snug);
	letter-spacing: -.005em;
}

.serif {
	font-family: var(--font-serif);
}

.muted {
	color: var(--color-ink-soft);
}

/* ---------------------------------------------------------------------------
   Layout primitives
--------------------------------------------------------------------------- */

.container {
	width: 100%;
	max-width: var(--width-wide);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.container-narrow {
	width: 100%;
	max-width: calc(var(--width-content) + var(--gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.section {
	padding-block: var(--section-pad);
}

.section-tight {
	padding-block: calc(var(--section-pad) * .5);
}

.section + .section {
	padding-top: 0;
}

.section-line {
	border-top: 1px solid var(--color-line);
}

.section-line + .section-line,
.section + .section-line {
	padding-top: var(--section-pad);
}

.section--head {
	display: flex;
	flex-direction: column;
	gap: var(--space-s);
	margin-bottom: var(--space-l);
}

.section--head-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-s) var(--space-m);
}

@media (min-width: 768px) {
	.section--head {
		flex-direction: row;
		align-items: flex-end;
		justify-content: space-between;
		gap: var(--space-m);
	}
}

main {
	display: block;
	min-height: 50vh;
}

/* ---------------------------------------------------------------------------
   Utilities
--------------------------------------------------------------------------- */

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

.screen-reader-text:focus {
	position: static !important;
	width: auto;
	height: auto;
	margin: 0;
	clip: auto;
	clip-path: none;
}

.object-fit-cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.object-fit-contain {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.sm-ignore-br br { display: none; }
.md-ignore-br br { display: none; }

@media (min-width: 576px) {
	.sm-ignore-br br { display: inline; }
}

@media (min-width: 768px) {
	.md-ignore-br br { display: inline; }
}

.text-link {
	display: inline-flex;
	align-items: center;
	gap: .5em;
	font-size: var(--text-small);
	font-weight: 500;
	letter-spacing: .04em;
	text-transform: uppercase;
	text-decoration: none;
	color: var(--color-ink);
}

.text-link::after {
	content: "";
	width: 1.5em;
	height: 1px;
	background: currentColor;
	transition: width .3s var(--ease);
}

.text-link:hover::after,
.text-link:focus-visible::after {
	width: 2.5em;
}

/* ---------------------------------------------------------------------------
   Page hero (title band used by all inner pages)
--------------------------------------------------------------------------- */

.page-hero--section {
	padding-block: calc(var(--section-pad) * .7) calc(var(--section-pad) * .5);
}

.page-hero--container {
	display: flex;
	flex-direction: column;
	gap: var(--space-s);
}

.page-hero--title {
	font-size: var(--text-h1);
	max-width: 14em;
}

.page-hero--meta {
	font-size: var(--text-small);
	color: var(--color-ink-soft);
}

.page-hero--lede {
	max-width: var(--width-measure);
	margin-top: var(--space-s);
	color: var(--color-ink-soft);
}

@media (min-width: 992px) {
	.page-hero--container.has-lede {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: var(--space-l);
		align-items: end;
	}

	.page-hero--container.has-lede .page-hero--lede {
		margin-top: 0;
	}
}

/* ---------------------------------------------------------------------------
   Long-form content (The Artist, Contact, any page body)
--------------------------------------------------------------------------- */

.entry-content {
	max-width: var(--width-measure);
}

.entry-content > * + * {
	margin-top: 1.25em;
}

.entry-content > h2 {
	margin-top: 2.5em;
	font-size: var(--text-h2);
}

.entry-content > h3 {
	margin-top: 2em;
}

.entry-content > h2 + *,
.entry-content > h3 + * {
	margin-top: .75em;
}

.entry-content > p:first-child {
	font-family: var(--font-serif);
	font-size: var(--text-lede);
	line-height: var(--leading-snug);
}

.entry-content p {
	margin-bottom: 0;
}

.entry-content .wp-block-quote,
.entry-content blockquote {
	padding-left: var(--space-m);
	border-left: 1px solid var(--color-line-strong);
}

.entry-content figure.wp-block-image {
	margin-block: var(--space-l);
}

.entry-content .wp-block-image img {
	width: 100%;
	height: auto;
	background: var(--color-wall);
}

.entry-content .wp-block-image figcaption {
	margin-top: var(--space-xs);
}

.entry-content .wp-block-gallery {
	margin-block: var(--space-l);
}

.entry-content .wp-block-separator {
	max-width: 6rem;
	margin-inline: 0;
}

.entry-content .byline {
	font-size: var(--text-small);
	color: var(--color-ink-soft);
}

.entry-content .article-aside {
	margin-top: var(--space-l);
	padding-top: var(--space-m);
	border-top: 1px solid var(--color-line);
}

/* Article layout: sticky aside with a portrait next to the reading column */

.article--container {
	display: grid;
	gap: var(--space-l);
}

.article--aside {
	order: -1;
}

.article--figure img {
	width: 100%;
	max-width: 22rem;
	height: auto;
	filter: grayscale(1);
}

.article--figure figcaption {
	margin-top: var(--space-xs);
}

.article--facts {
	display: grid;
	gap: var(--space-xs);
	margin: var(--space-m) 0 0;
	padding: var(--space-m) 0 0;
	border-top: 1px solid var(--color-line);
	font-size: var(--text-small);
}

.article--facts dt {
	color: var(--color-ink-soft);
}

.article--facts dd {
	margin: 0 0 var(--space-xs);
}

@media (min-width: 992px) {
	.article--container {
		grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
		gap: var(--space-xl);
		align-items: start;
	}

	.article--aside {
		order: 0;
		position: sticky;
		top: calc(var(--menu-height) + var(--space-m));
	}
}

/* ---------------------------------------------------------------------------
   Exhibitions timeline
   The page body is a flat sequence of one heading (year) followed by one
   list. Grid auto-placement puts every heading in the first column and every
   list in the second, so the editor keeps ordinary blocks and the page still
   reads as a two-column chronology.
--------------------------------------------------------------------------- */

.timeline--content {
	max-width: none;
}

.timeline--content > * + * {
	margin-top: 0;
}

.timeline--content > h2 {
	margin: 0;
	padding: var(--space-m) 0 var(--space-xs);
	font-family: var(--font-serif);
	font-size: var(--text-h3);
	font-variant-numeric: tabular-nums;
	border-top: 1px solid var(--color-line);
}

.timeline--content > ul {
	margin: 0;
	padding: 0 0 var(--space-m);
	list-style: none;
}

.timeline--content > ul li {
	max-width: var(--width-measure);
	padding: .35em 0;
}

.timeline--content > ul li + li {
	border-top: 1px solid var(--color-line);
}

@media (min-width: 768px) {
	.timeline--content {
		display: grid;
		grid-template-columns: 8rem minmax(0, 1fr);
		column-gap: var(--space-l);
	}

	.timeline--content > h2,
	.timeline--content > ul {
		padding-top: var(--space-m);
		padding-bottom: var(--space-m);
		border-top: 1px solid var(--color-line);
	}

	.timeline--content > h2:first-child,
	.timeline--content > h2:first-child + ul {
		border-top: 0;
		padding-top: 0;
	}
}

/* A heading that is not a year ("Works in museums and collections") starts a
   section of its own: it spans both columns and its list flows in columns. */
.timeline--content > .timeline--section {
	padding-top: var(--space-xl);
	font-size: var(--text-h2);
}

.timeline--content > .timeline--section + ul li {
	break-inside: avoid;
}

@media (min-width: 768px) {
	.timeline--content > .timeline--section,
	.timeline--content > .timeline--section + ul {
		grid-column: 1 / -1;
	}

	.timeline--content > .timeline--section + ul {
		columns: 2;
		column-gap: var(--space-xl);
	}

	.timeline--content > .timeline--section + ul li {
		max-width: none;
	}
}

/* ---------------------------------------------------------------------------
   Contact
--------------------------------------------------------------------------- */

.contact--grid {
	display: grid;
	gap: var(--space-l);
}

.contact--card {
	padding-top: var(--space-m);
	border-top: 1px solid var(--color-line);
}

.contact--name {
	font-family: var(--font-serif);
	font-size: var(--text-h3);
	margin-bottom: var(--space-s);
}

.contact--address {
	font-style: normal;
	line-height: 1.7;
}

.contact--address a {
	text-decoration: none;
}

.contact--address a:hover {
	text-decoration: underline;
}

@media (min-width: 768px) {
	.contact--grid {
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
		gap: var(--space-xl);
	}
}

/* ---------------------------------------------------------------------------
   Front page: intro, collections, about band
--------------------------------------------------------------------------- */

.intro--container {
	max-width: calc(var(--width-measure) + var(--gutter) * 2);
}

.intro--content > * + * {
	margin-top: 1.25em;
}

.intro--content > p:first-child {
	font-family: var(--font-serif);
	font-size: var(--text-lede);
	line-height: var(--leading-snug);
}

.intro--links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-s) var(--space-m);
	margin-top: var(--space-m);
}

.collections--grid {
	display: grid;
	gap: var(--space-l) var(--space-m);
}

.collection-card {
	display: block;
	text-decoration: none;
	color: inherit;
}

.collection-card--figure {
	aspect-ratio: 4 / 5;
	display: grid;
	place-items: center;
	padding: 6%;
	background: var(--color-wall);
	overflow: hidden;
}

.collection-card--figure img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: transform .6s var(--ease);
}

.collection-card:hover .collection-card--figure img,
.collection-card:focus-visible .collection-card--figure img {
	transform: scale(1.02);
}

.collection-card--body {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-s);
	margin-top: var(--space-s);
}

.collection-card--title {
	font-size: var(--text-h3);
}

.collection-card--count {
	font-size: var(--text-small);
	color: var(--color-ink-soft);
	white-space: nowrap;
}

@media (min-width: 576px) {
	.collections--grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 992px) {
	.collections--grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.about-band--container {
	display: grid;
	gap: var(--space-l);
}

.about-band--item {
	padding-top: var(--space-m);
	border-top: 1px solid var(--color-line);
}

.about-band--item h2 {
	margin-bottom: var(--space-s);
}

.about-band--item p {
	max-width: 36em;
	color: var(--color-ink-soft);
}

.about-band--item .text-link {
	margin-top: var(--space-m);
}

@media (min-width: 768px) {
	.about-band--container {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--space-xl);
	}
}

/* ---------------------------------------------------------------------------
   404
--------------------------------------------------------------------------- */

.error404 .page-hero--title {
	font-size: var(--text-display);
}

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

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

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