/**
 * Polish layer, module "downloads" (docs.ia/build/polish-design.md §16.2,
 * design §8.6). Finder states, finder cards (moved from cards, R6.7), new
 * cards (script 6.4), order control (R7), group archive. Needs the base
 * module (tokens).
 */

/* R7: order control not wanted (default order stays); label hidden too. */
#precoin-downloads-finder-sort,
label[for="precoin-downloads-finder-sort"] {
	display: none;
}

/* Filter buttons: the ghost tint on hover, scale on press. */
.wp-block-precoin-downloads-finder button {
	transition-property: background-color, color, border-color, box-shadow, translate, scale, background-size;
	transition-duration: var(--precoin-t-2);
	transition-timing-function: var(--precoin-ease-out);
}
@media (hover: hover) {
	.wp-block-precoin-downloads-finder button:hover {
		box-shadow: inset 0 0 0 999px var(--precoin-ink-06);
		transition-duration: var(--precoin-t-1);
	}
}
.wp-block-precoin-downloads-finder button:focus-visible {
	box-shadow: inset 0 0 0 999px var(--precoin-ink-06);
	transition-duration: var(--precoin-t-1);
}
.wp-block-precoin-downloads-finder button:active {
	scale: .98;
	transition-duration: var(--precoin-t-press);
}

/* R6.7: the finder card's own lift, shadow, one-target and title rules,
   moved here from the cards module. Subtler than the article/related cards: 2px lift
   (was 3px), 400ms in (--precoin-t-3, was 160ms), 240ms out unchanged
   (--precoin-t-2). No title underline (round 5: it looked wrong on every
   card type). */
.wp-block-precoin-downloads-finder__card {
	transition: translate var(--precoin-t-2) var(--precoin-ease-out), box-shadow var(--precoin-t-2) var(--precoin-ease-out), scale var(--precoin-t-2) var(--precoin-ease-out);
	position: relative;
}
@media (hover: hover) {
	.wp-block-precoin-downloads-finder__card:hover {
		translate: 0 -2px;
		box-shadow: var(--precoin-elev-1);
		transition-duration: var(--precoin-t-3);
	}
}
.wp-block-precoin-downloads-finder__card:focus-within {
	translate: 0 -2px;
	box-shadow: var(--precoin-elev-1);
	transition-duration: var(--precoin-t-3);
}
.wp-block-precoin-downloads-finder__card.has-border-color:hover,
.wp-block-precoin-downloads-finder__card.has-border-color:focus-within {
	box-shadow: var(--precoin-elev-1), 0 0 0 1px var(--wp--preset--color--line);
}
.wp-block-precoin-downloads-finder__card:active {
	scale: .99;
	translate: none;
	transition-duration: var(--precoin-t-press);
}
.wp-block-precoin-downloads-finder__card h3 a {
	text-decoration: none;
	position: relative;
}
.wp-block-precoin-downloads-finder__card h3 a::after {
	content: "";
	position: absolute;
	inset: 0;
}
.wp-block-precoin-downloads-finder__card-foot {
	position: relative;
	z-index: 1;
	margin-top: auto;
	/* R7.5: this link is also the card's own border-top rule (the base
	   block's CSS, side to side). R7.1's align-self: flex-end shrank it to
	   its own content width to move it right, taking the rule with it —
	   68px wide instead of the full card, and disappearing or jumping
	   width depending on state (rest/filtered/hover) since those never
	   agreed on a width. stretch keeps it full width, rule intact; the text
	   itself moves right with text-align (this is display: block, not
	   flex, so text-align is the right tool, not justify-content). */
	align-self: stretch;
	text-align: right;
}

/* Group archive: the taxonomy filter list as rows, matching the tag-cloud
   current-term pattern (font-weight is the non-colour state cue). */
.tax-grupo_descarga ul.wp-block-categories {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
}
.tax-grupo_descarga ul.wp-block-categories li.cat-item {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: var(--wp--preset--spacing--sm);
	padding: var(--wp--preset--spacing--sm) var(--wp--preset--spacing--md);
	border-radius: var(--wp--custom--radius--sm);
}
.tax-grupo_descarga ul.wp-block-categories li.cat-item a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}
.tax-grupo_descarga ul.wp-block-categories .precoin-cat-count {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--xs);
	color: var(--wp--preset--color--ink-faint);
}
.tax-grupo_descarga ul.wp-block-categories li.current-cat {
	background: var(--wp--preset--color--ink);
}
.tax-grupo_descarga ul.wp-block-categories li.current-cat a {
	color: var(--wp--preset--color--background);
	font-weight: 700;
}
.tax-grupo_descarga ul.wp-block-categories li.current-cat .precoin-cat-count {
	color: var(--wp--preset--color--on-dark-soft);
}

@media screen and (prefers-reduced-motion: no-preference) {
	/* New cards (design §8.6), gated by script 6.4's first interaction so the
	   finder's own initial render never animates. Round 6, R6.6: the owner
	   found the entrance too fast to see, 480ms (literal; no token
	   matches), with a 40ms stagger across the first 8 cards so a whole new
	   page of results doesn't pop in as one single flash. Round 7, R7.4:
	   still a little fast — 640ms, same stagger. */
	.precoin-finder-touched .wp-block-precoin-downloads-finder__card {
		transition: opacity 640ms var(--precoin-ease-out), translate 640ms var(--precoin-ease-out), box-shadow var(--precoin-t-2) var(--precoin-ease-out);
		@starting-style {
			opacity: 0;
			translate: 0 8px;
		}
		&:nth-child(1) { transition-delay: 0ms; }
		&:nth-child(2) { transition-delay: 40ms; }
		&:nth-child(3) { transition-delay: 80ms; }
		&:nth-child(4) { transition-delay: 120ms; }
		&:nth-child(5) { transition-delay: 160ms; }
		&:nth-child(6) { transition-delay: 200ms; }
		&:nth-child(7) { transition-delay: 240ms; }
		&:nth-child(8) { transition-delay: 280ms; }
	}
	/* Review follow-up: the stagger is for entering cards only. A hover or
	   focus after the entrance answers at once, with the rest transition. */
	.precoin-finder-touched .wp-block-precoin-downloads-finder__card:is(:hover, :focus-within) {
		transition: translate var(--precoin-t-3) var(--precoin-ease-out), box-shadow var(--precoin-t-3) var(--precoin-ease-out), opacity 640ms var(--precoin-ease-out);
		transition-delay: 0ms;
	}
}
