/* Client logo hover: a single restrained state with no lift, clone, glow or pulse. */
html body.light-theme .client-logo,
html body.light-theme .client-logo:is(:hover, :focus-visible, :focus-within) {
    transform: none !important;
    filter: none !important;
    box-shadow: none !important;
    background: transparent !important;
}

html body.light-theme .client-logo::before,
html body.light-theme .client-logo::after,
html body.light-theme .rp-contour-leak {
    display: none !important;
    content: none !important;
    animation: none !important;
}

html body.light-theme .client-logo .rp-logo-filter-wrap {
    display: flex;
    width: 100%;
    min-width: 0;
    align-items: center;
    justify-content: center;
    line-height: 0;
    transform: none !important;
    animation: none !important;
    filter: none !important;
}

html body.light-theme .client-logo img {
    transform: none !important;
    animation: none !important;
    transition: filter .2s ease, opacity .2s ease !important;
}

html body.light-theme .client-logo:is(:hover, :focus-visible, :focus-within) img {
    transform: none !important;
    animation: none !important;
    filter: grayscale(1) brightness(0) !important;
    opacity: 1 !important;
}

/* The dark-theme baseline makes client marks light; the hover state must
   still resolve to solid black exactly as requested. */
html[data-theme] body.light-theme .client-logo.client-logo:is(:hover, :focus-visible, :focus-within) img,
html[data-theme="dark"] body.light-theme .client-logo.client-logo:is(:hover, :focus-visible, :focus-within) img {
    filter: grayscale(1) brightness(0) !important;
    opacity: 1 !important;
}

/* Remove the former contour treatment from software, model and brand marks too. */
html body.light-theme :is(.ai-logo, .tool-item, .case-tool, .case-pipeline-list, .prompt-library-index-brand, .rp-brand) .rp-contour-leak {
    display: none !important;
    content: none !important;
    animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
    html body.light-theme .client-logo img {
        transition: none !important;
    }
}

/* A restrained diagonal reflection for every Rafał Pawlik mark. The helper
   element is positioned by logo-glow.js exactly over the source image, so the
   sweep never affects the adjacent label or changes the layout. */
:is(
    .rp-brand,
    .contact-vcard-mark,
    .rp-footer-vcard-mark,
    .ai-contact-vcard-mark
).rp-contour-host {
    position: relative;
    isolation: isolate;
}

html body :is(
    .rp-brand,
    .contact-vcard-mark,
    .rp-footer-vcard-mark,
    .ai-contact-vcard-mark
).rp-contour-host > .rp-contour-leak {
    position: absolute;
    z-index: 2;
    left: var(--rp-contour-left, 0);
    top: var(--rp-contour-top, 0);
    display: block !important;
    width: var(--rp-contour-width, 0);
    height: var(--rp-contour-height, 0);
    overflow: hidden;
    pointer-events: none;
    background: transparent;
    content: normal !important;
    animation: none !important;
}

html body :is(
    .rp-brand,
    .contact-vcard-mark,
    .rp-footer-vcard-mark,
    .ai-contact-vcard-mark
) > .rp-contour-leak::before {
    position: absolute;
    inset: -115%;
    display: block;
    background: linear-gradient(
        135deg,
        transparent 34%,
        rgba(255, 255, 255, .015) 40%,
        rgba(255, 255, 255, .07) 45%,
        rgba(255, 255, 255, .27) 50%,
        rgba(219, 237, 255, .1) 56%,
        rgba(255, 255, 255, .02) 61%,
        transparent 67%
    );
    content: "";
    filter: blur(4px);
    mix-blend-mode: screen;
    opacity: 0;
    transform: translate3d(-46%, 46%, 0);
    will-change: transform, opacity;
}

@media (hover: hover) and (pointer: fine) {
    html body :is(
        .rp-brand,
        .contact-vcard-mark,
        .rp-footer-vcard-mark,
        .ai-contact-vcard-mark
    ) > .rp-contour-source:hover ~ .rp-contour-leak::before {
        animation: rp-brand-light-sweep 1080ms cubic-bezier(.22, .72, .26, 1) both;
    }
}

html body :is(
    .rp-brand:focus-visible,
    .contact-vcard:focus-visible .contact-vcard-mark,
    .rp-footer-vcard:focus-visible .rp-footer-vcard-mark,
    .ai-contact-vcard:focus-visible .ai-contact-vcard-mark
) > .rp-contour-leak::before {
    animation: rp-brand-light-sweep 1080ms cubic-bezier(.22, .72, .26, 1) both;
}

@keyframes rp-brand-light-sweep {
    0% {
        opacity: 0;
        transform: translate3d(-46%, 46%, 0);
    }
    20% { opacity: .68; }
    76% { opacity: .48; }
    100% {
        opacity: 0;
        transform: translate3d(46%, -46%, 0);
    }
}

@media (prefers-reduced-motion: reduce) {
    html body :is(
        .rp-brand,
        .contact-vcard-mark,
        .rp-footer-vcard-mark,
        .ai-contact-vcard-mark
    ) > .rp-contour-leak::before {
        display: none;
        animation: none !important;
    }
}
