/*
 * OT TagPages — frontend (managed term archives only).
 * Inherits theme typography and colours; borders and tints derive from currentColor so contrast
 * follows the theme (light or dark).
 */

.ot-tagpages-header {
	margin-block: 0 var( --wp--style--block-gap, 1.5rem );
}

.ot-tagpages-title {
	margin-block: 0 0.5em;
}

.ot-tagpages-intro {
	max-width: var( --wp--style--global--content-size, 72ch );
}

.ot-tagpages-intro > :first-child {
	margin-top: 0;
}

.ot-tagpages-intro > :last-child {
	margin-bottom: 0;
}

/* Sections: "Start here" and "Related topics" */
.ot-tagpages-section {
	clear: both;
	margin-block: 2rem;
}

.ot-tagpages-section__title {
	margin-block: 0 0.35em;
	font-size: clamp( 1.15rem, 1rem + 0.6vw, 1.45rem );
}

.ot-tagpages-section__note {
	margin-block: 0 1rem;
	font-size: 0.92em;
	opacity: 0.8;
}

/* Related items live in a tinted, bordered box — visibly not part of the tag's own list. */
.ot-tagpages-related {
	padding: clamp( 1rem, 0.75rem + 1vw, 1.5rem );
	border: 1px solid color-mix( in srgb, currentColor 18%, transparent );
	border-radius: 12px;
	background: color-mix( in srgb, currentColor 4%, transparent );
}

.ot-tagpages-cards {
	display: grid;
	grid-template-columns: repeat( auto-fill, minmax( min( 100%, 220px ), 1fr ) );
	gap: 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ot-tagpages-card-item {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-width: 0;
	margin: 0;
}

.ot-tagpages-card__link {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	color: inherit;
	text-decoration: none;
}

.ot-tagpages-card__link:hover .ot-tagpages-card__title,
.ot-tagpages-card__link:focus-visible .ot-tagpages-card__title {
	text-decoration: underline;
}

.ot-tagpages-card__link:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 4px;
}

.ot-tagpages-card__media {
	display: block;
	overflow: hidden;
	aspect-ratio: 16 / 10;
	border-radius: 8px;
	background: color-mix( in srgb, currentColor 8%, transparent );
}

.ot-tagpages-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ot-tagpages-card__title {
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ot-tagpages-card__meta {
	font-size: 0.85em;
	opacity: 0.75;
}

@media ( prefers-reduced-motion: no-preference ) {
	.ot-tagpages-card__media img {
		transition: transform 200ms ease;
	}

	.ot-tagpages-card__link:hover .ot-tagpages-card__media img {
		transform: scale( 1.03 );
	}
}

/* Related tags (chips) — indexable tags of the same taxonomy only. */
.ot-tagpages-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ot-tagpages-chips li {
	margin: 0;
}

.ot-tagpages-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4em;
	min-height: 2.25rem;
	padding: 0.3em 0.85em;
	border: 1px solid color-mix( in srgb, currentColor 22%, transparent );
	border-radius: 999px;
	color: inherit;
	text-decoration: none;
	line-height: 1.3;
}

.ot-tagpages-chip:hover {
	background: color-mix( in srgb, currentColor 6%, transparent );
	text-decoration: underline;
}

.ot-tagpages-chip:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.ot-tagpages-chip__count {
	font-size: 0.8em;
	opacity: 0.7;
}

/* Blocks: the wrapper carries alignment / margin; the section keeps its own spacing. */
.ot-tagpages-block > .ot-tagpages-section {
	margin-block: 0;
}
