/*
 * Gini generated covers: the hero crop.
 *
 * Why this file exists
 * --------------------
 * `templates/partials/hero-post.php` and `templates/blocks/case-hero/case-hero.php`
 * render the featured image into `figure.aspect-64/20`, which is 3.2:1, and the
 * compiled theme stylesheet fills it with
 *
 *     figure > img:first-of-type { width:100%; height:100%; object-fit:cover }
 *
 * That rule sets no `object-position`, and the theme sets one nowhere else
 * either, so the browser falls back to the initial value of 50%. At 50% the tops
 * of the curves are sliced flat and a band of white sits under the baseline.
 *
 * The arithmetic, which is the whole reason for the number below
 * -------------------------------------------------------------
 * A cover master is 1500x1000, so 1.5:1. Dropped into a 3.2:1 box under
 * `object-fit: cover` the width fills and the height is cropped:
 *
 *     visible fraction of the master's height   f = 1.5 / 3.2 = 0.469
 *     vertical overflow                         1 - f         = 0.531
 *     window for a given object-position P      y from P * 0.531
 *                                                 to P * 0.531 + 0.469
 *
 * The artwork occupies y 0.22 (the curve peaks) to y 0.66 (the baseline), a span
 * of 0.440 inside a window of 0.469. Three values, of which only the last works:
 *
 *     P = 50.0%  ->  0.266 to 0.734   peaks clipped by 0.046
 *     P = 32.0%  ->  0.170 to 0.639   baseline clipped by 0.021
 *     P = 38.7%  ->  0.206 to 0.674   both clear
 *
 * Note how little room there is. The slack is 0.469 - 0.440 = 0.029 in total,
 * so 0.0145 at each end, about 14px on the master. Centring the artwork in the
 * window is therefore not a preference, it is the only setting where neither end
 * is cut, and solving for it gives P = 38.71%.
 *
 * Do not change this to 32%
 * -------------------------
 * The article treatment's `.cover-art` in the theme's `css/gini-article.css` does
 * read `background-position: center 32%`, and that value is correct there and
 * wrong here. `.cover-art` is a background on a variable-height hero,
 * `min-height: clamp(420px, 62vh, 680px)` at full container width, so its
 * effective ratio is nothing like 3.2:1 and its crop window is a different shape
 * entirely. The two heroes crop differently because their boxes differ. This
 * value is derived from this box's own ratio and transfers from nowhere.
 *
 * Why the src is part of the selector
 * ----------------------------------
 * A photographic featured image that somebody set by hand has no reason to be
 * shifted off centre, and shifting it would be a visible regression on any post
 * that has one. Matching on `gini-cover-` in the src moves the generated covers
 * and nothing else. The heroes ask `wp_get_attachment_image()` for size `full`,
 * which this plugin's `image_downsize` filter deliberately declines, so a hero
 * always resolves to the attachment's own URL and that URL carries the filename.
 *
 * Why the cards are not here
 * --------------------------
 * They are not broken, and adding them would break them. An insight card reads
 * the separate `-card.svg` variant, which is composed for 1.4:1 at ordinary 50%
 * centring, and the case study card at 52/24 is better balanced centred than
 * shifted. Only the two heroes crop the master at 3.2:1, so only the two heroes
 * appear below. Please do not "complete" this rule by adding `.post-card` or
 * `.case-study-card` to it.
 */

.article-hero figure img[src*="gini-cover-"],
.case-hero figure img[src*="gini-cover-"] {
	object-position: center 38.7%;
}
