/**
 * Section listings (Figma "Category / PLP": Category-Desktop, Category-Tablet, Category-Mobile).
 * Hero on the dark mat, the cream listing panel (results count, piece grid, pagination), then the dark
 * About band with the Consignments callout. Tokens only; media queries repeat custom.breakpoint values
 * as literals (decision 1). Desktop layout from custom.breakpoint.nav (1024px), as the header.
 */

/* ---------- Page ---------- */
.aa-collection {
	background-color: var(--wp--custom--color--bg--page);
}

.aa-collection > *,
.aa-listing > *,
:is(.aa-hero, .aa-hero__content, .aa-section-band, .aa-section-band__columns, .aa-section-band__text, .aa-section-band__cards, .aa-callout) > * {
	margin-block: 0;
}


/* ---------- Hero (Figma: Page hero) ---------- */
.aa-hero {
	position: relative;
	display: flex;
	flex-direction: column;
	background-color: var(--wp--custom--color--bg--mat);
	color: var(--wp--custom--color--text--primary);
}

/* Photo: client image from the Section page, cropped to the hero; on phones it sits on top. */
.aa-hero .aa-section-hero__photo {
	position: relative;
	margin: 0;
	block-size: var(--wp--custom--collection--hero-photo-mobile);
}

.aa-hero .aa-section-hero__photo img {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.aa-hero__content {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--8);
	padding: var(--wp--preset--spacing--16) var(--wp--preset--spacing--margin) var(--wp--preset--spacing--48);
}

/* The page's only H1: Display/H1, gold-text gradient where background-clip: text works (decision 10). */
.aa-hero .aa-hero__title {
	margin: 0;
	color: var(--wp--custom--color--accent--gold-light);
	font-size: var(--wp--preset--font-size--display);
	font-style: italic;
	font-weight: 700;
	line-height: var(--wp--custom--line-height--display);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {

	.aa-hero .aa-hero__title {
		background-image: var(--wp--preset--gradient--gold-text);
		-webkit-background-clip: text;
		background-clip: text;
		color: transparent;
	}
}

.aa-hero .aa-section-hero__line {
	color: var(--wp--custom--color--text--primary);
}

/* Flipped page-to-band torn edge: the cream listing tears up into the hero (decorative). */
.aa-hero::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 1;
	block-size: var(--wp--custom--torn-edge--page-to-band);
	background-color: var(--wp--custom--color--bg--panel);
	-webkit-mask: url(../svg/torn-page-to-band.svg) center top / max(100%, var(--wp--custom--torn-edge--min-width)) 100% no-repeat;
	mask: url(../svg/torn-page-to-band.svg) center top / max(100%, var(--wp--custom--torn-edge--min-width)) 100% no-repeat;
	transform: scaleY(-1);
	pointer-events: none;
}

@media (forced-colors: active) {

	.aa-hero::after {
		display: none;
	}
}

/* custom.breakpoint.tablet = 768px: photo on the right behind a scrim, text on the left. */
@media (min-width: 768px) {

	.aa-hero {
		min-block-size: var(--wp--custom--collection--hero-height-tablet);
	}

	.aa-hero .aa-section-hero__photo {
		position: absolute;
		inset-block: 0;
		inset-inline-end: 0;
		inline-size: var(--wp--custom--collection--hero-photo-width-tablet);
		block-size: auto;
	}

	/* Scrim (Figma: gradient/caption-scrim, rotated): fades the photo's left edge into the mat. */
	.aa-hero .aa-section-hero__photo::after {
		content: "";
		position: absolute;
		inset-block: 0;
		inset-inline-start: 0;
		inline-size: var(--wp--custom--collection--hero-scrim-width);
		background: linear-gradient(to left, var(--wp--custom--color--alpha--ink-0), var(--wp--custom--color--alpha--ink-85));
	}

	.aa-hero__content {
		padding: var(--wp--preset--spacing--32) var(--wp--preset--spacing--32) var(--wp--preset--spacing--48);
	}

	.aa-hero .aa-section-hero__line {
		max-inline-size: var(--wp--custom--collection--hero-line-tablet);
	}
}

/* custom.breakpoint.nav = 1024px */
@media (min-width: 1024px) {

	.aa-hero {
		min-block-size: var(--wp--custom--collection--hero-height);
	}

	/* The photo ends at the page container's right edge, not the screen's (owner, deviation #42); its left
	   edge stays at the token's share of the screen, so it keeps about 52% of the container. */
	.aa-hero .aa-section-hero__photo {
		inset-inline-start: calc(100% - var(--wp--custom--collection--hero-photo-width));
		inset-inline-end: calc((100% - min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--preset--spacing--margin))) / 2);
		inline-size: auto;
	}

	.aa-hero__content {
		box-sizing: border-box;
		inline-size: 100%;
		max-inline-size: calc(var(--wp--style--global--content-size) + 2 * var(--wp--preset--spacing--margin));
		margin-inline: auto;
		padding: var(--wp--preset--spacing--48) var(--wp--preset--spacing--margin);
	}

	.aa-hero .aa-section-hero__line {
		max-inline-size: var(--wp--custom--collection--hero-line);
	}

	/* The edge is as wide as the listing panel below it. */
	.aa-hero::after {
		inline-size: min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--preset--spacing--margin));
		margin-inline: auto;
	}
}

/* ---------- Listing panel (Figma: Collection/Container) ---------- */
.aa-listing {
	box-sizing: border-box;
	padding: var(--wp--preset--spacing--16) var(--wp--preset--spacing--24) 0;
	background-color: var(--wp--custom--color--bg--panel);
	color: var(--wp--custom--color--text--on-light);
}

/* Results text: Body, ink, above a border/gold rule. */
.aa-listing .aa-results {
	display: flex;
	align-items: center;
	min-block-size: var(--wp--custom--tap-target--base);
	padding-block: var(--wp--preset--spacing--12);
	border-block-end: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold);
	font-size: var(--wp--preset--font-size--body);
	line-height: var(--wp--custom--line-height--body);
}

/* Grid: 1 column on phones, 2 from 768px, 3 from 1024px; cards in a row share one height. */
.aa-listing .aa-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--wp--preset--spacing--32) var(--wp--preset--spacing--24);
	margin: 0;
	padding: var(--wp--preset--spacing--48) 0;
	list-style: none;
}

.aa-listing .aa-grid > li {
	display: flex;
	margin: 0;
}

/* custom.breakpoint.tablet = 768px */
@media (min-width: 768px) {

	.aa-listing {
		padding-inline: var(--wp--preset--spacing--32);
	}

	.aa-listing .aa-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: var(--wp--preset--spacing--40);
	}
}

/* custom.breakpoint.nav = 1024px: a 1200px cream panel on the plum page. */
@media (min-width: 1024px) {

	.aa-listing {
		inline-size: min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--preset--spacing--margin));
		margin-inline: auto;
		padding: 0 var(--wp--preset--spacing--24);
	}

	.aa-listing .aa-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

/* ---------- Piece card (Figma: Product card) ---------- */
.aa-card {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--12);
	inline-size: 100%;
	padding: var(--wp--preset--spacing--12);
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold-subtle);
	background-color: var(--wp--custom--color--bg--panel);
	color: var(--wp--custom--color--text--on-light);
	transition: box-shadow 0.15s ease;
}

.aa-card > * {
	margin: 0;
}

/* Photo contained in Figma's 326×340 box. */
.aa-card__media {
	position: relative;
	padding: var(--wp--preset--spacing--8);
}

.aa-card__photo {
	display: block;
	inline-size: 100%;
	block-size: auto;
	aspect-ratio: var(--wp--custom--collection--card-photo-ratio);
	object-fit: contain;
}

/* Sold: photo at 50%; the name and badge stay at full contrast. */
.aa-card.is-sold .aa-card__photo {
	opacity: var(--wp--custom--opacity--sold);
}

/* Status badge (Figma: Status badge): always text, never colour alone. */
.aa-status {
	position: absolute;
	inset-block-start: var(--wp--preset--spacing--16);
	inset-inline-start: var(--wp--preset--spacing--16);
	padding: var(--wp--preset--spacing--4) var(--wp--preset--spacing--12);
	border-radius: var(--wp--custom--radius--sm);
	font-size: var(--wp--preset--font-size--button);
	font-weight: 700;
	line-height: var(--wp--custom--line-height--button);
	letter-spacing: var(--wp--custom--letter-spacing--button);
	text-transform: uppercase;
}

.aa-status--on-sale {
	background-color: var(--wp--custom--color--accent--gold);
	color: var(--wp--custom--color--text--on-gold);
}

.aa-status--sold {
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold-subtle);
	background-color: var(--wp--custom--color--bg--nav);
	color: var(--wp--custom--color--text--muted);
}

.aa-card__info {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--4);
}

.aa-card__info > * {
	margin: 0;
}

/* Name: Body/Strong (Body size, bold, upright), wraps to as many lines as it needs. */
.aa-card .aa-card__name {
	color: var(--wp--custom--color--text--on-light);
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--body);
	font-style: normal;
	font-weight: 700;
	line-height: var(--wp--custom--line-height--body);
	overflow-wrap: anywhere;
}

.aa-card__id {
	font-size: var(--wp--preset--font-size--body-small);
	line-height: var(--wp--custom--line-height--body-small);
}

/* "View Details →" is the card's only link; its ::after covers the card (stretched link). */
.aa-card__link {
	display: inline-flex;
	align-items: center;
	align-self: flex-start;
	gap: var(--wp--preset--spacing--4);
	margin-block-start: auto;
	min-block-size: var(--wp--custom--tap-target--base);
	padding: var(--wp--preset--spacing--4);
	color: var(--wp--custom--color--text--on-light);
	font-size: var(--wp--preset--font-size--footer-link);
	line-height: var(--wp--custom--line-height--footer-link);
	text-decoration: none;
}

.aa-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* The global link focus style is for dark surfaces (dark fill, gold text); on the cream card the link
   stays ink on cream and the ring goes round the whole card instead. */
.aa-card__link:focus-visible {
	outline: var(--wp--custom--border-width--focus) solid transparent;
	background-color: transparent;
	box-shadow: none;
	color: var(--wp--custom--color--text--on-light);
	text-decoration: underline;
}

.aa-card:hover {
	box-shadow: var(--wp--preset--shadow--soft);
}

.aa-card:hover .aa-card__link {
	text-decoration: underline;
}

/* Focus: the ring goes round the whole card. Cream surface, so Focus/Ring-light (decision 3). */


.aa-card:has(.aa-card__link:focus-visible) {
	box-shadow: var(--wp--preset--shadow--focus-ring-light);
}

@media (forced-colors: active) {

	.aa-card:has(.aa-card__link:focus-visible) {
		outline: var(--wp--custom--border-width--focus) solid Highlight;
	}
}

@media (prefers-reduced-motion: reduce) {

	.aa-card {
		transition: none;
	}
}

/* Editor stand-in. */
.aa-card.is-placeholder {
	min-block-size: var(--wp--custom--tap-target--xl);
	font-size: var(--wp--preset--font-size--body-small);
}

/* ---------- Pagination (Figma: Collection/Pagination, Pagination item) ---------- */
.aa-pagination {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: var(--wp--preset--spacing--16);
	padding-block: 0 var(--wp--preset--spacing--48);
}

.aa-pagination__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--wp--preset--spacing--8);
	container-type: inline-size;
}

/* Narrowest phones: Previous · Page n of N · Next needs about 311px (Figma's 390 frame has 342). Below
   that, "Page n of N" takes its own centred line under the buttons. */
@container (max-width: 311px) {

	.aa-pagination__status--inline {
		flex-basis: 100%;
		order: 3;
	}
}

.aa-pagination__numbers {
	display: none;
	gap: var(--wp--preset--spacing--8);
	margin: 0;
	padding: 0;
	list-style: none;
}

.aa-pagination .aa-pagination__numbers li {
	margin: 0;
}

.aa-pagination__status {
	margin: 0;
	font-size: var(--wp--preset--font-size--body-small);
	line-height: var(--wp--custom--line-height--body-small);
	text-align: center;
}

.aa-pagination__status--below {
	display: none;
}

/* Page numbers: 44×44, cream, gold-subtle border. Current = gold fill + bold + underline (not colour alone). */
.aa-pagination .page-numbers {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-inline-size: var(--wp--custom--tap-target--base);
	block-size: var(--wp--custom--tap-target--base);
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold-subtle);
	background-color: var(--wp--custom--color--bg--panel);
	color: var(--wp--custom--color--text--on-light);
	font-size: var(--wp--preset--font-size--body);
	line-height: var(--wp--custom--line-height--body);
	text-decoration: none;
}

.aa-pagination .page-numbers.current {
	border-color: var(--wp--custom--color--accent--gold);
	background-color: var(--wp--custom--color--accent--gold);
	font-weight: 700;
	text-decoration: underline;
}

.aa-pagination .page-numbers.dots {
	border-color: transparent;
	background: none;
}

.aa-pagination a.page-numbers:hover {
	border-color: var(--wp--custom--color--accent--gold-hover);
}

/* Previous / Next: Button, Style=Outline on cream (ink label). */
.aa-pagination .aa-pagination__edge {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-block-size: var(--wp--custom--tap-target--base);
	padding: var(--wp--preset--spacing--12) var(--wp--preset--spacing--24);
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold-subtle);
	background: transparent;
	color: var(--wp--custom--color--text--on-light);
	text-decoration: none;
}

.aa-pagination a.aa-pagination__edge:hover {
	background: var(--wp--custom--color--bg--nav);
	border-color: var(--wp--custom--color--accent--gold-hover);
	color: var(--wp--custom--color--accent--gold-hover);
}

.aa-pagination .aa-pagination__edge.is-disabled {
	opacity: var(--wp--custom--opacity--disabled);
	cursor: not-allowed;
}

/* Cream surface: Focus/Ring-light on every pagination control (decision 3). */
.aa-pagination :is(a.page-numbers, a.aa-pagination__edge):focus-visible {
	outline: var(--wp--custom--border-width--focus) solid transparent;
	box-shadow: var(--wp--preset--shadow--focus-ring-light);
}

/* custom.breakpoint.tablet = 768px: ornament divider, numbers, and "Page n of N" below. */
@media (min-width: 768px) {

	.aa-pagination {
		padding-block-start: 0;
	}

	.aa-pagination::before {
		--aa-ornament-rule: calc(50% - var(--wp--custom--ornament--fleuron) / 2 - var(--wp--preset--spacing--12));
		content: "";
		display: block;
		block-size: var(--wp--custom--ornament--height);
		margin-block-end: var(--wp--preset--spacing--32);
		background: linear-gradient(
			to right,
			var(--wp--custom--color--border--gold-subtle) calc(50% - var(--wp--custom--ornament--fleuron) / 2),
			var(--wp--custom--color--accent--gold) 0 calc(50% + var(--wp--custom--ornament--fleuron) / 2),
			var(--wp--custom--color--border--gold-subtle) 0
		);
		-webkit-mask:
			linear-gradient(currentcolor 0 0) left center / var(--aa-ornament-rule) var(--wp--custom--border-width--hairline) no-repeat,
			linear-gradient(currentcolor 0 0) right center / var(--aa-ornament-rule) var(--wp--custom--border-width--hairline) no-repeat,
			var(--aa-fleuron) center / var(--wp--custom--ornament--fleuron) var(--wp--custom--ornament--fleuron) no-repeat;
		mask:
			linear-gradient(currentcolor 0 0) left center / var(--aa-ornament-rule) var(--wp--custom--border-width--hairline) no-repeat,
			linear-gradient(currentcolor 0 0) right center / var(--aa-ornament-rule) var(--wp--custom--border-width--hairline) no-repeat,
			var(--aa-fleuron) center / var(--wp--custom--ornament--fleuron) var(--wp--custom--ornament--fleuron) no-repeat;
	}

	/* Ornament + 32px margin + the 16px flex gap = Figma's 48px above the row. */
	.aa-pagination__row {
		justify-content: center;
	}

	.aa-pagination__numbers {
		display: flex;
	}

	.aa-pagination__status--inline {
		display: none;
	}

	.aa-pagination__status--below {
		display: block;
	}
}

/* ---------- Empty Section (Figma: Empty state, adapted) ---------- */
.aa-listing .aa-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--preset--spacing--24);
	margin-block: var(--wp--preset--spacing--48);
	padding: var(--wp--preset--spacing--32) var(--wp--preset--spacing--24);
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold-subtle);
	background-color: var(--wp--custom--color--bg--panel-deep);
	text-align: center;
}

.aa-empty > * {
	margin: 0;
}

.aa-empty .aa-empty__message {
	color: var(--wp--custom--color--accent--gold-light);
	font-size: var(--wp--preset--font-size--h-2);
	font-style: italic;
	font-weight: 700;
	line-height: var(--wp--custom--line-height--h-2);
}

.aa-empty .aa-empty__actions {
	justify-content: center;
	gap: var(--wp--preset--spacing--16);
}

/* ---------- About band (Figma: Collection/About) ---------- */
.aa-section-band.is-style-torn-page-to-band {
	--aa-torn-color: var(--wp--custom--color--bg--panel);
	padding: var(--wp--preset--spacing--48) var(--wp--preset--spacing--16);
	background-color: var(--wp--custom--color--bg--nav);
	color: var(--wp--custom--color--text--primary);
}

.aa-section-band__columns {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--32);
	max-inline-size: var(--wp--style--global--content-size);
	margin-inline: auto;
}

.aa-section-band__text {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--32);
}

/* About heading: H2 with the gold-text gradient. */
.aa-section-band .aa-section-about__heading {
	color: var(--wp--custom--color--accent--gold-light);
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {

	.aa-section-band .aa-section-about__heading {
		background-image: var(--wp--preset--gradient--gold-text);
		-webkit-background-clip: text;
		background-clip: text;
		color: transparent;
	}
}

/* Pull-quote: Caption (italic), between the ornament dividers (global.css). */
.aa-section-band .aa-section-about__quote {
	margin: 0;
	padding: 0;
	border: 0;
	color: var(--wp--custom--color--text--primary);
	font-size: var(--wp--preset--font-size--caption);
	font-style: italic;
	line-height: var(--wp--custom--line-height--caption);
}

/* Consignments callout (Figma: Content card, Style=Callout): transparent, 1px border/gold. */
.aa-callout {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--16);
	padding: var(--wp--preset--spacing--24);
	border: var(--wp--custom--border-width--hairline) solid var(--wp--custom--color--border--gold);
}

.aa-callout .aa-callout__heading {
	color: var(--wp--custom--color--accent--gold-light);
}

.aa-callout .aa-callout__actions .wp-block-button {
	inline-size: 100%;
}

.aa-callout .aa-callout__actions .wp-block-button__link {
	box-sizing: border-box;
	inline-size: 100%;
}

/* custom.breakpoint.tablet = 768px */
@media (min-width: 768px) {

	.aa-section-band.is-style-torn-page-to-band {
		padding-inline: var(--wp--preset--spacing--48);
	}
}

/* custom.breakpoint.nav = 1024px: text column beside the callout. */
@media (min-width: 1024px) {

	.aa-section-band.is-style-torn-page-to-band {
		padding-block-start: var(--wp--preset--spacing--64);
	}

	.aa-section-band.is-style-torn-page-to-band::before {
		inline-size: min(var(--wp--style--global--content-size), 100% - 2 * var(--wp--preset--spacing--margin));
		margin-inline: auto;
	}

	.aa-section-band__columns {
		flex-direction: row;
		align-items: flex-start;
		gap: var(--wp--preset--spacing--48);
	}

	.aa-section-band__text {
		flex: 0 1 var(--wp--custom--collection--about-text);
		gap: var(--wp--preset--spacing--24);
	}

	.aa-section-band__cards {
		flex: 0 0 var(--wp--custom--collection--callout);
	}

	.aa-section-band .aa-section-about__quote {
		padding: var(--wp--preset--spacing--16) var(--wp--preset--spacing--32);
	}
}

/* No site-level gap above or below the listing page. */
.wp-site-blocks > .aa-collection,
.wp-site-blocks > .aa-collection + * {
	margin-block-start: 0;
}

/* custom.breakpoint.tablet = 768px: the first crumb gives back its 4px focus/tap padding, so the breadcrumb
   text starts on the hero text's content edge (as on the piece page). Phones keep the back link on the margin. */
@media (min-width: 768px) {

	.aa-hero .aa-breadcrumbs li:first-child a {
		margin-inline-start: calc(-1 * var(--wp--preset--spacing--4));
	}
}

/* RD2 #3: results bar + "Show sold pieces" toggle */
.aa-results-bar {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--16);
	flex-wrap: wrap;
}
.aa-results-bar .aa-results { margin: 0; }
.aa-sold-toggle {
	margin-inline-start: auto;
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--8);
	text-decoration: none;
	color: var(--wp--custom--color--text--muted-on-light);
	font-size: var(--wp--preset--font-size--body-small);
	line-height: var(--wp--custom--line-height--body-small);
}
.aa-sold-toggle__track {
	position: relative;
	flex: none;
	inline-size: 40px;
	block-size: 22px;
	border-radius: var(--wp--custom--radius--pill);
	background-color: var(--wp--custom--color--border--gold-subtle);
	transition: background-color 0.15s ease;
}
.aa-sold-toggle.is-on .aa-sold-toggle__track {
	background-color: var(--wp--custom--color--accent--gold-light);
}
.aa-sold-toggle__thumb {
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	inline-size: 18px;
	block-size: 18px;
	border-radius: 50%;
	background-color: #fff;
	transition: transform 0.15s ease;
}
.aa-sold-toggle.is-on .aa-sold-toggle__thumb { transform: translateX(18px); }
.aa-sold-toggle__state { min-inline-size: 2em; }
.aa-sold-toggle:focus-visible {
	outline: 2px solid var(--wp--custom--color--accent--gold-hover);
	outline-offset: 2px;
	border-radius: var(--wp--custom--radius--sm);
}
