/*
 * CAE media bindings — shared idiom for compiler-emitted media sections.
 * Introduced for the Hardwick Farmers Market one-shot
 * (docs/soft-state/cae/farmersmarket2/REPRODUCE.md).
 *
 * Every selector is keyed on cae-mb-* classes stamped by
 * inc/cae-media-bindings.php from assets/media-bindings.json, so this sheet
 * is inert on every page that has no stamped bindings. All px values are
 * design px: inside the compiler's zoom shell 1 css px = 1 design px.
 */

/* --- Instagram feed band (column 13760-14270) ---------------------------- */

.cae-mb-feed-band {
    padding-bottom: 16px;
}

/*
 * The compiler emits the band children in DOM order tiles -> header ->
 * actions while the design draws header (y 55), tiles (y 152) and hangs the
 * Follow Us pill inside the header at (1176, 51.5). order + margins
 * reproduce the design without moving any node.
 */
.cae-mb-feed-band .cae-mb-feed-header {
    order: 1;
    height: 48px;
    margin-top: 55px;
    margin-bottom: 0;
    align-items: flex-start;
}

.cae-mb-feed-band .cae-mb-feed-grid {
    order: 2;
    flex: 0 0 100%;
    display: flex;
    margin-top: 49px;
    margin-bottom: 0;
}

.cae-mb-feed-band .cae-mb-feed-grid > * {
    flex: 0 0 25%;
    margin: 0;
}

.cae-mb-feed-band .cae-mb-feed-grid figure {
    aspect-ratio: 360 / 393;
}

.cae-mb-feed-band .cae-mb-feed-grid img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/*
 * The actions wrapper is a direct child of the band, so it anchors to the
 * same canvas content box as the decor strip. The header row is centered by
 * its own auto margins, so calc(50% - 600px) puts the pill's right edge on
 * the row's right edge at every canvas width (the percentage basis is the
 * containing block's padding box, and the row's half-width is 600px).
 */
.cae-mb-feed-band .cae-mb-actions {
    position: absolute;
    top: 51.5px;
    right: calc(50% - 600px);
    margin: 0;
    order: 3;
}

/* Below the 1200-design-point canvas the calc would overflow the band;
 * fall back to the compiler's own full-width actions row there. */
@media (max-width: 959px) {
    .cae-mb-feed-band .cae-mb-actions {
        position: static;
        flex: 0 0 100%;
        margin: 24px 0 0;
    }
}

/* --- Instagram feed in the band (lane hfmfeed-1019, Kate 869f4kjh9) ------- */

/*
 * inc/cae-instagram.php cae_instagram_band_grid() replaces the drawn tile run
 * with the account's posts (.cae-ig-band). With posts: each post sits in the
 * drawn figure's box (the rules above keep 25% / 360:393), the link fills it,
 * and the "coming soon" label goes (the feed is live). No posts on any tier
 * (.cae-ig-empty): the placeholder pictures are gone, the grid keeps the
 * four-tile box (4 x 360:393 = 1440:393, capped at the tiles' 393 px height
 * as the composition sheet caps them) on the band's own ground, and the label
 * plus the "Follow <account> on Instagram" link stack in its centre.
 */
.cae-mb-feed-band .cae-mb-feed-grid .cae-ig-post__link {
    display: block;
    width: 100%;
    height: 100%;
}

.cae-mb-feed-band .cae-mb-feed-grid.cae-ig-band:not(.cae-ig-empty)::after {
    content: none;
}

.cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty {
    aspect-ratio: 1440 / 393;
    max-height: 393px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty::after {
    position: static;
    transform: none;
    order: -1;
    flex: 0 0 auto;
}

.cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty .cae-ig-empty__caption {
    flex: 0 0 auto;
    max-width: calc(100% - 32px);
    margin: 0;
    font-family: var(--wp--preset--font-family--acumin-pro, "Acumin Pro", sans-serif);
    font-size: 24px;
    line-height: 32px;
    font-weight: 600;
    text-align: center;
}

.cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty .cae-ig-empty__link {
    color: var(--wp--preset--color--primary-evergreen, #004F39);
    text-decoration: underline;
    text-underline-offset: 0.15em;
}

@media (max-width: 599.98px) {
    .cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty {
        gap: 12px;
    }

    .cae-mb-feed-band .cae-mb-feed-grid.cae-ig-empty .cae-ig-empty__caption {
        font-size: 18px;
        line-height: 26px;
    }
}

/* --- Video click-to-play (column 13760-14283) ---------------------------- */

/*
 * The poster figure is already position:absolute at the exact design box,
 * so the iframe fills it pixel-identically.
 */
.cae-mb-video-embed {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/*
 * The compiler's drawn image emission sets pointer-events:none on the
 * poster figure; re-enable it on the stamped anchors so the delegated
 * click handler fires and the no-JS drawn link still navigates.
 */
.cae-mb-video-trigger {
    pointer-events: auto;
}

/* --- Instagram feed placeholder label (ClickUp 869f4kjh9) ---------------- */

/*
 * Kate 2026-10-18 18:55Z (verbatim): "Can you put a label over the image
 * thumbnails that tells the client that the live integration is coming
 * soon". The tiles are still the drawn placeholder pictures, so every
 * stamped feed band labels its tile run until a live feed replaces it. The
 * label is decoration on the run (pointer-events none: nothing about the
 * tiles' links or clicks changes) and sits centred over the thumbnails.
 */
.cae-mb-feed-band .cae-mb-feed-grid {
    position: relative;
}

.cae-mb-feed-band .cae-mb-feed-grid::after {
    content: "Live Instagram feed coming soon";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
    box-sizing: border-box;
    max-width: calc(100% - 32px);
    padding: 12px 28px;
    border-radius: 999px;
    background: rgba(0, 79, 57, 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    color: #fff;
    font-family: var(--wp--preset--font-family--acumin-pro, "Acumin Pro", sans-serif);
    font-size: 24px;
    line-height: 32px;
    font-weight: 700;
    text-align: center;
    white-space: normal;
}

@media (max-width: 599.98px) {
    .cae-mb-feed-band .cae-mb-feed-grid::after {
        padding: 8px 16px;
        font-size: 16px;
        line-height: 24px;
        width: max-content;
    }
}
