/**
 * Layout-shift (CLS) hardening: stop `transition: all` rules from animating
 * layout properties.
 *
 * A mobile performance trace of the homepage found a layout-shift cluster whose
 * root cause was non-composited animations of padding / font-size /
 * letter-spacing / border on buttons + nav links: when those elements reflow
 * during load, a blanket `transition: all` animates their geometry over 200ms,
 * generating a per-frame shift burst. web.dev's guidance is to never transition
 * layout properties — so we scope every offending `transition: all` down to
 * compositor/paint-safe properties (transform, opacity, colours, shadow).
 *
 * Two sources are neutralised here, both update-unsafe (parent theme + plugin),
 * so the fixes live in the child theme. This sheet is enqueued AFTER both the
 * `greyd-theme` and `greyd-animation-public-style` handles (see
 * greyd_child_anim_cls_fix() in functions.php); the overrides match the original
 * selectors' specificity and win on source order.
 */

/* ============================================================
 * 1. Core / Greyd buttons + nav button-links
 *    Source: greyd-theme/assets/css/theme.css (`transition: all .2s ease`).
 *    Buttons animate padding/font-size/letter-spacing/border on load reflow.
 *    Restrict to what buttons actually transition on hover.
 * ============================================================ */
.wp-block-button__link,
button[type="submit"],
input[type="submit"],
.button,
.wp-block-search .wp-block-search__button,
.wp-block-file .wp-block-file__button,
.wp-block-navigation[class*="is-style-button"] .wp-block-navigation-item .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-item[class*="is-style-button"] .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-item.is-style-button-fill.is-style-button-fill .wp-block-navigation-item__content,
.wp-block-navigation .wp-block-navigation-submenu .wp-block-navigation-item.is-style-button-fill .wp-block-navigation-item__content {
	transition-property: background-color, background, color, border-color, box-shadow, transform, opacity;
}

/* ============================================================
 * 2. Greyd scroll-animation feature fallback
 *    Source: greyd-plugin/src/features/animations/style.css:8
 *    `[data-anim-action] { transition-property: all }`. Not used on the homepage
 *    but present on pages built with Greyd animation blocks — same failure mode.
 *    Named presets already scope correctly and are re-asserted so the new base
 *    (same 0,1,0 specificity, later source) doesn't clobber them.
 * ============================================================ */
[data-anim-action] {
	transition-property: transform, opacity;
}

[data-anim-action="changeColor"] {
	transition-property: color, background;
}

[data-anim-action="translateX"],
[data-anim-action="translateY"],
[data-anim-action="scale"],
[data-anim-action="rotate"] {
	transition-property: transform;
}

[data-anim-action="filter"] {
	transition-property: filter;
}

[data-anim-action="show"],
[data-anim-action="hide"] {
	transition: none;
}
