/* =========================================================
   Sponsor wall styling
   Targets the standard `## Heading` + `{{< img >}}` pattern
   used in content/sponsors.md without requiring extra
   markup. Scoped via :has() so floated logos elsewhere
   (_index.md, getInvolved.md) are unaffected.
   ========================================================= */

/* Section heading with flanking gradient lines, e.g. ── HEADING ──
   Only applied when the section actually contains logo tiles, so
   ordinary article h2s elsewhere on the site keep their default look. */
.post__content:has(> p > a > img:only-child:not([style*="float"])) h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    text-align: center;
    margin: 3.5rem auto 2rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 1.35rem;
}

.post__content:has(> p > a > img:only-child:not([style*="float"])) h2::before,
.post__content:has(> p > a > img:only-child:not([style*="float"])) h2::after {
    content: "";
    flex: 0 1 90px;
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--color-accent2) 50%,
        var(--color-accent1) 100%);
    border-radius: 1px;
}

/* Mirror the gradient on the trailing line so it reads outward
   on both sides (cyan near text, magenta at the far end). */
.post__content:has(> p > a > img:only-child:not([style*="float"])) h2::before {
    background: linear-gradient(90deg,
        var(--color-accent1) 0%,
        var(--color-accent2) 50%,
        transparent 100%);
}

/* Sponsor logo row: any paragraph in post content whose only
   child is an <a><img></a> with no inline float. */
.post__content p:has(> a > img:only-child:not([style*="float"])) {
    display: inline-block;
    vertical-align: middle;
    margin: 1.25rem 1.5rem;
    text-align: center;
}

/* Group the logo paragraphs into a centered "wall" by
   centering their parent's inline content. Scoped to exclude
   floated logos so other pages aren't affected. */
.post__content:has(> p > a > img:only-child:not([style*="float"])) {
    text-align: center;
}

/* Re-left-align text-only paragraphs and lists so we don't
   center body copy by accident. */
.post__content > p,
.post__content > ul,
.post__content > ol {
    text-align: left;
}

/* But keep the logo paragraphs centered. */
.post__content > p:has(> a > img:only-child:not([style*="float"])) {
    text-align: center;
}

/* Logo tile — fixed-size frame that normalizes the visual
   weight of logos with different aspect ratios. The image
   inside scales to fit (object-fit: contain) so wide and
   square logos read as the same "size". Tier is detected
   from the existing width="500" / width="300" attributes
   on the shortcode-emitted <img>, so the markdown stays
   header + {{< img >}} only. */
.post__content p > a:has(> img:only-child:not([style*="float"])) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.025);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: transform 200ms ease, box-shadow 200ms ease,
                background-color 200ms ease, border-color 200ms ease;
}

/* Leading-tier tile (shortcode used width="500"). */
.post__content p > a:has(> img[width="500"]:only-child:not([style*="float"])) {
    width: 320px;
    height: 160px;
}

/* Contributing-tier tile (shortcode used width="300"). */
.post__content p > a:has(> img[width="300"]:only-child:not([style*="float"])) {
    width: 220px;
    height: 110px;
}

.post__content p > a:has(> img:only-child:not([style*="float"])):hover {
    transform: translateY(-3px);
    background-color: rgba(255, 255, 255, 0.05);
    border-color: color-mix(in srgb, var(--color-accent2) 55%, transparent);
    /* color-mix gives the accent colors a low alpha for the glow
       while still tracking whatever the theme defines them as. */
    box-shadow: 0 6px 24px color-mix(in srgb, var(--color-accent1) 18%, transparent),
                0 2px 8px color-mix(in srgb, var(--color-accent2) 12%, transparent);
}

/* Logos scale to fit the tile without distortion, regardless
   of their native aspect ratio. The width/height attributes
   from the shortcode are overridden by these rules. */
.post__content p > a > img:only-child:not([style*="float"]) {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* Tighten the horizontal rules used between sponsor tiers. */
.post__content hr {
    max-width: 60%;
    margin: 2.5rem auto;
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* Mobile: stack logos and shrink leading tiles a bit so
   they don't blow past the viewport. */
@media (max-width: 600px) {
    .post__content p:has(> a > img:only-child:not([style*="float"])) {
        display: block;
        margin: 1rem auto;
    }
    .post__content p > a:has(> img[width="500"]:only-child:not([style*="float"])) {
        width: 260px;
        height: 130px;
    }
}
