/*
 * Curiosity4U catalog templates (book, collection, series).
 * Built from the owner-approved M4 page preview (prototypes/books-m4-preview/)
 * and the approved M2 components it reuses. Every rule is scoped to
 * .c4u-catalog so Neve's own classes (for example .button) are untouched.
 * Tokens: style.css (DESIGN.md). Fonts are declared in c4u-site.css, which loads first.
 */


.c4u-catalog {
	/* Type scale and derived values from the approved M2 preview. */
	--fs-1: 0.875rem;
	--fs-2: 1rem;
	--fs-3: 1.375rem;
	--fs-4: 1.75rem;
	--fs-5: clamp(2rem, 1.45rem + 1.9vw, 3rem);
	--fs-6: clamp(2.625rem, 1.55rem + 3vw, 4rem);
	--aegean-deep: #1B4456;
	--aegean-night: #1C4A5E;
	--on-aegean: #F8F6F1;
	--on-aegean-soft: rgba(248, 246, 241, 0.86);
	--tone: #EFEBE3;
	--shelf-line: rgba(35, 43, 48, 0.28);
	--tone-stone: #E3DDD1;
	--font-display: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
	--font-text: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
	--ease-out: cubic-bezier(0.16, 1, 0.3, 1);
	--gutter: clamp(16px, 4vw, 40px);
	--section-space: clamp(64px, 8vw, 112px);

	background: var(--c4u-paper);
	color: var(--c4u-ink);
	font-family: var(--font-text);
	font-size: var(--fs-2);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
}

@media (min-width: 768px) {
	.c4u-catalog {
		--fs-2: 1.0625rem;
	}
}

.c4u-catalog *,
.c4u-catalog *::before,
.c4u-catalog *::after {
	box-sizing: border-box;
}

.c4u-catalog p,
.c4u-catalog dl,
.c4u-catalog ul,
.c4u-catalog ol {
	margin-top: 0;
}

.c4u-catalog p {
	margin-bottom: 0;
}

.c4u-catalog a {
	color: inherit;
}

.c4u-catalog img {
	max-width: 100%;
}

.c4u-catalog .button,
.c4u-catalog .button:hover,
.c4u-catalog .button:focus {
	color: var(--c4u-white);
}

.c4u-catalog .button--inverse,
.c4u-catalog .button--inverse:hover {
	color: var(--c4u-aegean);
}

.c4u-catalog h1,
.c4u-catalog h2,
.c4u-catalog h3 {
	color: inherit;
	letter-spacing: normal;
}

/* ---------- M2 components ---------- */

.c4u-catalog h1,
.c4u-catalog h2,
.c4u-catalog h3 {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 500;
	text-wrap: balance;
}

.c4u-catalog :focus-visible {
	outline: 3px solid var(--c4u-aegean);
	outline-offset: 3px;
	border-radius: 2px;
}

.c4u-catalog .wrap {
	width: 100%;
	max-width: calc(var(--c4u-content-width) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.c4u-catalog .meta {
	font-size: var(--fs-1);
	font-weight: 500;
	color: var(--c4u-muted);
}

.c4u-catalog .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.75rem 1.5rem;
	border-radius: var(--c4u-radius);
	background: var(--c4u-aegean);
	color: var(--c4u-white);
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.2s, transform 0.2s var(--ease-out);
}

.c4u-catalog .button:hover {
	background: var(--aegean-deep);
}

.c4u-catalog .button:active {
	transform: translateY(1px);
}

.c4u-catalog .button--inverse {
	background: var(--c4u-paper);
	color: var(--c4u-aegean);
}

.c4u-catalog .button--inverse:hover {
	background: var(--c4u-white);
}

.c4u-catalog .text-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	min-height: 44px;
	color: var(--c4u-aegean);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-color: rgba(35, 85, 107, 0.35);
	transition: text-decoration-color 0.2s;
}

.c4u-catalog .text-link:hover {
	text-decoration-color: currentColor;
}

.c4u-catalog .text-link__arrow {
	flex: none;
	width: 1.05em;
	height: 1.05em;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: transform 0.35s var(--ease-out);
}

.c4u-catalog .text-link:hover .text-link__arrow {
	transform: translateX(3px);
}

.c4u-catalog .cover--85x11 { --in: 8.5; --h: 11; aspect-ratio: 8.5 / 11; }

.c4u-catalog .section-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--c4u-space-2) var(--c4u-space-6);
	margin-bottom: clamp(28px, 4vw, 48px);
}

.c4u-catalog .section-title {
	font-size: var(--fs-5);
	line-height: 1.08;
	letter-spacing: -0.01em;
}

.c4u-catalog .series__frame {
	position: relative;
	display: flex;
	align-items: flex-end;
	aspect-ratio: 6 / 9;
	padding: 28px 24px;
	background: var(--aegean-night);
	box-shadow: 0 24px 40px -24px rgba(12, 28, 36, 0.8);
}

.c4u-catalog .series__frame::before {
	content: "";
	position: absolute;
	inset: 10px;
	border: 1px solid rgba(208, 173, 104, 0.75);
}

.c4u-catalog .series__art-note {
	position: relative;
	font-size: var(--fs-1);
	font-weight: 500;
	line-height: 1.35;
	color: var(--on-aegean-soft);
}

.c4u-catalog .badge {
	display: inline-block;
	padding: 3px 10px;
	border: 1px solid var(--c4u-gold);
	border-radius: 2px;
	font-size: var(--fs-1);
	font-weight: 600;
	letter-spacing: 0.02em;
}

.c4u-catalog .cover-img {
	display: block;
	height: auto;
	/* --cover-ar comes from the cover file (plugin); 8.5 x 11 when missing. */
	aspect-ratio: var(--cover-ar, 927 / 1200);
	object-fit: contain;
	background: var(--c4u-white);
	box-shadow:
		0 0 0 1px rgba(35, 43, 48, 0.08),
		0 1px 1px rgba(35, 43, 48, 0.14),
		0 10px 16px -12px rgba(35, 43, 48, 0.45);
}

/* ---------- M4 page components ---------- */

.c4u-catalog .page-head {
	padding-top: clamp(24px, 4vw, 40px);
}

.c4u-catalog .breadcrumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 var(--c4u-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: var(--fs-1);
	color: var(--c4u-muted);
}

.c4u-catalog .breadcrumbs li {
	display: inline-flex;
	align-items: center;
	gap: var(--c4u-space-2);
}

.c4u-catalog .breadcrumbs li:not(:last-child)::after {
	content: "/";
	color: rgba(88, 97, 105, 0.6);
}

.c4u-catalog .breadcrumbs a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--c4u-aegean);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgba(35, 85, 107, 0.35);
	text-underline-offset: 0.2em;
}

.c4u-catalog .breadcrumbs a:hover {
	text-decoration-color: currentColor;
}

.c4u-catalog .breadcrumbs [aria-current="page"] {
	color: var(--c4u-ink);
}

.c4u-catalog .page-section {
	padding-block: var(--section-space);
}

.c4u-catalog .page-section--tone {
	background: var(--tone);
}

.c4u-catalog .page-section__title {
	font-size: var(--fs-4);
	font-weight: 600;
	line-height: 1.15;
}

.c4u-catalog .reading {
	max-width: var(--c4u-reading-width);
}

.c4u-catalog .book-hero {
	padding-block: var(--c4u-space-6) var(--section-space);
}

.c4u-catalog .book-hero__grid {
	display: grid;
	gap: var(--c4u-space-8);
}

.c4u-catalog .book-hero__stage {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: var(--c4u-space-8) var(--c4u-space-6) 0;
	background: var(--tone);
	border-bottom: 1px solid var(--shelf-line);
}

.c4u-catalog .book-hero__cover {
	/* Same height for every trim: a narrower cover gets a narrower width. */
	width: calc(min(48vw, 190px) * var(--cover-ar, 0.7725) / 0.7725);
}

@media (max-width: 899px) {
	.c4u-catalog .book-hero__stage {
			padding: var(--c4u-space-6) var(--c4u-space-6) 0;
}

	.c4u-catalog .book-hero__format,
	.c4u-catalog .book-hero__action {
			margin-top: var(--c4u-space-4);
}
}

.c4u-catalog .book-hero__byline {
	margin: var(--c4u-space-4) 0 0;
}

.c4u-catalog .book-hero__title {
	font-size: var(--fs-6);
	font-weight: 500;
	line-height: 1.02;
	letter-spacing: -0.015em;
	max-width: 16ch;
}

.c4u-catalog .book-hero__subtitle {
	margin: var(--c4u-space-3) 0 0;
	max-width: 32ch;
	font-family: var(--font-display);
	font-size: var(--fs-3);
	font-weight: 500;
	line-height: 1.3;
	color: var(--c4u-ink);
}

.c4u-catalog .book-hero__format {
	margin: var(--c4u-space-6) 0 0;
}

.c4u-catalog .book-hero__action {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--c4u-space-3) var(--c4u-space-6);
	margin-top: var(--c4u-space-6);
}

.c4u-catalog .book-hero__action-note {
	margin: 0;
	font-size: var(--fs-1);
	color: var(--c4u-muted);
}

.c4u-catalog .button__arrow {
	width: 1em;
	height: 1em;
	margin-left: 0.5em;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.c4u-catalog .book-hero__pitch {
	margin-top: var(--c4u-space-8);
	padding-top: var(--c4u-space-6);
	border-top: 1px solid var(--c4u-border);
	max-width: 58ch;
}

.c4u-catalog .book-hero__pitch p {
	margin: 0;
}

@media (min-width: 900px) {
	.c4u-catalog .book-hero__grid {
			grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
			align-items: start;
			gap: clamp(40px, 6vw, 88px);
}

	.c4u-catalog .book-hero__stage {
			position: sticky;
			top: var(--c4u-space-6);
			padding: var(--c4u-space-12) var(--c4u-space-8) 0;
}

	.c4u-catalog .book-hero__cover {
			width: calc(min(100%, 360px) * var(--cover-ar, 0.7725) / 0.7725);
}

	.c4u-catalog .book-hero__details {
			padding-top: var(--c4u-space-4);
}
}

.c4u-catalog .details-grid {
	display: grid;
	gap: var(--c4u-space-12);
}

@media (min-width: 900px) {
	.c4u-catalog .details-grid {
			grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
			gap: clamp(40px, 6vw, 88px);
}
}

.c4u-catalog .facts {
	margin: var(--c4u-space-6) 0 0;
	display: grid;
	grid-template-columns: minmax(8rem, max-content) 1fr;
	border-top: 1px solid var(--c4u-border);
}

.c4u-catalog .facts dt,
.c4u-catalog .facts dd {
	margin: 0;
	padding: var(--c4u-space-3) 0;
	border-bottom: 1px solid var(--c4u-border);
}

.c4u-catalog .facts dt {
	padding-right: var(--c4u-space-6);
	font-size: var(--fs-1);
	font-weight: 600;
	color: var(--c4u-muted);
	line-height: 1.9;
}

.c4u-catalog .facts dd {
	font-variant-numeric: tabular-nums;
}

.c4u-catalog .book-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--c4u-space-12) var(--c4u-space-6);
	margin: var(--c4u-space-8) 0 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.c4u-catalog .book-grid {
			grid-template-columns: repeat(3, minmax(0, 1fr));
			gap: var(--c4u-space-16) var(--c4u-space-8);
}
}

@media (min-width: 1200px) {
	.c4u-catalog .book-grid--four {
			grid-template-columns: repeat(4, minmax(0, 1fr));
}
}

.c4u-catalog .book-card {
	position: relative;
	display: flex;
	flex-direction: column;
}

.c4u-catalog .book-card__stage {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	padding: var(--c4u-space-6) var(--c4u-space-4) 0;
	background: var(--tone);
	border-bottom: 1px solid var(--shelf-line);
}

.c4u-catalog .page-section--tone .book-card__stage {
	background: var(--c4u-paper);
}

.c4u-catalog .book-card__cover {
	width: calc(min(100%, 200px) * var(--cover-ar, 0.7725) / 0.7725);
	transition: transform 0.35s var(--ease-out);
}

.c4u-catalog .book-card__body {
	padding-top: var(--c4u-space-4);
}

.c4u-catalog .book-card__label {
	margin: var(--c4u-space-2) 0 0;
}

@media (max-width: 767px) {
	.c4u-catalog .book-grid--related > li:nth-child(n + 3) {
			display: none;
}
}

.c4u-catalog .book-card__title {
	font-size: var(--fs-3);
	font-weight: 600;
	line-height: 1.15;
}

.c4u-catalog .book-card__title a {
	color: var(--c4u-ink);
	text-decoration: none;
}

.c4u-catalog .book-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.c4u-catalog .book-card__title a:focus-visible {
	outline: none;
}

.c4u-catalog .book-card:has(a:focus-visible) {
	outline: 3px solid var(--c4u-aegean);
	outline-offset: 6px;
	border-radius: 2px;
}

.c4u-catalog .book-card__subtitle {
	margin: var(--c4u-space-2) 0 0;
	font-size: var(--fs-1);
	line-height: 1.45;
	color: var(--c4u-muted);
}

.c4u-catalog .book-card__cta {
	margin-top: var(--c4u-space-3);
	font-size: var(--fs-1);
	font-weight: 600;
	color: var(--c4u-aegean);
	text-decoration: underline;
	text-decoration-color: rgba(35, 85, 107, 0.35);
	text-underline-offset: 0.2em;
}

@media (hover: hover) {
	.c4u-catalog .book-card:hover .book-card__cover {
			transform: translateY(-4px);
}

	.c4u-catalog .book-card:hover .book-card__title a {
			color: var(--c4u-aegean);
}

	.c4u-catalog .book-card:hover .book-card__cta {
			text-decoration-color: currentColor;
}
}

@media (prefers-reduced-motion: reduce) {
	.c4u-catalog .book-card__cover {
			transition: none;
}

	.c4u-catalog .book-card:hover .book-card__cover {
			transform: none;
}
}

@media (max-width: 479px) {
	.c4u-catalog .book-card__title {
			font-size: 1.1875rem;
}

	.c4u-catalog .book-card__stage {
			padding: var(--c4u-space-4) var(--c4u-space-3) 0;
}
}

.c4u-catalog .collection-head {
	padding-block: var(--c4u-space-6) 0;
}

.c4u-catalog .collection-head__inner {
	padding-bottom: var(--c4u-space-12);
	border-bottom: 1px solid var(--c4u-border);
}

.c4u-catalog .collection-head__title + .draft-mark {
	margin-top: var(--c4u-space-4);
}

.c4u-catalog .page-section--after-head {
	padding-top: var(--c4u-space-8);
}

.c4u-catalog .page-section--after-head .book-grid {
	margin-top: 0;
}

.c4u-catalog .collection-head__title {
	font-size: var(--fs-6);
	line-height: 1.02;
	letter-spacing: -0.015em;
}

.c4u-catalog .collection-head__lede {
	margin: var(--c4u-space-4) 0 0;
	max-width: 46ch;
	font-size: var(--fs-3);
	line-height: 1.4;
	font-family: var(--font-display);
	font-weight: 500;
}

.c4u-catalog .collection-head__count {
	margin: var(--c4u-space-6) 0 0;
}

.c4u-catalog .other-collections {
	display: grid;
	gap: var(--c4u-space-6);
	margin: var(--c4u-space-6) 0 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.c4u-catalog .other-collections {
			grid-template-columns: repeat(2, minmax(0, 1fr));
			gap: var(--c4u-space-8);
}
}

.c4u-catalog .other-collections li {
	padding-top: var(--c4u-space-4);
	border-top: 1px solid var(--shelf-line);
}

.c4u-catalog .other-collections h3 {
	font-size: var(--fs-4);
	font-weight: 600;
	line-height: 1.15;
}

.c4u-catalog .other-collections h3 a {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--c4u-ink);
	text-decoration: underline;
	text-decoration-color: rgba(35, 43, 48, 0.3);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
}

.c4u-catalog .other-collections h3 a:hover {
	color: var(--c4u-aegean);
	text-decoration-color: currentColor;
}

.c4u-catalog .other-collections p {
	margin: var(--c4u-space-1) 0 0;
	max-width: 44ch;
}

.c4u-catalog .empty-state {
	display: grid;
	gap: var(--c4u-space-4);
	justify-items: start;
	max-width: 52ch;
	margin-top: var(--c4u-space-8);
	padding: var(--c4u-space-8);
	background: var(--c4u-white);
	border: 1px solid var(--c4u-border);
	border-radius: var(--c4u-radius);
}

.c4u-catalog .empty-state__title {
	font-size: var(--fs-4);
	font-weight: 600;
	line-height: 1.15;
}

.c4u-catalog .empty-state p {
	margin: 0;
}

.c4u-catalog .series-hero {
	padding-block: var(--c4u-space-6) clamp(64px, 9vw, 112px);
	background: var(--c4u-aegean);
	color: var(--on-aegean);
}

.c4u-catalog .series-hero .breadcrumbs ol,
.c4u-catalog .series-hero .breadcrumbs [aria-current="page"] {
	color: var(--on-aegean-soft);
}

.c4u-catalog .series-hero .breadcrumbs li:not(:last-child)::after {
	color: rgba(248, 246, 241, 0.5);
}

.c4u-catalog .series-hero .breadcrumbs a {
	color: var(--on-aegean);
	text-decoration-color: rgba(248, 246, 241, 0.45);
}

.c4u-catalog .series-hero .breadcrumbs a:focus-visible,
.c4u-catalog .series-hero .button--inverse:focus-visible {
	outline-color: var(--c4u-paper);
}

.c4u-catalog .series-hero__grid {
	display: grid;
	gap: var(--c4u-space-12);
	margin-top: var(--c4u-space-8);
	align-items: center;
}

@media (min-width: 900px) {
	.c4u-catalog .series-hero__grid {
			grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
			gap: clamp(40px, 6vw, 88px);
}
}

.c4u-catalog .series-hero__title {
	font-size: var(--fs-6);
	line-height: 1.02;
	letter-spacing: -0.015em;
	max-width: 14ch;
}

.c4u-catalog .series-hero__status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--c4u-space-3);
	margin: var(--c4u-space-6) 0 0;
}

.c4u-catalog .series-hero__lede {
	margin: var(--c4u-space-6) 0 0;
	max-width: 48ch;
	font-size: var(--fs-3);
	line-height: 1.45;
	font-family: var(--font-display);
	font-weight: 500;
}

.c4u-catalog .series-hero__art {
	max-width: 340px;
	width: 100%;
	justify-self: center;
}

@media (max-width: 899px) {
	.c4u-catalog .series-hero__art {
			max-width: 220px;
			justify-self: center;
}
}

.c4u-catalog .upcoming {
	display: grid;
	gap: var(--c4u-space-8);
	margin-top: var(--c4u-space-8);
	padding-top: var(--c4u-space-8);
	border-top: 1px solid var(--c4u-border);
}

@media (min-width: 768px) {
	.c4u-catalog .upcoming {
			grid-template-columns: 200px minmax(0, 1fr);
			align-items: end;
			gap: var(--c4u-space-12);
}
}

.c4u-catalog .upcoming__frame {
	display: flex;
	align-items: flex-end;
	aspect-ratio: 6 / 9;
	width: min(100%, 200px);
	padding: var(--c4u-space-4);
	background: var(--tone-stone);
	border: 1px dashed rgba(88, 97, 105, 0.5);
	font-size: var(--fs-1);
	font-weight: 500;
	line-height: 1.35;
	color: var(--c4u-muted);
}

.c4u-catalog .upcoming__title {
	font-size: var(--fs-5);
	font-weight: 500;
	line-height: 1.06;
}

.c4u-catalog .upcoming__title cite {
	font-style: normal;
}

.c4u-catalog .upcoming__status {
	margin: var(--c4u-space-4) 0 0;
}

.c4u-catalog .upcoming__status .badge {
	color: var(--c4u-ink);
}

.c4u-catalog .upcoming__note {
	margin: var(--c4u-space-4) 0 0;
	max-width: 48ch;
}

.c4u-catalog .series-close {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--c4u-space-4) var(--c4u-space-8);
}

.c4u-catalog .series-close p {
	margin: 0;
	max-width: 44ch;
	font-family: var(--font-display);
	font-size: var(--fs-4);
	font-weight: 500;
	line-height: 1.2;
}

.c4u-catalog .meta-link {
	color: var(--c4u-aegean);
	text-decoration: underline;
	text-decoration-color: rgba(35, 85, 107, 0.35);
	text-underline-offset: 0.2em;
}

.c4u-catalog .meta-link:hover {
	text-decoration-color: currentColor;
}

/* ---------- Template states (WordPress only) ---------- */

@media (min-width: 900px) {
	.c4u-catalog .details-grid--single {
		grid-template-columns: minmax(0, var(--c4u-reading-width));
	}

	.c4u-catalog .series-hero__grid--text {
		grid-template-columns: minmax(0, 1fr);
	}
}

.c4u-catalog .about-book__text {
	margin-top: var(--c4u-space-6);
	max-width: 65ch;
}

.c4u-catalog .about-book__text p + p {
	margin-top: var(--c4u-space-4);
}

.c4u-catalog .series-empty {
	margin-top: var(--c4u-space-6);
}

/* ---------- Books archive: collection filter ---------- */

.c4u-catalog .book-filter {
	margin-top: var(--c4u-space-6);
}

.c4u-catalog .book-filter ul {
	display: flex;
	flex-wrap: wrap;
	gap: var(--c4u-space-2) var(--c4u-space-6);
	margin: 0;
	padding: 0;
	list-style: none;
}

.c4u-catalog .book-filter a,
.c4u-catalog .book-filter [aria-current="page"] {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	font-weight: 500;
}

.c4u-catalog .book-filter a {
	color: var(--c4u-aegean);
	text-decoration: underline;
	text-decoration-color: rgba(35, 85, 107, 0.35);
	text-underline-offset: 0.2em;
}

.c4u-catalog .book-filter a:hover {
	text-decoration-color: currentColor;
}

.c4u-catalog .book-filter [aria-current="page"] {
	color: var(--c4u-ink);
	background: linear-gradient(var(--c4u-terracotta), var(--c4u-terracotta)) left calc(100% - 8px) / 100% 2px no-repeat;
}
