/* =========================================================
   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;
    }
}

/* Sessionize schedule — match the row time labels (e.g. "10:55 am") to
   the session-title color. Sessionize's wrapper sets `color:#111` so the
   labels inherit dark text and disappear against the dark page; session
   titles render in `#EEE` because they inherit from `.sz-session__card`.
   Peg the labels to the same `#EEE` so the two read as one color. */
#sessionize .sz-cssgrid__time-label {
    color: #EEE;
}

/* Rounded-square container (used by the {{< box >}} shortcode, e.g. the
   parking info on the home page). A subtle bordered panel with rounded
   corners so a block of related info reads as one grouped unit. */
.rounded-box {
    /* flow-root makes the box enclose its floated image so the map
       stays inside the border even when the text is shorter than it. */
    display: flow-root;
    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);
    padding: 1.25rem 1.75rem;
    margin: 1.5rem 0;
}

/* Trim the stray top/bottom margins on the first/last child so the
   padding does the spacing and the panel stays balanced. */
.rounded-box > :first-child {
    margin-top: 0;
}

.rounded-box > :last-child {
    margin-bottom: 0;
}

/* The body wrapper holds the markdown text; trim its first/last
   child margins too so the floated image lines up with the heading. */
.rounded-box .box-body > :first-child {
    margin-top: 0;
}

.rounded-box .box-body > :last-child {
    margin-bottom: 0;
}

/* Floated, click-to-expand thumbnail. Text wraps alongside it. */
.box-img {
    display: block;
    max-width: 42%;
    margin: 0.25rem 0 1rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    overflow: hidden;
    cursor: zoom-in;
    transition: transform 200ms ease, box-shadow 200ms ease,
                border-color 200ms ease;
}

.box-img--right {
    float: right;
}

.box-img--left {
    float: left;
    margin: 0.25rem 1.5rem 1rem 0;
}

.box-img img {
    display: block;
    width: 100%;
    height: auto;
}

.box-img:hover {
    transform: translateY(-2px);
    border-color: color-mix(in srgb, var(--color-accent2) 55%, transparent);
    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);
}

/* CSS-only lightbox: hidden until its #id is the :target (clicking the
   thumbnail). Clicking the dimmed backdrop (href="#") closes it. */
.box-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    padding: 4vmin;
    background: rgba(0, 0, 0, 0.85);
    cursor: zoom-out;
    align-items: center;
    justify-content: center;
}

.box-lightbox:target {
    display: flex;
}

.box-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* On narrow screens, stack the image above the text full-width. */
@media (max-width: 600px) {
    .box-img,
    .box-img--right,
    .box-img--left {
        float: none;
        max-width: 100%;
        margin: 0 0 1rem 0;
    }
}
