/*
 * Publication index and rows (inc/publications.php). Mirrors
 * src/components/sections/PublicationIndex.astro and
 * src/components/ui/PublicationRow.astro; sizes are the Tailwind values
 * there, tokens come from theme.json. Loaded only where a row or the index
 * renders, and in the editor canvas as the block's style.
 */

.credi-pub-index :where(h2, p),
.credi-pub-row :where(p) {
	margin: 0;
}

/* Bands: the page gutter and the content column, as Section.astro. */
.credi-pub-band {
	padding: var(--wp--preset--spacing--section-sm) var(--wp--style--root--padding-right) var(--wp--preset--spacing--section-sm) var(--wp--style--root--padding-left);
}

.credi-pub-band__inner {
	max-width: var(--wp--style--global--content-size);
	margin-inline: auto;
}

.credi-pub-intro,
.credi-pub-group,
.credi-pub-group__header {
	display: flex;
	flex-direction: column;
}

.credi-pub-intro {
	gap: 1.25rem;
}

.credi-pub-group {
	gap: 1.5rem;
	scroll-margin-top: 3rem;
}

.credi-pub-group__header {
	gap: 1rem;
}

/* Row. The inset lives on the block so the hairline and the hover tint
   overhang the text column while the content stays on the grid. */
.credi-pub-row {
	width: calc(100% + 2rem);
	margin-inline: -1rem;
}

.credi-pub-row__hairline {
	width: 100%;
	height: 1px;
	background-color: var(--wp--custom--color--navy-hairline);
}

.credi-pub {
	transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (hover: hover) {
	.credi-pub:hover {
		background-color: color-mix(in srgb, var(--wp--preset--color--navy-800) 3%, transparent);
	}

	.credi-pub[data-complete]:hover {
		background-color: transparent;
	}
}

.credi-pub__summary {
	display: flex;
	align-items: flex-start;
	gap: 1.5rem;
	padding: 1.75rem 1rem;
	list-style: none;
	cursor: pointer;
}

.credi-pub__summary::marker,
.credi-pub__summary *::marker {
	content: none;
}

.credi-pub__summary::-webkit-details-marker {
	display: none;
}

.credi-pub[data-complete] .credi-pub__summary {
	cursor: default;
}

.credi-pub__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

.credi-pub__title,
.credi-pub__year {
	font-size: var(--wp--preset--font-size--nav);
	font-weight: 700;
	line-height: 1.625rem;
	letter-spacing: -0.015em;
}

.credi-pub__title {
	color: var(--wp--preset--color--navy-800);
}

/* One clamped line at rest, the whole citation once the row opens. */
.credi-pub__reference {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 1;
	line-clamp: 1;
	font-size: var(--wp--preset--font-size--body-sm);
	line-height: 1.75;
	letter-spacing: normal;
	color: var(--wp--preset--color--slate);
}

.credi-pub[open] .credi-pub__reference {
	display: block;
	overflow: visible;
	-webkit-box-orient: horizontal;
	-webkit-line-clamp: unset;
	line-clamp: none;
}

.credi-pub__year {
	flex-shrink: 0;
	color: var(--wp--custom--color--navy-label);
	font-variant-numeric: tabular-nums;
}

.credi-pub__chevron {
	flex-shrink: 0;
	margin-top: 0.375rem;
	fill: none;
	stroke: var(--wp--preset--color--navy-800);
	stroke-width: 2;
	transition: scale 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.credi-pub[open] .credi-pub__chevron {
	scale: 1 -1;
}

.credi-pub[data-complete] .credi-pub__chevron {
	display: none;
}

/* The paragraph's line box is the 24px of Astro's root line height
   (Tailwind's 1.5), not this theme's 26px body: the inline-flex link sits on
   it, and the taller strut made every open row 1.5px taller. */
.credi-pub__link {
	padding: 0 1rem 1.75rem;
	line-height: 1.5;
}

.credi-pub__link a {
	display: inline-flex;
	align-items: center;
	min-height: 1.5rem;
	font-size: var(--wp--preset--font-size--body-sm);
	font-weight: 600;
	line-height: 1.4375rem;
	letter-spacing: normal;
	color: var(--wp--preset--color--navy-800);
	text-decoration: underline;
	text-underline-offset: 4px;
}

@media (min-width: 40rem) {
	.credi-pub-row {
		width: calc(100% + 3rem);
		margin-inline: -1.5rem;
	}

	.credi-pub__summary {
		gap: 2.5rem;
		padding-inline: 1.5rem;
	}

	.credi-pub__link {
		padding-inline: 1.5rem;
	}
}

/* Print: one record per piece of paper where it fits, every row open with
   its whole citation, as the Astro print rules do. */
@media print {
	.credi-pub {
		break-inside: avoid;
	}

	.credi-pub::details-content {
		content-visibility: visible;
	}

	.credi-pub__reference {
		display: block;
		overflow: visible;
		-webkit-line-clamp: none;
		line-clamp: none;
	}

	.credi-pub__chevron {
		display: none;
	}
}

/* Filters (blocks/publication-index, inc/publication-filters.php). Mirrors
   the controls of PublicationIndex.astro and FilterList.astro. */
.credi-pub-reset {
	align-self: flex-start;
	font-weight: 500;
	color: var(--wp--preset--color--navy-800);
	text-decoration-line: underline;
}

.credi-pub-filters {
	padding-top: 0.5rem;
}

.credi-pub-filters__links {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* One strip per dimension: the label, then the options. No separators; the
   gap carries the separation when the strip wraps. */
.credi-pub-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 2rem;
}

.credi-pub-filter a {
	font-weight: 500;
	color: var(--wp--custom--color--navy-label);
	text-decoration: none;
}

.credi-pub-filter a:hover {
	color: var(--wp--preset--color--navy-800);
	text-decoration: none;
}

.credi-pub-filter a[aria-current="true"] {
	font-weight: 700;
	color: var(--wp--preset--color--navy-800);
	text-decoration-line: underline;
}

.credi-pub-filters__selects {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.credi-pub-filters__field {
	display: flex;
	flex: 1 1 0%;
	flex-direction: column;
	gap: 0.5rem;
	min-width: 0;
}

/* The label box takes the browser's 1.5 line height, as on Astro, not the
   body's 1.625. */
.credi-pub-filters__field label {
	line-height: 1.5rem;
}

/* The native control with only a bottom rule, as Tailwind's reset leaves it
   on Astro. */
.credi-pub-filters__select {
	margin: 0;
	padding: 0 0 0.5rem;
	border: 0;
	border-bottom: 1px solid var(--wp--custom--color--navy-rule);
	border-radius: 0;
	background-color: transparent;
	font: inherit;
	font-size: var(--wp--preset--font-size--body-sm);
	line-height: 1.4375rem;
	letter-spacing: normal;
	color: var(--wp--preset--color--navy-800);
	cursor: pointer;
}

.credi-pub-filters__select:focus {
	border-color: var(--wp--preset--color--navy-800);
}

@media (min-width: 40rem) {
	.credi-pub-filters__selects {
		flex-direction: row;
	}
}

/* The link rows are the scriptless experience. Once the `credi-nf-scripted`
   mark the filter script depends on sets `credi-js`, before first paint,
   the selects replace them. */
html:not(.credi-js) [data-filter-selects],
.credi-js [data-filter-links] {
	display: none;
}
