/* ============================================================
   image-figure.css — framed, captioned image
   ============================================================
   A framed image with its caption — e.g. the project page's image
   gallery items. The component owns only the ITEM; the deck layout
   comes from the shared grid (`.grid--4` on the wrapper block,
   layout.css §4), so image decks and card decks are one system.
   Rendered as <figure> + <figcaption> in the template.
   Conventions: _shared/bricks-builder/css-conventions.md

   Last updated: 2026-10-12 (auto-stamped by the pre-commit hook)
   ============================================================ */
.image-figure {
    display: flex;
    flex-direction: column;
    align-items: center;   /* centre the caption block (beats Basic Text's default align) */
    gap: var(--space-s);
    margin: 0;
    text-align: center;
}

/* Every image shows in the same 3:2 frame, so a mixed set lines up
   neatly. Upload guidance (format, sizes, logos) lives on the ACF
   field. The thin frame line must stay `outline`, not border — it has
   to lie on top of the image itself. */
.image-figure img {
    inline-size: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    background-color: var(--surface-base);
    outline: var(--border-width-base) solid var(--border-media);
    outline-offset: calc(-1 * var(--border-width-base));
    border-radius: var(--radius-3);
    display: block;
}

/* Lightbox link around the image (Bricks wraps the image in an <a>
   when it opens in a lightbox). Block-level so no stray inline gap;
   zoom-in cursor signals "click to enlarge". */
.image-figure a {
    display: block;
    inline-size: 100%;
    cursor: zoom-in;
}

/* A clickable figure (lightbox link present) gets the card elevation
   ramp: resting shadow marks it interactive, hover lifts, press settles
   back — same rule as cards, shadow = clickable. A linkless figure
   stays flat. The card's dark-mode overlay lightening can't show on a
   photo, so the shadow carries the states alone. */
.image-figure:has(a) img {
    box-shadow: var(--elevation-card);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.image-figure a:hover img {
    box-shadow: var(--elevation-card-hover);
    transform: translateY(calc(-1 * var(--lift-hover)));   /* rises with the shadow (tokens.css §6) */
}
.image-figure a:active img {
    box-shadow: var(--elevation-card);
    transform: none;
}

/* Keyboard focus lifts the image like hover; the house ring (§6.5) is
   drawn by Bricks on the link, which wraps the image. */
.image-figure a:focus-visible img {
    box-shadow: var(--elevation-card-hover);
    transform: translateY(calc(-1 * var(--lift-hover)));
}

/* Reduced motion: the shadow still deepens, the image stays put. */
@media (prefers-reduced-motion: reduce) {
    .image-figure a:is(:hover, :focus-visible) img {
        transform: none;
    }
}

.image-figure-caption {
    font-size: var(--text-s);
    color: var(--text-base);
    text-align: center;
}
