/**
 * Front-end styles for the André Ester blocks.
 *
 * Colours, spacing and type come from the theme through `--wp--preset--*`
 * custom properties, with fallbacks so the blocks stay presentable under any
 * theme. Nothing here hardcodes a brand colour.
 *
 * The art direction is documented in
 * .claude/skills/museographic-art-direction/. Read it before changing a value.
 */

.ae-grid,
.ae-card,
.ae-discipline-filter,
.ae-artwork-meta,
.ae-project-meta,
.ae-contact {
	--ae-b-ink: var(--wp--preset--color--contrast, #0f0f0e);
	--ae-b-wall: var(--wp--preset--color--base, #f2f0ea);
	--ae-b-mount: var(--wp--preset--color--mount, #fff);
	--ae-b-line: var(--wp--preset--color--line, #c6c1b4);
	--ae-b-muted: var(--wp--preset--color--muted, #605c55);
	--ae-b-accent: var(--wp--preset--color--accent, #c4271a);
	--ae-b-data: var(--wp--preset--font-family--mono, ui-monospace, Menlo, monospace);
	--ae-b-gutter: var(--wp--preset--spacing--30, 1.5rem);
	--ae-b-ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* ------------------------------------------------------------------ *
 * Grids
 *
 * Column gap is the page gutter; row gap is twice that, so rows read as
 * separate shelves on a wall rather than as one continuous field.
 * ------------------------------------------------------------------ */

.ae-grid {
	display: grid;
	grid-template-columns: repeat(var(--ae-grid-columns, 3), minmax(0, 1fr));
	column-gap: var(--ae-b-gutter);
	row-gap: calc(var(--ae-b-gutter) * 2.5);
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (max-width: 1024px) {
	.ae-grid {
		grid-template-columns: repeat(min(var(--ae-grid-columns, 3), 2), minmax(0, 1fr));
	}
}

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

.ae-grid__empty {
	margin: 0;
	padding: 1.25rem 0;
	border-block: 1px solid var(--ae-b-line);
	font-family: var(--ae-b-data);
	font-size: 0.75rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ae-b-muted);
}

/* ------------------------------------------------------------------ *
 * Cards
 *
 * A work is mounted: fixed proportion, white passe-partout, hairline frame,
 * and the image contained inside it at its own proportions. That is how a wall
 * stays level without a single work being cropped.
 *
 * A project is documented, not mounted, so its image fills its frame. The
 * distinction is the point: one is the art, the other is evidence about it.
 * ------------------------------------------------------------------ */

.ae-card {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	min-width: 0;
}

.ae-card__link {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	color: inherit;
	text-decoration: none;
}

.ae-card__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.ae-card__media {
	position: relative;
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	padding: clamp(0.75rem, 1.6vw, 1.25rem);
	background-color: var(--ae-b-mount);
	border: 1px solid var(--ae-b-line);
	transition: border-color 200ms var(--ae-b-ease);
}

.ae-card__media img {
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
}

.ae-card--project .ae-card__media {
	aspect-ratio: 3 / 2;
	padding: 0;
	background-color: var(--ae-b-line);
}

.ae-card--project .ae-card__media img {
	width: 100%;
	height: 100%;
	max-height: none;
	object-fit: cover;
}

/*
 * The frame reacts, not the work. Scaling an artwork on hover is a small lie
 * about its size, and it is the one animation a gallery would never allow.
 */
.ae-card__link:hover .ae-card__media,
.ae-card__link:focus-visible .ae-card__media {
	border-color: var(--ae-b-accent);
}

.ae-card__link:hover .ae-card__title,
.ae-card__link:focus-visible .ae-card__title {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
}

.ae-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	background-image: repeating-linear-gradient(
		45deg,
		var(--ae-b-line) 0 1px,
		transparent 1px 10px
	);
}

.ae-card__badge {
	position: absolute;
	inset-block-end: 0;
	inset-inline-start: 0;
	padding: 0.45em 0.7em;
	font-family: var(--ae-b-data);
	font-size: 0.6875rem;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: #fff;
	background-color: var(--ae-b-accent);
}

.ae-card__title {
	margin: 0;
	font-size: var(--wp--preset--font-size--medium, 1.125rem);
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.ae-card__year {
	margin-inline-start: 0.5em;
	font-family: var(--ae-b-data);
	font-size: 0.8125rem;
	font-weight: 400;
	letter-spacing: 0.04em;
	color: var(--ae-b-muted);
	white-space: nowrap;
}

.ae-card__caption,
.ae-card__meta,
.ae-card__excerpt {
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	line-height: 1.55;
	color: var(--ae-b-muted);
	text-wrap: pretty;
}

.ae-card__status {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	margin: 0;
	font-family: var(--ae-b-data);
	font-size: 0.6875rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ae-b-muted);
}

/* An ongoing project carries the red square; a finished one does not. */
.ae-card__status[data-status="ongoing"] {
	color: var(--ae-b-ink);
}

.ae-card__status[data-status="ongoing"]::before {
	content: "";
	width: 0.5em;
	height: 0.5em;
	background-color: var(--ae-b-accent);
}

/* ------------------------------------------------------------------ *
 * Section navigation
 * ------------------------------------------------------------------ */

.ae-discipline-filter__list {
	display: flex;
	flex-wrap: wrap;
	gap: 0 clamp(1.5rem, 4vw, 3.5rem);
	margin: 0;
	padding: 0;
	list-style: none;
	font-family: var(--ae-b-data);
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--ae-b-line);
}

.ae-discipline-filter__item {
	margin: 0;
}

.ae-discipline-filter__item a,
.ae-discipline-filter__current {
	display: inline-flex;
	align-items: baseline;
	gap: 0.55em;
	/* 44px is the smallest target most people can hit reliably. */
	min-height: 44px;
	padding-block: 0.75em;
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 160ms var(--ae-b-ease);
}

.ae-discipline-filter__item a:hover,
.ae-discipline-filter__item a:focus-visible {
	border-bottom-color: currentColor;
}

/*
 * The current section is not a link, so it needs its own emphasis. The red
 * square carries the meaning where colour alone would not, and the weight
 * carries it where the square is invisible.
 */
.ae-discipline-filter__current {
	font-weight: 600;
	border-bottom-color: var(--ae-b-ink);
}

.ae-discipline-filter__current::before {
	content: "";
	align-self: center;
	width: 0.5em;
	height: 0.5em;
	background-color: var(--ae-b-accent);
}

.ae-discipline-filter__count {
	font-size: 0.9em;
	font-weight: 400;
	letter-spacing: 0.04em;
	color: var(--ae-b-muted);
	font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ *
 * Scrollytelling
 * ------------------------------------------------------------------ */

.ae-scrolly {
	position: relative;
	--ae-scrolly-gap: clamp(2rem, 6vw, 6rem);
}

.ae-scrolly.is-tone-dark {
	color: var(--wp--preset--color--base, #f2f0ea);
	background-color: var(--wp--preset--color--contrast, #0f0f0e);
}

.ae-scrolly.is-tone-light {
	color: var(--wp--preset--color--contrast, #0f0f0e);
	background-color: var(--wp--preset--color--base, #f2f0ea);
}

/*
 * The unenhanced state, and the one search engines and reduced-motion readers
 * see: chapters stacked, each with its image above its text.
 */
.ae-scrolly__chapters {
	display: flex;
	flex-direction: column;
	gap: var(--ae-scrolly-gap);
	margin-inline: auto;
	padding: clamp(2rem, 8vw, 6rem) clamp(1.25rem, 5vw, 3rem);
	max-width: 66ch;
}

.ae-scrolly__media {
	margin: 0 0 1.5rem;
}

.ae-scrolly__media img,
.ae-scrolly__media video {
	display: block;
	width: 100%;
	height: auto;
}

.ae-scrolly__caption {
	margin-top: 0.75rem;
	font-size: 0.8125rem;
	line-height: 1.5;
	opacity: 0.7;
}

/* The year is the chapter's catalogue number, so it is set as data. */
.ae-scrolly__year {
	display: flex;
	align-items: center;
	gap: 0.7em;
	margin: 0 0 0.9rem;
	padding-block-start: 0.7em;
	border-block-start: 1px solid currentColor;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, Menlo, monospace);
	font-size: 0.75rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	font-variant-numeric: tabular-nums;
}

.ae-scrolly__year::before {
	content: "";
	flex: none;
	width: 0.5em;
	height: 0.5em;
	background-color: var(--wp--preset--color--accent, #c4271a);
}

.ae-scrolly__text > :last-child {
	margin-bottom: 0;
}

.ae-scrolly__stage[hidden] {
	display: none;
}

/* The enhanced state: a sticky stage beside a scrolling column of text. */
/*
 * Column gap only. A row gap would push the sticky stage below the top of the
 * section, leaving a band of background above the image until the reader
 * scrolls — which reads as a broken image rather than as breathing room.
 */
.ae-scrolly.is-enhanced {
	display: grid;
	align-items: start;
	column-gap: var(--ae-scrolly-gap);
	row-gap: 0;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-left {
	grid-template-columns: 55fr 45fr;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-right {
	grid-template-columns: 45fr 55fr;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-right .ae-scrolly__stage {
	order: 2;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-full {
	grid-template-columns: minmax(0, 1fr);
}

.ae-scrolly.is-enhanced .ae-scrolly__stage {
	position: sticky;
	top: 0;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-full .ae-scrolly__stage {
	grid-area: 1 / 1;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-full .ae-scrolly__chapters {
	grid-area: 1 / 1;
	position: relative;
	z-index: 1;
}

.ae-scrolly__layer {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity 600ms var(--ae-b-ease, ease), visibility 0s linear 600ms;
}

.ae-scrolly__layer.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity 600ms var(--ae-b-ease, ease), visibility 0s;
}

.ae-scrolly__layer .ae-scrolly__media {
	margin: 0;
	width: 100%;
	height: 100%;
}

.ae-scrolly__layer img,
.ae-scrolly__layer video {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* A caption on the stage is a wall label pinned to the frame. */
.ae-scrolly__layer .ae-scrolly__caption {
	position: absolute;
	inset-block-end: 0;
	inset-inline-start: 0;
	max-width: 44ch;
	margin: 0;
	padding: 0.7em 1em;
	font-size: 0.75rem;
	letter-spacing: 0.02em;
	opacity: 1;
	color: var(--wp--preset--color--base, #f2f0ea);
	background-color: var(--wp--preset--color--contrast, #0f0f0e);
}

.ae-scrolly.is-enhanced .ae-scrolly__chapters {
	padding-block: 40vh;
	max-width: 58ch;
}

.ae-scrolly.is-enhanced .ae-scrolly__chapter {
	min-height: 60vh;
	display: flex;
	flex-direction: column;
	justify-content: center;
	/* Chapters off the reading band recede, so the eye knows where it is. */
	opacity: 0.3;
	transition: opacity 400ms ease;
}

.ae-scrolly.is-enhanced .ae-scrolly__chapter.is-active {
	opacity: 1;
}

.ae-scrolly.is-enhanced.ae-scrolly--media-full .ae-scrolly__text {
	padding: clamp(1.25rem, 3vw, 2rem);
	background-color: color-mix(in srgb, currentColor 12%, transparent);
	backdrop-filter: blur(10px);
}

.ae-scrolly__progress {
	position: sticky;
	top: 0;
	z-index: 2;
	height: 2px;
	background-color: color-mix(in srgb, currentColor 15%, transparent);
	grid-column: 1 / -1;
}

.ae-scrolly__progress-bar {
	display: block;
	height: 100%;
	width: var(--ae-progress, 0%);
	background-color: var(--wp--preset--color--accent, #c4271a);
	transition: width 400ms ease;
}

@media (max-width: 900px) {
	.ae-scrolly.is-enhanced.ae-scrolly--media-left,
	.ae-scrolly.is-enhanced.ae-scrolly--media-right {
		grid-template-columns: minmax(0, 1fr);
	}

	.ae-scrolly.is-enhanced .ae-scrolly__stage {
		height: 60vh;
		height: 60dvh;
	}
}

/*
 * A last line of defence. The view script already refuses to enhance when
 * reduced motion is requested, but if it ever runs before the query resolves,
 * this keeps the transitions from firing.
 */
@media (prefers-reduced-motion: reduce) {
	.ae-scrolly__layer,
	.ae-scrolly__chapter,
	.ae-scrolly__progress-bar,
	.ae-card__media {
		transition-duration: 0.01ms !important;
	}
}

/* ------------------------------------------------------------------ *
 * Video
 * ------------------------------------------------------------------ */

.ae-video {
	position: relative;
	aspect-ratio: var(--ae-video-ratio, 16 / 9);
	width: 100%;
	background-color: var(--wp--preset--color--contrast, #0f0f0e);
}

.ae-video iframe,
.ae-video video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ------------------------------------------------------------------ *
 * Wall label and project facts
 * ------------------------------------------------------------------ */

/*
 * A work is hung at eye level, not stretched across the whole wall. Capping
 * the image at most of the viewport height means the visitor sees the work
 * whole before reading anything about it — which is the entire argument for
 * putting the image above the label rather than beside it.
 */
.ae-artwork-media {
	max-width: 72rem;
	margin: 0;
	padding: clamp(1rem, 3vw, 2.5rem);
	background-color: var(--wp--preset--color--mount, #fff);
	border: 1px solid var(--wp--preset--color--line, #c6c1b4);
}

.ae-artwork-media__image {
	display: block;
	margin-inline: auto;
	max-width: 100%;
	max-height: 76vh;
	width: auto;
	height: auto;
}

.ae-artwork-media__caption {
	margin-top: 1.25rem;
	padding-top: 0.9rem;
	border-top: 1px solid var(--wp--preset--color--line, #c6c1b4);
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	line-height: 1.55;
	color: var(--wp--preset--color--muted, #605c55);
}

.ae-artwork-meta__list,
.ae-project-meta__list {
	display: grid;
	gap: 0;
	margin: 0;
}

/*
 * The label itself. Term set in the data face, value in the reading face,
 * every row opened by a hairline — a museum label, not a definition list that
 * happens to be on a wall.
 */
.ae-artwork-meta__row,
.ae-project-meta__row {
	display: grid;
	grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
	gap: 0.25rem 1.5rem;
	padding-block: 0.85rem;
	border-top: 1px solid var(--wp--preset--color--line, #c6c1b4);
}

.ae-artwork-meta__row:last-child,
.ae-project-meta__row:last-child {
	border-bottom: 1px solid var(--wp--preset--color--line, #c6c1b4);
}

@media (max-width: 600px) {
	.ae-artwork-meta__row,
	.ae-project-meta__row {
		grid-template-columns: minmax(0, 1fr);
	}
}

.ae-artwork-meta__term,
.ae-project-meta__term {
	margin: 0;
	font-family: var(--wp--preset--font-family--mono, ui-monospace, Menlo, monospace);
	font-size: 0.75rem;
	line-height: 1.7;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted, #605c55);
}

.ae-artwork-meta__value,
.ae-project-meta__value {
	margin: 0;
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
	line-height: 1.55;
	text-wrap: pretty;
}

.ae-artwork-meta__section,
.ae-project-meta__section {
	margin-top: 2.5rem;
}

.ae-artwork-meta__heading,
.ae-project-meta__heading {
	display: flex;
	align-items: baseline;
	gap: 0.9em;
	margin: 0 0 1rem;
	padding-top: 0.85em;
	border-top: 1px solid var(--wp--preset--color--contrast, #0f0f0e);
	font-family: var(--wp--preset--font-family--mono, ui-monospace, Menlo, monospace);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--wp--preset--color--contrast, #0f0f0e);
}

.ae-artwork-meta__heading::before,
.ae-project-meta__heading::before {
	content: "";
	flex: none;
	width: 0.55em;
	height: 0.55em;
	background-color: var(--wp--preset--color--accent, #c4271a);
}

.ae-artwork-meta__exhibitions,
.ae-project-meta__outcomes,
.ae-project-meta__collaborators {
	margin: 0;
	padding-left: 1.1em;
	display: grid;
	gap: 0.5rem;
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
}

.ae-artwork-meta__collaborators,
.ae-project-meta__collaborators {
	list-style: none;
	padding-left: 0;
}

.ae-artwork-meta__credit {
	margin-top: 1.5rem;
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	line-height: 1.55;
	color: var(--wp--preset--color--muted, #605c55);
}

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

.ae-contact {
	max-width: 42rem;
}

.ae-contact__form {
	display: grid;
	gap: 1.75rem;
}

.ae-contact__field {
	display: grid;
	gap: 0.5rem;
	margin: 0;
}

.ae-contact__label {
	font-family: var(--ae-b-data);
	font-size: 0.75rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ae-b-muted);
}

.ae-contact__required {
	color: var(--ae-b-accent);
}

.ae-contact__input {
	width: 100%;
	/* 44px is the smallest target most people can hit reliably. */
	min-height: 48px;
	padding: 0.7em 0.85em;
	font: inherit;
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
	color: inherit;
	background-color: var(--ae-b-mount);
	border: 1px solid var(--ae-b-ink);
	border-radius: 0;
}

.ae-contact__input::placeholder {
	color: var(--ae-b-muted);
}

.ae-contact__input:focus-visible {
	outline: 2px solid var(--ae-b-accent);
	outline-offset: 2px;
}

.ae-contact__textarea {
	min-height: 11rem;
	resize: vertical;
	line-height: 1.6;
}

.ae-contact__help {
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	color: var(--ae-b-muted);
}

.ae-contact__consent {
	margin: 0;
}

.ae-contact__consent-label {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: start;
	gap: 0.8rem;
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	line-height: 1.6;
	cursor: pointer;
}

.ae-contact__consent-label input {
	/* Nudged down so the box sits on the first line's baseline, not above it. */
	margin-top: 0.2em;
	width: 1.15em;
	height: 1.15em;
	accent-color: var(--ae-b-accent);
}

.ae-contact__actions {
	margin: 0;
}

.ae-contact__submit {
	appearance: none;
	min-height: 48px;
	padding: 1em 1.8em;
	font-family: var(--ae-b-data);
	font-size: 0.75rem;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ae-b-wall);
	background-color: var(--ae-b-ink);
	border: 1px solid var(--ae-b-ink);
	border-radius: 0;
	cursor: pointer;
	transition: background-color 160ms var(--ae-b-ease), border-color 160ms var(--ae-b-ease);
}

.ae-contact__submit:hover,
.ae-contact__submit:focus-visible {
	color: #fff;
	background-color: var(--ae-b-accent);
	border-color: var(--ae-b-accent);
}

.ae-contact__submit:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

.ae-contact__note {
	margin: 0;
	font-size: var(--wp--preset--font-size--x-small, 0.8125rem);
	color: var(--ae-b-muted);
}

.ae-contact__intro {
	margin: 0 0 2rem;
	text-wrap: pretty;
}

.ae-contact__message {
	margin: 0 0 2rem;
	padding: 1rem 1.2rem;
	border-inline-start: 3px solid var(--ae-b-ink);
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
	line-height: 1.6;
}

.ae-contact__message--success {
	background-color: var(--wp--preset--color--surface, #e3e0d7);
}

.ae-contact__message--error {
	border-inline-start-color: var(--ae-b-accent);
	background-color: color-mix(in srgb, var(--ae-b-accent) 10%, transparent);
}

/*
 * The honeypot. Not `display:none`: some bots skip hidden fields, and a few
 * skip anything a browser would not paint. This keeps it in the layout while
 * removing it from sight, from the tab order and from the accessibility tree.
 */
.ae-contact__trap {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
